diff --git a/DEPS b/DEPS index 50031d3..5030d02 100644 --- a/DEPS +++ b/DEPS
@@ -74,11 +74,11 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': '9daae51c4ad84b1d6364a7f6415621f12b232a41', + 'skia_revision': '9eedea7c507569212bb5d4b45425ac751467da10', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'v8_revision': '6c8aaa8d8aeb2e8f99c121ed98c8752c98b1fbb6', + 'v8_revision': '7f26ff952e63216b6c01311761b8bc9bbf402fff', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling swarming_client # and whatever else without interference from each other. @@ -86,7 +86,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling ANGLE # and whatever else without interference from each other. - 'angle_revision': '9af765dd2e4463242df8175f74d7a99af6f31cb1', + 'angle_revision': '9d4d7f06facbe5db0f178be7b4126d6072d4ee69', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling build tools # and whatever else without interference from each other. @@ -98,7 +98,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other. - 'pdfium_revision': '604f5b9e042267cffd8949f309a86c370a3d01d4', + 'pdfium_revision': 'd92073b756277d2d4c9c839dd5ac8fa0e8bb9e28', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling openmax_dl # and whatever else without interference from each other. @@ -130,7 +130,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': '97e6e42e3e392136a2a67b41768c3e14deec5c3b', + 'catapult_revision': '846f7660e7d5004afac6052a9d7905695bc1edb7', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other. @@ -323,7 +323,7 @@ }, 'src/third_party/depot_tools': - Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '0afcd104300db48c3d996e19d8c450272eff703e', + Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '41d9d87e9653e46166db0e97a184c801a28d75e3', # DevTools node modules. Used on Linux buildbots only. 'src/third_party/devtools-node-modules': { @@ -404,7 +404,7 @@ Var('chromium_git') + '/chromium/deps/hunspell_dictionaries.git' + '@' + 'a9bac57ce6c9d390a52ebaad3259f5fdb871210e', 'src/third_party/icu': - Var('chromium_git') + '/chromium/deps/icu.git' + '@' + 'e3b480d3be4446ea17011c0cdc9c4cd380a5c58f', + Var('chromium_git') + '/chromium/deps/icu.git' + '@' + '94d819fa3e7e71f3dd8210d428c213ddb6e2b336', 'src/third_party/jsoncpp/source': Var('chromium_git') + '/external/github.com/open-source-parsers/jsoncpp.git' + '@' + 'f572e8e42e22cfcf5ab0aea26574f408943edfa4', # from svn 248 @@ -474,7 +474,7 @@ }, 'src/third_party/libvpx/source/libvpx': - Var('chromium_git') + '/webm/libvpx.git' + '@' + '14dbdd95e686eafbe556c154c9e0bd76fe1d2d1a', + Var('chromium_git') + '/webm/libvpx.git' + '@' + 'cbe62b9c2d2b006aba52c8eebe7d842e59166fe4', 'src/third_party/libwebm/source': Var('chromium_git') + '/webm/libwebm.git' + '@' + '4956b2dec65352af32dc71bab553acb631c64177',
diff --git a/PRESUBMIT.py b/PRESUBMIT.py index a01cc0f..3f61dedd 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py
@@ -2759,6 +2759,27 @@ return [] +def _CheckCrbugLinksHaveHttps(input_api, output_api): + """Checks that crbug(.com) links are correctly prefixed by https://""" + white_list = r'.+%s' % _IMPLEMENTATION_EXTENSIONS + black_list = (_EXCLUDED_PATHS + _TEST_CODE_EXCLUDED_PATHS) + sources = lambda f: input_api.FilterSourceFile( + f, white_list=white_list, black_list=black_list) + + pattern = input_api.re.compile(r'//.*(?<!:\/\/)crbug[.com]*') + problems = [] + for f in input_api.AffectedSourceFiles(sources): + for line_num, line in f.ChangedContents(): + if pattern.search(line): + problems.append(' %s:%d %s' % (f.LocalPath(), line_num, line)) + + if problems: + return [output_api.PresubmitPromptWarning( + 'Found unprefixed crbug.com URL(s), consider prepending https://\n'+ + '\n'.join(problems))] + return [] + + def CheckChangeOnUpload(input_api, output_api): results = [] results.extend(_CommonChecks(input_api, output_api)) @@ -2769,6 +2790,7 @@ results.extend(_AndroidSpecificOnUploadChecks(input_api, output_api)) results.extend(_CheckSyslogUseWarning(input_api, output_api)) results.extend(_CheckGoogleSupportAnswerUrl(input_api, output_api)) + results.extend(_CheckCrbugLinksHaveHttps(input_api, output_api)) return results
diff --git a/PRESUBMIT_test.py b/PRESUBMIT_test.py index a18d9234..bb22f8c 100755 --- a/PRESUBMIT_test.py +++ b/PRESUBMIT_test.py
@@ -1288,5 +1288,22 @@ self.assertEqual([], errors) +class CrbugUrlFormatTest(unittest.TestCase): + + def testCheckCrbugLinksHaveHttps(self): + input_api = MockInputApi() + input_api.files = [ + MockFile('somewhere/file.cc', + ['// TODO(developer): crbug.com should be linkified', + '// TODO(developer): (crbug.com) should be linkified', + '// TODO(developer): crbug/123 should be well formed', + '// TODO(developer): http://crbug.com it\'s OK', + '// TODO(developer): https://crbug.com is just great']), + ] + + warnings = PRESUBMIT._CheckCrbugLinksHaveHttps(input_api, MockOutputApi()) + self.assertEqual(1, len(warnings)) + + if __name__ == '__main__': unittest.main()
diff --git a/android_webview/browser/DEPS b/android_webview/browser/DEPS index ce72a720..e9c2f5f5 100644 --- a/android_webview/browser/DEPS +++ b/android_webview/browser/DEPS
@@ -65,6 +65,9 @@ # AwContentBrowserClient::GetDefaultFavicon "!ui/resources/grit/ui_resources.h", + + # QuotaStatusCode required by AwQuotaManagerBridge. + "+third_party/WebKit/common/quota", # POD structure required by the find-in-page IPC messages. "+third_party/WebKit/public/web/WebFindOptions.h", # Interface required for in-process input event handling.
diff --git a/android_webview/browser/aw_contents.cc b/android_webview/browser/aw_contents.cc index 4f65783..e0b3f60a 100644 --- a/android_webview/browser/aw_contents.cc +++ b/android_webview/browser/aw_contents.cc
@@ -77,6 +77,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/common/mhtml_generation_params.h" #include "content/public/common/renderer_preferences.h" +#include "content/public/common/use_zoom_for_dsf_policy.h" #include "gpu/config/gpu_info.h" #include "jni/AwContents_jni.h" #include "net/base/auth.h" @@ -1177,8 +1178,13 @@ ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); if (obj.is_null()) return; + gfx::Size contents_size_css = + content::UseZoomForDSFEnabled() + ? ScaleToCeiledSize(contents_size, + 1 / browser_view_renderer_.dip_scale()) + : contents_size; Java_AwContents_onWebLayoutContentsSizeChanged( - env, obj, contents_size.width(), contents_size.height()); + env, obj, contents_size_css.width(), contents_size_css.height()); } jlong AwContents::CapturePicture(JNIEnv* env,
diff --git a/android_webview/browser/aw_contents.h b/android_webview/browser/aw_contents.h index aa92495..ffb1ba7 100644 --- a/android_webview/browser/aw_contents.h +++ b/android_webview/browser/aw_contents.h
@@ -281,7 +281,10 @@ void PostInvalidate() override; void OnNewPicture() override; gfx::Point GetLocationOnScreen() override; + + // |new_value| is in physical pixel scale. void ScrollContainerViewTo(const gfx::Vector2d& new_value) override; + void UpdateScrollState(const gfx::Vector2d& max_scroll_offset, const gfx::SizeF& contents_size_dip, float page_scale_factor,
diff --git a/android_webview/browser/aw_cookie_access_policy.cc b/android_webview/browser/aw_cookie_access_policy.cc index e2562ee..d7e564c 100644 --- a/android_webview/browser/aw_cookie_access_policy.cc +++ b/android_webview/browser/aw_cookie_access_policy.cc
@@ -9,6 +9,7 @@ #include "android_webview/browser/aw_contents_io_thread_client.h" #include "base/logging.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/render_frame_host.h" #include "content/public/browser/resource_request_info.h" #include "content/public/browser/websocket_handshake_request_info.h" #include "net/base/net_errors.h" @@ -48,9 +49,14 @@ bool AwCookieAccessPolicy::GetShouldAcceptThirdPartyCookies( int render_process_id, - int render_frame_id) { + int render_frame_id, + int frame_tree_node_id) { std::unique_ptr<AwContentsIoThreadClient> io_thread_client = - AwContentsIoThreadClient::FromID(render_process_id, render_frame_id); + (frame_tree_node_id != content::RenderFrameHost::kNoFrameTreeNodeId) + ? AwContentsIoThreadClient::FromID(frame_tree_node_id) + : AwContentsIoThreadClient::FromID(render_process_id, + render_frame_id); + if (!io_thread_client) { return false; } @@ -60,20 +66,23 @@ bool AwCookieAccessPolicy::GetShouldAcceptThirdPartyCookies( const net::URLRequest& request) { int child_id = 0; - int frame_id = 0; + int render_frame_id = 0; + int frame_tree_node_id = content::RenderFrameHost::kNoFrameTreeNodeId; const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(&request); if (info) { child_id = info->GetChildID(); - frame_id = info->GetRenderFrameID(); + render_frame_id = info->GetRenderFrameID(); + frame_tree_node_id = info->GetFrameTreeNodeId(); } else { const WebSocketHandshakeRequestInfo* websocket_info = WebSocketHandshakeRequestInfo::ForRequest(&request); if (!websocket_info) return false; child_id = websocket_info->GetChildId(); - frame_id = websocket_info->GetRenderFrameId(); + render_frame_id = websocket_info->GetRenderFrameId(); } - return GetShouldAcceptThirdPartyCookies(child_id, frame_id); + return GetShouldAcceptThirdPartyCookies(child_id, render_frame_id, + frame_tree_node_id); } bool AwCookieAccessPolicy::OnCanGetCookies(const net::URLRequest& request, @@ -100,8 +109,9 @@ int render_process_id, int render_frame_id) { bool global = GetShouldAcceptCookies(); - bool thirdParty = - GetShouldAcceptThirdPartyCookies(render_process_id, render_frame_id); + bool thirdParty = GetShouldAcceptThirdPartyCookies( + render_process_id, render_frame_id, + content::RenderFrameHost::kNoFrameTreeNodeId); return AwStaticCookiePolicy(global, thirdParty).AllowGet(url, first_party); } @@ -113,8 +123,9 @@ int render_frame_id, const net::CookieOptions& options) { bool global = GetShouldAcceptCookies(); - bool thirdParty = - GetShouldAcceptThirdPartyCookies(render_process_id, render_frame_id); + bool thirdParty = GetShouldAcceptThirdPartyCookies( + render_process_id, render_frame_id, + content::RenderFrameHost::kNoFrameTreeNodeId); return AwStaticCookiePolicy(global, thirdParty).AllowSet(url, first_party); }
diff --git a/android_webview/browser/aw_cookie_access_policy.h b/android_webview/browser/aw_cookie_access_policy.h index 32dd517..56fb8b4 100644 --- a/android_webview/browser/aw_cookie_access_policy.h +++ b/android_webview/browser/aw_cookie_access_policy.h
@@ -36,8 +36,12 @@ void SetShouldAcceptCookies(bool allow); // Can we read/write third party cookies? + // |render_process_id| and |render_frame_id| must be valid. + // Navigation requests are not associated with a renderer process. In this + // case, |frame_tree_node_id| must be valid instead. bool GetShouldAcceptThirdPartyCookies(int render_process_id, - int render_frame_id); + int render_frame_id, + int frame_tree_node_id); bool GetShouldAcceptThirdPartyCookies(const net::URLRequest& request); // These are the functions called when operating over cookies from the
diff --git a/android_webview/browser/aw_quota_manager_bridge.cc b/android_webview/browser/aw_quota_manager_bridge.cc index cfd15b7..48bd984f 100644 --- a/android_webview/browser/aw_quota_manager_bridge.cc +++ b/android_webview/browser/aw_quota_manager_bridge.cc
@@ -17,6 +17,7 @@ #include "jni/AwQuotaManagerBridge_jni.h" #include "storage/browser/quota/quota_manager.h" #include "storage/common/quota/quota_types.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" #include "url/gurl.h" using base::android::AttachCurrentThread; @@ -50,7 +51,7 @@ storage::StorageType type); void OnUsageAndQuotaObtained(const GURL& origin, - storage::QuotaStatusCode status_code, + blink::QuotaStatusCode status_code, int64_t usage, int64_t quota); @@ -105,13 +106,12 @@ CheckDone(); } -void GetOriginsTask::OnUsageAndQuotaObtained( - const GURL& origin, - storage::QuotaStatusCode status_code, - int64_t usage, - int64_t quota) { +void GetOriginsTask::OnUsageAndQuotaObtained(const GURL& origin, + blink::QuotaStatusCode status_code, + int64_t usage, + int64_t quota) { DCHECK_CURRENTLY_ON(BrowserThread::IO); - if (status_code == storage::kQuotaStatusOk) { + if (status_code == blink::QuotaStatusCode::kOk) { origin_.push_back(origin.spec()); usage_.push_back(usage); quota_.push_back(quota); @@ -274,11 +274,11 @@ void OnUsageAndQuotaObtained( const AwQuotaManagerBridge::QuotaUsageCallback& ui_callback, - storage::QuotaStatusCode status_code, + blink::QuotaStatusCode status_code, int64_t usage, int64_t quota) { DCHECK_CURRENTLY_ON(BrowserThread::IO); - if (status_code != storage::kQuotaStatusOk) { + if (status_code != blink::QuotaStatusCode::kOk) { usage = 0; quota = 0; }
diff --git a/android_webview/browser/browser_view_renderer.cc b/android_webview/browser/browser_view_renderer.cc index afb8e78..4052b973 100644 --- a/android_webview/browser/browser_view_renderer.cc +++ b/android_webview/browser/browser_view_renderer.cc
@@ -22,6 +22,7 @@ #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" #include "content/public/common/content_switches.h" +#include "content/public/common/use_zoom_for_dsf_policy.h" #include "gpu/command_buffer/service/gpu_switches.h" #include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkCanvas.h" @@ -656,15 +657,24 @@ void BrowserViewRenderer::UpdateRootLayerState( content::SynchronousCompositor* compositor, - const gfx::Vector2dF& total_scroll_offset_dip, - const gfx::Vector2dF& max_scroll_offset_dip, - const gfx::SizeF& scrollable_size_dip, + const gfx::Vector2dF& total_scroll_offset, + const gfx::Vector2dF& total_max_scroll_offset, + const gfx::SizeF& scrollable_size, float page_scale_factor, float min_page_scale_factor, float max_page_scale_factor) { if (compositor != compositor_) return; + gfx::Vector2dF total_scroll_offset_dip = total_scroll_offset; + gfx::Vector2dF max_scroll_offset_dip = total_max_scroll_offset; + gfx::SizeF scrollable_size_dip = scrollable_size; + if (content::UseZoomForDSFEnabled()) { + total_scroll_offset_dip.Scale(1 / dip_scale_); + max_scroll_offset_dip.Scale(1 / dip_scale_); + scrollable_size_dip.Scale(1 / dip_scale_); + } + TRACE_EVENT_INSTANT1( "android_webview", "BrowserViewRenderer::UpdateRootLayerState",
diff --git a/android_webview/browser/browser_view_renderer.h b/android_webview/browser/browser_view_renderer.h index 721dbcb0..fa566ca 100644 --- a/android_webview/browser/browser_view_renderer.h +++ b/android_webview/browser/browser_view_renderer.h
@@ -119,13 +119,18 @@ int routing_id) override; void PostInvalidate(content::SynchronousCompositor* compositor) override; void DidUpdateContent(content::SynchronousCompositor* compositor) override; + + // |total_scroll_offset|, |total_max_scroll_offset|, and |scrollable_size| are + // in DIP scale when --use-zoom-for-dsf is disabled. Otherwise, they are in + // physical pixel scale. void UpdateRootLayerState(content::SynchronousCompositor* compositor, - const gfx::Vector2dF& total_scroll_offset_dip, - const gfx::Vector2dF& max_scroll_offset_dip, - const gfx::SizeF& scrollable_size_dip, + const gfx::Vector2dF& total_scroll_offset, + const gfx::Vector2dF& total_max_scroll_offset, + const gfx::SizeF& scrollable_size, float page_scale_factor, float min_page_scale_factor, float max_page_scale_factor) override; + void DidOverscroll(content::SynchronousCompositor* compositor, const gfx::Vector2dF& accumulated_overscroll, const gfx::Vector2dF& latest_overscroll_delta,
diff --git a/android_webview/browser/hardware_renderer.cc b/android_webview/browser/hardware_renderer.cc index f73f97a..6cfd7a88 100644 --- a/android_webview/browser/hardware_renderer.cc +++ b/android_webview/browser/hardware_renderer.cc
@@ -272,7 +272,7 @@ constexpr bool is_root = false; constexpr bool needs_sync_points = true; support_.reset(); - support_ = viz::CompositorFrameSinkSupport::Create( + support_ = std::make_unique<viz::CompositorFrameSinkSupport>( this, surfaces_->GetFrameSinkManager(), frame_sink_id_, is_root, needs_sync_points); }
diff --git a/android_webview/browser/surfaces_instance.cc b/android_webview/browser/surfaces_instance.cc index 5727a5be..986ff36d 100644 --- a/android_webview/browser/surfaces_instance.cc +++ b/android_webview/browser/surfaces_instance.cc
@@ -60,7 +60,7 @@ constexpr bool is_root = true; constexpr bool needs_sync_points = true; - support_ = viz::CompositorFrameSinkSupport::Create( + support_ = std::make_unique<viz::CompositorFrameSinkSupport>( this, frame_sink_manager_.get(), frame_sink_id_, is_root, needs_sync_points);
diff --git a/android_webview/common/crash_reporter/crash_keys.cc b/android_webview/common/crash_reporter/crash_keys.cc index 33aae4e..e4887a86 100644 --- a/android_webview/common/crash_reporter/crash_keys.cc +++ b/android_webview/common/crash_reporter/crash_keys.cc
@@ -42,9 +42,6 @@ // media/: {kZeroEncodeDetails, kSmallSize}, - // Temporary for https://crbug.com/685996. - {"user-cloud-policy-manager-connect-trace", kMediumSize}, - // TODO(sunnyps): Remove after fixing crbug.com/724999. {"gl-context-set-current-stack-trace", kMediumSize}, };
diff --git a/android_webview/java/DEPS b/android_webview/java/DEPS index d18c9911..5e41f3c 100644 --- a/android_webview/java/DEPS +++ b/android_webview/java/DEPS
@@ -10,7 +10,6 @@ "-content/public/android/java", "+content/public/android/java/src/org/chromium/content_public", - "+content/public/android/java/src/org/chromium/content/common/ContentSwitches.java", "!content/public/android/java/src/org/chromium/content/browser/AppWebMessagePort.java", "!content/public/android/java/src/org/chromium/content/browser/BrowserStartupController.java", "!content/public/android/java/src/org/chromium/content/browser/ChildProcessCreationParams.java",
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 c3bfd64..f2f42008 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwContents.java +++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -2972,8 +2972,9 @@ } @CalledByNative - private void scrollContainerViewTo(int x, int y) { - mScrollOffsetManager.scrollContainerViewTo(x, y); + private void scrollContainerViewTo(int xPx, int yPx) { + // Both xPx and yPx are in physical pixel scale. + mScrollOffsetManager.scrollContainerViewTo(xPx, yPx); } @CalledByNative
diff --git a/android_webview/java/src/org/chromium/android_webview/AwLayoutSizer.java b/android_webview/java/src/org/chromium/android_webview/AwLayoutSizer.java index 6cee7d3..76f5af67 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwLayoutSizer.java +++ b/android_webview/java/src/org/chromium/android_webview/AwLayoutSizer.java
@@ -7,9 +7,6 @@ import android.view.View; import android.view.View.MeasureSpec; -import org.chromium.base.CommandLine; -import org.chromium.content.common.ContentSwitches; - /** * Helper methods used to manage the layout of the View that contains AwContents. */ @@ -20,8 +17,8 @@ private boolean mHeightMeasurementIsFixed; // Size of the rendered content, as reported by native. - private int mContentHeightDip; - private int mContentWidthDip; + private int mContentHeightCss; + private int mContentWidthCss; // Page scale factor. private float mPageScaleFactor = 1.0f; @@ -90,16 +87,9 @@ * Update the contents size. * This should be called whenever the content size changes (due to DOM manipulation or page * load, for example). - * The width and height should be in DIP pixels. When --use-zoom-for-dsf is disabled, the - * given width and height are in CSS pixels and we must scale them by DIP scale. */ - public void onContentSizeChanged(int width, int height) { - CommandLine commandLine = CommandLine.getInstance(); - if (!commandLine.hasSwitch(ContentSwitches.ENABLE_USE_ZOOM_FOR_DSF)) { - width = (int) (width * mDIPScale); - height = (int) (height * mDIPScale); - } - doUpdate(width, height, mPageScaleFactor); + public void onContentSizeChanged(int widthCss, int heightCss) { + doUpdate(widthCss, heightCss, mPageScaleFactor); } /** @@ -108,25 +98,25 @@ * example). */ public void onPageScaleChanged(float pageScaleFactor) { - doUpdate(mContentWidthDip, mContentHeightDip, pageScaleFactor); + doUpdate(mContentWidthCss, mContentHeightCss, pageScaleFactor); } - private void doUpdate(int widthDip, int heightDip, float pageScaleFactor) { + private void doUpdate(int widthCss, int heightCss, float pageScaleFactor) { // We want to request layout only if the size or scale change, however if any of the // measurements are 'fixed', then changing the underlying size won't have any effect, so we // ignore changes to dimensions that are 'fixed'. - final int heightPix = (int) (heightDip * mPageScaleFactor); + final int heightPix = (int) (heightCss * mPageScaleFactor * mDIPScale); boolean pageScaleChanged = mPageScaleFactor != pageScaleFactor; boolean contentHeightChangeMeaningful = !mHeightMeasurementIsFixed && (!mHeightMeasurementLimited || heightPix < mHeightMeasurementLimit); boolean pageScaleChangeMeaningful = !mWidthMeasurementIsFixed || contentHeightChangeMeaningful; - boolean layoutNeeded = (mContentWidthDip != widthDip && !mWidthMeasurementIsFixed) - || (mContentHeightDip != heightDip && contentHeightChangeMeaningful) + boolean layoutNeeded = (mContentWidthCss != widthCss && !mWidthMeasurementIsFixed) + || (mContentHeightCss != heightCss && contentHeightChangeMeaningful) || (pageScaleChanged && pageScaleChangeMeaningful); - mContentWidthDip = widthDip; - mContentHeightDip = heightDip; + mContentWidthCss = widthCss; + mContentHeightCss = heightCss; mPageScaleFactor = pageScaleFactor; if (layoutNeeded) { @@ -148,8 +138,8 @@ int widthMode = MeasureSpec.getMode(widthMeasureSpec); int widthSize = MeasureSpec.getSize(widthMeasureSpec); - int contentHeightPix = (int) (mContentHeightDip * mPageScaleFactor); - int contentWidthPix = (int) (mContentWidthDip * mPageScaleFactor); + int contentHeightPix = (int) (mContentHeightCss * mPageScaleFactor * mDIPScale); + int contentWidthPix = (int) (mContentWidthCss * mPageScaleFactor * mDIPScale); int measuredHeight = contentHeightPix; int measuredWidth = contentWidthPix;
diff --git a/ash/BUILD.gn b/ash/BUILD.gn index d30295dc..914ad90f 100644 --- a/ash/BUILD.gn +++ b/ash/BUILD.gn
@@ -212,6 +212,10 @@ "host/ash_window_tree_host_mirroring_unified.h", "host/ash_window_tree_host_mus.cc", "host/ash_window_tree_host_mus.h", + "host/ash_window_tree_host_mus_mirroring_unified.cc", + "host/ash_window_tree_host_mus_mirroring_unified.h", + "host/ash_window_tree_host_mus_unified.cc", + "host/ash_window_tree_host_mus_unified.h", "host/ash_window_tree_host_platform.cc", "host/ash_window_tree_host_platform.h", "host/ash_window_tree_host_unified.cc", @@ -375,6 +379,8 @@ "shelf/app_list_shelf_item_delegate.h", "shelf/assistant_overlay.cc", "shelf/assistant_overlay.h", + "shelf/back_button.cc", + "shelf/back_button.h", "shelf/ink_drop_button_listener.h", "shelf/login_shelf_view.cc", "shelf/login_shelf_view.h", @@ -1409,6 +1415,7 @@ "screen_util_unittest.cc", "session/session_controller_unittest.cc", "shelf/app_list_button_unittest.cc", + "shelf/back_button_unittest.cc", "shelf/login_shelf_view_unittest.cc", "shelf/shelf_application_menu_model_unittest.cc", "shelf/shelf_background_animator_unittest.cc",
diff --git a/ash/DEPS b/ash/DEPS index e144dec..1a8bb45 100644 --- a/ash/DEPS +++ b/ash/DEPS
@@ -102,6 +102,8 @@ "shell_port_mus\.cc": [ "+ash/host/ash_window_tree_host_init_params.h", "+ash/host/ash_window_tree_host_mus.h", + "+ash/host/ash_window_tree_host_mus_mirroring_unified.h", + "+ash/host/ash_window_tree_host_mus_unified.h", ], "touch_transformer_controller\.*": [ "+ash/host"
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc index bdad038a..50e4fd1 100644 --- a/ash/accelerators/accelerator_controller.cc +++ b/ash/accelerators/accelerator_controller.cc
@@ -169,11 +169,10 @@ const base::string16 message = GetNotificationText(message_id, old_shortcut_id, new_shortcut_id); std::unique_ptr<Notification> notification = - system_notifier::CreateSystemNotification( + message_center::Notification::CreateSystemNotification( message_center::NOTIFICATION_TYPE_SIMPLE, notification_id, l10n_util::GetStringUTF16(IDS_DEPRECATED_SHORTCUT_TITLE), message, - Shell::Get()->shell_delegate()->GetDeprecatedAcceleratorImage(), - base::string16(), GURL(), + gfx::Image(), base::string16(), GURL(), message_center::NotifierId( message_center::NotifierId::SYSTEM_COMPONENT, system_notifier::kNotifierDeprecatedAccelerator),
diff --git a/ash/accelerators/exit_warning_handler.cc b/ash/accelerators/exit_warning_handler.cc index 53b2f9f..f68006b 100644 --- a/ash/accelerators/exit_warning_handler.cc +++ b/ash/accelerators/exit_warning_handler.cc
@@ -61,7 +61,7 @@ label->SetAutoColorReadabilityEnabled(false); label->SetSubpixelRenderingEnabled(false); AddChildView(label); - SetLayoutManager(new views::FillLayout); + SetLayoutManager(std::make_unique<views::FillLayout>()); } void OnPaint(gfx::Canvas* canvas) override {
diff --git a/ash/accessibility/OWNERS b/ash/accessibility/OWNERS new file mode 100644 index 0000000..2c85844e --- /dev/null +++ b/ash/accessibility/OWNERS
@@ -0,0 +1,4 @@ +file://ui/accessibility/OWNERS + +# TEAM: chromium-accessibility@chromium.org +# COMPONENT: UI>Accessibility
diff --git a/ash/ash_strings.grd b/ash/ash_strings.grd index a3cab31..4a3ffdd6 100644 --- a/ash/ash_strings.grd +++ b/ash/ash_strings.grd
@@ -136,6 +136,9 @@ <message name="IDS_ASH_SHELF_APP_LIST_LAUNCHER_SYNCING_TITLE" desc="The title used for the Ash Launcher in the Shelf to indicate loading/syncinc apps."> Launcher (syncing apps...) </message> + <message name="IDS_ASH_SHELF_BACK_BUTTON_TITLE" desc="The title used for the back button on the Shelf, which is avaliable in tablet mode."> + Back + </message> <message name="IDS_ASH_SHELF_OVERFLOW_NAME" desc="The title used for the Ash overflow button in the shelf"> Overflow button </message>
diff --git a/ash/cast_config_controller.cc b/ash/cast_config_controller.cc index c4615001..0b0e5472 100644 --- a/ash/cast_config_controller.cc +++ b/ash/cast_config_controller.cc
@@ -9,7 +9,7 @@ namespace ash { -CastConfigController::CastConfigController() : binding_(this) {} +CastConfigController::CastConfigController() = default; CastConfigController::~CastConfigController() = default; @@ -27,7 +27,7 @@ } void CastConfigController::BindRequest(mojom::CastConfigRequest request) { - binding_.Bind(std::move(request)); + bindings_.AddBinding(this, std::move(request)); } void CastConfigController::SetClient(
diff --git a/ash/cast_config_controller.h b/ash/cast_config_controller.h index db36e03..3ac4833 100644 --- a/ash/cast_config_controller.h +++ b/ash/cast_config_controller.h
@@ -11,7 +11,7 @@ #include "base/macros.h" #include "base/observer_list.h" #include "mojo/public/cpp/bindings/associated_binding.h" -#include "mojo/public/cpp/bindings/binding.h" +#include "mojo/public/cpp/bindings/binding_set.h" namespace ash { @@ -53,8 +53,8 @@ void StopCasting(mojom::CastRoutePtr route); private: - // Binding for the CastConfig interface. - mojo::Binding<mojom::CastConfig> binding_; + // Bindings for the CastConfig interface. + mojo::BindingSet<mojom::CastConfig> bindings_; mojom::CastConfigClientAssociatedPtr client_;
diff --git a/ash/display/mirror_window_controller.cc b/ash/display/mirror_window_controller.cc index c18ddda..a5b78916 100644 --- a/ash/display/mirror_window_controller.cc +++ b/ash/display/mirror_window_controller.cc
@@ -197,8 +197,7 @@ AshWindowTreeHost* unified_ash_host = Shell::Get() ->window_tree_host_manager() - ->GetAshWindowTreeHostForDisplayId( - display::Screen::GetScreen()->GetPrimaryDisplay().id()); + ->GetAshWindowTreeHostForDisplayId(primary.id()); unified_ash_host->RegisterMirroringHost(host_info->ash_host.get()); aura::client::SetScreenPositionClient(host->window(), screen_position_client_.get());
diff --git a/ash/frame/caption_buttons/frame_caption_button_container_view.cc b/ash/frame/caption_buttons/frame_caption_button_container_view.cc index 1cec0be..658a0d6 100644 --- a/ash/frame/caption_buttons/frame_caption_button_container_view.cc +++ b/ash/frame/caption_buttons/frame_caption_button_container_view.cc
@@ -120,7 +120,7 @@ std::make_unique<views::BoxLayout>(views::BoxLayout::kHorizontal); layout->set_cross_axis_alignment( views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER); - SetLayoutManager(layout.release()); + SetLayoutManager(std::move(layout)); bool size_button_visibility = ShouldSizeButtonBeVisible(); tablet_mode_animation_.reset(new gfx::SlideAnimation(this)); tablet_mode_animation_->SetTweenType(gfx::Tween::LINEAR);
diff --git a/ash/highlighter/highlighter_controller_unittest.cc b/ash/highlighter/highlighter_controller_unittest.cc index 20292b2..05a9c3e 100644 --- a/ash/highlighter/highlighter_controller_unittest.cc +++ b/ash/highlighter/highlighter_controller_unittest.cc
@@ -232,7 +232,13 @@ } // Test that stylus gesture recognition correctly handles display scaling -TEST_F(HighlighterControllerTest, HighlighterGesturesScaled) { +// Flaky on ChromeOS. http://crbug.com/794703. +#if defined(OS_CHROMEOS) +#define MAYBE_HighlighterGesturesScaled DISABLED_HighlighterGesturesScaled +#else +#define MAYBE_HighlighterGesturesScaled HighlighterGesturesScaled +#endif +TEST_F(HighlighterControllerTest, MAYBE_HighlighterGesturesScaled) { controller_test_api_->SetEnabled(true); GetEventGenerator().EnterPenPointerMode();
diff --git a/ash/host/ash_window_tree_host_mus_mirroring_unified.cc b/ash/host/ash_window_tree_host_mus_mirroring_unified.cc new file mode 100644 index 0000000..bf185d2 --- /dev/null +++ b/ash/host/ash_window_tree_host_mus_mirroring_unified.cc
@@ -0,0 +1,73 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/host/ash_window_tree_host_mus_mirroring_unified.h" + +#include "ash/host/ash_window_tree_host_mirroring_delegate.h" +#include "ui/gfx/geometry/point3_f.h" +#include "ui/gfx/geometry/point_conversions.h" +#include "ui/gfx/transform.h" + +namespace ash { + +AshWindowTreeHostMusMirroringUnified::AshWindowTreeHostMusMirroringUnified( + aura::WindowTreeHostMusInitParams init_params, + int64_t mirroring_display_id, + AshWindowTreeHostMirroringDelegate* delegate) + : AshWindowTreeHostMus(std::move(init_params)), + mirroring_display_id_(mirroring_display_id), + delegate_(delegate) { + DCHECK(delegate_); +} + +AshWindowTreeHostMusMirroringUnified::~AshWindowTreeHostMusMirroringUnified() = + default; + +gfx::Transform +AshWindowTreeHostMusMirroringUnified::GetRootTransformForLocalEventCoordinates() + const { + gfx::Transform trans = GetRootTransform(); + + if (!is_shutting_down_) { + const auto* display = + delegate_->GetMirroringDisplayById(mirroring_display_id_); + DCHECK(display); + // Undo the translation in the root window transform, since this transform + // should be applied on local points to this host. + trans.Translate(SkIntToMScalar(display->bounds().x()), + SkIntToMScalar(display->bounds().y())); + } + + return trans; +} + +void AshWindowTreeHostMusMirroringUnified::ConvertDIPToPixels( + gfx::Point* point) const { + auto point_3f = gfx::Point3F(gfx::PointF(*point)); + // GetRootTransform() returns a transform that takes a point from the + // *unified* host coordinates to the *mirroring* host's pixel coordinates. + // ConvertDIPToPixels() and ConvertDIPToScreenInPixels() are called on local + // points in the *mirroring* host's root window, not on points in the unified + // host's. That's why we use the GetRootTransformForLocalEventCoordinates() + // defined above, which only scales those local points to the right size, and + // leaves the translation to be done by the MirroringScreenPositionClient + // functions. + GetRootTransformForLocalEventCoordinates().TransformPoint(&point_3f); + *point = gfx::ToFlooredPoint(point_3f.AsPointF()); +} + +void AshWindowTreeHostMusMirroringUnified::ConvertPixelsToDIP( + gfx::Point* point) const { + auto point_3f = gfx::Point3F(gfx::PointF(*point)); + GetInverseRootTransformForLocalEventCoordinates().TransformPoint(&point_3f); + *point = gfx::ToFlooredPoint(point_3f.AsPointF()); +} + +void AshWindowTreeHostMusMirroringUnified::PrepareForShutdown() { + is_shutting_down_ = true; + + AshWindowTreeHostMus::PrepareForShutdown(); +} + +} // namespace ash
diff --git a/ash/host/ash_window_tree_host_mus_mirroring_unified.h b/ash/host/ash_window_tree_host_mus_mirroring_unified.h new file mode 100644 index 0000000..971729b --- /dev/null +++ b/ash/host/ash_window_tree_host_mus_mirroring_unified.h
@@ -0,0 +1,46 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_HOST_ASH_WINDOW_TREE_HOST_MUS_MIRRORING_UNIFIED_H_ +#define ASH_HOST_ASH_WINDOW_TREE_HOST_MUS_MIRRORING_UNIFIED_H_ + +#include "ash/host/ash_window_tree_host_mus.h" +#include "base/macros.h" +#include "ui/aura/mus/window_tree_host_mus_init_params.h" + +namespace ash { + +class AshWindowTreeHostMirroringDelegate; + +// A WTH for the displays mirroring the unified desktop in mus without viz. +// This is a near copy of AshWindowTreeHostMirroringUnified. +class AshWindowTreeHostMusMirroringUnified : public AshWindowTreeHostMus { + public: + AshWindowTreeHostMusMirroringUnified( + aura::WindowTreeHostMusInitParams init_params, + int64_t mirroring_display_id, + AshWindowTreeHostMirroringDelegate* delegate); + ~AshWindowTreeHostMusMirroringUnified() override; + + // aura::WindowTreeHost: + gfx::Transform GetRootTransformForLocalEventCoordinates() const override; + void ConvertDIPToPixels(gfx::Point* point) const override; + void ConvertPixelsToDIP(gfx::Point* point) const override; + + // ash::AshWindowTreeHostMus: + void PrepareForShutdown() override; + + private: + int64_t mirroring_display_id_; + + AshWindowTreeHostMirroringDelegate* delegate_; // Not owned. + + bool is_shutting_down_ = false; + + DISALLOW_COPY_AND_ASSIGN(AshWindowTreeHostMusMirroringUnified); +}; + +} // namespace ash + +#endif // ASH_HOST_ASH_WINDOW_TREE_HOST_MUS_MIRRORING_UNIFIED_H_
diff --git a/ash/host/ash_window_tree_host_mus_unified.cc b/ash/host/ash_window_tree_host_mus_unified.cc new file mode 100644 index 0000000..fbe5950 --- /dev/null +++ b/ash/host/ash_window_tree_host_mus_unified.cc
@@ -0,0 +1,128 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/host/ash_window_tree_host_mus_unified.h" + +#include <memory> +#include <utility> + +#include "ash/host/ash_window_tree_host_mirroring_delegate.h" +#include "ash/host/root_window_transformer.h" +#include "base/logging.h" +#include "ui/aura/window.h" +#include "ui/aura/window_event_dispatcher.h" +#include "ui/aura/window_targeter.h" +#include "ui/compositor/compositor.h" +#include "ui/gfx/geometry/insets.h" +#include "ui/platform_window/stub/stub_window.h" + +namespace ash { + +// TODO(msw): Fix targeting of events on the second display during capture. +class UnifiedEventTargeter : public aura::WindowTargeter { + public: + UnifiedEventTargeter(aura::Window* src_root, + aura::Window* dst_root, + AshWindowTreeHostMirroringDelegate* delegate) + : src_root_(src_root), dst_root_(dst_root), delegate_(delegate) { + DCHECK(delegate); + } + + ui::EventTarget* FindTargetForEvent(ui::EventTarget* root, + ui::Event* event) override { + // Unlike the classic config, mus may provide a target for the event. + if (root == src_root_) { + delegate_->SetCurrentEventTargeterSourceHost(src_root_->GetHost()); + + if (event->IsLocatedEvent()) { + ui::LocatedEvent* located_event = static_cast<ui::LocatedEvent*>(event); + located_event->ConvertLocationToTarget( + static_cast<aura::Window*>(event->target()), dst_root_); + located_event->set_root_location_f(located_event->location_f()); + } + if (event->target()) + ui::Event::DispatcherApi(event).set_target(nullptr); + ignore_result( + dst_root_->GetHost()->event_sink()->OnEventFromSource(event)); + + // Reset the source host. + delegate_->SetCurrentEventTargeterSourceHost(nullptr); + + return nullptr; + } + + NOTREACHED(); + return aura::WindowTargeter::FindTargetForEvent(root, event); + } + + private: + aura::Window* src_root_; + aura::Window* dst_root_; + AshWindowTreeHostMirroringDelegate* delegate_; // Not owned. + + DISALLOW_COPY_AND_ASSIGN(UnifiedEventTargeter); +}; + +AshWindowTreeHostMusUnified::AshWindowTreeHostMusUnified( + aura::WindowTreeHostMusInitParams init_params, + AshWindowTreeHostMirroringDelegate* delegate) + : AshWindowTreeHostMus(std::move(init_params)), delegate_(delegate) { + DCHECK(delegate); +} + +AshWindowTreeHostMusUnified::~AshWindowTreeHostMusUnified() { + for (auto* ash_host : mirroring_hosts_) + ash_host->AsWindowTreeHost()->window()->RemoveObserver(this); +} + +void AshWindowTreeHostMusUnified::PrepareForShutdown() { + AshWindowTreeHostMus::PrepareForShutdown(); + + for (auto* host : mirroring_hosts_) + host->PrepareForShutdown(); +} + +void AshWindowTreeHostMusUnified::RegisterMirroringHost( + AshWindowTreeHost* mirroring_ash_host) { + aura::Window* src_root = mirroring_ash_host->AsWindowTreeHost()->window(); + src_root->SetEventTargeter( + std::make_unique<UnifiedEventTargeter>(src_root, window(), delegate_)); + DCHECK(std::find(mirroring_hosts_.begin(), mirroring_hosts_.end(), + mirroring_ash_host) == mirroring_hosts_.end()); + mirroring_hosts_.push_back(mirroring_ash_host); + mirroring_ash_host->AsWindowTreeHost()->window()->AddObserver(this); +} + +void AshWindowTreeHostMusUnified::SetBoundsInPixels(const gfx::Rect& bounds) { + AshWindowTreeHostMus::SetBoundsInPixels(bounds); + OnHostResizedInPixels(bounds.size()); +} + +void AshWindowTreeHostMusUnified::SetCursorNative(gfx::NativeCursor cursor) { + for (auto* host : mirroring_hosts_) + host->AsWindowTreeHost()->SetCursor(cursor); +} + +void AshWindowTreeHostMusUnified::OnCursorVisibilityChangedNative(bool show) { + for (auto* host : mirroring_hosts_) + host->AsWindowTreeHost()->OnCursorVisibilityChanged(show); +} + +void AshWindowTreeHostMusUnified::OnBoundsChanged(const gfx::Rect& bounds) { + if (platform_window()) + OnHostResizedInPixels(bounds.size()); +} + +void AshWindowTreeHostMusUnified::OnWindowDestroying(aura::Window* window) { + auto iter = + std::find_if(mirroring_hosts_.begin(), mirroring_hosts_.end(), + [window](AshWindowTreeHost* ash_host) { + return ash_host->AsWindowTreeHost()->window() == window; + }); + DCHECK(iter != mirroring_hosts_.end()); + window->RemoveObserver(this); + mirroring_hosts_.erase(iter); +} + +} // namespace ash
diff --git a/ash/host/ash_window_tree_host_mus_unified.h b/ash/host/ash_window_tree_host_mus_unified.h new file mode 100644 index 0000000..4d62331 --- /dev/null +++ b/ash/host/ash_window_tree_host_mus_unified.h
@@ -0,0 +1,53 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_HOST_ASH_WINDOW_TREE_HOST_MUS_UNIFIED_H_ +#define ASH_HOST_ASH_WINDOW_TREE_HOST_MUS_UNIFIED_H_ + +#include <vector> + +#include "ash/host/ash_window_tree_host_mus.h" +#include "base/macros.h" +#include "ui/aura/mus/window_tree_host_mus_init_params.h" +#include "ui/aura/window_observer.h" + +namespace ash { + +class AshWindowTreeHostMirroringDelegate; + +// A WTH for the unified desktop display in mus without viz. +// This is a near copy of AshWindowTreeHostUnified. +class AshWindowTreeHostMusUnified : public AshWindowTreeHostMus, + public aura::WindowObserver { + public: + AshWindowTreeHostMusUnified(aura::WindowTreeHostMusInitParams init_params, + AshWindowTreeHostMirroringDelegate* delegate); + ~AshWindowTreeHostMusUnified() override; + + private: + // AshWindowTreeHost: + void PrepareForShutdown() override; + void RegisterMirroringHost(AshWindowTreeHost* mirroring_ash_host) override; + + // aura::WindowTreeHost: + void SetBoundsInPixels(const gfx::Rect& bounds) override; + void SetCursorNative(gfx::NativeCursor cursor) override; + void OnCursorVisibilityChangedNative(bool show) override; + + // ui::PlatformWindowDelegate: + void OnBoundsChanged(const gfx::Rect& bounds) override; + + // aura::WindowObserver: + void OnWindowDestroying(aura::Window* window) override; + + AshWindowTreeHostMirroringDelegate* delegate_; // Not owned. + + std::vector<AshWindowTreeHost*> mirroring_hosts_; + + DISALLOW_COPY_AND_ASSIGN(AshWindowTreeHostMusUnified); +}; + +} // namespace ash + +#endif // ASH_HOST_ASH_WINDOW_TREE_HOST_MUS_UNIFIED_H_
diff --git a/ash/ime/ime_controller.cc b/ash/ime/ime_controller.cc index 78cc517..252754e 100644 --- a/ash/ime/ime_controller.cc +++ b/ash/ime/ime_controller.cc
@@ -11,7 +11,7 @@ namespace ash { -ImeController::ImeController() : binding_(this) {} +ImeController::ImeController() = default; ImeController::~ImeController() = default; @@ -24,7 +24,7 @@ } void ImeController::BindRequest(mojom::ImeControllerRequest request) { - binding_.Bind(std::move(request)); + bindings_.AddBinding(this, std::move(request)); } void ImeController::SetClient(mojom::ImeControllerClientPtr client) {
diff --git a/ash/ime/ime_controller.h b/ash/ime/ime_controller.h index 72043676..ff6fd37 100644 --- a/ash/ime/ime_controller.h +++ b/ash/ime/ime_controller.h
@@ -12,7 +12,7 @@ #include "ash/public/interfaces/ime_info.mojom.h" #include "base/macros.h" #include "base/observer_list.h" -#include "mojo/public/cpp/bindings/binding.h" +#include "mojo/public/cpp/bindings/binding_set.h" namespace ui { class Accelerator; @@ -100,8 +100,8 @@ std::vector<std::string> GetCandidateImesForAccelerator( const ui::Accelerator& accelerator) const; - // Binding for the mojo interface. - mojo::Binding<mojom::ImeController> binding_; + // Bindings for users of the mojo interface. + mojo::BindingSet<mojom::ImeController> bindings_; // Client interface back to IME code in chrome. mojom::ImeControllerClientPtr client_;
diff --git a/ash/lock_screen_action/lock_screen_action_background_view.cc b/ash/lock_screen_action/lock_screen_action_background_view.cc index 4c3cbf4..bc614720 100644 --- a/ash/lock_screen_action/lock_screen_action_background_view.cc +++ b/ash/lock_screen_action/lock_screen_action_background_view.cc
@@ -61,16 +61,17 @@ }; LockScreenActionBackgroundView::LockScreenActionBackgroundView() { - auto* layout_manager = new views::BoxLayout(views::BoxLayout::kVertical); + auto layout_manager = + std::make_unique<views::BoxLayout>(views::BoxLayout::kVertical); layout_manager->set_cross_axis_alignment( views::BoxLayout::CROSS_AXIS_ALIGNMENT_STRETCH); - SetLayoutManager(layout_manager); + auto* layout_ptr = SetLayoutManager(std::move(layout_manager)); background_ = new NoteBackground(this); AddChildView(background_); // Make background view flexible - the constant does not really matter given // that |background_| is the only child, as long as it's greater than 0. - layout_manager->SetFlexForView(background_, 1 /*flex_weight*/); + layout_ptr->SetFlexForView(background_, 1 /*flex_weight*/); } LockScreenActionBackgroundView::~LockScreenActionBackgroundView() = default;
diff --git a/ash/login/login_screen_controller.cc b/ash/login/login_screen_controller.cc index e68012f..0bcbf74 100644 --- a/ash/login/login_screen_controller.cc +++ b/ash/login/login_screen_controller.cc
@@ -32,8 +32,7 @@ } // namespace -LoginScreenController::LoginScreenController() - : binding_(this), weak_factory_(this) {} +LoginScreenController::LoginScreenController() : weak_factory_(this) {} LoginScreenController::~LoginScreenController() = default; @@ -51,7 +50,7 @@ } void LoginScreenController::BindRequest(mojom::LoginScreenRequest request) { - binding_.Bind(std::move(request)); + bindings_.AddBinding(this, std::move(request)); } void LoginScreenController::SetClient(mojom::LoginScreenClientPtr client) {
diff --git a/ash/login/login_screen_controller.h b/ash/login/login_screen_controller.h index 6f4b39a..0de0dc57 100644 --- a/ash/login/login_screen_controller.h +++ b/ash/login/login_screen_controller.h
@@ -10,7 +10,7 @@ #include "base/macros.h" #include "base/observer_list.h" #include "base/optional.h" -#include "mojo/public/cpp/bindings/binding.h" +#include "mojo/public/cpp/bindings/binding_set.h" class PrefRegistrySimple; @@ -121,8 +121,8 @@ // Client interface in chrome browser. May be null in tests. mojom::LoginScreenClientPtr login_screen_client_; - // Binding for the LockScreen interface. - mojo::Binding<mojom::LoginScreen> binding_; + // Bindings for users of the LockScreen interface. + mojo::BindingSet<mojom::LoginScreen> bindings_; // True iff we are currently authentication. bool is_authenticating_ = false;
diff --git a/ash/login/ui/layout_util.cc b/ash/login/ui/layout_util.cc index f27c65a..a7a634d 100644 --- a/ash/login/ui/layout_util.cc +++ b/ash/login/ui/layout_util.cc
@@ -12,10 +12,11 @@ views::View* WrapViewForPreferredSize(views::View* view) { auto* proxy = new NonAccessibleView(); - auto* layout_manager = new views::BoxLayout(views::BoxLayout::kVertical); + auto layout_manager = + std::make_unique<views::BoxLayout>(views::BoxLayout::kVertical); layout_manager->set_cross_axis_alignment( views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); - proxy->SetLayoutManager(layout_manager); + proxy->SetLayoutManager(std::move(layout_manager)); proxy->AddChildView(view); return proxy; }
diff --git a/ash/login/ui/lock_contents_view.cc b/ash/login/ui/lock_contents_view.cc index 2126912..52912e89 100644 --- a/ash/login/ui/lock_contents_view.cc +++ b/ash/login/ui/lock_contents_view.cc
@@ -250,25 +250,26 @@ // focusable. SetFocusBehavior(FocusBehavior::ALWAYS); - SetLayoutManager(new views::FillLayout()); + SetLayoutManager(std::make_unique<views::FillLayout>()); main_view_ = new NonAccessibleView(); AddChildView(main_view_); // The top header view. top_header_ = new views::View(); - auto* top_header_layout = new views::BoxLayout(views::BoxLayout::kHorizontal); + auto top_header_layout = + std::make_unique<views::BoxLayout>(views::BoxLayout::kHorizontal); top_header_layout->set_main_axis_alignment( views::BoxLayout::MAIN_AXIS_ALIGNMENT_END); - top_header_->SetLayoutManager(top_header_layout); + top_header_->SetLayoutManager(std::move(top_header_layout)); AddChildView(top_header_); dev_channel_info_ = new views::View(); - auto* dev_channel_info_layout = - new views::BoxLayout(views::BoxLayout::kVertical, gfx::Insets(5, 8)); + auto dev_channel_info_layout = std::make_unique<views::BoxLayout>( + views::BoxLayout::kVertical, gfx::Insets(5, 8)); dev_channel_info_layout->set_cross_axis_alignment( views::BoxLayout::CROSS_AXIS_ALIGNMENT_END); - dev_channel_info_->SetLayoutManager(dev_channel_info_layout); + dev_channel_info_->SetLayoutManager(std::move(dev_channel_info_layout)); dev_channel_info_->SetVisible(false); top_header_->AddChildView(dev_channel_info_); @@ -345,12 +346,14 @@ for (const mojom::LoginUserInfoPtr& user : users) users_.push_back(UserState{user->basic_user_info->account_id}); - main_layout_ = new views::BoxLayout(views::BoxLayout::kHorizontal); + auto box_layout = + std::make_unique<views::BoxLayout>(views::BoxLayout::kHorizontal); + main_layout_ = box_layout.get(); main_layout_->set_main_axis_alignment( views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER); main_layout_->set_cross_axis_alignment( views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER); - main_view_->SetLayoutManager(main_layout_); + main_view_->SetLayoutManager(std::move(box_layout)); // Add auth user. primary_auth_ = AllocateLoginAuthUserView(users[0], true /*is_primary*/); @@ -560,10 +563,9 @@ // Add additional users. auto* row = new NonAccessibleView(); main_view_->AddChildView(row); - auto* layout = - new views::BoxLayout(views::BoxLayout::kVertical, gfx::Insets(), - kMediumDensityVerticalDistanceBetweenUsersDp); - row->SetLayoutManager(layout); + row->SetLayoutManager(std::make_unique<views::BoxLayout>( + views::BoxLayout::kVertical, gfx::Insets(), + kMediumDensityVerticalDistanceBetweenUsersDp)); for (std::size_t i = 1u; i < users.size(); ++i) { auto* view = new LoginUserView(LoginDisplayStyle::kSmall, false /*show_dropdown*/, @@ -614,12 +616,12 @@ // Add user list. auto* row = new NonAccessibleView(); - auto* row_layout = - new views::BoxLayout(views::BoxLayout::kVertical, gfx::Insets(), - kHighDensityVerticalDistanceBetweenUsersDp); + auto row_layout = std::make_unique<views::BoxLayout>( + views::BoxLayout::kVertical, gfx::Insets(), + kHighDensityVerticalDistanceBetweenUsersDp); row_layout->set_minimum_cross_axis_size( LoginUserView::WidthForLayoutStyle(LoginDisplayStyle::kExtraSmall)); - row->SetLayoutManager(row_layout); + row->SetLayoutManager(std::move(row_layout)); for (std::size_t i = 1u; i < users.size(); ++i) { auto* view = new LoginUserView( LoginDisplayStyle::kExtraSmall, false /*show_dropdown*/,
diff --git a/ash/login/ui/lock_contents_view.h b/ash/login/ui/lock_contents_view.h index 7d15122..ec6de9db 100644 --- a/ash/login/ui/lock_contents_view.h +++ b/ash/login/ui/lock_contents_view.h
@@ -237,7 +237,7 @@ // Contains authentication user and the additional user views. NonAccessibleView* main_view_ = nullptr; - // Layout used for |main_view_|. + // Layout used for |main_view_|. Pointer owned by the View base class. views::BoxLayout* main_layout_ = nullptr; // Actions that should be executed when rotation changes. A full layout pass
diff --git a/ash/login/ui/lock_debug_view.cc b/ash/login/ui/lock_debug_view.cc index f6180d4..4d692f7 100644 --- a/ash/login/ui/lock_debug_view.cc +++ b/ash/login/ui/lock_debug_view.cc
@@ -256,7 +256,8 @@ : debug_data_dispatcher_(std::make_unique<DebugDataDispatcherTransformer>( initial_note_action_state, data_dispatcher)) { - SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal)); + SetLayoutManager( + std::make_unique<views::BoxLayout>(views::BoxLayout::kHorizontal)); lock_ = new LockContentsView(initial_note_action_state, debug_data_dispatcher_->debug_dispatcher()); @@ -264,12 +265,12 @@ debug_row_ = new NonAccessibleView(); debug_row_->SetLayoutManager( - new views::BoxLayout(views::BoxLayout::kHorizontal)); + std::make_unique<views::BoxLayout>(views::BoxLayout::kHorizontal)); AddChildView(debug_row_); per_user_action_column_ = new NonAccessibleView(); per_user_action_column_->SetLayoutManager( - new views::BoxLayout(views::BoxLayout::kVertical)); + std::make_unique<views::BoxLayout>(views::BoxLayout::kVertical)); debug_row_->AddChildView(per_user_action_column_); auto* margin = new NonAccessibleView(); @@ -408,7 +409,8 @@ for (size_t i = 0u; i < num_users_; ++i) { auto* row = new NonAccessibleView(); - row->SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal)); + row->SetLayoutManager( + std::make_unique<views::BoxLayout>(views::BoxLayout::kHorizontal)); views::View* toggle_pin = AddButton("Toggle PIN", false /*add_to_debug_row*/);
diff --git a/ash/login/ui/login_auth_user_view_unittest.cc b/ash/login/ui/login_auth_user_view_unittest.cc index 2dc2534..2390e86 100644 --- a/ash/login/ui/login_auth_user_view_unittest.cc +++ b/ash/login/ui/login_auth_user_view_unittest.cc
@@ -31,7 +31,7 @@ // We proxy |view_| inside of |container_| so we can control layout. container_ = new views::View(); container_->SetLayoutManager( - new views::BoxLayout(views::BoxLayout::kVertical)); + std::make_unique<views::BoxLayout>(views::BoxLayout::kVertical)); container_->AddChildView(view_); SetWidget(CreateWidgetWithContent(container_)); }
diff --git a/ash/login/ui/login_base_bubble_view.cc b/ash/login/ui/login_base_bubble_view.cc index 2f0d058b..63bb9a3f 100644 --- a/ash/login/ui/login_base_bubble_view.cc +++ b/ash/login/ui/login_base_bubble_view.cc
@@ -28,9 +28,8 @@ LoginBaseBubbleView::LoginBaseBubbleView(views::View* anchor_view) : BubbleDialogDelegateView(anchor_view, views::BubbleBorder::NONE) { - auto* layout = new views::BoxLayout( - views::BoxLayout::kVertical, gfx::Insets(), kBubbleBetweenChildSpacing); - SetLayoutManager(layout); + SetLayoutManager(std::make_unique<views::BoxLayout>( + views::BoxLayout::kVertical, gfx::Insets(), kBubbleBetweenChildSpacing)); set_margins(gfx::Insets(kBubbleTopMarginDp, kBubbleHorizontalMarginDp, kBubbleBottomMarginDp, kBubbleHorizontalMarginDp));
diff --git a/ash/login/ui/login_bubble.cc b/ash/login/ui/login_bubble.cc index 43afc76b..30e38ec9 100644 --- a/ash/login/ui/login_bubble.cc +++ b/ash/login/ui/login_bubble.cc
@@ -60,8 +60,8 @@ gfx::Insets(kAnchorViewErrorBubbleVerticalSpacingDp, 0)); views::View* alert_view = new views::View(); - alert_view->SetLayoutManager( - new views::BoxLayout(views::BoxLayout::kHorizontal, gfx::Insets())); + alert_view->SetLayoutManager(std::make_unique<views::BoxLayout>( + views::BoxLayout::kHorizontal, gfx::Insets())); views::ImageView* alert_icon = new views::ImageView(); alert_icon->SetPreferredSize(gfx::Size(kAlertIconSizeDp, kAlertIconSizeDp)); alert_icon->SetImage(
diff --git a/ash/login/ui/login_bubble_unittest.cc b/ash/login/ui/login_bubble_unittest.cc index 0445e56..ef47c25 100644 --- a/ash/login/ui/login_bubble_unittest.cc +++ b/ash/login/ui/login_bubble_unittest.cc
@@ -43,7 +43,7 @@ container_ = new views::View(); container_->SetLayoutManager( - new views::BoxLayout(views::BoxLayout::kVertical)); + std::make_unique<views::BoxLayout>(views::BoxLayout::kVertical)); bubble_opener_ = new LoginButton(nullptr /*listener*/); other_view_ = new views::View();
diff --git a/ash/login/ui/login_password_view.cc b/ash/login/ui/login_password_view.cc index a123054..7fa324c 100644 --- a/ash/login/ui/login_password_view.cc +++ b/ash/login/ui/login_password_view.cc
@@ -187,7 +187,7 @@ EasyUnlockIcon(const gfx::Size& size, int corner_radius) : views::Button(this) { SetPreferredSize(size); - SetLayoutManager(new views::FillLayout()); + SetLayoutManager(std::make_unique<views::FillLayout>()); icon_ = new AnimatedRoundedImageView(size, corner_radius); icon_->SetAnimationEnabled(true); AddChildView(icon_); @@ -344,20 +344,21 @@ } LoginPasswordView::LoginPasswordView() : ime_keyboard_observer_(this) { - auto* root_layout = new views::BoxLayout(views::BoxLayout::kVertical); + auto root_layout = + std::make_unique<views::BoxLayout>(views::BoxLayout::kVertical); root_layout->set_main_axis_alignment( views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER); - SetLayoutManager(root_layout); + SetLayoutManager(std::move(root_layout)); password_row_ = new NonAccessibleView(); - auto* layout = - new views::BoxLayout(views::BoxLayout::kHorizontal, - gfx::Insets(kMarginAboveBelowPasswordIconsDp, 0)); + auto layout = std::make_unique<views::BoxLayout>( + views::BoxLayout::kHorizontal, + gfx::Insets(kMarginAboveBelowPasswordIconsDp, 0)); layout->set_main_axis_alignment(views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER); layout->set_cross_axis_alignment( views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER); - password_row_->SetLayoutManager(layout); + auto* layout_ptr = password_row_->SetLayoutManager(std::move(layout)); AddChildView(password_row_); // Add easy unlock icon. @@ -391,7 +392,7 @@ textfield_->SetBackgroundColor(SK_ColorTRANSPARENT); password_row_->AddChildView(textfield_); - layout->SetFlexForView(textfield_, 1); + layout_ptr->SetFlexForView(textfield_, 1); // Caps lock hint icon. capslock_icon_ = new views::ImageView();
diff --git a/ash/login/ui/login_pin_view.cc b/ash/login/ui/login_pin_view.cc index 55e74b0..d5bfe8da 100644 --- a/ash/login/ui/login_pin_view.cc +++ b/ash/login/ui/login_pin_view.cc
@@ -73,10 +73,11 @@ SetFocusBehavior(FocusBehavior::ALWAYS); SetPreferredSize( gfx::Size(LoginPinView::kButtonSizeDp, LoginPinView::kButtonSizeDp)); - auto* layout = new views::BoxLayout(views::BoxLayout::kVertical); + auto layout = + std::make_unique<views::BoxLayout>(views::BoxLayout::kVertical); layout->set_main_axis_alignment( views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER); - SetLayoutManager(layout); + SetLayoutManager(std::move(layout)); // Layer rendering is needed for animation. Enable it here for // focus painter to paint. @@ -254,14 +255,14 @@ // Builds and returns a new view which contains a row of the PIN keyboard. auto build_and_add_row = [this]() { auto* row = new NonAccessibleView(); - row->SetLayoutManager(new views::BoxLayout( + row->SetLayoutManager(std::make_unique<views::BoxLayout>( views::BoxLayout::kHorizontal, gfx::Insets(), kButtonSeparatorSizeDp)); AddChildView(row); return row; }; - SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, - gfx::Insets(), kButtonSeparatorSizeDp)); + SetLayoutManager(std::make_unique<views::BoxLayout>( + views::BoxLayout::kVertical, gfx::Insets(), kButtonSeparatorSizeDp)); // 1-2-3 auto* row = build_and_add_row();
diff --git a/ash/login/ui/login_user_view.cc b/ash/login/ui/login_user_view.cc index 4cf08d5..f3ec9481 100644 --- a/ash/login/ui/login_user_view.cc +++ b/ash/login/ui/login_user_view.cc
@@ -90,7 +90,7 @@ : NonAccessibleView(kLoginUserImageClassName), size_(size), weak_factory_(this) { - SetLayoutManager(new views::FillLayout()); + SetLayoutManager(std::make_unique<views::FillLayout>()); // TODO(jdufault): We need to render a black border. We will probably have // to add support directly to AnimatedRoundedImageView, since the existing @@ -142,7 +142,7 @@ public: UserLabel(LoginDisplayStyle style) : NonAccessibleView(kLoginUserLabelClassName) { - SetLayoutManager(new views::FillLayout()); + SetLayoutManager(std::make_unique<views::FillLayout>()); user_name_ = new views::Label(); user_name_->SetEnabledColor(SK_ColorWHITE); @@ -540,10 +540,9 @@ } void LoginUserView::SetSmallishLayout() { - auto* root_layout = - new views::BoxLayout(views::BoxLayout::kHorizontal, gfx::Insets(), - kSmallManyDistanceFromUserIconToUserLabelDp); - SetLayoutManager(root_layout); + SetLayoutManager(std::make_unique<views::BoxLayout>( + views::BoxLayout::kHorizontal, gfx::Insets(), + kSmallManyDistanceFromUserIconToUserLabelDp)); AddChildView(user_image_); AddChildView(user_label_);
diff --git a/ash/login/ui/login_user_view_unittest.cc b/ash/login/ui/login_user_view_unittest.cc index d355d9a..2ebfdb4 100644 --- a/ash/login/ui/login_user_view_unittest.cc +++ b/ash/login/ui/login_user_view_unittest.cc
@@ -40,10 +40,11 @@ container_ = new views::View(); container_->SetLayoutManager( - new views::BoxLayout(views::BoxLayout::kVertical)); + std::make_unique<views::BoxLayout>(views::BoxLayout::kVertical)); auto* root = new views::View(); - root->SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal)); + root->SetLayoutManager( + std::make_unique<views::BoxLayout>(views::BoxLayout::kHorizontal)); root->AddChildView(container_); SetWidget(CreateWidgetWithContent(root)); }
diff --git a/ash/login/ui/note_action_launch_button.cc b/ash/login/ui/note_action_launch_button.cc index 53b4491..0394ff6 100644 --- a/ash/login/ui/note_action_launch_button.cc +++ b/ash/login/ui/note_action_launch_button.cc
@@ -343,7 +343,7 @@ NoteActionLaunchButton::NoteActionLaunchButton( mojom::TrayActionState initial_note_action_state) { - SetLayoutManager(new views::FillLayout()); + SetLayoutManager(std::make_unique<views::FillLayout>()); background_ = new BackgroundView(); AddChildView(background_);
diff --git a/ash/magnifier/magnification_controller_unittest.cc b/ash/magnifier/magnification_controller_unittest.cc index d681ce6..f791e7c 100644 --- a/ash/magnifier/magnification_controller_unittest.cc +++ b/ash/magnifier/magnification_controller_unittest.cc
@@ -35,7 +35,7 @@ TextInputView() : text_field_(new views::Textfield) { text_field_->SetTextInputType(ui::TEXT_INPUT_TYPE_TEXT); AddChildView(text_field_); - SetLayoutManager(new views::FillLayout); + SetLayoutManager(std::make_unique<views::FillLayout>()); } ~TextInputView() override = default;
diff --git a/ash/media_controller.cc b/ash/media_controller.cc index e2f7e90..972a5ec 100644 --- a/ash/media_controller.cc +++ b/ash/media_controller.cc
@@ -6,12 +6,12 @@ namespace ash { -MediaController::MediaController() : binding_(this) {} +MediaController::MediaController() = default; MediaController::~MediaController() = default; void MediaController::BindRequest(mojom::MediaControllerRequest request) { - binding_.Bind(std::move(request)); + bindings_.AddBinding(this, std::move(request)); } void MediaController::AddObserver(MediaCaptureObserver* observer) {
diff --git a/ash/media_controller.h b/ash/media_controller.h index d1380a1..40a9f13 100644 --- a/ash/media_controller.h +++ b/ash/media_controller.h
@@ -9,7 +9,7 @@ #include "base/macros.h" #include "base/observer_list.h" #include "mojo/public/cpp/bindings/associated_binding.h" -#include "mojo/public/cpp/bindings/binding.h" +#include "mojo/public/cpp/bindings/binding_set.h" namespace ash { @@ -52,7 +52,8 @@ private: friend class MultiProfileMediaTrayItemTest; - mojo::Binding<mojom::MediaController> binding_; + // Bindings for users of the mojo interface. + mojo::BindingSet<mojom::MediaController> bindings_; mojom::MediaClientAssociatedPtr client_;
diff --git a/ash/message_center/message_center_bubble.cc b/ash/message_center/message_center_bubble.cc index fee41f5..39810ea 100644 --- a/ash/message_center/message_center_bubble.cc +++ b/ash/message_center/message_center_bubble.cc
@@ -43,7 +43,7 @@ ContentsView::ContentsView(MessageCenterBubble* bubble, views::View* contents) : bubble_(bubble->AsWeakPtr()) { - SetLayoutManager(new views::FillLayout()); + SetLayoutManager(std::make_unique<views::FillLayout>()); AddChildView(contents); }
diff --git a/ash/message_center/message_center_button_bar.cc b/ash/message_center/message_center_button_bar.cc index 8847278..0bb98bbf 100644 --- a/ash/message_center/message_center_button_bar.cc +++ b/ash/message_center/message_center_button_bar.cc
@@ -133,7 +133,7 @@ button_container_->SetBackground( views::CreateSolidBackground(message_center_style::kBackgroundColor)); button_container_->SetLayoutManager( - new views::BoxLayout(views::BoxLayout::kHorizontal)); + std::make_unique<views::BoxLayout>(views::BoxLayout::kHorizontal)); close_all_button_ = new MessageCenterButton(this); close_all_button_->SetImage( views::Button::STATE_NORMAL,
diff --git a/ash/message_center/message_center_view.cc b/ash/message_center/message_center_view.cc index fc867b4..a7bdfe5 100644 --- a/ash/message_center/message_center_view.cc +++ b/ash/message_center/message_center_view.cc
@@ -77,12 +77,12 @@ class EmptyNotificationView : public views::View { public: EmptyNotificationView() { - views::BoxLayout* layout = - new views::BoxLayout(views::BoxLayout::kVertical, kEmptyViewPadding, 0); + auto layout = std::make_unique<views::BoxLayout>( + views::BoxLayout::kVertical, kEmptyViewPadding, 0); layout->set_main_axis_alignment(views::BoxLayout::MAIN_AXIS_ALIGNMENT_END); layout->set_cross_axis_alignment( views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER); - SetLayoutManager(layout); + SetLayoutManager(std::move(layout)); views::ImageView* icon = new views::ImageView(); icon->SetImage(gfx::CreateVectorIcon( @@ -179,7 +179,7 @@ // an intermediate view for the contents whose children we can swap in and // out. views::View* scroller_contents = new views::View(); - scroller_contents->SetLayoutManager(new views::FillLayout()); + scroller_contents->SetLayoutManager(std::make_unique<views::FillLayout>()); scroller_contents->AddChildView(message_list_view_.get()); scroller_->SetContents(scroller_contents); @@ -195,6 +195,9 @@ AddChildView(settings_view_); AddChildView(no_notifications_view_); AddChildView(button_bar_); + + if (switches::IsSidebarEnabled()) + MessageView::SetSidebarEnabled(); } MessageCenterView::~MessageCenterView() {
diff --git a/ash/message_center/message_list_view.cc b/ash/message_center/message_list_view.cc index 62e804b..474205c 100644 --- a/ash/message_center/message_list_view.cc +++ b/ash/message_center/message_list_view.cc
@@ -46,10 +46,10 @@ clear_all_started_(false), animator_(this), weak_ptr_factory_(this) { - views::BoxLayout* layout = - new views::BoxLayout(views::BoxLayout::kVertical, gfx::Insets(), 1); + auto layout = std::make_unique<views::BoxLayout>(views::BoxLayout::kVertical, + gfx::Insets(), 1); layout->SetDefaultFlex(1); - SetLayoutManager(layout); + SetLayoutManager(std::move(layout)); if (!switches::IsSidebarEnabled()) { SetBackground(
diff --git a/ash/message_center/notifier_settings_view.cc b/ash/message_center/notifier_settings_view.cc index 5faf222..a4d167f 100644 --- a/ash/message_center/notifier_settings_view.cc +++ b/ash/message_center/notifier_settings_view.cc
@@ -266,13 +266,13 @@ class EmptyNotifierView : public views::View { public: EmptyNotifierView() { - views::BoxLayout* layout = - new views::BoxLayout(views::BoxLayout::kVertical, gfx::Insets(), 0); + auto layout = std::make_unique<views::BoxLayout>( + views::BoxLayout::kVertical, gfx::Insets(), 0); layout->set_main_axis_alignment( views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER); layout->set_cross_axis_alignment( views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER); - SetLayoutManager(layout); + SetLayoutManager(std::move(layout)); views::ImageView* icon = new views::ImageView(); icon->SetImage(gfx::CreateVectorIcon( @@ -478,17 +478,17 @@ SetPaintToLayer(); header_view_ = new views::View; - header_view_->SetLayoutManager( - new views::BoxLayout(views::BoxLayout::kVertical, kHeaderViewPadding, 0)); + header_view_->SetLayoutManager(std::make_unique<views::BoxLayout>( + views::BoxLayout::kVertical, kHeaderViewPadding, 0)); header_view_->SetBorder( views::CreateSolidSidedBorder(1, 0, 0, 0, kTopBorderColor)); views::View* quiet_mode_view = new views::View; - views::BoxLayout* quiet_mode_layout = - new views::BoxLayout(views::BoxLayout::kHorizontal, kQuietModeViewPadding, - kQuietModeViewSpacing); - quiet_mode_view->SetLayoutManager(quiet_mode_layout); + auto* quiet_mode_layout = + quiet_mode_view->SetLayoutManager(std::make_unique<views::BoxLayout>( + views::BoxLayout::kHorizontal, kQuietModeViewPadding, + kQuietModeViewSpacing)); quiet_mode_icon_ = new views::ImageView(); quiet_mode_icon_->SetBorder(views::CreateEmptyBorder(kQuietModeLabelPadding)); @@ -579,7 +579,7 @@ buttons_.clear(); views::View* contents_view = new ScrollContentsView(); - contents_view->SetLayoutManager(new views::BoxLayout( + contents_view->SetLayoutManager(std::make_unique<views::BoxLayout>( views::BoxLayout::kVertical, gfx::Insets(0, kHorizontalMargin))); size_t notifier_count = ui_data.size();
diff --git a/ash/metrics/time_to_first_present_recorder.cc b/ash/metrics/time_to_first_present_recorder.cc index 70f6b81..a1e44fcc 100644 --- a/ash/metrics/time_to_first_present_recorder.cc +++ b/ash/metrics/time_to_first_present_recorder.cc
@@ -6,21 +6,19 @@ #include "base/bind.h" #include "base/bind_helpers.h" -#include "base/command_line.h" #include "base/metrics/histogram_macros.h" #include "base/time/time.h" #include "ui/aura/window.h" #include "ui/aura/window_tree_host.h" #include "ui/compositor/compositor.h" -#include "ui/gl/gl_switches.h" +#include "ui/gl/gl_switches_util.h" namespace ash { TimeToFirstPresentRecorder::TimeToFirstPresentRecorder(aura::Window* window) { aura::WindowTreeHost* window_tree_host = window->GetHost(); DCHECK(window_tree_host); - if (base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnablePresentationCallback)) { + if (gl::IsPresentationCallbackEnabled()) { window_tree_host->compositor()->RequestPresentationTimeForNextFrame( base::BindOnce(&TimeToFirstPresentRecorder::DidPresentCompositorFrame, base::Unretained(this)));
diff --git a/ash/metrics/user_metrics_recorder.cc b/ash/metrics/user_metrics_recorder.cc index 8d8b813..10f7de2 100644 --- a/ash/metrics/user_metrics_recorder.cc +++ b/ash/metrics/user_metrics_recorder.cc
@@ -156,7 +156,7 @@ for (const ShelfItem& item : Shell::Get()->shelf_model()->items()) { if (item.type == TYPE_PINNED_APP || item.type == TYPE_BROWSER_SHORTCUT) ++pinned_item_count; - else if (item.type != TYPE_APP_LIST) + else if (item.type != TYPE_APP_LIST && item.type != TYPE_BACK_BUTTON) ++unpinned_item_count; }
diff --git a/ash/metrics/user_metrics_recorder_unittest.cc b/ash/metrics/user_metrics_recorder_unittest.cc index 9897dcd..451f7d4 100644 --- a/ash/metrics/user_metrics_recorder_unittest.cc +++ b/ash/metrics/user_metrics_recorder_unittest.cc
@@ -132,10 +132,11 @@ TEST_F(UserMetricsRecorderTest, ValuesRecordedByRecordShelfItemCounts) { CreateUserSessions(1); - // Make sure the shelf contains the app list launcher button. + // Make sure the shelf contains the app list launcher and back button. ShelfModel* shelf_model = Shell::Get()->shelf_model(); - ASSERT_EQ(1u, shelf_model->items().size()); - ASSERT_EQ(TYPE_APP_LIST, shelf_model->items()[0].type); + ASSERT_EQ(2u, shelf_model->items().size()); + ASSERT_EQ(TYPE_BACK_BUTTON, shelf_model->items()[0].type); + ASSERT_EQ(TYPE_APP_LIST, shelf_model->items()[1].type); ShelfItem shelf_item; shelf_item.type = ash::TYPE_PINNED_APP;
diff --git a/ash/public/cpp/shelf_model.cc b/ash/public/cpp/shelf_model.cc index 0971679..cf84071 100644 --- a/ash/public/cpp/shelf_model.cc +++ b/ash/public/cpp/shelf_model.cc
@@ -16,8 +16,9 @@ int ShelfItemTypeToWeight(ShelfItemType type) { switch (type) { case TYPE_APP_LIST: - // TODO(skuhne): If the app list item becomes movable again, this need - // to be a fallthrough. + case TYPE_BACK_BUTTON: + // TODO(skuhne): If the app list and back button items become movable, + // this needs to be a fallthrough. return 0; case TYPE_BROWSER_SHORTCUT: case TYPE_PINNED_APP: @@ -44,15 +45,23 @@ } // namespace const char kAppListId[] = "jlfapfmkapbjlfbpjedlinehodkccjee"; +const char kBackButtonId[] = "icmmkgojeloilfifneofeejijgdhjknf"; ShelfModel::ShelfModel() { - // Add the app list item; its title and delegate are set in ShelfController. - // This avoids an ash/public dep on ash/strings, and a Chrome-side delegate. - ShelfItem item; - item.type = TYPE_APP_LIST; - item.id = ShelfID(kAppListId); - const int index = Add(item); - DCHECK_EQ(0, index); + // Add the back button and app list item; its title and delegate are set in + // ShelfController. This avoids an ash/public dep on ash/strings, and a + // Chrome-side delegate. + ShelfItem back_button_item; + back_button_item.type = TYPE_BACK_BUTTON; + back_button_item.id = ShelfID(kBackButtonId); + const int back_button_index = Add(back_button_item); + DCHECK_EQ(0, back_button_index); + + ShelfItem app_list_item; + app_list_item.type = TYPE_APP_LIST; + app_list_item.id = ShelfID(kAppListId); + const int app_list_index = Add(app_list_item); + DCHECK_EQ(1, app_list_index); } ShelfModel::~ShelfModel() = default;
diff --git a/ash/public/cpp/shelf_model.h b/ash/public/cpp/shelf_model.h index 530f1d3..df86bb4 100644 --- a/ash/public/cpp/shelf_model.h +++ b/ash/public/cpp/shelf_model.h
@@ -23,6 +23,10 @@ // Generated as crx_file::id_util::GenerateId("org.chromium.applist") ASH_PUBLIC_EXPORT extern const char kAppListId[]; +// An id for the BackButton item, which is added in the ShelfModel constructor. +// Generated as crx_file::id_util::GenerateId("org.chromium.backbutton") +ASH_PUBLIC_EXPORT extern const char kBackButtonId[]; + // Model used for shelf items. Owns ShelfItemDelegates but does not create them. class ASH_PUBLIC_EXPORT ShelfModel { public:
diff --git a/ash/public/cpp/shelf_model_unittest.cc b/ash/public/cpp/shelf_model_unittest.cc index a7aa3efb..c69e26b 100644 --- a/ash/public/cpp/shelf_model_unittest.cc +++ b/ash/public/cpp/shelf_model_unittest.cc
@@ -80,11 +80,14 @@ DISALLOW_COPY_AND_ASSIGN(ShelfModelTest); }; -TEST_F(ShelfModelTest, IntializesAppListItem) { - EXPECT_EQ(1, model_->item_count()); - EXPECT_EQ(kAppListId, model_->items()[0].id.app_id); - // The ShelfModel does not initialize the AppList's ShelfItemDelegate. - // ShelfController does that to prevent Chrome from creating its own delegate. +TEST_F(ShelfModelTest, InitializesAppListItem) { + EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(kBackButtonId, model_->items()[0].id.app_id); + EXPECT_EQ(kAppListId, model_->items()[1].id.app_id); + // The ShelfModel does not initialize the back button's or AppList's + // ShelfItemDelegate. ShelfController does that to prevent Chrome from + // creating its own delegate. + EXPECT_FALSE(model_->GetShelfItemDelegate(ShelfID(kBackButtonId))); EXPECT_FALSE(model_->GetShelfItemDelegate(ShelfID(kAppListId))); } @@ -94,7 +97,7 @@ item1.id = ShelfID("item1"); item1.type = TYPE_PINNED_APP; int index = model_->Add(item1); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); EXPECT_LE(0, model_->ItemIndexByID(item1.id)); EXPECT_NE(model_->items().end(), model_->ItemByID(item1.id)); EXPECT_EQ("added=1", observer_->StateStringAndClear()); @@ -110,7 +113,7 @@ // Remove the item. model_->RemoveItemAt(index); - EXPECT_EQ(1, model_->item_count()); + EXPECT_EQ(2, model_->item_count()); EXPECT_EQ(-1, model_->ItemIndexByID(item1.id)); EXPECT_EQ(model_->items().end(), model_->ItemByID(item1.id)); EXPECT_EQ("removed=1", observer_->StateStringAndClear()); @@ -120,7 +123,7 @@ item2.id = ShelfID("item2"); item2.type = TYPE_PINNED_APP; index = model_->Add(item2); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); EXPECT_LE(0, model_->ItemIndexByID(item2.id)); EXPECT_NE(model_->items().end(), model_->ItemByID(item2.id)); EXPECT_EQ("added=1", observer_->StateStringAndClear()); @@ -138,7 +141,7 @@ item3.id = ShelfID("item3"); item3.type = TYPE_PINNED_APP; model_->Add(item3); - EXPECT_EQ(3, model_->item_count()); + EXPECT_EQ(4, model_->item_count()); EXPECT_LE(0, model_->ItemIndexByID(item3.id)); EXPECT_NE(model_->items().end(), model_->ItemByID(item3.id)); EXPECT_EQ("added=1", observer_->StateStringAndClear()); @@ -160,23 +163,23 @@ // Assertions around where items are added. TEST_F(ShelfModelTest, AddIndices) { - // Insert a browser shortcut, like Chrome does, it should be added at index 1. + // Insert a browser shortcut, like Chrome does, it should be added at index 2. ShelfItem browser_shortcut; browser_shortcut.id = ShelfID("browser"); browser_shortcut.type = TYPE_BROWSER_SHORTCUT; - EXPECT_EQ(1, model_->Add(browser_shortcut)); + EXPECT_EQ(2, model_->Add(browser_shortcut)); // App items should be after the browser shortcut. ShelfItem item; item.type = TYPE_APP; item.id = ShelfID("id1"); int platform_app_index1 = model_->Add(item); - EXPECT_EQ(2, platform_app_index1); + EXPECT_EQ(3, platform_app_index1); // Add another platform app item, it should follow first. item.id = ShelfID("id2"); int platform_app_index2 = model_->Add(item); - EXPECT_EQ(3, platform_app_index2); + EXPECT_EQ(4, platform_app_index2); // TYPE_PINNED_APP priority is higher than TYPE_APP but same as // TYPE_BROWSER_SHORTCUT. So TYPE_PINNED_APP is located after @@ -184,26 +187,26 @@ item.type = TYPE_PINNED_APP; item.id = ShelfID("id3"); int app_shortcut_index1 = model_->Add(item); - EXPECT_EQ(2, app_shortcut_index1); + EXPECT_EQ(3, app_shortcut_index1); item.type = TYPE_PINNED_APP; item.id = ShelfID("id4"); int app_shortcut_index2 = model_->Add(item); - EXPECT_EQ(3, app_shortcut_index2); + EXPECT_EQ(4, app_shortcut_index2); // Check that AddAt() figures out the correct indexes for app shortcuts. // TYPE_PINNED_APP and TYPE_BROWSER_SHORTCUT has the same weight. - // So TYPE_PINNED_APP is located at index 0. And, TYPE_BROWSER_SHORTCUT is - // located at index 1. + // So TYPE_PINNED_APP is located at index 2. And, TYPE_BROWSER_SHORTCUT is + // located at index 3. item.type = TYPE_PINNED_APP; item.id = ShelfID("id5"); - int app_shortcut_index3 = model_->AddAt(1, item); - EXPECT_EQ(1, app_shortcut_index3); + int app_shortcut_index3 = model_->AddAt(2, item); + EXPECT_EQ(2, app_shortcut_index3); item.type = TYPE_PINNED_APP; item.id = ShelfID("id6"); - int app_shortcut_index4 = model_->AddAt(6, item); - EXPECT_EQ(5, app_shortcut_index4); + int app_shortcut_index4 = model_->AddAt(7, item); + EXPECT_EQ(6, app_shortcut_index4); item.type = TYPE_PINNED_APP; item.id = ShelfID("id7"); @@ -216,103 +219,105 @@ // Check that AddAt() figures out the correct indexes for apps and panels. item.type = TYPE_APP; item.id = ShelfID("id8"); - int platform_app_index3 = model_->AddAt(3, item); - EXPECT_EQ(7, platform_app_index3); + int platform_app_index3 = model_->AddAt(4, item); + EXPECT_EQ(8, platform_app_index3); item.type = TYPE_APP_PANEL; item.id = ShelfID("id9"); - int app_panel_index1 = model_->AddAt(2, item); - EXPECT_EQ(10, app_panel_index1); + int app_panel_index1 = model_->AddAt(3, item); + EXPECT_EQ(11, app_panel_index1); item.type = TYPE_APP; item.id = ShelfID("id10"); - int platform_app_index4 = model_->AddAt(11, item); - EXPECT_EQ(10, platform_app_index4); + int platform_app_index4 = model_->AddAt(12, item); + EXPECT_EQ(11, platform_app_index4); item.type = TYPE_APP_PANEL; item.id = ShelfID("id11"); - int app_panel_index2 = model_->AddAt(12, item); - EXPECT_EQ(12, app_panel_index2); + int app_panel_index2 = model_->AddAt(13, item); + EXPECT_EQ(13, app_panel_index2); item.type = TYPE_APP; item.id = ShelfID("id12"); - int platform_app_index5 = model_->AddAt(7, item); - EXPECT_EQ(7, platform_app_index5); + int platform_app_index5 = model_->AddAt(8, item); + EXPECT_EQ(8, platform_app_index5); item.type = TYPE_APP_PANEL; item.id = ShelfID("id13"); - int app_panel_index3 = model_->AddAt(13, item); - EXPECT_EQ(13, app_panel_index3); + int app_panel_index3 = model_->AddAt(14, item); + EXPECT_EQ(14, app_panel_index3); // Right aligned index should be the first app panel index. - EXPECT_EQ(12, model_->FirstPanelIndex()); + EXPECT_EQ(13, model_->FirstPanelIndex()); - EXPECT_EQ(TYPE_BROWSER_SHORTCUT, model_->items()[2].type); - EXPECT_EQ(TYPE_APP_LIST, model_->items()[0].type); + EXPECT_EQ(TYPE_BACK_BUTTON, model_->items()[0].type); + EXPECT_EQ(TYPE_APP_LIST, model_->items()[1].type); + EXPECT_EQ(TYPE_BROWSER_SHORTCUT, model_->items()[4].type); } // Test that the indexes for the running applications are properly determined. TEST_F(ShelfModelTest, FirstRunningAppIndex) { - // Insert the browser shortcut at index 1 and check that the running + // Insert the browser shortcut at index 2 and check that the running // application index would be behind it. ShelfItem item; item.id = ShelfID("browser"); item.type = TYPE_BROWSER_SHORTCUT; - EXPECT_EQ(1, model_->Add(item)); - EXPECT_EQ(2, model_->FirstRunningAppIndex()); + EXPECT_EQ(2, model_->Add(item)); + EXPECT_EQ(3, model_->FirstRunningAppIndex()); // Insert a panel application at the end and check that the running // application index would be at / before the application panel. item.type = TYPE_APP_PANEL; item.id = ShelfID("app panel"); - EXPECT_EQ(2, model_->Add(item)); - EXPECT_EQ(2, model_->FirstRunningAppIndex()); + EXPECT_EQ(3, model_->Add(item)); + EXPECT_EQ(3, model_->FirstRunningAppIndex()); // Insert an application shortcut and make sure that the running application // index would be behind it. item.type = TYPE_PINNED_APP; item.id = ShelfID("pinned app"); - EXPECT_EQ(2, model_->Add(item)); - EXPECT_EQ(3, model_->FirstRunningAppIndex()); + EXPECT_EQ(3, model_->Add(item)); + EXPECT_EQ(4, model_->FirstRunningAppIndex()); // Insert a two app items and check the first running app index. item.type = TYPE_APP; item.id = ShelfID("app1"); - EXPECT_EQ(3, model_->Add(item)); - EXPECT_EQ(3, model_->FirstRunningAppIndex()); - item.id = ShelfID("app2"); EXPECT_EQ(4, model_->Add(item)); - EXPECT_EQ(3, model_->FirstRunningAppIndex()); + EXPECT_EQ(4, model_->FirstRunningAppIndex()); + item.id = ShelfID("app2"); + EXPECT_EQ(5, model_->Add(item)); + EXPECT_EQ(4, model_->FirstRunningAppIndex()); } // Test item reordering on type/weight (eg. pinning) changes. crbug.com/248769. TEST_F(ShelfModelTest, ReorderOnTypeChanges) { - EXPECT_EQ(TYPE_APP_LIST, model_->items()[0].type); + EXPECT_EQ(TYPE_BACK_BUTTON, model_->items()[0].type); + EXPECT_EQ(TYPE_APP_LIST, model_->items()[1].type); // Add three pinned items. ShelfItem item1; item1.type = TYPE_PINNED_APP; item1.id = ShelfID("id1"); int app1_index = model_->Add(item1); - EXPECT_EQ(1, app1_index); + EXPECT_EQ(2, app1_index); ShelfItem item2; item2.type = TYPE_PINNED_APP; item2.id = ShelfID("id2"); int app2_index = model_->Add(item2); - EXPECT_EQ(2, app2_index); + EXPECT_EQ(3, app2_index); ShelfItem item3; item3.type = TYPE_PINNED_APP; item3.id = ShelfID("id3"); int app3_index = model_->Add(item3); - EXPECT_EQ(3, app3_index); + EXPECT_EQ(4, app3_index); // Unpinning an item moves it behind the shortcuts. - EXPECT_EQ(item3.id, model_->items()[3].id); + EXPECT_EQ(item3.id, model_->items()[4].id); item2.type = TYPE_APP; model_->Set(app2_index, item2); - EXPECT_EQ(item2.id, model_->items()[3].id); + EXPECT_EQ(item2.id, model_->items()[4].id); } // Test getting the index of ShelfIDs as a check for item presence. @@ -350,31 +355,31 @@ // Check the initial state. EXPECT_FALSE(model_->IsAppPinned(app_id)); - EXPECT_EQ(1, model_->item_count()); + EXPECT_EQ(2, model_->item_count()); // Pinning a previously unknown app should add an item. model_->PinAppWithID(app_id); EXPECT_TRUE(model_->IsAppPinned(app_id)); - EXPECT_EQ(2, model_->item_count()); - EXPECT_EQ(TYPE_PINNED_APP, model_->items()[1].type); - EXPECT_EQ(app_id, model_->items()[1].id.app_id); + EXPECT_EQ(3, model_->item_count()); + EXPECT_EQ(TYPE_PINNED_APP, model_->items()[2].type); + EXPECT_EQ(app_id, model_->items()[2].id.app_id); // Pinning the same app id again should have no change. model_->PinAppWithID(app_id); EXPECT_TRUE(model_->IsAppPinned(app_id)); - EXPECT_EQ(2, model_->item_count()); - EXPECT_EQ(TYPE_PINNED_APP, model_->items()[1].type); - EXPECT_EQ(app_id, model_->items()[1].id.app_id); + EXPECT_EQ(3, model_->item_count()); + EXPECT_EQ(TYPE_PINNED_APP, model_->items()[2].type); + EXPECT_EQ(app_id, model_->items()[2].id.app_id); // Unpinning the app should remove the item. model_->UnpinAppWithID(app_id); EXPECT_FALSE(model_->IsAppPinned(app_id)); - EXPECT_EQ(1, model_->item_count()); + EXPECT_EQ(2, model_->item_count()); // Unpinning the same app id again should have no change. model_->UnpinAppWithID(app_id); EXPECT_FALSE(model_->IsAppPinned(app_id)); - EXPECT_EQ(1, model_->item_count()); + EXPECT_EQ(2, model_->item_count()); } // Test pinning and unpinning a running app, and checking if it is pinned. @@ -383,7 +388,7 @@ // Check the initial state. EXPECT_FALSE(model_->IsAppPinned(app_id)); - EXPECT_EQ(1, model_->item_count()); + EXPECT_EQ(2, model_->item_count()); // Add an example running app. ShelfItem item; @@ -394,35 +399,35 @@ // The item should be added but not pinned. EXPECT_FALSE(model_->IsAppPinned(app_id)); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); EXPECT_EQ(TYPE_APP, model_->items()[index].type); EXPECT_EQ(item.id, model_->items()[index].id); // Pinning the item should just change its type. model_->PinAppWithID(app_id); EXPECT_TRUE(model_->IsAppPinned(app_id)); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); EXPECT_EQ(TYPE_PINNED_APP, model_->items()[index].type); EXPECT_EQ(item.id, model_->items()[index].id); // Pinning the same app id again should have no change. model_->PinAppWithID(app_id); EXPECT_TRUE(model_->IsAppPinned(app_id)); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); EXPECT_EQ(TYPE_PINNED_APP, model_->items()[index].type); EXPECT_EQ(item.id, model_->items()[index].id); // Unpinning the app should leave the item unpinnned but running. model_->UnpinAppWithID(app_id); EXPECT_FALSE(model_->IsAppPinned(app_id)); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); EXPECT_EQ(TYPE_APP, model_->items()[index].type); EXPECT_EQ(item.id, model_->items()[index].id); // Unpinning the same app id again should have no change. model_->UnpinAppWithID(app_id); EXPECT_FALSE(model_->IsAppPinned(app_id)); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); EXPECT_EQ(TYPE_APP, model_->items()[index].type); EXPECT_EQ(item.id, model_->items()[index].id); }
diff --git a/ash/public/cpp/shelf_struct_traits.h b/ash/public/cpp/shelf_struct_traits.h index 51b7ecc5..e4d42f9 100644 --- a/ash/public/cpp/shelf_struct_traits.h +++ b/ash/public/cpp/shelf_struct_traits.h
@@ -152,6 +152,8 @@ return ash::mojom::ShelfItemType::APP; case ash::TYPE_DIALOG: return ash::mojom::ShelfItemType::DIALOG; + case ash::TYPE_BACK_BUTTON: + return ash::mojom::ShelfItemType::BACK_BUTTON; case ash::TYPE_UNDEFINED: return ash::mojom::ShelfItemType::UNDEFINED; } @@ -180,6 +182,9 @@ case ash::mojom::ShelfItemType::DIALOG: *out = ash::TYPE_DIALOG; return true; + case ash::mojom::ShelfItemType::BACK_BUTTON: + *out = ash::TYPE_BACK_BUTTON; + return true; case ash::mojom::ShelfItemType::UNDEFINED: *out = ash::TYPE_UNDEFINED; return true;
diff --git a/ash/public/cpp/shelf_types.cc b/ash/public/cpp/shelf_types.cc index b5d1bf99..8392f17 100644 --- a/ash/public/cpp/shelf_types.cc +++ b/ash/public/cpp/shelf_types.cc
@@ -19,7 +19,8 @@ bool IsValidShelfItemType(int64_t type) { return type == TYPE_APP_PANEL || type == TYPE_PINNED_APP || type == TYPE_APP_LIST || type == TYPE_BROWSER_SHORTCUT || - type == TYPE_APP || type == TYPE_DIALOG || type == TYPE_UNDEFINED; + type == TYPE_APP || type == TYPE_DIALOG || type == TYPE_BACK_BUTTON || + type == TYPE_UNDEFINED; } ShelfID::ShelfID(const std::string& app_id, const std::string& launch_id)
diff --git a/ash/public/cpp/shelf_types.h b/ash/public/cpp/shelf_types.h index 27e81c4b..cf22ec4 100644 --- a/ash/public/cpp/shelf_types.h +++ b/ash/public/cpp/shelf_types.h
@@ -116,6 +116,9 @@ // Represents an open dialog. TYPE_DIALOG, + // Represents the back button, which is shown in tablet mode. + TYPE_BACK_BUTTON, + // Default value. TYPE_UNDEFINED, };
diff --git a/ash/public/interfaces/cast_config.mojom b/ash/public/interfaces/cast_config.mojom index 72b4e8e..2f27a9c 100644 --- a/ash/public/interfaces/cast_config.mojom +++ b/ash/public/interfaces/cast_config.mojom
@@ -13,7 +13,8 @@ MEETING = 3, HANGOUT = 4, EDUCATION = 5, - GENERIC = 6 + WIRED_DISPLAY = 6, + GENERIC = 7 }; struct CastSink {
diff --git a/ash/public/interfaces/shelf.mojom b/ash/public/interfaces/shelf.mojom index 58d155a..ed01b3c 100644 --- a/ash/public/interfaces/shelf.mojom +++ b/ash/public/interfaces/shelf.mojom
@@ -39,16 +39,17 @@ // The type of a shelf item. // These values match ash::ShelfItemType. enum ShelfItemType { - PANEL, // A running app panel. - PINNED_APP, // A pinned app, which may be running or not. - APP_LIST, // An item that toggles visiblity of the app list. - BROWSER, // The browser shortcut, the browser may be running or not. - APP, // An unpinned running app window. Supports these app types: - // - Extension "V1" (legacy packaged and hosted) apps, - // - Extension "V2" (platform) apps, - // - ARC (App Runtime for Chrome - Android Play Store) apps. - DIALOG, // An open dialog. - UNDEFINED, // Default value. + PANEL, // A running app panel. + PINNED_APP, // A pinned app, which may be running or not. + APP_LIST, // An item that toggles visiblity of the app list. + BROWSER, // The browser shortcut, the browser may be running or not. + APP, // An unpinned running app window. Supports these app types: + // - Extension "V1" (legacy packaged and hosted) apps, + // - Extension "V2" (platform) apps, + // - ARC (App Runtime for Chrome - Android Play Store) apps. + DIALOG, // An open dialog. + BACK_BUTTON, // The back button, which is shown in tablet mode. + UNDEFINED, // Default value. }; // Source of the launch or activation request, for tracking.
diff --git a/ash/resources/vector_icons/shelf_back.1x.icon b/ash/resources/vector_icons/shelf_back.1x.icon index 282a30f2..fe152e3 100644 --- a/ash/resources/vector_icons/shelf_back.1x.icon +++ b/ash/resources/vector_icons/shelf_back.1x.icon
@@ -3,14 +3,7 @@ // found in the LICENSE file. CANVAS_DIMENSIONS, 16, -FLIPS_IN_RTL, -MOVE_TO, 0, 0, -R_H_LINE_TO, 16, -R_V_LINE_TO, 16, -H_LINE_TO, 0, -CLOSE, NEW_PATH, -PATH_COLOR_ARGB, 0xFF, 0xFF, 0xFF, 0xFF, MOVE_TO, 5.2f, 7, H_LINE_TO, 15, R_V_LINE_TO, 2,
diff --git a/ash/resources/vector_icons/shelf_back.icon b/ash/resources/vector_icons/shelf_back.icon index 87b388a..193bf72 100644 --- a/ash/resources/vector_icons/shelf_back.icon +++ b/ash/resources/vector_icons/shelf_back.icon
@@ -3,14 +3,7 @@ // found in the LICENSE file. CANVAS_DIMENSIONS, 32, -FLIPS_IN_RTL, -MOVE_TO, 0, 0, -R_H_LINE_TO, 32, -R_V_LINE_TO, 32, -H_LINE_TO, 0, -CLOSE, NEW_PATH, -PATH_COLOR_ARGB, 0xFF, 0xFF, 0xFF, 0xFF, MOVE_TO, 8.56f, 17.99f, R_LINE_TO, 9.65f, 9.98f, LINE_TO, 16.18f, 30,
diff --git a/ash/session/multiprofiles_intro_dialog.cc b/ash/session/multiprofiles_intro_dialog.cc index 0c51609..874ce45d 100644 --- a/ash/session/multiprofiles_intro_dialog.cc +++ b/ash/session/multiprofiles_intro_dialog.cc
@@ -78,7 +78,7 @@ SetBorder( views::CreateEmptyBorder(views::LayoutProvider::Get()->GetInsetsMetric( views::INSETS_DIALOG_TITLE))); - SetLayoutManager(new views::FillLayout()); + SetLayoutManager(std::make_unique<views::FillLayout>()); // Explanation string views::Label* label = new views::Label(
diff --git a/ash/session/session_controller.h b/ash/session/session_controller.h index a8084e0..b604075 100644 --- a/ash/session/session_controller.h +++ b/ash/session/session_controller.h
@@ -223,9 +223,7 @@ const AccountId& account_id, std::unique_ptr<PrefService> pref_service); - // Bindings for mojom::SessionController interface. - // TODO(jamescook): This should be mojo::Binding<> but that causes crashes in - // browser test UserAddingScreenTest.AddingSeveralUsers. + // Bindings for users of the mojom::SessionController interface. mojo::BindingSet<mojom::SessionController> bindings_; // Client interface to session manager code (chrome).
diff --git a/ash/session/teleport_warning_dialog.cc b/ash/session/teleport_warning_dialog.cc index 6a41069..59e2376 100644 --- a/ash/session/teleport_warning_dialog.cc +++ b/ash/session/teleport_warning_dialog.cc
@@ -78,7 +78,7 @@ SetBorder( views::CreateEmptyBorder(views::LayoutProvider::Get()->GetInsetsMetric( views::INSETS_DIALOG_TITLE))); - SetLayoutManager(new views::FillLayout()); + SetLayoutManager(std::make_unique<views::FillLayout>()); // Explanation string views::Label* label = new views::Label(
diff --git a/ash/shelf/app_list_button.cc b/ash/shelf/app_list_button.cc index 9cf55d3..aac0bfc9 100644 --- a/ash/shelf/app_list_button.cc +++ b/ash/shelf/app_list_button.cc
@@ -9,7 +9,6 @@ #include <utility> #include "ash/public/cpp/shelf_types.h" -#include "ash/resources/vector_icons/vector_icons.h" #include "ash/session/session_controller.h" #include "ash/shelf/assistant_overlay.h" #include "ash/shelf/ink_drop_button_listener.h" @@ -20,7 +19,6 @@ #include "ash/strings/grit/ash_strings.h" #include "ash/system/tray/tray_popup_utils.h" #include "ash/voice_interaction/voice_interaction_controller.h" -#include "ash/wm/tablet_mode/tablet_mode_controller.h" #include "base/command_line.h" #include "base/metrics/histogram_macros.h" #include "base/metrics/user_metrics.h" @@ -28,22 +26,10 @@ #include "base/timer/timer.h" #include "chromeos/chromeos_switches.h" #include "components/signin/core/account_id/account_id.h" -#include "third_party/skia/include/core/SkPath.h" #include "ui/accessibility/ax_node_data.h" #include "ui/app_list/presenter/app_list.h" -#include "ui/aura/window_tree_host.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/compositor/layer_animation_element.h" -#include "ui/compositor/layer_animation_observer.h" -#include "ui/compositor/layer_animation_sequence.h" -#include "ui/compositor/paint_context.h" -#include "ui/compositor/paint_recorder.h" -#include "ui/events/event_sink.h" #include "ui/gfx/canvas.h" -#include "ui/gfx/image/canvas_image_source.h" -#include "ui/gfx/image/image_skia.h" -#include "ui/gfx/image/image_skia_operations.h" -#include "ui/gfx/paint_vector_icon.h" #include "ui/gfx/scoped_canvas.h" #include "ui/views/animation/flood_fill_ink_drop_ripple.h" #include "ui/views/animation/ink_drop_impl.h" @@ -66,8 +52,6 @@ ShelfView* shelf_view, Shelf* shelf) : views::ImageButton(nullptr), - is_showing_app_list_(false), - background_color_(kShelfDefaultBaseColor), listener_(listener), shelf_view_(shelf_view), shelf_(shelf) { @@ -86,11 +70,6 @@ SetFocusPainter(TrayPopupUtils::CreateFocusPainter()); set_notify_action(Button::NOTIFY_ON_PRESS); - // Disable canvas flipping for this view, otherwise there will be a lot of - // edge cases with ink drops, events, etc. in tablet mode where we have two - // buttons in one. - EnableCanvasFlippingForRTLUI(false); - // Initialize voice interaction overlay and sync the flags if active user // session has already started. This could happen when an external monitor // is plugged in. @@ -107,47 +86,18 @@ } void AppListButton::OnAppListShown() { - // Set |last_event_is_back_event_| false to drop ink on the app list circle. - last_event_is_back_event_ = false; AnimateInkDrop(views::InkDropState::ACTIVATED, nullptr); is_showing_app_list_ = true; shelf_->UpdateAutoHideState(); } void AppListButton::OnAppListDismissed() { - // Set |last_event_is_back_event_| false to drop ink on the app list circle. - last_event_is_back_event_ = false; AnimateInkDrop(views::InkDropState::DEACTIVATED, nullptr); is_showing_app_list_ = false; shelf_->UpdateAutoHideState(); } -void AppListButton::UpdateShelfItemBackground(SkColor color) { - background_color_ = color; - SchedulePaint(); -} - void AppListButton::OnGestureEvent(ui::GestureEvent* event) { - last_event_is_back_event_ = IsBackEvent(event->location()); - // Handle gesture events that are on the back button. - if (last_event_is_back_event_) { - switch (event->type()) { - case ui::ET_GESTURE_TAP: - AnimateInkDrop(views::InkDropState::ACTION_TRIGGERED, event); - GenerateAndSendBackEvent(*event); - return; - case ui::ET_GESTURE_TAP_CANCEL: - AnimateInkDrop(views::InkDropState::HIDDEN, event); - return; - case ui::ET_GESTURE_TAP_DOWN: - AnimateInkDrop(views::InkDropState::ACTION_PENDING, event); - GenerateAndSendBackEvent(*event); - return; - default: - return; - } - } - // Handle gesture events that are on the app list circle. switch (event->type()) { case ui::ET_GESTURE_SCROLL_BEGIN: @@ -204,26 +154,14 @@ } bool AppListButton::OnMousePressed(const ui::MouseEvent& event) { - last_event_is_back_event_ = IsBackEvent(event.location()); - if (last_event_is_back_event_) { - AnimateInkDrop(views::InkDropState::ACTION_PENDING, &event); - GenerateAndSendBackEvent(*event.AsLocatedEvent()); - } else { - ImageButton::OnMousePressed(event); - shelf_view_->PointerPressedOnButton(this, ShelfView::MOUSE, event); - } + ImageButton::OnMousePressed(event); + shelf_view_->PointerPressedOnButton(this, ShelfView::MOUSE, event); return true; } void AppListButton::OnMouseReleased(const ui::MouseEvent& event) { - last_event_is_back_event_ = IsBackEvent(event.location()); - if (last_event_is_back_event_) { - AnimateInkDrop(views::InkDropState::ACTION_TRIGGERED, &event); - GenerateAndSendBackEvent(*event.AsLocatedEvent()); - } else { - ImageButton::OnMouseReleased(event); - shelf_view_->PointerReleasedOnButton(this, ShelfView::MOUSE, false); - } + ImageButton::OnMouseReleased(event); + shelf_view_->PointerReleasedOnButton(this, ShelfView::MOUSE, false); } void AppListButton::OnMouseCaptureLost() { @@ -244,8 +182,7 @@ std::unique_ptr<views::InkDropRipple> AppListButton::CreateInkDropRipple() const { - gfx::Point center = last_event_is_back_event_ ? GetBackButtonCenterPoint() - : GetAppListButtonCenterPoint(); + gfx::Point center = GetCenterPoint(); gfx::Rect bounds(center.x() - kAppListButtonRadius, center.y() - kAppListButtonRadius, 2 * kAppListButtonRadius, 2 * kAppListButtonRadius); @@ -277,95 +214,12 @@ } std::unique_ptr<views::InkDropMask> AppListButton::CreateInkDropMask() const { - return std::make_unique<views::CircleInkDropMask>( - size(), - last_event_is_back_event_ ? GetBackButtonCenterPoint() - : GetAppListButtonCenterPoint(), - kAppListButtonRadius); + return std::make_unique<views::CircleInkDropMask>(size(), GetCenterPoint(), + kAppListButtonRadius); } void AppListButton::PaintButtonContents(gfx::Canvas* canvas) { - const bool is_tablet_mode = Shell::Get() - ->tablet_mode_controller() - ->IsTabletModeWindowManagerEnabled(); - const double current_animation_value = - shelf_view_->GetAppListButtonAnimationCurrentValue(); - gfx::PointF circle_center(GetAppListButtonCenterPoint()); - - // Paint the circular background. - cc::PaintFlags bg_flags; - bg_flags.setColor(background_color_); - bg_flags.setAntiAlias(true); - bg_flags.setStyle(cc::PaintFlags::kFill_Style); - - if (is_tablet_mode || shelf_->is_tablet_mode_animation_running()) { - // Draw the tablet mode app list background. It will look something like - // [1] when the shelf is horizontal and [2] when the shelf is vertical, - // where 1. is the back button and 2. is the app launcher circle. - // _____ - // [1] _______________ [2] / 1. \ - // / \ | | - // | 1. 2. | | 2. | - // \_______________/ \_____/ - - // Calculate the rectangular bounds of the path. The primary axis will be - // the distance between the back button and app circle centers and the - // secondary axis will be 2 * |kAppListButtonRadius|. The origin will be - // situated such that the back button center and app circle center are - // located equal distance from the sides parallel to the primary axis. See - // diagrams below; (1) is the back button and (2) is the app circle. - // - // ___________ ____(1)____ - // | | | | - // (1) (2) | | - // |_________| | | - // |___(2)___| - gfx::PointF back_center(GetBackButtonCenterPoint()); - float min_x = std::min(back_center.x(), circle_center.x()); - - gfx::RectF background_bounds( - shelf_->PrimaryAxisValue(min_x, min_x - kAppListButtonRadius), - shelf_->PrimaryAxisValue(back_center.y() - kAppListButtonRadius, - back_center.y()), - shelf_->PrimaryAxisValue(std::abs(circle_center.x() - back_center.x()), - 2 * kAppListButtonRadius), - shelf_->PrimaryAxisValue( - 2 * kAppListButtonRadius, - std::abs(circle_center.y() - back_center.y()))); - - // Create the path by drawing two circles, one around the back button and - // one around the app list circle. Join them with the rectangle calculated - // previously. - SkPath path; - path.addCircle(circle_center.x(), circle_center.y(), kAppListButtonRadius); - path.addCircle(back_center.x(), back_center.y(), kAppListButtonRadius); - path.addRect(background_bounds.x(), background_bounds.y(), - background_bounds.right(), background_bounds.bottom()); - canvas->DrawPath(path, bg_flags); - - // Draw the back button icon. Its flipping for RTL is handled by the - // FLIPS_IN_RTL flag set in the its .icon file. - gfx::ImageSkia back_button = - CreateVectorIcon(kShelfBackIcon, SK_ColorTRANSPARENT); - - // Paint the back button in tablet mode and handle transition animations. - int opacity = is_tablet_mode ? 255 : 0; - if (shelf_->is_tablet_mode_animation_running()) { - if (current_animation_value <= 0.0) { - // The mode flipped but the animation hasn't begun, paint the old state. - opacity = is_tablet_mode ? 0 : 255; - } else { - // Animate 0->255 into tablet mode, animate 255->0 into normal mode. - opacity = static_cast<int>(current_animation_value * 255.0); - opacity = is_tablet_mode ? opacity : (255 - opacity); - } - } - - canvas->DrawImageInt(back_button, back_center.x() - back_button.width() / 2, - back_center.y() - back_button.height() / 2, opacity); - } else { - canvas->DrawCircle(circle_center, kAppListButtonRadius, bg_flags); - } + gfx::PointF circle_center(GetCenterPoint()); // Paint a white ring as the foreground for the app list circle. The ceil/dsf // math assures that the ring draws sharply and is centered at all scale @@ -411,31 +265,18 @@ } } -gfx::Point AppListButton::GetAppListButtonCenterPoint() const { +gfx::Point AppListButton::GetCenterPoint() const { // For a bottom-aligned shelf, the button bounds could have a larger height // than width (in the case of touch-dragging the shelf upwards) or a larger // width than height (in the case of a shelf hide/show animation), so adjust // the y-position of the circle's center to ensure correct layout. Similarly - // adjust the x-position for a left- or right-aligned shelf. In tablet - // mode, the button will increase its primary axis size to accommodate the - // back button arrow in addition to the app list button circle. + // adjust the x-position for a left- or right-aligned shelf. const int x_mid = width() / 2.f; const int y_mid = height() / 2.f; - const bool is_tablet_mode = Shell::Get()->tablet_mode_controller() && - Shell::Get() - ->tablet_mode_controller() - ->IsTabletModeWindowManagerEnabled(); - const bool is_animating = shelf_->is_tablet_mode_animation_running(); const ShelfAlignment alignment = shelf_->alignment(); if (alignment == SHELF_ALIGNMENT_BOTTOM || alignment == SHELF_ALIGNMENT_BOTTOM_LOCKED) { - if (is_tablet_mode || is_animating) { - // In RTL, the app list circle is shown to the left of the back button. - return gfx::Point( - View::GetMirroredXInView(width() - kShelfButtonSize / 2.f), - kShelfButtonSize / 2.f); - } return gfx::Point(x_mid, x_mid); } else if (alignment == SHELF_ALIGNMENT_RIGHT) { return gfx::Point(y_mid, y_mid); @@ -445,32 +286,6 @@ } } -gfx::Point AppListButton::GetBackButtonCenterPoint() const { - // In RTL, the app list circle is shown to the right of the back button. If - // the shelf orientation is not horizontal then the back button center x - // coordinate will be the same in LTR or RTL. - return gfx::Point(View::GetMirroredXInView(kShelfButtonSize / 2.f), - kShelfButtonSize / 2.f); -} - -void AppListButton::OnBoundsAnimationStarted() { - // TODO(crbug.com/758402): Update ink drop bounds with app list button bounds. - // Hides the app list button ink drop during a bounds animation. - if (is_showing_app_list_) - AnimateInkDrop(views::InkDropState::DEACTIVATED, nullptr); -} - -void AppListButton::OnBoundsAnimationFinished() { - // TODO(crbug.com/758402): Update ink drop bounds with app list button bounds. - // Reactivate the app list button ink drop after a bounds animation is - // finished. - if (is_showing_app_list_) - AnimateInkDrop(views::InkDropState::ACTIVATED, nullptr); - - // Redraw to ensure the app list button is drawn at its expected final state. - SchedulePaint(); -} - void AppListButton::OnAppListVisibilityChanged(bool shown, aura::Window* root_window) { aura::Window* window = GetWidget() ? GetWidget()->GetNativeWindow() : nullptr; @@ -553,44 +368,6 @@ assistant_overlay_->StartAnimation(show_icon); } -bool AppListButton::IsBackEvent(const gfx::Point& location) { - if (!Shell::Get() - ->tablet_mode_controller() - ->IsTabletModeWindowManagerEnabled()) { - return false; - } - - return (location - GetBackButtonCenterPoint()).LengthSquared() < - (location - GetAppListButtonCenterPoint()).LengthSquared(); -} - -void AppListButton::GenerateAndSendBackEvent( - const ui::LocatedEvent& original_event) { - ui::EventType event_type; - switch (original_event.type()) { - case ui::ET_MOUSE_PRESSED: - case ui::ET_GESTURE_TAP_DOWN: - event_type = ui::ET_KEY_PRESSED; - break; - case ui::ET_MOUSE_RELEASED: - case ui::ET_GESTURE_TAP: - event_type = ui::ET_KEY_RELEASED; - base::RecordAction(base::UserMetricsAction("Tablet_BackButton")); - break; - default: - return; - } - - // Send the back event to the root window of the app list button's widget. - const views::Widget* widget = GetWidget(); - if (widget && widget->GetNativeWindow()) { - aura::Window* root_window = widget->GetNativeWindow()->GetRootWindow(); - ui::KeyEvent key_event(event_type, ui::VKEY_BROWSER_BACK, ui::EF_NONE); - ignore_result( - root_window->GetHost()->event_sink()->OnEventFromSource(&key_event)); - } -} - bool AppListButton::UseVoiceInteractionStyle() { VoiceInteractionController* controller = Shell::Get()->voice_interaction_controller();
diff --git a/ash/shelf/app_list_button.h b/ash/shelf/app_list_button.h index 78895df..273b0f4 100644 --- a/ash/shelf/app_list_button.h +++ b/ash/shelf/app_list_button.h
@@ -20,10 +20,11 @@ } // namespace base namespace ash { + +class AssistantOverlay; class InkDropButtonListener; class Shelf; class ShelfView; -class AssistantOverlay; // Button used for the AppList icon on the shelf. class ASH_EXPORT AppListButton : public views::ImageButton, @@ -41,24 +42,12 @@ bool is_showing_app_list() const { return is_showing_app_list_; } - // Updates background and schedules a paint. - void UpdateShelfItemBackground(SkColor color); - // views::ImageButton: void OnGestureEvent(ui::GestureEvent* event) override; // Get the center point of the app list button circle used to draw its // background and ink drops. - gfx::Point GetAppListButtonCenterPoint() const; - - // Get the center point of the app list button back arrow. Returns an empty - // gfx::Point if the back arrow is not shown. - gfx::Point GetBackButtonCenterPoint() const; - - // Called by ShelfView to notify the app list button that it has started or - // finished a bounds animation. - void OnBoundsAnimationStarted(); - void OnBoundsAnimationFinished(); + gfx::Point GetCenterPoint() const; protected: // views::ImageButton: @@ -90,15 +79,6 @@ void StartVoiceInteractionAnimation(); - // Helper function to determine whether and event at |location| should be - // handled by the back button or the app list circle. Returns false if we are - // not in tablet mode (there is no back button). - bool IsBackEvent(const gfx::Point& location); - - // Generate and send a VKEY_BROWSER_BACK key event when the back button - // portion is clicked or tapped. - void GenerateAndSendBackEvent(const ui::LocatedEvent& original_event); - // Whether the voice interaction style should be used. bool UseVoiceInteractionStyle(); @@ -107,10 +87,7 @@ // True if the app list is currently showing for this display. // This is useful because other IsApplistVisible functions aren't per-display. - bool is_showing_app_list_; - - // Color used to paint the background. - SkColor background_color_; + bool is_showing_app_list_ = false; InkDropButtonListener* listener_; ShelfView* shelf_view_; @@ -122,10 +99,6 @@ std::unique_ptr<base::OneShotTimer> assistant_animation_hide_delay_timer_; base::TimeTicks voice_interaction_start_timestamp_; - // Flag that gets set each time we receive a mouse or gesture event. It is - // then used to render the ink drop in the right location. - bool last_event_is_back_event_ = false; - DISALLOW_COPY_AND_ASSIGN(AppListButton); };
diff --git a/ash/shelf/app_list_button_unittest.cc b/ash/shelf/app_list_button_unittest.cc index 6198917..208d44f 100644 --- a/ash/shelf/app_list_button_unittest.cc +++ b/ash/shelf/app_list_button_unittest.cc
@@ -19,12 +19,10 @@ #include "ash/voice_interaction/voice_interaction_controller.h" #include "ash/wm/tablet_mode/tablet_mode_controller.h" #include "base/command_line.h" -#include "base/i18n/rtl.h" #include "base/test/scoped_command_line.h" #include "chromeos/chromeos_switches.h" #include "ui/app_list/presenter/app_list.h" #include "ui/app_list/presenter/test/test_app_list_presenter.h" -#include "ui/events/event_constants.h" #include "ui/events/test/event_generator.h" namespace ash { @@ -98,7 +96,7 @@ EXPECT_EQ(SHELF_ALIGNMENT_BOTTOM, shelf->alignment()); // Start the drags from the center of the app list button. - gfx::Point start = app_list_button()->GetAppListButtonCenterPoint(); + gfx::Point start = app_list_button()->GetCenterPoint(); views::View::ConvertPointToScreen(app_list_button(), &start); // Swiping up less than the threshold should trigger a peeking app list. gfx::Point end = start; @@ -126,6 +124,23 @@ test_app_list_presenter.app_list_state()); } +TEST_F(AppListButtonTest, ButtonPositionInTabletMode) { + // Finish all setup tasks. In particular we want to finish the + // GetSwitchStates post task in (Fake)PowerManagerClient which is triggered + // by TabletModeController otherwise this will cause tablet mode to exit + // while we wait for animations in the test. + RunAllPendingInMessageLoop(); + + ShelfViewTestAPI test_api(GetPrimaryShelf()->GetShelfViewForTesting()); + Shell::Get()->tablet_mode_controller()->EnableTabletModeWindowManager(true); + test_api.RunMessageLoopUntilAnimationsDone(); + EXPECT_GT(app_list_button()->bounds().x(), 0); + + Shell::Get()->tablet_mode_controller()->EnableTabletModeWindowManager(false); + test_api.RunMessageLoopUntilAnimationsDone(); + EXPECT_EQ(0, app_list_button()->bounds().x()); +} + class VoiceInteractionAppListButtonTest : public AppListButtonTest { public: VoiceInteractionAppListButtonTest() = default; @@ -224,68 +239,4 @@ EXPECT_EQ(2u, test_app_list_presenter.voice_session_count()); } -namespace { - -class BackButtonAppListButtonTest : public AppListButtonTest, - public testing::WithParamInterface<bool> { - public: - BackButtonAppListButtonTest() : is_rtl_(GetParam()) {} - ~BackButtonAppListButtonTest() override = default; - - void SetUp() override { - if (is_rtl_) { - original_locale_ = base::i18n::GetConfiguredLocale(); - base::i18n::SetICUDefaultLocale("he"); - } - AppListButtonTest::SetUp(); - ASSERT_EQ(is_rtl_, base::i18n::IsRTL()); - } - - void TearDown() override { - if (is_rtl_) - base::i18n::SetICUDefaultLocale(original_locale_); - AppListButtonTest::TearDown(); - } - - private: - bool is_rtl_ = false; - std::string original_locale_; - - DISALLOW_COPY_AND_ASSIGN(BackButtonAppListButtonTest); -}; - -INSTANTIATE_TEST_CASE_P( - /* prefix intentionally left blank due to only one parameterization */, - BackButtonAppListButtonTest, - testing::Bool()); - -} // namespace - -// Verify the locations of the back button and app list button. -TEST_P(BackButtonAppListButtonTest, BackButtonAppListButtonLocation) { - ShelfViewTestAPI test_api(GetPrimaryShelf()->GetShelfViewForTesting()); - - // Finish all setup tasks. In particular we want to finish the GetSwitchStates - // post task in (Fake)PowerManagerClient which is triggered by - // TabletModeController otherwise this will cause tablet mode to exit while we - // wait for animations in the test. - RunAllPendingInMessageLoop(); - - Shell::Get()->tablet_mode_controller()->EnableTabletModeWindowManager(true); - test_api.RunMessageLoopUntilAnimationsDone(); - - gfx::Point back_button_center = app_list_button()->GetBackButtonCenterPoint(); - gfx::Point app_list_button_center = - app_list_button()->GetAppListButtonCenterPoint(); - - // Verify that in rtl, the app list button is left of the back button and vice - // versa. - if (base::i18n::IsRTL()) - EXPECT_LT(app_list_button_center.x(), back_button_center.x()); - else - EXPECT_GT(app_list_button_center.x(), back_button_center.x()); - - Shell::Get()->tablet_mode_controller()->EnableTabletModeWindowManager(false); -} - } // namespace ash
diff --git a/ash/shelf/assistant_overlay.cc b/ash/shelf/assistant_overlay.cc index 68ba71aa..b81118df 100644 --- a/ash/shelf/assistant_overlay.cc +++ b/ash/shelf/assistant_overlay.cc
@@ -631,7 +631,7 @@ kRippleCircleStartRadiusDip / kRippleCircleInitRadiusDip; gfx::Transform transform; - const gfx::Point center = host_view_->GetAppListButtonCenterPoint(); + const gfx::Point center = host_view_->GetCenterPoint(); transform.Translate(center.x() - kRippleCircleStartRadiusDip, center.y() - kRippleCircleStartRadiusDip); transform.Scale(scale_factor, scale_factor); @@ -734,7 +734,7 @@ void AssistantOverlay::BurstAnimation() { animation_state_ = AnimationState::BURSTING; - gfx::Point center = host_view_->GetAppListButtonCenterPoint(); + gfx::Point center = host_view_->GetCenterPoint(); gfx::Transform transform; // Setup ripple animations. @@ -810,7 +810,7 @@ animation_state_ = AnimationState::WAITING; - gfx::Point center = host_view_->GetAppListButtonCenterPoint(); + gfx::Point center = host_view_->GetCenterPoint(); gfx::Transform transform; ripple_layer_->SetOpacity(0); @@ -874,7 +874,7 @@ kRippleCircleStartRadiusDip / kRippleCircleInitRadiusDip; gfx::Transform transform; - const gfx::Point center = host_view_->GetAppListButtonCenterPoint(); + const gfx::Point center = host_view_->GetCenterPoint(); transform.Translate(center.x() - kRippleCircleStartRadiusDip, center.y() - kRippleCircleStartRadiusDip); transform.Scale(scale_factor, scale_factor);
diff --git a/ash/shelf/back_button.cc b/ash/shelf/back_button.cc new file mode 100644 index 0000000..5aed690f --- /dev/null +++ b/ash/shelf/back_button.cc
@@ -0,0 +1,124 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/shelf/back_button.h" + +#include "ash/resources/vector_icons/vector_icons.h" +#include "ash/shelf/shelf.h" +#include "ash/shelf/shelf_constants.h" +#include "ash/shelf/shelf_view.h" +#include "ash/shell.h" +#include "ash/strings/grit/ash_strings.h" +#include "ash/system/tray/tray_popup_utils.h" +#include "ash/wm/tablet_mode/tablet_mode_controller.h" +#include "base/metrics/user_metrics.h" +#include "base/metrics/user_metrics_action.h" +#include "ui/aura/window.h" +#include "ui/aura/window_tree_host.h" +#include "ui/base/l10n/l10n_util.h" +#include "ui/events/event_sink.h" +#include "ui/gfx/canvas.h" +#include "ui/gfx/paint_vector_icon.h" +#include "ui/views/animation/flood_fill_ink_drop_ripple.h" +#include "ui/views/animation/ink_drop_impl.h" +#include "ui/views/animation/ink_drop_mask.h" +#include "ui/views/widget/widget.h" + +namespace ash { + +BackButton::BackButton() : views::ImageButton(nullptr) { + SetInkDropMode(InkDropMode::ON_NO_GESTURE_HANDLER); + set_has_ink_drop_action_on_click(true); + set_ink_drop_base_color(kShelfInkDropBaseColor); + set_ink_drop_visible_opacity(kShelfInkDropVisibleOpacity); + + SetAccessibleName(l10n_util::GetStringUTF16(IDS_ASH_SHELF_BACK_BUTTON_TITLE)); + SetSize(gfx::Size(kShelfSize, kShelfSize)); + SetFocusPainter(TrayPopupUtils::CreateFocusPainter()); +} + +BackButton::~BackButton() = default; + +gfx::Point BackButton::GetCenterPoint() const { + // The button bounds could have a larger height than width (in the case of + // touch-dragging the shelf upwards) or a larger width than height (in the + // case of a shelf hide/show animation), so adjust the y-position of the + // button's center to ensure correct layout. + return gfx::Point(width() / 2.f, width() / 2.f); +} + +void BackButton::OnGestureEvent(ui::GestureEvent* event) { + ImageButton::OnGestureEvent(event); + if (event->type() == ui::ET_GESTURE_TAP || + event->type() == ui::ET_GESTURE_TAP_DOWN) { + GenerateAndSendBackEvent(event->type()); + } +} + +bool BackButton::OnMousePressed(const ui::MouseEvent& event) { + ImageButton::OnMousePressed(event); + GenerateAndSendBackEvent(event.type()); + return true; +} + +void BackButton::OnMouseReleased(const ui::MouseEvent& event) { + ImageButton::OnMouseReleased(event); + GenerateAndSendBackEvent(event.type()); +} + +std::unique_ptr<views::InkDropRipple> BackButton::CreateInkDropRipple() const { + return std::make_unique<views::FloodFillInkDropRipple>( + size(), gfx::Insets(kShelfButtonSize / 2 - kAppListButtonRadius), + GetInkDropCenterBasedOnLastEvent(), GetInkDropBaseColor(), + ink_drop_visible_opacity()); +} + +std::unique_ptr<views::InkDrop> BackButton::CreateInkDrop() { + std::unique_ptr<views::InkDropImpl> ink_drop = + Button::CreateDefaultInkDropImpl(); + ink_drop->SetShowHighlightOnHover(false); + return std::move(ink_drop); +} + +std::unique_ptr<views::InkDropMask> BackButton::CreateInkDropMask() const { + return std::make_unique<views::CircleInkDropMask>(size(), GetCenterPoint(), + kAppListButtonRadius); +} + +void BackButton::PaintButtonContents(gfx::Canvas* canvas) { + // Use PaintButtonContents instead of SetImage so the icon gets drawn at + // |GetCenterPoint| coordinates instead of always in the center. + gfx::ImageSkia img = CreateVectorIcon(kShelfBackIcon, SK_ColorWHITE); + canvas->DrawImageInt(img, GetCenterPoint().x() - img.width() / 2, + GetCenterPoint().y() - img.height() / 2); +} + +void BackButton::GenerateAndSendBackEvent( + const ui::EventType& original_event_type) { + ui::EventType new_event_type; + switch (original_event_type) { + case ui::ET_MOUSE_PRESSED: + case ui::ET_GESTURE_TAP_DOWN: + new_event_type = ui::ET_KEY_PRESSED; + break; + case ui::ET_MOUSE_RELEASED: + case ui::ET_GESTURE_TAP: + new_event_type = ui::ET_KEY_RELEASED; + base::RecordAction(base::UserMetricsAction("Tablet_BackButton")); + break; + default: + return; + } + + // Send the back event to the root window of the back button's widget. + const views::Widget* widget = GetWidget(); + if (widget && widget->GetNativeWindow()) { + aura::Window* root_window = widget->GetNativeWindow()->GetRootWindow(); + ui::KeyEvent key_event(new_event_type, ui::VKEY_BROWSER_BACK, ui::EF_NONE); + ignore_result( + root_window->GetHost()->event_sink()->OnEventFromSource(&key_event)); + } +} + +} // namespace ash
diff --git a/ash/shelf/back_button.h b/ash/shelf/back_button.h new file mode 100644 index 0000000..1a2c26a --- /dev/null +++ b/ash/shelf/back_button.h
@@ -0,0 +1,50 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_SHELF_BACK_BUTTON_H_ +#define ASH_SHELF_BACK_BUTTON_H_ + +#include <memory> + +#include "ash/ash_export.h" +#include "base/macros.h" +#include "ui/views/controls/button/image_button.h" + +namespace ash { + +// The back button shown on the shelf when tablet mode is enabled. Its opacity +// and visiblity are handled by its parent, ShelfView, to ensure the fade +// in/out of the icon matches the movement of ShelfView's items. +class ASH_EXPORT BackButton : public views::ImageButton { + public: + BackButton(); + ~BackButton() override; + + // Get the center point of the back button used to draw its background and ink + // drops. + gfx::Point GetCenterPoint() const; + + protected: + // views::ImageButton: + // TODO(sammiequon): Consider using NotifyClick instead of OnGesture and + // OnMouse. + void OnGestureEvent(ui::GestureEvent* event) override; + bool OnMousePressed(const ui::MouseEvent& event) override; + void OnMouseReleased(const ui::MouseEvent& event) override; + std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override; + std::unique_ptr<views::InkDrop> CreateInkDrop() override; + std::unique_ptr<views::InkDropMask> CreateInkDropMask() const override; + void PaintButtonContents(gfx::Canvas* canvas) override; + + private: + // Generate and send a VKEY_BROWSER_BACK key event when the back button + // is pressed. + void GenerateAndSendBackEvent(const ui::EventType& original_event_type); + + DISALLOW_COPY_AND_ASSIGN(BackButton); +}; + +} // namespace ash + +#endif // ASH_SHELF_BACK_BUTTON_H_
diff --git a/ash/shelf/back_button_unittest.cc b/ash/shelf/back_button_unittest.cc new file mode 100644 index 0000000..84d946e --- /dev/null +++ b/ash/shelf/back_button_unittest.cc
@@ -0,0 +1,116 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/shelf/back_button.h" + +#include <memory> + +#include "ash/accelerators/accelerator_controller.h" +#include "ash/shelf/shelf.h" +#include "ash/shelf/shelf_view.h" +#include "ash/shelf/shelf_view_test_api.h" +#include "ash/shell.h" +#include "ash/test/ash_test_base.h" +#include "ash/wm/tablet_mode/tablet_mode_controller.h" +#include "ui/base/accelerators/accelerator.h" +#include "ui/events/test/event_generator.h" + +namespace ash { + +namespace { + +class TestTarget : public ui::AcceleratorTarget { + public: + TestTarget() = default; + ~TestTarget() override = default; + + size_t count() const { return count_; } + + // ui::AcceleratorTarget: + bool AcceleratorPressed(const ui::Accelerator& accelerator) override { + ++count_; + return true; + } + + bool CanHandleAccelerators() const override { return true; } + + private: + size_t count_ = 0; + + DISALLOW_COPY_AND_ASSIGN(TestTarget); +}; + +} // namespace + +class BackButtonTest : public AshTestBase { + public: + BackButtonTest() = default; + ~BackButtonTest() override = default; + + BackButton* back_button() { return back_button_; } + ShelfViewTestAPI* test_api() { return test_api_.get(); } + + void SetUp() override { + AshTestBase::SetUp(); + test_api_ = std::make_unique<ShelfViewTestAPI>( + GetPrimaryShelf()->GetShelfViewForTesting()); + back_button_ = test_api_->shelf_view()->GetBackButton(); + + // Finish all setup tasks. In particular we want to finish the + // GetSwitchStates post task in (Fake)PowerManagerClient which is triggered + // by TabletModeController otherwise this will cause tablet mode to exit + // while we wait for animations in the test. + RunAllPendingInMessageLoop(); + } + + private: + BackButton* back_button_ = nullptr; + std::unique_ptr<ShelfViewTestAPI> test_api_; + + DISALLOW_COPY_AND_ASSIGN(BackButtonTest); +}; + +// Verify that the back button is only visible in tablet mode. +TEST_F(BackButtonTest, Visibility) { + ASSERT_TRUE(back_button()->layer()); + EXPECT_EQ(0.f, back_button()->layer()->opacity()); + + Shell::Get()->tablet_mode_controller()->EnableTabletModeWindowManager(true); + test_api()->RunMessageLoopUntilAnimationsDone(); + EXPECT_EQ(1.f, back_button()->layer()->opacity()); + + Shell::Get()->tablet_mode_controller()->EnableTabletModeWindowManager(false); + test_api()->RunMessageLoopUntilAnimationsDone(); + EXPECT_EQ(0.f, back_button()->layer()->opacity()); +} + +TEST_F(BackButtonTest, BackKeySequenceGenerated) { + // Enter tablet mode; the back button is not visible in non tablet mode. + Shell::Get()->tablet_mode_controller()->EnableTabletModeWindowManager(true); + test_api()->RunMessageLoopUntilAnimationsDone(); + + AcceleratorController* controller = Shell::Get()->accelerator_controller(); + + // Register an accelerator that looks for back presses. + ui::Accelerator accelerator_back_press(ui::VKEY_BROWSER_BACK, ui::EF_NONE); + accelerator_back_press.set_key_state(ui::Accelerator::KeyState::PRESSED); + TestTarget target_back_press; + controller->Register({accelerator_back_press}, &target_back_press); + + // Register an accelerator that looks for back releases. + ui::Accelerator accelerator_back_release(ui::VKEY_BROWSER_BACK, ui::EF_NONE); + accelerator_back_release.set_key_state(ui::Accelerator::KeyState::RELEASED); + TestTarget target_back_release; + controller->Register({accelerator_back_release}, &target_back_release); + + // Verify that by clicking the back button, a back key sequence will be + // generated. + ui::test::EventGenerator& generator = GetEventGenerator(); + generator.MoveMouseTo(back_button()->GetBoundsInScreen().CenterPoint()); + generator.ClickLeftButton(); + EXPECT_EQ(1u, target_back_press.count()); + EXPECT_EQ(1u, target_back_release.count()); +} + +} // namespace ash
diff --git a/ash/shelf/login_shelf_view.cc b/ash/shelf/login_shelf_view.cc index dc9569a..7f7e8c4 100644 --- a/ash/shelf/login_shelf_view.cc +++ b/ash/shelf/login_shelf_view.cc
@@ -122,7 +122,8 @@ // switch to the lock screen or status area. This view should otherwise not // be focusable. SetFocusBehavior(FocusBehavior::ALWAYS); - SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal)); + SetLayoutManager( + std::make_unique<views::BoxLayout>(views::BoxLayout::kHorizontal)); auto add_button = [this](ButtonId id, int text_resource_id, const gfx::VectorIcon& icon) {
diff --git a/ash/shelf/shelf.cc b/ash/shelf/shelf.cc index d217f341..de3fadd 100644 --- a/ash/shelf/shelf.cc +++ b/ash/shelf/shelf.cc
@@ -230,7 +230,7 @@ // Iterating until we have hit the index we are interested in which // is true once indexes_left becomes negative. for (int i = 0; i < item_count && indexes_left >= 0; i++) { - if (items[i].type != TYPE_APP_LIST) { + if (items[i].type != TYPE_APP_LIST && items[i].type != TYPE_BACK_BUTTON) { found_index = i; indexes_left--; }
diff --git a/ash/shelf/shelf_controller.cc b/ash/shelf/shelf_controller.cc index bf249bd3..d08afcc 100644 --- a/ash/shelf/shelf_controller.cc +++ b/ash/shelf/shelf_controller.cc
@@ -106,13 +106,21 @@ !base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kAshDisableShelfModelSynchronization); + // Set the delegate and title string for the back button. + model_.SetShelfItemDelegate(ShelfID(kBackButtonId), nullptr); + DCHECK_EQ(0, model_.ItemIndexByID(ShelfID(kBackButtonId))); + ShelfItem back_item = model_.items()[0]; + back_item.title = l10n_util::GetStringUTF16(IDS_ASH_SHELF_BACK_BUTTON_TITLE); + model_.Set(0, back_item); + // Set the delegate and title string for the app list item. model_.SetShelfItemDelegate(ShelfID(kAppListId), std::make_unique<AppListShelfItemDelegate>()); - DCHECK_EQ(0, model_.ItemIndexByID(ShelfID(kAppListId))); - ShelfItem item = model_.items()[0]; - item.title = l10n_util::GetStringUTF16(IDS_ASH_SHELF_APP_LIST_LAUNCHER_TITLE); - model_.Set(0, item); + DCHECK_EQ(1, model_.ItemIndexByID(ShelfID(kAppListId))); + ShelfItem launcher_item = model_.items()[1]; + launcher_item.title = + l10n_util::GetStringUTF16(IDS_ASH_SHELF_APP_LIST_LAUNCHER_TITLE); + model_.Set(1, launcher_item); model_.AddObserver(this); Shell::Get()->session_controller()->AddObserver(this);
diff --git a/ash/shelf/shelf_controller_unittest.cc b/ash/shelf/shelf_controller_unittest.cc index 2973bd0..c1bd993 100644 --- a/ash/shelf/shelf_controller_unittest.cc +++ b/ash/shelf/shelf_controller_unittest.cc
@@ -64,10 +64,12 @@ using ShelfControllerTest = AshTestBase; -TEST_F(ShelfControllerTest, IntializesAppListItemDelegate) { +TEST_F(ShelfControllerTest, InitializesBackButtonAndAppListItemDelegate) { ShelfModel* model = Shell::Get()->shelf_controller()->model(); - EXPECT_EQ(1, model->item_count()); - EXPECT_EQ(kAppListId, model->items()[0].id.app_id); + EXPECT_EQ(2, model->item_count()); + EXPECT_EQ(kBackButtonId, model->items()[0].id.app_id); + EXPECT_FALSE(model->GetShelfItemDelegate(ShelfID(kBackButtonId))); + EXPECT_EQ(kAppListId, model->items()[1].id.app_id); EXPECT_TRUE(model->GetShelfItemDelegate(ShelfID(kAppListId))); } @@ -82,9 +84,10 @@ &observer, mojo::MakeRequestAssociatedWithDedicatedPipe(&observer_ptr)); controller->AddObserver(observer_ptr.PassInterface()); - // The ShelfModel should be initialized with a single item for the AppList. - // Without syncing, the observer should not be notified of ShelfModel changes. - EXPECT_EQ(1, controller->model()->item_count()); + // The ShelfModel should be initialized with a two items, one for the back + // button and one for the AppList. Without syncing, the observer should not be + // notified of ShelfModel changes. + EXPECT_EQ(2, controller->model()->item_count()); EXPECT_EQ(0u, observer.added_count()); EXPECT_EQ(0u, observer.removed_count()); @@ -94,14 +97,14 @@ item.id = ShelfID("foo"); int index = controller->model()->Add(item); base::RunLoop().RunUntilIdle(); - EXPECT_EQ(2, controller->model()->item_count()); + EXPECT_EQ(3, controller->model()->item_count()); EXPECT_EQ(0u, observer.added_count()); EXPECT_EQ(0u, observer.removed_count()); // Remove a ShelfModel item; |observer| should not be notified without sync. controller->model()->RemoveItemAt(index); base::RunLoop().RunUntilIdle(); - EXPECT_EQ(1, controller->model()->item_count()); + EXPECT_EQ(2, controller->model()->item_count()); EXPECT_EQ(0u, observer.added_count()); EXPECT_EQ(0u, observer.removed_count()); } @@ -118,10 +121,11 @@ controller->AddObserver(observer_ptr.PassInterface()); base::RunLoop().RunUntilIdle(); - // The ShelfModel should be initialized with a single item for the AppList. - // When syncing, the observer is immediately notified of existing shelf items. - EXPECT_EQ(1, controller->model()->item_count()); - EXPECT_EQ(1u, observer.added_count()); + // The ShelfModel should be initialized with a two items, one for the back + // button and one for the AppList. When syncing, the observer is immediately + // notified of existing shelf items. + EXPECT_EQ(2, controller->model()->item_count()); + EXPECT_EQ(2u, observer.added_count()); EXPECT_EQ(0u, observer.removed_count()); // Add a ShelfModel item; |observer| should be notified when syncing. @@ -130,31 +134,31 @@ item.id = ShelfID("foo"); int index = controller->model()->Add(item); base::RunLoop().RunUntilIdle(); - EXPECT_EQ(2, controller->model()->item_count()); - EXPECT_EQ(2u, observer.added_count()); + EXPECT_EQ(3, controller->model()->item_count()); + EXPECT_EQ(3u, observer.added_count()); EXPECT_EQ(0u, observer.removed_count()); // Remove a ShelfModel item; |observer| should be notified when syncing. controller->model()->RemoveItemAt(index); base::RunLoop().RunUntilIdle(); - EXPECT_EQ(1, controller->model()->item_count()); - EXPECT_EQ(2u, observer.added_count()); + EXPECT_EQ(2, controller->model()->item_count()); + EXPECT_EQ(3u, observer.added_count()); EXPECT_EQ(1u, observer.removed_count()); // Simulate adding an item remotely; Ash should apply the change. // |observer| is not notified; see mojom::ShelfController for rationale. controller->AddShelfItem(index, item); base::RunLoop().RunUntilIdle(); - EXPECT_EQ(2, controller->model()->item_count()); - EXPECT_EQ(2u, observer.added_count()); + EXPECT_EQ(3, controller->model()->item_count()); + EXPECT_EQ(3u, observer.added_count()); EXPECT_EQ(1u, observer.removed_count()); // Simulate removing an item remotely; Ash should apply the change. // |observer| is not notified; see mojom::ShelfController for rationale. controller->RemoveShelfItem(item.id); base::RunLoop().RunUntilIdle(); - EXPECT_EQ(1, controller->model()->item_count()); - EXPECT_EQ(2u, observer.added_count()); + EXPECT_EQ(2, controller->model()->item_count()); + EXPECT_EQ(3u, observer.added_count()); EXPECT_EQ(1u, observer.removed_count()); }
diff --git a/ash/shelf/shelf_tooltip_manager.cc b/ash/shelf/shelf_tooltip_manager.cc index e8b1937..9bdd33e9 100644 --- a/ash/shelf/shelf_tooltip_manager.cc +++ b/ash/shelf/shelf_tooltip_manager.cc
@@ -69,7 +69,7 @@ set_accept_events(false); set_margins(gfx::Insets(kTooltipTopBottomMargin, kTooltipLeftRightMargin)); set_shadow(views::BubbleBorder::NO_ASSETS); - SetLayoutManager(new views::FillLayout()); + SetLayoutManager(std::make_unique<views::FillLayout>()); views::Label* label = new views::Label(text); label->SetHorizontalAlignment(gfx::ALIGN_LEFT); ui::NativeTheme* theme = anchor->GetWidget()->GetNativeTheme();
diff --git a/ash/shelf/shelf_unittest.cc b/ash/shelf/shelf_unittest.cc index b87bbd34..b7404c3 100644 --- a/ash/shelf/shelf_unittest.cc +++ b/ash/shelf/shelf_unittest.cc
@@ -105,8 +105,8 @@ EXPECT_TRUE(shelf_widget->IsShowingOverflowBubble()); // Remove one of the first items in the main shelf view. - ASSERT_GT(shelf_model()->item_count(), 1); - shelf_model()->RemoveItemAt(1); + ASSERT_GT(shelf_model()->item_count(), 2); + shelf_model()->RemoveItemAt(2); // Waits for all transitions to finish and there should be no crash. test_api()->RunMessageLoopUntilAnimationsDone();
diff --git a/ash/shelf/shelf_view.cc b/ash/shelf/shelf_view.cc index 0a4b5ae..898dbf0 100644 --- a/ash/shelf/shelf_view.cc +++ b/ash/shelf/shelf_view.cc
@@ -15,6 +15,7 @@ #include "ash/scoped_root_window_for_new_windows.h" #include "ash/screen_util.h" #include "ash/shelf/app_list_button.h" +#include "ash/shelf/back_button.h" #include "ash/shelf/overflow_bubble.h" #include "ash/shelf/overflow_bubble_view.h" #include "ash/shelf/overflow_button.h" @@ -76,6 +77,14 @@ namespace { +// Helper to check if tablet mode is enabled. +bool IsTabletModeEnabled() { + return Shell::Get()->tablet_mode_controller() && + Shell::Get() + ->tablet_mode_controller() + ->IsTabletModeWindowManagerEnabled(); +} + // A class to temporarily disable a given bounds animator. class BoundsAnimatorDisabler { public: @@ -106,7 +115,7 @@ : FocusSearch(nullptr, true, true), view_model_(view_model) {} ~ShelfFocusSearch() override = default; - // views::FocusSearch overrides: + // views::FocusSearch: View* FindNextFocusableView(View* starting_view, bool reverse, Direction direction, @@ -114,18 +123,26 @@ views::FocusTraversable** focus_traversable, View** focus_traversable_view) override { int index = view_model_->GetIndexOfView(starting_view); - if (index == -1) - return view_model_->view_at(0); + // The back button (item with index 0 on the model) only exists in tablet + // mode, so punt focus to the app list button (item with index 1 on the + // model). + const bool tablet_mode = IsTabletModeEnabled(); + if (!tablet_mode && index == 0) + ++index; + // Increment or decrement index based on the cycle, unless we are at either + // edge, then we loop to the back or front. Skip the back button (item with + // index 0) when not in tablet mode. if (reverse) { --index; - if (index < 0) + if (index < 0 || (index == 0 && !tablet_mode)) index = view_model_->view_size() - 1; } else { ++index; if (index >= view_model_->view_size()) - index = 0; + index = tablet_mode ? 0 : 1; } + return view_model_->view_at(index); } @@ -245,6 +262,7 @@ shelf_widget_(shelf_widget), view_model_(new views::ViewModel), tooltip_(this), + shelf_item_background_color_(kShelfDefaultBaseColor), weak_factory_(this) { DCHECK(model_); DCHECK(shelf_); @@ -275,6 +293,10 @@ ConfigureChildView(overflow_button_); AddChildView(overflow_button_); + GetBackButton()->layer()->SetOpacity(IsTabletModeEnabled() ? 1.f : 0.f); + GetBackButton()->SetFocusBehavior( + IsTabletModeEnabled() ? FocusBehavior::ALWAYS : FocusBehavior::NEVER); + // We'll layout when our bounds change. } @@ -367,10 +389,25 @@ return nullptr; } +BackButton* ShelfView::GetBackButton() const { + for (int i = 0; i < model_->item_count(); ++i) { + if (model_->items()[i].type == TYPE_BACK_BUTTON) { + views::View* view = view_model_->view_at(i); + CHECK_EQ(BackButton::kViewClassName, view->GetClassName()); + return static_cast<BackButton*>(view); + } + } + + NOTREACHED() << "Back button not found"; + return nullptr; +} + bool ShelfView::ShouldHideTooltip(const gfx::Point& cursor_location) const { gfx::Rect tooltip_bounds; for (int i = 0; i < child_count(); ++i) { const views::View* child = child_at(i); + if (!IsTabletModeEnabled() && child == GetBackButton()) + continue; if (child != overflow_button_ && ShouldShowTooltipForView(child)) tooltip_bounds.Union(child->GetMirroredBounds()); } @@ -450,6 +487,7 @@ break; case TYPE_APP_PANEL: + case TYPE_BACK_BUTTON: case TYPE_DIALOG: break; @@ -686,8 +724,8 @@ if (index == -1 || view_model_->view_size() <= 1) return; // View is being deleted, ignore request. - if (view == GetAppListButton()) - return; // View is not draggable, ignore request. + if (view == GetAppListButton() || view == GetBackButton()) + return; // Views are not draggable, ignore request. // Only when the repost event occurs on the same shelf item, we should ignore // the call in ShelfView::ButtonPressed(...). @@ -747,18 +785,9 @@ } void ShelfView::UpdateShelfItemBackground(SkColor color) { - GetAppListButton()->UpdateShelfItemBackground(color); + shelf_item_background_color_ = color; overflow_button_->UpdateShelfItemBackground(color); -} - -double ShelfView::GetAppListButtonAnimationCurrentValue() { - DCHECK(bounds_animator_); - const gfx::SlideAnimation* animation = - bounds_animator_->GetAnimationForView(GetAppListButton()); - if (!animation) - return 0.0; - - return animation->GetCurrentValue(); + SchedulePaint(); } void ShelfView::UpdateAllButtonsVisibilityInOverflowMode() { @@ -789,30 +818,24 @@ int w = shelf_->PrimaryAxisValue(kShelfButtonSize, width()); int h = shelf_->PrimaryAxisValue(height(), kShelfButtonSize); - const bool is_tablet_mode = Shell::Get()->tablet_mode_controller() - ? Shell::Get() - ->tablet_mode_controller() - ->IsTabletModeWindowManagerEnabled() - : false; - for (int i = 0; i < view_model_->view_size(); ++i) { if (i < first_visible_index_) { view_model_->set_ideal_bounds(i, gfx::Rect(x, y, 0, 0)); continue; } - int width = w; - int height = h; - // If this is the app list button and we are in tablet mode, make space for - // the back button (which is part of the app list button). - if (i == 0 && is_tablet_mode) { - width = shelf_->PrimaryAxisValue(2 * w, w); - height = shelf_->PrimaryAxisValue(h, 2 * h); - } + view_model_->set_ideal_bounds(i, gfx::Rect(x, y, w, h)); + // If not in tablet mode do not increase |x| or |y|. Instead just let the + // next item (app list button) cover the back button, which will have + // opacity 0 anyways. + if (i == 0 && !IsTabletModeEnabled()) + continue; - view_model_->set_ideal_bounds(i, gfx::Rect(x, y, width, height)); - x = shelf_->PrimaryAxisValue(x + width + kShelfButtonSpacing, x); - y = shelf_->PrimaryAxisValue(y, y + height + kShelfButtonSpacing); + // There is no spacing between the first two elements. Do not worry about y + // since the back button only appears in tablet mode, which forces the shelf + // to be bottom aligned. + x = shelf_->PrimaryAxisValue(x + w + (i == 0 ? 0 : kShelfButtonSpacing), x); + y = shelf_->PrimaryAxisValue(y, y + h + kShelfButtonSpacing); } if (is_overflow_mode()) { @@ -954,9 +977,6 @@ // padding of the first gets properly transferred to the new first item. if (i && view->border()) view->SetBorder(views::NullBorder()); - - if (view == GetAppListButton()) - GetAppListButton()->OnBoundsAnimationStarted(); } overflow_button_->SetBoundsRect(overflow_bounds); } @@ -981,6 +1001,11 @@ break; } + case TYPE_BACK_BUTTON: { + view = new BackButton(); + break; + } + case TYPE_UNDEFINED: return nullptr; } @@ -1077,9 +1102,10 @@ target_index = std::min(indices.second, std::max(target_index, indices.first)); - // The app list button is always first, and it is the only non-draggable item. + // The back button and app list button are always first, and they are the + // only non-draggable items. int first_draggable_item = model_->GetItemIndexForType(TYPE_APP_LIST) + 1; - DCHECK_EQ(1, first_draggable_item); + DCHECK_EQ(2, first_draggable_item); target_index = std::max(target_index, first_draggable_item); DCHECK_LT(target_index, model_->item_count()); @@ -1303,7 +1329,7 @@ ShelfView::RemovableState ShelfView::RemovableByRipOff(int index) const { DCHECK(index >= 0 && index < model_->item_count()); ShelfItemType type = model_->items()[index].type; - if (type == TYPE_APP_LIST || type == TYPE_DIALOG) + if (type == TYPE_APP_LIST || type == TYPE_DIALOG || type == TYPE_BACK_BUTTON) return NOT_REMOVABLE; if (model_->items()[index].pinned_by_policy) @@ -1323,6 +1349,7 @@ case TYPE_APP_PANEL: case TYPE_APP_LIST: case TYPE_APP: + case TYPE_BACK_BUTTON: case TYPE_DIALOG: return typeb == typea; case TYPE_UNDEFINED: @@ -1522,6 +1549,38 @@ overflow_bubble_->Hide(); } +void ShelfView::OnPaint(gfx::Canvas* canvas) { + if (overflow_mode_) + return; + + cc::PaintFlags flags; + flags.setColor(shelf_item_background_color_); + flags.setAntiAlias(true); + flags.setStyle(cc::PaintFlags::kFill_Style); + + // Draws a round rect around the back button and app list button. This will + // just be a circle if the back button is hidden. + const gfx::PointF circle_center( + GetAppListButton()->bounds().origin() + + gfx::Vector2d(GetAppListButton()->GetCenterPoint().x(), + GetAppListButton()->GetCenterPoint().y())); + if (GetBackButton()->layer()->opacity() <= 0.f) { + canvas->DrawCircle(circle_center, kAppListButtonRadius, flags); + return; + } + + const gfx::PointF back_center( + GetBackButton()->bounds().x() + kShelfButtonSize / 2, + GetBackButton()->bounds().y() + kShelfButtonSize / 2); + const gfx::RectF background_bounds( + back_center.x() - kAppListButtonRadius, + back_center.y() - kAppListButtonRadius, + std::abs(circle_center.x() - back_center.x()) + 2 * kAppListButtonRadius, + 2 * kAppListButtonRadius); + + canvas->DrawRoundRect(background_bounds, kAppListButtonRadius, flags); +} + views::FocusTraversable* ShelfView::GetPaneFocusTraversable() { return this; } @@ -1803,6 +1862,7 @@ // Only selected shelf items with context menu opened can be dragged. const ShelfItem* item = ShelfItemForView(source); if (context_menu && item && item->type != TYPE_APP_LIST && + item->type != TYPE_BACK_BUTTON && source_type == ui::MenuSourceType::MENU_SOURCE_TOUCH) { run_types |= views::MenuRunner::SEND_GESTURE_EVENTS_TO_OWNER; } @@ -1872,6 +1932,17 @@ void ShelfView::OnBoundsAnimatorProgressed(views::BoundsAnimator* animator) { shelf_->NotifyShelfIconPositionsChanged(); PreferredSizeChanged(); + + float opacity = 0.f; + const gfx::SlideAnimation* animation = + bounds_animator_->GetAnimationForView(GetBackButton()); + if (animation) + opacity = static_cast<float>(animation->GetCurrentValue()); + if (!IsTabletModeEnabled()) + opacity = 1.f - opacity; + + GetBackButton()->layer()->SetOpacity(opacity); + GetBackButton()->SetFocusBehavior(FocusBehavior::ALWAYS); } void ShelfView::OnBoundsAnimatorDone(views::BoundsAnimator* animator) { @@ -1896,8 +1967,9 @@ } } - if (GetAppListButton()) - GetAppListButton()->OnBoundsAnimationFinished(); + GetBackButton()->layer()->SetOpacity(IsTabletModeEnabled() ? 1.f : 0.f); + GetBackButton()->SetFocusBehavior( + IsTabletModeEnabled() ? FocusBehavior::ALWAYS : FocusBehavior::NEVER); } bool ShelfView::IsRepostEvent(const ui::Event& event) {
diff --git a/ash/shelf/shelf_view.h b/ash/shelf/shelf_view.h index 36ec275..5ef9950c 100644 --- a/ash/shelf/shelf_view.h +++ b/ash/shelf/shelf_view.h
@@ -39,6 +39,7 @@ namespace ash { class AppListButton; +class BackButton; class DragImageView; class OverflowBubble; class OverflowButton; @@ -98,6 +99,7 @@ } AppListButton* GetAppListButton() const; + BackButton* GetBackButton() const; // Returns true if the mouse cursor exits the area for launcher tooltip. // There are thin gaps between launcher buttons but the tooltip shouldn't hide @@ -183,11 +185,6 @@ const ShelfButton* drag_view() const { return drag_view_; } - // Returns the AppListButton's current animation value, or 0.0 if the - // animation is not running. Used to synchronize AppListButton and ShelfView's - // icons' animations. - double GetAppListButtonAnimationCurrentValue(); - private: friend class ShelfViewTestAPI; @@ -300,6 +297,7 @@ // Overridden from views::View: gfx::Size CalculatePreferredSize() const override; void OnBoundsChanged(const gfx::Rect& previous_bounds) override; + void OnPaint(gfx::Canvas* canvas) override; FocusTraversable* GetPaneFocusTraversable() override; void GetAccessibleNodeData(ui::AXNodeData* node_data) override; void ViewHierarchyChanged( @@ -499,6 +497,10 @@ // Tracks UMA metrics based on shelf button press actions. ShelfButtonPressedMetricTracker shelf_button_pressed_metric_tracker_; + // Color used to paint the background behind the app list button and back + // button. + SkColor shelf_item_background_color_; + base::WeakPtrFactory<ShelfView> weak_factory_; DISALLOW_COPY_AND_ASSIGN(ShelfView);
diff --git a/ash/shelf/shelf_view_test_api.cc b/ash/shelf/shelf_view_test_api.cc index 9514c653..9c0c037 100644 --- a/ash/shelf/shelf_view_test_api.cc +++ b/ash/shelf/shelf_view_test_api.cc
@@ -47,8 +47,9 @@ } ShelfButton* ShelfViewTestAPI::GetButton(int index) { - // App list button is not a ShelfButton. - if (shelf_view_->model_->items()[index].type == ash::TYPE_APP_LIST) + // App list and back button are not ShelfButtons. + if (shelf_view_->model_->items()[index].type == ash::TYPE_APP_LIST || + shelf_view_->model_->items()[index].type == ash::TYPE_BACK_BUTTON) return nullptr; return static_cast<ShelfButton*>(GetViewAt(index));
diff --git a/ash/shelf/shelf_view_unittest.cc b/ash/shelf/shelf_view_unittest.cc index 0c759af3..0feb2b8 100644 --- a/ash/shelf/shelf_view_unittest.cc +++ b/ash/shelf/shelf_view_unittest.cc
@@ -486,9 +486,10 @@ // Add 5 app shelf buttons for testing. for (int i = 0; i < 5; ++i) { ShelfID id = AddAppShortcut(); - // App Icon is located at index 0, and browser shortcut is located at - // index 1. So we should start to add app shortcut at index 2. - id_map->insert(id_map->begin() + i + 2, + // The back button is located at index 0, the app icon is located at + // index 1, and the browser shortcut is located at index 2. So we should + // start to add app shortcuts at index 3. + id_map->insert(id_map->begin() + i + 3, std::make_pair(id, GetButtonByID(id))); } ASSERT_NO_FATAL_FAILURE(CheckModelIDs(*id_map)); @@ -539,7 +540,7 @@ main_to_overflow ? &test_api_for_overflow : test_api_.get(); // Set the item to be dragged depending on |main_to_overflow|. - int drag_item_index = main_to_overflow ? 1 : src_api->GetLastVisibleIndex(); + int drag_item_index = main_to_overflow ? 3 : src_api->GetLastVisibleIndex(); ShelfID drag_item_id = GetItemId(drag_item_index); ShelfButton* drag_button = src_api->GetButton(drag_item_index); gfx::Point center_point_of_drag_item = GetButtonCenter(drag_button); @@ -556,7 +557,7 @@ ASSERT_FALSE(src_api->DraggedItemToAnotherShelf()); // Move a dragged item into the destination shelf at |drop_index|. - int drop_index = main_to_overflow ? dest_api->GetLastVisibleIndex() : 1; + int drop_index = main_to_overflow ? dest_api->GetLastVisibleIndex() : 3; ShelfButton* drop_button = dest_api->GetButton(drop_index); gfx::Point drop_point = GetButtonCenter(drop_button); // To insert at |drop_index|, a smaller x-axis value of |drop_point| @@ -902,7 +903,7 @@ shelf_view_->shelf()->SetAlignment(alignment); // For every 2 successive visible icons, expect that their bounds don't // intersect. - for (int i = 1; i < test_api_->GetButtonCount() - 1; ++i) { + for (int i = 2; i < test_api_->GetButtonCount() - 1; ++i) { if (!(test_api_->GetButton(i)->visible() && test_api_->GetButton(i + 1)->visible())) { continue; @@ -984,8 +985,9 @@ // Wait for the last animation to finish. test_api_->RunMessageLoopUntilAnimationsDone(); - // Verifies non-overflow buttons are visible. - for (int i = 0; i <= test_api_->GetLastVisibleIndex(); ++i) { + // Verifies non-overflow buttons are visible. The back button at index 0 is + // not visible. + for (int i = 1; i <= test_api_->GetLastVisibleIndex(); ++i) { ShelfButton* button = test_api_->GetButton(i); if (button) { EXPECT_TRUE(button->visible()) << "button index=" << i; @@ -1001,43 +1003,43 @@ SetupForDragTest(&id_map); // Dragging browser shortcut at index 1. - EXPECT_TRUE(model_->items()[1].type == TYPE_BROWSER_SHORTCUT); - views::View* dragged_button = SimulateDrag(ShelfView::MOUSE, 1, 3, false); - std::rotate(id_map.begin() + 1, id_map.begin() + 2, id_map.begin() + 4); + EXPECT_TRUE(model_->items()[2].type == TYPE_BROWSER_SHORTCUT); + views::View* dragged_button = SimulateDrag(ShelfView::MOUSE, 2, 4, false); + std::rotate(id_map.begin() + 2, id_map.begin() + 3, id_map.begin() + 5); ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); shelf_view_->PointerReleasedOnButton(dragged_button, ShelfView::MOUSE, false); - EXPECT_TRUE(model_->items()[3].type == TYPE_BROWSER_SHORTCUT); + EXPECT_TRUE(model_->items()[4].type == TYPE_BROWSER_SHORTCUT); // Dragging changes model order. - dragged_button = SimulateDrag(ShelfView::MOUSE, 1, 3, false); - std::rotate(id_map.begin() + 1, id_map.begin() + 2, id_map.begin() + 4); + dragged_button = SimulateDrag(ShelfView::MOUSE, 2, 4, false); + std::rotate(id_map.begin() + 2, id_map.begin() + 3, id_map.begin() + 5); ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); // Cancelling the drag operation restores previous order. shelf_view_->PointerReleasedOnButton(dragged_button, ShelfView::MOUSE, true); - std::rotate(id_map.begin() + 1, id_map.begin() + 3, id_map.begin() + 4); + std::rotate(id_map.begin() + 2, id_map.begin() + 4, id_map.begin() + 5); ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); // Deleting an item keeps the remaining intact. - dragged_button = SimulateDrag(ShelfView::MOUSE, 1, 3, false); - model_->RemoveItemAt(1); - id_map.erase(id_map.begin() + 1); + dragged_button = SimulateDrag(ShelfView::MOUSE, 2, 4, false); + model_->RemoveItemAt(2); + id_map.erase(id_map.begin() + 2); ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); shelf_view_->PointerReleasedOnButton(dragged_button, ShelfView::MOUSE, false); // Adding a shelf item cancels the drag and respects the order. - dragged_button = SimulateDrag(ShelfView::MOUSE, 1, 3, false); + dragged_button = SimulateDrag(ShelfView::MOUSE, 2, 4, false); ShelfID new_id = AddAppShortcut(); - id_map.insert(id_map.begin() + 6, + id_map.insert(id_map.begin() + 7, std::make_pair(new_id, GetButtonByID(new_id))); ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); shelf_view_->PointerReleasedOnButton(dragged_button, ShelfView::MOUSE, false); // Adding a shelf item at the end (i.e. a panel) canels drag and respects // the order. - dragged_button = SimulateDrag(ShelfView::MOUSE, 1, 3, false); + dragged_button = SimulateDrag(ShelfView::MOUSE, 2, 4, false); new_id = AddPanel(); - id_map.insert(id_map.begin() + 7, + id_map.insert(id_map.begin() + 8, std::make_pair(new_id, GetButtonByID(new_id))); ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); shelf_view_->PointerReleasedOnButton(dragged_button, ShelfView::MOUSE, false); @@ -1050,12 +1052,12 @@ // Start a mouse drag. views::View* dragged_button_mouse = - SimulateDrag(ShelfView::MOUSE, 1, 3, false); - std::rotate(id_map.begin() + 1, id_map.begin() + 2, id_map.begin() + 4); + SimulateDrag(ShelfView::MOUSE, 2, 4, false); + std::rotate(id_map.begin() + 2, id_map.begin() + 3, id_map.begin() + 5); ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); // Attempt a touch drag before the mouse drag finishes. views::View* dragged_button_touch = - SimulateDrag(ShelfView::TOUCH, 4, 2, false); + SimulateDrag(ShelfView::TOUCH, 5, 3, false); // Nothing changes since 2nd drag is ignored. ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); @@ -1066,12 +1068,12 @@ ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); // Now start a touch drag. - dragged_button_touch = SimulateDrag(ShelfView::TOUCH, 4, 2, false); - std::rotate(id_map.begin() + 3, id_map.begin() + 4, id_map.begin() + 5); + dragged_button_touch = SimulateDrag(ShelfView::TOUCH, 5, 3, false); + std::rotate(id_map.begin() + 4, id_map.begin() + 5, id_map.begin() + 6); ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); // And attempt a mouse drag before the touch drag finishes. - dragged_button_mouse = SimulateDrag(ShelfView::MOUSE, 1, 2, false); + dragged_button_mouse = SimulateDrag(ShelfView::MOUSE, 2, 3, false); // Nothing changes since 2nd drag is ignored. ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); @@ -1082,28 +1084,45 @@ } // Ensure the app list button cannot be dragged and other items cannot be -// dragged in front of the app list button. +// dragged in front of the back button or app list button. TEST_F(ShelfViewTest, DragWithNotDraggableItemInFront) { // The expected id order is initialized as: 1, 2, 3, 4, 5, 6, 7 std::vector<std::pair<ShelfID, views::View*>> id_map; SetupForDragTest(&id_map); - // Ensure that the app list button cannot be dragged. + // Ensure that the back button cannot be dragged. // The expected id order is unchanged: 1, 2, 3, 4, 5, 6, 7 ASSERT_NO_FATAL_FAILURE(DragAndVerify(0, 1, shelf_view_, id_map)); ASSERT_NO_FATAL_FAILURE(DragAndVerify(0, 2, shelf_view_, id_map)); ASSERT_NO_FATAL_FAILURE(DragAndVerify(0, 5, shelf_view_, id_map)); + // Ensure that the app list button cannot be dragged. + // The expected id order is unchanged: 1, 2, 3, 4, 5, 6, 7 + ASSERT_NO_FATAL_FAILURE(DragAndVerify(1, 1, shelf_view_, id_map)); + ASSERT_NO_FATAL_FAILURE(DragAndVerify(1, 2, shelf_view_, id_map)); + ASSERT_NO_FATAL_FAILURE(DragAndVerify(1, 5, shelf_view_, id_map)); + + // Ensure that items cannot be dragged in front of the back button. + // Attempting to do so will order buttons immediately after the app list. + // Dragging the third button in front should no-op: 1, 2, 3, 4, 5, 6, 7 + ASSERT_NO_FATAL_FAILURE(DragAndVerify(2, 0, shelf_view_, id_map)); + // Dragging the fourth button in front should yield: 1, 2, 4, 3, 5, 6, 7 + std::rotate(id_map.begin() + 2, id_map.begin() + 3, id_map.begin() + 4); + ASSERT_NO_FATAL_FAILURE(DragAndVerify(3, 0, shelf_view_, id_map)); + // Dragging the sixth button in front should yield: 1, 2, 6, 4, 3, 5, 7 + std::rotate(id_map.begin() + 2, id_map.begin() + 5, id_map.begin() + 6); + ASSERT_NO_FATAL_FAILURE(DragAndVerify(5, 0, shelf_view_, id_map)); + // Ensure that items cannot be dragged in front of the app list button. // Attempting to do so will order buttons immediately after the app list. - // Dragging the second button in front should no-op: 1, 2, 3, 4, 5, 6, 7 - ASSERT_NO_FATAL_FAILURE(DragAndVerify(1, 0, shelf_view_, id_map)); - // Dragging the third button in front should yield: 1, 3, 2, 4, 5, 6, 7 - std::rotate(id_map.begin() + 1, id_map.begin() + 2, id_map.begin() + 3); - ASSERT_NO_FATAL_FAILURE(DragAndVerify(2, 0, shelf_view_, id_map)); - // Dragging the sixth button in front should yield: 1, 6, 3, 2, 4, 5, 7 - std::rotate(id_map.begin() + 1, id_map.begin() + 5, id_map.begin() + 6); - ASSERT_NO_FATAL_FAILURE(DragAndVerify(5, 0, shelf_view_, id_map)); + // Dragging the third button in front should no-op: 1, 2, 6, 4, 3, 5, 7 + ASSERT_NO_FATAL_FAILURE(DragAndVerify(2, 1, shelf_view_, id_map)); + // Dragging the fourth button in front should yield: 1, 2, 4, 6, 3, 5, 7 + std::rotate(id_map.begin() + 2, id_map.begin() + 3, id_map.begin() + 4); + ASSERT_NO_FATAL_FAILURE(DragAndVerify(3, 1, shelf_view_, id_map)); + // Dragging the sixth button in front should yield: 1, 2, 5, 4, 6, 3, 7 + std::rotate(id_map.begin() + 2, id_map.begin() + 5, id_map.begin() + 6); + ASSERT_NO_FATAL_FAILURE(DragAndVerify(5, 1, shelf_view_, id_map)); } // Ensure that clicking on one item and then dragging another works as expected. @@ -1112,29 +1131,29 @@ SetupForDragTest(&id_map); // A click on the item at index 2 is simulated. - SimulateClick(2); + SimulateClick(3); // Dragging the browser item at index 1 should change the model order. - EXPECT_TRUE(model_->items()[1].type == TYPE_BROWSER_SHORTCUT); - views::View* dragged_button = SimulateDrag(ShelfView::MOUSE, 1, 3, false); - std::rotate(id_map.begin() + 1, id_map.begin() + 2, id_map.begin() + 4); + EXPECT_TRUE(model_->items()[2].type == TYPE_BROWSER_SHORTCUT); + views::View* dragged_button = SimulateDrag(ShelfView::MOUSE, 2, 4, false); + std::rotate(id_map.begin() + 2, id_map.begin() + 3, id_map.begin() + 5); ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); shelf_view_->PointerReleasedOnButton(dragged_button, ShelfView::MOUSE, false); - EXPECT_TRUE(model_->items()[3].type == TYPE_BROWSER_SHORTCUT); + EXPECT_TRUE(model_->items()[4].type == TYPE_BROWSER_SHORTCUT); } // Tests that double-clicking an item does not activate it twice. TEST_F(ShelfViewTest, ClickingTwiceActivatesOnce) { // Watch for selection of the browser shortcut. ShelfItemSelectionTracker* selection_tracker = new ShelfItemSelectionTracker; - model_->SetShelfItemDelegate(model_->items()[1].id, + model_->SetShelfItemDelegate(model_->items()[2].id, base::WrapUnique(selection_tracker)); // A single click selects the item, but a double-click does not. EXPECT_EQ(0u, selection_tracker->item_selected_count()); - SimulateClick(1); + SimulateClick(2); EXPECT_EQ(1u, selection_tracker->item_selected_count()); - SimulateDoubleClick(1); + SimulateDoubleClick(2); EXPECT_EQ(1u, selection_tracker->item_selected_count()); } @@ -1143,8 +1162,8 @@ std::vector<std::pair<ShelfID, views::View*>> id_map; SetupForDragTest(&id_map); - ShelfID shelf_id = (id_map.begin() + 1)->first; - views::View* button = (id_map.begin() + 1)->second; + ShelfID shelf_id = (id_map.begin() + 2)->first; + views::View* button = (id_map.begin() + 2)->second; // Install a ShelfItemDelegate that tracks when the shelf item is selected. ShelfItemSelectionTracker* selection_tracker = new ShelfItemSelectionTracker; @@ -1466,7 +1485,7 @@ app_list_presenter_impl.ShowAndRunLoop(GetPrimaryDisplay().id()); // The tooltip shouldn't hide if the mouse is on normal buttons. - for (int i = 1; i < test_api_->GetButtonCount(); i++) { + for (int i = 2; i < test_api_->GetButtonCount(); i++) { ShelfButton* button = test_api_->GetButton(i); if (!button) continue; @@ -1749,7 +1768,7 @@ secondary_shelf->GetShelfViewForTesting(); ShelfViewTestAPI test_api_for_secondary_shelf_view(shelf_view_for_secondary); - ShelfButton* button = test_api_for_secondary_shelf_view.GetButton(1); + ShelfButton* button = test_api_for_secondary_shelf_view.GetButton(2); // Fetch the start point of dragging. gfx::Point start_point = button->GetBoundsInScreen().CenterPoint(); @@ -1807,10 +1826,10 @@ ShelfItemSelectionTracker* selection_tracker = new ShelfItemSelectionTracker; model_->SetShelfItemDelegate( - model_->items()[1].id, + model_->items()[2].id, base::WrapUnique<ShelfItemSelectionTracker>(selection_tracker)); - SimulateClick(1); + SimulateClick(2); EXPECT_EQ(1, user_action_tester.GetActionCount("Launcher_ButtonPressed_Mouse")); } @@ -1823,10 +1842,10 @@ ShelfItemSelectionTracker* selection_tracker = new ShelfItemSelectionTracker; selection_tracker->set_item_selected_action(SHELF_ACTION_NEW_WINDOW_CREATED); model_->SetShelfItemDelegate( - model_->items()[1].id, + model_->items()[2].id, base::WrapUnique<ShelfItemSelectionTracker>(selection_tracker)); - SimulateClick(1); + SimulateClick(2); EXPECT_EQ(1, user_action_tester.GetActionCount("Launcher_LaunchTask")); } @@ -1838,14 +1857,14 @@ ShelfItemSelectionTracker* selection_tracker = new ShelfItemSelectionTracker; model_->SetShelfItemDelegate( - model_->items()[1].id, + model_->items()[2].id, base::WrapUnique<ShelfItemSelectionTracker>(selection_tracker)); selection_tracker->set_item_selected_action(SHELF_ACTION_WINDOW_MINIMIZED); - SimulateClick(1); + SimulateClick(2); selection_tracker->set_item_selected_action(SHELF_ACTION_WINDOW_ACTIVATED); - SimulateClick(1); + SimulateClick(2); histogram_tester.ExpectTotalCount( kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName, 1); @@ -2272,7 +2291,7 @@ } void InitBrowserButtonInkDrop() { - browser_button_ = test_api_->GetButton(1); + browser_button_ = test_api_->GetButton(2); auto browser_button_ink_drop = std::make_unique<InkDropSpy>(std::make_unique<views::InkDropImpl>( @@ -2619,7 +2638,7 @@ InitBrowserButtonInkDrop(); // Set a delegate for the shelf item that returns an app list menu. - model_->SetShelfItemDelegate(model_->items()[1].id, + model_->SetShelfItemDelegate(model_->items()[2].id, std::make_unique<ListMenuShelfItemDelegate>()); views::Button* button = browser_button_; @@ -2647,164 +2666,6 @@ views::InkDropState::DEACTIVATED)); } -// Ensure the app list button ink drop is disabled during bounds animations. -// TODO(crbug.com/758402): Update ink drop bounds with app list button bounds. -TEST_F(ShelfViewInkDropTest, AppListButtonInkDropDisabledOnAnimations) { - InitAppListButtonInkDrop(); - - // Display the app list. - TestAppListPresenterImpl app_list_presenter_impl; - app_list_presenter_impl.ShowAndRunLoop(GetPrimaryDisplay().id()); - EXPECT_EQ(views::InkDropState::ACTIVATED, - app_list_button_ink_drop_->GetTargetInkDropState()); - EXPECT_THAT(app_list_button_ink_drop_->GetAndResetRequestedStates(), - ElementsAre(views::InkDropState::ACTIVATED)); - - // The ink drop should be hidden during the animation to enter tablet mode. - Shell::Get()->tablet_mode_controller()->EnableTabletModeWindowManager(true); - EXPECT_THAT(app_list_button_ink_drop_->GetAndResetRequestedStates(), - ElementsAre(views::InkDropState::DEACTIVATED)); - test_api_->RunMessageLoopUntilAnimationsDone(); - EXPECT_EQ(views::InkDropState::ACTIVATED, - app_list_button_ink_drop_->GetTargetInkDropState()); - EXPECT_THAT(app_list_button_ink_drop_->GetAndResetRequestedStates(), - ElementsAre(views::InkDropState::ACTIVATED)); - - // The ink drop should be hidden during the animation to exit tablet mode. - Shell::Get()->tablet_mode_controller()->EnableTabletModeWindowManager(false); - EXPECT_THAT(app_list_button_ink_drop_->GetAndResetRequestedStates(), - ElementsAre(views::InkDropState::DEACTIVATED)); - test_api_->RunMessageLoopUntilAnimationsDone(); - EXPECT_EQ(views::InkDropState::ACTIVATED, - app_list_button_ink_drop_->GetTargetInkDropState()); - EXPECT_THAT(app_list_button_ink_drop_->GetAndResetRequestedStates(), - ElementsAre(views::InkDropState::ACTIVATED)); -} - -namespace { - -// Test fixture to run app list button ink drop tests for both mouse and touch -// events. -class AppListButtonInkDropTest - : public ShelfViewInkDropTest, - public testing::WithParamInterface<ui::EventPointerType> { - public: - AppListButtonInkDropTest() : pointer_type_(GetParam()) {} - - ~AppListButtonInkDropTest() override = default; - - void MovePointerTo(const gfx::Point& point) { - if (pointer_type_ == ui::EventPointerType::POINTER_TYPE_MOUSE) - GetEventGenerator().MoveMouseTo(point); - else if (pointer_type_ == ui::EventPointerType::POINTER_TYPE_TOUCH) - GetEventGenerator().MoveTouch(point); - } - - void PressPointer() { - if (pointer_type_ == ui::EventPointerType::POINTER_TYPE_MOUSE) - GetEventGenerator().PressLeftButton(); - else if (pointer_type_ == ui::EventPointerType::POINTER_TYPE_TOUCH) - GetEventGenerator().PressTouch(); - } - - void ReleasePointer() { - if (pointer_type_ == ui::EventPointerType::POINTER_TYPE_MOUSE) - GetEventGenerator().ReleaseLeftButton(); - else if (pointer_type_ == ui::EventPointerType::POINTER_TYPE_TOUCH) - GetEventGenerator().ReleaseTouch(); - } - - private: - ui::EventPointerType pointer_type_; - - DISALLOW_COPY_AND_ASSIGN(AppListButtonInkDropTest); -}; - -const ui::EventPointerType kPointerTypes[] = { - ui::EventPointerType::POINTER_TYPE_MOUSE, - ui::EventPointerType::POINTER_TYPE_TOUCH}; - -} // namespace - -// Tests that clicking/tapping on the app list button in tablet mode (when -// it has two functionalities), transitions the ink drop state correctly. -TEST_P(AppListButtonInkDropTest, AppListButtonInTabletMode) { - InitAppListButtonInkDrop(); - // Finish all setup tasks. In particular we want to finish the GetSwitchStates - // post task in (Fake)PowerManagerClient which is triggered by - // TabletModeController otherwise this will cause tablet mode to exit while we - // wait for animations in the test. - RunAllPendingInMessageLoop(); - - // Verify the app list button bounds change when we enter tablet mode. - const gfx::Rect old_bounds = app_list_button_->GetBoundsInScreen(); - Shell::Get()->tablet_mode_controller()->EnableTabletModeWindowManager(true); - test_api_->RunMessageLoopUntilAnimationsDone(); - - gfx::Rect new_bounds = app_list_button_->GetBoundsInScreen(); - EXPECT_EQ(new_bounds.height(), old_bounds.height()); - EXPECT_GT(new_bounds.width(), old_bounds.width()); - - gfx::Point point_on_circle = app_list_button_->GetAppListButtonCenterPoint(); - views::View::ConvertPointToScreen(app_list_button_, &point_on_circle); - gfx::Point point_on_back_button = - app_list_button_->GetBackButtonCenterPoint(); - views::View::ConvertPointToScreen(app_list_button_, &point_on_back_button); - - // Verify the ink drop state transitions as expected when we press and - // release on the app list circle part of the app list button. Taps on the - // app list circle, which shows the app list, should end up in the activated - // state. - MovePointerTo(point_on_circle); - PressPointer(); - EXPECT_EQ(views::InkDropState::ACTION_PENDING, - app_list_button_ink_drop_->GetTargetInkDropState()); - EXPECT_THAT(app_list_button_ink_drop_->GetAndResetRequestedStates(), - ElementsAre(views::InkDropState::ACTION_PENDING)); - ReleasePointer(); - - // Trigger a mock button notification that the app list was shown. - app_list_button_->OnAppListShown(); - FinishAppListVisibilityChange(); - EXPECT_EQ(views::InkDropState::ACTIVATED, - app_list_button_ink_drop_->GetTargetInkDropState()); - EXPECT_THAT(app_list_button_ink_drop_->GetAndResetRequestedStates(), - ElementsAre(views::InkDropState::ACTIVATED)); - - // Trigger a mock button notification that the app list was dismissed. - app_list_button_->OnAppListDismissed(); - FinishAppListVisibilityChange(); - EXPECT_EQ(views::InkDropState::HIDDEN, - app_list_button_ink_drop_->GetTargetInkDropState()); - EXPECT_THAT(app_list_button_ink_drop_->GetAndResetRequestedStates(), - ElementsAre(views::InkDropState::DEACTIVATED)); - - // Verify the ink drop state transitions as expected when we tap on the back - // button part of the app list button. - MovePointerTo(point_on_back_button); - PressPointer(); - EXPECT_EQ(views::InkDropState::ACTION_PENDING, - app_list_button_ink_drop_->GetTargetInkDropState()); - EXPECT_THAT(app_list_button_ink_drop_->GetAndResetRequestedStates(), - ElementsAre(views::InkDropState::ACTION_PENDING)); - ReleasePointer(); - EXPECT_EQ(views::InkDropState::HIDDEN, - app_list_button_ink_drop_->GetTargetInkDropState()); - EXPECT_THAT(app_list_button_ink_drop_->GetAndResetRequestedStates(), - ElementsAre(views::InkDropState::ACTION_TRIGGERED)); - - // Verify that the bounds after leaving tablet mode match the original bounds. - Shell::Get()->tablet_mode_controller()->EnableTabletModeWindowManager(false); - test_api_->RunMessageLoopUntilAnimationsDone(); - new_bounds = app_list_button_->GetBoundsInScreen(); - EXPECT_EQ(new_bounds, old_bounds); -} - -INSTANTIATE_TEST_CASE_P( - /* prefix intentionally left blank due to only one parameterization */, - AppListButtonInkDropTest, - ::testing::ValuesIn(kPointerTypes)); - namespace { std::string ToString(ShelfAlignment shelf_alignment) {
diff --git a/ash/shelf/shelf_window_watcher_unittest.cc b/ash/shelf/shelf_window_watcher_unittest.cc index 24ce3219..fa3cbec 100644 --- a/ash/shelf/shelf_window_watcher_unittest.cc +++ b/ash/shelf/shelf_window_watcher_unittest.cc
@@ -46,8 +46,8 @@ void SetUp() override { AshTestBase::SetUp(); model_ = Shell::Get()->shelf_model(); - // ShelfModel creates an app list item. - ASSERT_EQ(1, model_->item_count()); + // ShelfModel creates an app list item and back button. + ASSERT_EQ(2, model_->item_count()); } void TearDown() override { @@ -76,17 +76,17 @@ std::unique_ptr<views::Widget> widget1 = CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); CreateShelfItem(widget1->GetNativeWindow()); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); std::unique_ptr<views::Widget> widget2 = CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); CreateShelfItem(widget2->GetNativeWindow()); - EXPECT_EQ(3, model_->item_count()); + EXPECT_EQ(4, model_->item_count()); // Each ShelfItem is removed when the associated window is destroyed. widget1.reset(); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); widget2.reset(); - EXPECT_EQ(1, model_->item_count()); + EXPECT_EQ(2, model_->item_count()); } // Ensure shelf items are added and removed for some unknown windows in mash. @@ -97,16 +97,16 @@ // Windows with no valid ShelfItemType and ShelfID properties get shelf items. std::unique_ptr<views::Widget> widget1 = CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); std::unique_ptr<views::Widget> widget2 = CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); - EXPECT_EQ(3, model_->item_count()); + EXPECT_EQ(4, model_->item_count()); // Each ShelfItem is removed when the associated window is destroyed. widget1.reset(); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); widget2.reset(); - EXPECT_EQ(1, model_->item_count()); + EXPECT_EQ(2, model_->item_count()); // Windows with type WINDOW_TYPE_NORMAL get shelf items, others do not. aura::client::WindowType no_item_types[] = { @@ -122,7 +122,7 @@ ->GetChildById(kShellWindowId_DefaultContainer) ->AddChild(window.get()); window->Show(); - EXPECT_EQ(type == aura::client::WINDOW_TYPE_NORMAL ? 2 : 1, + EXPECT_EQ(type == aura::client::WINDOW_TYPE_NORMAL ? 3 : 2, model_->item_count()); } @@ -133,28 +133,27 @@ // TODO(msw): Make the flag a window property and remove this workaround. widget1->GetNativeWindow()->SetProperty(aura::client::kDrawAttentionKey, true); - EXPECT_EQ(1, model_->item_count()); + EXPECT_EQ(2, model_->item_count()); } TEST_F(ShelfWindowWatcherTest, CreateAndRemoveShelfItemProperties) { // Creating windows without a valid ShelfItemType does not add items. - EXPECT_EQ(1, model_->item_count()); std::unique_ptr<views::Widget> widget1 = CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); std::unique_ptr<views::Widget> widget2 = CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); - EXPECT_EQ(1, model_->item_count()); + EXPECT_EQ(2, model_->item_count()); // Create a ShelfItem for the first window. ShelfID id_w1 = CreateShelfItem(widget1->GetNativeWindow()); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); int index_w1 = model_->ItemIndexByID(id_w1); EXPECT_EQ(STATUS_RUNNING, model_->items()[index_w1].status); // Create a ShelfItem for the second window. ShelfID id_w2 = CreateShelfItem(widget2->GetNativeWindow()); - EXPECT_EQ(3, model_->item_count()); + EXPECT_EQ(4, model_->item_count()); int index_w2 = model_->ItemIndexByID(id_w2); EXPECT_EQ(STATUS_RUNNING, model_->items()[index_w2].status); @@ -162,23 +161,22 @@ // ShelfItem is removed when the item type window property is cleared. widget1->GetNativeWindow()->SetProperty(kShelfItemTypeKey, static_cast<int32_t>(TYPE_UNDEFINED)); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); widget2->GetNativeWindow()->SetProperty(kShelfItemTypeKey, static_cast<int32_t>(TYPE_UNDEFINED)); - EXPECT_EQ(1, model_->item_count()); + EXPECT_EQ(2, model_->item_count()); // Clearing twice doesn't do anything. widget2->GetNativeWindow()->SetProperty(kShelfItemTypeKey, static_cast<int32_t>(TYPE_UNDEFINED)); - EXPECT_EQ(1, model_->item_count()); + EXPECT_EQ(2, model_->item_count()); } TEST_F(ShelfWindowWatcherTest, UpdateWindowProperty) { // Create a ShelfItem for a new window. - EXPECT_EQ(1, model_->item_count()); std::unique_ptr<views::Widget> widget = CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); ShelfID id = CreateShelfItem(widget->GetNativeWindow()); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); int index = model_->ItemIndexByID(id); EXPECT_EQ(STATUS_RUNNING, model_->items()[index].status); @@ -187,7 +185,7 @@ widget->GetNativeWindow()->SetProperty(kShelfItemTypeKey, static_cast<int32_t>(TYPE_APP_PANEL)); // No new item is created after updating a launcher item. - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); // index and id are not changed after updating a launcher item. EXPECT_EQ(index, model_->ItemIndexByID(id)); EXPECT_EQ(id, model_->items()[index].id); @@ -195,11 +193,10 @@ TEST_F(ShelfWindowWatcherTest, MaximizeAndRestoreWindow) { // Create a ShelfItem for a new window. - EXPECT_EQ(1, model_->item_count()); std::unique_ptr<views::Widget> widget = CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); ShelfID id = CreateShelfItem(widget->GetNativeWindow()); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); int index = model_->ItemIndexByID(id); EXPECT_EQ(STATUS_RUNNING, model_->items()[index].status); @@ -210,7 +207,7 @@ window_state->Maximize(); EXPECT_TRUE(window_state->IsMaximized()); // No new item is created after maximizing the window. - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); // index and id are not changed after maximizing the window. EXPECT_EQ(index, model_->ItemIndexByID(id)); EXPECT_EQ(id, model_->items()[index].id); @@ -219,7 +216,7 @@ window_state->Restore(); EXPECT_FALSE(window_state->IsMaximized()); // No new item is created after restoring the window. - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); // Index and id are not changed after maximizing the window. EXPECT_EQ(index, model_->ItemIndexByID(id)); EXPECT_EQ(id, model_->items()[index].id); @@ -229,11 +226,10 @@ // TODO(simonhong): Add a test for removing a Window during the dragging. TEST_F(ShelfWindowWatcherTest, DragWindow) { // Create a ShelfItem for a new window. - EXPECT_EQ(1, model_->item_count()); std::unique_ptr<views::Widget> widget = CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); ShelfID id = CreateShelfItem(widget->GetNativeWindow()); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); int index = model_->ItemIndexByID(id); EXPECT_EQ(STATUS_RUNNING, model_->items()[index].status); @@ -254,13 +250,12 @@ // Ensure panels and dialogs get shelf items. TEST_F(ShelfWindowWatcherTest, PanelAndDialogWindows) { // An item is created for a dialog window. - EXPECT_EQ(1, model_->item_count()); std::unique_ptr<views::Widget> dialog_widget = CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); aura::Window* dialog = dialog_widget->GetNativeWindow(); dialog->SetProperty(kShelfIDKey, new std::string(ShelfID("a").Serialize())); dialog->SetProperty(kShelfItemTypeKey, static_cast<int32_t>(TYPE_DIALOG)); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); // An item is created for a panel window. views::Widget panel_widget; @@ -273,7 +268,7 @@ aura::Window* panel = panel_widget.GetNativeWindow(); panel->SetProperty(kShelfIDKey, new std::string(ShelfID("b").Serialize())); panel->SetProperty(kShelfItemTypeKey, static_cast<int32_t>(TYPE_APP_PANEL)); - EXPECT_EQ(3, model_->item_count()); + EXPECT_EQ(4, model_->item_count()); // An item is not created for an app window. std::unique_ptr<views::Widget> app_widget = @@ -281,47 +276,45 @@ aura::Window* app = app_widget->GetNativeWindow(); app->SetProperty(kShelfIDKey, new std::string(ShelfID("c").Serialize())); app->SetProperty(kShelfItemTypeKey, static_cast<int32_t>(TYPE_APP)); - EXPECT_EQ(3, model_->item_count()); + EXPECT_EQ(4, model_->item_count()); app_widget.reset(); // Each ShelfItem is removed when the associated window is destroyed. panel_widget.CloseNow(); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); dialog_widget.reset(); - EXPECT_EQ(1, model_->item_count()); + EXPECT_EQ(2, model_->item_count()); } // Ensure items use the app icon and window icon aura::Window properties. TEST_F(ShelfWindowWatcherTest, ItemIcon) { // Create a ShelfItem for a window; it should have a default icon. - EXPECT_EQ(1, model_->item_count()); std::unique_ptr<views::Widget> widget = CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); aura::Window* window = widget->GetNativeWindow(); ShelfID id = CreateShelfItem(window); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); gfx::Image default_image = rb.GetImageNamed(IDR_DEFAULT_FAVICON_32); - EXPECT_TRUE(model_->items()[1].image.BackedBySameObjectAs( + EXPECT_TRUE(model_->items()[2].image.BackedBySameObjectAs( default_image.AsImageSkia())); // Setting a window icon should update the item icon. const gfx::ImageSkia red = CreateImageSkiaIcon(SK_ColorRED); window->SetProperty(aura::client::kWindowIconKey, new gfx::ImageSkia(red)); - EXPECT_EQ(SK_ColorRED, model_->items()[1].image.bitmap()->getColor(0, 0)); + EXPECT_EQ(SK_ColorRED, model_->items()[2].image.bitmap()->getColor(0, 0)); // Setting an app icon should override the window icon. const gfx::ImageSkia blue = CreateImageSkiaIcon(SK_ColorBLUE); window->SetProperty(aura::client::kAppIconKey, new gfx::ImageSkia(blue)); - EXPECT_EQ(SK_ColorBLUE, model_->items()[1].image.bitmap()->getColor(0, 0)); + EXPECT_EQ(SK_ColorBLUE, model_->items()[2].image.bitmap()->getColor(0, 0)); // Clearing the app icon should restore the window icon to the shelf item. window->ClearProperty(aura::client::kAppIconKey); - EXPECT_EQ(SK_ColorRED, model_->items()[1].image.bitmap()->getColor(0, 0)); + EXPECT_EQ(SK_ColorRED, model_->items()[2].image.bitmap()->getColor(0, 0)); } TEST_F(ShelfWindowWatcherTest, DontCreateShelfEntriesForChildWindows) { - EXPECT_EQ(1, model_->item_count()); std::unique_ptr<aura::Window> window = std::make_unique<aura::Window>(nullptr, aura::client::WINDOW_TYPE_NORMAL); window->Init(ui::LAYER_NOT_DRAWN); @@ -331,7 +324,7 @@ ->GetChildById(kShellWindowId_DefaultContainer) ->AddChild(window.get()); window->Show(); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); std::unique_ptr<aura::Window> child = std::make_unique<aura::Window>(nullptr, aura::client::WINDOW_TYPE_NORMAL); @@ -341,16 +334,15 @@ window->AddChild(child.get()); child->Show(); // There should not be a new shelf item for |child|. - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); child.reset(); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); window.reset(); - EXPECT_EQ(1, model_->item_count()); + EXPECT_EQ(2, model_->item_count()); } TEST_F(ShelfWindowWatcherTest, CreateShelfEntriesForTransientWindows) { - EXPECT_EQ(1, model_->item_count()); std::unique_ptr<aura::Window> window = std::make_unique<aura::Window>(nullptr, aura::client::WINDOW_TYPE_NORMAL); window->Init(ui::LAYER_NOT_DRAWN); @@ -360,7 +352,7 @@ ->GetChildById(kShellWindowId_DefaultContainer) ->AddChild(window.get()); window->Show(); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); std::unique_ptr<aura::Window> transient = std::make_unique<aura::Window>(nullptr, aura::client::WINDOW_TYPE_NORMAL); @@ -375,12 +367,12 @@ transient.get()); transient->Show(); // There should be a new shelf item for |transient|. - EXPECT_EQ(3, model_->item_count()); + EXPECT_EQ(4, model_->item_count()); transient.reset(); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); window.reset(); - EXPECT_EQ(1, model_->item_count()); + EXPECT_EQ(2, model_->item_count()); } // Ensures ShelfWindowWatcher supports windows opened prior to session start. @@ -390,18 +382,18 @@ ASSERT_FALSE( Shell::Get()->session_controller()->IsActiveUserSessionStarted()); - // ShelfModel creates an app list item. - EXPECT_EQ(1, model->item_count()); + // ShelfModel creates an app list item and back button. + EXPECT_EQ(2, model->item_count()); // Construct a window that should get a shelf item once the session starts. std::unique_ptr<views::Widget> widget = CreateTestWidget(nullptr, kShellWindowId_DefaultContainer, gfx::Rect()); ShelfWindowWatcherTest::CreateShelfItem(widget->GetNativeWindow()); - EXPECT_EQ(1, model->item_count()); + EXPECT_EQ(2, model->item_count()); // Start the test user session; ShelfWindowWatcher will find the open window. CreateUserSessions(1); - EXPECT_EQ(2, model->item_count()); + EXPECT_EQ(3, model->item_count()); } } // namespace
diff --git a/ash/shell/bubble.cc b/ash/shell/bubble.cc index ab4b2268..045e8d1 100644 --- a/ash/shell/bubble.cc +++ b/ash/shell/bubble.cc
@@ -24,7 +24,7 @@ ~ExampleBubbleDialogDelegateView() override; void Init() override { - SetLayoutManager(new views::FillLayout()); + SetLayoutManager(std::make_unique<views::FillLayout>()); views::Label* label = new views::Label(label_); AddChildView(label); }
diff --git a/ash/shell/shell_delegate_impl.cc b/ash/shell/shell_delegate_impl.cc index e6514e5..2d971674 100644 --- a/ash/shell/shell_delegate_impl.cc +++ b/ash/shell/shell_delegate_impl.cc
@@ -78,10 +78,6 @@ return base::string16(); } -gfx::Image ShellDelegateImpl::GetDeprecatedAcceleratorImage() const { - return gfx::Image(); -} - ui::InputDeviceControllerClient* ShellDelegateImpl::GetInputDeviceControllerClient() { return nullptr;
diff --git a/ash/shell/shell_delegate_impl.h b/ash/shell/shell_delegate_impl.h index d3c4ef11..2a30d3e 100644 --- a/ash/shell/shell_delegate_impl.h +++ b/ash/shell/shell_delegate_impl.h
@@ -37,7 +37,6 @@ std::unique_ptr<WallpaperDelegate> CreateWallpaperDelegate() override; AccessibilityDelegate* CreateAccessibilityDelegate() override; base::string16 GetProductName() const override; - gfx::Image GetDeprecatedAcceleratorImage() const override; ui::InputDeviceControllerClient* GetInputDeviceControllerClient() override; private:
diff --git a/ash/shell_delegate.h b/ash/shell_delegate.h index 15fec449..62ef39f 100644 --- a/ash/shell_delegate.h +++ b/ash/shell_delegate.h
@@ -18,10 +18,6 @@ class Window; } -namespace gfx { -class Image; -} - namespace keyboard { class KeyboardUI; } @@ -93,8 +89,6 @@ virtual void OpenKeyboardShortcutHelpPage() const {} - virtual gfx::Image GetDeprecatedAcceleratorImage() const = 0; - // Creator of Shell owns this; it's assumed this outlives Shell. virtual ui::InputDeviceControllerClient* GetInputDeviceControllerClient() = 0; };
diff --git a/ash/shell_delegate_mus.cc b/ash/shell_delegate_mus.cc index 13e39415..55886b4 100644 --- a/ash/shell_delegate_mus.cc +++ b/ash/shell_delegate_mus.cc
@@ -109,11 +109,6 @@ return base::string16(); } -gfx::Image ShellDelegateMus::GetDeprecatedAcceleratorImage() const { - NOTIMPLEMENTED_LOG_ONCE(); - return gfx::Image(); -} - ui::InputDeviceControllerClient* ShellDelegateMus::GetInputDeviceControllerClient() { if (!connector_)
diff --git a/ash/shell_delegate_mus.h b/ash/shell_delegate_mus.h index b856032..3f2933ee 100644 --- a/ash/shell_delegate_mus.h +++ b/ash/shell_delegate_mus.h
@@ -35,7 +35,6 @@ std::unique_ptr<WallpaperDelegate> CreateWallpaperDelegate() override; AccessibilityDelegate* CreateAccessibilityDelegate() override; base::string16 GetProductName() const override; - gfx::Image GetDeprecatedAcceleratorImage() const override; ui::InputDeviceControllerClient* GetInputDeviceControllerClient() override; private:
diff --git a/ash/shell_port_mus.cc b/ash/shell_port_mus.cc index b6d4a1b5..f598e0a 100644 --- a/ash/shell_port_mus.cc +++ b/ash/shell_port_mus.cc
@@ -11,6 +11,8 @@ #include "ash/display/display_synchronizer.h" #include "ash/host/ash_window_tree_host_init_params.h" #include "ash/host/ash_window_tree_host_mus.h" +#include "ash/host/ash_window_tree_host_mus_mirroring_unified.h" +#include "ash/host/ash_window_tree_host_mus_unified.h" #include "ash/keyboard/keyboard_ui_mash.h" #include "ash/pointer_watcher_adapter_classic.h" #include "ash/public/cpp/config.h" @@ -209,6 +211,19 @@ aura_init_params.use_classic_ime = !Shell::ShouldUseIMEService(); aura_init_params.uses_real_accelerated_widget = !::switches::IsMusHostingViz(); + + if (!::switches::IsMusHostingViz()) { + if (init_params.mirroring_unified) { + return std::make_unique<AshWindowTreeHostMusMirroringUnified>( + std::move(aura_init_params), init_params.display_id, + init_params.mirroring_delegate); + } + if (init_params.offscreen) { + return std::make_unique<AshWindowTreeHostMusUnified>( + std::move(aura_init_params), init_params.mirroring_delegate); + } + } + return std::make_unique<AshWindowTreeHostMus>(std::move(aura_init_params)); }
diff --git a/ash/sidebar/sidebar_widget.cc b/ash/sidebar/sidebar_widget.cc index f0ee13b..5b22f10 100644 --- a/ash/sidebar/sidebar_widget.cc +++ b/ash/sidebar/sidebar_widget.cc
@@ -40,15 +40,14 @@ const SkColor kLightShadingColor = SkColorSetARGB(200, 0, 0, 0); -// TODO(yoshiki): Remove the margins from the sidebar. -constexpr size_t kWidth = message_center::kNotificationWidth + 2; - // The blur radius of the background. constexpr int kSidebarBackgroundBlurRadius = 30; gfx::Rect CalculateBounds(const gfx::Rect& display_bounds) { - return gfx::Rect(display_bounds.x() + display_bounds.width() - kWidth, - display_bounds.y(), kWidth, display_bounds.height()); + return gfx::Rect(display_bounds.x() + display_bounds.width() - + message_center::kNotificationWidth, + display_bounds.y(), message_center::kNotificationWidth, + display_bounds.height()); } } // namespace @@ -85,12 +84,13 @@ message_center_view_->SetNotifications( message_center->GetVisibleNotifications()); - auto* container_layout = new views::BoxLayout(views::BoxLayout::kVertical); + auto container_layout = + std::make_unique<views::BoxLayout>(views::BoxLayout::kVertical); container_->SetPaintToLayer(); container_->layer()->SetFillsBoundsOpaquely(false); - container_->SetLayoutManager(container_layout); container_->AddChildView(message_center_view_); container_layout->SetFlexForView(message_center_view_, 1); + container_->SetLayoutManager(std::move(container_layout)); AddChildView(background_); AddChildView(container_);
diff --git a/ash/sticky_keys/sticky_keys_overlay.cc b/ash/sticky_keys/sticky_keys_overlay.cc index 1a17db9..294af541 100644 --- a/ash/sticky_keys/sticky_keys_overlay.cc +++ b/ash/sticky_keys/sticky_keys_overlay.cc
@@ -141,7 +141,7 @@ int vertical_spacing = font_size / 2 - font_padding; int child_spacing = font_size - 2 * font_padding; - SetLayoutManager(new views::BoxLayout( + SetLayoutManager(std::make_unique<views::BoxLayout>( views::BoxLayout::kVertical, gfx::Insets(vertical_spacing, horizontal_spacing), child_spacing)); AddKeyLabel(ui::EF_CONTROL_DOWN,
diff --git a/ash/system/audio/volume_view.cc b/ash/system/audio/volume_view.cc index a14494de..2fc328b 100644 --- a/ash/system/audio/volume_view.cc +++ b/ash/system/audio/volume_view.cc
@@ -122,7 +122,7 @@ slider_(nullptr), device_type_(nullptr), is_default_view_(is_default_view) { - SetLayoutManager(new views::FillLayout); + SetLayoutManager(std::make_unique<views::FillLayout>()); AddChildView(tri_view_); icon_ = new VolumeButton(owner, this);
diff --git a/ash/system/bluetooth/tray_bluetooth.cc b/ash/system/bluetooth/tray_bluetooth.cc index eaebceb1..099fa11c 100644 --- a/ash/system/bluetooth/tray_bluetooth.cc +++ b/ash/system/bluetooth/tray_bluetooth.cc
@@ -471,11 +471,11 @@ views::View* CreateDisabledPanel() { views::View* container = new views::View; - views::BoxLayout* box_layout = - new views::BoxLayout(views::BoxLayout::kVertical); + auto box_layout = + std::make_unique<views::BoxLayout>(views::BoxLayout::kVertical); box_layout->set_main_axis_alignment( views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER); - container->SetLayoutManager(box_layout); + container->SetLayoutManager(std::move(box_layout)); TrayPopupItemStyle style( TrayPopupItemStyle::FontStyle::DETAILED_VIEW_LABEL);
diff --git a/ash/system/brightness/tray_brightness.cc b/ash/system/brightness/tray_brightness.cc index 1c90819..f13da16 100644 --- a/ash/system/brightness/tray_brightness.cc +++ b/ash/system/brightness/tray_brightness.cc
@@ -92,7 +92,7 @@ : dragging_(false), is_default_view_(default_view), last_percent_(initial_percent) { - SetLayoutManager(new views::FillLayout); + SetLayoutManager(std::make_unique<views::FillLayout>()); // Use CreateMultiTargetRowView() instead of CreateDefaultRowView() because // that's what the audio row uses and we want the two rows to layout with the // same insets.
diff --git a/ash/system/cast/tray_cast.cc b/ash/system/cast/tray_cast.cc index 153c8c9..3a40bd89 100644 --- a/ash/system/cast/tray_cast.cc +++ b/ash/system/cast/tray_cast.cc
@@ -78,6 +78,8 @@ return kSystemMenuCastAudioGroupIcon; case mojom::SinkIconType::CAST_AUDIO: return kSystemMenuCastAudioIcon; + case mojom::SinkIconType::WIRED_DISPLAY: + return kSystemMenuCastGenericIcon; } NOTREACHED(); @@ -262,7 +264,7 @@ select_view_->SetEnabled(enabled); cast_view_ = new CastCastView(); cast_view_->UpdateLabel(sinks_routes); - SetLayoutManager(new views::FillLayout()); + SetLayoutManager(std::make_unique<views::FillLayout>()); ActivateSelectView(); }
diff --git a/ash/system/date/date_view.cc b/ash/system/date/date_view.cc index 6a581b45..7d8e71c 100644 --- a/ash/system/date/date_view.cc +++ b/ash/system/date/date_view.cc
@@ -127,14 +127,14 @@ DateView::DateView(SystemTrayItem* owner) : BaseDateTimeView(owner), action_(DateAction::NONE) { - views::BoxLayout* box_layout = - new views::BoxLayout(views::BoxLayout::kHorizontal, - gfx::Insets(0, kTrayPopupLabelHorizontalPadding), 0); + auto box_layout = std::make_unique<views::BoxLayout>( + views::BoxLayout::kHorizontal, + gfx::Insets(0, kTrayPopupLabelHorizontalPadding), 0); box_layout->set_main_axis_alignment( views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER); box_layout->set_cross_axis_alignment( views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER); - SetLayoutManager(box_layout); + SetLayoutManager(std::move(box_layout)); date_label_ = TrayPopupUtils::CreateDefaultLabel(); UpdateTextInternal(base::Time::Now()); TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::SYSTEM_INFO); @@ -258,7 +258,7 @@ if (clock_layout == ClockLayout::HORIZONTAL_CLOCK) { RemoveChildView(vertical_label_hours_.get()); RemoveChildView(vertical_label_minutes_.get()); - SetLayoutManager(new views::FillLayout()); + SetLayoutManager(std::make_unique<views::FillLayout>()); AddChildView(horizontal_label_.get()); } else { RemoveChildView(horizontal_label_.get());
diff --git a/ash/system/date/system_info_default_view.cc b/ash/system/date/system_info_default_view.cc index aaecd25..ce4860d 100644 --- a/ash/system/date/system_info_default_view.cc +++ b/ash/system/date/system_info_default_view.cc
@@ -32,7 +32,7 @@ tri_view_(TrayPopupUtils::CreateMultiTargetRowView()) { tri_view_->SetMinHeight(kTrayPopupSystemInfoRowHeight); AddChildView(tri_view_); - SetLayoutManager(new views::FillLayout); + SetLayoutManager(std::make_unique<views::FillLayout>()); date_view_ = new tray::DateView(owner); tri_view_->AddView(TriView::Container::START, date_view_);
diff --git a/ash/system/display_scale/scale_view.cc b/ash/system/display_scale/scale_view.cc index d96cab34..2496810 100644 --- a/ash/system/display_scale/scale_view.cc +++ b/ash/system/display_scale/scale_view.cc
@@ -37,7 +37,7 @@ label_(nullptr), slider_(nullptr), is_default_view_(is_default_view) { - SetLayoutManager(new views::FillLayout); + SetLayoutManager(std::make_unique<views::FillLayout>()); AddChildView(tri_view_); label_ = new views::Label(base::UTF8ToUTF16(base::StringPrintf(
diff --git a/ash/system/ime_menu/ime_list_view.cc b/ash/system/ime_menu/ime_list_view.cc index d63ce63..4ed001d 100644 --- a/ash/system/ime_menu/ime_list_view.cc +++ b/ash/system/ime_menu/ime_list_view.cc
@@ -59,7 +59,7 @@ TriView* tri_view = TrayPopupUtils::CreateDefaultRowView(); AddChildView(tri_view); - SetLayoutManager(new views::FillLayout); + SetLayoutManager(std::make_unique<views::FillLayout>()); // |id_label| contains the IME short name (e.g., 'US', 'GB', 'IT'). views::Label* id_label = TrayPopupUtils::CreateDefaultLabel(); @@ -149,7 +149,7 @@ void Init(views::ButtonListener* listener) { TrayPopupUtils::ConfigureAsStickyHeader(this); - SetLayoutManager(new views::FillLayout); + SetLayoutManager(std::make_unique<views::FillLayout>()); TriView* tri_view = TrayPopupUtils::CreateDefaultRowView(); AddChildView(tri_view);
diff --git a/ash/system/ime_menu/ime_menu_tray.cc b/ash/system/ime_menu/ime_menu_tray.cc index a6946d5..5280814 100644 --- a/ash/system/ime_menu/ime_menu_tray.cc +++ b/ash/system/ime_menu/ime_menu_tray.cc
@@ -137,9 +137,10 @@ views::CreateSolidSidedBorder(0, 0, kSeparatorWidth, 0, kMenuSeparatorColor), gfx::Insets(kMenuSeparatorVerticalPadding - kSeparatorWidth, 0))); - auto* box_layout = new views::BoxLayout(views::BoxLayout::kHorizontal); + auto box_layout = + std::make_unique<views::BoxLayout>(views::BoxLayout::kHorizontal); box_layout->set_minimum_cross_axis_size(kTrayPopupItemMinHeight); - SetLayoutManager(box_layout); + views::BoxLayout* layout_ptr = SetLayoutManager(std::move(box_layout)); auto* title_label = new views::Label(l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_IME)); title_label->SetBorder( @@ -149,7 +150,7 @@ style.SetupLabel(title_label); AddChildView(title_label); - box_layout->SetFlexForView(title_label, 1); + layout_ptr->SetFlexForView(title_label, 1); if (show_settings_button) { settings_button_ = CreateImeMenuButton( @@ -221,9 +222,10 @@ private: void Init(bool show_emoji, bool show_handwriting, bool show_voice) { - auto* box_layout = new views::BoxLayout(views::BoxLayout::kHorizontal); + auto box_layout = + std::make_unique<views::BoxLayout>(views::BoxLayout::kHorizontal); box_layout->set_minimum_cross_axis_size(kTrayPopupItemMinHeight); - SetLayoutManager(box_layout); + SetLayoutManager(std::move(box_layout)); SetBorder(views::CreatePaddedBorder( views::CreateSolidSidedBorder(kSeparatorWidth, 0, 0, 0, kMenuSeparatorColor),
diff --git a/ash/system/keyboard_brightness/tray_keyboard_brightness.cc b/ash/system/keyboard_brightness/tray_keyboard_brightness.cc index c0d5f79..992deba 100644 --- a/ash/system/keyboard_brightness/tray_keyboard_brightness.cc +++ b/ash/system/keyboard_brightness/tray_keyboard_brightness.cc
@@ -75,7 +75,7 @@ }; KeyboardBrightnessView::KeyboardBrightnessView(double initial_percent) { - SetLayoutManager(new views::FillLayout); + SetLayoutManager(std::make_unique<views::FillLayout>()); // Use CreateMultiTargetRowView() instead of CreateDefaultRowView() because // that's what the audio row uses and we want the two rows to layout with the // same insets.
diff --git a/ash/system/network/network_icon.cc b/ash/system/network/network_icon.cc index 5d758dd..d4cdc3fb 100644 --- a/ash/system/network/network_icon.cc +++ b/ash/system/network/network_icon.cc
@@ -389,9 +389,12 @@ } int StrengthIndex(int strength) { + if (strength == 0) + return 0; // Return an index in the range [1, kNumNetworkImages - 1]. - const float findex = (static_cast<float>(strength) / 100.0f) * - nextafter(static_cast<float>(kNumNetworkImages - 1), 0); + // This logic is equivalent to cr_network_icon.js:strengthToIndex_(). + const float findex = (static_cast<float>(strength - 1) / 100.0f) * + static_cast<float>(kNumNetworkImages - 1); int index = 1 + static_cast<int>(findex); index = std::max(std::min(index, kNumNetworkImages - 1), 1); return index; @@ -434,7 +437,6 @@ return gfx::CreateVectorIcon(kNetworkEthernetIcon, GetDefaultColorForIconType(ICON_TYPE_LIST)); } else if (network->Matches(NetworkTypePattern::Wireless())) { - DCHECK(strength_index > 0); return GetImageForIndex(ImageTypeForNetwork(network, icon_type), icon_type, strength_index); } else if (network->Matches(NetworkTypePattern::VPN())) { @@ -595,7 +597,9 @@ } else if (type == shill::kTypeWimax) { technology_badge_ = {&kNetworkBadgeTechnology4gIcon, icon_color}; } else if (type == shill::kTypeCellular) { - if (network->roaming() == shill::kRoamingStateRoaming) { + // technology_badge_ is set in UpdateCellularState. + if (network->IsConnectedState() && + network->roaming() == shill::kRoamingStateRoaming) { // For networks that are always in roaming don't show roaming badge. const DeviceState* device = NetworkHandler::Get()->network_state_handler()->GetDeviceState( @@ -607,13 +611,12 @@ } } } - if (!network->IsConnectingState()) { + // Only show technology, VPN, and captive portal badges when connected. + if (network->IsConnectedState()) { badges->top_left = technology_badge_; badges->bottom_left = vpn_badge_; - } - - if (behind_captive_portal_) { - badges->bottom_right = {&kNetworkBadgeCaptivePortalIcon, icon_color}; + if (behind_captive_portal_) + badges->bottom_right = {&kNetworkBadgeCaptivePortalIcon, icon_color}; } } @@ -768,8 +771,8 @@ flags.setColor(color_); // As a percentage of the bg triangle, the length of one of the short // sides of the fg triangle, indexed by signal strength. - static constexpr float kTriangleSidePercents[] = {0.f, 0.5f, 0.625f, 0.75f, - 1.f}; + static constexpr float kTriangleSidePercents[] = {0.f, 0.375f, 0.5833f, + 0.75f, 1.f}; canvas->DrawPath(make_triangle(kTriangleSidePercents[signal_strength_] * kFullTriangleSide), flags); @@ -1019,6 +1022,8 @@ // attempted to be split evenly from |kNumNetworkImages| - 1. Remainders go // first to the lowest bucket and then the second lowest bucket. const int index = StrengthIndex(network->signal_strength()); + if (index == 0) + return SignalStrength::NONE; const int seperations = kNumNetworkImages - 1; const int bucket_size = seperations / 3;
diff --git a/ash/system/network/network_icon.h b/ash/system/network/network_icon.h index e7ae8e3..e33da1b 100644 --- a/ash/system/network/network_icon.h +++ b/ash/system/network/network_icon.h
@@ -33,7 +33,7 @@ enum ImageType { ARCS, BARS, NONE }; // Strength of a wireless signal. -enum class SignalStrength { WEAK, MEDIUM, STRONG, NOT_WIRELESS }; +enum class SignalStrength { NONE, WEAK, MEDIUM, STRONG, NOT_WIRELESS }; // Depicts a given signal strength using arcs (e.g. for WiFi connections) or // bars (e.g. for cell connections).
diff --git a/ash/system/network/network_icon_unittest.cc b/ash/system/network/network_icon_unittest.cc index 71a965f2..32287ede 100644 --- a/ash/system/network/network_icon_unittest.cc +++ b/ash/system/network/network_icon_unittest.cc
@@ -217,20 +217,20 @@ GetSignalStrengthForNetwork(ethernet_network_.get())); EXPECT_NE(ss::NOT_WIRELESS, GetSignalStrengthForNetwork(wifi_network_.get())); - // Signal strength is divided into three categories: weak, medium and strong. - // They are meant to match the number of sections in the wifi icon. The wifi - // icon currently has four levels; signals [0, 100] are mapped to [1, 4]. - // There are only three signal strengths so icons that were mapped to 2 are - // also considered weak. + // Signal strength is divided into four categories: none, weak, medium and + // strong. They are meant to match the number of sections in the wifi icon. + // The wifi icon currently has four levels; signals [0, 100] are mapped to [1, + // 4]. There are only three signal strengths so icons that were mapped to 2 + // are also considered weak. wifi_network_->set_signal_strength(0); - EXPECT_EQ(ss::WEAK, GetSignalStrengthForNetwork(wifi_network_.get())); - wifi_network_->set_signal_strength(49); - EXPECT_EQ(ss::WEAK, GetSignalStrengthForNetwork(wifi_network_.get())); + EXPECT_EQ(ss::NONE, GetSignalStrengthForNetwork(wifi_network_.get())); wifi_network_->set_signal_strength(50); - EXPECT_EQ(ss::MEDIUM, GetSignalStrengthForNetwork(wifi_network_.get())); - wifi_network_->set_signal_strength(74); + EXPECT_EQ(ss::WEAK, GetSignalStrengthForNetwork(wifi_network_.get())); + wifi_network_->set_signal_strength(51); EXPECT_EQ(ss::MEDIUM, GetSignalStrengthForNetwork(wifi_network_.get())); wifi_network_->set_signal_strength(75); + EXPECT_EQ(ss::MEDIUM, GetSignalStrengthForNetwork(wifi_network_.get())); + wifi_network_->set_signal_strength(76); EXPECT_EQ(ss::STRONG, GetSignalStrengthForNetwork(wifi_network_.get())); wifi_network_->set_signal_strength(100); EXPECT_EQ(ss::STRONG, GetSignalStrengthForNetwork(wifi_network_.get()));
diff --git a/ash/system/network/network_list.cc b/ash/system/network/network_list.cc index 04701bc..bac51ff 100644 --- a/ash/system/network/network_list.cc +++ b/ash/system/network/network_list.cc
@@ -195,7 +195,7 @@ void InitializeLayout() { TrayPopupUtils::ConfigureAsStickyHeader(this); - SetLayoutManager(new views::FillLayout); + SetLayoutManager(std::make_unique<views::FillLayout>()); container_ = TrayPopupUtils::CreateSubHeaderRowView(false); AddChildView(container_);
diff --git a/ash/system/network/network_row_title_view.cc b/ash/system/network/network_row_title_view.cc index c1cf5e8..91918f8 100644 --- a/ash/system/network/network_row_title_view.cc +++ b/ash/system/network/network_row_title_view.cc
@@ -22,8 +22,8 @@ NetworkRowTitleView::NetworkRowTitleView(int title_message_id) : title_(TrayPopupUtils::CreateDefaultLabel()), subtitle_(TrayPopupUtils::CreateDefaultLabel()) { - SetLayoutManager( - new views::BoxLayout(views::BoxLayout::Orientation::kVertical)); + SetLayoutManager(std::make_unique<views::BoxLayout>( + views::BoxLayout::Orientation::kVertical)); TrayPopupItemStyle title_style(TrayPopupItemStyle::FontStyle::SUB_HEADER); title_style.SetupLabel(title_);
diff --git a/ash/system/network/network_state_list_detailed_view.cc b/ash/system/network/network_state_list_detailed_view.cc index 25964ad3..4cf2048 100644 --- a/ash/system/network/network_state_list_detailed_view.cc +++ b/ash/system/network/network_state_list_detailed_view.cc
@@ -67,7 +67,7 @@ set_shadow(views::BubbleBorder::NO_ASSETS); set_anchor_view_insets(gfx::Insets(0, 0, kBubbleMargin, 0)); set_notify_enter_exit_on_child(true); - SetLayoutManager(new views::FillLayout()); + SetLayoutManager(std::make_unique<views::FillLayout>()); AddChildView(content); } @@ -294,10 +294,8 @@ if (list_type_ == LIST_TYPE_NETWORK) { NetworkStateHandler* network_state_handler = NetworkHandler::Get()->network_state_handler(); - // TODO(crbug.com/756092): Add | operator to NetworkTypePattern. - const bool scanning = - network_state_handler->GetScanningByType(NetworkTypePattern::WiFi()) || - network_state_handler->GetScanningByType(NetworkTypePattern::Tether()); + const bool scanning = network_state_handler->GetScanningByType( + NetworkTypePattern::WiFi() | NetworkTypePattern::Tether()); ShowProgress(-1, scanning); } }
diff --git a/ash/system/network/tray_network.cc b/ash/system/network/tray_network.cc index cf8ea9f57..2325e2e 100644 --- a/ash/system/network/tray_network.cc +++ b/ash/system/network/tray_network.cc
@@ -128,6 +128,7 @@ // to |connected_network|. base::string16 signal_strength_string; switch (network_icon::GetSignalStrengthForNetwork(connected_network)) { + case SignalStrength::NONE: case SignalStrength::NOT_WIRELESS: break; case SignalStrength::WEAK: @@ -142,9 +143,6 @@ signal_strength_string = l10n_util::GetStringUTF16( IDS_ASH_STATUS_TRAY_NETWORK_SIGNAL_STRONG); break; - default: - NOTREACHED(); - break; } if (!signal_strength_string.empty()) {
diff --git a/ash/system/network/vpn_list_view.cc b/ash/system/network/vpn_list_view.cc index 84838d65..a6a8926 100644 --- a/ash/system/network/vpn_list_view.cc +++ b/ash/system/network/vpn_list_view.cc
@@ -78,7 +78,7 @@ int button_accessible_name_id) : vpn_provider_(vpn_provider) { TrayPopupUtils::ConfigureAsStickyHeader(this); - SetLayoutManager(new views::FillLayout); + SetLayoutManager(std::make_unique<views::FillLayout>()); TriView* tri_view = TrayPopupUtils::CreateSubHeaderRowView(false); AddChildView(tri_view);
diff --git a/ash/system/palette/palette_tray.cc b/ash/system/palette/palette_tray.cc index fcf09663..002e439 100644 --- a/ash/system/palette/palette_tray.cc +++ b/ash/system/palette/palette_tray.cc
@@ -86,10 +86,11 @@ explicit TitleView(PaletteTray* palette_tray) : palette_tray_(palette_tray) { // TODO(tdanderson|jdufault): Use TriView to handle the layout of the title. // See crbug.com/614453. - auto* box_layout = new views::BoxLayout(views::BoxLayout::kHorizontal); + auto box_layout = + std::make_unique<views::BoxLayout>(views::BoxLayout::kHorizontal); box_layout->set_cross_axis_alignment( views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER); - SetLayoutManager(box_layout); + views::BoxLayout* layout_ptr = SetLayoutManager(std::move(box_layout)); auto* title_label = new views::Label(l10n_util::GetStringUTF16(IDS_ASH_STYLUS_TOOLS_TITLE)); @@ -97,7 +98,7 @@ AddChildView(title_label); TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::TITLE); style.SetupLabel(title_label); - box_layout->SetFlexForView(title_label, 1); + layout_ptr->SetFlexForView(title_label, 1); help_button_ = new SystemMenuButton(this, TrayPopupInkDropStyle::HOST_CENTERED, kSystemMenuHelpIcon, IDS_ASH_STATUS_TRAY_HELP); @@ -152,7 +153,7 @@ PaletteTool::RegisterToolInstances(palette_tool_manager_.get()); SetInkDropMode(InkDropMode::ON); - SetLayoutManager(new views::FillLayout()); + SetLayoutManager(std::make_unique<views::FillLayout>()); icon_ = new views::ImageView(); icon_->SetTooltipText(l10n_util::GetStringUTF16(IDS_ASH_STYLUS_TOOLS_TITLE)); UpdateTrayIcon();
diff --git a/ash/system/palette/palette_welcome_bubble.cc b/ash/system/palette/palette_welcome_bubble.cc index eee0e36..9fa03a3 100644 --- a/ash/system/palette/palette_welcome_bubble.cc +++ b/ash/system/palette/palette_welcome_bubble.cc
@@ -46,12 +46,14 @@ set_parent_window( anchor_widget()->GetNativeWindow()->GetRootWindow()->GetChildById( kShellWindowId_SettingBubbleContainer)); - SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical)); + SetLayoutManager( + std::make_unique<views::BoxLayout>(views::BoxLayout::kVertical)); // Add the header which contains the title and close button. auto* header = new views::View(); - auto* box_layout = new views::BoxLayout(views::BoxLayout::kHorizontal); - header->SetLayoutManager(box_layout); + auto box_layout = + std::make_unique<views::BoxLayout>(views::BoxLayout::kHorizontal); + auto* layout_ptr = header->SetLayoutManager(std::move(box_layout)); AddChildView(header); // Add the title, which is bolded. @@ -61,7 +63,7 @@ title->SetFontList(views::Label::GetDefaultFontList().Derive( 0, gfx::Font::FontStyle::NORMAL, gfx::Font::Weight::BOLD)); header->AddChildView(title); - box_layout->SetFlexForView(title, 1); + layout_ptr->SetFlexForView(title, 1); // Add a button to close the bubble. close_button_ = new views::ImageButton(this);
diff --git a/ash/system/power/power_status_view.cc b/ash/system/power/power_status_view.cc index a50a6167..5d7ddf7 100644 --- a/ash/system/power/power_status_view.cc +++ b/ash/system/power/power_status_view.cc
@@ -33,10 +33,9 @@ separator_label_->SetEnabledColor(kHeaderTextColorNormal); separator_label_->SetText(base::ASCIIToUTF16(" - ")); - views::BoxLayout* layout = - new views::BoxLayout(views::BoxLayout::kHorizontal, gfx::Insets(0, 12), - kTrayPopupPaddingBetweenItems); - SetLayoutManager(layout); + SetLayoutManager(std::make_unique<views::BoxLayout>( + views::BoxLayout::kHorizontal, gfx::Insets(0, 12), + kTrayPopupPaddingBetweenItems)); AddChildView(percentage_label_); AddChildView(separator_label_);
diff --git a/ash/system/rotation/tray_rotation_lock.cc b/ash/system/rotation/tray_rotation_lock.cc index de518ac5..7208105 100644 --- a/ash/system/rotation/tray_rotation_lock.cc +++ b/ash/system/rotation/tray_rotation_lock.cc
@@ -78,7 +78,7 @@ : ActionableView(owner, TrayPopupInkDropStyle::FILL_BOUNDS), icon_(TrayPopupUtils::CreateMainImageView()), label_(TrayPopupUtils::CreateDefaultLabel()) { - SetLayoutManager(new views::FillLayout); + SetLayoutManager(std::make_unique<views::FillLayout>()); TriView* tri_view = TrayPopupUtils::CreateDefaultRowView(); AddChildView(tri_view);
diff --git a/ash/system/screen_security/screen_tray_item.cc b/ash/system/screen_security/screen_tray_item.cc index ea2fc4f..e9ac1f7a 100644 --- a/ash/system/screen_security/screen_tray_item.cc +++ b/ash/system/screen_security/screen_tray_item.cc
@@ -46,7 +46,7 @@ stop_button_text_(stop_button_text) { CreateItems(); TriView* tri_view(TrayPopupUtils::CreateDefaultRowView()); - SetLayoutManager(new views::FillLayout); + SetLayoutManager(std::make_unique<views::FillLayout>()); AddChildView(tri_view); tri_view->AddView(TriView::Container::START, icon_); tri_view->AddView(TriView::Container::CENTER, label_);
diff --git a/ash/system/session/logout_button_tray.cc b/ash/system/session/logout_button_tray.cc index 8e37b35c..1b75e07 100644 --- a/ash/system/session/logout_button_tray.cc +++ b/ash/system/session/logout_button_tray.cc
@@ -38,7 +38,7 @@ show_logout_button_in_tray_(false) { DCHECK(shelf); Shell::Get()->session_controller()->AddObserver(this); - SetLayoutManager(new views::FillLayout); + SetLayoutManager(std::make_unique<views::FillLayout>()); AddChildView(container_); button_->SetProminent(true);
diff --git a/ash/system/session/logout_confirmation_dialog.cc b/ash/system/session/logout_confirmation_dialog.cc index d2aff4f..f130f18 100644 --- a/ash/system/session/logout_confirmation_dialog.cc +++ b/ash/system/session/logout_confirmation_dialog.cc
@@ -35,7 +35,7 @@ LogoutConfirmationController* controller, base::TimeTicks logout_time) : controller_(controller), logout_time_(logout_time) { - SetLayoutManager(new views::FillLayout()); + SetLayoutManager(std::make_unique<views::FillLayout>()); SetBorder(views::CreateEmptyBorder( views::LayoutProvider::Get()->GetDialogInsetsForContentType( views::TEXT, views::TEXT)));
diff --git a/ash/system/status_area_widget_delegate.cc b/ash/system/status_area_widget_delegate.cc index 3168457..aa6a6f3e 100644 --- a/ash/system/status_area_widget_delegate.cc +++ b/ash/system/status_area_widget_delegate.cc
@@ -121,7 +121,8 @@ void StatusAreaWidgetDelegate::DeleteDelegate() {} void StatusAreaWidgetDelegate::AddTray(views::View* tray) { - SetLayoutManager(NULL); // Reset layout manager before adding a child. + // Reset layout manager before adding a child. + SetLayoutManager(nullptr); AddChildView(tray); // Set the layout manager with the new list of children. UpdateLayout();
diff --git a/ash/system/tray/system_tray_controller.cc b/ash/system/tray/system_tray_controller.cc index e266a6a..fd36f28 100644 --- a/ash/system/tray/system_tray_controller.cc +++ b/ash/system/tray/system_tray_controller.cc
@@ -13,7 +13,7 @@ namespace ash { SystemTrayController::SystemTrayController() - : binding_(this), hour_clock_type_(base::GetHourClockType()) {} + : hour_clock_type_(base::GetHourClockType()) {} SystemTrayController::~SystemTrayController() = default; @@ -140,7 +140,7 @@ } void SystemTrayController::BindRequest(mojom::SystemTrayRequest request) { - binding_.Bind(std::move(request)); + bindings_.AddBinding(this, std::move(request)); } void SystemTrayController::SetClient(mojom::SystemTrayClientPtr client) {
diff --git a/ash/system/tray/system_tray_controller.h b/ash/system/tray/system_tray_controller.h index c5643c1..03fbc242 100644 --- a/ash/system/tray/system_tray_controller.h +++ b/ash/system/tray/system_tray_controller.h
@@ -10,7 +10,7 @@ #include "base/compiler_specific.h" #include "base/i18n/time_formatting.h" #include "base/macros.h" -#include "mojo/public/cpp/bindings/binding.h" +#include "mojo/public/cpp/bindings/binding_set.h" namespace ash { @@ -80,8 +80,8 @@ // Client interface in chrome browser. May be null in tests. mojom::SystemTrayClientPtr system_tray_client_; - // Binding for the SystemTray interface. - mojo::Binding<mojom::SystemTray> binding_; + // Bindings for users of the mojo interface. + mojo::BindingSet<mojom::SystemTray> bindings_; // The type of clock hour display: 12 or 24 hour. base::HourClockType hour_clock_type_;
diff --git a/ash/test_shell_delegate.cc b/ash/test_shell_delegate.cc index 7e61d26..28e9560 100644 --- a/ash/test_shell_delegate.cc +++ b/ash/test_shell_delegate.cc
@@ -66,10 +66,6 @@ return base::string16(); } -gfx::Image TestShellDelegate::GetDeprecatedAcceleratorImage() const { - return gfx::Image(); -} - ui::InputDeviceControllerClient* TestShellDelegate::GetInputDeviceControllerClient() { return nullptr;
diff --git a/ash/test_shell_delegate.h b/ash/test_shell_delegate.h index f68fc744..616a90d 100644 --- a/ash/test_shell_delegate.h +++ b/ash/test_shell_delegate.h
@@ -31,7 +31,6 @@ std::unique_ptr<WallpaperDelegate> CreateWallpaperDelegate() override; AccessibilityDelegate* CreateAccessibilityDelegate() override; base::string16 GetProductName() const override; - gfx::Image GetDeprecatedAcceleratorImage() const override; ui::InputDeviceControllerClient* GetInputDeviceControllerClient() override; void SetForceMaximizeOnFirstRun(bool maximize) {
diff --git a/ash/tray_action/tray_action.cc b/ash/tray_action/tray_action.cc index f114c1b..bb8c7f9 100644 --- a/ash/tray_action/tray_action.cc +++ b/ash/tray_action/tray_action.cc
@@ -18,7 +18,6 @@ TrayAction::TrayAction(BacklightsForcedOffSetter* backlights_forced_off_setter) : backlights_forced_off_setter_(backlights_forced_off_setter), - binding_(this), stylus_observer_(this) { stylus_observer_.Add(ui::InputDeviceManager::GetInstance()); } @@ -34,7 +33,7 @@ } void TrayAction::BindRequest(mojom::TrayActionRequest request) { - binding_.Bind(std::move(request)); + bindings_.AddBinding(this, std::move(request)); } mojom::TrayActionState TrayAction::GetLockScreenNoteState() const {
diff --git a/ash/tray_action/tray_action.h b/ash/tray_action/tray_action.h index 41ffccc..ea9fef1 100644 --- a/ash/tray_action/tray_action.h +++ b/ash/tray_action/tray_action.h
@@ -12,7 +12,7 @@ #include "base/macros.h" #include "base/observer_list.h" #include "base/scoped_observer.h" -#include "mojo/public/cpp/bindings/binding.h" +#include "mojo/public/cpp/bindings/binding_set.h" #include "ui/events/devices/input_device_event_observer.h" namespace ui { @@ -92,7 +92,8 @@ base::ObserverList<TrayActionObserver> observers_; - mojo::Binding<mojom::TrayAction> binding_; + // Bindings for users of the mojo interface. + mojo::BindingSet<mojom::TrayAction> bindings_; mojom::TrayActionClientPtr tray_action_client_;
diff --git a/ash/wm/tablet_mode/tablet_mode_controller.cc b/ash/wm/tablet_mode/tablet_mode_controller.cc index bcd5060..58b080fc6 100644 --- a/ash/wm/tablet_mode/tablet_mode_controller.cc +++ b/ash/wm/tablet_mode/tablet_mode_controller.cc
@@ -202,6 +202,7 @@ void TabletModeController::BindRequest( mojom::TabletModeControllerRequest request) { + DCHECK(!binding_.is_bound()) << "Only one client allowed."; binding_.Bind(std::move(request)); }
diff --git a/base/BUILD.gn b/base/BUILD.gn index b7a4775..89e9ddb9 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn
@@ -1148,6 +1148,7 @@ ":build_date", ":cfi_flags", ":debugging_flags", + ":protected_memory_flags", "//base/numerics:base_numerics", ] @@ -1749,6 +1750,17 @@ ] } +# Build flags for ProtectedMemory, temporary workaround for crbug.com/792777 +# TODO(vtsyrklevich): Remove once support for gold on Android/CrOs is dropped +buildflag_header("protected_memory_flags") { + header = "protected_memory_flags.h" + header_dir = "base/memory" + + # buildflag entries added to this header must also must be manually added to + # tools/gn/bootstrap/bootstrap.py + flags = [ "USE_LLD=$use_lld" ] +} + # This is the subset of files from base that should not be used with a dynamic # library. Note that this library cannot depend on base because base depends on # base_static.
diff --git a/base/android/jni_generator/AndroidManifest.xml b/base/android/jni_generator/AndroidManifest.xml deleted file mode 100644 index ec28ff5..0000000 --- a/base/android/jni_generator/AndroidManifest.xml +++ /dev/null
@@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright 2017 The Chromium Authors. All rights reserved. Use of this source - code is governed by a BSD-style license that can be found in the LICENSE - file. ---> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.jni.generator"> - - <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="24" /> - <application></application> - -</manifest>
diff --git a/base/android/jni_generator/BUILD.gn b/base/android/jni_generator/BUILD.gn index 4dda6cd..68e5519 100644 --- a/base/android/jni_generator/BUILD.gn +++ b/base/android/jni_generator/BUILD.gn
@@ -64,7 +64,7 @@ android_apk("sample_jni_apk") { apk_name = "SampleJni" - android_manifest = "AndroidManifest.xml" + android_manifest = "//build/android/AndroidManifest.xml" deps = [ ":jni_sample_java", "//base:base_java",
diff --git a/base/compiler_specific.h b/base/compiler_specific.h index 2b9cd02e..e4f005f 100644 --- a/base/compiler_specific.h +++ b/base/compiler_specific.h
@@ -187,6 +187,13 @@ #endif #endif +// DISABLE_CFI_ICALL -- Disable Control Flow Integrity indirect call checks. +#if !defined(DISABLE_CFI_ICALL) && defined(__clang__) +#define DISABLE_CFI_ICALL __attribute__((no_sanitize("cfi-icall"))) +#else +#define DISABLE_CFI_ICALL +#endif + // Macro useful for writing cross-platform function pointers. #if !defined(CDECL) #if defined(OS_WIN)
diff --git a/base/i18n/time_formatting_unittest.cc b/base/i18n/time_formatting_unittest.cc index 8224f660..027b7c9 100644 --- a/base/i18n/time_formatting_unittest.cc +++ b/base/i18n/time_formatting_unittest.cc
@@ -175,6 +175,34 @@ EXPECT_EQ(clock24h, TimeFormatTimeOfDay(time)); EXPECT_EQ(k24HourClock, GetHourClockType()); // k{Keep,Drop}AmPm should not affect for 24h clock. + EXPECT_EQ(clock24h, TimeFormatTimeOfDayWithHourClockType(time, k24HourClock, + kKeepAmPm)); + EXPECT_EQ(clock24h, TimeFormatTimeOfDayWithHourClockType(time, k24HourClock, + kDropAmPm)); + // k{Keep,Drop}AmPm affects for 12h clock. + EXPECT_EQ(clock12h_pm, TimeFormatTimeOfDayWithHourClockType( + time, k12HourClock, kKeepAmPm)); + EXPECT_EQ(clock12h, TimeFormatTimeOfDayWithHourClockType(time, k12HourClock, + kDropAmPm)); +} + +TEST(TimeFormattingTest, TimeFormatTimeOfDayDE) { + // Test for a locale that uses different mark than "AM" and "PM". + // As an instance, we use third_party/icu/source/data/locales/de.txt. + test::ScopedRestoreICUDefaultLocale restore_locale; + i18n::SetICUDefaultLocale("de"); + ScopedRestoreDefaultTimezone la_time("America/Los_Angeles"); + + Time time; + EXPECT_TRUE(Time::FromUTCExploded(kTestDateTimeExploded, &time)); + string16 clock24h(ASCIIToUTF16("15:42")); + string16 clock12h_pm(UTF8ToUTF16("3:42 nachm.")); + string16 clock12h(ASCIIToUTF16("3:42")); + + // The default is 24h clock. + EXPECT_EQ(clock24h, TimeFormatTimeOfDay(time)); + EXPECT_EQ(k24HourClock, GetHourClockType()); + // k{Keep,Drop}AmPm should not affect for 24h clock. EXPECT_EQ(clock24h, TimeFormatTimeOfDayWithHourClockType(time, k24HourClock,
diff --git a/base/memory/protected_memory.h b/base/memory/protected_memory.h index 7ae5fda..2bfb75f 100644 --- a/base/memory/protected_memory.h +++ b/base/memory/protected_memory.h
@@ -17,12 +17,15 @@ #include "base/lazy_instance.h" #include "base/logging.h" #include "base/macros.h" +#include "base/memory/protected_memory_flags.h" #include "base/synchronization/lock.h" #include "build/build_config.h" #define PROTECTED_MEMORY_ENABLED 1 -#if defined(OS_LINUX) +// Linking with lld is required to workaround crbug.com/792777. +// TODO(vtsyrklevich): Remove once support for gold on Android/CrOs is dropped +#if defined(OS_LINUX) && BUILDFLAG(USE_LLD) // Define the section read-only __asm__(".section protected_memory, \"a\"\n\t"); #define PROTECTED_MEMORY_SECTION __attribute__((section("protected_memory")))
diff --git a/base/memory/ref_counted_memory.cc b/base/memory/ref_counted_memory.cc index 7eaaf03..c46bb9a 100644 --- a/base/memory/ref_counted_memory.cc +++ b/base/memory/ref_counted_memory.cc
@@ -38,6 +38,8 @@ RefCountedBytes::RefCountedBytes(const unsigned char* p, size_t size) : data_(p, p + size) {} +RefCountedBytes::RefCountedBytes(size_t size) : data_(size, 0) {} + scoped_refptr<RefCountedBytes> RefCountedBytes::TakeVector( std::vector<unsigned char>* to_destroy) { scoped_refptr<RefCountedBytes> bytes(new RefCountedBytes);
diff --git a/base/memory/ref_counted_memory.h b/base/memory/ref_counted_memory.h index aa22c9e..ca7c371 100644 --- a/base/memory/ref_counted_memory.h +++ b/base/memory/ref_counted_memory.h
@@ -78,6 +78,10 @@ // Constructs a RefCountedBytes object by copying |size| bytes from |p|. RefCountedBytes(const unsigned char* p, size_t size); + // Constructs a RefCountedBytes object by zero-initializing a new vector of + // |size| bytes. + explicit RefCountedBytes(size_t size); + // Constructs a RefCountedBytes object by performing a swap. (To non // destructively build a RefCountedBytes, use the constructor that takes a // vector.) @@ -91,6 +95,14 @@ const std::vector<unsigned char>& data() const { return data_; } std::vector<unsigned char>& data() { return data_; } + // Non-const versions of front() and front_as() that are simply shorthand for + // data().data(). + unsigned char* front() { return data_.data(); } + template <typename T> + T* front_as() { + return reinterpret_cast<T*>(front()); + } + private: ~RefCountedBytes() override;
diff --git a/base/memory/ref_counted_memory_unittest.cc b/base/memory/ref_counted_memory_unittest.cc index 034f674b..72046e52 100644 --- a/base/memory/ref_counted_memory_unittest.cc +++ b/base/memory/ref_counted_memory_unittest.cc
@@ -6,13 +6,16 @@ #include <stdint.h> +#include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +using testing::Each; +using testing::ElementsAre; + namespace base { TEST(RefCountedMemoryUnitTest, RefCountedStaticMemory) { - scoped_refptr<RefCountedMemory> mem = new RefCountedStaticMemory( - "static mem00", 10); + auto mem = MakeRefCounted<RefCountedStaticMemory>("static mem00", 10); EXPECT_EQ(10U, mem->size()); EXPECT_EQ("static mem", std::string(mem->front_as<char>(), mem->size())); @@ -26,41 +29,52 @@ EXPECT_EQ(0U, data.size()); - EXPECT_EQ(2U, mem->size()); + ASSERT_EQ(2U, mem->size()); EXPECT_EQ(45U, mem->front()[0]); EXPECT_EQ(99U, mem->front()[1]); scoped_refptr<RefCountedMemory> mem2; { - unsigned char data2[] = { 12, 11, 99 }; - mem2 = new RefCountedBytes(data2, 3); + const unsigned char kData[] = {12, 11, 99}; + mem2 = MakeRefCounted<RefCountedBytes>(kData, arraysize(kData)); } - EXPECT_EQ(3U, mem2->size()); + ASSERT_EQ(3U, mem2->size()); EXPECT_EQ(12U, mem2->front()[0]); EXPECT_EQ(11U, mem2->front()[1]); EXPECT_EQ(99U, mem2->front()[2]); } +TEST(RefCountedMemoryUnitTest, RefCountedBytesMutable) { + auto mem = base::MakeRefCounted<RefCountedBytes>(10); + + ASSERT_EQ(10U, mem->size()); + EXPECT_THAT(mem->data(), Each(0U)); + + // Test non-const versions of data(), front() and front_as<>(). + mem->data()[0] = 1; + mem->front()[1] = 2; + mem->front_as<char>()[2] = 3; + + EXPECT_THAT(mem->data(), ElementsAre(1, 2, 3, 0, 0, 0, 0, 0, 0, 0)); +} + TEST(RefCountedMemoryUnitTest, RefCountedString) { std::string s("destroy me"); scoped_refptr<RefCountedMemory> mem = RefCountedString::TakeString(&s); EXPECT_EQ(0U, s.size()); - EXPECT_EQ(10U, mem->size()); + ASSERT_EQ(10U, mem->size()); EXPECT_EQ('d', mem->front()[0]); EXPECT_EQ('e', mem->front()[1]); + EXPECT_EQ('e', mem->front()[9]); } TEST(RefCountedMemoryUnitTest, Equals) { std::string s1("same"); scoped_refptr<RefCountedMemory> mem1 = RefCountedString::TakeString(&s1); - std::vector<unsigned char> d2; - d2.push_back('s'); - d2.push_back('a'); - d2.push_back('m'); - d2.push_back('e'); + std::vector<unsigned char> d2 = {'s', 'a', 'm', 'e'}; scoped_refptr<RefCountedMemory> mem2 = RefCountedBytes::TakeVector(&d2); EXPECT_TRUE(mem1->Equals(mem2));
diff --git a/base/message_loop/message_loop.cc b/base/message_loop/message_loop.cc index 519eb8f..41c58bf 100644 --- a/base/message_loop/message_loop.cc +++ b/base/message_loop/message_loop.cc
@@ -303,7 +303,7 @@ internal::ScopedSetSequenceLocalStorageMapForCurrentThread>( &sequence_local_storage_map_); - run_loop_client_ = RunLoop::RegisterDelegateForCurrentThread(this); + RunLoop::RegisterDelegateForCurrentThread(this); } std::string MessageLoop::GetThreadName() const { @@ -491,7 +491,7 @@ if (ProcessNextDelayedNonNestableTask()) return true; - if (run_loop_client_->ShouldQuitWhenIdle()) + if (ShouldQuitWhenIdle()) pump_->Quit(); // When we return we will do a kernel wait for more tasks.
diff --git a/base/message_loop/message_loop.h b/base/message_loop/message_loop.h index bff60ef..46c7ab9 100644 --- a/base/message_loop/message_loop.h +++ b/base/message_loop/message_loop.h
@@ -398,9 +398,6 @@ // Whether task observers are allowed. bool allow_task_observers_ = true; - // An interface back to RunLoop state accessible by this RunLoop::Delegate. - RunLoop::Delegate::Client* run_loop_client_ = nullptr; - // Holds data stored through the SequenceLocalStorageSlot API. internal::SequenceLocalStorageMap sequence_local_storage_map_;
diff --git a/base/nix/xdg_util.cc b/base/nix/xdg_util.cc index 7d1a8795..109624a 100644 --- a/base/nix/xdg_util.cc +++ b/base/nix/xdg_util.cc
@@ -71,6 +71,8 @@ } if (xdg_current_desktop == "GNOME") return DESKTOP_ENVIRONMENT_GNOME; + if (xdg_current_desktop == "X-Cinnamon") + return DESKTOP_ENVIRONMENT_CINNAMON; if (xdg_current_desktop == "KDE") { std::string kde_session; if (env->GetVar(kKDESessionEnvVar, &kde_session)) { @@ -120,6 +122,8 @@ switch (env) { case DESKTOP_ENVIRONMENT_OTHER: return nullptr; + case DESKTOP_ENVIRONMENT_CINNAMON: + return "CINNAMON"; case DESKTOP_ENVIRONMENT_GNOME: return "GNOME"; case DESKTOP_ENVIRONMENT_KDE3:
diff --git a/base/nix/xdg_util.h b/base/nix/xdg_util.h index c012f9f..65f7d15 100644 --- a/base/nix/xdg_util.h +++ b/base/nix/xdg_util.h
@@ -47,6 +47,7 @@ enum DesktopEnvironment { DESKTOP_ENVIRONMENT_OTHER, + DESKTOP_ENVIRONMENT_CINNAMON, DESKTOP_ENVIRONMENT_GNOME, // KDE3, KDE4 and KDE5 are sufficiently different that we count // them as different desktop environments here.
diff --git a/base/nix/xdg_util_unittest.cc b/base/nix/xdg_util_unittest.cc index 6f72a84..e195303 100644 --- a/base/nix/xdg_util_unittest.cc +++ b/base/nix/xdg_util_unittest.cc
@@ -32,6 +32,7 @@ const char* const kDesktopKDE4 = "kde4"; const char* const kDesktopKDE = "kde"; const char* const kDesktopXFCE = "xfce"; +const char* const kXdgDesktopCinnamon = "X-Cinnamon"; const char* const kXdgDesktopGNOME = "GNOME"; const char* const kXdgDesktopKDE = "KDE"; const char* const kXdgDesktopPantheon = "Pantheon"; @@ -91,6 +92,15 @@ EXPECT_EQ(DESKTOP_ENVIRONMENT_XFCE, GetDesktopEnvironment(&getter)); } +TEST(XDGUtilTest, GetXdgDesktopCinnamon) { + MockEnvironment getter; + EXPECT_CALL(getter, GetVar(_, _)).WillRepeatedly(Return(false)); + EXPECT_CALL(getter, GetVar(Eq(kXdgDesktop), _)) + .WillOnce(DoAll(SetArgPointee<1>(kXdgDesktopCinnamon), Return(true))); + + EXPECT_EQ(DESKTOP_ENVIRONMENT_CINNAMON, GetDesktopEnvironment(&getter)); +} + TEST(XDGUtilTest, GetXdgDesktopGnome) { MockEnvironment getter; EXPECT_CALL(getter, GetVar(_, _)).WillRepeatedly(Return(false));
diff --git a/base/run_loop.cc b/base/run_loop.cc index 880625a..3cda1cb0 100644 --- a/base/run_loop.cc +++ b/base/run_loop.cc
@@ -32,7 +32,12 @@ } // namespace -RunLoop::Delegate::Delegate() { +RunLoop::Delegate::Delegate() + : should_quit_when_idle_callback_(base::BindRepeating( + [](Delegate* self) { + return self->active_run_loops_.top()->quit_when_idle_received_; + }, + Unretained(this))) { // The Delegate can be created on another thread. It is only bound in // RegisterDelegateForCurrentThread(). DETACH_FROM_THREAD(bound_thread_checker_); @@ -47,18 +52,12 @@ tls_delegate.Get().Set(nullptr); } -bool RunLoop::Delegate::Client::ShouldQuitWhenIdle() const { - DCHECK_CALLED_ON_VALID_THREAD(outer_->bound_thread_checker_); - DCHECK(outer_->bound_); - return outer_->was_overriden_ || - outer_->active_run_loops_.top()->quit_when_idle_received_; +bool RunLoop::Delegate::ShouldQuitWhenIdle() { + return should_quit_when_idle_callback_.Run(); } -RunLoop::Delegate::Client::Client(Delegate* outer) : outer_(outer) {} - // static -RunLoop::Delegate::Client* RunLoop::RegisterDelegateForCurrentThread( - Delegate* delegate) { +void RunLoop::RegisterDelegateForCurrentThread(Delegate* delegate) { // Bind |delegate| to this thread. DCHECK(!delegate->bound_); DCHECK_CALLED_ON_VALID_THREAD(delegate->bound_thread_checker_); @@ -67,13 +66,13 @@ DCHECK(!tls_delegate.Get().Get()); tls_delegate.Get().Set(delegate); delegate->bound_ = true; - - return &delegate->client_interface_; } // static -std::pair<RunLoop::Delegate::Client*, RunLoop::Delegate*> -RunLoop::OverrideDelegateForCurrentThreadForTesting(Delegate* delegate) { +RunLoop::Delegate* RunLoop::OverrideDelegateForCurrentThreadForTesting( + Delegate* delegate, + Delegate::ShouldQuitWhenIdleCallback + overriding_should_quit_when_idle_callback) { // Bind |delegate| to this thread. DCHECK(!delegate->bound_); DCHECK_CALLED_ON_VALID_THREAD(delegate->bound_thread_checker_); @@ -82,14 +81,15 @@ DCHECK(!IsRunningOnCurrentThread()); // Override the current Delegate (there must be one). - Delegate* overriden_delegate = tls_delegate.Get().Get(); - DCHECK(overriden_delegate); - DCHECK(overriden_delegate->bound_); - overriden_delegate->was_overriden_ = true; + Delegate* overridden_delegate = tls_delegate.Get().Get(); + DCHECK(overridden_delegate); + DCHECK(overridden_delegate->bound_); + overridden_delegate->should_quit_when_idle_callback_ = + std::move(overriding_should_quit_when_idle_callback); tls_delegate.Get().Set(delegate); delegate->bound_ = true; - return std::make_pair(&delegate->client_interface_, overriden_delegate); + return overridden_delegate; } RunLoop::RunLoop(Type type)
diff --git a/base/run_loop.h b/base/run_loop.h index bdaeda5..e43c4fc 100644 --- a/base/run_loop.h +++ b/base/run_loop.h
@@ -152,46 +152,33 @@ static void DisallowNestingOnCurrentThread(); // A RunLoop::Delegate is a generic interface that allows RunLoop to be - // separate from the uderlying implementation of the message loop for this + // separate from the underlying implementation of the message loop for this // thread. It holds private state used by RunLoops on its associated thread. // One and only one RunLoop::Delegate must be registered on a given thread // via RunLoop::RegisterDelegateForCurrentThread() before RunLoop instances // and RunLoop static methods can be used on it. class BASE_EXPORT Delegate { public: + // A Callback which returns true if the Delegate should return from the + // topmost Run() when it becomes idle. The Delegate is responsible for + // probing this when it becomes idle. + using ShouldQuitWhenIdleCallback = RepeatingCallback<bool(void)>; + Delegate(); virtual ~Delegate(); - // The client interface provided back to the caller who registers this - // Delegate via RegisterDelegateForCurrentThread() or - // OverrideDelegateForCurrentThreadForTesting(). - class BASE_EXPORT Client { - public: - // Returns true if the Delegate should return from the topmost Run() when - // it becomes idle. The Delegate is responsible for probing this when it - // becomes idle. - bool ShouldQuitWhenIdle() const; - - private: - // Only a Delegate can instantiate a Delegate::Client. - friend class Delegate; - Client(Delegate* outer); - - Delegate* outer_; - }; - // Used by RunLoop to inform its Delegate to Run/Quit. Implementations are // expected to keep on running synchronously from the Run() call until the // eventual matching Quit() call. Upon receiving a Quit() call it should // return from the Run() call as soon as possible without executing // remaining tasks/messages. Run() calls can nest in which case each Quit() // call should result in the topmost active Run() call returning. The only - // other trigger for Run() to return is Client::ShouldQuitWhenIdle() which - // the Delegate should probe before sleeping when it becomes idle. - // |application_tasks_allowed| is true if this is the first Run() call on - // the stack or it was made from a nested RunLoop of - // Type::kNestableTasksAllowed (otherwise this Run() level should only - // process system tasks). + // other trigger for Run() to return is the + // |should_quit_when_idle_callback_| which the Delegate should probe before + // sleeping when it becomes idle. |application_tasks_allowed| is true if + // this is the first Run() call on the stack or it was made from a nested + // RunLoop of Type::kNestableTasksAllowed (otherwise this Run() level should + // only process system tasks). virtual void Run(bool application_tasks_allowed) = 0; virtual void Quit() = 0; @@ -204,6 +191,11 @@ // system messages. virtual void EnsureWorkScheduled() = 0; + protected: + // Returns the result of this Delegate's |should_quit_when_idle_callback_|. + // "protected" so it can be invoked only by the Delegate itself. + bool ShouldQuitWhenIdle(); + private: // While the state is owned by the Delegate subclass, only RunLoop can use // it. @@ -218,12 +210,6 @@ RunLoopStack active_run_loops_; ObserverList<RunLoop::NestingObserver> nesting_observers_; - // True if this Delegate was overriden through - // OverrideDelegateForCurrentThreadForTesting(). It will from then on always - // return from Run() when idle (i.e. its Client's ShouldQuitWhenIdle() will - // always be true). - bool was_overriden_ = false; - #if DCHECK_IS_ON() bool allow_running_for_testing_ = true; #endif @@ -232,28 +218,28 @@ // RegisterDelegateForCurrentThread(). bool bound_ = false; + ShouldQuitWhenIdleCallback should_quit_when_idle_callback_; + // Thread-affine per its use of TLS. THREAD_CHECKER(bound_thread_checker_); - Client client_interface_ = Client(this); - DISALLOW_COPY_AND_ASSIGN(Delegate); }; // Registers |delegate| on the current thread. Must be called once and only // once per thread before using RunLoop methods on it. |delegate| is from then - // on forever bound to that thread (including its destruction). The returned - // Delegate::Client is valid as long as |delegate| is kept alive. - static Delegate::Client* RegisterDelegateForCurrentThread(Delegate* delegate); + // on forever bound to that thread (including its destruction). + static void RegisterDelegateForCurrentThread(Delegate* delegate); // Akin to RegisterDelegateForCurrentThread but overrides an existing Delegate - // (there must be one). Returning |delegate|'s client interface like - // RegisterDelegateForCurrentThread() as well as the overriden Delegate which - // the caller is now in charge of driving. The overriden Delegate's Run() - // method will always return when idle (or earlier if the Delegate's Quit() - // method is explicitly invoked). - static std::pair<Delegate::Client*, Delegate*> - OverrideDelegateForCurrentThreadForTesting(Delegate* delegate); + // (there must be one). Returning the overridden Delegate which the caller is + // now in charge of driving. |override_should_quit_when_idle_callback| + // specifies will replace the overridden Delegate's + // |should_quit_when_idle_callback_|, giving full control to |delegate|. + static Delegate* OverrideDelegateForCurrentThreadForTesting( + Delegate* delegate, + Delegate::ShouldQuitWhenIdleCallback + overriding_should_quit_when_idle_callback); // Quits the active RunLoop (when idle) -- there must be one. These were // introduced as prefered temporary replacements to the long deprecated @@ -318,9 +304,8 @@ bool running_ = false; // Used to record that QuitWhenIdle() was called on this RunLoop, meaning that // the Delegate should quit Run() once it becomes idle (it's responsible for - // probing this state via Client::ShouldQuitWhenIdle()). This state is stored - // here rather than pushed to Delegate via, e.g., Delegate::QuitWhenIdle() to - // support nested RunLoops. + // probing this state via ShouldQuitWhenIdle()). This state is stored here + // rather than pushed to Delegate to support nested RunLoops. bool quit_when_idle_received_ = false; // RunLoop is not thread-safe. Its state/methods, unless marked as such, may
diff --git a/base/run_loop_unittest.cc b/base/run_loop_unittest.cc index 1f626ca..714bf82 100644 --- a/base/run_loop_unittest.cc +++ b/base/run_loop_unittest.cc
@@ -158,10 +158,9 @@ // Makes this TestBoundDelegate become the RunLoop::Delegate and // ThreadTaskRunnerHandle for this thread. void BindToCurrentThread() { - DCHECK(!run_loop_client_); thread_task_runner_handle_ = std::make_unique<ThreadTaskRunnerHandle>(simple_task_runner_); - run_loop_client_ = RunLoop::RegisterDelegateForCurrentThread(this); + RunLoop::RegisterDelegateForCurrentThread(this); } private: @@ -178,7 +177,7 @@ if (application_tasks_allowed && simple_task_runner_->ProcessSingleTask()) continue; - if (run_loop_client_->ShouldQuitWhenIdle()) + if (ShouldQuitWhenIdle()) break; if (RunInjectedClosure()) @@ -205,8 +204,6 @@ std::unique_ptr<ThreadTaskRunnerHandle> thread_task_runner_handle_; bool should_quit_ = false; - - RunLoop::Delegate::Client* run_loop_client_ = nullptr; }; // A test RunLoop::Delegate meant to override an existing RunLoop::Delegate. @@ -219,20 +216,19 @@ // Overrides the existing RunLoop::Delegate and ThreadTaskRunnerHandles on // this thread with this TestOverridingDelegate's. void TakeOverCurrentThread() { - DCHECK(!run_loop_client_); - - overriden_task_runner_ = ThreadTaskRunnerHandle::Get(); - DCHECK(overriden_task_runner_); + overridden_task_runner_ = ThreadTaskRunnerHandle::Get(); + ASSERT_TRUE(overridden_task_runner_); thread_task_runner_handle_override_scope_ = ThreadTaskRunnerHandle::OverrideForTesting( simple_task_runner_, ThreadTaskRunnerHandle::OverrideType::kTakeOverThread); - auto delegate_override_pair = - RunLoop::OverrideDelegateForCurrentThreadForTesting(this); - run_loop_client_ = delegate_override_pair.first; - overriden_delegate_ = delegate_override_pair.second; - DCHECK(overriden_delegate_); + // TestOverridingDelegate::Run() is designed with the assumption that the + // overridden Delegate's Run() always returns control to it when it becomes + // idle. + overridden_delegate_ = RunLoop::OverrideDelegateForCurrentThreadForTesting( + this, base::BindRepeating([]() { return true; })); + ASSERT_TRUE(overridden_delegate_); } private: @@ -241,15 +237,15 @@ auto pending_tasks = simple_task_runner_->TakePendingTasks(); if (!pending_tasks.empty()) { while (!pending_tasks.empty()) { - overriden_task_runner_->PostTask(FROM_HERE, - std::move(pending_tasks.front())); + overridden_task_runner_->PostTask(FROM_HERE, + std::move(pending_tasks.front())); pending_tasks.pop(); } - overriden_delegate_->Run(application_tasks_allowed); + overridden_delegate_->Run(application_tasks_allowed); continue; } - if (run_loop_client_->ShouldQuitWhenIdle()) + if (ShouldQuitWhenIdle()) break; if (RunInjectedClosure()) @@ -262,11 +258,11 @@ void Quit() override { should_quit_ = true; - overriden_delegate_->Quit(); + overridden_delegate_->Quit(); } void EnsureWorkScheduled() override { - overriden_delegate_->EnsureWorkScheduled(); + overridden_delegate_->EnsureWorkScheduled(); } scoped_refptr<SimpleSingleThreadTaskRunner> simple_task_runner_ = @@ -274,12 +270,10 @@ ScopedClosureRunner thread_task_runner_handle_override_scope_; - scoped_refptr<SingleThreadTaskRunner> overriden_task_runner_; - RunLoop::Delegate* overriden_delegate_; + scoped_refptr<SingleThreadTaskRunner> overridden_task_runner_; + RunLoop::Delegate* overridden_delegate_; bool should_quit_ = false; - - RunLoop::Delegate::Client* run_loop_client_ = nullptr; }; enum class RunLoopTestType {
diff --git a/base/test/test_mock_time_task_runner.cc b/base/test/test_mock_time_task_runner.cc index 1264113a..b5328bb0 100644 --- a/base/test/test_mock_time_task_runner.cc +++ b/base/test/test_mock_time_task_runner.cc
@@ -197,7 +197,7 @@ Type type) : now_(start_time), now_ticks_(start_ticks), tasks_lock_cv_(&tasks_lock_) { if (type == Type::kBoundToThread) { - run_loop_client_ = RunLoop::RegisterDelegateForCurrentThread(this); + RunLoop::RegisterDelegateForCurrentThread(this); thread_task_runner_handle_ = std::make_unique<ThreadTaskRunnerHandle>( MakeRefCounted<NonOwningProxyTaskRunner>(this)); } @@ -387,7 +387,7 @@ while (!quit_run_loop_) { RunUntilIdle(); - if (quit_run_loop_ || run_loop_client_->ShouldQuitWhenIdle()) + if (quit_run_loop_ || ShouldQuitWhenIdle()) break; // Peek into |tasks_| to perform one of two things:
diff --git a/base/test/test_mock_time_task_runner.h b/base/test/test_mock_time_task_runner.h index ffa91c9d..acc2ff70 100644 --- a/base/test/test_mock_time_task_runner.h +++ b/base/test/test_mock_time_task_runner.h
@@ -248,10 +248,6 @@ mutable Lock tasks_lock_; ConditionVariable tasks_lock_cv_; - - // Members used to in TestMockTimeTaskRunners of Type::kBoundToThread to take - // ownership of the thread it was created on. - RunLoop::Delegate::Client* run_loop_client_ = nullptr; std::unique_ptr<ThreadTaskRunnerHandle> thread_task_runner_handle_; // Set to true in RunLoop::Delegate::Quit() to signal the topmost
diff --git a/base/threading/thread_task_runner_handle.h b/base/threading/thread_task_runner_handle.h index a24d68b6..2e41eb0 100644 --- a/base/threading/thread_task_runner_handle.h +++ b/base/threading/thread_task_runner_handle.h
@@ -7,6 +7,7 @@ #include "base/base_export.h" #include "base/callback_helpers.h" +#include "base/compiler_specific.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/single_thread_task_runner.h" @@ -46,7 +47,7 @@ }; static ScopedClosureRunner OverrideForTesting( scoped_refptr<SingleThreadTaskRunner> overriding_task_runner, - OverrideType type = OverrideType::kDefault); + OverrideType type = OverrideType::kDefault) WARN_UNUSED_RESULT; // Binds |task_runner| to the current thread. |task_runner| must belong // to the current thread for this to succeed.
diff --git a/build/android/binary_size/apk_downloader.py b/build/android/binary_size/apk_downloader.py index b0787d8..132325b 100755 --- a/build/android/binary_size/apk_downloader.py +++ b/build/android/binary_size/apk_downloader.py
@@ -20,7 +20,7 @@ import download_from_google_storage import upload_to_google_storage -CURRENT_MILESTONE = '63' +CURRENT_MILESTONE = '64' DEFAULT_BUCKET = 'gs://chromium-android-tools/apks' DEFAULT_DOWNLOAD_PATH = os.path.join(os.path.dirname(__file__), 'apks') DEFAULT_BUILDER = 'Android_Builder'
diff --git a/build/android/binary_size/apks/Android_Builder/64/ChromeModernPublic.apk.sha1 b/build/android/binary_size/apks/Android_Builder/64/ChromeModernPublic.apk.sha1 new file mode 100644 index 0000000..92e9519e --- /dev/null +++ b/build/android/binary_size/apks/Android_Builder/64/ChromeModernPublic.apk.sha1
@@ -0,0 +1 @@ +98af8f2265f68dea89eecd1d93410fd36bf233c4 \ No newline at end of file
diff --git a/build/android/binary_size/apks/Android_Builder/64/ChromePublic.apk.sha1 b/build/android/binary_size/apks/Android_Builder/64/ChromePublic.apk.sha1 new file mode 100644 index 0000000..7bbf28ae --- /dev/null +++ b/build/android/binary_size/apks/Android_Builder/64/ChromePublic.apk.sha1
@@ -0,0 +1 @@ +d5c209e967fa2f6b98fd4e3d6882a85ad67a9d87 \ No newline at end of file
diff --git a/build/android/binary_size/apks/Android_Builder/64/MonochromePublic.apk.sha1 b/build/android/binary_size/apks/Android_Builder/64/MonochromePublic.apk.sha1 new file mode 100644 index 0000000..123d071 --- /dev/null +++ b/build/android/binary_size/apks/Android_Builder/64/MonochromePublic.apk.sha1
@@ -0,0 +1 @@ +a5059a9bbe1dd9b6750bee7c2728a366bf9864e9 \ No newline at end of file
diff --git a/build/android/binary_size/apks/Android_arm64_Builder/64/ChromeModernPublic.apk.sha1 b/build/android/binary_size/apks/Android_arm64_Builder/64/ChromeModernPublic.apk.sha1 new file mode 100644 index 0000000..e0df57b --- /dev/null +++ b/build/android/binary_size/apks/Android_arm64_Builder/64/ChromeModernPublic.apk.sha1
@@ -0,0 +1 @@ +3e4b8fd75aea0a22fa769c6686dd153d72741e91 \ No newline at end of file
diff --git a/build/android/binary_size/apks/Android_arm64_Builder/64/ChromePublic.apk.sha1 b/build/android/binary_size/apks/Android_arm64_Builder/64/ChromePublic.apk.sha1 new file mode 100644 index 0000000..e65c26f --- /dev/null +++ b/build/android/binary_size/apks/Android_arm64_Builder/64/ChromePublic.apk.sha1
@@ -0,0 +1 @@ +b7b222a6650e98dda980dd9bc922763e4102d0b6 \ No newline at end of file
diff --git a/build/android/binary_size/apks/README.md b/build/android/binary_size/apks/README.md index b095968..e651ed7 100644 --- a/build/android/binary_size/apks/README.md +++ b/build/android/binary_size/apks/README.md
@@ -39,3 +39,4 @@ * [M61](https://crrev.com/488528) * [M62](https://crrev.com/499187) * [M63](https://crrev.com/508578) + * [M64](https://crrev.com/520840)
diff --git a/build/android/buildhooks/java/org/chromium/build/BuildHooksAndroid.java b/build/android/buildhooks/java/org/chromium/build/BuildHooksAndroid.java index 9646c26..fdf0a86 100644 --- a/build/android/buildhooks/java/org/chromium/build/BuildHooksAndroid.java +++ b/build/android/buildhooks/java/org/chromium/build/BuildHooksAndroid.java
@@ -51,6 +51,14 @@ protected abstract Context createConfigurationContextImpl(Context context); + public static int getIdentifier( + Resources resources, String name, String defType, String defPackage) { + return sInstance.getIdentifierImpl(resources, name, defType, defPackage); + } + + protected abstract int getIdentifierImpl( + Resources resources, String name, String defType, String defPackage); + public static boolean isEnabled() { return sInstance.isEnabledImpl(); }
diff --git a/build/android/buildhooks/java/org/chromium/build/BuildHooksAndroidImpl.java b/build/android/buildhooks/java/org/chromium/build/BuildHooksAndroidImpl.java index f4791df..5b9b997 100644 --- a/build/android/buildhooks/java/org/chromium/build/BuildHooksAndroidImpl.java +++ b/build/android/buildhooks/java/org/chromium/build/BuildHooksAndroidImpl.java
@@ -36,6 +36,12 @@ } @Override + protected int getIdentifierImpl( + Resources resources, String name, String defType, String defPackage) { + return resources.getIdentifier(name, defType, defPackage); + } + + @Override protected boolean isEnabledImpl() { return false; }
diff --git a/build/android/bytecode/java/org/chromium/bytecode/AssertionEnablerClassAdapter.java b/build/android/bytecode/java/org/chromium/bytecode/AssertionEnablerClassAdapter.java index ac0239c..0a903a60 100644 --- a/build/android/bytecode/java/org/chromium/bytecode/AssertionEnablerClassAdapter.java +++ b/build/android/bytecode/java/org/chromium/bytecode/AssertionEnablerClassAdapter.java
@@ -55,11 +55,11 @@ @Override public MethodVisitor visitMethod(final int access, final String name, String desc, String signature, String[] exceptions) { - return new RewriteAssertMethodVisitorWriter( + return new RewriteAssertMethodVisitor( Opcodes.ASM5, super.visitMethod(access, name, desc, signature, exceptions)); } - static class RewriteAssertMethodVisitorWriter extends MethodVisitor { + static class RewriteAssertMethodVisitor extends MethodVisitor { static final String ASSERTION_DISABLED_NAME = "$assertionsDisabled"; static final String INSERT_INSTRUCTION_NAME = "assertFailureHandler"; static final String INSERT_INSTRUCTION_DESC = @@ -69,7 +69,7 @@ boolean mStartLoadingAssert; Label mGotoLabel; - public RewriteAssertMethodVisitorWriter(int api, MethodVisitor mv) { + public RewriteAssertMethodVisitor(int api, MethodVisitor mv) { super(api, mv); }
diff --git a/build/android/bytecode/java/org/chromium/bytecode/CustomResourcesClassAdapter.java b/build/android/bytecode/java/org/chromium/bytecode/CustomResourcesClassAdapter.java index 2a7b846..29e8013 100644 --- a/build/android/bytecode/java/org/chromium/bytecode/CustomResourcesClassAdapter.java +++ b/build/android/bytecode/java/org/chromium/bytecode/CustomResourcesClassAdapter.java
@@ -16,6 +16,7 @@ import static org.objectweb.asm.Opcodes.ILOAD; import static org.objectweb.asm.Opcodes.INVOKESPECIAL; import static org.objectweb.asm.Opcodes.INVOKESTATIC; +import static org.objectweb.asm.Opcodes.INVOKEVIRTUAL; import static org.objectweb.asm.Opcodes.RETURN; import static org.chromium.bytecode.TypeUtils.ASSET_MANAGER; @@ -28,6 +29,7 @@ import static org.chromium.bytecode.TypeUtils.DISPLAY_LEAK_ACTIVITY; import static org.chromium.bytecode.TypeUtils.INT; import static org.chromium.bytecode.TypeUtils.RESOURCES; +import static org.chromium.bytecode.TypeUtils.STRING; import static org.chromium.bytecode.TypeUtils.THEME; import static org.chromium.bytecode.TypeUtils.VOID; @@ -59,6 +61,9 @@ class CustomResourcesClassAdapter extends ClassVisitor { private static final String IS_ENABLED_METHOD = "isEnabled"; private static final String IS_ENABLED_DESCRIPTOR = TypeUtils.getMethodDescriptor(BOOLEAN); + // Cached since this is used so often. + private static final String GET_IDENTIFIER_DESCRIPTOR = + TypeUtils.getMethodDescriptor(INT, STRING, STRING, STRING); // Existing methods are more difficult to handle, and not currently needed. private static final List<String> PROHIBITED_METHODS = Arrays.asList( @@ -102,7 +107,8 @@ + "#" + methodSignature); } } - return super.visitMethod(access, name, desc, signature, exceptions); + return new RewriteGetIdentifierMethodVisitor( + super.visitMethod(access, name, desc, signature, exceptions)); } @Override @@ -160,6 +166,31 @@ } /** + * Remaps Resources.getIdentifier() method calls to use BuildHooksAndroid. + * + * resourceObj.getIdentifier(String, String, String) becomes: + * BuildHooksAndroid.getIdentifier(resourceObj, String, String, String); + */ + private static final class RewriteGetIdentifierMethodVisitor extends MethodVisitor { + RewriteGetIdentifierMethodVisitor(MethodVisitor mv) { + super(ASM5, mv); + } + + @Override + public void visitMethodInsn( + int opcode, String owner, String name, String desc, boolean itf) { + String methodName = "getIdentifier"; + if (opcode == INVOKEVIRTUAL && owner.equals(RESOURCES) && name.equals(methodName) + && desc.equals(GET_IDENTIFIER_DESCRIPTOR)) { + super.visitMethodInsn(INVOKESTATIC, BUILD_HOOKS_ANDROID, methodName, + TypeUtils.getMethodDescriptor(INT, RESOURCES, STRING, STRING, STRING), itf); + } else { + super.visitMethodInsn(opcode, owner, name, desc, itf); + } + } + } + + /** * Generates: * * <pre>
diff --git a/build/android/bytecode/java/org/chromium/bytecode/TypeUtils.java b/build/android/bytecode/java/org/chromium/bytecode/TypeUtils.java index 1ae24c7d..e297b11 100644 --- a/build/android/bytecode/java/org/chromium/bytecode/TypeUtils.java +++ b/build/android/bytecode/java/org/chromium/bytecode/TypeUtils.java
@@ -31,12 +31,13 @@ static final String DISPLAY_LEAK_ACTIVITY = "com/squareup/leakcanary/internal/DisplayLeakActivity"; static final String RESOURCES = "android/content/res/Resources"; + static final String STRING = "java/lang/String"; static final String THEME = "android/content/res/Resources$Theme"; + static final String BOOLEAN = "Z"; static final String INT = "I"; static final String VOID = "V"; private static final Map<String, Type> PRIMITIVE_DESCRIPTORS; - static { PRIMITIVE_DESCRIPTORS = new HashMap<>(); PRIMITIVE_DESCRIPTORS.put(Type.BOOLEAN_TYPE.toString(), Type.BOOLEAN_TYPE);
diff --git a/build/android/gyp/javac.py b/build/android/gyp/javac.py index 5727ae9..c29e2f2 100755 --- a/build/android/gyp/javac.py +++ b/build/android/gyp/javac.py
@@ -209,8 +209,12 @@ # Add the extracted files to the classpath. This is required because # when compiling only a subset of files, classes that haven't changed # need to be findable. - classpath_idx = javac_cmd.index('-classpath') - javac_cmd[classpath_idx + 1] += ':' + classes_dir + try: + classpath_idx = javac_cmd.index('-classpath') + javac_cmd[classpath_idx + 1] += ':' + classes_dir + except ValueError: + # If there is no class path in the command line then add the arg + javac_cmd.extend(["-classpath", classes_dir]) # Can happen when a target goes from having no sources, to having sources. # It's created by the call to build_utils.Touch() below.
diff --git a/build/android/gyp/process_resources.py b/build/android/gyp/process_resources.py index e0b642e3..31a87de 100755 --- a/build/android/gyp/process_resources.py +++ b/build/android/gyp/process_resources.py
@@ -19,9 +19,8 @@ import shutil import subprocess import sys +import xml.etree.ElementTree import zipfile -from xml.etree import ElementTree - import generate_v14_compatible_resources @@ -466,7 +465,7 @@ shutil.copyfile(path, hk_path) def _ExtractPackageFromManifest(manifest_path): - doc = ElementTree.parse(manifest_path) + doc = xml.etree.ElementTree.parse(manifest_path) return doc.getroot().get('package') @@ -554,62 +553,45 @@ 'config (trigger=%s)') % (name, trigger.pattern)) -def _CreateLinkApkArgs(options): - link_command = [ - options.aapt_path + '2', - 'link', +def _CreatePackageApkArgs(options): + package_command = [ '--version-code', options.version_code, '--version-name', options.version_name, - '--auto-add-overlay', - '--no-version-vectors', - '-I', options.android_sdk_jar, - '-o', options.apk_path, + '-f', + '-F', options.apk_path, ] if options.proguard_file: - link_command += ['--proguard', options.proguard_file] + package_command += ['-G', options.proguard_file] if options.proguard_file_main_dex: - link_command += ['--proguard-main-dex', options.proguard_file_main_dex] + package_command += ['-D', options.proguard_file_main_dex] if options.no_compress: for ext in options.no_compress.split(','): - link_command += ['-0', ext] + package_command += ['-0', ext] if options.shared_resources: - link_command.append('--shared-lib') + package_command.append('--shared-lib') + if options.app_as_shared_lib: + package_command.append('--app-as-shared-lib') if options.create_density_splits: for config in _DENSITY_SPLITS.itervalues(): - link_command.extend(('--split', ','.join(config))) + package_command.extend(('--split', ','.join(config))) if options.language_splits: for lang in options.language_splits: - link_command.extend(('--split', lang)) + package_command.extend(('--split', lang)) + + if options.debuggable: + package_command += ['--debug-mode'] if options.locale_whitelist: aapt_locales = _ToAaptLocales( options.locale_whitelist, options.support_zh_hk) - link_command += ['-c', ','.join(aapt_locales)] + package_command += ['-c', ','.join(aapt_locales)] - return link_command - - -def _EnableDebugInManifest(manifest_path, temp_dir): - debug_manifest_path = os.path.join(temp_dir, 'AndroidManifest.xml') - _ANDROID_NAMESPACE = 'http://schemas.android.com/apk/res/android' - _TOOLS_NAMESPACE = 'http://schemas.android.com/tools' - ElementTree.register_namespace('android', _ANDROID_NAMESPACE) - ElementTree.register_namespace('tools', _TOOLS_NAMESPACE) - original_manifest = ElementTree.parse(manifest_path) - - app_node = original_manifest.find('application') - app_node.set('{%s}%s' % (_ANDROID_NAMESPACE, 'debuggable'), 'true') - - with open(debug_manifest_path, 'w') as debug_manifest: - debug_manifest.write(ElementTree.tostring( - original_manifest.getroot(), encoding='UTF-8')) - - return debug_manifest_path + return package_command def _ResourceNameFromPath(path): @@ -654,32 +636,11 @@ pool.join() -def _CompileDeps(aapt_path, dep_subdirs, temp_dir): - partials_dir = os.path.join(temp_dir, 'partials') - build_utils.MakeDirectory(partials_dir) - partial_compile_command = [ - aapt_path + '2', - 'compile', - '--no-crunch', - ] - pool = multiprocessing.pool.ThreadPool(10) - def compile_partial(directory): - dirname = os.path.basename(directory) - partial_path = os.path.join(partials_dir, dirname + '.zip') - compile_command = (partial_compile_command + - ['--dir', directory, '-o', partial_path]) - build_utils.CheckOutput(compile_command) - return partial_path - - partials = pool.map(compile_partial, dep_subdirs) - pool.close() - pool.join() - return partials - - -def _PackageApk(options, dep_subdirs, temp_dir, gen_dir, r_txt_path): +def _PackageApk(options, package_command, dep_subdirs): _DuplicateZhResources(dep_subdirs) + package_command += _CreatePackageApkArgs(options) + keep_predicate = _CreateKeepPredicate( dep_subdirs, options.exclude_xxxhdpi, options.xxxhdpi_whitelist) png_paths = [] @@ -694,26 +655,10 @@ for directory in dep_subdirs: _MoveImagesToNonMdpiFolders(directory) - link_command = _CreateLinkApkArgs(options) - link_command += ['--output-text-symbols', r_txt_path] - link_command += ['--java', gen_dir] - - if options.debuggable: - debug_manifest = _EnableDebugInManifest(options.android_manifest, temp_dir) - link_command += ['--manifest', debug_manifest] - else: - link_command += ['--manifest', options.android_manifest] - - partials = _CompileDeps(options.aapt_path, dep_subdirs, temp_dir) - # It only works if partials are reversed (resource clobbering). This could be - # due to aapt2 processes the partials in reversed order (compared to aapt) - for partial in reversed(partials): - link_command += ['-R', partial] - # Creates a .zip with AndroidManifest.xml, resources.arsc, res/* # Also creates R.txt build_utils.CheckOutput( - link_command, print_stdout=False, print_stderr=False) + package_command, print_stdout=False, print_stderr=False) if options.create_density_splits or options.language_splits: _CheckForMissedConfigs(options.apk_path, options.create_density_splits, @@ -723,44 +668,15 @@ _RenameDensitySplits(options.apk_path) -# _PackageLibrary uses aapt rather than aapt2 because aapt2 compile does not -# support outputting an R.txt file. -def _PackageLibrary(options, dep_subdirs, temp_dir, gen_dir): +def _PackageLibrary(options, package_command, temp_dir): v14_dir = os.path.join(temp_dir, 'v14') build_utils.MakeDirectory(v14_dir) - # Generate R.java. This R.java contains non-final constants and is used only - # while compiling the library jar (e.g. chromium_content.jar). When building - # an apk, a new R.java file with the correct resource -> ID mappings will be - # generated by merging the resources from all libraries and the main apk - # project. - package_command = [options.aapt_path, - 'package', - '-m', - '-M', options.android_manifest, - '--no-crunch', - '--auto-add-overlay', - '--no-version-vectors', - '-I', options.android_sdk_jar, - '--output-text-symbols', gen_dir, - '-J', gen_dir, # Required for R.txt generation. - '--ignore-assets', build_utils.AAPT_IGNORE_PATTERN] - - # Adding all dependencies as sources is necessary for @type/foo references - # to symbols within dependencies to resolve. However, it has the side-effect - # that all Java symbols from dependencies are copied into the new R.java. - # E.g.: It enables an arguably incorrect usage of - # "mypackage.R.id.lib_symbol" where "libpackage.R.id.lib_symbol" would be - # more correct. This is just how Android works. - for d in dep_subdirs: - package_command += ['-S', d] - input_resource_dirs = options.resource_dirs for d in input_resource_dirs: package_command += ['-S', d] - #TODO(mheikal): use aapt2 to do this instead, which can do this on its own. if not options.v14_skip: for resource_dir in input_resource_dirs: generate_v14_compatible_resources.GenerateV14Resources( @@ -848,10 +764,36 @@ dep_subdirs = _ExtractDeps(options.dependencies_res_zips, deps_dir) + # Generate R.java. This R.java contains non-final constants and is used only + # while compiling the library jar (e.g. chromium_content.jar). When building + # an apk, a new R.java file with the correct resource -> ID mappings will be + # generated by merging the resources from all libraries and the main apk + # project. + package_command = [options.aapt_path, + 'package', + '-m', + '-M', options.android_manifest, + '--no-crunch', + '--auto-add-overlay', + '--no-version-vectors', + '-I', options.android_sdk_jar, + '--output-text-symbols', gen_dir, + '-J', gen_dir, # Required for R.txt generation. + '--ignore-assets', build_utils.AAPT_IGNORE_PATTERN] + + # Adding all dependencies as sources is necessary for @type/foo references + # to symbols within dependencies to resolve. However, it has the side-effect + # that all Java symbols from dependencies are copied into the new R.java. + # E.g.: It enables an arguably incorrect usage of + # "mypackage.R.id.lib_symbol" where "libpackage.R.id.lib_symbol" would be + # more correct. This is just how Android works. + for d in dep_subdirs: + package_command += ['-S', d] + if options.apk_path: - _PackageApk(options, dep_subdirs, temp_dir, gen_dir, r_txt_path) + _PackageApk(options, package_command, dep_subdirs) else: - _PackageLibrary(options, dep_subdirs, temp_dir, gen_dir) + _PackageLibrary(options, package_command, temp_dir) _CreateRTxtAndSrcJar(options, r_txt_path, srcjar_dir) @@ -890,13 +832,12 @@ options.v14_skip, options.exclude_xxxhdpi, options.xxxhdpi_whitelist, - str(options.debuggable), str(options.png_to_webp), str(options.support_zh_hk), ] if options.apk_path: - input_strings.extend(_CreateLinkApkArgs(options)) + input_strings.extend(_CreatePackageApkArgs(options)) input_paths = [ options.aapt_path,
diff --git a/build/android/pylib/instrumentation/instrumentation_test_instance.py b/build/android/pylib/instrumentation/instrumentation_test_instance.py index ddc80f7..5f7c196 100644 --- a/build/android/pylib/instrumentation/instrumentation_test_instance.py +++ b/build/android/pylib/instrumentation/instrumentation_test_instance.py
@@ -568,10 +568,10 @@ self._test_package = self._test_apk.GetPackageName() all_instrumentations = self._test_apk.GetAllInstrumentations() all_junit3_runner_classes = [ - x for x in all_instrumentations if ('0xffffffff' not in x.get( + x for x in all_instrumentations if ('true' not in x.get( 'chromium-junit4', ''))] all_junit4_test_runner_classes = [ - x for x in all_instrumentations if ('0xffffffff' in x.get( + x for x in all_instrumentations if ('true' in x.get( 'chromium-junit4', ''))] if len(all_junit3_runner_classes) > 1:
diff --git a/build/android/test_runner.py b/build/android/test_runner.py index 3d0350fc3..2d34b30c 100755 --- a/build/android/test_runner.py +++ b/build/android/test_runner.py
@@ -362,7 +362,10 @@ help='googletest-style filter string.', default=os.environ.get('GTEST_FILTER')) filter_group.add_argument( + # Deprecated argument. '--gtest-filter-file', + # New argument. + '--test-launcher-filter-file', dest='test_filter_file', type=os.path.realpath, help='Path to file that contains googletest-style filter strings. ' 'See also //testing/buildbot/filters/README.md.')
diff --git a/build/args/fuchsia.gn b/build/args/fuchsia.gn index d3b8314..ba10b88 100644 --- a/build/args/fuchsia.gn +++ b/build/args/fuchsia.gn
@@ -2,7 +2,6 @@ target_os = "fuchsia" enable_basic_printing = false -enable_webrtc = false headless_fontconfig_utils = false toolkit_views = false enable_plugins = false
diff --git a/build/args/headless.gn b/build/args/headless.gn index 82d30e4..ae5e043 100644 --- a/build/args/headless.gn +++ b/build/args/headless.gn
@@ -35,7 +35,6 @@ use_alsa = false use_cups = false use_dbus = false -use_gconf = false use_gio = false use_kerberos = false use_libpci = false
diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn index 78038b04..b8d515426 100644 --- a/build/config/BUILDCONFIG.gn +++ b/build/config/BUILDCONFIG.gn
@@ -242,9 +242,10 @@ _default_toolchain = host_toolchain } else if (target_os == "win") { # On Windows we use the same toolchain for host and target by default. - # Beware, win cross builds mostly don't work yet, see docs/win_cross.md - # TODO(thakis): Allow on Mac as well soon. - assert(host_os != "mac", "https://crbug.com/774209") + # Beware, win cross builds have some caveats, see docs/win_cross.md + # TODO(thakis): See if we want to make 32-bit builds on mac hosts work. + assert(host_os != "mac" || target_cpu == "x64", + "Mac hosts can only build 64-bit chrome/win, https://crbug.com/794838") if (is_clang) { _default_toolchain = "//build/toolchain/win:win_clang_$target_cpu" } else {
diff --git a/build/config/android/BUILD.gn b/build/config/android/BUILD.gn index d575b84..e92818c 100644 --- a/build/config/android/BUILD.gn +++ b/build/config/android/BUILD.gn
@@ -211,7 +211,11 @@ config("cygprofile_instrumentation") { defines = [ "CYGPROFILE_INSTRUMENTATION=1" ] - cflags = [ "-finstrument-functions-after-inlining" ] + if (use_lightweight_order_profiling) { + cflags = [ "-finstrument-function-entry-bare" ] + } else { + cflags = [ "-finstrument-functions-after-inlining" ] + } } config("no_cygprofile_instrumentation") {
diff --git a/build/config/features.gni b/build/config/features.gni index d014d0e1..09cddfd 100644 --- a/build/config/features.gni +++ b/build/config/features.gni
@@ -50,11 +50,6 @@ use_dbus = is_linux && !is_chromecast - # Option controlling the use of GConf (the classic GNOME configuration - # system). - use_gconf = is_linux && !is_chromeos && !is_chromecast && - current_toolchain == default_toolchain - use_gio = is_linux && !is_chromeos && !is_chromecast } #
diff --git a/build/config/linux/atk/BUILD.gn b/build/config/linux/atk/BUILD.gn index 63a7222..16a3f8c 100644 --- a/build/config/linux/atk/BUILD.gn +++ b/build/config/linux/atk/BUILD.gn
@@ -7,12 +7,10 @@ import("//build/config/linux/pkg_config.gni") import("//build/config/ui.gni") -# CrOS doesn't install GTK, gconf or any gnome packages. +# CrOS doesn't install GTK or any gnome packages. assert(!is_chromeos) # These packages should _only_ be expected when building for a target. -# If these extra checks are not run, gconf is required when building host -# tools for a CrOS build. assert(current_toolchain == default_toolchain) if (use_atk) {
diff --git a/build/config/linux/gconf/BUILD.gn b/build/config/linux/gconf/BUILD.gn deleted file mode 100644 index 262e96a..0000000 --- a/build/config/linux/gconf/BUILD.gn +++ /dev/null
@@ -1,19 +0,0 @@ -# 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. - -import("//build/config/features.gni") -import("//build/config/linux/pkg_config.gni") - -# CrOS doesn't install GTK, gconf or any gnome packages. -assert(!is_chromeos && use_gconf) - -# These packages should _only_ be expected when building for a target. -# If these extra checks are not run, gconf is required when building host -# tools for a CrOS build. -assert(current_toolchain == default_toolchain) - -pkg_config("gconf") { - packages = [ "gconf-2.0" ] - defines = [ "USE_GCONF" ] -}
diff --git a/cc/paint/paint_op_buffer_fuzzer.cc b/cc/paint/paint_op_buffer_fuzzer.cc index bdd583d..4b1caa8 100644 --- a/cc/paint/paint_op_buffer_fuzzer.cc +++ b/cc/paint/paint_op_buffer_fuzzer.cc
@@ -21,6 +21,7 @@ kRasterDimension, kRasterDimension, kOpaque_SkAlphaType); scoped_refptr<cc::TestContextProvider> context_provider = cc::TestContextProvider::Create(); + context_provider->BindToCurrentThread(); sk_sp<SkSurface> surface = SkSurface::MakeRenderTarget( context_provider->GrContext(), SkBudgeted::kYes, image_info); SkCanvas* canvas = surface->getCanvas();
diff --git a/cc/paint/paint_op_reader.cc b/cc/paint/paint_op_reader.cc index 9acc86da..9ae2b1c 100644 --- a/cc/paint/paint_op_reader.cc +++ b/cc/paint/paint_op_reader.cc
@@ -268,8 +268,10 @@ TransferCacheDeserializeHelper* transfer_cache) { sk_sp<SkData> data; Read(&data); - if (!data || !valid_) + if (!data || !valid_) { + SetInvalid(); return; + } // Skia expects the following to be true, make sure we don't pass it incorrect // data.
diff --git a/cc/paint/transfer_cache_serialize_helper.cc b/cc/paint/transfer_cache_serialize_helper.cc index ae579ab..8c941bf 100644 --- a/cc/paint/transfer_cache_serialize_helper.cc +++ b/cc/paint/transfer_cache_serialize_helper.cc
@@ -35,7 +35,8 @@ } void TransferCacheSerializeHelper::FlushEntries() { - FlushEntriesInternal(added_entries_); + FlushEntriesInternal( + std::vector<EntryKey>(added_entries_.begin(), added_entries_.end())); added_entries_.clear(); }
diff --git a/cc/paint/transfer_cache_serialize_helper.h b/cc/paint/transfer_cache_serialize_helper.h index f1266783..e1dd58d 100644 --- a/cc/paint/transfer_cache_serialize_helper.h +++ b/cc/paint/transfer_cache_serialize_helper.h
@@ -6,6 +6,7 @@ #define CC_PAINT_TRANSFER_CACHE_SERIALIZE_HELPER_H_ #include <set> +#include <vector> #include "cc/paint/paint_export.h" #include "cc/paint/transfer_cache_entry.h" @@ -27,7 +28,7 @@ using EntryKey = std::pair<TransferCacheEntryType, uint32_t>; virtual bool LockEntryInternal(TransferCacheEntryType type, uint32_t id) = 0; virtual void CreateEntryInternal(const ClientTransferCacheEntry& entry) = 0; - virtual void FlushEntriesInternal(const std::set<EntryKey>& entries) = 0; + virtual void FlushEntriesInternal(const std::vector<EntryKey>& entries) = 0; std::set<EntryKey> added_entries_; };
diff --git a/cc/paint/transfer_cache_unittest.cc b/cc/paint/transfer_cache_unittest.cc index 3ab11e9f..5ba4fd2 100644 --- a/cc/paint/transfer_cache_unittest.cc +++ b/cc/paint/transfer_cache_unittest.cc
@@ -103,7 +103,7 @@ EXPECT_NE(nullptr, service_cache->GetEntry(entry.Type(), entry.Id())); // Unlock on client side and flush to service. - context_support->UnlockTransferCacheEntry(entry.Type(), entry.Id()); + context_support->UnlockTransferCacheEntries({{entry.Type(), entry.Id()}}); gl->Finish(); // Re-lock on client side and validate state. No need to flush as lock is @@ -131,7 +131,7 @@ EXPECT_NE(nullptr, service_cache->GetEntry(entry.Type(), entry.Id())); // Unlock on client side and flush to service. - context_support->UnlockTransferCacheEntry(entry.Type(), entry.Id()); + context_support->UnlockTransferCacheEntries({{entry.Type(), entry.Id()}}); gl->Finish(); // Evict on the service side.
diff --git a/cc/test/test_context_support.cc b/cc/test/test_context_support.cc index 1bcf7fa..3c80d99 100644 --- a/cc/test/test_context_support.cc +++ b/cc/test/test_context_support.cc
@@ -107,6 +107,11 @@ } void TestContextSupport::CompleteLockDiscardableTexureOnContextThread( uint32_t texture_id) {} +bool TestContextSupport::ThreadsafeDiscardableTextureIsDeletedForTracing( + uint32_t texture_id) { + NOTIMPLEMENTED(); + return false; +} void TestContextSupport::CreateTransferCacheEntry( const ClientTransferCacheEntry& entry) { @@ -118,9 +123,8 @@ NOTIMPLEMENTED(); return false; } -void TestContextSupport::UnlockTransferCacheEntry( - TransferCacheEntryType entry_type, - uint32_t entry_id) { +void TestContextSupport::UnlockTransferCacheEntries( + const std::vector<std::pair<TransferCacheEntryType, uint32_t>>& entries) { NOTIMPLEMENTED(); } void TestContextSupport::DeleteTransferCacheEntry(
diff --git a/cc/test/test_context_support.h b/cc/test/test_context_support.h index 43623c1..34e74df 100644 --- a/cc/test/test_context_support.h +++ b/cc/test/test_context_support.h
@@ -53,11 +53,14 @@ bool ThreadSafeShallowLockDiscardableTexture(uint32_t texture_id) override; void CompleteLockDiscardableTexureOnContextThread( uint32_t texture_id) override; + bool ThreadsafeDiscardableTextureIsDeletedForTracing( + uint32_t texture_id) override; void CreateTransferCacheEntry(const ClientTransferCacheEntry& entry) override; bool ThreadsafeLockTransferCacheEntry(TransferCacheEntryType entry_type, uint32_t entry_id) override; - void UnlockTransferCacheEntry(TransferCacheEntryType entry_type, - uint32_t entry_id) override; + void UnlockTransferCacheEntries( + const std::vector<std::pair<TransferCacheEntryType, uint32_t>>& entries) + override; void DeleteTransferCacheEntry(TransferCacheEntryType entry_type, uint32_t entry_id) override;
diff --git a/cc/test/transfer_cache_test_helper.cc b/cc/test/transfer_cache_test_helper.cc index 582b3ced7..9fb7994f 100644 --- a/cc/test/transfer_cache_test_helper.cc +++ b/cc/test/transfer_cache_test_helper.cc
@@ -57,7 +57,7 @@ } void TransferCacheTestHelper::FlushEntriesInternal( - const std::set<EntryKey>& entries) { + const std::vector<EntryKey>& entries) { for (auto& entry : entries) locked_entries_.erase(entry); }
diff --git a/cc/test/transfer_cache_test_helper.h b/cc/test/transfer_cache_test_helper.h index b73fbaeb..150b356 100644 --- a/cc/test/transfer_cache_test_helper.h +++ b/cc/test/transfer_cache_test_helper.h
@@ -6,7 +6,7 @@ #define CC_TEST_TRANSFER_CACHE_TEST_HELPER_H_ #include <map> -#include <set> +#include <vector> #include "cc/paint/transfer_cache_deserialize_helper.h" #include "cc/paint/transfer_cache_serialize_helper.h" @@ -31,7 +31,7 @@ // Serialization helpers. bool LockEntryInternal(TransferCacheEntryType type, uint32_t id) override; void CreateEntryInternal(const ClientTransferCacheEntry& entry) override; - void FlushEntriesInternal(const std::set<EntryKey>& entries) override; + void FlushEntriesInternal(const std::vector<EntryKey>& entries) override; std::map<EntryKey, std::unique_ptr<ServiceTransferCacheEntry>> entries_; std::set<EntryKey> locked_entries_;
diff --git a/cc/tiles/checker_image_tracker.cc b/cc/tiles/checker_image_tracker.cc index 0ca306265..012cbb65 100644 --- a/cc/tiles/checker_image_tracker.cc +++ b/cc/tiles/checker_image_tracker.cc
@@ -162,11 +162,6 @@ ImageDecodeQueue image_decode_queue) { TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug"), "CheckerImageTracker::ScheduleImageDecodeQueue"); - // Only checker-imaged (async updated) images are decoded using the image - // decode service. If |enable_checker_imaging_| is false, no image should - // be checkered. - DCHECK(image_decode_queue.empty() || enable_checker_imaging_); - #if DCHECK_IS_ON() // The decodes in the queue should be prioritized correctly. DecodeType type = DecodeType::kRaster; @@ -282,8 +277,20 @@ TRACE_EVENT1("cc", "CheckerImageTracker::ShouldCheckerImage", "image_id", image_id); - if (!enable_checker_imaging_) + auto decoding_mode_it = decoding_mode_map_.find(image_id); + PaintImage::DecodingMode decoding_mode_hint = + decoding_mode_it == decoding_mode_map_.end() + ? PaintImage::DecodingMode::kUnspecified + : decoding_mode_it->second; + + // If we don't have default checker imaging enabled, and the developer did not + // specify "async" then we don't checker the images. To put it different, we + // currently only not respect |enable_checker_imaging_| if the value was + // specified as "async" by the developer. + if (decoding_mode_hint != PaintImage::DecodingMode::kAsync && + !enable_checker_imaging_) { return false; + } // If the image was invalidated on the current sync tree and the tile is // for the active tree, continue checkering it on the active tree to ensure @@ -305,11 +312,6 @@ auto it = insert_result.first; if (insert_result.second) { CheckerImagingDecision decision = CheckerImagingDecision::kCanChecker; - auto decoding_mode_it = decoding_mode_map_.find(image_id); - PaintImage::DecodingMode decoding_mode_hint = - decoding_mode_it == decoding_mode_map_.end() - ? PaintImage::DecodingMode::kUnspecified - : decoding_mode_it->second; // If the mode is sync, then don't checker this image. // TODO(vmpstr): Figure out if we should do something different in other // cases.
diff --git a/cc/tiles/gpu_image_decode_cache.cc b/cc/tiles/gpu_image_decode_cache.cc index fdfb369..85c647e 100644 --- a/cc/tiles/gpu_image_decode_cache.cc +++ b/cc/tiles/gpu_image_decode_cache.cc
@@ -833,16 +833,25 @@ // CPU wrapper), upload it here. if (image_data->upload.image() && image_data->mode == DecodedDataMode::GPU) { + size_t discardable_size = image_data->size; + // If the discardable system has deleted this out from under us, log a + // size of 0 to match software discardable. + if (context_->ContextSupport() + ->ThreadsafeDiscardableTextureIsDeletedForTracing( + image_data->upload.gl_id())) { + discardable_size = 0; + } + std::string gpu_dump_name = base::StringPrintf( "cc/image_memory/cache_0x%" PRIXPTR "/gpu/image_%d", reinterpret_cast<uintptr_t>(this), image_id); MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(gpu_dump_name); dump->AddScalar(MemoryAllocatorDump::kNameSize, - MemoryAllocatorDump::kUnitsBytes, image_data->size); + MemoryAllocatorDump::kUnitsBytes, discardable_size); // Dump the "locked_size" as an additional column. size_t locked_size = - image_data->upload.is_locked() ? image_data->size : 0u; + image_data->upload.is_locked() ? discardable_size : 0u; dump->AddScalar("locked_size", MemoryAllocatorDump::kUnitsBytes, locked_size);
diff --git a/cc/tiles/tile_manager.cc b/cc/tiles/tile_manager.cc index 1484864..4969e4ab 100644 --- a/cc/tiles/tile_manager.cc +++ b/cc/tiles/tile_manager.cc
@@ -93,7 +93,7 @@ std::unique_ptr<RasterBuffer> raster_buffer, TileTask::Vector* dependencies, bool is_gpu_rasterization, - base::Optional<PlaybackImageProvider> image_provider) + PlaybackImageProvider image_provider) : TileTask(!is_gpu_rasterization, dependencies), tile_manager_(tile_manager), tile_id_(tile->id()), @@ -113,9 +113,7 @@ raster_buffer_(std::move(raster_buffer)), image_provider_(std::move(image_provider)) { DCHECK(origin_thread_checker_.CalledOnValidThread()); - - if (image_provider_.has_value()) - playback_settings_.image_provider = &image_provider_.value(); + playback_settings_.image_provider = &image_provider_; } // Overridden from Task: @@ -180,7 +178,7 @@ int source_frame_number_; bool is_gpu_rasterization_; std::unique_ptr<RasterBuffer> raster_buffer_; - base::Optional<PlaybackImageProvider> image_provider_; + PlaybackImageProvider image_provider_; DISALLOW_COPY_AND_ASSIGN(RasterTaskImpl); }; @@ -1216,24 +1214,18 @@ raster_buffer_provider_->AcquireBufferForRaster( resource, resource_content_id, tile->invalidated_id()); - base::Optional<PlaybackImageProvider> image_provider; - const bool has_sync_decoded_images = !sync_decoded_images.empty(); - const bool has_at_raster_images = !at_raster_images.empty(); - if (skip_images || has_checker_images || has_sync_decoded_images || - has_at_raster_images) { - base::Optional<PlaybackImageProvider::Settings> settings; - if (!skip_images) { - settings.emplace(); - settings->images_to_skip = std::move(images_to_skip); - settings->at_raster_images = std::move(at_raster_images); - settings->image_to_current_frame_index = - std::move(image_id_to_current_frame_index); - } - - image_provider.emplace(image_controller_.cache(), color_space, - std::move(settings)); + base::Optional<PlaybackImageProvider::Settings> settings; + if (!skip_images) { + settings.emplace(); + settings->images_to_skip = std::move(images_to_skip); + settings->at_raster_images = std::move(at_raster_images); + settings->image_to_current_frame_index = + std::move(image_id_to_current_frame_index); } + PlaybackImageProvider image_provider(image_controller_.cache(), color_space, + std::move(settings)); + return base::MakeRefCounted<RasterTaskImpl>( this, tile, resource, prioritized_tile.raster_source(), playback_settings, prioritized_tile.priority().resolution, invalidated_rect,
diff --git a/chrome/VERSION b/chrome/VERSION index 85dee8c..adb50f6 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=65 MINOR=0 -BUILD=3295 +BUILD=3296 PATCH=0
diff --git a/chrome/android/java/res/layout/data_reduction_main_menu_item.xml b/chrome/android/java/res/layout/data_reduction_main_menu_item.xml index a298cef..fe546c2 100644 --- a/chrome/android/java/res/layout/data_reduction_main_menu_item.xml +++ b/chrome/android/java/res/layout/data_reduction_main_menu_item.xml
@@ -25,7 +25,7 @@ <ImageView android:id="@+id/chart_icon" - android:src="@drawable/data_reduction_main_menu_icon" + android:src="@+drawable/data_reduction_main_menu_icon" android:layout_width="@dimen/data_reduction_main_menu_icon_width" android:layout_height="match_parent" android:layout_gravity="start|center_vertical"
diff --git a/chrome/android/java/res/layout/distilled_page_prefs_view.xml b/chrome/android/java/res/layout/distilled_page_prefs_view.xml index f0a73c38..d39922c8 100644 --- a/chrome/android/java/res/layout/distilled_page_prefs_view.xml +++ b/chrome/android/java/res/layout/distilled_page_prefs_view.xml
@@ -52,7 +52,7 @@ <TextView android:id="@+id/font_size_percentage" android:layout_width="wrap_content" - android:layout_height="match_parent" + android:layout_height="wrap_content" android:layout_marginEnd="3dp" android:layout_marginStart="3dp" android:minWidth="50dp" @@ -61,7 +61,7 @@ <TextView android:layout_width="wrap_content" - android:layout_height="match_parent" + android:layout_height="wrap_content" android:gravity="center_vertical" android:layout_marginStart="5dp" android:textSize="13sp" @@ -71,13 +71,14 @@ android:id="@+id/font_size" android:layout_width="0dp" android:layout_height="wrap_content" + android:layout_gravity="center" android:layout_weight="1" android:orientation="horizontal" android:max="30" /> <TextView android:layout_width="wrap_content" - android:layout_height="match_parent" + android:layout_height="wrap_content" android:gravity="center_vertical" android:layout_marginEnd="3dp" android:textSize="20sp"
diff --git a/chrome/android/java/res/layout/list_menu_item.xml b/chrome/android/java/res/layout/list_menu_item.xml index bc597d2..071eb0d 100644 --- a/chrome/android/java/res/layout/list_menu_item.xml +++ b/chrome/android/java/res/layout/list_menu_item.xml
@@ -6,8 +6,7 @@ <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="?android:attr/listPreferredItemHeightSmall" - android:paddingStart="?android:attr/listPreferredItemPaddingStart" - android:paddingEnd="?android:attr/listPreferredItemPaddingEnd" android:textColor="@color/dark_mode_tint" android:gravity="center_vertical" - android:textSize="16sp" /> + android:textSize="16sp" + style="@style/ListMenuItemStyle" />
diff --git a/chrome/android/java/res/layout/password_entry_editor_copyable_row.xml b/chrome/android/java/res/layout/password_entry_editor_copyable_row.xml index cb7b3170..0e48a80f 100644 --- a/chrome/android/java/res/layout/password_entry_editor_copyable_row.xml +++ b/chrome/android/java/res/layout/password_entry_editor_copyable_row.xml
@@ -27,7 +27,6 @@ android:layout_gravity="end" android:layout_marginTop="15dp" android:layout_marginEnd="15dp" - app:srcCompat="@drawable/ic_content_copy_black" app:chrometint="@color/black_alpha_54" android:contentDescription="@string/password_entry_editor_copy_stored_username" style="?android:attr/buttonStyleSmall" />
diff --git a/chrome/android/java/res/layout/password_entry_editor_interactive.xml b/chrome/android/java/res/layout/password_entry_editor_interactive.xml index 36fc713..ad15665 100644 --- a/chrome/android/java/res/layout/password_entry_editor_interactive.xml +++ b/chrome/android/java/res/layout/password_entry_editor_interactive.xml
@@ -75,7 +75,6 @@ android:layout_gravity="end" android:layout_marginTop="15dp" android:layout_marginEnd="15dp" - app:srcCompat="@drawable/ic_content_copy_black" app:chrometint="@color/black_alpha_54" android:contentDescription="@string/password_entry_editor_copy_stored_password" style="?android:attr/buttonStyleSmall" />
diff --git a/chrome/android/java/res/values-v16/styles.xml b/chrome/android/java/res/values-v16/styles.xml new file mode 100644 index 0000000..30fcf39 --- /dev/null +++ b/chrome/android/java/res/values-v16/styles.xml
@@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright 2017 The Chromium Authors. All rights reserved. + Use of this source code is governed by a BSD-style license that can be + found in the LICENSE file. --> + +<resources> + <!-- ListMenuButton. listPreferredItemPaddingStart/End are not supported before API 17 + of Android. (https://crbug.com/792809) --> + <style name="ListMenuItemStyle"> + <item name="android:paddingLeft">?android:attr/listPreferredItemPaddingLeft</item> + <item name="android:paddingRight">?android:attr/listPreferredItemPaddingRight</item> + </style> +</resources>
diff --git a/chrome/android/java/res/values-v17/styles.xml b/chrome/android/java/res/values-v17/styles.xml index 16d2ab5..78901f8 100644 --- a/chrome/android/java/res/values-v17/styles.xml +++ b/chrome/android/java/res/values-v17/styles.xml
@@ -774,4 +774,10 @@ <item name="android:layout_width">match_parent</item> <item name="android:layout_height">wrap_content</item> </style> + + <!-- ListMenuButton --> + <style name="ListMenuItemStyle"> + <item name="android:paddingStart">?android:attr/listPreferredItemPaddingStart</item> + <item name="android:paddingEnd">?android:attr/listPreferredItemPaddingEnd</item> + </style> </resources>
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkPromoHeader.java b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkPromoHeader.java index 2a5c6d3..6cb27b6 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkPromoHeader.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkPromoHeader.java
@@ -19,7 +19,6 @@ import org.chromium.base.VisibleForTesting; import org.chromium.base.metrics.RecordUserAction; import org.chromium.chrome.R; -import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.signin.DisplayableProfileData; import org.chromium.chrome.browser.signin.PersonalizedSigninPromoView; import org.chromium.chrome.browser.signin.ProfileDataCache; @@ -93,8 +92,7 @@ SigninAccessPoint.BOOKMARK_MANAGER)) { int imageSize = mContext.getResources().getDimensionPixelSize(R.dimen.user_picture_size); - mProfileDataCache = - new ProfileDataCache(mContext, Profile.getLastUsedProfile(), imageSize); + mProfileDataCache = new ProfileDataCache(mContext, imageSize); mProfileDataCache.addObserver(this); mSigninPromoController = new SigninPromoController(SigninAccessPoint.BOOKMARK_MANAGER); AccountManagerFacade.get().addObserver(this);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadItemView.java b/chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadItemView.java index 15cfbd7..3d3f39d 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadItemView.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadItemView.java
@@ -7,6 +7,7 @@ import android.content.Context; import android.content.res.ColorStateList; import android.graphics.Bitmap; +import android.support.annotation.IntDef; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.graphics.drawable.RoundedBitmapDrawable; @@ -19,6 +20,7 @@ import android.widget.TextView; import org.chromium.base.ApiCompatibilityUtils; +import org.chromium.base.metrics.RecordHistogram; import org.chromium.chrome.R; import org.chromium.chrome.browser.download.DownloadUtils; import org.chromium.chrome.browser.util.FeatureUtilities; @@ -39,6 +41,20 @@ */ public class DownloadItemView extends SelectableItemView<DownloadHistoryItemWrapper> implements ThumbnailProvider.ThumbnailRequest, ListMenuButton.Delegate { + // Please treat this list as append only and keep it in sync with + // Android.DownloadManager.List.View.Actions in enums.xml. + @IntDef({VIEW_ACTION_OPEN, VIEW_ACTION_RESUME, VIEW_ACTION_PAUSE, VIEW_ACTION_CANCEL, + VIEW_ACTION_MENU_SHARE, VIEW_ACTION_MENU_DELETE}) + public @interface ViewAction {} + + private static final int VIEW_ACTION_OPEN = 0; + private static final int VIEW_ACTION_RESUME = 1; + private static final int VIEW_ACTION_PAUSE = 2; + private static final int VIEW_ACTION_CANCEL = 3; + private static final int VIEW_ACTION_MENU_SHARE = 4; + private static final int VIEW_ACTION_MENU_DELETE = 5; + private static final int VIEW_ACTION_BOUNDARY = 6; + private final int mMargin; private final int mMarginSubsection; private final int mIconBackgroundColor; @@ -107,8 +123,10 @@ @Override public void onItemSelected(Item item) { if (item.getTextId() == R.string.share) { + recordViewActionHistogram(VIEW_ACTION_MENU_SHARE); mItem.share(); } else if (item.getTextId() == R.string.delete) { + recordViewActionHistogram(VIEW_ACTION_MENU_DELETE); mItem.startRemove(); } } @@ -136,12 +154,17 @@ mMoreButton.setDelegate(this); mPauseResumeButton.setOnClickListener(view -> { if (mItem.isPaused()) { + recordViewActionHistogram(VIEW_ACTION_RESUME); mItem.resume(); } else if (!mItem.isComplete()) { + recordViewActionHistogram(VIEW_ACTION_PAUSE); mItem.pause(); } }); - mCancelButton.setOnClickListener(view -> mItem.cancel()); + mCancelButton.setOnClickListener(view -> { + recordViewActionHistogram(VIEW_ACTION_CANCEL); + mItem.cancel(); + }); } @Override @@ -272,7 +295,10 @@ @Override public void onClick() { - if (mItem != null && mItem.isComplete()) mItem.open(); + if (mItem != null && mItem.isComplete()) { + recordViewActionHistogram(VIEW_ACTION_OPEN); + mItem.open(); + } } @Override @@ -338,4 +364,9 @@ mLayoutContainer.addView(mMoreButton); } } + + private static void recordViewActionHistogram(@ViewAction int action) { + RecordHistogram.recordEnumeratedHistogram( + "Android.DownloadManager.List.View.Action", action, VIEW_ACTION_BOUNDARY); + } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadManagerUi.java b/chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadManagerUi.java index 715106f..de947b9 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadManagerUi.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadManagerUi.java
@@ -8,6 +8,7 @@ import android.content.ComponentName; import android.content.Intent; import android.os.AsyncTask; +import android.support.annotation.IntDef; import android.support.graphics.drawable.VectorDrawableCompat; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; @@ -165,6 +166,20 @@ } } + // Please treat this list as append only and keep it in sync with + // Android.DownloadManager.Menu.Actions in enums.xml. + @IntDef({MENU_ACTION_CLOSE, MENU_ACTION_MULTI_DELETE, MENU_ACTION_MULTI_SHARE, + MENU_ACTION_SHOW_INFO, MENU_ACTION_HIDE_INFO, MENU_ACTION_SEARCH}) + public @interface MenuAction {} + + private static final int MENU_ACTION_CLOSE = 0; + private static final int MENU_ACTION_MULTI_DELETE = 1; + private static final int MENU_ACTION_MULTI_SHARE = 2; + private static final int MENU_ACTION_SHOW_INFO = 3; + private static final int MENU_ACTION_HIDE_INFO = 4; + private static final int MENU_ACTION_SEARCH = 5; + private static final int MENU_ACTION_BOUNDARY = 6; + private static BackendProvider sProviderForTests; private final DownloadHistoryAdapter mHistoryAdapter; @@ -333,12 +348,18 @@ @Override public boolean onMenuItemClick(MenuItem item) { if (item.getItemId() == R.id.close_menu_id && mIsSeparateActivity) { + recordMenuActionHistogram(MENU_ACTION_CLOSE); mActivity.finish(); return true; } else if (item.getItemId() == R.id.selection_mode_delete_menu_id) { List<DownloadHistoryItemWrapper> items = mBackendProvider.getSelectionDelegate().getSelectedItems(); mBackendProvider.getSelectionDelegate().clearSelection(); + + recordMenuActionHistogram(MENU_ACTION_MULTI_DELETE); + RecordHistogram.recordCount100Histogram( + "Android.DownloadManager.Menu.Delete.SelectedCount", items.size()); + deleteItems(items); return true; } else if (item.getItemId() == R.id.selection_mode_share_menu_id) { @@ -348,12 +369,20 @@ // startActivityForResult() and the selection would only be cleared // after receiving an OK response. See crbug.com/638916. mBackendProvider.getSelectionDelegate().clearSelection(); + + recordMenuActionHistogram(MENU_ACTION_MULTI_SHARE); + RecordHistogram.recordCount100Histogram( + "Android.DownloadManager.Menu.Share.SelectedCount", items.size()); + startShareIntent(DownloadUtils.createShareIntent(items)); return true; } else if (item.getItemId() == R.id.info_menu_id) { - enableStorageInfoHeader(!mHistoryAdapter.shouldShowStorageInfoHeader()); + boolean showInfo = !mHistoryAdapter.shouldShowStorageInfoHeader(); + recordMenuActionHistogram(showInfo ? MENU_ACTION_SHOW_INFO : MENU_ACTION_HIDE_INFO); + enableStorageInfoHeader(showInfo); return true; } else if (item.getItemId() == R.id.search_menu_id) { + recordMenuActionHistogram(MENU_ACTION_SEARCH); // The header should be removed as soon as a search is started. It will be added back in // DownloadHistoryAdatper#filter() when the search is ended. mHistoryAdapter.removeHeader(); @@ -514,4 +543,9 @@ public static void setProviderForTests(BackendProvider provider) { sProviderForTests = provider; } + + private static void recordMenuActionHistogram(@MenuAction int action) { + RecordHistogram.recordEnumeratedHistogram( + "Android.DownloadManager.Menu.Action", action, MENU_ACTION_BOUNDARY); + } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/router/BaseMediaRouteProvider.java b/chrome/android/java/src/org/chromium/chrome/browser/media/router/BaseMediaRouteProvider.java index 6141c71..a7b78e8 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/media/router/BaseMediaRouteProvider.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/media/router/BaseMediaRouteProvider.java
@@ -9,6 +9,8 @@ import android.support.v7.media.MediaRouter.RouteInfo; import org.chromium.base.Log; +import org.chromium.chrome.browser.media.router.cast.CastSession; +import org.chromium.chrome.browser.media.router.cast.ChromeCastSessionManager; import org.chromium.chrome.browser.media.router.cast.DiscoveryCallback; import org.chromium.chrome.browser.media.router.cast.MediaSink; import org.chromium.chrome.browser.media.router.cast.MediaSource; @@ -25,7 +27,9 @@ /** * A {@link BaseMediaRouteProvider} common implementation for MediaRouteProviders. */ -public abstract class BaseMediaRouteProvider implements MediaRouteProvider, DiscoveryDelegate { +public abstract class BaseMediaRouteProvider + implements MediaRouteProvider, DiscoveryDelegate, + ChromeCastSessionManager.CastSessionManagerListener { private static final String TAG = "MediaRouter"; protected static final List<MediaSink> NO_SINKS = Collections.emptyList(); @@ -37,6 +41,9 @@ protected final Map<String, MediaRoute> mRoutes = new HashMap<String, MediaRoute>(); protected Handler mHandler = new Handler(); + // There can be only one Cast session at the same time on Android. + protected CastSession mSession; + protected BaseMediaRouteProvider(MediaRouter androidMediaRouter, MediaRouteManager manager) { mAndroidMediaRouter = androidMediaRouter; mManager = manager; @@ -157,4 +164,32 @@ @Override public abstract void sendStringMessage(String routeId, String message, int nativeCallbackId); + + // ChromeCastSessionObserver implementation. + @Override + public abstract void onSessionStarting( + ChromeCastSessionManager.CastSessionLaunchRequest originalRequest); + + @Override + public abstract void onSessionEnded(); + + @Override + public void onSessionStartFailed() { + for (String routeId : mRoutes.keySet()) { + mManager.onRouteClosedWithError(routeId, "Launch error"); + } + mRoutes.clear(); + }; + + @Override + public void onSessionStarted(CastSession session) { + mSession = session; + } + + @Override + public void onSessionStopAction() { + if (mSession == null) return; + + for (String routeId : mRoutes.keySet()) closeRoute(routeId); + } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/CastMediaRouteProvider.java b/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/CastMediaRouteProvider.java index 44541197..552ccfb3 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/CastMediaRouteProvider.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/CastMediaRouteProvider.java
@@ -36,10 +36,6 @@ private ClientRecord mLastRemovedRouteRecord; private final Map<String, ClientRecord> mClientRecords = new HashMap<String, ClientRecord>(); - // There can be only one Cast session at the same time on Android. - private CastSession mSession; - private CreateRouteRequest mPendingCreateRouteRequest; - /** * @return Initialized {@link CastMediaRouteProvider} object. */ @@ -47,26 +43,20 @@ return new CastMediaRouteProvider(ChromeMediaRouter.getAndroidMediaRouter(), manager); } - public void onLaunchError() { - for (String routeId : mRoutes.keySet()) { - mManager.onRouteClosedWithError(routeId, "Launch error"); - } - mRoutes.clear(); + @Override + public void onSessionStartFailed() { + super.onSessionStartFailed(); mClientRecords.clear(); } - public void onSessionStopAction() { - if (mSession == null) return; - - for (String routeId : mRoutes.keySet()) closeRoute(routeId); - } - - public void onSessionCreated(CastSession session) { - mSession = session; + @Override + public void onSessionStarted(CastSession session) { + super.onSessionStarted(session); mMessageHandler.onSessionCreated(mSession); } - public void onSessionClosed() { + @Override + public void onSessionEnded() { if (mSession == null) return; if (mClientRecords.isEmpty()) { @@ -84,10 +74,7 @@ mSession = null; - if (mPendingCreateRouteRequest != null) { - launchSession(mPendingCreateRouteRequest); - mPendingCreateRouteRequest = null; - } else if (mAndroidMediaRouter != null) { + if (mAndroidMediaRouter != null) { mAndroidMediaRouter.selectRoute(mAndroidMediaRouter.getDefaultRoute()); } } @@ -147,20 +134,16 @@ return; } - CreateRouteRequest createRouteRequest = new CreateRouteRequest( - source, sink, presentationId, origin, tabId, isIncognito, nativeRequestId, this); + CreateRouteRequest createRouteRequest = new CreateRouteRequest(source, sink, presentationId, + origin, tabId, isIncognito, nativeRequestId, this, mMessageHandler); - // Since we only have one session, close it before starting a new one. - if (mSession != null) { - mPendingCreateRouteRequest = createRouteRequest; - mSession.stopApplication(); - return; - } - - launchSession(createRouteRequest); + ChromeCastSessionManager.get().requestSessionLaunch(createRouteRequest); } - private void launchSession(CreateRouteRequest request) { + @Override + public void onSessionStarting( + ChromeCastSessionManager.CastSessionLaunchRequest sessionLaunchRequest) { + CreateRouteRequest request = (CreateRouteRequest) sessionLaunchRequest; MediaSink sink = request.getSink(); MediaSource source = request.getSource(); @@ -177,7 +160,6 @@ sendReceiverAction(clientRecord.routeId, sink, clientId, "cast"); } } - request.start(); } @Override @@ -221,7 +203,7 @@ if (sink != null) sendReceiverAction(routeId, sink, client.clientId, "stop"); } - mSession.stopApplication(); + ChromeCastSessionManager.get().stopApplication(); } @Override
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/CastSessionImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/CastSessionImpl.java index 57dbb48..e4eee91d 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/CastSessionImpl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/CastSessionImpl.java
@@ -61,7 +61,6 @@ private final CastDevice mCastDevice; private final MediaSource mSource; private final CastMessageHandler mMessageHandler; - private final CastMediaRouteProvider mRouteProvider; private GoogleApiClient mApiClient; private String mSessionId; @@ -83,25 +82,17 @@ * @param source The {@link MediaSource} corresponding to this session. * @param routeProvider The {@link CastMediaRouteProvider} instance managing this session. */ - public CastSessionImpl( - GoogleApiClient apiClient, - String sessionId, - ApplicationMetadata metadata, - String applicationStatus, - CastDevice castDevice, - String origin, - int tabId, - boolean isIncognito, - MediaSource source, - CastMediaRouteProvider routeProvider) { + public CastSessionImpl(GoogleApiClient apiClient, String sessionId, + ApplicationMetadata metadata, String applicationStatus, CastDevice castDevice, + String origin, int tabId, boolean isIncognito, MediaSource source, + CastMessageHandler messageHandler) { mSessionId = sessionId; - mRouteProvider = routeProvider; mApiClient = apiClient; mSource = source; mApplicationMetadata = metadata; mApplicationStatus = applicationStatus; mCastDevice = castDevice; - mMessageHandler = mRouteProvider.getMessageHandler(); + mMessageHandler = messageHandler; mMessageChannel = new CastMessagingChannel(this); updateNamespaces(); @@ -179,7 +170,7 @@ @Override public void onStop(int actionSource) { stopApplication(); - mRouteProvider.onSessionStopAction(); + ChromeCastSessionManager.get().onSessionStopAction(); } @Override @@ -443,7 +434,7 @@ mSessionId = null; mApiClient = null; - mRouteProvider.onSessionClosed(); + ChromeCastSessionManager.get().onSessionEnded(); mStoppingApplication = false; MediaNotificationManager.clear(R.id.presentation_notification);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/ChromeCastSessionManager.java b/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/ChromeCastSessionManager.java new file mode 100644 index 0000000..eddd689 --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/ChromeCastSessionManager.java
@@ -0,0 +1,230 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.media.router.cast; + +import android.annotation.SuppressLint; + +import com.google.android.gms.cast.ApplicationMetadata; +import com.google.android.gms.cast.Cast; +import com.google.android.gms.cast.CastStatusCodes; + +import org.chromium.base.Log; + +/** + * Manages the lifetime of the active CastSessions and broadcasts state changes to observers. + */ +public class ChromeCastSessionManager { + private static final String TAG = "cr_CastSessionMgr"; + + // Singleton instance. + private static ChromeCastSessionManager sInstance; + + /** + * Defines the events relevant to CastSession state changes. + * NOTE: This interface is modeled after Cast SDK V3's SessionManagerListener, but does not map + * exactly to it. + */ + public interface CastSessionManagerListener { + // Called right before a session launch is started. + public void onSessionStarting( + ChromeCastSessionManager.CastSessionLaunchRequest originalRequest); + + // Called after a successful session launch. + public void onSessionStarted(CastSession session); + + // Called after a failed session launch. + public void onSessionStartFailed(); + + // Called when a session is shutting down (as a result of user action, or when a new + // session is being launched). + public void onSessionStopAction(); + + // Called after a session has shut down. + public void onSessionEnded(); + } + + /** + * Encapsulates a request to start a cast session. Mostly used to simplify testing. + */ + public interface CastSessionLaunchRequest { + // Starts the request. + // Success or failure will be reported to the ChromeCastSessionManager via the + // onSessionStarted() and onSessionStartFailed() calls. + public void start(Cast.Listener listener); + + // Gets the session observer that should be notified of the session launch. + public CastSessionManagerListener getSessionListener(); + } + + private class CastListener extends Cast.Listener { + private CastSession mSession; + + CastListener() {} + + void setSession(CastSession session) { + mSession = session; + } + + @Override + public void onApplicationStatusChanged() { + if (mSession == null) return; + + mSession.updateSessionStatus(); + } + + @Override + public void onApplicationMetadataChanged(ApplicationMetadata metadata) { + if (mSession == null) return; + + mSession.updateSessionStatus(); + } + + // TODO(https://crbug.com/635567): Fix this properly. + @Override + @SuppressLint("DefaultLocale") + public void onApplicationDisconnected(int errorCode) { + if (errorCode != CastStatusCodes.SUCCESS) { + Log.e(TAG, String.format("Application disconnected with: %d", errorCode)); + } + + // This callback can be called more than once if the application is stopped from Chrome. + if (mSession == null) return; + + mSession.stopApplication(); + mSession = null; + } + + @Override + public void onVolumeChanged() { + if (mSession == null) return; + + mSession.onVolumeChanged(); + } + } + + // The current active session. There can only be one active session on Android. + // NOTE: This is a Chromium abstraction, different from the Cast SDK CastSession. + private CastSession mSession; + + // Listener tied to |mSession|. + private CastListener mListener; + + // Request to be started once |mSession| is stopped. + private CastSessionLaunchRequest mPendingSessionLaunchRequest; + + // Object that initiated the current cast session and that should be notified + // of changes to the session. + private CastSessionManagerListener mCurrentSessionListener; + + // Whether we are currently in the process of launching a session. + private boolean mSessionLaunching = false; + + public static ChromeCastSessionManager get() { + if (sInstance == null) sInstance = new ChromeCastSessionManager(); + + return sInstance; + } + + /** + * Should only be used for testing purposes. + */ + public static void resetInstanceForTesting() { + sInstance = null; + } + + private ChromeCastSessionManager() {} + + /** + * Called after a session successfully launched and was created. + * @param session the newly created session. + */ + public void onSessionStarted(CastSession session) { + assert mSession == null; + + mSession = session; + mSessionLaunching = false; + mCurrentSessionListener.onSessionStarted(session); + } + + /** + * Called to initiate a new session launch. Will stop the current session if it exists. + * Calls back into onSessionStarting(). + * Calling this method when we already have a session will stop that session first. + * Requests will be dropped if we are in the process of launching a new session. + * @param request the encapsulated information required to launch the session. + */ + public void requestSessionLaunch(CastSessionLaunchRequest request) { + // Do not attempt to launch more than one session at a time. + if (mSessionLaunching) return; + + // Since we only can only have one session, close it before starting a new one. + if (mSession != null) { + mPendingSessionLaunchRequest = request; + mSession.stopApplication(); + return; + } + + launchSession(request); + } + + /** + * Stops the current session. + */ + public void stopApplication() { + mSession.stopApplication(); + } + + /** + * Starts the session request. + * Will result in a call to onSessionStarted() or onSessionStartFailed() based on the + * success/failure of the launch. + */ + private void launchSession(CastSessionLaunchRequest request) { + assert mSession == null; + + mSessionLaunching = true; + + mCurrentSessionListener = request.getSessionListener(); + mCurrentSessionListener.onSessionStarting(request); + + mListener = new CastListener(); + + request.start(mListener); + } + + /** + * Called when the session has received a stop action. + */ + public void onSessionStopAction() { + mCurrentSessionListener.onSessionStopAction(); + } + + /** + * Called when the session has ended. The session may no longer be valid at this point. + */ + public void onSessionEnded() { + mCurrentSessionListener.onSessionEnded(); + + mSession = null; + mCurrentSessionListener = null; + mListener = null; + + if (mPendingSessionLaunchRequest != null) { + launchSession(mPendingSessionLaunchRequest); + mPendingSessionLaunchRequest = null; + } + } + + /** + * Called when the session has failed to launch. + */ + public void onSessionStartFailed() { + mCurrentSessionListener.onSessionStartFailed(); + mCurrentSessionListener = null; + mListener = null; + + mSessionLaunching = false; + } +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/CreateRouteRequest.java b/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/CreateRouteRequest.java index 060172aa..7b4fb9c7 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/CreateRouteRequest.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/CreateRouteRequest.java
@@ -7,9 +7,7 @@ import android.annotation.SuppressLint; import android.os.Bundle; -import com.google.android.gms.cast.ApplicationMetadata; import com.google.android.gms.cast.Cast; -import com.google.android.gms.cast.CastStatusCodes; import com.google.android.gms.cast.LaunchOptions; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.api.GoogleApiClient; @@ -22,6 +20,8 @@ import org.chromium.chrome.browser.media.router.ChromeMediaRouter; import org.chromium.chrome.browser.media.router.MediaRoute; +import javax.annotation.Nullable; + /** * Establishes a {@link MediaRoute} by starting a Cast application represented by the given * presentation URL. Reports success or failure to {@link ChromeMediaRouter}. @@ -29,8 +29,9 @@ * the class is implemented as a state machine. */ public class CreateRouteRequest implements GoogleApiClient.ConnectionCallbacks, - GoogleApiClient.OnConnectionFailedListener, - ResultCallback<Cast.ApplicationConnectionResult> { + GoogleApiClient.OnConnectionFailedListener, + ResultCallback<Cast.ApplicationConnectionResult>, + ChromeCastSessionManager.CastSessionLaunchRequest { private static final String TAG = "MediaRouter"; private static final int STATE_IDLE = 0; @@ -40,53 +41,6 @@ private static final int STATE_LAUNCH_SUCCEEDED = 4; private static final int STATE_TERMINATED = 5; - private class CastListener extends Cast.Listener { - private CastSession mSession; - - CastListener() {} - - void setSession(CastSession session) { - mSession = session; - } - - @Override - public void onApplicationStatusChanged() { - if (mSession == null) return; - - mSession.updateSessionStatus(); - } - - @Override - public void onApplicationMetadataChanged(ApplicationMetadata metadata) { - if (mSession == null) return; - - mSession.updateSessionStatus(); - } - - @Override - // TODO(crbug.com/635567): Fix this properly. - @SuppressLint("DefaultLocale") - public void onApplicationDisconnected(int errorCode) { - if (errorCode != CastStatusCodes.SUCCESS) { - Log.e(TAG, String.format( - "Application disconnected with: %d", errorCode)); - } - - // This callback can be called more than once if the application is stopped from Chrome. - if (mSession == null) return; - - mSession.stopApplication(); - mSession = null; - } - - @Override - public void onVolumeChanged() { - if (mSession == null) return; - - mSession.onVolumeChanged(); - } - } - private final MediaSource mSource; private final MediaSink mSink; private final String mPresentationId; @@ -94,8 +48,8 @@ private final int mTabId; private final boolean mIsIncognito; private final int mRequestId; - private final CastMediaRouteProvider mRouteProvider; - private final CastListener mCastListener = new CastListener(); + private final CastMessageHandler mMessageHandler; + private final ChromeCastSessionManager.CastSessionManagerListener mSessionListener; private GoogleApiClient mApiClient; private int mState = STATE_IDLE; @@ -110,17 +64,13 @@ * @param isIncognito Whether the route is being requested from an Incognito profile. * @param requestId The id of the route creation request for tracking by * {@link ChromeMediaRouter}. - * @param routeProvider The instance of {@link CastMediaRouteProvider} handling the request. + * @param listener The listener that should be notified of session/route creation changes. + * @param messageHandler A message handler (used to create CastSessionImpl instances). */ - public CreateRouteRequest( - MediaSource source, - MediaSink sink, - String presentationId, - String origin, - int tabId, - boolean isIncognito, - int requestId, - CastMediaRouteProvider routeProvider) { + public CreateRouteRequest(MediaSource source, MediaSink sink, String presentationId, + String origin, int tabId, boolean isIncognito, int requestId, + ChromeCastSessionManager.CastSessionManagerListener listener, + @Nullable CastMessageHandler messageHandler) { assert source != null; assert sink != null; @@ -131,7 +81,8 @@ mTabId = tabId; mIsIncognito = isIncognito; mRequestId = requestId; - mRouteProvider = routeProvider; + mSessionListener = listener; + mMessageHandler = messageHandler; } public MediaSource getSource() { @@ -162,25 +113,39 @@ return mRequestId; } + ///////////////////////////////////////////////////////////////////////////////////////////// + // ChromeCastSessionManager.CastSessionLaunchRequest implementation. + + /** + * Returns the object that should be notified of session changes that result + * from this route creation request. + */ + @Override + public ChromeCastSessionManager.CastSessionManagerListener getSessionListener() { + return mSessionListener; + } + /** * Starts the process of launching the application on the Cast device. */ - public void start() { + @Override + public void start(Cast.Listener castListener) { if (mState != STATE_IDLE) throwInvalidState(); - mApiClient = createApiClient(mCastListener); + mApiClient = createApiClient(castListener); mApiClient.connect(); mState = STATE_CONNECTING_TO_API; } + ///////////////////////////////////////////////////////////////////////////////////////////// + // GoogleApiClient.* implementations. + @Override public void onConnected(Bundle connectionHint) { if (mState != STATE_CONNECTING_TO_API && mState != STATE_API_CONNECTION_SUSPENDED) { throwInvalidState(); } - // TODO(avayvod): switch to using ConnectedTask class for GoogleApiClient operations. - // See https://crbug.com/522478 if (mState == STATE_API_CONNECTION_SUSPENDED) return; try { @@ -193,14 +158,24 @@ } } - // TODO(avayvod): switch to using ConnectedTask class for GoogleApiClient operations. - // See https://crbug.com/522478 @Override public void onConnectionSuspended(int cause) { mState = STATE_API_CONNECTION_SUSPENDED; } @Override + public void onConnectionFailed(ConnectionResult result) { + if (mState != STATE_CONNECTING_TO_API) throwInvalidState(); + + Log.e(TAG, "GoogleApiClient connection failed: %d, %b", result.getErrorCode(), + result.hasResolution()); + reportError(); + } + + /** + * ResultCallback<Cast.ApplicationConnectionResult> implementation. + */ + @Override public void onResult(Cast.ApplicationConnectionResult result) { if (mState != STATE_LAUNCHING_APPLICATION && mState != STATE_API_CONNECTION_SUSPENDED) { @@ -219,17 +194,6 @@ reportSuccess(result); } - // TODO(avayvod): switch to using ConnectedTask class for GoogleApiClient operations. - // See https://crbug.com/522478 - @Override - public void onConnectionFailed(ConnectionResult result) { - if (mState != STATE_CONNECTING_TO_API) throwInvalidState(); - - Log.e(TAG, "GoogleApiClient connection failed: %d, %b", - result.getErrorCode(), result.hasResolution()); - reportError(); - } - private GoogleApiClient createApiClient(Cast.Listener listener) { Cast.CastOptions.Builder apiOptionsBuilder = new Cast.CastOptions.Builder(mSink.getDevice(), listener) @@ -262,19 +226,11 @@ private void reportSuccess(Cast.ApplicationConnectionResult result) { if (mState != STATE_LAUNCH_SUCCEEDED) throwInvalidState(); - CastSession session = new CastSessionImpl( - mApiClient, - result.getSessionId(), - result.getApplicationMetadata(), - result.getApplicationStatus(), - mSink.getDevice(), - mOrigin, - mTabId, - mIsIncognito, - mSource, - mRouteProvider); - mCastListener.setSession(session); - mRouteProvider.onSessionCreated(session); + CastSession session = new CastSessionImpl(mApiClient, result.getSessionId(), + result.getApplicationMetadata(), result.getApplicationStatus(), mSink.getDevice(), + mOrigin, mTabId, mIsIncognito, mSource, mMessageHandler); + + ChromeCastSessionManager.get().onSessionStarted(session); terminate(); } @@ -282,8 +238,7 @@ private void reportError() { if (mState == STATE_TERMINATED) throwInvalidState(); - assert mRouteProvider != null; - mRouteProvider.onLaunchError(); + ChromeCastSessionManager.get().onSessionStartFailed(); terminate(); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/remoting/RemotingMediaRouteProvider.java b/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/remoting/RemotingMediaRouteProvider.java index 614ce53..72ba1ced 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/remoting/RemotingMediaRouteProvider.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/remoting/RemotingMediaRouteProvider.java
@@ -10,6 +10,7 @@ import org.chromium.chrome.browser.media.router.ChromeMediaRouter; import org.chromium.chrome.browser.media.router.MediaRouteManager; import org.chromium.chrome.browser.media.router.MediaRouteProvider; +import org.chromium.chrome.browser.media.router.cast.ChromeCastSessionManager; import org.chromium.chrome.browser.media.router.cast.MediaSource; /** @@ -52,4 +53,11 @@ RemotingMediaRouteProvider(MediaRouter androidMediaRouter, MediaRouteManager manager) { super(androidMediaRouter, manager); } + + // TODO(tguilbert): Implement the functions below. See https://crbug.com/790766. + @Override + public void onSessionEnded() {} + + @Override + public void onSessionStarting(ChromeCastSessionManager.CastSessionLaunchRequest request) {} }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/metrics/WebApkUma.java b/chrome/android/java/src/org/chromium/chrome/browser/metrics/WebApkUma.java index 05ab619..f6b32ce 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/metrics/WebApkUma.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/metrics/WebApkUma.java
@@ -229,6 +229,11 @@ RecordHistogram.recordBooleanHistogram("WebApk.WebApkService.BindSuccess", bindSucceeded); } + /** Records the network error code caught when a WebAPK is launched. */ + public static void recordNetworkErrorWhenLaunch(int errorCode) { + RecordHistogram.recordSparseSlowlyHistogram("WebApk.Launch.NetworkError", -errorCode); + } + /** * Log necessary disk usage and cache size UMAs when WebAPK installation fails. */
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/RecentTabsManager.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/RecentTabsManager.java index ee0a4386..d9332dd 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/RecentTabsManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/RecentTabsManager.java
@@ -108,7 +108,7 @@ if (SigninPromoController.arePersonalizedPromosEnabled()) { int imageSize = context.getResources().getDimensionPixelSize(R.dimen.user_picture_size); - mProfileDataCache = new ProfileDataCache(mContext, profile, imageSize); + mProfileDataCache = new ProfileDataCache(mContext, imageSize); mSigninPromoController = new SigninPromoController(SigninAccessPoint.RECENT_TABS); } else { mProfileDataCache = null;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SignInPromo.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SignInPromo.java index 3d0d3ddc..669a24e 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SignInPromo.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SignInPromo.java
@@ -22,7 +22,6 @@ import org.chromium.chrome.browser.ntp.snippets.SnippetsBridge; import org.chromium.chrome.browser.ntp.snippets.SuggestionsSource; import org.chromium.chrome.browser.preferences.ChromePreferenceManager; -import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.signin.AccountSigninActivity; import org.chromium.chrome.browser.signin.DisplayableProfileData; import org.chromium.chrome.browser.signin.PersonalizedSigninPromoView; @@ -116,8 +115,7 @@ if (mArePersonalizedPromosEnabled) { int imageSize = context.getResources().getDimensionPixelSize(R.dimen.user_picture_size); - mProfileDataCache = - new ProfileDataCache(context, Profile.getLastUsedProfile(), imageSize); + mProfileDataCache = new ProfileDataCache(context, imageSize); mSigninPromoController = new SigninPromoController(SigninAccessPoint.NTP_CONTENT_SUGGESTIONS); mGenericPromoData = null;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/PickerCategoryView.java b/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/PickerCategoryView.java index faae81d..56bd0c57 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/PickerCategoryView.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/PickerCategoryView.java
@@ -158,6 +158,7 @@ mRecyclerView.setLayoutManager(mLayoutManager); mSpacingDecoration = new GridSpacingItemDecoration(mColumns, mPadding); mRecyclerView.addItemDecoration(mSpacingDecoration); + mRecyclerView.setRecyclerListener(this); final long maxMemory = ConversionUtils.bytesToKilobytes(Runtime.getRuntime().maxMemory()); mCacheSizeLarge = (int) (maxMemory / 2); // 1/2 of the available memory.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/SignInPreference.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/SignInPreference.java index 6887b57a..6eef39db 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/SignInPreference.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/SignInPreference.java
@@ -16,7 +16,6 @@ import org.chromium.base.metrics.RecordUserAction; import org.chromium.chrome.R; import org.chromium.chrome.browser.firstrun.FirstRunSignInProcessor; -import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.signin.AccountManagementFragment; import org.chromium.chrome.browser.signin.AccountSigninActivity; import org.chromium.chrome.browser.signin.DisplayableProfileData; @@ -57,7 +56,7 @@ super(context, attrs); int imageSize = context.getResources().getDimensionPixelSize(R.dimen.user_picture_size); - mProfileDataCache = new ProfileDataCache(context, Profile.getLastUsedProfile(), imageSize); + mProfileDataCache = new ProfileDataCache(context, imageSize); setOnPreferenceClickListener(preference -> AccountSigninActivity.startIfAllowed(getContext(), SigninAccessPoint.SETTINGS));
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/password/PasswordEntryEditor.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/password/PasswordEntryEditor.java index 7359d44..66e2efa7 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/password/PasswordEntryEditor.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/password/PasswordEntryEditor.java
@@ -12,6 +12,7 @@ import android.net.Uri; import android.os.Bundle; import android.support.annotation.StringRes; +import android.support.v7.content.res.AppCompatResources; import android.text.InputType; import android.text.SpannableString; import android.text.Spanned; @@ -27,6 +28,7 @@ import android.view.ViewGroup; import android.view.WindowManager.LayoutParams; import android.widget.ImageButton; +import android.widget.ImageView; import android.widget.TextView; import org.chromium.base.ApiCompatibilityUtils; @@ -250,6 +252,10 @@ private void hookupCopyUsernameButton(View usernameView) { final ImageButton copyUsernameButton = (ImageButton) usernameView.findViewById(R.id.password_entry_editor_copy); + final ImageView copy_image = usernameView.findViewById(R.id.password_entry_editor_copy); + copy_image.setImageDrawable( + AppCompatResources.getDrawable(getActivity(), R.drawable.ic_content_copy_black)); + copyUsernameButton.setContentDescription( getActivity().getString(R.string.password_entry_editor_copy_stored_username)); copyUsernameButton.setOnClickListener(new View.OnClickListener() { @@ -274,6 +280,10 @@ (ImageButton) siteView.findViewById(R.id.password_entry_editor_copy); copySiteButton.setContentDescription( getActivity().getString(R.string.password_entry_editor_copy_stored_site)); + final ImageView copy_image = siteView.findViewById(R.id.password_entry_editor_copy); + copy_image.setImageDrawable( + AppCompatResources.getDrawable(getActivity(), R.drawable.ic_content_copy_black)); + copySiteButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -348,6 +358,10 @@ (ImageButton) mView.findViewById(R.id.password_entry_editor_copy_password); final ImageButton viewPasswordButton = (ImageButton) mView.findViewById(R.id.password_entry_editor_view_password); + final ImageView copy_password = + mView.findViewById(R.id.password_entry_editor_copy_password); + copy_password.setImageDrawable( + AppCompatResources.getDrawable(getActivity(), R.drawable.ic_content_copy_black)); copyPasswordButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -391,5 +405,4 @@ } }); } - }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/profiles/ProfileDownloader.java b/chrome/android/java/src/org/chromium/chrome/browser/profiles/ProfileDownloader.java index b1abb587..9bc3fca 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/profiles/ProfileDownloader.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/profiles/ProfileDownloader.java
@@ -114,13 +114,13 @@ /** * Starts fetching the account information for a given account. * @param context context associated with the request - * @param profile Profile associated with the request * @param accountId Account name to fetch the information for * @param imageSidePixels Request image side (in pixels) */ - public static void startFetchingAccountInfoFor(Context context, Profile profile, - String accountId, int imageSidePixels, boolean isPreSignin) { + public static void startFetchingAccountInfoFor( + Context context, String accountId, int imageSidePixels, boolean isPreSignin) { ThreadUtils.assertOnUiThread(); + Profile profile = Profile.getLastUsedProfile().getOriginalProfile(); if (!AccountTrackerService.get().checkAndSeedSystemAccounts()) { PendingProfileDownloads.get(context).pendProfileDownload( profile, accountId, imageSidePixels);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/share/ShareMenuActionHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/share/ShareMenuActionHandler.java index 1096f71..f9a071f 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/share/ShareMenuActionHandler.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/share/ShareMenuActionHandler.java
@@ -107,8 +107,12 @@ @VisibleForTesting static String getUrlToShare(String visibleUrl, String canonicalUrl) { if (TextUtils.isEmpty(canonicalUrl)) return visibleUrl; - if (!UrlConstants.HTTPS_SCHEME.equals(GURLUtils.getScheme(canonicalUrl)) - || !UrlConstants.HTTPS_SCHEME.equals(GURLUtils.getScheme(visibleUrl))) { + String canonicalScheme = GURLUtils.getScheme(canonicalUrl); + if (!UrlConstants.HTTP_SCHEME.equals(canonicalScheme) + && !UrlConstants.HTTPS_SCHEME.equals(canonicalScheme)) { + return visibleUrl; + } + if (!UrlConstants.HTTPS_SCHEME.equals(GURLUtils.getScheme(visibleUrl))) { return visibleUrl; } return canonicalUrl;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/AccountManagementFragment.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/AccountManagementFragment.java index 3fea45b..a55f9944 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/signin/AccountManagementFragment.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/AccountManagementFragment.java
@@ -135,8 +135,7 @@ badgeConfig = new ProfileDataCache.BadgeConfig( badge, new Point(badgePositionX, badgePositionY), badgeBorderSize); } - mProfileDataCache = - new ProfileDataCache(getActivity(), mProfile, avatarImageSize, badgeConfig); + mProfileDataCache = new ProfileDataCache(getActivity(), avatarImageSize, badgeConfig); } @Override
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/AccountSigninView.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/AccountSigninView.java index b95aece..d5a893b 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/signin/AccountSigninView.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/AccountSigninView.java
@@ -26,7 +26,6 @@ import org.chromium.chrome.R; import org.chromium.chrome.browser.externalauth.UserRecoverableErrorHandler; import org.chromium.chrome.browser.preferences.PrefServiceBridge; -import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.signin.AccountTrackerService.OnSystemAccountsSeededListener; import org.chromium.chrome.browser.signin.ConfirmImportSyncDataDialog.ImportSyncType; import org.chromium.components.signin.AccountManagerDelegateException; @@ -149,7 +148,7 @@ super(context, attrs); mAccountsChangedObserver = this::triggerUpdateAccounts; mProfileDataCacheObserver = (String accountId) -> updateProfileData(); - mProfileDataCache = new ProfileDataCache(context, Profile.getLastUsedProfile(), + mProfileDataCache = new ProfileDataCache(context, context.getResources().getDimensionPixelSize(R.dimen.signin_account_image_size)); mCancelButtonTextId = R.string.no_thanks;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/ProfileDataCache.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/ProfileDataCache.java index aa0f12f5..0ac6bc5 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/signin/ProfileDataCache.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/ProfileDataCache.java
@@ -25,7 +25,6 @@ import org.chromium.base.ObserverList; import org.chromium.base.ThreadUtils; import org.chromium.chrome.R; -import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileDownloader; import org.chromium.components.signin.AccountManagerFacade; import org.chromium.components.signin.ProfileDataSource; @@ -91,7 +90,6 @@ } private final Context mContext; - private final Profile mProfile; private final int mImageSize; private @Nullable final BadgeConfig mBadgeConfig; private final Drawable mPlaceholderImage; @@ -99,14 +97,12 @@ private final Map<String, DisplayableProfileData> mCachedProfileData = new HashMap<>(); private @Nullable final ProfileDataSource mProfileDataSource; - public ProfileDataCache(Context context, Profile profile, int imageSize) { - this(context, profile, imageSize, null); + public ProfileDataCache(Context context, int imageSize) { + this(context, imageSize, null); } - public ProfileDataCache( - Context context, Profile profile, int imageSize, @Nullable BadgeConfig badgeConfig) { + public ProfileDataCache(Context context, int imageSize, @Nullable BadgeConfig badgeConfig) { mContext = context; - mProfile = profile; mImageSize = imageSize; mBadgeConfig = badgeConfig; @@ -131,7 +127,7 @@ for (int i = 0; i < accounts.size(); i++) { if (mCachedProfileData.get(accounts.get(i)) == null) { ProfileDownloader.startFetchingAccountInfoFor( - mContext, mProfile, accounts.get(i), mImageSize, true); + mContext, accounts.get(i), mImageSize, true); } } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/survey/ChromeHomeSurveyController.java b/chrome/android/java/src/org/chromium/chrome/browser/survey/ChromeHomeSurveyController.java index 37d8bea8..74ad827 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/survey/ChromeHomeSurveyController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/survey/ChromeHomeSurveyController.java
@@ -48,8 +48,9 @@ public static final String PARAM_NAME = "survey_override_site_id"; public static final long REQUIRED_VISIBILITY_DURATION_MS = 5000; - private static final String TRIAL_NAME = "ChromeHome"; - private static final String MAX_NUMBER = "MaxNumber"; + private static final String CHROME_HOME_TRIAL_NAME = "ChromeHome"; + private static final String HAPPINESS_SURVEY_TRIAL_NAME = "ChromeHomeHappinessSurvey"; + private static final String MAX_NUMBER = "max-number"; private static final String TEST_SITE_ID = "obw74vpeieqaw4xmw7o6qlpdbq"; private static boolean sForceUmaEnabledForTesting; @@ -98,7 +99,8 @@ } else if (ChromeFeatureList.isEnabled(ChromeFeatureList.CHROME_HOME_SURVEY)) { siteId = TEST_SITE_ID; } else { - siteId = VariationsAssociatedData.getVariationParamValue(TRIAL_NAME, PARAM_NAME); + siteId = VariationsAssociatedData.getVariationParamValue( + HAPPINESS_SURVEY_TRIAL_NAME, PARAM_NAME); } if (TextUtils.isEmpty(siteId)) return; @@ -302,7 +304,8 @@ @VisibleForTesting int getMaxNumber() { try { - String number = VariationsAssociatedData.getVariationParamValue(TRIAL_NAME, MAX_NUMBER); + String number = VariationsAssociatedData.getVariationParamValue( + CHROME_HOME_TRIAL_NAME, MAX_NUMBER); if (TextUtils.isEmpty(number)) return -1; return Integer.parseInt(number); } catch (NumberFormatException e) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappOfflineDialog.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappOfflineDialog.java index 7b5ae90..299510cf 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappOfflineDialog.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappOfflineDialog.java
@@ -7,11 +7,11 @@ import android.app.Activity; import android.app.Dialog; import android.content.DialogInterface; -import android.support.annotation.StringRes; import android.support.v7.app.AlertDialog; import org.chromium.base.ApiCompatibilityUtils; import org.chromium.chrome.R; +import org.chromium.net.NetError; /** * A dialog to notify users that WebAPKs and Trusted Web Activities need a network connection to @@ -25,19 +25,17 @@ * @param activity Activity that will be used for {@link Dialog#show()}. * @param appName The name of the Android native client for which the dialog is shown. * @param isWebApk Whether the app above is a WebAPK. + * @param errorCode The network error code. */ - public void show(final Activity activity, String appName, boolean isWebApk) { - @StringRes int messageID = isWebApk - ? R.string.webapk_offline_dialog : R.string.webapp_twa_offline_dialog; + public void show(final Activity activity, String appName, boolean isWebApk, int errorCode) { AlertDialog.Builder builder = new AlertDialog.Builder(activity, R.style.AlertDialogTheme); - builder.setMessage(activity.getString(messageID, appName)) - .setPositiveButton(R.string.ok, - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - ApiCompatibilityUtils.finishAndRemoveTask(activity); - } - }); + builder.setMessage(getErrorDescription(activity, appName, isWebApk, errorCode)) + .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + ApiCompatibilityUtils.finishAndRemoveTask(activity); + } + }); mDialog = builder.create(); mDialog.setCanceledOnTouchOutside(false); @@ -48,4 +46,19 @@ public void cancel() { mDialog.cancel(); } + + private String getErrorDescription( + Activity activity, String appName, boolean isWebApk, int errorCode) { + switch (errorCode) { + case NetError.ERR_INTERNET_DISCONNECTED: + int messageID = isWebApk ? R.string.webapk_offline_dialog + : R.string.webapp_twa_offline_dialog; + return activity.getString(messageID, appName); + case NetError.ERR_TUNNEL_CONNECTION_FAILED: + return activity.getString( + R.string.webapp_network_error_message_tunnel_connection_failed); + default: + return activity.getString(R.string.webapp_cannot_connect_to_site); + } + } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappSplashScreenController.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappSplashScreenController.java index 6c2fa52..219c2ce4 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappSplashScreenController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappSplashScreenController.java
@@ -18,6 +18,7 @@ import org.chromium.base.VisibleForTesting; import org.chromium.chrome.R; import org.chromium.chrome.browser.compositor.CompositorViewHolder; +import org.chromium.chrome.browser.metrics.WebApkUma; import org.chromium.chrome.browser.metrics.WebappUma; import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.Tab; @@ -28,6 +29,9 @@ /** Shows and hides splash screen. */ class WebappSplashScreenController extends EmptyTabObserver { + // No error. + public static final int ERROR_OK = 0; + /** Used to schedule splash screen hiding. */ private CompositorViewHolder mCompositorViewHolder; @@ -144,24 +148,24 @@ boolean isErrorPage, boolean hasCommitted, boolean isSameDocument, boolean isFragmentNavigation, Integer pageTransition, int errorCode, int httpStatusCode) { - if (mActivityType == WebappActivity.ACTIVITY_TYPE_WEBAPP) return; + if (mActivityType == WebappActivity.ACTIVITY_TYPE_WEBAPP || !isInMainFrame) return; mErrorCode = errorCode; - switch (mErrorCode) { - case NetError.ERR_NETWORK_CHANGED: - onNetworkChanged(tab); - break; - case NetError.ERR_INTERNET_DISCONNECTED: - onNetworkDisconnected(tab); - break; - default: + case ERROR_OK: if (mOfflineDialog != null) { mOfflineDialog.cancel(); mOfflineDialog = null; } break; + case NetError.ERR_NETWORK_CHANGED: + onNetworkChanged(tab); + break; + default: + onNetworkError(tab, errorCode); + break; } + WebApkUma.recordNetworkErrorWhenLaunch(-errorCode); } protected boolean canHideSplashScreen() { @@ -181,7 +185,7 @@ mAllowReloads = false; } - private void onNetworkDisconnected(final Tab tab) { + private void onNetworkError(final Tab tab, int errorCode) { if (mOfflineDialog != null || tab.getActivity() == null) return; final NetworkChangeNotifier.ConnectionTypeObserver observer = @@ -199,8 +203,8 @@ NetworkChangeNotifier.addConnectionTypeObserver(observer); mOfflineDialog = new WebappOfflineDialog(); - mOfflineDialog.show( - tab.getActivity(), mAppName, mActivityType == WebappActivity.ACTIVITY_TYPE_WEBAPK); + mOfflineDialog.show(tab.getActivity(), mAppName, + mActivityType == WebappActivity.ACTIVITY_TYPE_WEBAPK, errorCode); } /** Sets the splash screen layout and sets the splash screen's title and icon. */
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheet.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheet.java index 53425ff..98850e8 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheet.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheet.java
@@ -139,10 +139,10 @@ private static final float SWIPE_ALLOWED_FRACTION = 0.2f; /** - * The maximum swipe velocity (dp/ms) that should be considered as a user opening the bottom + * The minimum swipe velocity (dp/ms) that should be considered as a user opening the bottom * sheet intentionally. This is specifically for the 'velocity' swipe logic. */ - private static final float SHEET_SWIPE_MAX_DP_PER_MS = 0.2f; + private static final float SHEET_SWIPE_MIN_DP_PER_MS = 0.2f; /** * Information about the different scroll states of the sheet. Order is important for these, @@ -397,7 +397,7 @@ double dpPerMs = scrollDistanceDp / (double) timeDeltaMs; - if (dpPerMs > SHEET_SWIPE_MAX_DP_PER_MS) { + if (dpPerMs < SHEET_SWIPE_MIN_DP_PER_MS) { if (shouldRecordHistogram && !mIsSwipeVelocityRecorded) { recordSwipeVelocity("Android.ChromeHome.OpenSheetVelocity.Fail", (int) mLastSheetOpenMicrosPerDp);
diff --git a/chrome/android/java/strings/android_chrome_strings.grd b/chrome/android/java/strings/android_chrome_strings.grd index 8b3bcef..b7fa08ee 100644 --- a/chrome/android/java/strings/android_chrome_strings.grd +++ b/chrome/android/java/strings/android_chrome_strings.grd
@@ -3049,6 +3049,12 @@ <message name="IDS_WEBAPK_NOTIFICATION_CHANNEL_NAME" desc="The visible name of the notification channel of WebAPKs on Android O+."> General </message> + <message name="IDS_WEBAPP_CANNOT_CONNECT_TO_SITE" desc="The message on the dialog shown when launching a WebAPK or a TWA with network failure."> + Can't connect to the site + </message> + <message name="IDS_WEBAPP_NETWORK_ERROR_MESSAGE_TUNNEL_CONNECTION_FAILED" desc="The error message for ERROR_TUNNEL_CONNECTION_FAILED."> + Establishing a tunnel via proxy server failed + </message> <!-- Keyboard shortcuts in Android N--> <message name="IDS_KEYBOARD_SHORTCUT_OPEN_NEW_TAB" desc="A text label that appears next to the keyboard shortcut to open a new tab in Chrome. The shortcut description is shown in a system dialog along with all other supported shortcuts. [CHAR-LIMIT=55]">
diff --git a/chrome/android/java_sources.gni b/chrome/android/java_sources.gni index 872c482c..4891e18 100644 --- a/chrome/android/java_sources.gni +++ b/chrome/android/java_sources.gni
@@ -605,6 +605,7 @@ "java/src/org/chromium/chrome/browser/media/router/cast/CastSession.java", "java/src/org/chromium/chrome/browser/media/router/cast/CastSessionImpl.java", "java/src/org/chromium/chrome/browser/media/router/cast/CastSessionInfo.java", + "java/src/org/chromium/chrome/browser/media/router/cast/ChromeCastSessionManager.java", "java/src/org/chromium/chrome/browser/media/router/cast/ClientRecord.java", "java/src/org/chromium/chrome/browser/media/router/cast/CreateRouteRequest.java", "java/src/org/chromium/chrome/browser/media/router/cast/DiscoveryCallback.java", @@ -1909,6 +1910,7 @@ "junit/src/org/chromium/chrome/browser/media/router/cast/CastMediaRouteProviderTest.java", "junit/src/org/chromium/chrome/browser/media/router/cast/CastMediaSourceTest.java", "junit/src/org/chromium/chrome/browser/media/router/cast/CastMessageHandlerTest.java", + "junit/src/org/chromium/chrome/browser/media/router/cast/ChromeCastSessionManagerTest.java", "junit/src/org/chromium/chrome/browser/media/router/cast/DiscoveryCallbackTest.java", "junit/src/org/chromium/chrome/browser/media/router/cast/JSONTestUtils.java", "junit/src/org/chromium/chrome/browser/media/router/cast/TestUtils.java",
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/ShareIntentTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/ShareIntentTest.java index 8a2a771..34949935 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/ShareIntentTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/ShareIntentTest.java
@@ -54,7 +54,7 @@ * activity and redirects the calls to the methods to the actual activity. */ private static class MockChromeActivity extends ChromeTabbedActivity { - private Object mLock = new Object(); + private final Object mLock = new Object(); private boolean mCheckCompleted = false; private ChromeActivity mActivity = null;
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/share/ShareMenuActionHandlerIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/share/ShareMenuActionHandlerIntegrationTest.java index 621b794..cba7e83b 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/share/ShareMenuActionHandlerIntegrationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/share/ShareMenuActionHandlerIntegrationTest.java
@@ -62,7 +62,7 @@ try { verifyShareUrl(httpsCanonicalUrl, "https://examplehttps.com/"); - verifyShareUrl(httpCanonicalUrl, httpCanonicalUrl); + verifyShareUrl(httpCanonicalUrl, "http://examplehttp.com/"); verifyShareUrl(noCanonicalUrl, noCanonicalUrl); } finally { testServer.stopAndDestroyServer();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/share/ShareMenuActionHandlerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/share/ShareMenuActionHandlerTest.java index 97a8bbe..0083ea2 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/share/ShareMenuActionHandlerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/share/ShareMenuActionHandlerTest.java
@@ -99,17 +99,25 @@ final String otherHttpUrl = "http://eek.com"; final String httpsUrl = "https://blah.com"; final String otherHttpsUrl = "https://eek.com"; + final String ftpUrl = "ftp://blah.com"; + final String contentUrl = "content://eek.com"; - // HTTP, HTTP + // HTTP Display URL, HTTP Canonical URL -> HTTP Display URL Assert.assertEquals(httpUrl, ShareMenuActionHandler.getUrlToShare(httpUrl, otherHttpUrl)); - // HTTP, HTTPS + // HTTP Display URL, HTTPS Canonical URL -> HTTP Display URL Assert.assertEquals(httpUrl, ShareMenuActionHandler.getUrlToShare(httpUrl, httpsUrl)); - // HTTPS, HTTP - Assert.assertEquals(httpsUrl, ShareMenuActionHandler.getUrlToShare(httpsUrl, httpUrl)); + // HTTPS Display URL, HTTP Canonical URL -> HTTP Canonical URL + Assert.assertEquals(httpUrl, ShareMenuActionHandler.getUrlToShare(httpsUrl, httpUrl)); + // HTTPS Display URL, HTTPS Canonical URL -> HTTPS Canonical URL Assert.assertEquals(httpsUrl, ShareMenuActionHandler.getUrlToShare(httpsUrl, httpsUrl)); Assert.assertEquals( otherHttpsUrl, ShareMenuActionHandler.getUrlToShare(httpsUrl, otherHttpsUrl)); + + // HTTPS Display URL, FTP URL -> HTTPS Display URL + Assert.assertEquals(httpsUrl, ShareMenuActionHandler.getUrlToShare(httpsUrl, ftpUrl)); + // HTTPS Display URL, Content URL -> HTTPS Display URL + Assert.assertEquals(httpsUrl, ShareMenuActionHandler.getUrlToShare(httpsUrl, contentUrl)); } private static class MockTab extends Tab {
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/media/router/cast/CastMediaRouteProviderTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/media/router/cast/CastMediaRouteProviderTest.java index 057c3fd..097ab0cf 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/media/router/cast/CastMediaRouteProviderTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/media/router/cast/CastMediaRouteProviderTest.java
@@ -78,11 +78,11 @@ setUpMediaRouter(mock(MediaRouter.class)); CastSession mockSession = mock(CastSession.class); - mProvider.onSessionCreated(mockSession); + mProvider.onSessionStarted(mockSession); MediaRoute route = new MediaRoute("sink", SUPPORTED_SOURCE, ""); mProvider.addRoute(route, "", -1); - mProvider.onSessionClosed(); + mProvider.onSessionEnded(); verify(mMockManager).onRouteClosed(route.id); } @@ -110,7 +110,7 @@ MediaRoute route = new MediaRoute("sinkId", SUPPORTED_AUTOJOIN_SOURCE, "presentationId"); mProvider.addRoute(route, "https://example.com", 1); - mProvider.onSessionCreated(mockSession); + mProvider.onSessionStarted(mockSession); mProvider.joinRoute(SUPPORTED_AUTOJOIN_SOURCE, "auto-join", "https://example.com", 1, -1); verify(mMockManager) @@ -129,7 +129,7 @@ MediaRoute route = new MediaRoute("sinkId", SUPPORTED_AUTOJOIN_SOURCE, "presentationId"); mProvider.addRoute(route, "https://example.com", 1); - mProvider.onSessionCreated(mockSession); + mProvider.onSessionStarted(mockSession); mProvider.joinRoute(SUPPORTED_AUTOJOIN_SOURCE, "auto-join", "", 1, -1); verify(mMockManager).onRouteRequestError("No matching route", -1); @@ -146,7 +146,7 @@ MediaRoute route = new MediaRoute("sinkId", SUPPORTED_AUTOJOIN_SOURCE, "presentationId"); mProvider.addRoute(route, "", 1); - mProvider.onSessionCreated(mockSession); + mProvider.onSessionStarted(mockSession); mProvider.joinRoute(SUPPORTED_AUTOJOIN_SOURCE, "auto-join", "", 1, -1); verify(mMockManager).onRouteRequestError("No matching route", -1);
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/media/router/cast/ChromeCastSessionManagerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/media/router/cast/ChromeCastSessionManagerTest.java new file mode 100644 index 0000000..4cc2a86 --- /dev/null +++ b/chrome/android/junit/src/org/chromium/chrome/browser/media/router/cast/ChromeCastSessionManagerTest.java
@@ -0,0 +1,208 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.media.router.cast; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; +import org.robolectric.annotation.Config; + +import org.chromium.base.test.util.Feature; +import org.chromium.chrome.browser.media.router.cast.ChromeCastSessionManager.CastSessionLaunchRequest; +import org.chromium.chrome.browser.media.router.cast.ChromeCastSessionManager.CastSessionManagerListener; +import org.chromium.testing.local.LocalRobolectricTestRunner; + +/** + * Robolectric tests for {@link CastMediaSource} class. + */ +@RunWith(LocalRobolectricTestRunner.class) +@Config(manifest = Config.NONE) +public class ChromeCastSessionManagerTest { + private CastSessionManagerListener mListener; + private CastSessionLaunchRequest mRequest; + private CastSession mSession; + private ChromeCastSessionManager mManager; + + // Mocks to be used in scenarios where multiple sessions are launched. + private CastSessionManagerListener mAltListener; + private CastSessionLaunchRequest mAltRequest; + private CastSession mAltSession; + + @Before + public void setup() { + mListener = mock(CastSessionManagerListener.class); + mRequest = mock(CastSessionLaunchRequest.class); + mSession = mock(CastSession.class); + + doReturn(mListener).when(mRequest).getSessionListener(); + + mManager = ChromeCastSessionManager.get(); + } + + private void setupAlternateMocks() { + mAltListener = mock(CastSessionManagerListener.class); + mAltRequest = mock(CastSessionLaunchRequest.class); + mAltSession = mock(CastSession.class); + + doReturn(mAltListener).when(mAltRequest).getSessionListener(); + } + + @After + public void cleanup() { + ChromeCastSessionManager.resetInstanceForTesting(); + } + + private void setupLaunch( + CastSessionLaunchRequest request, CastSession session, boolean success) { + doAnswer(new Answer() { + @Override + public Object answer(InvocationOnMock invocation) { + if (success) + mManager.onSessionStarted(session); + else + mManager.onSessionStartFailed(); + + return null; + } + }) + .when(request) + .start(any()); + } + + @Test + @Feature({"MediaRouter"}) + public void testLaunchingRequest() { + mManager.requestSessionLaunch(mRequest); + verify(mRequest).start(any()); + verify(mListener).onSessionStarting(mRequest); + } + + @Test + @Feature({"MediaRouter"}) + public void testSessionRequestSucceeded() { + // Setup a successful launch. + setupLaunch(mRequest, mSession, true); + + mManager.requestSessionLaunch(mRequest); + verify(mListener).onSessionStarted(mSession); + } + + @Test + @Feature({"MediaRouter"}) + public void testSessionRequestFailed() { + // Setup a failed launch. + setupLaunch(mRequest, null, false); + + mManager.requestSessionLaunch(mRequest); + verify(mListener).onSessionStartFailed(); + } + + @Test + @Feature({"MediaRouter"}) + public void testNewRequestWaitOnSessionClose() { + // Make sure |mManager| currently has a session. + setupAlternateMocks(); + setupLaunch(mAltRequest, mAltSession, true); + mManager.requestSessionLaunch(mAltRequest); + + // Simulate the session taking a while to stop. + doNothing().when(mAltSession).stopApplication(); + + // Launching a new request should stop the current session, and wait until it has has + // stopped before launching the request. + mManager.requestSessionLaunch(mRequest); + verify(mAltSession).stopApplication(); + verify(mRequest, never()).start(any()); + } + + @Test + @Feature({"MediaRouter"}) + public void testNewSessionStopsOldOnes() { + // Make sure |mManager| currently has a session. + setupAlternateMocks(); + setupLaunch(mAltRequest, mAltSession, true); + mManager.requestSessionLaunch(mAltRequest); + + // Setup the current session to successfuly stop. + doAnswer(new Answer() { + @Override + public Object answer(InvocationOnMock invocation) { + mManager.onSessionEnded(); + return null; + } + }) + .when(mAltSession) + .stopApplication(); + + // The old observer should be notified of a session closing. + // The new request should be launched + mManager.requestSessionLaunch(mRequest); + verify(mAltListener).onSessionEnded(); + verify(mRequest).start(any()); + } + + // Makes sure we can override pending requests while waiting for an old + // session to close. + @Test + @Feature({"MediaRouter"}) + public void testNewRequestOverwritePendingOnes() { + // Make sure |mManager| currently has a session. + setupAlternateMocks(); + setupLaunch(mAltRequest, mAltSession, true); + mManager.requestSessionLaunch(mAltRequest); + + // Simulate the current session taking a while to stop. + doNothing().when(mAltSession).stopApplication(); + + // Make sure the queued request isn't launched immediately. + CastSessionLaunchRequest middleRequest = mock(CastSessionLaunchRequest.class); + mManager.requestSessionLaunch(middleRequest); + + // Queue up another pending request. + mManager.requestSessionLaunch(mRequest); + + // Simulate |mAltSession| finally closing. + mManager.onSessionEnded(); + + // The first request shouldn't have started. + verify(middleRequest, never()).start(any()); + // The last request should have been started. + verify(mRequest).start(any()); + } + + // Makes sure new requests are dropped when we are waiting for a request to + // complete its launch. + @Test + @Feature({"MediaRouter"}) + public void testRequestAreDroppedWhenLaunching() { + setupAlternateMocks(); + + // Simulate a slow to launch request. + doNothing().when(mAltRequest).start(any()); + mManager.requestSessionLaunch(mAltRequest); + + // Queue up a new request whilst launching. + // Make this new request isn't started. + setupLaunch(mRequest, mSession, true); + mManager.requestSessionLaunch(mRequest); + verify(mRequest, never()).start(any()); + + // Simulate the completion of the slow request. + // Make sure the 2nd request was not launched. + mManager.onSessionStarted(mAltSession); + verify(mRequest, never()).start(any()); + } +}
diff --git a/chrome/app/chrome_crash_reporter_client_win.cc b/chrome/app/chrome_crash_reporter_client_win.cc index 27e3a65..c8e7b60 100644 --- a/chrome/app/chrome_crash_reporter_client_win.cc +++ b/chrome/app/chrome_crash_reporter_client_win.cc
@@ -88,9 +88,6 @@ // media/: {kZeroEncodeDetails, kSmallSize}, - // Temporary for https://crbug.com/685996. - {"user-cloud-policy-manager-connect-trace", kMediumSize}, - // TODO(sunnyps): Remove after fixing crbug.com/724999. {"gl-context-set-current-stack-trace", kMediumSize}, };
diff --git a/chrome/app/chrome_main.cc b/chrome/app/chrome_main.cc index 932c48d1..307e0d3b 100644 --- a/chrome/app/chrome_main.cc +++ b/chrome/app/chrome_main.cc
@@ -115,13 +115,14 @@ params.create_discardable_memory = true; params.env_mode = aura::Env::Mode::MUS; } - if (service_manager::ServiceManagerIsRemote() || - command_line->HasSwitch(switches::kMash)) { +#if defined(OS_CHROMEOS) + if (command_line->HasSwitch(switches::kMash)) { params.create_discardable_memory = false; params.env_mode = aura::Env::Mode::MUS; base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( switches::kMus, switches::kMusHostVizValue); } +#endif // defined(OS_CHROMEOS) #endif // BUILDFLAG(ENABLE_MUS) int rv = content::ContentMain(params);
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index ff19842..eb761b8c 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -5678,51 +5678,6 @@ </message> </if> - <!-- MD Feedback Strings --> - <message name="IDS_MD_FEEDBACK_DIALOG_TITLE" desc="Text for feedback dialog. This appears in the OS taskbar and the top of the dialog window when the title is shown."> - Feedback - </message> - <message name="IDS_MD_FEEDBACK_HEADING" desc="Header text of the feedback dialog."> - Tell us what's happening - </message> - <message name="IDS_MD_FEEDBACK_OPEN_ENDED_LABEL" desc="Label for the open ended feedback input box that is initially blank. Users can write open ended feedback before submission."> - Please enter your feedback here. - </message> - <message name="IDS_MD_FEEDBACK_URL_LABEL" desc="Label for the text input that may be prepopulated with the URL to be reported. Users are able to modify this text before submission.."> - URL - </message> - <message name="IDS_MD_FEEDBACK_USER_EMAIL_LABEL" desc="Label for the text input that may be prepopulated with the user's email. Users are able to modify this text before submission."> - Email - </message> - <message name="IDS_MD_FEEDBACK_CANCEL_BUTTON" desc="Text for Cancel button of the feedback dialog. When clicked, the dialog will close without sending the feedback."> - Cancel - </message> - <message name="IDS_MD_FEEDBACK_SEND_REPORT_BUTTON" desc="Text for Send Report button of the feedback dialog. When clicked, the feedback report will be sent."> - Send - </message> - <message name="IDS_MD_FEEDBACK_SCREENSHOT_LABEL" desc="Label for the checkbox to indicate whether the shown screenshot should be included in the feedback report."> - Include this screenshot - </message> - <message name="IDS_MD_FEEDBACK_SEND_SYSTEM_INFO_LABEL" desc="Label for the checkbox to indicate whether the system info should be included in the feedback report."> - Send system information - </message> - <if expr="_google_chrome"> - <message name="IDS_MD_FEEDBACK_PRIVACY_NOTE" desc="Text for the privacy note shown on the feedback dialog."> - Your Chrome and operating system version will be submitted in addition - to any information you choose to include above. If you include your email - address, Google may contact you regarding your feedback report. This feedback - is used to diagnose problems and help improve Chrome. Any personal information - you submit, whether explicitly or incidentally will be protected in - accordance with our privacy policies.<ph name="BEGIN_BOLD"><strong> - </ph> By submitting this feedback, you agree that Google may use feedback - that you provide to improve any Google product or service. - <ph name="END_BOLD"></strong></ph> - </message> - </if> - <message name="IDS_MD_FEEDBACK_ADDITIONAL_INFO_LABEL" desc="Text for the group label to indicate that some fields are optional."> - Additional info (optional) - </message> - <!-- Clear Browsing Data --> <message name="IDS_CLEAR_BROWSING_DATA_TITLE" desc="Dialog title"> Clear browsing data @@ -8530,13 +8485,19 @@ <!-- Translate Bubble --> <if expr="toolkit_views or is_macosx"> <if expr="not use_titlecase"> - <message name="IDS_TRANSLATE_BUBBLE_BEFORE_TRANSLATE" desc="Text to show for the translate bubble label when that page is in specified language and ask if should translate."> - Would you like to translate this page? + <message name="IDS_TRANSLATE_BUBBLE_BEFORE_TRANSLATE_TITLE" desc="Title text for the translate bubble when asking to translate a page."> + Do you want to translate this page? </message> <message name="IDS_TRANSLATE_BUBBLE_BEFORE_TRANSLATE_NEW" desc="Text to show for the translate bubble label when that page is in specified language and ask if should translate."> Do you want Google to translate this page from <ph name="source_language">$1<ex>Spanish</ex></ph> to <ph name="target_language">$2<ex>English</ex></ph>? </message> - <message name="IDS_TRANSLATE_BUBBLE_ADVANCED" desc="Text to show for the translate bubble link label to jump to the advanced panel."> + <message name="IDS_TRANSLATE_BUBBLE_ADVANCED_LINK" desc="Text to show for the translate bubble link label to jump to the advanced panel."> + Options + </message> + <message name="IDS_TRANSLATE_BUBBLE_ADVANCED_BUTTON" desc="Text to show for the translate bubble button to jump to the advanced panel."> + More options + </message> + <message name="IDS_TRANSLATE_BUBBLE_ADVANCED_TITLE" desc="Title text for the options panel."> Options </message> <message name="IDS_TRANSLATE_BUBBLE_ACCEPT" desc="Text to show for the translate bubble button to accept translation."> @@ -8557,6 +8518,9 @@ <message name="IDS_TRANSLATE_BUBBLE_TRANSLATED" desc="Text to show for the translate bubble label when the page has been translated from one language to another"> This page has been translated. </message> + <message name="IDS_TRANSLATE_BUBBLE_TRANSLATED_TITLE" desc="Title text for the translate bubble label when the page has been translated from one language to another"> + This page has been translated + </message> <message name="IDS_TRANSLATE_BUBBLE_REVERT" desc="Text to show for the translate bubble button to revert translation of translated page"> Show original </message> @@ -8575,6 +8539,9 @@ <message name="IDS_TRANSLATE_BUBBLE_COULD_NOT_TRANSLATE" desc="Text to show for the translate bubble label when the page could not be translated."> This page could not be translated. </message> + <message name="IDS_TRANSLATE_BUBBLE_COULD_NOT_TRANSLATE_TITLE" desc="Title text for the translate bubble label when the page could not be translated."> + This page could not be translated + </message> <message name="IDS_TRANSLATE_BUBBLE_PAGE_LANGUAGE" desc="Text to show for the translate bubble label next to the combobox of the page language"> Page language: </message> @@ -8586,13 +8553,19 @@ </message> </if> <if expr="use_titlecase"> - <message name="IDS_TRANSLATE_BUBBLE_BEFORE_TRANSLATE" desc="In Title Case: Text to show for the translate bubble label when that page is in specified language and ask if should translate."> - Would You Like To Translate This Page? + <message name="IDS_TRANSLATE_BUBBLE_BEFORE_TRANSLATE_TITLE" desc="In Title Case: Title text for the translate bubble when asking to translate a page."> + Do You Want To Translate This Page? </message> <message name="IDS_TRANSLATE_BUBBLE_BEFORE_TRANSLATE_NEW" desc="In Title Case: Text to show for the translate bubble label when that page is in specified language and ask if should translate."> Do You Want Google To Translate This Page From <ph name="source_language">$1<ex>Spanish</ex></ph> To <ph name="target_language">$2<ex>English</ex></ph>? </message> - <message name="IDS_TRANSLATE_BUBBLE_ADVANCED" desc="In Title Case: Text to show for the translate bubble link label to jump to the advanced panel."> + <message name="IDS_TRANSLATE_BUBBLE_ADVANCED_LINK" desc="In Title Case: Text to show for the translate bubble link label to jump to the advanced panel."> + Options + </message> + <message name="IDS_TRANSLATE_BUBBLE_ADVANCED_BUTTON" desc="In Title Case: Text to show for the translate bubble button to jump to the advanced panel."> + More Options + </message> + <message name="IDS_TRANSLATE_BUBBLE_ADVANCED_TITLE" desc="In Title Case: Title text for the options panel."> Options </message> <message name="IDS_TRANSLATE_BUBBLE_ACCEPT" desc="In Title Case: Text to show for the translate bubble button to accept translation."> @@ -8613,6 +8586,9 @@ <message name="IDS_TRANSLATE_BUBBLE_TRANSLATED" desc="In Title Case: Text to show for the translate bubble label when the page has been translated from one language to another"> This Page Has Been Translated. </message> + <message name="IDS_TRANSLATE_BUBBLE_TRANSLATED_TITLE" desc="In Title Case: Title text for the translate bubble label when the page has been translated from one language to another"> + This Page Has Been Translated + </message> <message name="IDS_TRANSLATE_BUBBLE_REVERT" desc="In Title Case: Text to show for the translate bubble button to revert translation of translated page"> Show Original </message> @@ -8631,6 +8607,9 @@ <message name="IDS_TRANSLATE_BUBBLE_COULD_NOT_TRANSLATE" desc="In Title Case: Text to show for the translate bubble label when the page could not be translated."> This Page Could Not Be Translated. </message> + <message name="IDS_TRANSLATE_BUBBLE_COULD_NOT_TRANSLATE_TITLE" desc="In Title Case: Title text for the translate bubble label when the page could not be translated."> + This Page Could Not Be Translated + </message> <message name="IDS_TRANSLATE_BUBBLE_PAGE_LANGUAGE" desc="In Title Case: Text to show for the translate bubble label next to the combobox of the page language"> Page Language: </message>
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index b4573a2..dab617f 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -24,6 +24,7 @@ import("//sandbox/features.gni") import("//third_party/protobuf/proto_library.gni") import("//ui/base/ui_features.gni") +import("//build/buildflag_header.gni") # //build/config/android/rules.gni imports //tools/grit/grit_rule.gni, which # produces a conflict for the "grit" template so we have to only include one. @@ -33,6 +34,10 @@ import("//tools/grit/grit_rule.gni") } +if (enable_vr) { + import("//chrome/browser/vr/features.gni") +} + additional_modules_list_file = "$root_gen_dir/chrome/browser/internal/additional_modules_list.txt" @@ -56,6 +61,13 @@ } } +if (enable_vr) { + buildflag_header("vr_build_features") { + header = "vr_features.h" + flags = [ "REGISTER_VR_ASSETS_COMPONENT=$register_vr_assets_component" ] + } +} + # Use a static library here because many test binaries depend on this but don't # require many files from it. This makes linking more efficient. split_static_library("browser") { @@ -892,6 +904,8 @@ "page_load_metrics/observers/from_gws_page_load_metrics_observer.h", "page_load_metrics/observers/google_captcha_observer.cc", "page_load_metrics/observers/google_captcha_observer.h", + "page_load_metrics/observers/histogram_suffixes.cc", + "page_load_metrics/observers/histogram_suffixes.h", "page_load_metrics/observers/https_engagement_metrics/https_engagement_page_load_metrics_observer.cc", "page_load_metrics/observers/https_engagement_metrics/https_engagement_page_load_metrics_observer.h", "page_load_metrics/observers/https_engagement_metrics/https_engagement_service.cc", @@ -1731,6 +1745,7 @@ "//crypto", "//crypto:platform", "//device/base", + "//device/geolocation", "//device/usb/mojo", "//device/usb/public/interfaces", "//device/vr/features", @@ -3897,6 +3912,8 @@ "spellchecker/spellcheck_factory.h", "spellchecker/spellcheck_hunspell_dictionary.cc", "spellchecker/spellcheck_hunspell_dictionary.h", + "spellchecker/spellcheck_language_policy_handler.cc", + "spellchecker/spellcheck_language_policy_handler.h", "spellchecker/spellcheck_message_filter_platform_mac.cc", "spellchecker/spellcheck_service.cc", "spellchecker/spellcheck_service.h", @@ -4028,8 +4045,12 @@ sources += [ "component_updater/vr_assets_component_installer.cc", "component_updater/vr_assets_component_installer.h", + "vr_features.h", ] - deps += [ "//chrome/browser/vr:vr_common" ] + deps += [ + ":vr_build_features", + "//chrome/browser/vr:vr_common", + ] } if (enable_wayland_server) {
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index dd2767f..8d0b0f0 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -1245,7 +1245,7 @@ SINGLE_VALUE_TYPE(switches::kShowOverdrawFeedback)}, {"enable-draw-occlusion", flag_descriptions::kEnableDrawOcclusionName, flag_descriptions::kEnableDrawOcclusionDescription, kOsAll, - SINGLE_VALUE_TYPE(switches::kShowOverdrawFeedback)}, + SINGLE_VALUE_TYPE(switches::kEnableDrawOcclusion)}, {"ui-disable-partial-swap", flag_descriptions::kUiPartialSwapName, flag_descriptions::kUiPartialSwapDescription, kOsAll, SINGLE_DISABLE_VALUE_TYPE(switches::kUIDisablePartialSwap)}, @@ -1460,9 +1460,11 @@ ENABLE_DISABLE_VALUE_TYPE( chromeos::switches::kEnableNetworkPortalNotification, chromeos::switches::kDisableNetworkPortalNotification)}, - {"network-settings-config", flag_descriptions::kNetworkSettingsConfigName, - flag_descriptions::kNetworkSettingsConfigDescription, kOsCrOS, - SINGLE_VALUE_TYPE(chromeos::switches::kNetworkSettingsConfig)}, + {"disable-network-settings-config", + flag_descriptions::kDisableNetworkSettingsConfigName, + flag_descriptions::kDisableNetworkSettingsConfigDescription, kOsCrOS, + SINGLE_DISABLE_VALUE_TYPE( + chromeos::switches::kDisableNetworkSettingsConfig)}, #endif // OS_CHROMEOS #if BUILDFLAG(ENABLE_PLUGINS) {"allow-nacl-socket-api", flag_descriptions::kAllowNaclSocketApiName,
diff --git a/chrome/browser/android/preferences/website_preference_bridge.cc b/chrome/browser/android/preferences/website_preference_bridge.cc index c83e56ce..417b373 100644 --- a/chrome/browser/android/preferences/website_preference_bridge.cc +++ b/chrome/browser/android/preferences/website_preference_bridge.cc
@@ -45,7 +45,7 @@ #include "jni/WebsitePreferenceBridge_jni.h" #include "net/base/registry_controlled_domains/registry_controlled_domain.h" #include "storage/browser/quota/quota_manager.h" -#include "storage/common/quota/quota_status_code.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" #include "url/origin.h" #include "url/url_constants.h" @@ -679,7 +679,7 @@ } void OnStorageInfoCleared(const ScopedJavaGlobalRef<jobject>& java_callback, - storage::QuotaStatusCode code) { + blink::QuotaStatusCode code) { DCHECK_CURRENTLY_ON(BrowserThread::UI); Java_StorageInfoClearedCallback_onStorageInfoCleared(
diff --git a/chrome/browser/android/vr_shell/vr_shell_gl.cc b/chrome/browser/android/vr_shell/vr_shell_gl.cc index 12348c5..f914eb7 100644 --- a/chrome/browser/android/vr_shell/vr_shell_gl.cc +++ b/chrome/browser/android/vr_shell/vr_shell_gl.cc
@@ -1296,25 +1296,16 @@ binding_.Close(); } -void VrShellGl::OnAssetsLoaded(bool success, - std::string environment, +void VrShellGl::OnAssetsLoaded(vr::AssetsLoadStatus status, + std::unique_ptr<SkBitmap> background_image, const base::Version& component_version) { - if (success && environment == "zq7sax8chrtjchxysh7b\n") { + // TODO(793407): Handle adding background image to UI. + if (status == vr::AssetsLoadStatus::kSuccess) { VLOG(1) << "Successfully loaded VR assets component"; } else { VLOG(1) << "Failed to load VR assets component"; } - if (!success) { - browser_->OnAssetsLoaded(vr::AssetsLoadStatus::kParseFailure, - component_version); - return; - } - if (environment != "zq7sax8chrtjchxysh7b\n") { - browser_->OnAssetsLoaded(vr::AssetsLoadStatus::kInvalidContent, - component_version); - return; - } - browser_->OnAssetsLoaded(vr::AssetsLoadStatus::kSuccess, component_version); + browser_->OnAssetsLoaded(status, component_version); } } // namespace vr_shell
diff --git a/chrome/browser/android/vr_shell/vr_shell_gl.h b/chrome/browser/android/vr_shell/vr_shell_gl.h index a95f111..11a93c4 100644 --- a/chrome/browser/android/vr_shell/vr_shell_gl.h +++ b/chrome/browser/android/vr_shell/vr_shell_gl.h
@@ -17,6 +17,7 @@ #include "base/single_thread_task_runner.h" #include "chrome/browser/android/vr_shell/android_vsync_helper.h" #include "chrome/browser/android/vr_shell/vr_controller.h" +#include "chrome/browser/vr/assets_load_status.h" #include "chrome/browser/vr/content_input_delegate.h" #include "chrome/browser/vr/controller_mesh.h" #include "chrome/browser/vr/fps_meter.h" @@ -177,8 +178,8 @@ void ClosePresentationBindings(); - void OnAssetsLoaded(bool success, - std::string environment, + void OnAssetsLoaded(vr::AssetsLoadStatus status, + std::unique_ptr<SkBitmap> background_image, const base::Version& component_version); // samplerExternalOES texture data for WebVR content image.
diff --git a/chrome/browser/apps/guest_view/web_view_browsertest.cc b/chrome/browser/apps/guest_view/web_view_browsertest.cc index 5b4474d..434ccb8 100644 --- a/chrome/browser/apps/guest_view/web_view_browsertest.cc +++ b/chrome/browser/apps/guest_view/web_view_browsertest.cc
@@ -72,6 +72,7 @@ #include "content/public/test/test_navigation_observer.h" #include "content/public/test/test_renderer_host.h" #include "content/public/test/test_utils.h" +#include "device/geolocation/public/cpp/scoped_geolocation_overrider.h" #include "extensions/browser/api/declarative/rules_registry.h" #include "extensions/browser/api/declarative/rules_registry_service.h" #include "extensions/browser/api/declarative/test_rules_registry.h" @@ -514,7 +515,8 @@ // Mock out geolocation for geolocation specific tests. if (!strncmp(test_info->name(), "GeolocationAPI", strlen("GeolocationAPI"))) { - ui_test_utils::OverrideGeolocation(10, 20); + geolocation_overrider_ = + std::make_unique<device::ScopedGeolocationOverrider>(10, 20); } } @@ -839,6 +841,7 @@ return !strncmp(test_info->name(), name, strlen(name)); } + std::unique_ptr<device::ScopedGeolocationOverrider> geolocation_overrider_; std::unique_ptr<content::FakeSpeechRecognitionManager> fake_speech_recognition_manager_;
diff --git a/chrome/browser/banners/app_banner_manager.cc b/chrome/browser/banners/app_banner_manager.cc index 22b96ba..789c10a 100644 --- a/chrome/browser/banners/app_banner_manager.cc +++ b/chrome/browser/banners/app_banner_manager.cc
@@ -409,14 +409,16 @@ // Any existing binding is invalid when we send a new beforeinstallprompt. ResetBindings(); + blink::mojom::AppBannerControllerPtr controller; web_contents()->GetMainFrame()->GetRemoteInterfaces()->GetInterface( - mojo::MakeRequest(&controller_)); + mojo::MakeRequest(&controller)); blink::mojom::AppBannerServicePtr banner_proxy; binding_.Bind(mojo::MakeRequest(&banner_proxy)); - controller_->BannerPromptRequest( + controller->BannerPromptRequest( std::move(banner_proxy), mojo::MakeRequest(&event_), {GetBannerType()}, - base::Bind(&AppBannerManager::OnBannerPromptReply, GetWeakPtr())); + base::BindOnce(&AppBannerManager::OnBannerPromptReply, GetWeakPtr(), + base::Passed(&controller))); } void AppBannerManager::UpdateState(State state) { @@ -541,7 +543,6 @@ void AppBannerManager::ResetBindings() { binding_.Close(); - controller_.reset(); event_.reset(); } @@ -610,12 +611,9 @@ } void AppBannerManager::OnBannerPromptReply( + blink::mojom::AppBannerControllerPtr controller, blink::mojom::AppBannerPromptReply reply, const std::string& referrer) { - // We don't need the controller any more, so reset it so the Blink-side object - // is destroyed. - controller_.reset(); - // The renderer might have requested the prompt to be canceled. They may // request that it is redisplayed later, so don't Terminate() here. However, // log that the cancelation was requested, so Terminate() can be called if a
diff --git a/chrome/browser/banners/app_banner_manager.h b/chrome/browser/banners/app_banner_manager.h index c2470b7..d804c605 100644 --- a/chrome/browser/banners/app_banner_manager.h +++ b/chrome/browser/banners/app_banner_manager.h
@@ -290,8 +290,10 @@ // Called after the manager sends a message to the renderer regarding its // intention to show a prompt. The renderer will send a message back with the // opportunity to cancel. - virtual void OnBannerPromptReply(blink::mojom::AppBannerPromptReply reply, - const std::string& referrer); + virtual void OnBannerPromptReply( + blink::mojom::AppBannerControllerPtr controller, + blink::mojom::AppBannerPromptReply reply, + const std::string& referrer); // Does the non-platform specific parts of showing the app banner. void ShowBanner(); @@ -323,7 +325,6 @@ // Mojo bindings and interface pointers. mojo::Binding<blink::mojom::AppBannerService> binding_; blink::mojom::AppBannerEventPtr event_; - blink::mojom::AppBannerControllerPtr controller_; // If a banner is requested before the page has finished loading, defer // triggering the pipeline until the load is complete.
diff --git a/chrome/browser/banners/app_banner_manager_browsertest.cc b/chrome/browser/banners/app_banner_manager_browsertest.cc index e8417e2..8db7900 100644 --- a/chrome/browser/banners/app_banner_manager_browsertest.cc +++ b/chrome/browser/banners/app_banner_manager_browsertest.cc
@@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <utility> #include <vector> #include "base/bind.h" @@ -116,9 +117,11 @@ } } - void OnBannerPromptReply(blink::mojom::AppBannerPromptReply reply, + void OnBannerPromptReply(blink::mojom::AppBannerControllerPtr controller, + blink::mojom::AppBannerPromptReply reply, const std::string& referrer) override { - AppBannerManager::OnBannerPromptReply(reply, referrer); + AppBannerManager::OnBannerPromptReply(std::move(controller), reply, + referrer); if (on_banner_prompt_reply_) { base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, on_banner_prompt_reply_);
diff --git a/chrome/browser/browsing_data/browsing_data_quota_helper_impl.cc b/chrome/browser/browsing_data/browsing_data_quota_helper_impl.cc index 7230d80b..929cda6a 100644 --- a/chrome/browser/browsing_data/browsing_data_quota_helper_impl.cc +++ b/chrome/browser/browsing_data/browsing_data_quota_helper_impl.cc
@@ -170,5 +170,5 @@ } void BrowsingDataQuotaHelperImpl::DidRevokeHostQuota( - storage::QuotaStatusCode /*status*/, + blink::QuotaStatusCode /*status*/, int64_t /*quota*/) {}
diff --git a/chrome/browser/browsing_data/browsing_data_quota_helper_impl.h b/chrome/browser/browsing_data/browsing_data_quota_helper_impl.h index 482ab89..569ff61 100644 --- a/chrome/browser/browsing_data/browsing_data_quota_helper_impl.h +++ b/chrome/browser/browsing_data/browsing_data_quota_helper_impl.h
@@ -18,6 +18,7 @@ #include "base/memory/weak_ptr.h" #include "chrome/browser/browsing_data/browsing_data_quota_helper.h" #include "storage/common/quota/quota_types.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" class GURL; @@ -65,7 +66,7 @@ QuotaInfoMap* quota_info); void RevokeHostQuotaOnIOThread(const std::string& host); - void DidRevokeHostQuota(storage::QuotaStatusCode status, int64_t quota); + void DidRevokeHostQuota(blink::QuotaStatusCode status, int64_t quota); scoped_refptr<storage::QuotaManager> quota_manager_;
diff --git a/chrome/browser/browsing_data/browsing_data_quota_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_quota_helper_unittest.cc index 46562bc..8d88d37 100644 --- a/chrome/browser/browsing_data/browsing_data_quota_helper_unittest.cc +++ b/chrome/browser/browsing_data/browsing_data_quota_helper_unittest.cc
@@ -90,8 +90,8 @@ weak_factory_.GetWeakPtr())); } - void GotPersistentHostQuota(storage::QuotaStatusCode status, int64_t quota) { - EXPECT_EQ(storage::kQuotaStatusOk, status); + void GotPersistentHostQuota(blink::QuotaStatusCode status, int64_t quota) { + EXPECT_EQ(blink::QuotaStatusCode::kOk, status); quota_ = quota; }
diff --git a/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc b/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc index b1c0308f..20145e48 100644 --- a/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc +++ b/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc
@@ -282,12 +282,14 @@ const int kFramesPowerEfficient = 0; const url::Origin kOrigin = url::Origin::Create(GURL("http://example.com")); const bool kIsTopFrame = true; + const uint64_t kPlayerId = 1234u; { base::RunLoop run_loop; video_decode_perf_history->SavePerfRecord( kOrigin, kIsTopFrame, kProfile, kSize, kFrameRate, kFramesDecoded, - kFramesDropped, kFramesPowerEfficient, run_loop.QuitWhenIdleClosure()); + kFramesDropped, kFramesPowerEfficient, kPlayerId, + run_loop.QuitWhenIdleClosure()); run_loop.Run(); }
diff --git a/chrome/browser/chrome_browser_main_linux.cc b/chrome/browser/chrome_browser_main_linux.cc index 0b6ca73..f41c5a6 100644 --- a/chrome/browser/chrome_browser_main_linux.cc +++ b/chrome/browser/chrome_browser_main_linux.cc
@@ -26,7 +26,6 @@ #if !defined(OS_CHROMEOS) #include "base/command_line.h" #include "base/linux_util.h" -#include "chrome/browser/dbus/dbus_thread_linux.h" #include "chrome/common/chrome_paths_internal.h" #include "chrome/common/chrome_switches.h" #include "components/os_crypt/key_storage_config_linux.h" @@ -71,10 +70,9 @@ parsed_command_line().GetSwitchValueASCII(switches::kPasswordStore); // Forward the product name config->product_name = l10n_util::GetStringUTF8(IDS_PRODUCT_NAME); - // OSCrypt may target backends, which require calls from specific threads. + // OSCrypt may target keyring, which requires calls from the main thread. config->main_thread_runner = content::BrowserThread::GetTaskRunnerForThread( content::BrowserThread::UI); - config->dbus_task_runner = chrome::GetDBusTaskRunner(); // OSCrypt can be disabled in a special settings file. config->should_use_preference = parsed_command_line().HasSwitch(switches::kEnableEncryptionSelection);
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 2764edff..f0ffd65 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc
@@ -2579,7 +2579,8 @@ #if defined(OS_ANDROID) auto* single_tab_mode_helper = SingleTabModeTabHelper::FromWebContents(web_contents); - if (single_tab_mode_helper->block_all_new_windows()) { + if (single_tab_mode_helper && + single_tab_mode_helper->block_all_new_windows()) { if (TabAndroid* tab_android = TabAndroid::FromWebContents(web_contents)) { tab_android->HandlePopupNavigation(&nav_params); }
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index 031a06c..b98f315 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -1331,6 +1331,8 @@ "policy/remote_commands/device_commands_factory_chromeos.h", "policy/remote_commands/screenshot_delegate.cc", "policy/remote_commands/screenshot_delegate.h", + "policy/secondary_google_account_signin_policy_handler.cc", + "policy/secondary_google_account_signin_policy_handler.h", "policy/server_backed_device_state.cc", "policy/server_backed_device_state.h", "policy/server_backed_state_keys_broker.cc", @@ -1918,6 +1920,7 @@ "policy/recommendation_restorer_unittest.cc", "policy/remote_commands/device_command_screenshot_job_unittest.cc", "policy/remote_commands/device_command_set_volume_job_unittest.cc", + "policy/secondary_google_account_signin_policy_handler_unittest.cc", "policy/server_backed_state_keys_broker_unittest.cc", "policy/status_uploader_unittest.cc", "policy/system_log_uploader_unittest.cc",
diff --git a/chrome/browser/chromeos/app_mode/app_session.cc b/chrome/browser/chromeos/app_mode/app_session.cc index 58ca9ff2..43a6be5 100644 --- a/chrome/browser/chromeos/app_mode/app_session.cc +++ b/chrome/browser/chromeos/app_mode/app_session.cc
@@ -135,10 +135,9 @@ ->GetAccountId())) { // If we were in demo mode, we disabled all our network technologies, // re-enable them. - NetworkStateHandler* handler = - NetworkHandler::Get()->network_state_handler(); - handler->SetTechnologyEnabled(NetworkTypePattern::NonVirtual(), true, - chromeos::network_handler::ErrorCallback()); + NetworkHandler::Get()->network_state_handler()->SetTechnologyEnabled( + NetworkTypePattern::Physical(), true, + chromeos::network_handler::ErrorCallback()); } app_session_->OnLastAppWindowClosed();
diff --git a/chrome/browser/chromeos/ash_config.cc b/chrome/browser/chromeos/ash_config.cc index 1592ef7..01a9334 100644 --- a/chrome/browser/chromeos/ash_config.cc +++ b/chrome/browser/chromeos/ash_config.cc
@@ -7,6 +7,7 @@ #include "base/command_line.h" #include "chrome/common/chrome_switches.h" #include "services/service_manager/runner/common/client_util.h" +#include "ui/base/ui_base_switches.h" namespace chromeos {
diff --git a/chrome/browser/chromeos/attestation/attestation_policy_observer.cc b/chrome/browser/chromeos/attestation/attestation_policy_observer.cc index f3f52536..8e9a437a 100644 --- a/chrome/browser/chromeos/attestation/attestation_policy_observer.cc +++ b/chrome/browser/chromeos/attestation/attestation_policy_observer.cc
@@ -254,7 +254,7 @@ void AttestationPolicyObserver::UploadCertificate( const std::string& pem_certificate_chain) { - policy_client_->UploadCertificate( + policy_client_->UploadEnterpriseMachineCertificate( pem_certificate_chain, base::Bind(&AttestationPolicyObserver::OnUploadComplete, weak_factory_.GetWeakPtr()));
diff --git a/chrome/browser/chromeos/attestation/attestation_policy_observer.h b/chrome/browser/chromeos/attestation/attestation_policy_observer.h index e564c30b..c61da96 100644 --- a/chrome/browser/chromeos/attestation/attestation_policy_observer.h +++ b/chrome/browser/chromeos/attestation/attestation_policy_observer.h
@@ -67,7 +67,7 @@ // and, if so, gets a new one. If not renewing, calls CheckIfUploaded. void CheckCertificateExpiry(const std::string& pem_certificate_chain); - // Uploads a certificate to the policy server. + // Uploads a machine certificate to the policy server. void UploadCertificate(const std::string& pem_certificate_chain); // Checks if a certificate has already been uploaded and, if not, upload.
diff --git a/chrome/browser/chromeos/attestation/attestation_policy_observer_unittest.cc b/chrome/browser/chromeos/attestation/attestation_policy_observer_unittest.cc index 0794be5..0509852a 100644 --- a/chrome/browser/chromeos/attestation/attestation_policy_observer_unittest.cc +++ b/chrome/browser/chromeos/attestation/attestation_policy_observer_unittest.cc
@@ -87,8 +87,8 @@ // status in the key payload matches the upload operation. bool new_key = (mock_options & MOCK_NEW_KEY); if (new_key || !key_uploaded) { - EXPECT_CALL(policy_client_, - UploadCertificate(new_key ? "fake_cert" : certificate, _)) + EXPECT_CALL(policy_client_, UploadEnterpriseMachineCertificate( + new_key ? "fake_cert" : certificate, _)) .WillOnce(WithArgs<1>(Invoke(StatusCallbackSuccess))); }
diff --git a/chrome/browser/chromeos/attestation/enrollment_policy_observer.cc b/chrome/browser/chromeos/attestation/enrollment_policy_observer.cc index 756a901..9955fb7ce 100644 --- a/chrome/browser/chromeos/attestation/enrollment_policy_observer.cc +++ b/chrome/browser/chromeos/attestation/enrollment_policy_observer.cc
@@ -159,7 +159,7 @@ void EnrollmentPolicyObserver::UploadCertificate( const std::string& pem_certificate_chain) { - policy_client_->UploadCertificate( + policy_client_->UploadEnterpriseEnrollmentCertificate( pem_certificate_chain, base::Bind(&EnrollmentPolicyObserver::OnUploadComplete, weak_factory_.GetWeakPtr()));
diff --git a/chrome/browser/chromeos/attestation/enrollment_policy_observer.h b/chrome/browser/chromeos/attestation/enrollment_policy_observer.h index b5bee088..439478be 100644 --- a/chrome/browser/chromeos/attestation/enrollment_policy_observer.h +++ b/chrome/browser/chromeos/attestation/enrollment_policy_observer.h
@@ -57,7 +57,7 @@ // Gets an enrollment certificate. void GetEnrollmentCertificate(); - // Uploads a certificate to the policy server. + // Uploads an enrollment certificate to the policy server. void UploadCertificate(const std::string& pem_certificate_chain); // Called when a certificate upload operation completes. On success, |status|
diff --git a/chrome/browser/chromeos/attestation/enrollment_policy_observer_unittest.cc b/chrome/browser/chromeos/attestation/enrollment_policy_observer_unittest.cc index aed28e0..ba8848658b 100644 --- a/chrome/browser/chromeos/attestation/enrollment_policy_observer_unittest.cc +++ b/chrome/browser/chromeos/attestation/enrollment_policy_observer_unittest.cc
@@ -57,7 +57,8 @@ void SetupMocks() { EXPECT_CALL(attestation_flow_, GetCertificate(_, _, _, _, _)) .WillOnce(WithArgs<4>(Invoke(CertCallbackSuccess))); - EXPECT_CALL(policy_client_, UploadCertificate("fake_cert", _)) + EXPECT_CALL(policy_client_, + UploadEnterpriseEnrollmentCertificate("fake_cert", _)) .WillOnce(WithArgs<1>(Invoke(StatusCallbackSuccess))); }
diff --git a/chrome/browser/chromeos/first_run/goodies_displayer_browsertest.cc b/chrome/browser/chromeos/first_run/goodies_displayer_browsertest.cc index 3a9a241..00db6f9 100644 --- a/chrome/browser/chromeos/first_run/goodies_displayer_browsertest.cc +++ b/chrome/browser/chromeos/first_run/goodies_displayer_browsertest.cc
@@ -15,6 +15,7 @@ #include "chrome/test/base/test_launcher_utils.h" #include "chrome/test/base/ui_test_utils.h" #include "components/prefs/pref_service.h" +#include "ui/base/ui_base_switches.h" namespace chromeos {
diff --git a/chrome/browser/chromeos/lock_screen_apps/state_controller_unittest.cc b/chrome/browser/chromeos/lock_screen_apps/state_controller_unittest.cc index 1ce73acd..6b58188 100644 --- a/chrome/browser/chromeos/lock_screen_apps/state_controller_unittest.cc +++ b/chrome/browser/chromeos/lock_screen_apps/state_controller_unittest.cc
@@ -778,8 +778,6 @@ TEST_F(LockScreenAppStateNoStylusInputTest, StylusDetectedAfterInitializationAndScreenLock) { - ui::test::DeviceDataManagerTestAPI devices_test_api; - ASSERT_TRUE(InitializeNoteTakingApp(TrayActionState::kNotAvailable, true)); EXPECT_EQ(TestAppManager::State::kStopped, app_manager()->state()); EXPECT_TRUE(LockScreenItemStorage::GetIfAllowed(profile())); @@ -804,8 +802,6 @@ } TEST_F(LockScreenAppStateNoStylusInputTest, StylusDetectedAfterInitialization) { - ui::test::DeviceDataManagerTestAPI devices_test_api; - ASSERT_TRUE(InitializeNoteTakingApp(TrayActionState::kNotAvailable, true)); EXPECT_EQ(TestAppManager::State::kStopped, app_manager()->state()); @@ -1203,7 +1199,6 @@ TEST_F(LockScreenAppStateWebUiLockTest, LaunchActionWhenStylusRemoved_ActionClosedBeforeAnimationDone) { - ui::test::DeviceDataManagerTestAPI devices_test_api; ASSERT_TRUE(InitializeNoteTakingApp(TrayActionState::kAvailable, true /* enable_app_launch */)); tray_action()->SendNewNoteRequest(LockScreenNoteOrigin::kStylusEject);
diff --git a/chrome/browser/chromeos/login/demo_mode/demo_app_launcher.cc b/chrome/browser/chromeos/login/demo_mode/demo_app_launcher.cc index 0fcc9f3c..0c8df3f 100644 --- a/chrome/browser/chromeos/login/demo_mode/demo_app_launcher.cc +++ b/chrome/browser/chromeos/login/demo_mode/demo_app_launcher.cc
@@ -88,9 +88,9 @@ // Disable network before launching the app. LOG(WARNING) << "Disabling network before launching demo app.."; - NetworkStateHandler* handler = NetworkHandler::Get()->network_state_handler(); - handler->SetTechnologyEnabled(NetworkTypePattern::NonVirtual(), false, - chromeos::network_handler::ErrorCallback()); + NetworkHandler::Get()->network_state_handler()->SetTechnologyEnabled( + NetworkTypePattern::Physical(), false, + chromeos::network_handler::ErrorCallback()); OpenApplication(AppLaunchParams(profile, extension, extensions::LAUNCH_CONTAINER_WINDOW,
diff --git a/chrome/browser/chromeos/platform_keys/platform_keys_nss.cc b/chrome/browser/chromeos/platform_keys/platform_keys_nss.cc index d18c43de..28e02c8 100644 --- a/chrome/browser/chromeos/platform_keys/platform_keys_nss.cc +++ b/chrome/browser/chromeos/platform_keys/platform_keys_nss.cc
@@ -599,8 +599,13 @@ if (cert_slot != state->slot_) continue; + // Allow UTF-8 inside PrintableStrings in client certificates. See + // crbug.com/770323 and crbug.com/788655. + net::X509Certificate::UnsafeCreateOptions options; + options.printable_string_is_utf8 = true; scoped_refptr<net::X509Certificate> cert = - net::x509_util::CreateX509CertificateFromCERTCertificate(cert_handle); + net::x509_util::CreateX509CertificateFromCERTCertificate(cert_handle, + {}, options); if (!cert) continue;
diff --git a/chrome/browser/chromeos/policy/secondary_google_account_signin_policy_handler.cc b/chrome/browser/chromeos/policy/secondary_google_account_signin_policy_handler.cc new file mode 100644 index 0000000..f66db98 --- /dev/null +++ b/chrome/browser/chromeos/policy/secondary_google_account_signin_policy_handler.cc
@@ -0,0 +1,38 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/chromeos/policy/secondary_google_account_signin_policy_handler.h" +#include "components/policy/core/common/policy_map.h" +#include "components/policy/policy_constants.h" +#include "components/prefs/pref_value_map.h" +#include "components/signin/core/browser/signin_pref_names.h" + +namespace policy { + +SecondaryGoogleAccountSigninPolicyHandler:: + SecondaryGoogleAccountSigninPolicyHandler() + : TypeCheckingPolicyHandler(key::kSecondaryGoogleAccountSigninAllowed, + base::Value::Type::BOOLEAN) {} + +SecondaryGoogleAccountSigninPolicyHandler:: + ~SecondaryGoogleAccountSigninPolicyHandler() {} + +void SecondaryGoogleAccountSigninPolicyHandler::ApplyPolicySettings( + const PolicyMap& policies, + PrefValueMap* prefs) { + const base::Value* value = + policies.GetValue(key::kSecondaryGoogleAccountSigninAllowed); + + // If the policy is unset, or set to true, do not override the pref value. + // The default value of the preference is |true| for child accounts and + // |false| for regular accounts. + if (!value || value->GetBool()) { + return; + } + + // Disallow secondary sign-in by enabling Mirror consistency. + prefs->SetBoolean(prefs::kAccountConsistencyMirrorRequired, true); +} + +} // namespace policy
diff --git a/chrome/browser/chromeos/policy/secondary_google_account_signin_policy_handler.h b/chrome/browser/chromeos/policy/secondary_google_account_signin_policy_handler.h new file mode 100644 index 0000000..10d6fbc --- /dev/null +++ b/chrome/browser/chromeos/policy/secondary_google_account_signin_policy_handler.h
@@ -0,0 +1,35 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_CHROMEOS_POLICY_SECONDARY_GOOGLE_ACCOUNT_SIGNIN_POLICY_HANDLER_H_ +#define CHROME_BROWSER_CHROMEOS_POLICY_SECONDARY_GOOGLE_ACCOUNT_SIGNIN_POLICY_HANDLER_H_ + +#include "base/macros.h" +#include "components/policy/core/browser/configuration_policy_handler.h" +#include "components/policy/policy_export.h" + +class PrefValueMap; + +namespace policy { + +class PolicyMap; + +// Handles secondary Google account sign-in (in the content area) policy. +class POLICY_EXPORT SecondaryGoogleAccountSigninPolicyHandler + : public TypeCheckingPolicyHandler { + public: + SecondaryGoogleAccountSigninPolicyHandler(); + ~SecondaryGoogleAccountSigninPolicyHandler() override; + + // ConfigurationPolicyHandler methods: + void ApplyPolicySettings(const PolicyMap& policies, + PrefValueMap* prefs) override; + + private: + DISALLOW_COPY_AND_ASSIGN(SecondaryGoogleAccountSigninPolicyHandler); +}; + +} // namespace policy + +#endif // CHROME_BROWSER_CHROMEOS_POLICY_SECONDARY_GOOGLE_ACCOUNT_SIGNIN_POLICY_HANDLER_H_
diff --git a/chrome/browser/chromeos/policy/secondary_google_account_signin_policy_handler_unittest.cc b/chrome/browser/chromeos/policy/secondary_google_account_signin_policy_handler_unittest.cc new file mode 100644 index 0000000..8f49a58d --- /dev/null +++ b/chrome/browser/chromeos/policy/secondary_google_account_signin_policy_handler_unittest.cc
@@ -0,0 +1,80 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <memory> +#include <string> +#include <utility> + +#include "base/macros.h" +#include "chrome/browser/chromeos/policy/secondary_google_account_signin_policy_handler.h" +#include "components/policy/core/common/policy_map.h" +#include "components/policy/core/common/policy_pref_names.h" +#include "components/policy/policy_constants.h" +#include "components/prefs/pref_value_map.h" +#include "components/signin/core/browser/signin_pref_names.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace policy { + +class SecondaryGoogleAccountSigninPolicyHandlerTest : public testing::Test { + protected: + SecondaryGoogleAccountSigninPolicyHandlerTest() = default; + + void SetPolicy(std::unique_ptr<base::Value> value) { + policies_.Set(key::kSecondaryGoogleAccountSigninAllowed, + POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, + POLICY_SOURCE_CLOUD, std::move(value), nullptr); + } + + void ApplyPolicySettings(bool value) { + SetPolicy(std::make_unique<base::Value>(value)); + handler_.ApplyPolicySettings(policies_, &prefs_); + } + + bool GetAccountConsistencyPref(bool* pref) { + return prefs_.GetBoolean(prefs::kAccountConsistencyMirrorRequired, pref); + } + + void SetAccountConsistencyPref(bool pref) { + prefs_.SetBoolean(prefs::kAccountConsistencyMirrorRequired, pref); + } + + private: + SecondaryGoogleAccountSigninPolicyHandler handler_; + PolicyMap policies_; + PrefValueMap prefs_; + + DISALLOW_COPY_AND_ASSIGN(SecondaryGoogleAccountSigninPolicyHandlerTest); +}; + +TEST_F(SecondaryGoogleAccountSigninPolicyHandlerTest, + CheckSigninAllowedDoesNotChangeDefaultTruePreference) { + SetAccountConsistencyPref(true); + ApplyPolicySettings(true /* policy value */); + + bool preference = false; + EXPECT_TRUE(GetAccountConsistencyPref(&preference)); + EXPECT_TRUE(preference); +} + +TEST_F(SecondaryGoogleAccountSigninPolicyHandlerTest, + CheckSigninAllowedDoesNotChangeDefaultFalsePreference) { + SetAccountConsistencyPref(false); + ApplyPolicySettings(true /* policy value */); + + bool preference = true; + EXPECT_TRUE(GetAccountConsistencyPref(&preference)); + EXPECT_FALSE(preference); +} + +TEST_F(SecondaryGoogleAccountSigninPolicyHandlerTest, + CheckSigninDisallowedEnablesMirror) { + ApplyPolicySettings(false /* policy value */); + + bool preference = false; + EXPECT_TRUE(GetAccountConsistencyPref(&preference)); + EXPECT_TRUE(preference); +} + +} // namespace policy
diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc index b124f40..f5d54527 100644 --- a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc +++ b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc
@@ -10,7 +10,6 @@ #include "base/bind.h" #include "base/bind_helpers.h" #include "base/command_line.h" -#include "base/debug/crash_logging.h" #include "base/logging.h" #include "base/memory/ptr_util.h" #include "base/metrics/histogram_functions.h" @@ -27,8 +26,8 @@ #include "chrome/browser/chromeos/policy/wildcard_login_checker.h" #include "chrome/browser/lifetime/application_lifetime.h" #include "chrome/common/chrome_content_client.h" -#include "chrome/common/crash_keys.h" #include "chromeos/chromeos_switches.h" +#include "components/crash/core/common/crash_key.h" #include "components/policy/core/common/cloud/cloud_external_data_manager.h" #include "components/policy/core/common/cloud/cloud_policy_refresh_scheduler.h" #include "components/policy/core/common/cloud/device_management_service.h" @@ -136,8 +135,10 @@ // TODO(emaxx): Remove the crash key after the crashes tracked at // https://crbug.com/685996 are fixed. if (core()->client()) { - base::debug::SetCrashKeyToStackTrace( - crash_keys::kUserCloudPolicyManagerConnectTrace, connect_callstack_); + static crash_reporter::CrashKeyString<1024> connect_callstack_key( + "user-cloud-policy-manager-connect-trace"); + crash_reporter::SetCrashKeyStringToStackTrace(&connect_callstack_key, + connect_callstack_); } else { connect_callstack_ = base::debug::StackTrace(); }
diff --git a/chrome/browser/chromeos/printing/cups_printers_manager.cc b/chrome/browser/chromeos/printing/cups_printers_manager.cc index c6d5e59..69e87a47 100644 --- a/chrome/browser/chromeos/printing/cups_printers_manager.cc +++ b/chrome/browser/chromeos/printing/cups_printers_manager.cc
@@ -372,6 +372,14 @@ // else here. continue; } + + // Sometimes the detector can flag a printer as IPP-everywhere compatible; + // those printers can go directly into the automatic class without further + // processing. + if (detected.printer.IsIppEverywhere()) { + printers_[kAutomatic].push_back(detected.printer); + continue; + } auto it = detected_printer_ppd_references_.find(detected.printer.id()); if (it != detected_printer_ppd_references_.end()) { if (it->second == nullptr) { @@ -385,12 +393,11 @@ *printers_[kAutomatic].back().mutable_ppd_reference() = *it->second; } } else { - // Didn't find an entry for this printer in the PpdReferences cache. - // We need to ask PpdProvider whether or not it can determine a - // PpdReference. If there's not already an outstanding request for - // one, start one. When the request comes back, we'll rerun - // classification and then should be able to figure out where this - // printer belongs. + // Didn't find an entry for this printer in the PpdReferences cache. We + // need to ask PpdProvider whether or not it can determine a + // PpdReference. If there's not already an outstanding request for one, + // start one. When the request comes back, we'll rerun classification + // and then should be able to figure out where this printer belongs. if (!base::ContainsKey(inflight_ppd_reference_resolutions_, detected.printer.id())) { inflight_ppd_reference_resolutions_.insert(detected.printer.id());
diff --git a/chrome/browser/chromeos/printing/zeroconf_printer_detector.cc b/chrome/browser/chromeos/printing/zeroconf_printer_detector.cc index a6f949f..da0f465 100644 --- a/chrome/browser/chromeos/printing/zeroconf_printer_detector.cc +++ b/chrome/browser/chromeos/printing/zeroconf_printer_detector.cc
@@ -28,6 +28,10 @@ const char* kIppServiceName = "_ipp._tcp.local"; const char* kIppsServiceName = "_ipps._tcp.local"; +// IppEverywhere printers are also required to advertise these services. +const char* kIppEverywhereServiceName = "_ipp._tcp.local,print"; +const char* kIppsEverywhereServiceName = "_ipps._tcp.local,print"; + // These (including the default values) come from section 9.2 of the Bonjour // Printing Spec v1.2, and the field names follow the spec definitions instead // of the canonical Chromium style. @@ -161,6 +165,14 @@ service_description.ip_address.ToString().c_str(), service_description.address.port(), metadata.rp.c_str())); + // Per the IPP Everywhere Standard 5100.14-2013, section 4.2.1, IPP + // everywhere-capable printers advertise services suffixed with ",_print" + // (possibly in addition to suffix-free versions). If we get a printer from a + // ,_print service type, it should be auto-configurable with IPP Everywhere. + printer.mutable_ppd_reference()->autoconf = + base::StringPiece(service_description.service_type()) + .ends_with(",_print"); + // gather ppd identification candidates. if (!metadata.ty.empty()) { detected_printer->ppd_search_data.make_and_model.push_back(metadata.ty); @@ -182,9 +194,19 @@ // should replace the existing record. bool ShouldReplaceRecord(const PrinterDetector::DetectedPrinter& existing, const PrinterDetector::DetectedPrinter& candidate) { - // Right now the only time this should happen is for ipp vs ipps. - return (base::StringPiece(existing.printer.uri()).starts_with("ipp://") && - base::StringPiece(candidate.printer.uri()).starts_with("ipps://")); + // If the new version is auto-configurable and the previous version is not, + // then do the replacement. (This can happen if we initially found an + // _ipp[s]._tcp.local record and later get an ipp[s]._tcp.local,_print record. + // Advertising the latter service implies that we can use IPP Everywhere for + // this printer. + if (candidate.printer.IsIppEverywhere() != + existing.printer.IsIppEverywhere()) { + return candidate.printer.IsIppEverywhere(); + } else { + // Otherwise, prefer an equivalent ipps record to an ipp record. + return (base::StringPiece(existing.printer.uri()).starts_with("ipp://") && + base::StringPiece(candidate.printer.uri()).starts_with("ipps://")); + } } class ZeroconfPrinterDetectorImpl @@ -194,7 +216,9 @@ explicit ZeroconfPrinterDetectorImpl(Profile* profile) : discovery_client_(ServiceDiscoverySharedClient::GetInstance()), observer_list_(new base::ObserverListThreadSafe<Observer>()) { - std::array<const char*, 2> services{{kIppServiceName, kIppsServiceName}}; + std::array<const char*, 4> services{{kIppServiceName, kIppsServiceName, + kIppEverywhereServiceName, + kIppsEverywhereServiceName}}; // Since we start the discoverers immediately, this must come last in the // constructor.
diff --git a/chrome/browser/chromeos/profiles/profile_helper.h b/chrome/browser/chromeos/profiles/profile_helper.h index a14941c..ee07d930 100644 --- a/chrome/browser/chromeos/profiles/profile_helper.h +++ b/chrome/browser/chromeos/profiles/profile_helper.h
@@ -139,10 +139,6 @@ // Should called once after UserManager instance has been created. void Initialize(); - // Returns hash for active user ID which is used to identify that user profile - // on Chrome OS. - std::string active_user_id_hash() { return active_user_id_hash_; } - // Clears site data (cookies, history, etc) for signin profile. // Callback can be empty. Not thread-safe. void ClearSigninProfile(const base::Closure& on_clear_callback);
diff --git a/chrome/browser/chromeos/tether/tether_service.cc b/chrome/browser/chromeos/tether/tether_service.cc index fbb9440e..4881a0a 100644 --- a/chrome/browser/chromeos/tether/tether_service.cc +++ b/chrome/browser/chromeos/tether/tether_service.cc
@@ -269,8 +269,8 @@ void TetherService::DevicePropertiesUpdated( const chromeos::DeviceState* device) { - if (device->Matches(chromeos::NetworkTypePattern::Tether()) || - device->Matches(chromeos::NetworkTypePattern::WiFi())) { + if (device->Matches(chromeos::NetworkTypePattern::Tether() | + chromeos::NetworkTypePattern::WiFi())) { UpdateEnabledState(); } }
diff --git a/chrome/browser/component_updater/vr_assets_component_installer.cc b/chrome/browser/component_updater/vr_assets_component_installer.cc index 4169b89..5df4b3ac 100644 --- a/chrome/browser/component_updater/vr_assets_component_installer.cc +++ b/chrome/browser/component_updater/vr_assets_component_installer.cc
@@ -19,6 +19,7 @@ #include "base/version.h" #include "chrome/browser/vr/assets.h" #include "chrome/browser/vr/metrics_helper.h" +#include "chrome/browser/vr_features.h" #include "chrome/common/safe_browsing/file_type_policies.h" #include "components/component_updater/component_updater_paths.h" @@ -121,7 +122,8 @@ update_client::InstallerAttributes VrAssetsComponentInstallerTraits::GetInstallerAttributes() const { - return update_client::InstallerAttributes(); + return {{"compatible_major_version", + std::to_string(vr::kCompatibleMajorVrAssetsComponentVersion)}}; } std::vector<std::string> VrAssetsComponentInstallerTraits::GetMimeTypes() @@ -130,12 +132,14 @@ } void RegisterVrAssetsComponent(ComponentUpdateService* cus) { +#if BUILDFLAG(REGISTER_VR_ASSETS_COMPONENT) std::unique_ptr<ComponentInstallerPolicy> policy( new VrAssetsComponentInstallerTraits()); auto installer = base::MakeRefCounted<ComponentInstaller>(std::move(policy)); installer->Register(cus, base::Closure()); vr::Assets::GetInstance()->GetMetricsHelper()->OnRegisteredComponent(); VLOG(1) << "Registered VR assets component"; +#endif // BUILDFLAG(REGISTER_VR_ASSETS_COMPONENT) } } // namespace component_updater
diff --git a/chrome/browser/data_use_measurement/chrome_data_use_ascriber.cc b/chrome/browser/data_use_measurement/chrome_data_use_ascriber.cc index 06044b8b..744eeb6 100644 --- a/chrome/browser/data_use_measurement/chrome_data_use_ascriber.cc +++ b/chrome/browser/data_use_measurement/chrome_data_use_ascriber.cc
@@ -242,7 +242,7 @@ // If all requests are done for |entry| and no more requests can be attributed // to it, it is safe to delete. if (entry->IsDataUseComplete() && !page_load_is_tracked) { - NotifyDataUseCompleted(entry); + NotifyPageLoadConcluded(entry); data_use_recorders_.erase(entry); } } @@ -290,7 +290,7 @@ if (main_render_frame_entry_map_.end() != main_frame_it) { DataUseRecorderEntry entry = main_frame_it->second.data_use_recorder; if (entry->IsDataUseComplete()) { - NotifyDataUseCompleted(entry); + NotifyPageLoadConcluded(entry); data_use_recorders_.erase(entry); } main_render_frame_entry_map_.erase(main_frame_it); @@ -362,7 +362,7 @@ main_frame_it->second.data_use_recorder = data_use_recorders_.end(); NotifyPageLoadCommit(old_frame_entry); if (old_frame_entry->IsDataUseComplete()) { - NotifyDataUseCompleted(old_frame_entry); + NotifyPageLoadConcluded(old_frame_entry); data_use_recorders_.erase(old_frame_entry); } @@ -379,12 +379,12 @@ entry->set_main_frame_id(main_frame); // If the frame has already been deleted then mark this navigation as having - // completed its data use. + // concluded its data use. if (main_frame_it == main_render_frame_entry_map_.end()) { entry->set_page_transition(page_transition); NotifyPageLoadCommit(entry); if (entry->IsDataUseComplete()) { - NotifyDataUseCompleted(entry); + NotifyPageLoadConcluded(entry); data_use_recorders_.erase(entry); } return; @@ -441,7 +441,7 @@ } } if (old_frame_entry->IsDataUseComplete()) { - NotifyDataUseCompleted(old_frame_entry); + NotifyPageLoadConcluded(old_frame_entry); data_use_recorders_.erase(old_frame_entry); } entry->set_is_visible(main_frame_it->second.is_visible); @@ -450,14 +450,41 @@ } } +void ChromeDataUseAscriber::DidFinishLoad(int render_process_id, + int render_frame_id, + const GURL& validated_url) { + // Only continue for validated HTTP* URLs (e.g., not internal error pages). + if (!validated_url.SchemeIsHTTPOrHTTPS()) + return; + + RenderFrameHostID main_frame(render_process_id, render_frame_id); + + auto main_frame_it = main_render_frame_entry_map_.find(main_frame); + if (main_frame_it == main_render_frame_entry_map_.end()) + return; + + // Check that the DataUse entry has a committed URL. + DataUseRecorderEntry entry = main_frame_it->second.data_use_recorder; + DataUse& data_use = entry->data_use(); + if (data_use.url().is_valid()) { + NotifyDidFinishLoad(entry); + } +} + void ChromeDataUseAscriber::NotifyPageLoadCommit(DataUseRecorderEntry entry) { for (auto& observer : observers_) observer.OnPageLoadCommit(&entry->data_use()); } -void ChromeDataUseAscriber::NotifyDataUseCompleted(DataUseRecorderEntry entry) { +void ChromeDataUseAscriber::NotifyDidFinishLoad(DataUseRecorderEntry entry) { for (auto& observer : observers_) - observer.OnPageLoadComplete(&entry->data_use()); + observer.OnPageDidFinishLoad(&entry->data_use()); +} + +void ChromeDataUseAscriber::NotifyPageLoadConcluded( + DataUseRecorderEntry entry) { + for (auto& observer : observers_) + observer.OnPageLoadConcluded(&entry->data_use()); } std::unique_ptr<URLRequestClassifier>
diff --git a/chrome/browser/data_use_measurement/chrome_data_use_ascriber.h b/chrome/browser/data_use_measurement/chrome_data_use_ascriber.h index dc649e0..184867ac 100644 --- a/chrome/browser/data_use_measurement/chrome_data_use_ascriber.h +++ b/chrome/browser/data_use_measurement/chrome_data_use_ascriber.h
@@ -111,6 +111,11 @@ int new_render_process_id, int new_render_frame_id); + // Called when the load is finished. + void DidFinishLoad(int render_process_id, + int render_frame_id, + const GURL& validated_url); + private: friend class ChromeDataUseAscriberTest; @@ -167,7 +172,8 @@ net::URLRequest* request); void NotifyPageLoadCommit(DataUseRecorderEntry entry); - void NotifyDataUseCompleted(DataUseRecorderEntry entry); + void NotifyDidFinishLoad(DataUseRecorderEntry entry); + void NotifyPageLoadConcluded(DataUseRecorderEntry entry); DataUseRecorderEntry CreateNewDataUseRecorder( net::URLRequest* request,
diff --git a/chrome/browser/data_use_measurement/chrome_data_use_ascriber_service.cc b/chrome/browser/data_use_measurement/chrome_data_use_ascriber_service.cc index 074a5263..14cdba8 100644 --- a/chrome/browser/data_use_measurement/chrome_data_use_ascriber_service.cc +++ b/chrome/browser/data_use_measurement/chrome_data_use_ascriber_service.cc
@@ -186,6 +186,22 @@ base::TimeTicks::Now())); } +void ChromeDataUseAscriberService::DidFinishLoad( + content::RenderFrameHost* main_render_frame_host, + const GURL& validated_url) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + + if (!ascriber_) + return; + + content::BrowserThread::PostTask( + content::BrowserThread::IO, FROM_HERE, + base::BindOnce(&ChromeDataUseAscriber::DidFinishLoad, + base::Unretained(ascriber_), + main_render_frame_host->GetProcess()->GetID(), + main_render_frame_host->GetRoutingID(), validated_url)); +} + void ChromeDataUseAscriberService::SetDataUseAscriber( ChromeDataUseAscriber* ascriber) { DCHECK(!is_initialized_);
diff --git a/chrome/browser/data_use_measurement/chrome_data_use_ascriber_service.h b/chrome/browser/data_use_measurement/chrome_data_use_ascriber_service.h index 57481f2..98aa184b 100644 --- a/chrome/browser/data_use_measurement/chrome_data_use_ascriber_service.h +++ b/chrome/browser/data_use_measurement/chrome_data_use_ascriber_service.h
@@ -10,6 +10,7 @@ #include "base/macros.h" #include "components/keyed_service/core/keyed_service.h" +#include "url/gurl.h" namespace content { class NavigationHandle; @@ -66,6 +67,10 @@ // Forwarded from DataUseWebContentsObserver void DidFinishNavigation(content::NavigationHandle* navigation_handle); + // Forwarded from DataUseWebContentsObserver + void DidFinishLoad(content::RenderFrameHost* main_render_frame_host, + const GURL& validated_url); + private: friend class ChromeDataUseAscriberServiceTest;
diff --git a/chrome/browser/data_use_measurement/chrome_data_use_ascriber_unittest.cc b/chrome/browser/data_use_measurement/chrome_data_use_ascriber_unittest.cc index 5ed6a94..b07a54ff 100644 --- a/chrome/browser/data_use_measurement/chrome_data_use_ascriber_unittest.cc +++ b/chrome/browser/data_use_measurement/chrome_data_use_ascriber_unittest.cc
@@ -37,7 +37,9 @@ MOCK_METHOD2(OnPageResourceLoad, void(const net::URLRequest& request, data_use_measurement::DataUse* data_use)); - MOCK_METHOD1(OnPageLoadComplete, + MOCK_METHOD1(OnPageDidFinishLoad, + void(data_use_measurement::DataUse* data_use)); + MOCK_METHOD1(OnPageLoadConcluded, void(data_use_measurement::DataUse* data_use)); }; @@ -483,7 +485,7 @@ ascriber()->OnUrlRequestCompleted(*request, false); EXPECT_CALL(mock_observer, OnPageLoadCommit(data_use)).Times(1); - EXPECT_CALL(mock_observer, OnPageLoadComplete(testing::_)).Times(1); + EXPECT_CALL(mock_observer, OnPageLoadConcluded(testing::_)).Times(1); ascriber()->DidFinishMainFrameNavigation( kRenderProcessId, kRenderFrameId, GURL("http://mobile.test.com"), false, kPageTransition, base::TimeTicks::Now()); @@ -495,9 +497,70 @@ EXPECT_EQ(content::GlobalRequestID(kRenderProcessId, 0), recorder_entry.main_frame_request_id()); EXPECT_EQ(GURL("http://mobile.test.com"), recorder_entry.data_use().url()); - EXPECT_CALL(mock_observer, OnPageLoadComplete(&recorder_entry.data_use())) - .Times(1); + EXPECT_CALL(mock_observer, OnPageDidFinishLoad(&recorder_entry.data_use())) + .Times(1); + ascriber()->DidFinishLoad(kRenderProcessId, kRenderFrameId, + GURL("http://mobile.test.com")); + + EXPECT_CALL(mock_observer, OnPageLoadConcluded(&recorder_entry.data_use())) + .Times(1); + ascriber()->RenderFrameDeleted(kRenderProcessId, kRenderFrameId, -1, -1); + ascriber()->OnUrlRequestDestroyed(request.get()); + + EXPECT_EQ(0u, recorders().size()); +} + +TEST_F(ChromeDataUseAscriberTest, PageLoadObserverForErrorPageValidatedURL) { + MockPageLoadObserver mock_observer; + ascriber()->AddObserver(&mock_observer); + + std::unique_ptr<net::URLRequest> request = CreateNewRequest( + "http://test.com", true, kRequestId, kRenderProcessId, kRenderFrameId); + + // Mainframe is created. + ascriber()->RenderFrameCreated(kRenderProcessId, kRenderFrameId, -1, -1); + EXPECT_EQ(1u, recorders().size()); + + ascriber()->OnBeforeUrlRequest(request.get()); + + // Navigation starts. + ascriber()->DidStartMainFrameNavigation(GURL("http://test.com"), + kRenderProcessId, kRenderFrameId, + kNavigationHandle); + + ascriber()->ReadyToCommitMainFrameNavigation( + content::GlobalRequestID(kRenderProcessId, 0), kRenderProcessId, + kRenderFrameId); + + EXPECT_EQ(2u, recorders().size()); + DataUse* data_use = &recorders().back().data_use(); + + EXPECT_CALL(mock_observer, OnPageResourceLoad(testing::_, data_use)).Times(1); + ascriber()->OnUrlRequestCompleted(*request, false); + + EXPECT_CALL(mock_observer, OnPageLoadCommit(data_use)).Times(1); + EXPECT_CALL(mock_observer, OnPageLoadConcluded(testing::_)).Times(1); + ascriber()->DidFinishMainFrameNavigation( + kRenderProcessId, kRenderFrameId, GURL("http://mobile.test.com"), false, + kPageTransition, base::TimeTicks::Now()); + + EXPECT_EQ(1u, recorders().size()); + auto& recorder_entry = recorders().front(); + EXPECT_EQ(RenderFrameHostID(kRenderProcessId, kRenderFrameId), + recorder_entry.main_frame_id()); + EXPECT_EQ(content::GlobalRequestID(kRenderProcessId, 0), + recorder_entry.main_frame_request_id()); + EXPECT_EQ(GURL("http://mobile.test.com"), recorder_entry.data_use().url()); + + // Now expect no DidFinishLoad observer call for "about:blank" validated URL. + EXPECT_CALL(mock_observer, OnPageDidFinishLoad(&recorder_entry.data_use())) + .Times(0); + ascriber()->DidFinishLoad(kRenderProcessId, kRenderFrameId, + GURL("about:blank")); + + EXPECT_CALL(mock_observer, OnPageLoadConcluded(&recorder_entry.data_use())) + .Times(1); ascriber()->RenderFrameDeleted(kRenderProcessId, kRenderFrameId, -1, -1); ascriber()->OnUrlRequestDestroyed(request.get());
diff --git a/chrome/browser/data_use_measurement/data_use_web_contents_observer.cc b/chrome/browser/data_use_measurement/data_use_web_contents_observer.cc index 91170f23..4f83246 100644 --- a/chrome/browser/data_use_measurement/data_use_web_contents_observer.cc +++ b/chrome/browser/data_use_measurement/data_use_web_contents_observer.cc
@@ -93,4 +93,10 @@ service_->DidFinishNavigation(navigation_handle); } +void DataUseWebContentsObserver::DidFinishLoad( + content::RenderFrameHost* render_frame_host, + const GURL& validated_url) { + service_->DidFinishLoad(render_frame_host, validated_url); +} + } // namespace data_use_measurement
diff --git a/chrome/browser/data_use_measurement/data_use_web_contents_observer.h b/chrome/browser/data_use_measurement/data_use_web_contents_observer.h index 93803ab6..cc787eff 100644 --- a/chrome/browser/data_use_measurement/data_use_web_contents_observer.h +++ b/chrome/browser/data_use_measurement/data_use_web_contents_observer.h
@@ -45,6 +45,8 @@ content::RenderFrameHost* new_host) override; void DidFinishNavigation( content::NavigationHandle* navigation_handle) override; + void DidFinishLoad(content::RenderFrameHost* render_frame_host, + const GURL& validated_url) override; private: friend class content::WebContentsUserData<DataUseWebContentsObserver>;
diff --git a/chrome/browser/devtools/device/usb/android_usb_browsertest.cc b/chrome/browser/devtools/device/usb/android_usb_browsertest.cc index c2c2ca53..e17d1ecb 100644 --- a/chrome/browser/devtools/device/usb/android_usb_browsertest.cc +++ b/chrome/browser/devtools/device/usb/android_usb_browsertest.cc
@@ -12,6 +12,7 @@ #include "base/containers/queue.h" #include "base/location.h" #include "base/memory/ptr_util.h" +#include "base/memory/ref_counted_memory.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" @@ -30,7 +31,6 @@ #include "device/usb/usb_descriptors.h" #include "device/usb/usb_device.h" #include "device/usb/usb_device_handle.h" -#include "net/base/io_buffer.h" #include "testing/gtest/include/gtest/gtest.h" using content::BrowserThread; @@ -193,21 +193,21 @@ uint8_t request, uint16_t value, uint16_t index, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length, unsigned int timeout, TransferCallback callback) override {} void GenericTransfer(UsbTransferDirection direction, uint8_t endpoint, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length, unsigned int timeout, TransferCallback callback) override { if (direction == device::UsbTransferDirection::OUTBOUND) { if (remaining_body_length_ == 0) { std::vector<uint32_t> header(6); - memcpy(&header[0], buffer->data(), length); + memcpy(&header[0], buffer->front(), length); current_message_.reset( new AdbMessage(header[0], header[1], header[2], std::string())); remaining_body_length_ = header[3]; @@ -218,7 +218,7 @@ } } else { DCHECK(current_message_.get()); - current_message_->body += std::string(buffer->data(), length); + current_message_->body += std::string(buffer->front_as<char>(), length); remaining_body_length_ -= length; } @@ -354,9 +354,8 @@ Query query = std::move(queries_.front()); queries_.pop(); - std::copy(output_buffer_.begin(), - output_buffer_.begin() + query.size, - query.buffer->data()); + std::copy(output_buffer_.begin(), output_buffer_.begin() + query.size, + query.buffer->front()); output_buffer_.erase(output_buffer_.begin(), output_buffer_.begin() + query.size); base::ThreadTaskRunnerHandle::Get()->PostTask( @@ -371,7 +370,7 @@ IsochronousTransferCallback callback) override {} void IsochronousTransferOut(uint8_t endpoint_number, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, const std::vector<uint32_t>& packet_lengths, unsigned int timeout, IsochronousTransferCallback callback) override {} @@ -381,11 +380,11 @@ struct Query { TransferCallback callback; - scoped_refptr<net::IOBuffer> buffer; + scoped_refptr<base::RefCountedBytes> buffer; size_t size; Query(TransferCallback callback, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, int size) : callback(std::move(callback)), buffer(buffer), size(size) {} };
diff --git a/chrome/browser/devtools/device/usb/android_usb_device.cc b/chrome/browser/devtools/device/usb/android_usb_device.cc index c8acbd1..3b35abc3 100644 --- a/chrome/browser/devtools/device/usb/android_usb_device.cc +++ b/chrome/browser/devtools/device/usb/android_usb_device.cc
@@ -11,6 +11,7 @@ #include "base/base64.h" #include "base/lazy_instance.h" #include "base/memory/ptr_util.h" +#include "base/memory/ref_counted_memory.h" #include "base/single_thread_task_runner.h" #include "base/stl_util.h" #include "base/strings/string_util.h" @@ -25,7 +26,6 @@ #include "device/usb/usb_descriptors.h" #include "device/usb/usb_device.h" #include "device/usb/usb_service.h" -#include "net/base/io_buffer.h" #include "net/base/ip_endpoint.h" #include "net/base/net_errors.h" #include "net/socket/stream_socket.h" @@ -107,13 +107,12 @@ return sum; } -void DumpMessage(bool outgoing, const char* data, size_t length) { +void DumpMessage(bool outgoing, const uint8_t* data, size_t length) { #if 0 std::string result = ""; if (length == kHeaderSize) { for (size_t i = 0; i < 24; ++i) { - result += base::StringPrintf("%02x", - data[i] > 0 ? data[i] : (data[i] + 0x100) & 0xFF); + result += base::StringPrintf("%02x", data[i]); if ((i + 1) % 4 == 0) result += " "; } @@ -434,22 +433,20 @@ header.push_back(body_length); header.push_back(Checksum(message->body)); header.push_back(message->command ^ 0xffffffff); - scoped_refptr<net::IOBufferWithSize> header_buffer = - new net::IOBufferWithSize(kHeaderSize); - memcpy(header_buffer.get()->data(), &header[0], kHeaderSize); + auto header_buffer = base::MakeRefCounted<base::RefCountedBytes>( + reinterpret_cast<uint8_t*>(header.data()), kHeaderSize); outgoing_queue_.push(header_buffer); // Queue body. if (!message->body.empty()) { - scoped_refptr<net::IOBufferWithSize> body_buffer = - new net::IOBufferWithSize(body_length); - memcpy(body_buffer->data(), message->body.data(), message->body.length()); + auto body_buffer = base::MakeRefCounted<base::RefCountedBytes>(body_length); + memcpy(body_buffer->front(), message->body.data(), message->body.length()); if (append_zero) body_buffer->data()[body_length - 1] = 0; outgoing_queue_.push(body_buffer); if (zero_mask_ && (body_length & zero_mask_) == 0) { // Send a zero length packet. - outgoing_queue_.push(new net::IOBufferWithSize(0)); + outgoing_queue_.push(base::MakeRefCounted<base::RefCountedBytes>(0)); } } ProcessOutgoing(); @@ -463,7 +460,7 @@ BulkMessage message = outgoing_queue_.front(); outgoing_queue_.pop(); - DumpMessage(true, message->data(), message->size()); + DumpMessage(true, message->front(), message->size()); usb_handle_->GenericTransfer( UsbTransferDirection::OUTBOUND, outbound_address_, message, @@ -472,9 +469,10 @@ weak_factory_.GetWeakPtr())); } -void AndroidUsbDevice::OutgoingMessageSent(UsbTransferStatus status, - scoped_refptr<net::IOBuffer> buffer, - size_t result) { +void AndroidUsbDevice::OutgoingMessageSent( + UsbTransferStatus status, + scoped_refptr<base::RefCountedBytes> buffer, + size_t result) { if (status != UsbTransferStatus::COMPLETED) return; @@ -489,7 +487,7 @@ return; } - scoped_refptr<net::IOBuffer> buffer = new net::IOBuffer(kHeaderSize); + auto buffer = base::MakeRefCounted<base::RefCountedBytes>(kHeaderSize); usb_handle_->GenericTransfer( UsbTransferDirection::INBOUND, inbound_address_, buffer, kHeaderSize, kUsbTimeout, @@ -497,7 +495,7 @@ } void AndroidUsbDevice::ParseHeader(UsbTransferStatus status, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t result) { DCHECK(task_runner_->BelongsToCurrentThread()); @@ -512,9 +510,9 @@ return; } - DumpMessage(false, buffer->data(), result); + DumpMessage(false, buffer->front(), result); std::vector<uint32_t> header(6); - memcpy(&header[0], buffer->data(), result); + memcpy(&header[0], buffer->front(), result); std::unique_ptr<AdbMessage> message( new AdbMessage(header[0], header[1], header[2], "")); uint32_t data_length = header[3]; @@ -546,8 +544,7 @@ return; } - scoped_refptr<net::IOBuffer> buffer = - new net::IOBuffer(static_cast<size_t>(data_length)); + auto buffer = base::MakeRefCounted<base::RefCountedBytes>(data_length); usb_handle_->GenericTransfer( UsbTransferDirection::INBOUND, inbound_address_, buffer, data_length, kUsbTimeout, @@ -559,7 +556,7 @@ uint32_t data_length, uint32_t data_check, UsbTransferStatus status, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t result) { DCHECK(task_runner_->BelongsToCurrentThread()); @@ -577,8 +574,8 @@ return; } - DumpMessage(false, buffer->data(), data_length); - message->body = std::string(buffer->data(), result); + DumpMessage(false, buffer->front(), data_length); + message->body = std::string(buffer->front_as<char>(), result); if (Checksum(message->body) != data_check) { TransferError(UsbTransferStatus::TRANSFER_ERROR); return;
diff --git a/chrome/browser/devtools/device/usb/android_usb_device.h b/chrome/browser/devtools/device/usb/android_usb_device.h index 4a83224..b52a3817 100644 --- a/chrome/browser/devtools/device/usb/android_usb_device.h +++ b/chrome/browser/devtools/device/usb/android_usb_device.h
@@ -27,8 +27,6 @@ } namespace net { -class IOBuffer; -class IOBufferWithSize; class StreamSocket; } @@ -108,12 +106,12 @@ void Queue(std::unique_ptr<AdbMessage> message); void ProcessOutgoing(); void OutgoingMessageSent(device::UsbTransferStatus status, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t result); void ReadHeader(); void ParseHeader(device::UsbTransferStatus status, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t result); void ReadBody(std::unique_ptr<AdbMessage> message, @@ -123,7 +121,7 @@ uint32_t data_length, uint32_t data_check, device::UsbTransferStatus status, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t result); void HandleIncoming(std::unique_ptr<AdbMessage> message); @@ -156,7 +154,7 @@ AndroidUsbSockets sockets_; // Outgoing bulk queue - using BulkMessage = scoped_refptr<net::IOBufferWithSize>; + using BulkMessage = scoped_refptr<base::RefCountedBytes>; base::queue<BulkMessage> outgoing_queue_; // Outgoing messages pending connect
diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc index 0ee139f..ee8526bdd 100644 --- a/chrome/browser/download/download_browsertest.cc +++ b/chrome/browser/download/download_browsertest.cc
@@ -51,6 +51,7 @@ #include "chrome/browser/download/download_target_determiner.h" #include "chrome/browser/download/download_test_file_activity_observer.h" #include "chrome/browser/extensions/extension_service.h" +#include "chrome/browser/extensions/install_verifier.h" #include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/infobars/infobar_service.h" #include "chrome/browser/net/url_request_mock_util.h" @@ -1111,6 +1112,7 @@ content::TestDownloadResponseHandler test_response_handler_; std::unique_ptr<DownloadTestFileActivityObserver> file_activity_observer_; extensions::ScopedIgnoreContentVerifierForTest ignore_content_verifier_; + extensions::ScopedInstallVerifierBypassForTest ignore_install_verification_; }; namespace {
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.cc b/chrome/browser/extensions/api/developer_private/developer_private_api.cc index d261f135..5366fa0 100644 --- a/chrome/browser/extensions/api/developer_private/developer_private_api.cc +++ b/chrome/browser/extensions/api/developer_private/developer_private_api.cc
@@ -55,6 +55,7 @@ #include "content/public/browser/site_instance.h" #include "content/public/browser/storage_partition.h" #include "content/public/browser/web_contents.h" +#include "content/public/common/drop_data.h" #include "extensions/browser/api/file_handlers/app_file_handler_util.h" #include "extensions/browser/app_window/app_window.h" #include "extensions/browser/app_window/app_window_registry.h" @@ -118,6 +119,8 @@ const char kUnpackedAppsFolder[] = "apps_target"; const char kManifestFile[] = "manifest.json"; +base::FilePath* g_drop_path_for_testing = nullptr; + ExtensionService* GetExtensionService(content::BrowserContext* context) { return ExtensionSystem::Get(context)->extension_service(); } @@ -235,7 +238,7 @@ void WebContentsDestroyed() override { if (api_) - api_->allowed_unpacked_paths_.erase(web_contents()); + api_->web_contents_data_.erase(web_contents()); delete this; } @@ -244,6 +247,11 @@ DISALLOW_COPY_AND_ASSIGN(WebContentsTracker); }; +DeveloperPrivateAPI::WebContentsData::WebContentsData() = default; +DeveloperPrivateAPI::WebContentsData::~WebContentsData() = default; +DeveloperPrivateAPI::WebContentsData::WebContentsData(WebContentsData&& other) = + default; + // static BrowserContextKeyedAPIFactory<DeveloperPrivateAPI>* DeveloperPrivateAPI::GetFactoryInstance() { @@ -462,21 +470,16 @@ const base::FilePath& path) { DCHECK(web_contents); last_unpacked_directory_ = path; - IdToPathMap& paths = allowed_unpacked_paths_[web_contents]; - if (paths.empty()) { - // This is the first we've added this WebContents. Track its lifetime so we - // can clean up the paths when it is destroyed. - // WebContentsTracker manages its own lifetime. - new WebContentsTracker(weak_factory_.GetWeakPtr(), web_contents); - } else { - auto existing = std::find_if( - paths.begin(), paths.end(), - [path](const std::pair<std::string, base::FilePath>& entry) { - return entry.second == path; - }); - if (existing != paths.end()) - return existing->first; - } + WebContentsData* data = GetOrCreateWebContentsData(web_contents); + IdToPathMap& paths = data->allowed_unpacked_paths; + auto existing = + std::find_if(paths.begin(), paths.end(), + [path](const std::pair<std::string, base::FilePath>& entry) { + return entry.second == path; + }); + if (existing != paths.end()) + return existing->first; + UnpackedRetryId id = base::GenerateGUID(); paths[id] = path; return id; @@ -485,21 +488,54 @@ base::FilePath DeveloperPrivateAPI::GetUnpackedPath( content::WebContents* web_contents, const UnpackedRetryId& id) const { - auto iter = allowed_unpacked_paths_.find(web_contents); - if (iter == allowed_unpacked_paths_.end()) + const WebContentsData* data = GetWebContentsData(web_contents); + if (!data) return base::FilePath(); - const IdToPathMap& paths = iter->second; + const IdToPathMap& paths = data->allowed_unpacked_paths; auto path_iter = paths.find(id); if (path_iter == paths.end()) return base::FilePath(); return path_iter->second; } +void DeveloperPrivateAPI::SetDraggedPath(content::WebContents* web_contents, + const base::FilePath& dragged_path) { + WebContentsData* data = GetOrCreateWebContentsData(web_contents); + data->dragged_path = dragged_path; +} + +base::FilePath DeveloperPrivateAPI::GetDraggedPath( + content::WebContents* web_contents) const { + const WebContentsData* data = GetWebContentsData(web_contents); + return data ? data->dragged_path : base::FilePath(); +} + void DeveloperPrivateAPI::RegisterNotifications() { EventRouter::Get(profile_)->RegisterObserver( this, developer::OnItemStateChanged::kEventName); } +const DeveloperPrivateAPI::WebContentsData* +DeveloperPrivateAPI::GetWebContentsData( + content::WebContents* web_contents) const { + auto iter = web_contents_data_.find(web_contents); + return iter == web_contents_data_.end() ? nullptr : &iter->second; +} + +DeveloperPrivateAPI::WebContentsData* +DeveloperPrivateAPI::GetOrCreateWebContentsData( + content::WebContents* web_contents) { + auto iter = web_contents_data_.find(web_contents); + if (iter != web_contents_data_.end()) + return &iter->second; + + // This is the first we've added this WebContents. Track its lifetime so we + // can clean up the paths when it is destroyed. + // WebContentsTracker manages its own lifetime. + new WebContentsTracker(weak_factory_.GetWeakPtr(), web_contents); + return &web_contents_data_[web_contents]; +} + DeveloperPrivateAPI::~DeveloperPrivateAPI() {} void DeveloperPrivateAPI::Shutdown() {} @@ -910,6 +946,17 @@ return RespondLater(); } + if (params->options && params->options->use_dragged_path && + *params->options->use_dragged_path) { + DeveloperPrivateAPI* api = DeveloperPrivateAPI::Get(browser_context()); + base::FilePath path = api->GetDraggedPath(web_contents); + if (path.empty()) + return RespondNow(Error("No dragged path")); + AddRef(); // Balanced in FileSelected. + FileSelected(path); + return RespondLater(); + } + if (!ShowPicker(ui::SelectFileDialog::SELECT_FOLDER, l10n_util::GetStringUTF16(IDS_EXTENSION_LOAD_FROM_DIRECTORY), ui::SelectFileDialog::FileTypeInfo(), @@ -969,6 +1016,47 @@ .ToValue())); } +DeveloperPrivateNotifyDragInstallInProgressFunction:: + DeveloperPrivateNotifyDragInstallInProgressFunction() = default; +DeveloperPrivateNotifyDragInstallInProgressFunction:: + ~DeveloperPrivateNotifyDragInstallInProgressFunction() = default; + +ExtensionFunction::ResponseAction +DeveloperPrivateNotifyDragInstallInProgressFunction::Run() { + content::WebContents* web_contents = GetSenderWebContents(); + if (!web_contents) + return RespondNow(Error(kCouldNotFindWebContentsError)); + + const base::FilePath* file_path = nullptr; + if (g_drop_path_for_testing) { + file_path = g_drop_path_for_testing; + } else { + content::DropData* drop_data = web_contents->GetDropData(); + if (!drop_data) + return RespondNow(Error("No current drop data.")); + + if (drop_data->filenames.empty()) + return RespondNow(Error("No files being dragged.")); + + const ui::FileInfo& file_info = drop_data->filenames.front(); + file_path = &file_info.path; + } + + DCHECK(file_path); + // Note(devlin): we don't do further validation that the file is a directory + // here. This is validated in the JS, but if that fails, then trying to load + // the file as an unpacked extension will also fail (reasonably gracefully). + DeveloperPrivateAPI::Get(browser_context()) + ->SetDraggedPath(web_contents, *file_path); + return RespondNow(NoArguments()); +} + +// static +void DeveloperPrivateNotifyDragInstallInProgressFunction::SetDropPathForTesting( + base::FilePath* file_path) { + g_drop_path_for_testing = file_path; +} + bool DeveloperPrivateChooseEntryFunction::ShowPicker( ui::SelectFileDialog::Type picker_type, const base::string16& select_title,
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.h b/chrome/browser/extensions/api/developer_private/developer_private_api.h index ed423b1d..454d4a2 100644 --- a/chrome/browser/extensions/api/developer_private/developer_private_api.h +++ b/chrome/browser/extensions/api/developer_private/developer_private_api.h
@@ -5,6 +5,7 @@ #ifndef CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API_H_ #define CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API_H_ +#include <map> #include <set> #include "base/files/file.h" @@ -187,6 +188,13 @@ base::FilePath GetUnpackedPath(content::WebContents* web_contents, const UnpackedRetryId& id) const; + // Sets the dragged path for the given |web_contents|. + void SetDraggedPath(content::WebContents* web_contents, + const base::FilePath& path); + + // Returns the dragged path for the given |web_contents|, if one exists. + base::FilePath GetDraggedPath(content::WebContents* web_contents) const; + // KeyedService implementation void Shutdown() override; @@ -204,6 +212,30 @@ private: class WebContentsTracker; + using IdToPathMap = std::map<UnpackedRetryId, base::FilePath>; + // Data specific to a given WebContents. + struct WebContentsData { + WebContentsData(); + ~WebContentsData(); + WebContentsData(WebContentsData&& other); + + // A set of unpacked paths that we are allowed to load for different + // WebContents. For security reasons, we don't let JavaScript arbitrarily + // pass us a path and load the extension at that location; instead, the user + // has to explicitly select the path through a native dialog first, and then + // we will allow JavaScript to request we reload that same selected path. + // Additionally, these are segmented by WebContents; this is primarily to + // allow collection (removing old paths when the WebContents closes) but has + // the effect that WebContents A cannot retry a path selected in + // WebContents B. + IdToPathMap allowed_unpacked_paths; + + // The last dragged path for the WebContents. + base::FilePath dragged_path; + + DISALLOW_COPY_AND_ASSIGN(WebContentsData); + }; + friend class BrowserContextKeyedAPIFactory<DeveloperPrivateAPI>; // BrowserContextKeyedAPI implementation. @@ -213,23 +245,18 @@ void RegisterNotifications(); + const WebContentsData* GetWebContentsData( + content::WebContents* web_contents) const; + WebContentsData* GetOrCreateWebContentsData( + content::WebContents* web_contents); + Profile* profile_; // Used to start the load |load_extension_dialog_| in the last directory that // was loaded. base::FilePath last_unpacked_directory_; - // A set of unpacked paths that we are allowed to load for different - // WebContents. For security reasons, we don't let JavaScript arbitrarily - // pass us a path and load the extension at that location; instead, the user - // has to explicitly select the path through a native dialog first, and then - // we will allow JavaScript to request we reload that same selected path. - // Additionally, these are segmented by WebContents; this is primarily to - // allow collection (removing old paths when the WebContents closes) but has - // the effect that WebContents A cannot retry a path selected in - // WebContents B. - using IdToPathMap = std::map<UnpackedRetryId, base::FilePath>; - std::map<content::WebContents*, IdToPathMap> allowed_unpacked_paths_; + std::map<content::WebContents*, WebContentsData> web_contents_data_; // Created lazily upon OnListenerAdded. std::unique_ptr<DeveloperPrivateEventRouter> developer_private_event_router_; @@ -465,6 +492,24 @@ DeveloperPrivateAPI::UnpackedRetryId retry_guid_; }; +class DeveloperPrivateNotifyDragInstallInProgressFunction + : public DeveloperPrivateAPIFunction { + public: + DECLARE_EXTENSION_FUNCTION("developerPrivate.notifyDragInstallInProgress", + DEVELOPERPRIVATE_NOTIFYDRAGINSTALLINPROGRESS); + + DeveloperPrivateNotifyDragInstallInProgressFunction(); + + ResponseAction Run() override; + + static void SetDropPathForTesting(base::FilePath* file_path); + + private: + ~DeveloperPrivateNotifyDragInstallInProgressFunction() override; + + DISALLOW_COPY_AND_ASSIGN(DeveloperPrivateNotifyDragInstallInProgressFunction); +}; + class DeveloperPrivateChoosePathFunction : public DeveloperPrivateChooseEntryFunction { public:
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc b/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc index 2b7ccc2..5113fec8 100644 --- a/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc +++ b/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc
@@ -861,6 +861,87 @@ } } +TEST_F(DeveloperPrivateApiUnitTest, + DeveloperPrivateNotifyDragInstallInProgress) { + std::unique_ptr<content::WebContents> web_contents( + content::WebContentsTester::CreateTestWebContents(profile(), nullptr)); + + TestExtensionDir dir; + dir.WriteManifest( + R"({ + "name": "foo", + "description": "bar", + "version": "1", + "manifest_version": 2 + })"); + base::FilePath path = dir.UnpackedPath(); + api::DeveloperPrivateNotifyDragInstallInProgressFunction:: + SetDropPathForTesting(&path); + + { + auto function = base::MakeRefCounted< + api::DeveloperPrivateNotifyDragInstallInProgressFunction>(); + function->SetRenderFrameHost(web_contents->GetMainFrame()); + api_test_utils::RunFunction(function.get(), "[]", profile()); + } + + // Set the picker to choose an invalid path (the picker should be skipped if + // we supply a retry id). + base::FilePath empty_path; + api::EntryPicker::SkipPickerAndAlwaysSelectPathForTest(&empty_path); + + constexpr char kLoadUnpackedArgs[] = + R"([{"failQuietly": true, + "populateError": true, + "useDraggedPath": true}])"; + + { + // Try reloading the extension by supplying the retry id. It should succeed. + auto function = + base::MakeRefCounted<api::DeveloperPrivateLoadUnpackedFunction>(); + function->SetRenderFrameHost(web_contents->GetMainFrame()); + TestExtensionRegistryObserver observer(registry()); + api_test_utils::RunFunction(function.get(), kLoadUnpackedArgs, profile()); + const Extension* extension = observer.WaitForExtensionLoaded(); + ASSERT_TRUE(extension); + EXPECT_EQ(extension->path(), path); + } + + // Next, ensure that nothing catastrophic happens if the file that was dropped + // was not a directory. In theory, this shouldn't happen (the JS validates the + // file), but it could in the case of a compromised renderer, JS bug, etc. + base::FilePath invalid_path = path.AppendASCII("manifest.json"); + api::DeveloperPrivateNotifyDragInstallInProgressFunction:: + SetDropPathForTesting(&invalid_path); + { + auto function = base::MakeRefCounted< + api::DeveloperPrivateNotifyDragInstallInProgressFunction>(); + function->SetRenderFrameHost(web_contents->GetMainFrame()); + std::unique_ptr<base::Value> result = + api_test_utils::RunFunctionAndReturnSingleResult(function.get(), "[]", + profile()); + } + + { + // Trying to load the bad extension (the path points to the manifest, not + // the directory) should result in a load error. + auto function = + base::MakeRefCounted<api::DeveloperPrivateLoadUnpackedFunction>(); + function->SetRenderFrameHost(web_contents->GetMainFrame()); + TestExtensionRegistryObserver observer(registry()); + std::unique_ptr<base::Value> result = + api_test_utils::RunFunctionAndReturnSingleResult( + function.get(), kLoadUnpackedArgs, profile()); + ASSERT_TRUE(result); + EXPECT_TRUE(api::developer_private::LoadError::FromValue(*result)); + } + + // Cleanup. + api::DeveloperPrivateNotifyDragInstallInProgressFunction:: + SetDropPathForTesting(nullptr); + api::EntryPicker::SkipPickerAndAlwaysSelectPathForTest(nullptr); +} + // Test developerPrivate.requestFileSource. TEST_F(DeveloperPrivateApiUnitTest, DeveloperPrivateRequestFileSource) { // Testing of this function seems light, but that's because it basically just
diff --git a/chrome/browser/extensions/api/developer_private/extension_info_generator.cc b/chrome/browser/extensions/api/developer_private/extension_info_generator.cc index 2ecd98b..53965e17 100644 --- a/chrome/browser/extensions/api/developer_private/extension_info_generator.cc +++ b/chrome/browser/extensions/api/developer_private/extension_info_generator.cc
@@ -411,6 +411,13 @@ info->home_page.url = ManifestURL::GetHomepageURL(&extension).spec(); info->home_page.specified = ManifestURL::SpecifiedHomepageURL(&extension); + // Developer and web store URLs. + // TODO(dschuyler) after MD extensions releases (expected in m64), look into + // removing the |home_page.url| and |home_page.specified| above. + info->manifest_home_page_url = + ManifestURL::GetManifestHomePageURL(&extension).spec(); + info->web_store_url = ManifestURL::GetWebStoreURL(&extension).spec(); + info->id = extension.id(); // Incognito access.
diff --git a/chrome/browser/extensions/api/settings_private/prefs_util.cc b/chrome/browser/extensions/api/settings_private/prefs_util.cc index 7b73936b..07b8ee6c 100644 --- a/chrome/browser/extensions/api/settings_private/prefs_util.cc +++ b/chrome/browser/extensions/api/settings_private/prefs_util.cc
@@ -179,6 +179,8 @@ // Languages page (*s_whitelist)[spellcheck::prefs::kSpellCheckDictionaries] = settings_private::PrefType::PREF_TYPE_LIST; + (*s_whitelist)[spellcheck::prefs::kSpellCheckForcedDictionaries] = + settings_private::PrefType::PREF_TYPE_LIST; (*s_whitelist)[spellcheck::prefs::kSpellCheckUseSpellingService] = settings_private::PrefType::PREF_TYPE_BOOLEAN; (*s_whitelist)[::prefs::kOfferTranslateEnabled] =
diff --git a/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc b/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc index 647f7f40..c24e6e2 100644 --- a/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc +++ b/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc
@@ -67,6 +67,25 @@ static_cast<int>(code)); } +const char* QuotaStatusCodeToString(blink::QuotaStatusCode status) { + switch (status) { + case blink::QuotaStatusCode::kOk: + return "OK."; + case blink::QuotaStatusCode::kErrorNotSupported: + return "Operation not supported."; + case blink::QuotaStatusCode::kErrorInvalidModification: + return "Invalid modification."; + case blink::QuotaStatusCode::kErrorInvalidAccess: + return "Invalid access."; + case blink::QuotaStatusCode::kErrorAbort: + return "Quota operation aborted."; + case blink::QuotaStatusCode::kUnknown: + return "Unknown error."; + } + NOTREACHED(); + return "Unknown error."; +} + } // namespace bool SyncFileSystemDeleteFileSystemFunction::RunAsync() { @@ -323,7 +342,7 @@ } void SyncFileSystemGetUsageAndQuotaFunction::DidGetUsageAndQuota( - storage::QuotaStatusCode status, + blink::QuotaStatusCode status, int64_t usage, int64_t quota) { // Repost to switch from IO thread to UI thread for SendResponse(). @@ -337,7 +356,7 @@ } DCHECK_CURRENTLY_ON(BrowserThread::UI); - if (status != storage::kQuotaStatusOk) { + if (status != blink::QuotaStatusCode::kOk) { error_ = QuotaStatusCodeToString(status); SendResponse(false); return;
diff --git a/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.h b/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.h index 9863c8f9..902a961e 100644 --- a/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.h +++ b/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.h
@@ -15,7 +15,7 @@ #include "chrome/browser/sync_file_system/sync_status_code.h" #include "chrome/common/extensions/api/sync_file_system.h" #include "storage/browser/fileapi/file_system_url.h" -#include "storage/common/quota/quota_types.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" namespace storage { class FileSystemContext; @@ -93,7 +93,7 @@ bool RunAsync() override; private: - void DidGetUsageAndQuota(storage::QuotaStatusCode status, + void DidGetUsageAndQuota(blink::QuotaStatusCode status, int64_t usage, int64_t quota); };
diff --git a/chrome/browser/extensions/extension_browsertest.cc b/chrome/browser/extensions/extension_browsertest.cc index a032fe1..14cafdf 100644 --- a/chrome/browser/extensions/extension_browsertest.cc +++ b/chrome/browser/extensions/extension_browsertest.cc
@@ -153,6 +153,10 @@ return false; } +bool ExtensionBrowserTest::ShouldEnableInstallVerification() { + return false; +} + // static const Extension* ExtensionBrowserTest::GetExtensionByPath( const extensions::ExtensionSet& extensions, @@ -186,6 +190,11 @@ new extensions::ScopedIgnoreContentVerifierForTest()); } + if (!ShouldEnableInstallVerification()) { + ignore_install_verification_.reset( + new extensions::ScopedInstallVerifierBypassForTest()); + } + #if defined(OS_CHROMEOS) if (set_chromeos_user_) { // This makes sure that we create the Default profile first, with no
diff --git a/chrome/browser/extensions/extension_browsertest.h b/chrome/browser/extensions/extension_browsertest.h index 221eaaf..0b2396a8 100644 --- a/chrome/browser/extensions/extension_browsertest.h +++ b/chrome/browser/extensions/extension_browsertest.h
@@ -14,6 +14,7 @@ #include "base/test/scoped_path_override.h" #include "build/build_config.h" #include "chrome/browser/extensions/chrome_extension_test_notification_observer.h" +#include "chrome/browser/extensions/install_verifier.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/test/base/in_process_browser_test.h" @@ -81,6 +82,12 @@ // about content verification. virtual bool ShouldEnableContentVerification(); + // Extensions used in tests are typically not from the web store and will fail + // install verification. The default implementation disables install + // verification; this should be overridden by derived tests which care + // about install verification. + virtual bool ShouldEnableInstallVerification(); + static const extensions::Extension* GetExtensionByPath( const extensions::ExtensionSet& extensions, const base::FilePath& path); @@ -411,6 +418,10 @@ std::unique_ptr<extensions::ScopedIgnoreContentVerifierForTest> ignore_content_verification_; + // Conditionally disable install verification. + std::unique_ptr<extensions::ScopedInstallVerifierBypassForTest> + ignore_install_verification_; + DISALLOW_COPY_AND_ASSIGN(ExtensionBrowserTest); };
diff --git a/chrome/browser/extensions/extension_geolocation_apitest.cc b/chrome/browser/extensions/extension_geolocation_apitest.cc index 201e85b6..eda7310 100644 --- a/chrome/browser/extensions/extension_geolocation_apitest.cc +++ b/chrome/browser/extensions/extension_geolocation_apitest.cc
@@ -3,7 +3,7 @@ // found in the LICENSE file. #include "chrome/browser/extensions/extension_apitest.h" -#include "chrome/test/base/ui_test_utils.h" +#include "device/geolocation/public/cpp/scoped_geolocation_overrider.h" class GeolocationApiTest : public ExtensionApiTest { public: @@ -12,8 +12,12 @@ // InProcessBrowserTest void SetUpOnMainThread() override { - ui_test_utils::OverrideGeolocation(0, 0); + geolocation_overrider_ = + std::make_unique<device::ScopedGeolocationOverrider>(0, 0); } + + private: + std::unique_ptr<device::ScopedGeolocationOverrider> geolocation_overrider_; }; // http://crbug.com/68287
diff --git a/chrome/browser/extensions/extension_service_test_base.h b/chrome/browser/extensions/extension_service_test_base.h index 0e4179c..e90e534 100644 --- a/chrome/browser/extensions/extension_service_test_base.h +++ b/chrome/browser/extensions/extension_service_test_base.h
@@ -122,6 +122,7 @@ content::BrowserContext* browser_context(); Profile* profile(); + TestingProfile* testing_profile() { return profile_.get(); } sync_preferences::TestingPrefServiceSyncable* testing_pref_service(); ExtensionService* service() { return service_; } ExtensionRegistry* registry() { return registry_; }
diff --git a/chrome/browser/extensions/extension_special_storage_policy.cc b/chrome/browser/extensions/extension_special_storage_policy.cc index 65041ad..52e51c3 100644 --- a/chrome/browser/extensions/extension_special_storage_policy.cc +++ b/chrome/browser/extensions/extension_special_storage_policy.cc
@@ -32,8 +32,8 @@ #include "extensions/common/manifest_handlers/content_capabilities_handler.h" #include "extensions/common/permissions/permissions_data.h" #include "storage/browser/quota/quota_manager.h" -#include "storage/common/quota/quota_status_code.h" #include "storage/common/quota/quota_types.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" using content::BrowserThread; using extensions::APIPermission; @@ -42,10 +42,10 @@ namespace { -void ReportQuotaUsage(storage::QuotaStatusCode code, +void ReportQuotaUsage(blink::QuotaStatusCode code, int64_t usage, int64_t quota) { - if (code == storage::kQuotaStatusOk) { + if (code == blink::QuotaStatusCode::kOk) { // We're interested in the amount of space hosted apps are using. Record it // when the extension is granted the unlimited storage permission (once per // extension load, so on average once per run).
diff --git a/chrome/browser/extensions/install_verifier.cc b/chrome/browser/extensions/install_verifier.cc index b6dd776c..51d4e10 100644 --- a/chrome/browser/extensions/install_verifier.cc +++ b/chrome/browser/extensions/install_verifier.cc
@@ -41,7 +41,7 @@ namespace { // This should only be set during tests. -bool g_bypass_for_test = false; +ScopedInstallVerifierBypassForTest::ForceType* g_bypass_for_test = nullptr; enum VerifyStatus { NONE = 0, // Do not request install signatures, and do not enforce them. @@ -108,10 +108,16 @@ } VerifyStatus GetStatus() { - if (g_bypass_for_test) - return NONE; - else - return std::max(GetExperimentStatus(), GetCommandLineStatus()); + if (g_bypass_for_test) { + switch (*g_bypass_for_test) { + case ScopedInstallVerifierBypassForTest::kForceOn: + return ENFORCE_STRICT; + case ScopedInstallVerifierBypassForTest::kForceOff: + return NONE; + } + } + + return std::max(GetExperimentStatus(), GetCommandLineStatus()); } bool ShouldFetchSignature() { @@ -204,20 +210,10 @@ return IsFromStore(extension) && CanUseExtensionApis(extension); } - - // static bool InstallVerifier::IsFromStore(const Extension& extension) { - if (extension.from_webstore() || ManifestURL::UpdatesFromGallery(&extension)) - return true; - - // If an extension has no update url, our autoupdate code will ask the - // webstore about it (to aid in migrating to the webstore from self-hosting - // or sideloading based installs). So we want to do verification checks on - // such extensions too so that we don't accidentally disable old installs of - // extensions that did migrate to the webstore. - return (ManifestURL::GetUpdateURL(&extension).is_empty() && - Manifest::IsAutoUpdateableLocation(extension.location())); + return extension.from_webstore() || + ManifestURL::UpdatesFromGallery(&extension); } void InstallVerifier::Init() { @@ -415,14 +411,20 @@ // will bootstrap itself once the ExtensionsSystem is ready. outcome = NO_SIGNATURE; } else if (!IsVerified(extension->id())) { + // Transient network failures can create a stale signature missing recently + // added extension ids. To avoid false positives, consider all extensions to + // be from the webstore unless the signature explicitly lists the extension + // as invalid. if (signature_.get() && - !base::ContainsKey(signature_->invalid_ids, extension->id())) { + !base::ContainsKey(signature_->invalid_ids, extension->id()) && + GetStatus() < ENFORCE_STRICT) { outcome = NOT_VERIFIED_BUT_UNKNOWN_ID; } else { verified = false; outcome = NOT_VERIFIED; } } + if (!verified && !ShouldEnforce()) { verified = true; outcome = NOT_VERIFIED_BUT_NOT_ENFORCING; @@ -430,6 +432,12 @@ MustRemainDisabledHistogram(outcome); if (!verified) { + DLOG(WARNING) << "Disabling extension " << extension->id() << " ('" + << extension->name() + << "') due to install verification failure. In tests you " + << "might want to use a ScopedInstallVerifierBypassForTest " + << "instance to prevent this."; + if (reason) *reason = disable_reason::DISABLE_NOT_VERIFIED; if (error) @@ -658,18 +666,14 @@ BeginFetch(); } -ScopedInstallVerifierBypassForTest::ScopedInstallVerifierBypassForTest() - : old_value_(ShouldBypass()) { - g_bypass_for_test = true; +ScopedInstallVerifierBypassForTest::ScopedInstallVerifierBypassForTest( + ForceType force_type) + : value_(force_type), old_value_(g_bypass_for_test) { + g_bypass_for_test = &value_; } ScopedInstallVerifierBypassForTest::~ScopedInstallVerifierBypassForTest() { g_bypass_for_test = old_value_; } -// static -bool ScopedInstallVerifierBypassForTest::ShouldBypass() { - return g_bypass_for_test; -} - } // namespace extensions
diff --git a/chrome/browser/extensions/install_verifier.h b/chrome/browser/extensions/install_verifier.h index cca3a3c..552c9ad0 100644 --- a/chrome/browser/extensions/install_verifier.h +++ b/chrome/browser/extensions/install_verifier.h
@@ -180,14 +180,18 @@ // during tests. class ScopedInstallVerifierBypassForTest { public: - ScopedInstallVerifierBypassForTest(); + enum ForceType { + kForceOn, + kForceOff, + }; + + explicit ScopedInstallVerifierBypassForTest(ForceType force_type = kForceOff); ~ScopedInstallVerifierBypassForTest(); - // Should install verification be bypassed? - static bool ShouldBypass(); - private: - bool old_value_; + ForceType value_; + ForceType* old_value_; + DISALLOW_COPY_AND_ASSIGN(ScopedInstallVerifierBypassForTest); };
diff --git a/chrome/browser/extensions/install_verifier_unittest.cc b/chrome/browser/extensions/install_verifier_unittest.cc new file mode 100644 index 0000000..bfe3ac5 --- /dev/null +++ b/chrome/browser/extensions/install_verifier_unittest.cc
@@ -0,0 +1,122 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/extensions/install_verifier.h" + +#include "base/macros.h" +#include "base/values.h" +#include "chrome/browser/extensions/extension_management.h" +#include "chrome/browser/extensions/extension_service_test_base.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/test/base/testing_profile.h" +#include "components/sync_preferences/testing_pref_service_syncable.h" +#include "extensions/browser/pref_names.h" +#include "extensions/common/extension.h" +#include "extensions/common/extension_builder.h" +#include "extensions/common/extension_urls.h" +#include "extensions/common/manifest.h" +#include "extensions/common/value_builder.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace extensions { + +class InstallVerifierTest : public ExtensionServiceTestBase { + public: + InstallVerifierTest() = default; + ~InstallVerifierTest() override = default; + + void SetUp() override { + ExtensionServiceTestBase::SetUp(); + + InitializeExtensionService(ExtensionServiceInitParams()); + } + + // Adds an extension as being allowed by policy. + void AddExtensionAsPolicyInstalled(const ExtensionId& id) { + std::unique_ptr<base::DictionaryValue> extension_entry = + DictionaryBuilder().Set("installation_mode", "allowed").Build(); + testing_profile()->GetTestingPrefService()->SetManagedPref( + pref_names::kExtensionManagement, + DictionaryBuilder().Set(id, std::move(extension_entry)).Build()); + EXPECT_TRUE(ExtensionManagementFactory::GetForBrowserContext(profile()) + ->IsInstallationExplicitlyAllowed(id)); + } + + private: + ScopedInstallVerifierBypassForTest force_install_verification{ + ScopedInstallVerifierBypassForTest::kForceOn}; + std::unique_ptr<ExtensionManagement> extension_management_; + std::unique_ptr<TestingPrefServiceSimple> pref_service_; + + DISALLOW_COPY_AND_ASSIGN(InstallVerifierTest); +}; + +// Test the behavior of the InstallVerifier for various extensions. +TEST_F(InstallVerifierTest, TestIsFromStoreAndMustRemainDisabled) { + enum FromStoreStatus { + FROM_STORE, + NOT_FROM_STORE, + }; + + enum MustRemainDisabledStatus { + MUST_REMAIN_DISABLED, + CAN_BE_ENABLED, + }; + + GURL store_update_url = extension_urls::GetWebstoreUpdateUrl(); + GURL non_store_update_url("https://example.com"); + struct { + const char* test_name; + Manifest::Location location; + base::Optional<GURL> update_url; + FromStoreStatus expected_from_store_status; + MustRemainDisabledStatus expected_must_remain_disabled_status; + } test_cases[] = { + {"internal from store", Manifest::INTERNAL, store_update_url, FROM_STORE, + CAN_BE_ENABLED}, + {"internal non-store update url", Manifest::INTERNAL, + non_store_update_url, NOT_FROM_STORE, MUST_REMAIN_DISABLED}, + {"internal no update url", Manifest::INTERNAL, base::nullopt, + NOT_FROM_STORE, MUST_REMAIN_DISABLED}, + {"unpacked from store", Manifest::UNPACKED, store_update_url, FROM_STORE, + CAN_BE_ENABLED}, + {"unpacked non-store update url", Manifest::UNPACKED, + non_store_update_url, NOT_FROM_STORE, CAN_BE_ENABLED}, + {"unpacked no update url", Manifest::UNPACKED, base::nullopt, + NOT_FROM_STORE, CAN_BE_ENABLED}, + {"external from store", Manifest::EXTERNAL_POLICY_DOWNLOAD, + store_update_url, FROM_STORE, CAN_BE_ENABLED}, + {"external non-store update url", Manifest::EXTERNAL_POLICY_DOWNLOAD, + non_store_update_url, NOT_FROM_STORE, CAN_BE_ENABLED}, + }; + + InstallVerifier* install_verifier = InstallVerifier::Get(profile()); + for (const auto& test_case : test_cases) { + SCOPED_TRACE(test_case.test_name); + ExtensionBuilder extension_builder(test_case.test_name); + extension_builder.SetLocation(test_case.location); + if (test_case.update_url) { + extension_builder.MergeManifest( + DictionaryBuilder() + .Set("update_url", test_case.update_url->spec()) + .Build()); + } + scoped_refptr<const Extension> extension = extension_builder.Build(); + + if (Manifest::IsPolicyLocation(test_case.location)) + AddExtensionAsPolicyInstalled(extension->id()); + + EXPECT_EQ(test_case.expected_from_store_status == FROM_STORE, + InstallVerifier::IsFromStore(*extension)); + disable_reason::DisableReason disable_reason; + base::string16 error; + EXPECT_EQ( + test_case.expected_must_remain_disabled_status == MUST_REMAIN_DISABLED, + install_verifier->MustRemainDisabled(extension.get(), &disable_reason, + &error)) + << error; + } +} + +} // namespace extensions
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index 54adac6..495e2e0 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -2596,11 +2596,11 @@ "If enabled, notification is displayed when device is connected to a " "network behind captive portal."; -const char kNetworkSettingsConfigName[] = - "Settings based Network Configuration"; -const char kNetworkSettingsConfigDescription[] = - "Enables the Settings based network configuration UI instead of the Views " - "based configuration dialog."; +const char kDisableNetworkSettingsConfigName[] = + "Disable Settings based Network Configuration"; +const char kDisableNetworkSettingsConfigDescription[] = + "Disables the Settings based network configuration UI and restores the " + "Views based configuration dialog."; const char kNewKoreanImeName[] = "New Korean IME"; const char kNewKoreanImeDescription[] =
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index ebd329b..b3c903b 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -1614,8 +1614,8 @@ extern const char kNetworkPortalNotificationName[]; extern const char kNetworkPortalNotificationDescription[]; -extern const char kNetworkSettingsConfigName[]; -extern const char kNetworkSettingsConfigDescription[]; +extern const char kDisableNetworkSettingsConfigName[]; +extern const char kDisableNetworkSettingsConfigDescription[]; extern const char kNewKoreanImeName[]; extern const char kNewKoreanImeDescription[];
diff --git a/chrome/browser/geolocation/geolocation_browsertest.cc b/chrome/browser/geolocation/geolocation_browsertest.cc index a8082ef..75289c4 100644 --- a/chrome/browser/geolocation/geolocation_browsertest.cc +++ b/chrome/browser/geolocation/geolocation_browsertest.cc
@@ -35,6 +35,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/test/browser_test_utils.h" #include "device/geolocation/network_location_request.h" +#include "device/geolocation/public/cpp/scoped_geolocation_overrider.h" #include "device/geolocation/public/interfaces/geoposition.mojom.h" #include "google_apis/google_api_keys.h" #include "net/base/escape.h" @@ -232,10 +233,9 @@ }; GeolocationBrowserTest(); - ~GeolocationBrowserTest() override; + ~GeolocationBrowserTest() override = default; // InProcessBrowserTest: - void SetUpOnMainThread() override; void TearDownInProcessBrowserTestFixture() override; Browser* current_browser() { return current_browser_; } @@ -293,6 +293,12 @@ // Convenience method to look up the number of queued permission requests. int GetRequestQueueSize(PermissionRequestManager* manager); + protected: + // The values used for the position override. + double fake_latitude_ = 1.23; + double fake_longitude_ = 4.56; + std::unique_ptr<device::ScopedGeolocationOverrider> geolocation_overrider_; + private: // Calls watchPosition() in JavaScript and accepts or denies the resulting // permission request. Returns the JavaScript response. @@ -314,23 +320,41 @@ // The urls for the iframes loaded by LoadIFrames. std::vector<GURL> iframe_urls_; - // The values used for the position override. - double fake_latitude_ = 1.23; - double fake_longitude_ = 4.56; DISALLOW_COPY_AND_ASSIGN(GeolocationBrowserTest); }; -GeolocationBrowserTest::GeolocationBrowserTest() { +// This class is only used by test case of UrlWithApiKey which connects the +// real geolocation implementation instead of the FakeGeolocation. +// TODO(ke.he@intel.com): crbug.com/788298. Remove this class and rewrite the +// test case of UrlWithApiKey as a services_unittest. Also remove the +// ui_test_utils::OverrideGeolocation() then. +class GeolocationBrowserTestWithoutOverrider : public GeolocationBrowserTest { + public: + GeolocationBrowserTestWithoutOverrider(); + ~GeolocationBrowserTestWithoutOverrider() override = default; + void SetUpOnMainThread() override; + + DISALLOW_COPY_AND_ASSIGN(GeolocationBrowserTestWithoutOverrider); +}; + +GeolocationBrowserTestWithoutOverrider:: + GeolocationBrowserTestWithoutOverrider() { + geolocation_overrider_.reset(); } -GeolocationBrowserTest::~GeolocationBrowserTest() { -} - -void GeolocationBrowserTest::SetUpOnMainThread() { +void GeolocationBrowserTestWithoutOverrider::SetUpOnMainThread() { ui_test_utils::OverrideGeolocation(fake_latitude_, fake_longitude_); } +// WebContentImpl tries to connect Device Service earlier than +// of SetUpOnMainThread(), so create the |geolocation_overrider_| here. +GeolocationBrowserTest::GeolocationBrowserTest() + : geolocation_overrider_( + std::make_unique<device::ScopedGeolocationOverrider>( + fake_latitude_, + fake_longitude_)) {} + void GeolocationBrowserTest::TearDownInProcessBrowserTestFixture() { LOG(WARNING) << "TearDownInProcessBrowserTestFixture. Test Finished."; } @@ -452,7 +476,8 @@ fake_latitude_ = latitude; fake_longitude_ = longitude; - ui_test_utils::OverrideGeolocation(latitude, longitude); + + geolocation_overrider_->UpdateLocation(fake_latitude_, fake_longitude_); std::string result; if (!dom_message_queue.WaitForMessage(&result)) @@ -495,7 +520,8 @@ #endif // Tests that Chrome makes a network geolocation request to the correct URL // including Google API key query param. -IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, MAYBE_UrlWithApiKey) { +IN_PROC_BROWSER_TEST_F(GeolocationBrowserTestWithoutOverrider, + MAYBE_UrlWithApiKey) { ASSERT_NO_FATAL_FAILURE(Initialize(INITIALIZATION_DEFAULT)); // Unique ID (derived from Gerrit CL number):
diff --git a/chrome/browser/loader/predictor_resource_throttle.cc b/chrome/browser/loader/predictor_resource_throttle.cc index 59a90da7..021e238 100644 --- a/chrome/browser/loader/predictor_resource_throttle.cc +++ b/chrome/browser/loader/predictor_resource_throttle.cc
@@ -5,6 +5,9 @@ #include "chrome/browser/loader/predictor_resource_throttle.h" #include "base/memory/ptr_util.h" +#include "base/sequenced_task_runner.h" +#include "base/threading/sequenced_task_runner_handle.h" +#include "base/trace_event/trace_event.h" #include "chrome/browser/net/predictor.h" #include "chrome/browser/profiles/profile_io_data.h" #include "content/public/browser/resource_request_info.h" @@ -27,7 +30,7 @@ PredictorResourceThrottle::PredictorResourceThrottle( net::URLRequest* request, chrome_browser_net::Predictor* predictor) - : request_(request), predictor_(predictor) {} + : request_(request), predictor_(predictor), weak_factory_(this) {} PredictorResourceThrottle::~PredictorResourceThrottle() {} @@ -68,8 +71,6 @@ predictor_->LearnFromNavigation(referring_scheme_host, request_scheme_host); } - // Subresources for main frames are predicted when navigation starts, in - // PredictorTabHelper, so only handle predictions for subframes here. // If the referring host is equal to the request host, then the predictor has // already made any/all predictions when navigating to the referring host. // Don't update the RecentlySeen() time because the timed cache is already @@ -77,10 +78,7 @@ if (IsNavigationRequest(request_) && referring_scheme_host != request_scheme_host) { predictor_->timed_cache()->SetRecentlySeen(request_scheme_host); - if (resource_type == content::RESOURCE_TYPE_SUB_FRAME) { - predictor_->PredictFrameSubresources(request_scheme_host, - request_->site_for_cookies()); - } + DispatchPredictions(request_scheme_host, request_->site_for_cookies()); } } @@ -115,10 +113,26 @@ } predictor_->timed_cache()->SetRecentlySeen(new_scheme_host); - predictor_->PredictFrameSubresources(new_scheme_host, - redirect_info.new_site_for_cookies); + DispatchPredictions(new_scheme_host, redirect_info.new_site_for_cookies); } const char* PredictorResourceThrottle::GetNameForLogging() const { return "PredictorResourceThrottle"; } + +void PredictorResourceThrottle::DispatchPredictions( + const GURL& url, + const GURL& site_for_cookies) { + // Dispatch predictions asynchronously to avoid blocking the actual request + // from going out to the network. + base::SequencedTaskRunnerHandle::Get()->PostTask( + FROM_HERE, + base::BindOnce(&PredictorResourceThrottle::DoPredict, + weak_factory_.GetWeakPtr(), url, site_for_cookies)); +} + +void PredictorResourceThrottle::DoPredict(const GURL& url, + const GURL& site_for_cookies) { + TRACE_EVENT0("loading", "PredictorResourceThrottle::DoPredict"); + predictor_->PredictFrameSubresources(url, site_for_cookies); +}
diff --git a/chrome/browser/loader/predictor_resource_throttle.h b/chrome/browser/loader/predictor_resource_throttle.h index 5fe97c3..083b7eed 100644 --- a/chrome/browser/loader/predictor_resource_throttle.h +++ b/chrome/browser/loader/predictor_resource_throttle.h
@@ -8,6 +8,7 @@ #include <memory> #include "base/macros.h" +#include "base/memory/weak_ptr.h" #include "content/public/browser/resource_throttle.h" namespace chrome_browser_net { @@ -19,20 +20,19 @@ class URLRequest; } +class GURL; class ProfileIOData; // This resource throttle tracks requests in order to help the predictor learn // resource relationships. It notifies the predictor of redirect and referrer // relationships, and populates the predictor's timed cache of ongoing -// navigations. It also initiates predictive actions based on subframe +// navigations. It also initiates predictive actions based on navigation // requests and redirects. // Note: This class does not issue predictive actions off of the initial main // frame request (before any redirects). That is done on the UI thread in // response to navigation callbacks in predictor_tab_helper.cc. // TODO(csharrison): This class shouldn't depend on chrome_browser_net. The // predictor should probably be moved here (along with its dependencies). -// TODO(csharrison): When the PreconnectMore experiment is over, move all -// prediction dispatching to the tab helper. class PredictorResourceThrottle : public content::ResourceThrottle { public: PredictorResourceThrottle(net::URLRequest* request, @@ -50,9 +50,14 @@ const char* GetNameForLogging() const override; private: + void DispatchPredictions(const GURL& url, const GURL& site_for_cookies); + void DoPredict(const GURL& url, const GURL& site_for_cookies); + net::URLRequest* request_; chrome_browser_net::Predictor* predictor_; + base::WeakPtrFactory<PredictorResourceThrottle> weak_factory_; + DISALLOW_COPY_AND_ASSIGN(PredictorResourceThrottle); };
diff --git a/chrome/browser/media/media_engagement_autoplay_browsertest.cc b/chrome/browser/media/media_engagement_autoplay_browsertest.cc index a0b1539..2b354847 100644 --- a/chrome/browser/media/media_engagement_autoplay_browsertest.cc +++ b/chrome/browser/media/media_engagement_autoplay_browsertest.cc
@@ -142,7 +142,8 @@ // Launch the generator and wait for it to finish. base::CommandLine cmd(GetPythonPath()); - cmd.AppendArg("tools/media_engagement_preload/make_dafsa.py"); + cmd.AppendArgPath(module_dir.Append( + FILE_PATH_LITERAL("tools/media_engagement_preload/make_dafsa.py"))); cmd.AppendArgPath(input_path); cmd.AppendArgPath(output_path); base::Process process = base::LaunchProcess(cmd, base::LaunchOptions());
diff --git a/chrome/browser/media/router/media_router_metrics.cc b/chrome/browser/media/router/media_router_metrics.cc index 526fa9c..7134fdc 100644 --- a/chrome/browser/media/router/media_router_metrics.cc +++ b/chrome/browser/media/router/media_router_metrics.cc
@@ -9,6 +9,7 @@ #include "base/metrics/histogram_macros.h" #include "base/strings/string_util.h" #include "base/time/default_clock.h" +#include "chrome/common/media_router/media_sink.h" #include "chrome/common/media_router/media_source_helper.h" #include "url/gurl.h" #include "url/url_constants.h" @@ -52,6 +53,10 @@ "MediaRouter.Source.LocalFileFormat"; const char MediaRouterMetrics::kHistogramMediaRouterFileSize[] = "MediaRouter.Source.LocalFileSize"; +const char MediaRouterMetrics::kHistogramMediaSinkType[] = + "MediaRouter.MediaSink.SelectedType"; +const char MediaRouterMetrics::kHistogramPresentationUrlType[] = + "MediaRouter.PresentationRequest.AvailabilityUrlType"; const char MediaRouterMetrics::kHistogramRouteCreationOutcome[] = "MediaRouter.Route.CreationOutcome"; const char MediaRouterMetrics::kHistogramUiDialogPaint[] = @@ -60,8 +65,6 @@ "MediaRouter.Ui.Dialog.LoadedWithData"; const char MediaRouterMetrics::kHistogramUiFirstAction[] = "MediaRouter.Ui.FirstAction"; -const char MediaRouterMetrics::kHistogramPresentationUrlType[] = - "MediaRouter.PresentationRequest.AvailabilityUrlType"; // static void MediaRouterMetrics::RecordMediaRouterDialogOrigin( @@ -139,4 +142,10 @@ PresentationUrlType::kPresentationUrlTypeCount); } +// static +void MediaRouterMetrics::RecordMediaSinkType(SinkIconType sink_icon_type) { + UMA_HISTOGRAM_ENUMERATION(kHistogramMediaSinkType, sink_icon_type, + SinkIconType::TOTAL_COUNT); +} + } // namespace media_router
diff --git a/chrome/browser/media/router/media_router_metrics.h b/chrome/browser/media/router/media_router_metrics.h index 56ff5a30..cfee5c5 100644 --- a/chrome/browser/media/router/media_router_metrics.h +++ b/chrome/browser/media/router/media_router_metrics.h
@@ -17,6 +17,8 @@ namespace media_router { +enum class SinkIconType; + // NOTE: Do not renumber enums as that would confuse interpretation of // previously logged data. When making changes, also update the enum list // in tools/metrics/histograms/histograms.xml to keep it in sync. @@ -84,11 +86,12 @@ static const char kHistogramMediaRouterCastingSource[]; static const char kHistogramMediaRouterFileFormat[]; static const char kHistogramMediaRouterFileSize[]; + static const char kHistogramMediaSinkType[]; + static const char kHistogramPresentationUrlType[]; static const char kHistogramRouteCreationOutcome[]; static const char kHistogramUiDialogPaint[]; static const char kHistogramUiDialogLoadedWithData[]; static const char kHistogramUiFirstAction[]; - static const char kHistogramPresentationUrlType[]; // Records where the user clicked to open the Media Router dialog. static void RecordMediaRouterDialogOrigin( @@ -129,6 +132,9 @@ // Records the type of Presentation URL used by a web page. static void RecordPresentationUrlType(const GURL& url); + + // Records the type of the sink that media is being Cast to. + static void RecordMediaSinkType(SinkIconType sink_icon_type); }; } // namespace media_router
diff --git a/chrome/browser/media/router/media_router_metrics_unittest.cc b/chrome/browser/media/router/media_router_metrics_unittest.cc index 91675622..f2c8625 100644 --- a/chrome/browser/media/router/media_router_metrics_unittest.cc +++ b/chrome/browser/media/router/media_router_metrics_unittest.cc
@@ -10,6 +10,7 @@ #include "base/test/simple_test_clock.h" #include "base/time/time.h" #include "chrome/browser/ui/webui/media_router/media_cast_mode.h" +#include "chrome/common/media_router/media_sink.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" @@ -167,4 +168,25 @@ Bucket(static_cast<int>(PresentationUrlType::kRemotePlayback), 1))); } +TEST(MediaRouterMetricsTest, RecordMediaSinkType) { + base::HistogramTester tester; + tester.ExpectTotalCount(MediaRouterMetrics::kHistogramMediaSinkType, 0); + + MediaRouterMetrics::RecordMediaSinkType(SinkIconType::WIRED_DISPLAY); + MediaRouterMetrics::RecordMediaSinkType(SinkIconType::CAST); + MediaRouterMetrics::RecordMediaSinkType(SinkIconType::CAST_AUDIO); + MediaRouterMetrics::RecordMediaSinkType(SinkIconType::HANGOUT); + MediaRouterMetrics::RecordMediaSinkType(SinkIconType::CAST); + MediaRouterMetrics::RecordMediaSinkType(SinkIconType::GENERIC); + + tester.ExpectTotalCount(MediaRouterMetrics::kHistogramMediaSinkType, 6); + EXPECT_THAT( + tester.GetAllSamples(MediaRouterMetrics::kHistogramMediaSinkType), + ElementsAre(Bucket(static_cast<int>(SinkIconType::CAST), 2), + Bucket(static_cast<int>(SinkIconType::CAST_AUDIO), 1), + Bucket(static_cast<int>(SinkIconType::HANGOUT), 1), + Bucket(static_cast<int>(SinkIconType::WIRED_DISPLAY), 1), + Bucket(static_cast<int>(SinkIconType::GENERIC), 1))); +} + } // namespace media_router
diff --git a/chrome/browser/media/router/mojo/media_router_mojo_impl.cc b/chrome/browser/media/router/mojo/media_router_mojo_impl.cc index bee5d359..ae6d2446d 100644 --- a/chrome/browser/media/router/mojo/media_router_mojo_impl.cc +++ b/chrome/browser/media/router/mojo/media_router_mojo_impl.cc
@@ -18,6 +18,7 @@ #include "chrome/browser/media/router/issues_observer.h" #include "chrome/browser/media/router/media_router_factory.h" #include "chrome/browser/media/router/media_router_feature.h" +#include "chrome/browser/media/router/media_router_metrics.h" #include "chrome/browser/media/router/media_routes_observer.h" #include "chrome/browser/media/router/media_sinks_observer.h" #include "chrome/browser/media/router/mojo/media_route_controller.h" @@ -179,22 +180,22 @@ base::TimeDelta timeout, bool incognito) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - base::Optional<MediaRouteProviderId> provider_id = - GetProviderIdForSink(sink_id); - if (!provider_id) { + const MediaSink* sink = GetSinkById(sink_id); + if (!sink) { std::unique_ptr<RouteRequestResult> result = RouteRequestResult::FromError( "Sink not found", RouteRequestResult::SINK_NOT_FOUND); RunRouteRequestCallbacks(std::move(result), std::move(callbacks)); return; } + MediaRouterMetrics::RecordMediaSinkType(sink->icon_type()); + MediaRouteProviderId provider_id = sink->provider_id(); int tab_id = SessionTabHelper::IdForTab(web_contents); std::string presentation_id = MediaRouterBase::CreatePresentationId(); - auto callback = - base::BindOnce(&MediaRouterMojoImpl::RouteResponseReceived, - weak_factory_.GetWeakPtr(), presentation_id, *provider_id, - incognito, base::Passed(&callbacks), false); - media_route_providers_[*provider_id]->CreateRoute( + auto callback = base::BindOnce( + &MediaRouterMojoImpl::RouteResponseReceived, weak_factory_.GetWeakPtr(), + presentation_id, provider_id, incognito, base::Passed(&callbacks), false); + media_route_providers_[provider_id]->CreateRoute( source_id, sink_id, presentation_id, origin, tab_id, timeout, incognito, std::move(callback)); }
diff --git a/chrome/browser/media_galleries/chromeos/mtp_device_object_enumerator.cc b/chrome/browser/media_galleries/chromeos/mtp_device_object_enumerator.cc index 5884cc6..d7086cc 100644 --- a/chrome/browser/media_galleries/chromeos/mtp_device_object_enumerator.cc +++ b/chrome/browser/media_galleries/chromeos/mtp_device_object_enumerator.cc
@@ -7,7 +7,7 @@ #include "base/logging.h" MTPDeviceObjectEnumerator::MTPDeviceObjectEnumerator( - const std::vector<MtpFileEntry>& entries) + const std::vector<device::mojom::MtpFileEntry>& entries) : file_entries_(entries), index_(0U), is_index_ready_(false) { @@ -24,25 +24,26 @@ if (!HasMoreEntries()) return base::FilePath(); - return base::FilePath(file_entries_[index_].file_name()); + return base::FilePath(file_entries_[index_].file_name); } int64_t MTPDeviceObjectEnumerator::Size() { if (!IsIndexReadyAndInRange()) return 0; - return file_entries_[index_].file_size(); + return file_entries_[index_].file_size; } bool MTPDeviceObjectEnumerator::IsDirectory() { if (!IsIndexReadyAndInRange()) return false; - return file_entries_[index_].file_type() == MtpFileEntry::FILE_TYPE_FOLDER; + return file_entries_[index_].file_type == + device::mojom::MtpFileEntry::FileType::FILE_TYPE_FOLDER; } base::Time MTPDeviceObjectEnumerator::LastModifiedTime() { if (!IsIndexReadyAndInRange()) return base::Time(); - return base::Time::FromTimeT(file_entries_[index_].modification_time()); + return base::Time::FromTimeT(file_entries_[index_].modification_time); } bool MTPDeviceObjectEnumerator::GetEntryId(uint32_t* entry_id) const { @@ -50,7 +51,7 @@ if (!IsIndexReadyAndInRange()) return false; - *entry_id = file_entries_[index_].item_id(); + *entry_id = file_entries_[index_].item_id; return true; }
diff --git a/chrome/browser/media_galleries/chromeos/mtp_device_object_enumerator.h b/chrome/browser/media_galleries/chromeos/mtp_device_object_enumerator.h index b2d24641..ea8a993 100644 --- a/chrome/browser/media_galleries/chromeos/mtp_device_object_enumerator.h +++ b/chrome/browser/media_galleries/chromeos/mtp_device_object_enumerator.h
@@ -13,12 +13,13 @@ #include "base/files/file_path.h" #include "base/macros.h" #include "base/time/time.h" -#include "device/media_transfer_protocol/mtp_file_entry.pb.h" +#include "device/media_transfer_protocol/public/interfaces/mtp_file_entry.mojom.h" // Used to enumerate top-level files of an media file system. class MTPDeviceObjectEnumerator { public: - explicit MTPDeviceObjectEnumerator(const std::vector<MtpFileEntry>& entries); + explicit MTPDeviceObjectEnumerator( + const std::vector<device::mojom::MtpFileEntry>& entries); ~MTPDeviceObjectEnumerator(); @@ -41,7 +42,7 @@ bool IsIndexReadyAndInRange() const; // List of directory file entries information. - const std::vector<MtpFileEntry> file_entries_; + const std::vector<device::mojom::MtpFileEntry> file_entries_; // Index into |file_entries_|. // Should only be used when |is_index_ready_| is true.
diff --git a/chrome/browser/media_galleries/chromeos/mtp_device_object_enumerator_unittest.cc b/chrome/browser/media_galleries/chromeos/mtp_device_object_enumerator_unittest.cc index b8069279..1e2f176 100644 --- a/chrome/browser/media_galleries/chromeos/mtp_device_object_enumerator_unittest.cc +++ b/chrome/browser/media_galleries/chromeos/mtp_device_object_enumerator_unittest.cc
@@ -37,7 +37,7 @@ typedef testing::Test MTPDeviceObjectEnumeratorTest; TEST_F(MTPDeviceObjectEnumeratorTest, Empty) { - std::vector<MtpFileEntry> entries; + std::vector<device::mojom::MtpFileEntry> entries; MTPDeviceObjectEnumerator enumerator(entries); TestEnumeratorIsEmpty(&enumerator); TestNextEntryIsEmpty(&enumerator); @@ -46,15 +46,15 @@ } TEST_F(MTPDeviceObjectEnumeratorTest, Traversal) { - std::vector<MtpFileEntry> entries; + std::vector<device::mojom::MtpFileEntry> entries; for (size_t i = 0; i < arraysize(kTestCases); ++i) { - MtpFileEntry entry; - entry.set_file_name(kTestCases[i].name); - entry.set_file_size(kTestCases[i].size); - entry.set_file_type(kTestCases[i].is_directory ? - MtpFileEntry::FILE_TYPE_FOLDER : - MtpFileEntry::FILE_TYPE_OTHER); - entry.set_modification_time(kTestCases[i].modification_time); + device::mojom::MtpFileEntry entry; + entry.file_name = kTestCases[i].name; + entry.file_size = kTestCases[i].size; + entry.file_type = kTestCases[i].is_directory + ? device::mojom::MtpFileEntry::FileType::FILE_TYPE_FOLDER + : device::mojom::MtpFileEntry::FileType::FILE_TYPE_OTHER; + entry.modification_time = kTestCases[i].modification_time; entries.push_back(entry); } MTPDeviceObjectEnumerator enumerator(entries);
diff --git a/chrome/browser/media_galleries/chromeos/mtp_device_task_helper.cc b/chrome/browser/media_galleries/chromeos/mtp_device_task_helper.cc index e4cae1c..d998f4a 100644 --- a/chrome/browser/media_galleries/chromeos/mtp_device_task_helper.cc +++ b/chrome/browser/media_galleries/chromeos/mtp_device_task_helper.cc
@@ -33,14 +33,16 @@ return StorageMonitor::GetInstance()->media_transfer_protocol_manager(); } -base::File::Info FileInfoFromMTPFileEntry(const MtpFileEntry& file_entry) { +base::File::Info FileInfoFromMTPFileEntry( + const device::mojom::MtpFileEntry& file_entry) { base::File::Info file_entry_info; - file_entry_info.size = file_entry.file_size(); + file_entry_info.size = file_entry.file_size; file_entry_info.is_directory = - file_entry.file_type() == MtpFileEntry::FILE_TYPE_FOLDER; + file_entry.file_type == + device::mojom::MtpFileEntry::FileType::FILE_TYPE_FOLDER; file_entry_info.is_symbolic_link = false; file_entry_info.last_modified = - base::Time::FromTimeT(file_entry.modification_time()); + base::Time::FromTimeT(file_entry.modification_time); file_entry_info.last_accessed = file_entry_info.last_modified; file_entry_info.creation_time = base::Time(); return file_entry_info; @@ -221,7 +223,7 @@ void MTPDeviceTaskHelper::OnGetFileInfo( const GetFileInfoSuccessCallback& success_callback, const ErrorCallback& error_callback, - const MtpFileEntry& file_entry, + const device::mojom::MtpFileEntry& file_entry, bool error) const { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); if (error) { @@ -254,7 +256,7 @@ void MTPDeviceTaskHelper::OnDidReadDirectory( const ReadDirectorySuccessCallback& success_callback, const ErrorCallback& error_callback, - const std::vector<MtpFileEntry>& file_entries, + const std::vector<device::mojom::MtpFileEntry>& file_entries, bool has_more, bool error) const { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); @@ -282,7 +284,7 @@ void MTPDeviceTaskHelper::OnGetFileInfoToReadBytes( const MTPDeviceAsyncDelegate::ReadBytesRequest& request, - const MtpFileEntry& file_entry, + const device::mojom::MtpFileEntry& file_entry, bool error) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK(request.buf.get());
diff --git a/chrome/browser/media_galleries/chromeos/mtp_device_task_helper.h b/chrome/browser/media_galleries/chromeos/mtp_device_task_helper.h index f4e34ad..2c4b9be 100644 --- a/chrome/browser/media_galleries/chromeos/mtp_device_task_helper.h +++ b/chrome/browser/media_galleries/chromeos/mtp_device_task_helper.h
@@ -16,7 +16,7 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h" -#include "device/media_transfer_protocol/mtp_file_entry.pb.h" +#include "device/media_transfer_protocol/public/interfaces/mtp_file_entry.mojom.h" #include "storage/browser/fileapi/async_file_util.h" class MTPReadFileWorker; @@ -169,7 +169,7 @@ // caller. void OnGetFileInfo(const GetFileInfoSuccessCallback& success_callback, const ErrorCallback& error_callback, - const MtpFileEntry& file_entry, + const device::mojom::MtpFileEntry& file_entry, bool error) const; // Called when CreateDirectory completes. @@ -185,16 +185,17 @@ // // If there is an error, |error| is set to true, |file_entries| is empty // and |error_callback| is invoked on the IO thread to notify the caller. - void OnDidReadDirectory(const ReadDirectorySuccessCallback& success_callback, - const ErrorCallback& error_callback, - const std::vector<MtpFileEntry>& file_entries, - bool has_more, - bool error) const; + void OnDidReadDirectory( + const ReadDirectorySuccessCallback& success_callback, + const ErrorCallback& error_callback, + const std::vector<device::mojom::MtpFileEntry>& file_entries, + bool has_more, + bool error) const; // Intermediate step to finish a ReadBytes request. void OnGetFileInfoToReadBytes( const MTPDeviceAsyncDelegate::ReadBytesRequest& request, - const MtpFileEntry& file_entry, + const device::mojom::MtpFileEntry& file_entry, bool error); // Query callback for ReadBytes();
diff --git a/chrome/browser/metrics/process_memory_metrics_emitter_browsertest.cc b/chrome/browser/metrics/process_memory_metrics_emitter_browsertest.cc index ea36bbfc..b944440 100644 --- a/chrome/browser/metrics/process_memory_metrics_emitter_browsertest.cc +++ b/chrome/browser/metrics/process_memory_metrics_emitter_browsertest.cc
@@ -420,7 +420,9 @@ #if defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER) #define MAYBE_FetchAndEmitMetrics DISABLED_FetchAndEmitMetrics #else -#define MAYBE_FetchAndEmitMetrics FetchAndEmitMetrics +// TODO(michaelpg): Remove this unconditional disabling once new UKM testing +// style CLs land: crbug.com/761524. +#define MAYBE_FetchAndEmitMetrics DISABLED_FetchAndEmitMetrics #endif IN_PROC_BROWSER_TEST_F(ProcessMemoryMetricsEmitterTest, MAYBE_FetchAndEmitMetrics) { @@ -454,8 +456,10 @@ #define MAYBE_FetchAndEmitMetricsWithExtensions \ DISABLED_FetchAndEmitMetricsWithExtensions #else +// TODO(michaelpg): Remove this unconditional disabling once new UKM testing +// style CLs land: crbug.com/761524. #define MAYBE_FetchAndEmitMetricsWithExtensions \ - FetchAndEmitMetricsWithExtensions + DISABLED_FetchAndEmitMetricsWithExtensions #endif IN_PROC_BROWSER_TEST_F(ProcessMemoryMetricsEmitterTest, MAYBE_FetchAndEmitMetricsWithExtensions) { @@ -499,8 +503,10 @@ #define MAYBE_FetchAndEmitMetricsWithHostedApps \ DISABLED_FetchAndEmitMetricsWithHostedApps #else +// TODO(michaelpg): Remove this unconditional disabling once new UKM testing +// style CLs land: crbug.com/761524. #define MAYBE_FetchAndEmitMetricsWithHostedApps \ - FetchAndEmitMetricsWithHostedApps + DISABLED_FetchAndEmitMetricsWithHostedApps #endif IN_PROC_BROWSER_TEST_F(ProcessMemoryMetricsEmitterTest, MAYBE_FetchAndEmitMetricsWithHostedApps) { @@ -592,7 +598,9 @@ #if defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER) #define MAYBE_FetchDuringTrace DISABLED_FetchDuringTrace #else -#define MAYBE_FetchDuringTrace FetchDuringTrace +// TODO(michaelpg): Remove this unconditional disabling once new UKM testing +// style CLs land: crbug.com/761524. +#define MAYBE_FetchDuringTrace DISABLED_FetchDuringTrace #endif IN_PROC_BROWSER_TEST_F(ProcessMemoryMetricsEmitterTest, MAYBE_FetchDuringTrace) { @@ -650,7 +658,9 @@ #if defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER) #define MAYBE_FetchThreeTimes DISABLED_FetchThreeTimes #else -#define MAYBE_FetchThreeTimes FetchThreeTimes +// TODO(michaelpg): Remove this unconditional disabling once new UKM testing +// style CLs land: crbug.com/761524. +#define MAYBE_FetchThreeTimes DISABLED_FetchThreeTimes #endif IN_PROC_BROWSER_TEST_F(ProcessMemoryMetricsEmitterTest, MAYBE_FetchThreeTimes) { ASSERT_TRUE(embedded_test_server()->Start()); @@ -680,7 +690,9 @@ #if defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER) #define MAYBE_ForegroundAndBackgroundPages DISABLED_ForegroundAndBackgroundPages #else -#define MAYBE_ForegroundAndBackgroundPages ForegroundAndBackgroundPages +// TODO(michaelpg): Remove this unconditional disabling once new UKM testing +// style CLs land: crbug.com/761524. +#define MAYBE_ForegroundAndBackgroundPages DISABLED_ForegroundAndBackgroundPages #endif IN_PROC_BROWSER_TEST_F(ProcessMemoryMetricsEmitterTest, MAYBE_ForegroundAndBackgroundPages) {
diff --git a/chrome/browser/net/predictor_browsertest.cc b/chrome/browser/net/predictor_browsertest.cc index 0b6c5f7..2cacbf1 100644 --- a/chrome/browser/net/predictor_browsertest.cc +++ b/chrome/browser/net/predictor_browsertest.cc
@@ -61,6 +61,7 @@ #include "net/url_request/url_request_test_job.h" #include "testing/gmock/include/gmock/gmock.h" #include "url/gurl.h" +#include "url/url_constants.h" using content::BrowserThread; using testing::HasSubstr; @@ -1410,9 +1411,14 @@ EXPECT_EQ(0u, cross_site_connection_listener_->GetAcceptedSocketCount()); // Now, navigate using a renderer initiated navigation and expect preconnects. + // Need to navigate to about:blank first so the referring site is different + // from the request site. + ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL)); EXPECT_TRUE(content::ExecuteScript( browser()->tab_strip_model()->GetActiveWebContents(), - "window.location.href='/title1.html'")); + base::StringPrintf( + "window.location.href='%s'", + embedded_test_server()->GetURL("/title1.html").spec().c_str()))); // The renderer initiated navigation is not synchronous, so just wait for the // preconnects to go through.
diff --git a/chrome/browser/net/predictor_tab_helper.cc b/chrome/browser/net/predictor_tab_helper.cc index 00adda9dbc..dcf2bc9 100644 --- a/chrome/browser/net/predictor_tab_helper.cc +++ b/chrome/browser/net/predictor_tab_helper.cc
@@ -6,10 +6,6 @@ #include "chrome/browser/net/predictor.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/common/chrome_features.h" -#include "chrome/common/url_constants.h" -#include "content/public/browser/navigation_handle.h" -#include "content/public/common/browser_side_navigation_policy.h" #if defined(OS_CHROMEOS) #include "chrome/browser/chromeos/profiles/profile_helper.h" @@ -20,41 +16,9 @@ namespace chrome_browser_net { PredictorTabHelper::PredictorTabHelper(content::WebContents* web_contents) - : content::WebContentsObserver(web_contents), - predicted_from_pending_entry_(false) { -} + : content::WebContentsObserver(web_contents) {} -PredictorTabHelper::~PredictorTabHelper() { -} - -void PredictorTabHelper::DidStartNavigation( - content::NavigationHandle* navigation_handle) { - if (!base::FeatureList::IsEnabled(features::kPreconnectMore) && - (!content::IsBrowserSideNavigationEnabled() || - navigation_handle->IsRendererInitiated())) - return; - // Subframe navigations are handled in WitnessURLRequest. - if (!navigation_handle->IsInMainFrame()) - return; - if (predicted_from_pending_entry_) { - predicted_from_pending_entry_ = false; - return; - } - PreconnectUrl(navigation_handle->GetURL()); -} - -void PredictorTabHelper::DidStartNavigationToPendingEntry( - const GURL& url, - content::ReloadType reload_type) { - // This method isn't needed with PlzNavigate (see comment in header for - // predicted_from_pending_entry_) - if (content::IsBrowserSideNavigationEnabled()) - return; - - // The standard way to preconnect based on navigation. - PreconnectUrl(url); - predicted_from_pending_entry_ = true; -} +PredictorTabHelper::~PredictorTabHelper() {} void PredictorTabHelper::DocumentOnLoadCompletedInMainFrame() { Profile* profile = @@ -68,12 +32,4 @@ predictor->SaveStateForNextStartup(); } -void PredictorTabHelper::PreconnectUrl(const GURL& url) { - Profile* profile = - Profile::FromBrowserContext(web_contents()->GetBrowserContext()); - Predictor* predictor(profile->GetNetworkPredictor()); - if (predictor && url.SchemeIsHTTPOrHTTPS()) - predictor->PreconnectUrlAndSubresources(url, GURL()); -} - } // namespace chrome_browser_net
diff --git a/chrome/browser/net/predictor_tab_helper.h b/chrome/browser/net/predictor_tab_helper.h index 643dbc9..8fa7331 100644 --- a/chrome/browser/net/predictor_tab_helper.h +++ b/chrome/browser/net/predictor_tab_helper.h
@@ -6,16 +6,9 @@ #define CHROME_BROWSER_NET_PREDICTOR_TAB_HELPER_H_ #include "base/macros.h" -#include "content/public/browser/notification_observer.h" -#include "content/public/browser/notification_registrar.h" -#include "content/public/browser/reload_type.h" #include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_user_data.h" -namespace content { -class NavigationHandle; -} - namespace chrome_browser_net { class PredictorTabHelper @@ -25,28 +18,12 @@ ~PredictorTabHelper() override; // content::WebContentsObserver: - void DidStartNavigation( - content::NavigationHandle* navigation_handle) override; - void DidStartNavigationToPendingEntry( - const GURL& url, - content::ReloadType reload_type) override; void DocumentOnLoadCompletedInMainFrame() override; private: explicit PredictorTabHelper(content::WebContents* web_contents); friend class content::WebContentsUserData<PredictorTabHelper>; - void PreconnectUrl(const GURL& url); - - // This boolean is set to true after a call to - // DidStartNavigationToPendingEntry, which fires off predictive preconnects. - // This ensures that the resulting call to DidStartNavigation does not - // duplicate these preconnects. The tab helper spawns preconnects on the - // navigation to the pending entry because DidStartNavigation is called after - // render process spawn (pre-PlzNavigate), which can take substantial time - // especially on Android. - bool predicted_from_pending_entry_; - DISALLOW_COPY_AND_ASSIGN(PredictorTabHelper); };
diff --git a/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.cc b/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.cc index 3ae4a96b..c276cf0 100644 --- a/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.cc +++ b/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.cc
@@ -80,12 +80,12 @@ web_contents, previews::PreviewsType::LOFI, base::Time() /* previews_freshness */, true /* is_data_saver_user */, false /* is_reload */, - base::Bind(&AddPreviewNavigationToBlackListCallback, - web_contents->GetBrowserContext(), - web_contents->GetController() - .GetLastCommittedEntry() - ->GetRedirectChain()[0], - previews::PreviewsType::LOFI, page_id), + base::BindOnce(&AddPreviewNavigationToBlackListCallback, + web_contents->GetBrowserContext(), + web_contents->GetController() + .GetLastCommittedEntry() + ->GetRedirectChain()[0], + previews::PreviewsType::LOFI, page_id), previews_ui_service); }
diff --git a/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer.cc b/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer.cc index b24b61c..e2e0feff 100644 --- a/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer.cc +++ b/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer.cc
@@ -13,6 +13,7 @@ #include "chrome/browser/loader/chrome_navigation_data.h" #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_factory.h" +#include "chrome/browser/page_load_metrics/observers/histogram_suffixes.h" #include "chrome/browser/page_load_metrics/page_load_metrics_observer.h" #include "chrome/browser/page_load_metrics/page_load_metrics_util.h" #include "chrome/browser/previews/previews_infobar_delegate.h" @@ -72,25 +73,6 @@ "PageLoad.Clients.DataReductionProxy."; const char kHistogramDataReductionProxyLoFiOnPrefix[] = "PageLoad.Clients.DataReductionProxy.LoFiOn."; -const char kHistogramDOMContentLoadedEventFiredSuffix[] = - "DocumentTiming.NavigationToDOMContentLoadedEventFired"; -const char kHistogramFirstLayoutSuffix[] = - "DocumentTiming.NavigationToFirstLayout"; -const char kHistogramLoadEventFiredSuffix[] = - "DocumentTiming.NavigationToLoadEventFired"; -const char kHistogramFirstContentfulPaintSuffix[] = - "PaintTiming.NavigationToFirstContentfulPaint"; -const char kHistogramFirstMeaningfulPaintSuffix[] = - "Experimental.PaintTiming.NavigationToFirstMeaningfulPaint"; -const char kHistogramFirstImagePaintSuffix[] = - "PaintTiming.NavigationToFirstImagePaint"; -const char kHistogramFirstPaintSuffix[] = "PaintTiming.NavigationToFirstPaint"; -const char kHistogramFirstTextPaintSuffix[] = - "PaintTiming.NavigationToFirstTextPaint"; -const char kHistogramParseStartSuffix[] = "ParseTiming.NavigationToParseStart"; -const char kHistogramParseBlockedOnScriptLoadSuffix[] = - "ParseTiming.ParseBlockedOnScriptLoad"; -const char kHistogramParseDurationSuffix[] = "ParseTiming.ParseDuration"; const char kResourcesPercentProxied[] = "Experimental.CompletedResources.Network.PercentProxied"; @@ -340,7 +322,7 @@ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); RECORD_FOREGROUND_HISTOGRAMS_FOR_SUFFIX( info, data_, timing.document_timing->dom_content_loaded_event_start, - internal::kHistogramDOMContentLoadedEventFiredSuffix); + ::internal::kHistogramDOMContentLoadedEventFiredSuffix); } void DataReductionProxyMetricsObserver::OnLoadEventStart( @@ -349,7 +331,7 @@ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); RECORD_FOREGROUND_HISTOGRAMS_FOR_SUFFIX( info, data_, timing.document_timing->load_event_start, - internal::kHistogramLoadEventFiredSuffix); + ::internal::kHistogramLoadEventFiredSuffix); } void DataReductionProxyMetricsObserver::OnFirstLayout( @@ -358,16 +340,16 @@ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); RECORD_FOREGROUND_HISTOGRAMS_FOR_SUFFIX( info, data_, timing.document_timing->first_layout, - internal::kHistogramFirstLayoutSuffix); + ::internal::kHistogramFirstLayoutSuffix); } void DataReductionProxyMetricsObserver::OnFirstPaintInPage( const page_load_metrics::mojom::PageLoadTiming& timing, const page_load_metrics::PageLoadExtraInfo& info) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - RECORD_FOREGROUND_HISTOGRAMS_FOR_SUFFIX(info, data_, - timing.paint_timing->first_paint, - internal::kHistogramFirstPaintSuffix); + RECORD_FOREGROUND_HISTOGRAMS_FOR_SUFFIX( + info, data_, timing.paint_timing->first_paint, + ::internal::kHistogramFirstPaintSuffix); } void DataReductionProxyMetricsObserver::OnFirstTextPaintInPage( @@ -376,7 +358,7 @@ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); RECORD_FOREGROUND_HISTOGRAMS_FOR_SUFFIX( info, data_, timing.paint_timing->first_text_paint, - internal::kHistogramFirstTextPaintSuffix); + ::internal::kHistogramFirstTextPaintSuffix); } void DataReductionProxyMetricsObserver::OnFirstImagePaintInPage( @@ -385,7 +367,7 @@ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); RECORD_FOREGROUND_HISTOGRAMS_FOR_SUFFIX( info, data_, timing.paint_timing->first_image_paint, - internal::kHistogramFirstImagePaintSuffix); + ::internal::kHistogramFirstImagePaintSuffix); } void DataReductionProxyMetricsObserver::OnFirstContentfulPaintInPage( @@ -394,7 +376,7 @@ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); RECORD_FOREGROUND_HISTOGRAMS_FOR_SUFFIX( info, data_, timing.paint_timing->first_contentful_paint, - internal::kHistogramFirstContentfulPaintSuffix); + ::internal::kHistogramFirstContentfulPaintSuffix); } void DataReductionProxyMetricsObserver:: @@ -404,16 +386,16 @@ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); RECORD_FOREGROUND_HISTOGRAMS_FOR_SUFFIX( info, data_, timing.paint_timing->first_meaningful_paint, - internal::kHistogramFirstMeaningfulPaintSuffix); + ::internal::kHistogramFirstMeaningfulPaintSuffix); } void DataReductionProxyMetricsObserver::OnParseStart( const page_load_metrics::mojom::PageLoadTiming& timing, const page_load_metrics::PageLoadExtraInfo& info) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - RECORD_FOREGROUND_HISTOGRAMS_FOR_SUFFIX(info, data_, - timing.parse_timing->parse_start, - internal::kHistogramParseStartSuffix); + RECORD_FOREGROUND_HISTOGRAMS_FOR_SUFFIX( + info, data_, timing.parse_timing->parse_start, + ::internal::kHistogramParseStartSuffix); } void DataReductionProxyMetricsObserver::OnParseStop( @@ -427,10 +409,10 @@ base::TimeDelta parse_duration = timing.parse_timing->parse_stop.value() - timing.parse_timing->parse_start.value(); RECORD_HISTOGRAMS_FOR_SUFFIX(data_, parse_duration, - internal::kHistogramParseDurationSuffix); + ::internal::kHistogramParseDurationSuffix); RECORD_HISTOGRAMS_FOR_SUFFIX( data_, timing.parse_timing->parse_blocked_on_script_load_duration.value(), - internal::kHistogramParseBlockedOnScriptLoadSuffix); + ::internal::kHistogramParseBlockedOnScriptLoadSuffix); } void DataReductionProxyMetricsObserver::OnLoadedResource(
diff --git a/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer_unittest.cc index c83d7d9..65dde18 100644 --- a/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer_unittest.cc +++ b/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer_unittest.cc
@@ -17,6 +17,7 @@ #include "base/time/time.h" #include "chrome/browser/loader/chrome_navigation_data.h" #include "chrome/browser/page_load_metrics/metrics_web_contents_observer.h" +#include "chrome/browser/page_load_metrics/observers/histogram_suffixes.h" #include "chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.h" #include "chrome/browser/page_load_metrics/page_load_metrics_observer.h" #include "chrome/browser/page_load_metrics/page_load_tracker.h" @@ -222,28 +223,30 @@ void ValidateHistograms() { ValidateHistogramsForSuffix( - internal::kHistogramDOMContentLoadedEventFiredSuffix, + ::internal::kHistogramDOMContentLoadedEventFiredSuffix, timing_.document_timing->dom_content_loaded_event_start); - ValidateHistogramsForSuffix(internal::kHistogramFirstLayoutSuffix, + ValidateHistogramsForSuffix(::internal::kHistogramFirstLayoutSuffix, timing_.document_timing->first_layout); - ValidateHistogramsForSuffix(internal::kHistogramLoadEventFiredSuffix, + ValidateHistogramsForSuffix(::internal::kHistogramLoadEventFiredSuffix, timing_.document_timing->load_event_start); - ValidateHistogramsForSuffix(internal::kHistogramFirstContentfulPaintSuffix, - timing_.paint_timing->first_contentful_paint); - ValidateHistogramsForSuffix(internal::kHistogramFirstMeaningfulPaintSuffix, - timing_.paint_timing->first_meaningful_paint); - ValidateHistogramsForSuffix(internal::kHistogramFirstImagePaintSuffix, + ValidateHistogramsForSuffix( + ::internal::kHistogramFirstContentfulPaintSuffix, + timing_.paint_timing->first_contentful_paint); + ValidateHistogramsForSuffix( + ::internal::kHistogramFirstMeaningfulPaintSuffix, + timing_.paint_timing->first_meaningful_paint); + ValidateHistogramsForSuffix(::internal::kHistogramFirstImagePaintSuffix, timing_.paint_timing->first_image_paint); - ValidateHistogramsForSuffix(internal::kHistogramFirstPaintSuffix, + ValidateHistogramsForSuffix(::internal::kHistogramFirstPaintSuffix, timing_.paint_timing->first_paint); - ValidateHistogramsForSuffix(internal::kHistogramFirstTextPaintSuffix, + ValidateHistogramsForSuffix(::internal::kHistogramFirstTextPaintSuffix, timing_.paint_timing->first_text_paint); - ValidateHistogramsForSuffix(internal::kHistogramParseStartSuffix, + ValidateHistogramsForSuffix(::internal::kHistogramParseStartSuffix, timing_.parse_timing->parse_start); ValidateHistogramsForSuffix( - internal::kHistogramParseBlockedOnScriptLoadSuffix, + ::internal::kHistogramParseBlockedOnScriptLoadSuffix, timing_.parse_timing->parse_blocked_on_script_load_duration); - ValidateHistogramsForSuffix(internal::kHistogramParseDurationSuffix, + ValidateHistogramsForSuffix(::internal::kHistogramParseDurationSuffix, timing_.parse_timing->parse_stop.value() - timing_.parse_timing->parse_start.value()); }
diff --git a/chrome/browser/page_load_metrics/observers/histogram_suffixes.cc b/chrome/browser/page_load_metrics/observers/histogram_suffixes.cc new file mode 100644 index 0000000..2a0b0435 --- /dev/null +++ b/chrome/browser/page_load_metrics/observers/histogram_suffixes.cc
@@ -0,0 +1,37 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/page_load_metrics/observers/histogram_suffixes.h" + +namespace internal { + +const char kHistogramDOMContentLoadedEventFiredBackgroundSuffix[] = + "DocumentTiming.NavigationToDOMContentLoadedEventFired.Background"; +const char kHistogramDOMContentLoadedEventFiredSuffix[] = + "DocumentTiming.NavigationToDOMContentLoadedEventFired"; +const char kHistogramFirstContentfulPaintSuffix[] = + "PaintTiming.NavigationToFirstContentfulPaint"; +const char kHistogramFirstImagePaintSuffix[] = + "PaintTiming.NavigationToFirstImagePaint"; +const char kHistogramFirstLayoutSuffix[] = + "DocumentTiming.NavigationToFirstLayout"; +const char kHistogramFirstMeaningfulPaintSuffix[] = + "Experimental.PaintTiming.NavigationToFirstMeaningfulPaint"; +const char kHistogramFirstPaintSuffix[] = "PaintTiming.NavigationToFirstPaint"; +const char kHistogramFirstTextPaintSuffix[] = + "PaintTiming.NavigationToFirstTextPaint"; +const char kHistogramForegroundToFirstContentfulPaintSuffix[] = + "PaintTiming.ForegroundToFirstContentfulPaint"; +const char kHistogramForegroundToFirstMeaningfulPaintSuffix[] = + "Experimental.PaintTiming.ForegroundToFirstMeaningfulPaint"; +const char kHistogramLoadEventFiredBackgroundSuffix[] = + "DocumentTiming.NavigationToLoadEventFired.Background"; +const char kHistogramLoadEventFiredSuffix[] = + "DocumentTiming.NavigationToLoadEventFired"; +const char kHistogramParseBlockedOnScriptLoadSuffix[] = + "ParseTiming.ParseBlockedOnScriptLoad"; +const char kHistogramParseDurationSuffix[] = "ParseTiming.ParseDuration"; +const char kHistogramParseStartSuffix[] = "ParseTiming.NavigationToParseStart"; + +} // namespace internal
diff --git a/chrome/browser/page_load_metrics/observers/histogram_suffixes.h b/chrome/browser/page_load_metrics/observers/histogram_suffixes.h new file mode 100644 index 0000000..9e22842 --- /dev/null +++ b/chrome/browser/page_load_metrics/observers/histogram_suffixes.h
@@ -0,0 +1,29 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_HISTOGRAM_SUFFIXES_H_ +#define CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_HISTOGRAM_SUFFIXES_H_ + +namespace internal { + +// Histogram suffixes used by multiple observers. +extern const char kHistogramDOMContentLoadedEventFiredBackgroundSuffix[]; +extern const char kHistogramDOMContentLoadedEventFiredSuffix[]; +extern const char kHistogramFirstContentfulPaintSuffix[]; +extern const char kHistogramFirstImagePaintSuffix[]; +extern const char kHistogramFirstLayoutSuffix[]; +extern const char kHistogramFirstMeaningfulPaintSuffix[]; +extern const char kHistogramFirstPaintSuffix[]; +extern const char kHistogramFirstTextPaintSuffix[]; +extern const char kHistogramForegroundToFirstContentfulPaintSuffix[]; +extern const char kHistogramForegroundToFirstMeaningfulPaintSuffix[]; +extern const char kHistogramLoadEventFiredBackgroundSuffix[]; +extern const char kHistogramLoadEventFiredSuffix[]; +extern const char kHistogramParseBlockedOnScriptLoadSuffix[]; +extern const char kHistogramParseDurationSuffix[]; +extern const char kHistogramParseStartSuffix[]; + +} // namespace internal + +#endif // CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_HISTOGRAM_SUFFIXES_H_
diff --git a/chrome/browser/page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer.cc b/chrome/browser/page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer.cc index f221916..cac767a0 100644 --- a/chrome/browser/page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer.cc +++ b/chrome/browser/page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer.h" #include "base/metrics/histogram_macros.h" +#include "chrome/browser/page_load_metrics/observers/histogram_suffixes.h" #include "chrome/browser/page_load_metrics/page_load_metrics_util.h" #include "content/public/browser/web_contents.h" @@ -19,32 +20,15 @@ namespace internal { +const char kHistogramPrefixMultiTabLoading[] = + "PageLoad.Clients.MultiTabLoading."; +const char kHistogramPrefixMultiTabLoading2OrMore[] = + "PageLoad.Clients.MultiTabLoading.2OrMore."; +const char kHistogramPrefixMultiTabLoading5OrMore[] = + "PageLoad.Clients.MultiTabLoading.5OrMore."; + const char kHistogramMultiTabLoadingNumTabsWithInflightLoad[] = "PageLoad.Clients.MultiTabLoading.NumTabsWithInflightLoad"; -const char kHistogramMultiTabLoadingFirstContentfulPaint[] = - "PageLoad.Clients.MultiTabLoading.PaintTiming." - "NavigationToFirstContentfulPaint"; -const char kHistogramMultiTabLoadingForegroundToFirstContentfulPaint[] = - "PageLoad.Clients.MultiTabLoading.PaintTiming." - "ForegroundToFirstContentfulPaint"; -const char kHistogramMultiTabLoadingFirstMeaningfulPaint[] = - "PageLoad.Clients.MultiTabLoading.Experimental.PaintTiming." - "NavigationToFirstMeaningfulPaint"; -const char kHistogramMultiTabLoadingForegroundToFirstMeaningfulPaint[] = - "PageLoad.Clients.MultiTabLoading.Experimental.PaintTiming." - "ForegroundToFirstMeaningfulPaint"; -const char kHistogramMultiTabLoadingDomContentLoaded[] = - "PageLoad.Clients.MultiTabLoading.DocumentTiming." - "NavigationToDOMContentLoadedEventFired"; -const char kBackgroundHistogramMultiTabLoadingDomContentLoaded[] = - "PageLoad.Clients.MultiTabLoading.DocumentTiming." - "NavigationToDOMContentLoadedEventFired.Background"; -const char kHistogramMultiTabLoadingLoad[] = - "PageLoad.Clients.MultiTabLoading.DocumentTiming." - "NavigationToLoadEventFired"; -const char kBackgroundHistogramMultiTabLoadingLoad[] = - "PageLoad.Clients.MultiTabLoading.DocumentTiming." - "NavigationToLoadEventFired.Background"; } // namespace internal @@ -76,19 +60,39 @@ : STOP_OBSERVING; } +#define RECORD_HISTOGRAMS(suffix, sample) \ + do { \ + base::TimeDelta sample_value(sample); \ + PAGE_LOAD_HISTOGRAM( \ + std::string(internal::kHistogramPrefixMultiTabLoading).append(suffix), \ + sample_value); \ + if (num_loading_tabs_when_started_ >= 2) { \ + PAGE_LOAD_HISTOGRAM( \ + std::string(internal::kHistogramPrefixMultiTabLoading2OrMore) \ + .append(suffix), \ + sample_value); \ + } \ + if (num_loading_tabs_when_started_ >= 5) { \ + PAGE_LOAD_HISTOGRAM( \ + std::string(internal::kHistogramPrefixMultiTabLoading5OrMore) \ + .append(suffix), \ + sample_value); \ + } \ + } while (false) + void MultiTabLoadingPageLoadMetricsObserver::OnFirstContentfulPaintInPage( const page_load_metrics::mojom::PageLoadTiming& timing, const page_load_metrics::PageLoadExtraInfo& info) { if (WasStartedInForegroundOptionalEventInForeground( timing.paint_timing->first_contentful_paint, info)) { - PAGE_LOAD_HISTOGRAM(internal::kHistogramMultiTabLoadingFirstContentfulPaint, - timing.paint_timing->first_contentful_paint.value()); + RECORD_HISTOGRAMS(internal::kHistogramFirstContentfulPaintSuffix, + timing.paint_timing->first_contentful_paint.value()); } if (WasStartedInBackgroundOptionalEventInForeground( timing.paint_timing->first_contentful_paint, info)) { - PAGE_LOAD_HISTOGRAM( - internal::kHistogramMultiTabLoadingForegroundToFirstContentfulPaint, + RECORD_HISTOGRAMS( + internal::kHistogramForegroundToFirstContentfulPaintSuffix, timing.paint_timing->first_contentful_paint.value() - info.first_foreground_time.value()); } @@ -100,13 +104,13 @@ const page_load_metrics::PageLoadExtraInfo& info) { if (WasStartedInForegroundOptionalEventInForeground( timing.paint_timing->first_meaningful_paint, info)) { - PAGE_LOAD_HISTOGRAM(internal::kHistogramMultiTabLoadingFirstMeaningfulPaint, - timing.paint_timing->first_meaningful_paint.value()); + RECORD_HISTOGRAMS(internal::kHistogramFirstMeaningfulPaintSuffix, + timing.paint_timing->first_meaningful_paint.value()); } if (WasStartedInBackgroundOptionalEventInForeground( timing.paint_timing->first_meaningful_paint, info)) { - PAGE_LOAD_HISTOGRAM( - internal::kHistogramMultiTabLoadingForegroundToFirstMeaningfulPaint, + RECORD_HISTOGRAMS( + internal::kHistogramForegroundToFirstMeaningfulPaintSuffix, timing.paint_timing->first_meaningful_paint.value() - info.first_foreground_time.value()); } @@ -117,12 +121,12 @@ const page_load_metrics::PageLoadExtraInfo& info) { if (WasStartedInForegroundOptionalEventInForeground( timing.document_timing->dom_content_loaded_event_start, info)) { - PAGE_LOAD_HISTOGRAM( - internal::kHistogramMultiTabLoadingDomContentLoaded, + RECORD_HISTOGRAMS( + internal::kHistogramDOMContentLoadedEventFiredSuffix, timing.document_timing->dom_content_loaded_event_start.value()); } else { - PAGE_LOAD_HISTOGRAM( - internal::kBackgroundHistogramMultiTabLoadingDomContentLoaded, + RECORD_HISTOGRAMS( + internal::kHistogramDOMContentLoadedEventFiredBackgroundSuffix, timing.document_timing->dom_content_loaded_event_start.value()); } } @@ -132,11 +136,11 @@ const page_load_metrics::PageLoadExtraInfo& info) { if (WasStartedInForegroundOptionalEventInForeground( timing.document_timing->load_event_start, info)) { - PAGE_LOAD_HISTOGRAM(internal::kHistogramMultiTabLoadingLoad, - timing.document_timing->load_event_start.value()); + RECORD_HISTOGRAMS(internal::kHistogramLoadEventFiredSuffix, + timing.document_timing->load_event_start.value()); } else { - PAGE_LOAD_HISTOGRAM(internal::kBackgroundHistogramMultiTabLoadingLoad, - timing.document_timing->load_event_start.value()); + RECORD_HISTOGRAMS(internal::kHistogramLoadEventFiredBackgroundSuffix, + timing.document_timing->load_event_start.value()); } }
diff --git a/chrome/browser/page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer.h b/chrome/browser/page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer.h index 63058ed..c04ccf8f 100644 --- a/chrome/browser/page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer.h +++ b/chrome/browser/page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer.h
@@ -15,15 +15,10 @@ namespace internal { // Exposed for tests. +extern const char kHistogramPrefixMultiTabLoading[]; +extern const char kHistogramPrefixMultiTabLoading2OrMore[]; +extern const char kHistogramPrefixMultiTabLoading5OrMore[]; extern const char kHistogramMultiTabLoadingNumTabsWithInflightLoad[]; -extern const char kHistogramMultiTabLoadingFirstContentfulPaint[]; -extern const char kHistogramMultiTabLoadingForegroundToFirstContentfulPaint[]; -extern const char kHistogramMultiTabLoadingFirstMeaningfulPaint[]; -extern const char kHistogramMultiTabLoadingForegroundToFirstMeaningfulPaint[]; -extern const char kHistogramMultiTabLoadingDomContentLoaded[]; -extern const char kBackgroundHistogramMultiTabLoadingDomContentLoaded[]; -extern const char kHistogramMultiTabLoadingLoad[]; -extern const char kBackgroundHistogramMultiTabLoadingLoad[]; } // namespace internal
diff --git a/chrome/browser/page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer_browsertest.cc b/chrome/browser/page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer_browsertest.cc index da96052..7108c7244 100644 --- a/chrome/browser/page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer_browsertest.cc +++ b/chrome/browser/page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer_browsertest.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer.h" #include "base/test/histogram_tester.h" +#include "chrome/browser/page_load_metrics/observers/histogram_suffixes.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/test/base/in_process_browser_test.h" @@ -31,6 +32,11 @@ void SetUpOnMainThread() override { ASSERT_TRUE(embedded_test_server()->Start()); } + + std::string HistogramNameWithSuffix(const char* suffix) { + return std::string(internal::kHistogramPrefixMultiTabLoading) + .append(suffix); + } }; IN_PROC_BROWSER_TEST_F(MultiTabLoadingPageLoadMetricsBrowserTest, SingleTab) { @@ -41,9 +47,12 @@ // Navigate away to force the histogram recording. ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL)); - histogram_tester.ExpectTotalCount(internal::kHistogramMultiTabLoadingLoad, 0); histogram_tester.ExpectTotalCount( - internal::kBackgroundHistogramMultiTabLoadingLoad, 0); + HistogramNameWithSuffix(internal::kHistogramLoadEventFiredSuffix), 0); + histogram_tester.ExpectTotalCount( + HistogramNameWithSuffix( + internal::kHistogramLoadEventFiredBackgroundSuffix), + 0); } IN_PROC_BROWSER_TEST_F(MultiTabLoadingPageLoadMetricsBrowserTest, @@ -60,9 +69,12 @@ // Navigate away to force the histogram recording. ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL)); - histogram_tester.ExpectTotalCount(internal::kHistogramMultiTabLoadingLoad, 1); histogram_tester.ExpectTotalCount( - internal::kBackgroundHistogramMultiTabLoadingLoad, 0); + HistogramNameWithSuffix(internal::kHistogramLoadEventFiredSuffix), 1); + histogram_tester.ExpectTotalCount( + HistogramNameWithSuffix( + internal::kHistogramLoadEventFiredBackgroundSuffix), + 0); } IN_PROC_BROWSER_TEST_F(MultiTabLoadingPageLoadMetricsBrowserTest, @@ -87,7 +99,10 @@ // Navigate away to force the histogram recording. ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL)); - histogram_tester.ExpectTotalCount(internal::kHistogramMultiTabLoadingLoad, 0); histogram_tester.ExpectTotalCount( - internal::kBackgroundHistogramMultiTabLoadingLoad, 1); + HistogramNameWithSuffix(internal::kHistogramLoadEventFiredSuffix), 0); + histogram_tester.ExpectTotalCount( + HistogramNameWithSuffix( + internal::kHistogramLoadEventFiredBackgroundSuffix), + 1); }
diff --git a/chrome/browser/page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer_unittest.cc index 0687bd5..0e1707ed 100644 --- a/chrome/browser/page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer_unittest.cc +++ b/chrome/browser/page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer_unittest.cc
@@ -6,6 +6,7 @@ #include "base/memory/ptr_util.h" #include "base/optional.h" +#include "chrome/browser/page_load_metrics/observers/histogram_suffixes.h" #include "chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.h" #include "chrome/browser/page_load_metrics/page_load_tracker.h" #include "chrome/common/page_load_metrics/test/page_load_metrics_test_util.h" @@ -18,17 +19,18 @@ class TestMultiTabLoadingPageLoadMetricsObserver : public MultiTabLoadingPageLoadMetricsObserver { public: - explicit TestMultiTabLoadingPageLoadMetricsObserver(bool multi_tab_loading) - : multi_tab_loading_(multi_tab_loading) {} + explicit TestMultiTabLoadingPageLoadMetricsObserver( + int number_of_tabs_with_inflight_load) + : number_of_tabs_with_inflight_load_(number_of_tabs_with_inflight_load) {} ~TestMultiTabLoadingPageLoadMetricsObserver() override {} private: int NumberOfTabsWithInflightLoad( content::NavigationHandle* navigation_handle) override { - return multi_tab_loading_ ? 1 : 0; + return number_of_tabs_with_inflight_load_; } - const bool multi_tab_loading_; + const int number_of_tabs_with_inflight_load_; }; } // namespace @@ -36,11 +38,11 @@ class MultiTabLoadingPageLoadMetricsObserverTest : public page_load_metrics::PageLoadMetricsObserverTestHarness { public: - enum UseCase { SingleTabLoading, MultiTabLoading }; enum TabState { Foreground, Background }; - void SimulatePageLoad(UseCase use_case, TabState tab_state) { - use_case_ = use_case; + void SimulatePageLoad(int number_of_tabs_with_inflight_load, + TabState tab_state) { + number_of_tabs_with_inflight_load_ = number_of_tabs_with_inflight_load; page_load_metrics::mojom::PageLoadTiming timing; page_load_metrics::InitPageLoadTimingForTest(&timing); @@ -74,75 +76,126 @@ void RegisterObservers(page_load_metrics::PageLoadTracker* tracker) override { tracker->AddObserver( base::MakeUnique<TestMultiTabLoadingPageLoadMetricsObserver>( - use_case_.value() == MultiTabLoading)); + number_of_tabs_with_inflight_load_.value())); + } + + void ValidateHistograms(const char* suffix, + base::HistogramBase::Count expected_base, + base::HistogramBase::Count expected_2_or_more, + base::HistogramBase::Count expected_5_or_more) { + histogram_tester().ExpectTotalCount( + std::string(internal::kHistogramPrefixMultiTabLoading).append(suffix), + expected_base); + histogram_tester().ExpectTotalCount( + std::string(internal::kHistogramPrefixMultiTabLoading2OrMore) + .append(suffix), + expected_2_or_more); + histogram_tester().ExpectTotalCount( + std::string(internal::kHistogramPrefixMultiTabLoading5OrMore) + .append(suffix), + expected_5_or_more); } private: - base::Optional<UseCase> use_case_; + base::Optional<int> number_of_tabs_with_inflight_load_; }; TEST_F(MultiTabLoadingPageLoadMetricsObserverTest, SingleTabLoading) { - SimulatePageLoad(SingleTabLoading, Foreground); + SimulatePageLoad(0, Foreground); histogram_tester().ExpectUniqueSample( internal::kHistogramMultiTabLoadingNumTabsWithInflightLoad, 0, 1); - histogram_tester().ExpectTotalCount( - internal::kHistogramMultiTabLoadingFirstContentfulPaint, 0); - histogram_tester().ExpectTotalCount( - internal::kHistogramMultiTabLoadingForegroundToFirstContentfulPaint, 0); - histogram_tester().ExpectTotalCount( - internal::kHistogramMultiTabLoadingFirstMeaningfulPaint, 0); - histogram_tester().ExpectTotalCount( - internal::kHistogramMultiTabLoadingForegroundToFirstMeaningfulPaint, 0); - histogram_tester().ExpectTotalCount( - internal::kHistogramMultiTabLoadingDomContentLoaded, 0); - histogram_tester().ExpectTotalCount( - internal::kBackgroundHistogramMultiTabLoadingDomContentLoaded, 0); - histogram_tester().ExpectTotalCount(internal::kHistogramMultiTabLoadingLoad, - 0); - histogram_tester().ExpectTotalCount( - internal::kBackgroundHistogramMultiTabLoadingLoad, 0); + + ValidateHistograms(internal::kHistogramFirstContentfulPaintSuffix, 0, 0, 0); + ValidateHistograms(internal::kHistogramForegroundToFirstContentfulPaintSuffix, + 0, 0, 0); + ValidateHistograms(internal::kHistogramFirstMeaningfulPaintSuffix, 0, 0, 0); + ValidateHistograms(internal::kHistogramForegroundToFirstMeaningfulPaintSuffix, + 0, 0, 0); + ValidateHistograms(internal::kHistogramDOMContentLoadedEventFiredSuffix, 0, 0, + 0); + ValidateHistograms( + internal::kHistogramDOMContentLoadedEventFiredBackgroundSuffix, 0, 0, 0); + ValidateHistograms(internal::kHistogramLoadEventFiredSuffix, 0, 0, 0); + ValidateHistograms(internal::kHistogramLoadEventFiredBackgroundSuffix, 0, 0, + 0); } -TEST_F(MultiTabLoadingPageLoadMetricsObserverTest, MultiTabLoading) { - SimulatePageLoad(MultiTabLoading, Foreground); +TEST_F(MultiTabLoadingPageLoadMetricsObserverTest, MultiTabLoading1) { + SimulatePageLoad(1, Foreground); histogram_tester().ExpectUniqueSample( internal::kHistogramMultiTabLoadingNumTabsWithInflightLoad, 1, 1); - histogram_tester().ExpectTotalCount( - internal::kHistogramMultiTabLoadingFirstContentfulPaint, 1); - histogram_tester().ExpectTotalCount( - internal::kHistogramMultiTabLoadingForegroundToFirstContentfulPaint, 0); - histogram_tester().ExpectTotalCount( - internal::kHistogramMultiTabLoadingFirstMeaningfulPaint, 1); - histogram_tester().ExpectTotalCount( - internal::kHistogramMultiTabLoadingForegroundToFirstMeaningfulPaint, 0); - histogram_tester().ExpectTotalCount( - internal::kHistogramMultiTabLoadingDomContentLoaded, 1); - histogram_tester().ExpectTotalCount( - internal::kBackgroundHistogramMultiTabLoadingDomContentLoaded, 0); - histogram_tester().ExpectTotalCount(internal::kHistogramMultiTabLoadingLoad, - 1); - histogram_tester().ExpectTotalCount( - internal::kBackgroundHistogramMultiTabLoadingLoad, 0); + + ValidateHistograms(internal::kHistogramFirstContentfulPaintSuffix, 1, 0, 0); + ValidateHistograms(internal::kHistogramForegroundToFirstContentfulPaintSuffix, + 0, 0, 0); + ValidateHistograms(internal::kHistogramFirstMeaningfulPaintSuffix, 1, 0, 0); + ValidateHistograms(internal::kHistogramForegroundToFirstMeaningfulPaintSuffix, + 0, 0, 0); + ValidateHistograms(internal::kHistogramDOMContentLoadedEventFiredSuffix, 1, 0, + 0); + ValidateHistograms( + internal::kHistogramDOMContentLoadedEventFiredBackgroundSuffix, 0, 0, 0); + ValidateHistograms(internal::kHistogramLoadEventFiredSuffix, 1, 0, 0); + ValidateHistograms(internal::kHistogramLoadEventFiredBackgroundSuffix, 0, 0, + 0); +} + +TEST_F(MultiTabLoadingPageLoadMetricsObserverTest, MultiTabLoading2) { + SimulatePageLoad(2, Foreground); + histogram_tester().ExpectUniqueSample( + internal::kHistogramMultiTabLoadingNumTabsWithInflightLoad, 2, 1); + + ValidateHistograms(internal::kHistogramFirstContentfulPaintSuffix, 1, 1, 0); + ValidateHistograms(internal::kHistogramForegroundToFirstContentfulPaintSuffix, + 0, 0, 0); + ValidateHistograms(internal::kHistogramFirstMeaningfulPaintSuffix, 1, 1, 0); + ValidateHistograms(internal::kHistogramForegroundToFirstMeaningfulPaintSuffix, + 0, 0, 0); + ValidateHistograms(internal::kHistogramDOMContentLoadedEventFiredSuffix, 1, 1, + 0); + ValidateHistograms( + internal::kHistogramDOMContentLoadedEventFiredBackgroundSuffix, 0, 0, 0); + ValidateHistograms(internal::kHistogramLoadEventFiredSuffix, 1, 1, 0); + ValidateHistograms(internal::kHistogramLoadEventFiredBackgroundSuffix, 0, 0, + 0); +} + +TEST_F(MultiTabLoadingPageLoadMetricsObserverTest, MultiTabLoading5) { + SimulatePageLoad(5, Foreground); + histogram_tester().ExpectUniqueSample( + internal::kHistogramMultiTabLoadingNumTabsWithInflightLoad, 5, 1); + + ValidateHistograms(internal::kHistogramFirstContentfulPaintSuffix, 1, 1, 1); + ValidateHistograms(internal::kHistogramForegroundToFirstContentfulPaintSuffix, + 0, 0, 0); + ValidateHistograms(internal::kHistogramFirstMeaningfulPaintSuffix, 1, 1, 1); + ValidateHistograms(internal::kHistogramForegroundToFirstMeaningfulPaintSuffix, + 0, 0, 0); + ValidateHistograms(internal::kHistogramDOMContentLoadedEventFiredSuffix, 1, 1, + 1); + ValidateHistograms( + internal::kHistogramDOMContentLoadedEventFiredBackgroundSuffix, 0, 0, 0); + ValidateHistograms(internal::kHistogramLoadEventFiredSuffix, 1, 1, 1); + ValidateHistograms(internal::kHistogramLoadEventFiredBackgroundSuffix, 0, 0, + 0); } TEST_F(MultiTabLoadingPageLoadMetricsObserverTest, MultiTabBackground) { - SimulatePageLoad(MultiTabLoading, Background); + SimulatePageLoad(1, Background); histogram_tester().ExpectUniqueSample( internal::kHistogramMultiTabLoadingNumTabsWithInflightLoad, 1, 1); - histogram_tester().ExpectTotalCount( - internal::kHistogramMultiTabLoadingFirstContentfulPaint, 0); - histogram_tester().ExpectTotalCount( - internal::kHistogramMultiTabLoadingForegroundToFirstContentfulPaint, 1); - histogram_tester().ExpectTotalCount( - internal::kHistogramMultiTabLoadingFirstMeaningfulPaint, 0); - histogram_tester().ExpectTotalCount( - internal::kHistogramMultiTabLoadingForegroundToFirstMeaningfulPaint, 1); - histogram_tester().ExpectTotalCount( - internal::kHistogramMultiTabLoadingDomContentLoaded, 0); - histogram_tester().ExpectTotalCount( - internal::kBackgroundHistogramMultiTabLoadingDomContentLoaded, 1); - histogram_tester().ExpectTotalCount(internal::kHistogramMultiTabLoadingLoad, - 0); - histogram_tester().ExpectTotalCount( - internal::kBackgroundHistogramMultiTabLoadingLoad, 1); + + ValidateHistograms(internal::kHistogramFirstContentfulPaintSuffix, 0, 0, 0); + ValidateHistograms(internal::kHistogramForegroundToFirstContentfulPaintSuffix, + 1, 0, 0); + ValidateHistograms(internal::kHistogramFirstMeaningfulPaintSuffix, 0, 0, 0); + ValidateHistograms(internal::kHistogramForegroundToFirstMeaningfulPaintSuffix, + 1, 0, 0); + ValidateHistograms(internal::kHistogramDOMContentLoadedEventFiredSuffix, 0, 0, + 0); + ValidateHistograms( + internal::kHistogramDOMContentLoadedEventFiredBackgroundSuffix, 1, 0, 0); + ValidateHistograms(internal::kHistogramLoadEventFiredSuffix, 0, 0, 0); + ValidateHistograms(internal::kHistogramLoadEventFiredBackgroundSuffix, 1, 0, + 0); }
diff --git a/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc b/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc index 31fd918..f4de288 100644 --- a/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc +++ b/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc
@@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <algorithm> +#include <iterator> #include <memory> #include <string> #include <unordered_set> @@ -15,6 +17,7 @@ #include "base/memory/weak_ptr.h" #include "base/path_service.h" #include "base/run_loop.h" +#include "base/strings/string_util.h" #include "base/test/histogram_tester.h" #include "base/test/scoped_feature_list.h" #include "base/threading/thread_restrictions.h" @@ -358,6 +361,17 @@ ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL)); } + std::string GetRecordedPageLoadMetricNames() { + auto entries = histogram_tester_.GetTotalCountsForPrefix("PageLoad."); + std::vector<std::string> names; + std::transform( + entries.begin(), entries.end(), std::back_inserter(names), + [](const std::pair<std::string, base::HistogramBase::Count>& entry) { + return entry.first; + }); + return base::JoinString(names, ","); + } + bool NoPageLoadMetricsRecorded() { // Determine whether any 'public' page load metrics are recorded. We exclude // 'internal' metrics as these may be recorded for debugging purposes. @@ -385,7 +399,8 @@ IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, NoNavigation) { ASSERT_TRUE(embedded_test_server()->Start()); - EXPECT_TRUE(NoPageLoadMetricsRecorded()); + EXPECT_TRUE(NoPageLoadMetricsRecorded()) + << "Recorded metrics: " << GetRecordedPageLoadMetricNames(); } IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, NewPage) { @@ -628,21 +643,17 @@ ui_test_utils::NavigateToURL(browser(), embedded_test_server()->GetURL("/circle.svg")); NavigateToUntrackedUrl(); - EXPECT_TRUE(NoPageLoadMetricsRecorded()); + EXPECT_TRUE(NoPageLoadMetricsRecorded()) + << "Recorded metrics: " << GetRecordedPageLoadMetricNames(); } -// Flaky on Win7 dbg. crbug.com/794879. -#if defined(OS_WIN) -#define MAYBE_NonHttpOrHttpsUrl DISABLED_NonHttpOrHttpsUrl -#else -#define MAYBE_NonHttpOrHttpsUrl NonHttpOrHttpsUrl -#endif -IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, MAYBE_NonHttpOrHttpsUrl) { +IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, NonHttpOrHttpsUrl) { ASSERT_TRUE(embedded_test_server()->Start()); ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIVersionURL)); NavigateToUntrackedUrl(); - EXPECT_TRUE(NoPageLoadMetricsRecorded()); + EXPECT_TRUE(NoPageLoadMetricsRecorded()) + << "Recorded metrics: " << GetRecordedPageLoadMetricNames(); } IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, HttpErrorPage) { @@ -651,7 +662,8 @@ ui_test_utils::NavigateToURL( browser(), embedded_test_server()->GetURL("/page_load_metrics/404.html")); NavigateToUntrackedUrl(); - EXPECT_TRUE(NoPageLoadMetricsRecorded()); + EXPECT_TRUE(NoPageLoadMetricsRecorded()) + << "Recorded metrics: " << GetRecordedPageLoadMetricNames(); } IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, ChromeErrorPage) { @@ -669,7 +681,8 @@ ui_test_utils::NavigateToURL(browser(), embedded_test_server()->GetURL("/title1.html")); NavigateToUntrackedUrl(); - EXPECT_TRUE(NoPageLoadMetricsRecorded()); + EXPECT_TRUE(NoPageLoadMetricsRecorded()) + << "Recorded metrics: " << GetRecordedPageLoadMetricNames(); } IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, Ignore204Pages) { @@ -678,7 +691,8 @@ ui_test_utils::NavigateToURL(browser(), embedded_test_server()->GetURL("/page204.html")); NavigateToUntrackedUrl(); - EXPECT_TRUE(NoPageLoadMetricsRecorded()); + EXPECT_TRUE(NoPageLoadMetricsRecorded()) + << "Recorded metrics: " << GetRecordedPageLoadMetricNames(); } IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, IgnoreDownloads) { @@ -699,7 +713,8 @@ downloads_observer.WaitForFinished(); NavigateToUntrackedUrl(); - EXPECT_TRUE(NoPageLoadMetricsRecorded()); + EXPECT_TRUE(NoPageLoadMetricsRecorded()) + << "Recorded metrics: " << GetRecordedPageLoadMetricNames(); } IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, NoDocumentWrite) {
diff --git a/chrome/browser/password_manager/native_backend_libsecret.cc b/chrome/browser/password_manager/native_backend_libsecret.cc index a1d3f6da..15be5000 100644 --- a/chrome/browser/password_manager/native_backend_libsecret.cc +++ b/chrome/browser/password_manager/native_backend_libsecret.cc
@@ -20,7 +20,6 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" -#include "components/os_crypt/libsecret_task_runner_linux.h" #include "components/password_manager/core/browser/password_manager_metrics_util.h" #include "components/password_manager/core/browser/password_manager_util.h" #include "url/origin.h" @@ -413,7 +412,7 @@ scoped_refptr<base::SequencedTaskRunner> NativeBackendLibsecret::GetBackgroundTaskRunner() { - return os_crypt::GetLibsecretTaskRunner(); + return nullptr; } bool NativeBackendLibsecret::GetLoginsList(
diff --git a/chrome/browser/password_manager/password_store_factory.cc b/chrome/browser/password_manager/password_store_factory.cc index 4605a11..54e54a5 100644 --- a/chrome/browser/password_manager/password_store_factory.cc +++ b/chrome/browser/password_manager/password_store_factory.cc
@@ -321,7 +321,8 @@ usage = used_backend == KWALLET ? KDE_NOFLAG_KWALLET : KDE_NOFLAG_PLAINTEXT; } - } else if (desktop_env == base::nix::DESKTOP_ENVIRONMENT_GNOME || + } else if (desktop_env == base::nix::DESKTOP_ENVIRONMENT_CINNAMON || + desktop_env == base::nix::DESKTOP_ENVIRONMENT_GNOME || desktop_env == base::nix::DESKTOP_ENVIRONMENT_UNITY || desktop_env == base::nix::DESKTOP_ENVIRONMENT_XFCE) { if (command_line_flag == "kwallet") {
diff --git a/chrome/browser/policy/configuration_policy_handler_list_factory.cc b/chrome/browser/policy/configuration_policy_handler_list_factory.cc index e134289..460c2cd 100644 --- a/chrome/browser/policy/configuration_policy_handler_list_factory.cc +++ b/chrome/browser/policy/configuration_policy_handler_list_factory.cc
@@ -24,6 +24,7 @@ #include "chrome/browser/profiles/guest_mode_policy_handler.h" #include "chrome/browser/profiles/incognito_mode_policy_handler.h" #include "chrome/browser/sessions/restore_on_startup_policy_handler.h" +#include "chrome/browser/spellchecker/spellcheck_language_policy_handler.h" #include "chrome/browser/supervised_user/supervised_user_creation_policy_handler.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/features.h" @@ -71,6 +72,7 @@ #include "ash/public/cpp/ash_pref_names.h" #include "chrome/browser/chromeos/platform_keys/key_permissions_policy_handler.h" #include "chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.h" +#include "chrome/browser/chromeos/policy/secondary_google_account_signin_policy_handler.h" #include "chrome/browser/policy/default_geolocation_policy_handler.h" #include "chromeos/chromeos_pref_names.h" #include "chromeos/dbus/power_policy_controller.h" @@ -958,6 +960,10 @@ handlers->AddHandler(base::MakeUnique<BrowsingHistoryPolicyHandler>()); +#if BUILDFLAG(ENABLE_SPELLCHECK) + handlers->AddHandler(base::MakeUnique<SpellcheckLanguagePolicyHandler>()); +#endif // BUILDFLAG(ENABLE_SPELLCHECK) + #if BUILDFLAG(ENABLE_EXTENSIONS) handlers->AddHandler(base::MakeUnique<extensions::ExtensionListPolicyHandler>( key::kExtensionInstallWhitelist, @@ -1123,6 +1129,8 @@ handlers->AddHandler(base::MakeUnique<extensions::ExtensionListPolicyHandler>( key::kNoteTakingAppsLockScreenWhitelist, prefs::kNoteTakingAppsLockScreenWhitelist, false /*allow_wildcards*/)); + handlers->AddHandler( + std::make_unique<SecondaryGoogleAccountSigninPolicyHandler>()); #endif // defined(OS_CHROMEOS) #if BUILDFLAG(ENABLE_PLUGINS)
diff --git a/chrome/browser/previews/previews_infobar_delegate.cc b/chrome/browser/previews/previews_infobar_delegate.cc index a552a85..5412803b 100644 --- a/chrome/browser/previews/previews_infobar_delegate.cc +++ b/chrome/browser/previews/previews_infobar_delegate.cc
@@ -98,7 +98,7 @@ PreviewsInfoBarDelegate::~PreviewsInfoBarDelegate() { if (!on_dismiss_callback_.is_null()) - on_dismiss_callback_.Run(false); + std::move(on_dismiss_callback_).Run(false); RecordPreviewsInfoBarAction(previews_type_, infobar_dismissed_action_); } @@ -110,7 +110,7 @@ base::Time previews_freshness, bool is_data_saver_user, bool is_reload, - const OnDismissPreviewsInfobarCallback& on_dismiss_callback, + OnDismissPreviewsInfobarCallback on_dismiss_callback, previews::PreviewsUIService* previews_ui_service) { PreviewsInfoBarTabHelper* infobar_tab_helper = PreviewsInfoBarTabHelper::FromWebContents(web_contents); @@ -126,7 +126,7 @@ std::unique_ptr<PreviewsInfoBarDelegate> delegate(new PreviewsInfoBarDelegate( infobar_tab_helper, previews_type, previews_freshness, is_data_saver_user, - is_reload, on_dismiss_callback)); + is_reload, std::move(on_dismiss_callback))); #if defined(OS_ANDROID) std::unique_ptr<infobars::InfoBar> infobar_ptr( @@ -162,7 +162,7 @@ base::Time previews_freshness, bool is_data_saver_user, bool is_reload, - const OnDismissPreviewsInfobarCallback& on_dismiss_callback) + OnDismissPreviewsInfobarCallback on_dismiss_callback) : ConfirmInfoBarDelegate(), infobar_tab_helper_(infobar_tab_helper), previews_type_(previews_type), @@ -172,7 +172,7 @@ message_text_(l10n_util::GetStringUTF16( is_data_saver_user ? IDS_PREVIEWS_INFOBAR_SAVED_DATA_TITLE : IDS_PREVIEWS_INFOBAR_FASTER_PAGE_TITLE)), - on_dismiss_callback_(on_dismiss_callback) {} + on_dismiss_callback_(std::move(on_dismiss_callback)) {} infobars::InfoBarDelegate::InfoBarIdentifier PreviewsInfoBarDelegate::GetIdentifier() const { @@ -225,8 +225,7 @@ bool PreviewsInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { infobar_dismissed_action_ = INFOBAR_LOAD_ORIGINAL_CLICKED; if (!on_dismiss_callback_.is_null()) - on_dismiss_callback_.Run(true); - on_dismiss_callback_.Reset(); + std::move(on_dismiss_callback_).Run(true); content::WebContents* web_contents = InfoBarService::WebContentsFromInfoBar(infobar());
diff --git a/chrome/browser/previews/previews_infobar_delegate.h b/chrome/browser/previews/previews_infobar_delegate.h index 4d2ccd4..b83cf06 100644 --- a/chrome/browser/previews/previews_infobar_delegate.h +++ b/chrome/browser/previews/previews_infobar_delegate.h
@@ -27,7 +27,8 @@ // infobar. class PreviewsInfoBarDelegate : public ConfirmInfoBarDelegate { public: - typedef base::Callback<void(bool opt_out)> OnDismissPreviewsInfobarCallback; + typedef base::OnceCallback<void(bool opt_out)> + OnDismissPreviewsInfobarCallback; // Actions on the previews infobar. This enum must remain synchronized with // the enum of the same name in metrics/histograms/histograms.xml. @@ -66,7 +67,7 @@ bool is_reload, // TODO(ryansturm): Replace |on_dismiss_callback| with direct call to // |previews_ui_service|. - const OnDismissPreviewsInfobarCallback& on_dismiss_callback, + OnDismissPreviewsInfobarCallback on_dismiss_callback, previews::PreviewsUIService* previews_ui_service); // ConfirmInfoBarDelegate overrides: @@ -80,13 +81,12 @@ static const void* OptOutEventKey(); private: - PreviewsInfoBarDelegate( - PreviewsInfoBarTabHelper* infobar_tab_helper, - previews::PreviewsType previews_type, - base::Time previews_freshness, - bool is_data_saver_user, - bool is_reload, - const OnDismissPreviewsInfobarCallback& on_dismiss_callback); + PreviewsInfoBarDelegate(PreviewsInfoBarTabHelper* infobar_tab_helper, + previews::PreviewsType previews_type, + base::Time previews_freshness, + bool is_data_saver_user, + bool is_reload, + OnDismissPreviewsInfobarCallback on_dismiss_callback); // ConfirmInfoBarDelegate overrides: infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
diff --git a/chrome/browser/previews/previews_infobar_tab_helper.cc b/chrome/browser/previews/previews_infobar_tab_helper.cc index fffe44a..db71da1c 100644 --- a/chrome/browser/previews/previews_infobar_tab_helper.cc +++ b/chrome/browser/previews/previews_infobar_tab_helper.cc
@@ -118,6 +118,11 @@ bool data_saver_enabled = data_reduction_proxy_settings->IsDataReductionProxyEnabled(); + + data_reduction_proxy_settings->data_reduction_proxy_service() + ->UpdateDataUseForHost(0, uncached_size, + navigation_handle->GetRedirectChain()[0].host()); + data_reduction_proxy_settings->data_reduction_proxy_service() ->UpdateContentLengths(0, uncached_size, data_saver_enabled, data_reduction_proxy::HTTPS, @@ -128,10 +133,10 @@ base::Time() /* previews_freshness */, data_reduction_proxy_settings && data_saver_enabled, false /* is_reload */, - base::Bind(&AddPreviewNavigationCallback, - web_contents()->GetBrowserContext(), - navigation_handle->GetRedirectChain()[0], - previews::PreviewsType::OFFLINE, page_id), + base::BindOnce(&AddPreviewNavigationCallback, + web_contents()->GetBrowserContext(), + navigation_handle->GetRedirectChain()[0], + previews::PreviewsType::OFFLINE, page_id), previews_ui_service); // Don't try to show other infobars if this is an offline preview. return; @@ -148,10 +153,10 @@ web_contents(), main_frame_preview, base::Time() /* previews_freshness */, true /* is_data_saver_user */, is_reload, - base::Bind(&AddPreviewNavigationCallback, - web_contents()->GetBrowserContext(), - navigation_handle->GetRedirectChain()[0], - main_frame_preview, page_id), + base::BindOnce(&AddPreviewNavigationCallback, + web_contents()->GetBrowserContext(), + navigation_handle->GetRedirectChain()[0], + main_frame_preview, page_id), previews_ui_service); } }
diff --git a/chrome/browser/previews/previews_infobar_tab_helper_unittest.cc b/chrome/browser/previews/previews_infobar_tab_helper_unittest.cc index 043c883..ef992b3f 100644 --- a/chrome/browser/previews/previews_infobar_tab_helper_unittest.cc +++ b/chrome/browser/previews/previews_infobar_tab_helper_unittest.cc
@@ -23,6 +23,7 @@ #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_headers.h" #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_names.h" +#include "components/data_reduction_proxy/proto/data_store.pb.h" #include "components/offline_pages/core/offline_page_item.h" #include "components/offline_pages/core/request_header/offline_page_header.h" #include "components/offline_pages/features/features.h" @@ -136,10 +137,12 @@ ->SetNavigationData(test_handle_.get(), std::move(navigation_data)); } - private: - std::unique_ptr<content::NavigationHandle> test_handle_; + protected: std::unique_ptr<data_reduction_proxy::DataReductionProxyTestContext> drp_test_context_; + + private: + std::unique_ptr<content::NavigationHandle> test_handle_; }; TEST_F(PreviewsInfoBarTabHelperUnitTest, @@ -238,6 +241,20 @@ offline_pages::OfflinePageHeader header; offline_pages::OfflinePageTabHelper::FromWebContents(web_contents()) ->SetOfflinePage(item, header, true); + + auto* data_reduction_proxy_settings = + DataReductionProxyChromeSettingsFactory::GetForBrowserContext( + web_contents()->GetBrowserContext()); + + EXPECT_TRUE(data_reduction_proxy_settings->data_reduction_proxy_service() + ->compression_stats() + ->DataUsageMapForTesting() + .empty()); + + drp_test_context_->pref_service()->SetBoolean("data_usage_reporting.enabled", + true); + base::RunLoop().RunUntilIdle(); + CallDidFinishNavigation(); InfoBarService* infobar_service = @@ -249,9 +266,6 @@ content::WebContentsTester::For(web_contents()) ->NavigateAndCommit(GURL(kTestUrl)); - auto* data_reduction_proxy_settings = - DataReductionProxyChromeSettingsFactory::GetForBrowserContext( - web_contents()->GetBrowserContext()); EXPECT_EQ(0, data_reduction_proxy_settings->data_reduction_proxy_service() ->compression_stats() ->GetHttpReceivedContentLength()); @@ -263,6 +277,24 @@ ->compression_stats() ->GetHttpOriginalContentLength()); + EXPECT_FALSE(data_reduction_proxy_settings->data_reduction_proxy_service() + ->compression_stats() + ->DataUsageMapForTesting() + .empty()); + + // Normalize the host name. + std::string host = GURL(kTestUrl).host(); + size_t pos = host.find("://"); + if (pos != std::string::npos) + host = host.substr(pos + 3); + + EXPECT_EQ(expected_file_size, + data_reduction_proxy_settings->data_reduction_proxy_service() + ->compression_stats() + ->DataUsageMapForTesting() + .find(host) + ->second->original_size()); + EXPECT_FALSE(infobar_tab_helper->displayed_preview_infobar()); } #endif // BUILDFLAG(ENABLE_OFFLINE_PAGES)
diff --git a/chrome/browser/printing/cloud_print/privet_http.h b/chrome/browser/printing/cloud_print/privet_http.h index d7c953d..a5ab9f7 100644 --- a/chrome/browser/printing/cloud_print/privet_http.h +++ b/chrome/browser/printing/cloud_print/privet_http.h
@@ -21,7 +21,7 @@ } namespace printing { -class PWGRasterConverter; +class PwgRasterConverter; } namespace cloud_print { @@ -174,8 +174,8 @@ virtual void SetPageSize(const gfx::Size& page_size) = 0; // For testing, inject an alternative PWG raster converter. - virtual void SetPWGRasterConverterForTesting( - std::unique_ptr<printing::PWGRasterConverter> pwg_raster_converter) = 0; + virtual void SetPwgRasterConverterForTesting( + std::unique_ptr<printing::PwgRasterConverter> pwg_raster_converter) = 0; virtual PrivetHTTPClient* GetHTTPClient() = 0; };
diff --git a/chrome/browser/printing/cloud_print/privet_http_impl.cc b/chrome/browser/printing/cloud_print/privet_http_impl.cc index c102d388..156fe3a 100644 --- a/chrome/browser/printing/cloud_print/privet_http_impl.cc +++ b/chrome/browser/printing/cloud_print/privet_http_impl.cc
@@ -502,14 +502,14 @@ } void PrivetLocalPrintOperationImpl::StartConvertToPWG() { - using printing::PWGRasterConverter; + using printing::PwgRasterConverter; if (!pwg_raster_converter_) - pwg_raster_converter_ = PWGRasterConverter::CreateDefault(); + pwg_raster_converter_ = PwgRasterConverter::CreateDefault(); pwg_raster_converter_->Start( data_.get(), - PWGRasterConverter::GetConversionSettings(capabilities_, page_size_), - PWGRasterConverter::GetBitmapSettings(capabilities_, ticket_), + PwgRasterConverter::GetConversionSettings(capabilities_, page_size_), + PwgRasterConverter::GetBitmapSettings(capabilities_, ticket_), base::Bind(&PrivetLocalPrintOperationImpl::OnPWGRasterConverted, weak_factory_.GetWeakPtr())); } @@ -636,8 +636,8 @@ page_size_ = page_size; } -void PrivetLocalPrintOperationImpl::SetPWGRasterConverterForTesting( - std::unique_ptr<printing::PWGRasterConverter> pwg_raster_converter) { +void PrivetLocalPrintOperationImpl::SetPwgRasterConverterForTesting( + std::unique_ptr<printing::PwgRasterConverter> pwg_raster_converter) { pwg_raster_converter_ = std::move(pwg_raster_converter); } #endif // ENABLE_PRINT_PREVIEW
diff --git a/chrome/browser/printing/cloud_print/privet_http_impl.h b/chrome/browser/printing/cloud_print/privet_http_impl.h index 0493e46e..a3f9225 100644 --- a/chrome/browser/printing/cloud_print/privet_http_impl.h +++ b/chrome/browser/printing/cloud_print/privet_http_impl.h
@@ -160,8 +160,8 @@ void SetUsername(const std::string& user) override; void SetJobname(const std::string& jobname) override; void SetPageSize(const gfx::Size& page_size) override; - void SetPWGRasterConverterForTesting( - std::unique_ptr<printing::PWGRasterConverter> pwg_raster_converter) + void SetPwgRasterConverterForTesting( + std::unique_ptr<printing::PwgRasterConverter> pwg_raster_converter) override; PrivetHTTPClient* GetHTTPClient() override; @@ -216,7 +216,7 @@ std::unique_ptr<PrivetURLFetcher> url_fetcher_; std::unique_ptr<PrivetJSONOperation> info_operation_; - std::unique_ptr<printing::PWGRasterConverter> pwg_raster_converter_; + std::unique_ptr<printing::PwgRasterConverter> pwg_raster_converter_; base::WeakPtrFactory<PrivetLocalPrintOperationImpl> weak_factory_; };
diff --git a/chrome/browser/printing/cloud_print/privet_http_unittest.cc b/chrome/browser/printing/cloud_print/privet_http_unittest.cc index 39812a8..49d9804 100644 --- a/chrome/browser/printing/cloud_print/privet_http_unittest.cc +++ b/chrome/browser/printing/cloud_print/privet_http_unittest.cc
@@ -755,7 +755,7 @@ // converts strings to file paths based on them by appending "test.pdf", since // it's easier to test that way. Instead of using a mock, we simply check if the // request is uploading a file that is based on this pattern. -class FakePWGRasterConverter : public printing::PWGRasterConverter { +class FakePwgRasterConverter : public printing::PwgRasterConverter { public: void Start(base::RefCountedMemory* data, const printing::PdfRenderSettings& conversion_settings, @@ -783,9 +783,9 @@ local_print_operation_ = privet_client_->CreateLocalPrintOperation( &local_print_delegate_); - auto pwg_converter = std::make_unique<FakePWGRasterConverter>(); + auto pwg_converter = std::make_unique<FakePwgRasterConverter>(); pwg_converter_ = pwg_converter.get(); - local_print_operation_->SetPWGRasterConverterForTesting( + local_print_operation_->SetPwgRasterConverterForTesting( std::move(pwg_converter)); } @@ -799,7 +799,7 @@ protected: std::unique_ptr<PrivetLocalPrintOperation> local_print_operation_; StrictMock<MockLocalPrintDelegate> local_print_delegate_; - FakePWGRasterConverter* pwg_converter_; + FakePwgRasterConverter* pwg_converter_; }; INSTANTIATE_TEST_CASE_P(PrivetTests,
diff --git a/chrome/browser/printing/pdf_to_emf_converter.cc b/chrome/browser/printing/pdf_to_emf_converter.cc index e4d5716..ee29482 100644 --- a/chrome/browser/printing/pdf_to_emf_converter.cc +++ b/chrome/browser/printing/pdf_to_emf_converter.cc
@@ -214,7 +214,7 @@ const PdfRenderSettings& settings); void Start(const scoped_refptr<base::RefCountedMemory>& data, - const PdfConverter::StartCallback& start_callback); + PdfConverter::StartCallback start_callback); void GetPage(int page_number, const PdfConverter::GetPageCallback& get_page_callback); @@ -333,18 +333,18 @@ void Start(const scoped_refptr<base::RefCountedMemory>& data, const PdfRenderSettings& conversion_settings, - const StartCallback& start_callback); + StartCallback start_callback); void GetPage(int page_number, const GetPageCallback& get_page_callback) override; // Helps to cancel callbacks if this object is destroyed. - void RunCallback(const base::Closure& callback); + void RunCallback(base::OnceClosure callback); void Start( const scoped_refptr<PdfConverterUtilityProcessHostClient>& utility_client, const scoped_refptr<base::RefCountedMemory>& data, - const StartCallback& start_callback); + StartCallback start_callback); private: scoped_refptr<PdfConverterUtilityProcessHostClient> utility_client_; @@ -475,18 +475,18 @@ void PdfConverterUtilityProcessHostClient::Start( const scoped_refptr<base::RefCountedMemory>& data, - const PdfConverter::StartCallback& start_callback) { + PdfConverter::StartCallback start_callback) { if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, - base::Bind(&PdfConverterUtilityProcessHostClient::Start, this, data, - start_callback)); + base::BindOnce(&PdfConverterUtilityProcessHostClient::Start, this, data, + std::move(start_callback))); return; } // Store callback before any OnFailed() call to make it called on failure. DCHECK(start_callback); - start_callback_ = start_callback; + start_callback_ = std::move(start_callback); // NOTE: This process _must_ be sandboxed, otherwise the pdf dll will load // gdiplus.dll, change how rendering happens, and not be able to correctly @@ -540,7 +540,7 @@ BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::BindOnce(&PdfConverterImpl::RunCallback, converter_, - base::Bind(start_callback_, page_count))); + base::BindOnce(std::move(start_callback_), page_count))); } void PdfConverterUtilityProcessHostClient::GetPage( @@ -604,8 +604,8 @@ BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::Bind(&PdfConverterImpl::RunCallback, converter_, - base::Bind(data.callback(), data.page_number(), scale_factor, - base::Passed(&file)))); + base::BindRepeating(data.callback(), data.page_number(), + scale_factor, base::Passed(&file)))); get_page_callbacks_.pop(); } @@ -701,10 +701,10 @@ void PdfConverterImpl::Start( const scoped_refptr<PdfConverterUtilityProcessHostClient>& utility_client, const scoped_refptr<base::RefCountedMemory>& data, - const StartCallback& start_callback) { + StartCallback start_callback) { DCHECK(!utility_client_); utility_client_ = utility_client; - utility_client_->Start(data, start_callback); + utility_client_->Start(data, std::move(start_callback)); } void PdfConverterImpl::GetPage(int page_number, @@ -712,9 +712,9 @@ utility_client_->GetPage(page_number, get_page_callback); } -void PdfConverterImpl::RunCallback(const base::Closure& callback) { +void PdfConverterImpl::RunCallback(base::OnceClosure callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - callback.Run(); + std::move(callback).Run(); } } // namespace @@ -725,12 +725,12 @@ std::unique_ptr<PdfConverter> PdfConverter::StartPdfConverter( const scoped_refptr<base::RefCountedMemory>& data, const PdfRenderSettings& conversion_settings, - const StartCallback& start_callback) { + StartCallback start_callback) { std::unique_ptr<PdfConverterImpl> converter = base::MakeUnique<PdfConverterImpl>(); converter->Start(new PdfConverterUtilityProcessHostClient( converter->GetWeakPtr(), conversion_settings), - data, start_callback); + data, std::move(start_callback)); return std::move(converter); }
diff --git a/chrome/browser/printing/pdf_to_emf_converter.h b/chrome/browser/printing/pdf_to_emf_converter.h index 9990400a..6fa4c235 100644 --- a/chrome/browser/printing/pdf_to_emf_converter.h +++ b/chrome/browser/printing/pdf_to_emf_converter.h
@@ -17,11 +17,11 @@ class PdfConverter { public: - using StartCallback = base::Callback<void(int page_count)>; + using StartCallback = base::OnceCallback<void(int page_count)>; using GetPageCallback = - base::Callback<void(int page_number, - float scale_factor, - std::unique_ptr<MetafilePlayer> file)>; + base::RepeatingCallback<void(int page_number, + float scale_factor, + std::unique_ptr<MetafilePlayer> file)>; virtual ~PdfConverter(); // Starts conversion of PDF provided as |data|. Calls |start_callback| @@ -29,7 +29,7 @@ static std::unique_ptr<PdfConverter> StartPdfConverter( const scoped_refptr<base::RefCountedMemory>& data, const PdfRenderSettings& conversion_settings, - const StartCallback& start_callback); + StartCallback start_callback); // Requests conversion of the page. |page_number| is 0-base page number in // PDF provided in Start() call.
diff --git a/chrome/browser/printing/print_job.cc b/chrome/browser/printing/print_job.cc index ce8c62c8..67f7427 100644 --- a/chrome/browser/printing/print_job.cc +++ b/chrome/browser/printing/print_job.cc
@@ -226,9 +226,9 @@ void Start(const scoped_refptr<base::RefCountedMemory>& data, const PdfRenderSettings& conversion_settings, - const PdfConverter::StartCallback& start_callback) { - converter_ = PdfConverter::StartPdfConverter( - data, conversion_settings, start_callback); + PdfConverter::StartCallback start_callback) { + converter_ = PdfConverter::StartPdfConverter(data, conversion_settings, + std::move(start_callback)); } void GetMorePages(const PdfConverter::GetPageCallback& get_page_callback) {
diff --git a/chrome/browser/printing/printer_manager_dialog_linux.cc b/chrome/browser/printing/printer_manager_dialog_linux.cc index f0f03e29..8e62d44 100644 --- a/chrome/browser/printing/printer_manager_dialog_linux.cc +++ b/chrome/browser/printing/printer_manager_dialog_linux.cc
@@ -54,6 +54,7 @@ opened = OpenPrinterConfigDialog(kSystemConfigPrinterCommand) || OpenPrinterConfigDialog(kGnomeControlCenterPrintersCommand); break; + case base::nix::DESKTOP_ENVIRONMENT_CINNAMON: case base::nix::DESKTOP_ENVIRONMENT_KDE3: case base::nix::DESKTOP_ENVIRONMENT_KDE4: case base::nix::DESKTOP_ENVIRONMENT_KDE5:
diff --git a/chrome/browser/printing/pwg_raster_converter.cc b/chrome/browser/printing/pwg_raster_converter.cc index 169d2b5..4fb3d81 100644 --- a/chrome/browser/printing/pwg_raster_converter.cc +++ b/chrome/browser/printing/pwg_raster_converter.cc
@@ -112,19 +112,19 @@ // This step posts |FileHandlers| to be destroyed on |blocking_task_runner_|. // All these steps work sequentially, so no data should be accessed // simultaneously by several threads. -class PWGRasterConverterHelper - : public base::RefCountedThreadSafe<PWGRasterConverterHelper> { +class PwgRasterConverterHelper + : public base::RefCountedThreadSafe<PwgRasterConverterHelper> { public: - PWGRasterConverterHelper(const PdfRenderSettings& settings, + PwgRasterConverterHelper(const PdfRenderSettings& settings, const PwgRasterSettings& bitmap_settings); void Convert(base::RefCountedMemory* data, - PWGRasterConverter::ResultCallback callback); + PwgRasterConverter::ResultCallback callback); private: - friend class base::RefCountedThreadSafe<PWGRasterConverterHelper>; + friend class base::RefCountedThreadSafe<PwgRasterConverterHelper>; - ~PWGRasterConverterHelper(); + ~PwgRasterConverterHelper(); void RunCallback(bool success); @@ -134,14 +134,14 @@ PwgRasterSettings bitmap_settings_; mojo::InterfacePtr<printing::mojom::PdfToPwgRasterConverter> pdf_to_pwg_raster_converter_ptr_; - PWGRasterConverter::ResultCallback callback_; + PwgRasterConverter::ResultCallback callback_; const scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; std::unique_ptr<FileHandlers, base::OnTaskRunnerDeleter> files_; - DISALLOW_COPY_AND_ASSIGN(PWGRasterConverterHelper); + DISALLOW_COPY_AND_ASSIGN(PwgRasterConverterHelper); }; -PWGRasterConverterHelper::PWGRasterConverterHelper( +PwgRasterConverterHelper::PwgRasterConverterHelper( const PdfRenderSettings& settings, const PwgRasterSettings& bitmap_settings) : settings_(settings), @@ -151,11 +151,11 @@ base::TaskShutdownBehavior::BLOCK_SHUTDOWN})), files_(nullptr, base::OnTaskRunnerDeleter(blocking_task_runner_)) {} -PWGRasterConverterHelper::~PWGRasterConverterHelper() {} +PwgRasterConverterHelper::~PwgRasterConverterHelper() {} -void PWGRasterConverterHelper::Convert( +void PwgRasterConverterHelper::Convert( base::RefCountedMemory* data, - PWGRasterConverter::ResultCallback callback) { + PwgRasterConverter::ResultCallback callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); callback_ = std::move(callback); @@ -166,10 +166,10 @@ FROM_HERE, base::BindOnce(&FileHandlers::Init, base::Unretained(files_.get()), base::RetainedRef(data)), - base::BindOnce(&PWGRasterConverterHelper::OnFilesReadyOnUIThread, this)); + base::BindOnce(&PwgRasterConverterHelper::OnFilesReadyOnUIThread, this)); } -void PWGRasterConverterHelper::OnFilesReadyOnUIThread() { +void PwgRasterConverterHelper::OnFilesReadyOnUIThread() { DCHECK_CURRENTLY_ON(BrowserThread::UI); if (!files_->IsValid()) { @@ -183,24 +183,24 @@ &pdf_to_pwg_raster_converter_ptr_); pdf_to_pwg_raster_converter_ptr_.set_connection_error_handler( - base::Bind(&PWGRasterConverterHelper::RunCallback, this, false)); + base::Bind(&PwgRasterConverterHelper::RunCallback, this, false)); pdf_to_pwg_raster_converter_ptr_->Convert( mojo::WrapPlatformFile(files_->GetPdfForProcess()), settings_, bitmap_settings_, mojo::WrapPlatformFile(files_->GetPwgForProcess()), - base::Bind(&PWGRasterConverterHelper::RunCallback, this)); + base::Bind(&PwgRasterConverterHelper::RunCallback, this)); } -void PWGRasterConverterHelper::RunCallback(bool success) { +void PwgRasterConverterHelper::RunCallback(bool success) { DCHECK_CURRENTLY_ON(BrowserThread::UI); if (callback_) std::move(callback_).Run(success, files_->GetPwgPath()); } -class PWGRasterConverterImpl : public PWGRasterConverter { +class PwgRasterConverterImpl : public PwgRasterConverter { public: - PWGRasterConverterImpl(); - ~PWGRasterConverterImpl() override; + PwgRasterConverterImpl(); + ~PwgRasterConverterImpl() override; void Start(base::RefCountedMemory* data, const PdfRenderSettings& conversion_settings, @@ -212,33 +212,32 @@ // change callback_ to a CancelableOnceCallback. void RunCallback(bool success, const base::FilePath& temp_file); - scoped_refptr<PWGRasterConverterHelper> utility_client_; + scoped_refptr<PwgRasterConverterHelper> utility_client_; ResultCallback callback_; - base::WeakPtrFactory<PWGRasterConverterImpl> weak_ptr_factory_; + base::WeakPtrFactory<PwgRasterConverterImpl> weak_ptr_factory_; - DISALLOW_COPY_AND_ASSIGN(PWGRasterConverterImpl); + DISALLOW_COPY_AND_ASSIGN(PwgRasterConverterImpl); }; -PWGRasterConverterImpl::PWGRasterConverterImpl() : weak_ptr_factory_(this) {} +PwgRasterConverterImpl::PwgRasterConverterImpl() : weak_ptr_factory_(this) {} -PWGRasterConverterImpl::~PWGRasterConverterImpl() { -} +PwgRasterConverterImpl::~PwgRasterConverterImpl() {} -void PWGRasterConverterImpl::Start(base::RefCountedMemory* data, +void PwgRasterConverterImpl::Start(base::RefCountedMemory* data, const PdfRenderSettings& conversion_settings, const PwgRasterSettings& bitmap_settings, ResultCallback callback) { // Bind callback here and pass a wrapper to the utility client to avoid - // calling callback if PWGRasterConverterImpl is destroyed. + // calling callback if PwgRasterConverterImpl is destroyed. callback_ = std::move(callback); - utility_client_ = base::MakeRefCounted<PWGRasterConverterHelper>( + utility_client_ = base::MakeRefCounted<PwgRasterConverterHelper>( conversion_settings, bitmap_settings); utility_client_->Convert(data, - base::BindOnce(&PWGRasterConverterImpl::RunCallback, + base::BindOnce(&PwgRasterConverterImpl::RunCallback, weak_ptr_factory_.GetWeakPtr())); } -void PWGRasterConverterImpl::RunCallback(bool success, +void PwgRasterConverterImpl::RunCallback(bool success, const base::FilePath& temp_file) { std::move(callback_).Run(success, temp_file); } @@ -246,12 +245,12 @@ } // namespace // static -std::unique_ptr<PWGRasterConverter> PWGRasterConverter::CreateDefault() { - return base::MakeUnique<PWGRasterConverterImpl>(); +std::unique_ptr<PwgRasterConverter> PwgRasterConverter::CreateDefault() { + return base::MakeUnique<PwgRasterConverterImpl>(); } // static -PdfRenderSettings PWGRasterConverter::GetConversionSettings( +PdfRenderSettings PwgRasterConverter::GetConversionSettings( const cloud_devices::CloudDeviceDescription& printer_capabilities, const gfx::Size& page_size) { int dpi = kDefaultPdfDpi; @@ -270,7 +269,7 @@ } // static -PwgRasterSettings PWGRasterConverter::GetBitmapSettings( +PwgRasterSettings PwgRasterConverter::GetBitmapSettings( const cloud_devices::CloudDeviceDescription& printer_capabilities, const cloud_devices::CloudDeviceDescription& ticket) { cloud_devices::printer::DuplexTicketItem duplex_item;
diff --git a/chrome/browser/printing/pwg_raster_converter.h b/chrome/browser/printing/pwg_raster_converter.h index b7e1af71..3fc13b63 100644 --- a/chrome/browser/printing/pwg_raster_converter.h +++ b/chrome/browser/printing/pwg_raster_converter.h
@@ -27,7 +27,7 @@ struct PwgRasterSettings; -class PWGRasterConverter { +class PwgRasterConverter { public: // Callback for when the PDF is converted to a PWG raster. // |success| denotes whether the conversion succeeded. @@ -37,9 +37,9 @@ base::OnceCallback<void(bool /*success*/, const base::FilePath& /*temp_file*/)>; - virtual ~PWGRasterConverter() {} + virtual ~PwgRasterConverter() {} - static std::unique_ptr<PWGRasterConverter> CreateDefault(); + static std::unique_ptr<PwgRasterConverter> CreateDefault(); // Generates conversion settings to be used with converter from printer // capabilities and page size.
diff --git a/chrome/browser/printing/pwg_raster_converter_browsertest.cc b/chrome/browser/printing/pwg_raster_converter_browsertest.cc index 978d4ba5..d958240 100644 --- a/chrome/browser/printing/pwg_raster_converter_browsertest.cc +++ b/chrome/browser/printing/pwg_raster_converter_browsertest.cc
@@ -36,7 +36,7 @@ class PdfToPwgRasterBrowserTest : public InProcessBrowserTest { public: PdfToPwgRasterBrowserTest() - : converter_(PWGRasterConverter::CreateDefault()) {} + : converter_(PwgRasterConverter::CreateDefault()) {} ~PdfToPwgRasterBrowserTest() override {} void Convert(base::RefCountedMemory* pdf_data, @@ -56,7 +56,7 @@ } private: - std::unique_ptr<PWGRasterConverter> converter_; + std::unique_ptr<PwgRasterConverter> converter_; }; std::string HashFile(const std::string& file_data) {
diff --git a/chrome/browser/profiles/profile_attributes_storage_unittest.cc b/chrome/browser/profiles/profile_attributes_storage_unittest.cc index 8fb263e..1a04ad7 100644 --- a/chrome/browser/profiles/profile_attributes_storage_unittest.cc +++ b/chrome/browser/profiles/profile_attributes_storage_unittest.cc
@@ -791,7 +791,14 @@ EXPECT_EQ(0U, storage()->avatar_images_downloads_in_progress_.size()); } -TEST_F(ProfileAttributesStorageTest, LoadAvatarFromDiskTest) { +// Flaky on Linux ASAN. http://crbug.com/794821. +#if defined(OS_LINUX) && defined(ADDRESS_SANITIZER) +#define MAYBE_LoadAvatarFromDiskTest DISABLED_LoadAvatarFromDiskTest +#else +#define MAYBE_LoadAvatarFromDiskTest LoadAvatarFromDiskTest +#endif + +TEST_F(ProfileAttributesStorageTest, MAYBE_LoadAvatarFromDiskTest) { const size_t kIconIndex = 0; base::FilePath icon_path = profiles::GetPathOfHighResAvatarAtIndex(kIconIndex);
diff --git a/chrome/browser/resource_coordinator/tab_manager_unittest.cc b/chrome/browser/resource_coordinator/tab_manager_unittest.cc index a9576b2..ee463aa3 100644 --- a/chrome/browser/resource_coordinator/tab_manager_unittest.cc +++ b/chrome/browser/resource_coordinator/tab_manager_unittest.cc
@@ -146,6 +146,11 @@ return web_contents; } + void SetUp() override { + ChromeRenderViewHostTestHarness::SetUp(); + tab_manager_ = g_browser_process->GetTabManager(); + } + void TearDown() override { // NavigationHandles and NavigationThrottles must be deleted before the // associated WebContents. @@ -245,6 +250,7 @@ GURL(url), web_contents->GetMainFrame()); } + TabManager* tab_manager_ = nullptr; scoped_refptr<base::TestMockTimeTaskRunner> task_runner_ = base::MakeRefCounted<base::TestMockTimeTaskRunner>(); std::unique_ptr<base::TickClock> tick_clock_ = @@ -266,7 +272,7 @@ void SetUp() override { scoped_feature_list_.InitAndDisableFeature( features::kStaggeredBackgroundTabOpeningExperiment); - ChromeRenderViewHostTestHarness::SetUp(); + TabManagerTest::SetUp(); } void CheckThrottleResults(NavigationThrottle::ThrottleCheckResult result1, @@ -406,18 +412,16 @@ // Ensures discarding tabs leaves TabStripModel in a good state. TEST_F(TabManagerTest, DiscardWebContentsAt) { - TabManager tab_manager; - // Create a tab strip in a visible and active window. TabStripDummyDelegate delegate; TabStripModelImpl tabstrip(&delegate, profile()); - tabstrip.AddObserver(&tab_manager); + tabstrip.AddObserver(tab_manager_); BrowserInfo browser_info; browser_info.tab_strip_model = &tabstrip; browser_info.window_is_minimized = false; browser_info.browser_is_app = false; - tab_manager.test_browser_info_list_.push_back(browser_info); + tab_manager_->test_browser_info_list_.push_back(browser_info); // Fill it with some tabs. WebContents* contents1 = CreateWebContents(); @@ -431,11 +435,11 @@ tabstrip.AddObserver(&tabstrip_observer); // Discard one of the tabs. - WebContents* null_contents1 = - tab_manager.DiscardWebContentsAt(0, &tabstrip, DiscardReason::kProactive); + WebContents* null_contents1 = tab_manager_->DiscardWebContentsAt( + 0, &tabstrip, DiscardReason::kProactive); ASSERT_EQ(2, tabstrip.count()); - EXPECT_TRUE(tab_manager.IsTabDiscarded(tabstrip.GetWebContentsAt(0))); - EXPECT_FALSE(tab_manager.IsTabDiscarded(tabstrip.GetWebContentsAt(1))); + EXPECT_TRUE(tab_manager_->IsTabDiscarded(tabstrip.GetWebContentsAt(0))); + EXPECT_FALSE(tab_manager_->IsTabDiscarded(tabstrip.GetWebContentsAt(1))); ASSERT_EQ(null_contents1, tabstrip.GetWebContentsAt(0)); ASSERT_EQ(contents2, tabstrip.GetWebContentsAt(1)); ASSERT_EQ(1, tabstrip_observer.NbEvents()); @@ -444,13 +448,13 @@ tabstrip_observer.Reset(); // Discard the same tab again, after resetting its discard state. - tab_manager.GetWebContentsData(tabstrip.GetWebContentsAt(0)) + tab_manager_->GetWebContentsData(tabstrip.GetWebContentsAt(0)) ->SetDiscardState(false); - WebContents* null_contents2 = - tab_manager.DiscardWebContentsAt(0, &tabstrip, DiscardReason::kProactive); + WebContents* null_contents2 = tab_manager_->DiscardWebContentsAt( + 0, &tabstrip, DiscardReason::kProactive); ASSERT_EQ(2, tabstrip.count()); - EXPECT_TRUE(tab_manager.IsTabDiscarded(tabstrip.GetWebContentsAt(0))); - EXPECT_FALSE(tab_manager.IsTabDiscarded(tabstrip.GetWebContentsAt(1))); + EXPECT_TRUE(tab_manager_->IsTabDiscarded(tabstrip.GetWebContentsAt(0))); + EXPECT_FALSE(tab_manager_->IsTabDiscarded(tabstrip.GetWebContentsAt(1))); ASSERT_EQ(null_contents2, tabstrip.GetWebContentsAt(0)); ASSERT_EQ(contents2, tabstrip.GetWebContentsAt(1)); ASSERT_EQ(1, tabstrip_observer.NbEvents()); @@ -460,8 +464,8 @@ // Activating the tab should clear its discard state. tabstrip.ActivateTabAt(0, true /* user_gesture */); ASSERT_EQ(2, tabstrip.count()); - EXPECT_FALSE(tab_manager.IsTabDiscarded(tabstrip.GetWebContentsAt(0))); - EXPECT_FALSE(tab_manager.IsTabDiscarded(tabstrip.GetWebContentsAt(1))); + EXPECT_FALSE(tab_manager_->IsTabDiscarded(tabstrip.GetWebContentsAt(0))); + EXPECT_FALSE(tab_manager_->IsTabDiscarded(tabstrip.GetWebContentsAt(1))); tabstrip.CloseAllTabs(); EXPECT_TRUE(tabstrip.empty()); @@ -474,7 +478,6 @@ // the event we are trying to test for is not related to the tab strip, but // the web content instead and therefore should be handled by WebContentsData // (which observes the web content). - TabManager tab_manager; TabStripDummyDelegate delegate; TabStripModelImpl tabstrip(&delegate, profile()); @@ -488,14 +491,14 @@ // so the reload can happen. WebContentsTester::For(test_contents) ->NavigateAndCommit(GURL("chrome://newtab")); - EXPECT_FALSE(tab_manager.IsTabDiscarded(tabstrip.GetWebContentsAt(1))); + EXPECT_FALSE(tab_manager_->IsTabDiscarded(tabstrip.GetWebContentsAt(1))); - tab_manager.DiscardWebContentsAt(1, &tabstrip, DiscardReason::kProactive); - EXPECT_TRUE(tab_manager.IsTabDiscarded(tabstrip.GetWebContentsAt(1))); + tab_manager_->DiscardWebContentsAt(1, &tabstrip, DiscardReason::kProactive); + EXPECT_TRUE(tab_manager_->IsTabDiscarded(tabstrip.GetWebContentsAt(1))); tabstrip.GetWebContentsAt(1)->GetController().Reload( content::ReloadType::NORMAL, false); - EXPECT_FALSE(tab_manager.IsTabDiscarded(tabstrip.GetWebContentsAt(1))); + EXPECT_FALSE(tab_manager_->IsTabDiscarded(tabstrip.GetWebContentsAt(1))); tabstrip.CloseAllTabs(); EXPECT_TRUE(tabstrip.empty()); } @@ -503,10 +506,9 @@ // Makes sure that the last active time property is saved even though the tab is // discarded. TEST_F(TabManagerTest, DiscardedTabKeepsLastActiveTime) { - TabManager tab_manager; TabStripDummyDelegate delegate; TabStripModelImpl tabstrip(&delegate, profile()); - tabstrip.AddObserver(&tab_manager); + tabstrip.AddObserver(tab_manager_); tabstrip.AppendWebContents(CreateWebContents(), true); WebContents* test_contents = CreateWebContents(); @@ -518,8 +520,8 @@ test_contents->SetLastActiveTime(new_last_active_time); EXPECT_EQ(new_last_active_time, test_contents->GetLastActiveTime()); - WebContents* null_contents = - tab_manager.DiscardWebContentsAt(1, &tabstrip, DiscardReason::kProactive); + WebContents* null_contents = tab_manager_->DiscardWebContentsAt( + 1, &tabstrip, DiscardReason::kProactive); EXPECT_EQ(new_last_active_time, null_contents->GetLastActiveTime()); tabstrip.CloseAllTabs(); @@ -527,85 +529,82 @@ } TEST_F(TabManagerTest, DefaultTimeToPurgeInCorrectRange) { - TabManager tab_manager; base::TimeDelta time_to_purge = - tab_manager.GetTimeToPurge(TabManager::kDefaultMinTimeToPurge, - TabManager::kDefaultMinTimeToPurge * 4); + tab_manager_->GetTimeToPurge(TabManager::kDefaultMinTimeToPurge, + TabManager::kDefaultMinTimeToPurge * 4); EXPECT_GE(time_to_purge, base::TimeDelta::FromMinutes(1)); EXPECT_LE(time_to_purge, base::TimeDelta::FromMinutes(4)); } TEST_F(TabManagerTest, ShouldPurgeAtDefaultTime) { - TabManager tab_manager; TabStripDummyDelegate delegate; TabStripModelImpl tabstrip(&delegate, profile()); - tabstrip.AddObserver(&tab_manager); + tabstrip.AddObserver(tab_manager_); WebContents* test_contents = CreateWebContents(); tabstrip.AppendWebContents(test_contents, false); - tab_manager.GetWebContentsData(test_contents)->set_is_purged(false); - tab_manager.GetWebContentsData(test_contents) + tab_manager_->GetWebContentsData(test_contents)->set_is_purged(false); + tab_manager_->GetWebContentsData(test_contents) ->SetLastInactiveTime(NowTicks()); - tab_manager.GetWebContentsData(test_contents) + tab_manager_->GetWebContentsData(test_contents) ->set_time_to_purge(base::TimeDelta::FromMinutes(1)); // Wait 1 minute and verify that the tab is still not to be purged. task_runner_->FastForwardBy(base::TimeDelta::FromMinutes(1)); - EXPECT_FALSE(tab_manager.ShouldPurgeNow(test_contents)); + EXPECT_FALSE(tab_manager_->ShouldPurgeNow(test_contents)); // Wait another 1 second and verify that it should be purged now . task_runner_->FastForwardBy(base::TimeDelta::FromSeconds(1)); - EXPECT_TRUE(tab_manager.ShouldPurgeNow(test_contents)); + EXPECT_TRUE(tab_manager_->ShouldPurgeNow(test_contents)); - tab_manager.GetWebContentsData(test_contents)->set_is_purged(true); - tab_manager.GetWebContentsData(test_contents) + tab_manager_->GetWebContentsData(test_contents)->set_is_purged(true); + tab_manager_->GetWebContentsData(test_contents) ->SetLastInactiveTime(NowTicks()); // Wait 1 day and verify that the tab is still be purged. task_runner_->FastForwardBy(base::TimeDelta::FromHours(24)); - EXPECT_FALSE(tab_manager.ShouldPurgeNow(test_contents)); + EXPECT_FALSE(tab_manager_->ShouldPurgeNow(test_contents)); // Tabs with a committed URL must be closed explicitly to avoid DCHECK errors. tabstrip.CloseAllTabs(); } TEST_F(TabManagerTest, ActivateTabResetPurgeState) { - TabManager tab_manager; TabStripDummyDelegate delegate; TabStripModelImpl tabstrip(&delegate, profile()); - tabstrip.AddObserver(&tab_manager); + tabstrip.AddObserver(tab_manager_); BrowserInfo browser_info; browser_info.tab_strip_model = &tabstrip; browser_info.window_is_minimized = false; browser_info.browser_is_app = false; - tab_manager.test_browser_info_list_.push_back(browser_info); + tab_manager_->test_browser_info_list_.push_back(browser_info); WebContents* tab1 = CreateWebContents(); WebContents* tab2 = CreateWebContents(); tabstrip.AppendWebContents(tab1, true); tabstrip.AppendWebContents(tab2, false); - tab_manager.GetWebContentsData(tab2)->SetLastInactiveTime(NowTicks()); + tab_manager_->GetWebContentsData(tab2)->SetLastInactiveTime(NowTicks()); static_cast<content::MockRenderProcessHost*>( tab2->GetMainFrame()->GetProcess()) ->set_is_process_backgrounded(true); EXPECT_TRUE(tab2->GetMainFrame()->GetProcess()->IsProcessBackgrounded()); // Initially PurgeAndSuspend state should be NOT_PURGED. - EXPECT_FALSE(tab_manager.GetWebContentsData(tab2)->is_purged()); - tab_manager.GetWebContentsData(tab2)->set_time_to_purge( + EXPECT_FALSE(tab_manager_->GetWebContentsData(tab2)->is_purged()); + tab_manager_->GetWebContentsData(tab2)->set_time_to_purge( base::TimeDelta::FromMinutes(1)); task_runner_->FastForwardBy(base::TimeDelta::FromMinutes(2)); - tab_manager.PurgeBackgroundedTabsIfNeeded(); + tab_manager_->PurgeBackgroundedTabsIfNeeded(); // Since tab2 is kept inactive and background for more than time-to-purge, // tab2 should be purged. - EXPECT_TRUE(tab_manager.GetWebContentsData(tab2)->is_purged()); + EXPECT_TRUE(tab_manager_->GetWebContentsData(tab2)->is_purged()); // Activate tab2. Tab2's PurgeAndSuspend state should be NOT_PURGED. tabstrip.ActivateTabAt(1, true /* user_gesture */); - EXPECT_FALSE(tab_manager.GetWebContentsData(tab2)->is_purged()); + EXPECT_FALSE(tab_manager_->GetWebContentsData(tab2)->is_purged()); // Tabs with a committed URL must be closed explicitly to avoid DCHECK errors. tabstrip.CloseAllTabs(); @@ -614,7 +613,6 @@ // Verify that the |is_in_visible_window| field of TabStats returned by // GetUnsortedTabStats() is set correctly. TEST_F(TabManagerTest, GetUnsortedTabStatsIsInVisibleWindow) { - TabManager tab_manager; TabStripDummyDelegate delegate; WebContents* web_contents1a = CreateWebContents(); @@ -638,24 +636,24 @@ browser_info1.tab_strip_model = &tab_strip1; browser_info1.window_is_minimized = false; browser_info1.browser_is_app = false; - tab_manager.test_browser_info_list_.push_back(browser_info1); + tab_manager_->test_browser_info_list_.push_back(browser_info1); BrowserInfo browser_info2; browser_info2.tab_strip_model = &tab_strip2; browser_info2.window_is_minimized = true; browser_info2.browser_is_app = false; - tab_manager.test_browser_info_list_.push_back(browser_info2); + tab_manager_->test_browser_info_list_.push_back(browser_info2); // Get TabStats and verify the the |is_in_visible_window| field of each // TabStats is set correctly. - auto tab_stats = tab_manager.GetUnsortedTabStats(); + auto tab_stats = tab_manager_->GetUnsortedTabStats(); ASSERT_EQ(4U, tab_stats.size()); - EXPECT_EQ(tab_stats[0].id, tab_manager.IdFromWebContents(web_contents1a)); - EXPECT_EQ(tab_stats[1].id, tab_manager.IdFromWebContents(web_contents1b)); - EXPECT_EQ(tab_stats[2].id, tab_manager.IdFromWebContents(web_contents2a)); - EXPECT_EQ(tab_stats[3].id, tab_manager.IdFromWebContents(web_contents2b)); + EXPECT_EQ(tab_stats[0].id, tab_manager_->IdFromWebContents(web_contents1a)); + EXPECT_EQ(tab_stats[1].id, tab_manager_->IdFromWebContents(web_contents1b)); + EXPECT_EQ(tab_stats[2].id, tab_manager_->IdFromWebContents(web_contents2a)); + EXPECT_EQ(tab_stats[3].id, tab_manager_->IdFromWebContents(web_contents2b)); EXPECT_TRUE(tab_stats[0].is_in_visible_window); EXPECT_TRUE(tab_stats[1].is_in_visible_window); @@ -679,7 +677,6 @@ // cannot discard the active tab in a visible window. // - On other platforms, DiscardTab can discard every non-active tab. TEST_F(TabManagerTest, MAYBE_DiscardTabWithNonVisibleTabs) { - TabManager tab_manager; TabStripDummyDelegate delegate; // Create 2 TabStripModels. @@ -698,35 +695,35 @@ browser_info1.tab_strip_model = &tab_strip1; browser_info1.window_is_minimized = false; browser_info1.browser_is_app = false; - tab_manager.test_browser_info_list_.push_back(browser_info1); + tab_manager_->test_browser_info_list_.push_back(browser_info1); BrowserInfo browser_info2; browser_info2.tab_strip_model = &tab_strip2; browser_info2.window_is_minimized = true; browser_info2.browser_is_app = false; - tab_manager.test_browser_info_list_.push_back(browser_info2); + tab_manager_->test_browser_info_list_.push_back(browser_info2); // Fast-forward time until no tab is protected from being discarded for having // recently been used. task_runner_->FastForwardBy(TabManager::kDiscardProtectionTime); for (int i = 0; i < 4; ++i) - tab_manager.DiscardTab(DiscardReason::kProactive); + tab_manager_->DiscardTab(DiscardReason::kProactive); // Active tab in a visible window should not be discarded. - EXPECT_FALSE(tab_manager.IsTabDiscarded(tab_strip1.GetWebContentsAt(0))); + EXPECT_FALSE(tab_manager_->IsTabDiscarded(tab_strip1.GetWebContentsAt(0))); // Non-active tabs should be discarded. - EXPECT_TRUE(tab_manager.IsTabDiscarded(tab_strip1.GetWebContentsAt(1))); - EXPECT_TRUE(tab_manager.IsTabDiscarded(tab_strip2.GetWebContentsAt(1))); + EXPECT_TRUE(tab_manager_->IsTabDiscarded(tab_strip1.GetWebContentsAt(1))); + EXPECT_TRUE(tab_manager_->IsTabDiscarded(tab_strip2.GetWebContentsAt(1))); #if defined(OS_CHROMEOS) // On ChromeOS, active tab in a minimized window should be discarded. - EXPECT_TRUE(tab_manager.IsTabDiscarded(tab_strip2.GetWebContentsAt(0))); + EXPECT_TRUE(tab_manager_->IsTabDiscarded(tab_strip2.GetWebContentsAt(0))); #else // On other platforms, an active tab is never discarded, even if its window is // minimized. - EXPECT_FALSE(tab_manager.IsTabDiscarded(tab_strip2.GetWebContentsAt(0))); + EXPECT_FALSE(tab_manager_->IsTabDiscarded(tab_strip2.GetWebContentsAt(0))); #endif // defined(OS_CHROMEOS) // Tabs with a committed URL must be closed explicitly to avoid DCHECK errors. @@ -735,211 +732,204 @@ } TEST_F(TabManagerTest, MaybeThrottleNavigation) { - TabManager* tab_manager = g_browser_process->GetTabManager(); - tab_manager->ResetMemoryPressureListenerForTest(); - MaybeThrottleNavigations(tab_manager); - tab_manager->GetWebContentsData(contents1_.get()) + tab_manager_->ResetMemoryPressureListenerForTest(); + MaybeThrottleNavigations(tab_manager_); + tab_manager_->GetWebContentsData(contents1_.get()) ->DidStartNavigation(nav_handle1_.get()); // Tab 1 is loading. The other 2 tabs's navigations are delayed. - EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents1_.get())); - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents2_.get())); - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents3_.get())); + EXPECT_TRUE(tab_manager_->IsTabLoadingForTest(contents1_.get())); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents2_.get())); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents3_.get())); - EXPECT_FALSE(tab_manager->IsNavigationDelayedForTest(nav_handle1_.get())); - EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); - EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle3_.get())); + EXPECT_FALSE(tab_manager_->IsNavigationDelayedForTest(nav_handle1_.get())); + EXPECT_TRUE(tab_manager_->IsNavigationDelayedForTest(nav_handle2_.get())); + EXPECT_TRUE(tab_manager_->IsNavigationDelayedForTest(nav_handle3_.get())); } TEST_F(TabManagerTest, OnDidFinishNavigation) { - TabManager* tab_manager = g_browser_process->GetTabManager(); - tab_manager->ResetMemoryPressureListenerForTest(); - MaybeThrottleNavigations(tab_manager); - tab_manager->GetWebContentsData(contents1_.get()) + tab_manager_->ResetMemoryPressureListenerForTest(); + MaybeThrottleNavigations(tab_manager_); + tab_manager_->GetWebContentsData(contents1_.get()) ->DidStartNavigation(nav_handle1_.get()); - EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); - tab_manager->GetWebContentsData(contents2_.get()) + EXPECT_TRUE(tab_manager_->IsNavigationDelayedForTest(nav_handle2_.get())); + tab_manager_->GetWebContentsData(contents2_.get()) ->DidFinishNavigation(nav_handle2_.get()); - EXPECT_FALSE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); + EXPECT_FALSE(tab_manager_->IsNavigationDelayedForTest(nav_handle2_.get())); } TEST_F(TabManagerTest, OnTabIsLoaded) { - TabManager* tab_manager = g_browser_process->GetTabManager(); - tab_manager->ResetMemoryPressureListenerForTest(); - MaybeThrottleNavigations(tab_manager); - tab_manager->GetWebContentsData(contents1_.get()) + tab_manager_->ResetMemoryPressureListenerForTest(); + MaybeThrottleNavigations(tab_manager_); + tab_manager_->GetWebContentsData(contents1_.get()) ->DidStartNavigation(nav_handle1_.get()); - EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents1_.get())); - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents2_.get())); - EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); + EXPECT_TRUE(tab_manager_->IsTabLoadingForTest(contents1_.get())); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents2_.get())); + EXPECT_TRUE(tab_manager_->IsNavigationDelayedForTest(nav_handle2_.get())); // Simulate tab 1 has finished loading. - tab_manager->GetWebContentsData(contents1_.get())->NotifyTabIsLoaded(); + tab_manager_->GetWebContentsData(contents1_.get())->NotifyTabIsLoaded(); // After tab 1 has finished loading, TabManager starts loading the next tab. - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents1_.get())); - EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents2_.get())); - EXPECT_FALSE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents1_.get())); + EXPECT_TRUE(tab_manager_->IsTabLoadingForTest(contents2_.get())); + EXPECT_FALSE(tab_manager_->IsNavigationDelayedForTest(nav_handle2_.get())); } TEST_F(TabManagerTest, OnWebContentsDestroyed) { - TabManager* tab_manager = g_browser_process->GetTabManager(); - tab_manager->ResetMemoryPressureListenerForTest(); - MaybeThrottleNavigations(tab_manager); - tab_manager->GetWebContentsData(contents1_.get()) + tab_manager_->ResetMemoryPressureListenerForTest(); + MaybeThrottleNavigations(tab_manager_); + tab_manager_->GetWebContentsData(contents1_.get()) ->DidStartNavigation(nav_handle1_.get()); // Tab 2 is destroyed when its navigation is still delayed. Its states are // cleaned up. - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents2_.get())); - EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); - tab_manager->OnWebContentsDestroyed(contents2_.get()); - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents2_.get())); - EXPECT_FALSE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents2_.get())); + EXPECT_TRUE(tab_manager_->IsNavigationDelayedForTest(nav_handle2_.get())); + tab_manager_->OnWebContentsDestroyed(contents2_.get()); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents2_.get())); + EXPECT_FALSE(tab_manager_->IsNavigationDelayedForTest(nav_handle2_.get())); // Tab 1 is destroyed when it is still loading. Its states are cleaned up and // Tabmanager starts to load the next tab (tab 3). - EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents1_.get())); - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents3_.get())); - EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle3_.get())); - tab_manager->GetWebContentsData(contents1_.get())->WebContentsDestroyed(); - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents1_.get())); - EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents3_.get())); - EXPECT_FALSE(tab_manager->IsNavigationDelayedForTest(nav_handle3_.get())); + EXPECT_TRUE(tab_manager_->IsTabLoadingForTest(contents1_.get())); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents3_.get())); + EXPECT_TRUE(tab_manager_->IsNavigationDelayedForTest(nav_handle3_.get())); + tab_manager_->GetWebContentsData(contents1_.get())->WebContentsDestroyed(); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents1_.get())); + EXPECT_TRUE(tab_manager_->IsTabLoadingForTest(contents3_.get())); + EXPECT_FALSE(tab_manager_->IsNavigationDelayedForTest(nav_handle3_.get())); } TEST_F(TabManagerTest, OnDelayedTabSelected) { - TabManager* tab_manager = g_browser_process->GetTabManager(); - tab_manager->ResetMemoryPressureListenerForTest(); - MaybeThrottleNavigations(tab_manager); - tab_manager->GetWebContentsData(contents1_.get()) + tab_manager_->ResetMemoryPressureListenerForTest(); + MaybeThrottleNavigations(tab_manager_); + tab_manager_->GetWebContentsData(contents1_.get()) ->DidStartNavigation(nav_handle1_.get()); - EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents1_.get())); - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents3_.get())); - EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle3_.get())); + EXPECT_TRUE(tab_manager_->IsTabLoadingForTest(contents1_.get())); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents3_.get())); + EXPECT_TRUE(tab_manager_->IsNavigationDelayedForTest(nav_handle3_.get())); // Simulate selecting tab 3, which should start loading immediately. - tab_manager->ActiveTabChanged( + tab_manager_->ActiveTabChanged( contents1_.get(), contents3_.get(), 2, TabStripModelObserver::CHANGE_REASON_USER_GESTURE); - EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents1_.get())); - EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents3_.get())); - EXPECT_FALSE(tab_manager->IsNavigationDelayedForTest(nav_handle3_.get())); + EXPECT_TRUE(tab_manager_->IsTabLoadingForTest(contents1_.get())); + EXPECT_TRUE(tab_manager_->IsTabLoadingForTest(contents3_.get())); + EXPECT_FALSE(tab_manager_->IsNavigationDelayedForTest(nav_handle3_.get())); // Simulate tab 1 has finished loading. TabManager will NOT load the next tab // (tab 2) because tab 3 is still loading. - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents2_.get())); - EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); - tab_manager->GetWebContentsData(contents1_.get())->NotifyTabIsLoaded(); - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents1_.get())); - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents2_.get())); - EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents2_.get())); + EXPECT_TRUE(tab_manager_->IsNavigationDelayedForTest(nav_handle2_.get())); + tab_manager_->GetWebContentsData(contents1_.get())->NotifyTabIsLoaded(); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents1_.get())); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents2_.get())); + EXPECT_TRUE(tab_manager_->IsNavigationDelayedForTest(nav_handle2_.get())); // Simulate tab 3 has finished loading. TabManager starts loading the next tab // (tab 2). - tab_manager->GetWebContentsData(contents3_.get())->NotifyTabIsLoaded(); - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents3_.get())); - EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents2_.get())); - EXPECT_FALSE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); + tab_manager_->GetWebContentsData(contents3_.get())->NotifyTabIsLoaded(); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents3_.get())); + EXPECT_TRUE(tab_manager_->IsTabLoadingForTest(contents2_.get())); + EXPECT_FALSE(tab_manager_->IsNavigationDelayedForTest(nav_handle2_.get())); } TEST_F(TabManagerTest, TimeoutWhenLoadingBackgroundTabs) { - TabManager* tab_manager = g_browser_process->GetTabManager(); - tab_manager->ResetMemoryPressureListenerForTest(); + tab_manager_->ResetMemoryPressureListenerForTest(); - MaybeThrottleNavigations(tab_manager); - tab_manager->GetWebContentsData(contents1_.get()) + MaybeThrottleNavigations(tab_manager_); + tab_manager_->GetWebContentsData(contents1_.get()) ->DidStartNavigation(nav_handle1_.get()); - EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents1_.get())); - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents2_.get())); - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents3_.get())); - EXPECT_FALSE(tab_manager->IsNavigationDelayedForTest(nav_handle1_.get())); - EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); - EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle3_.get())); + EXPECT_TRUE(tab_manager_->IsTabLoadingForTest(contents1_.get())); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents2_.get())); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents3_.get())); + EXPECT_FALSE(tab_manager_->IsNavigationDelayedForTest(nav_handle1_.get())); + EXPECT_TRUE(tab_manager_->IsNavigationDelayedForTest(nav_handle2_.get())); + EXPECT_TRUE(tab_manager_->IsNavigationDelayedForTest(nav_handle3_.get())); // Simulate timeout when loading the 1st tab. TabManager should start loading // the 2nd tab. task_runner_->FastForwardBy(base::TimeDelta::FromSeconds(10)); - EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents1_.get())); - EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents2_.get())); - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents3_.get())); - EXPECT_FALSE(tab_manager->IsNavigationDelayedForTest(nav_handle1_.get())); - EXPECT_FALSE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); - EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle3_.get())); + EXPECT_TRUE(tab_manager_->IsTabLoadingForTest(contents1_.get())); + EXPECT_TRUE(tab_manager_->IsTabLoadingForTest(contents2_.get())); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents3_.get())); + EXPECT_FALSE(tab_manager_->IsNavigationDelayedForTest(nav_handle1_.get())); + EXPECT_FALSE(tab_manager_->IsNavigationDelayedForTest(nav_handle2_.get())); + EXPECT_TRUE(tab_manager_->IsNavigationDelayedForTest(nav_handle3_.get())); // Simulate timeout again. TabManager should start loading the 3rd tab. task_runner_->FastForwardBy(base::TimeDelta::FromSeconds(10)); - EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents1_.get())); - EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents2_.get())); - EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents3_.get())); - EXPECT_FALSE(tab_manager->IsNavigationDelayedForTest(nav_handle1_.get())); - EXPECT_FALSE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); - EXPECT_FALSE(tab_manager->IsNavigationDelayedForTest(nav_handle3_.get())); + EXPECT_TRUE(tab_manager_->IsTabLoadingForTest(contents1_.get())); + EXPECT_TRUE(tab_manager_->IsTabLoadingForTest(contents2_.get())); + EXPECT_TRUE(tab_manager_->IsTabLoadingForTest(contents3_.get())); + EXPECT_FALSE(tab_manager_->IsNavigationDelayedForTest(nav_handle1_.get())); + EXPECT_FALSE(tab_manager_->IsNavigationDelayedForTest(nav_handle2_.get())); + EXPECT_FALSE(tab_manager_->IsNavigationDelayedForTest(nav_handle3_.get())); } TEST_F(TabManagerTest, BackgroundTabLoadingMode) { - TabManager* tab_manager = g_browser_process->GetTabManager(); - tab_manager->ResetMemoryPressureListenerForTest(); + tab_manager_->ResetMemoryPressureListenerForTest(); EXPECT_EQ(TabManager::BackgroundTabLoadingMode::kStaggered, - tab_manager->background_tab_loading_mode_); + tab_manager_->background_tab_loading_mode_); - MaybeThrottleNavigations(tab_manager); - tab_manager->GetWebContentsData(contents1_.get()) + MaybeThrottleNavigations(tab_manager_); + tab_manager_->GetWebContentsData(contents1_.get()) ->DidStartNavigation(nav_handle1_.get()); - EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents1_.get())); - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents2_.get())); - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents3_.get())); - EXPECT_FALSE(tab_manager->IsNavigationDelayedForTest(nav_handle1_.get())); - EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); - EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle3_.get())); + EXPECT_TRUE(tab_manager_->IsTabLoadingForTest(contents1_.get())); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents2_.get())); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents3_.get())); + EXPECT_FALSE(tab_manager_->IsNavigationDelayedForTest(nav_handle1_.get())); + EXPECT_TRUE(tab_manager_->IsNavigationDelayedForTest(nav_handle2_.get())); + EXPECT_TRUE(tab_manager_->IsNavigationDelayedForTest(nav_handle3_.get())); // TabManager pauses loading pending background tabs. - tab_manager->PauseBackgroundTabOpeningIfNeeded(); + tab_manager_->PauseBackgroundTabOpeningIfNeeded(); EXPECT_EQ(TabManager::BackgroundTabLoadingMode::kPaused, - tab_manager->background_tab_loading_mode_); + tab_manager_->background_tab_loading_mode_); // Simulate timeout when loading the 1st tab. task_runner_->FastForwardBy(base::TimeDelta::FromSeconds(10)); // Tab 2 and 3 are still pending because of the paused loading mode. - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents2_.get())); - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents3_.get())); - EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); - EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle3_.get())); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents2_.get())); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents3_.get())); + EXPECT_TRUE(tab_manager_->IsNavigationDelayedForTest(nav_handle2_.get())); + EXPECT_TRUE(tab_manager_->IsNavigationDelayedForTest(nav_handle3_.get())); // Simulate tab 1 has finished loading. - tab_manager->GetWebContentsData(contents1_.get())->NotifyTabIsLoaded(); + tab_manager_->GetWebContentsData(contents1_.get())->NotifyTabIsLoaded(); // Tab 2 and 3 are still pending because of the paused loading mode. - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents2_.get())); - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents3_.get())); - EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); - EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle3_.get())); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents2_.get())); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents3_.get())); + EXPECT_TRUE(tab_manager_->IsNavigationDelayedForTest(nav_handle2_.get())); + EXPECT_TRUE(tab_manager_->IsNavigationDelayedForTest(nav_handle3_.get())); // TabManager resumes loading pending background tabs. - tab_manager->ResumeBackgroundTabOpeningIfNeeded(); + tab_manager_->ResumeBackgroundTabOpeningIfNeeded(); EXPECT_EQ(TabManager::BackgroundTabLoadingMode::kStaggered, - tab_manager->background_tab_loading_mode_); + tab_manager_->background_tab_loading_mode_); // Tab 2 should start loading right away. - EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents2_.get())); - EXPECT_FALSE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); + EXPECT_TRUE(tab_manager_->IsTabLoadingForTest(contents2_.get())); + EXPECT_FALSE(tab_manager_->IsNavigationDelayedForTest(nav_handle2_.get())); // Simulate tab 2 has finished loading. - tab_manager->GetWebContentsData(contents2_.get())->NotifyTabIsLoaded(); + tab_manager_->GetWebContentsData(contents2_.get())->NotifyTabIsLoaded(); // Tab 3 should start loading now in staggered loading mode. - EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents3_.get())); - EXPECT_FALSE(tab_manager->IsNavigationDelayedForTest(nav_handle3_.get())); + EXPECT_TRUE(tab_manager_->IsTabLoadingForTest(contents3_.get())); + EXPECT_FALSE(tab_manager_->IsNavigationDelayedForTest(nav_handle3_.get())); } TEST_F(TabManagerTest, BackgroundTabLoadingSlots) { @@ -965,294 +955,286 @@ } TEST_F(TabManagerTest, BackgroundTabsLoadingOrdering) { - TabManager* tab_manager = g_browser_process->GetTabManager(); - tab_manager->ResetMemoryPressureListenerForTest(); + tab_manager_->ResetMemoryPressureListenerForTest(); MaybeThrottleNavigations( - tab_manager, 1, kTestUrl, + tab_manager_, 1, kTestUrl, chrome::kChromeUISettingsURL, // Using internal page URL for tab 2. kTestUrl); - tab_manager->GetWebContentsData(contents1_.get()) + tab_manager_->GetWebContentsData(contents1_.get()) ->DidStartNavigation(nav_handle1_.get()); - EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents1_.get())); - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents2_.get())); - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents3_.get())); - EXPECT_FALSE(tab_manager->IsNavigationDelayedForTest(nav_handle1_.get())); - EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); - EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle3_.get())); + EXPECT_TRUE(tab_manager_->IsTabLoadingForTest(contents1_.get())); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents2_.get())); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents3_.get())); + EXPECT_FALSE(tab_manager_->IsNavigationDelayedForTest(nav_handle1_.get())); + EXPECT_TRUE(tab_manager_->IsNavigationDelayedForTest(nav_handle2_.get())); + EXPECT_TRUE(tab_manager_->IsNavigationDelayedForTest(nav_handle3_.get())); // Simulate tab 1 has finished loading. Tab 3 should be loaded before tab 2, // because tab 2 is internal page. - tab_manager->GetWebContentsData(contents1_.get())->NotifyTabIsLoaded(); + tab_manager_->GetWebContentsData(contents1_.get())->NotifyTabIsLoaded(); - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents2_.get())); - EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents3_.get())); - EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); - EXPECT_FALSE(tab_manager->IsNavigationDelayedForTest(nav_handle3_.get())); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents2_.get())); + EXPECT_TRUE(tab_manager_->IsTabLoadingForTest(contents3_.get())); + EXPECT_TRUE(tab_manager_->IsNavigationDelayedForTest(nav_handle2_.get())); + EXPECT_FALSE(tab_manager_->IsNavigationDelayedForTest(nav_handle3_.get())); } TEST_F(TabManagerTest, PauseAndResumeBackgroundTabOpening) { - TabManager* tab_manager = g_browser_process->GetTabManager(); - tab_manager->ResetMemoryPressureListenerForTest(); + tab_manager_->ResetMemoryPressureListenerForTest(); PrepareTabs(); EXPECT_EQ(TabManager::BackgroundTabLoadingMode::kStaggered, - tab_manager->background_tab_loading_mode_); - EXPECT_FALSE(tab_manager->IsInBackgroundTabOpeningSession()); + tab_manager_->background_tab_loading_mode_); + EXPECT_FALSE(tab_manager_->IsInBackgroundTabOpeningSession()); EXPECT_FALSE( - tab_manager->stats_collector()->is_in_background_tab_opening_session()); + tab_manager_->stats_collector()->is_in_background_tab_opening_session()); // Start background tab opening session. EXPECT_EQ(content::NavigationThrottle::PROCEED, - tab_manager->MaybeThrottleNavigation(throttle1_.get())); - tab_manager->GetWebContentsData(contents1_.get()) + tab_manager_->MaybeThrottleNavigation(throttle1_.get())); + tab_manager_->GetWebContentsData(contents1_.get()) ->DidStartNavigation(nav_handle1_.get()); - EXPECT_TRUE(tab_manager->IsInBackgroundTabOpeningSession()); + EXPECT_TRUE(tab_manager_->IsInBackgroundTabOpeningSession()); EXPECT_TRUE( - tab_manager->stats_collector()->is_in_background_tab_opening_session()); + tab_manager_->stats_collector()->is_in_background_tab_opening_session()); // TabManager pauses loading pending background tabs. - tab_manager->PauseBackgroundTabOpeningIfNeeded(); + tab_manager_->PauseBackgroundTabOpeningIfNeeded(); EXPECT_EQ(TabManager::BackgroundTabLoadingMode::kPaused, - tab_manager->background_tab_loading_mode_); - EXPECT_FALSE(tab_manager->IsInBackgroundTabOpeningSession()); + tab_manager_->background_tab_loading_mode_); + EXPECT_FALSE(tab_manager_->IsInBackgroundTabOpeningSession()); EXPECT_FALSE( - tab_manager->stats_collector()->is_in_background_tab_opening_session()); + tab_manager_->stats_collector()->is_in_background_tab_opening_session()); // Simulate tab 1 has finished loading, which was scheduled to load before // pausing. - tab_manager->GetWebContentsData(contents1_.get())->NotifyTabIsLoaded(); + tab_manager_->GetWebContentsData(contents1_.get())->NotifyTabIsLoaded(); // TabManager cannot enter BackgroundTabOpening session when it is in paused // mode. EXPECT_EQ(content::NavigationThrottle::DEFER, - tab_manager->MaybeThrottleNavigation(throttle2_.get())); - EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); - EXPECT_FALSE(tab_manager->IsInBackgroundTabOpeningSession()); + tab_manager_->MaybeThrottleNavigation(throttle2_.get())); + EXPECT_TRUE(tab_manager_->IsNavigationDelayedForTest(nav_handle2_.get())); + EXPECT_FALSE(tab_manager_->IsInBackgroundTabOpeningSession()); EXPECT_FALSE( - tab_manager->stats_collector()->is_in_background_tab_opening_session()); + tab_manager_->stats_collector()->is_in_background_tab_opening_session()); // TabManager resumes loading pending background tabs. - tab_manager->ResumeBackgroundTabOpeningIfNeeded(); + tab_manager_->ResumeBackgroundTabOpeningIfNeeded(); EXPECT_EQ(TabManager::BackgroundTabLoadingMode::kStaggered, - tab_manager->background_tab_loading_mode_); - EXPECT_TRUE(tab_manager->IsInBackgroundTabOpeningSession()); + tab_manager_->background_tab_loading_mode_); + EXPECT_TRUE(tab_manager_->IsInBackgroundTabOpeningSession()); EXPECT_TRUE( - tab_manager->stats_collector()->is_in_background_tab_opening_session()); + tab_manager_->stats_collector()->is_in_background_tab_opening_session()); // Tab 2 should start loading right away. - EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents2_.get())); - EXPECT_FALSE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); + EXPECT_TRUE(tab_manager_->IsTabLoadingForTest(contents2_.get())); + EXPECT_FALSE(tab_manager_->IsNavigationDelayedForTest(nav_handle2_.get())); } TEST_F(TabManagerTest, IsInBackgroundTabOpeningSession) { - TabManager* tab_manager = g_browser_process->GetTabManager(); - tab_manager->ResetMemoryPressureListenerForTest(); - EXPECT_FALSE(tab_manager->IsInBackgroundTabOpeningSession()); + tab_manager_->ResetMemoryPressureListenerForTest(); + EXPECT_FALSE(tab_manager_->IsInBackgroundTabOpeningSession()); EXPECT_FALSE( - tab_manager->stats_collector()->is_in_background_tab_opening_session()); + tab_manager_->stats_collector()->is_in_background_tab_opening_session()); - MaybeThrottleNavigations(tab_manager); - tab_manager->GetWebContentsData(contents1_.get()) + MaybeThrottleNavigations(tab_manager_); + tab_manager_->GetWebContentsData(contents1_.get()) ->DidStartNavigation(nav_handle1_.get()); - EXPECT_TRUE(tab_manager->IsInBackgroundTabOpeningSession()); + EXPECT_TRUE(tab_manager_->IsInBackgroundTabOpeningSession()); EXPECT_TRUE( - tab_manager->stats_collector()->is_in_background_tab_opening_session()); + tab_manager_->stats_collector()->is_in_background_tab_opening_session()); - tab_manager->GetWebContentsData(contents1_.get())->NotifyTabIsLoaded(); - EXPECT_TRUE(tab_manager->IsInBackgroundTabOpeningSession()); + tab_manager_->GetWebContentsData(contents1_.get())->NotifyTabIsLoaded(); + EXPECT_TRUE(tab_manager_->IsInBackgroundTabOpeningSession()); EXPECT_TRUE( - tab_manager->stats_collector()->is_in_background_tab_opening_session()); + tab_manager_->stats_collector()->is_in_background_tab_opening_session()); - tab_manager->GetWebContentsData(contents2_.get())->NotifyTabIsLoaded(); - EXPECT_TRUE(tab_manager->IsInBackgroundTabOpeningSession()); + tab_manager_->GetWebContentsData(contents2_.get())->NotifyTabIsLoaded(); + EXPECT_TRUE(tab_manager_->IsInBackgroundTabOpeningSession()); EXPECT_TRUE( - tab_manager->stats_collector()->is_in_background_tab_opening_session()); + tab_manager_->stats_collector()->is_in_background_tab_opening_session()); // It is still in background tab opening session even if tab3 is brought to // foreground. The session only ends after tab1, tab2 and tab3 have all // finished loading. contents3_->WasShown(); - EXPECT_TRUE(tab_manager->IsInBackgroundTabOpeningSession()); + EXPECT_TRUE(tab_manager_->IsInBackgroundTabOpeningSession()); EXPECT_TRUE( - tab_manager->stats_collector()->is_in_background_tab_opening_session()); + tab_manager_->stats_collector()->is_in_background_tab_opening_session()); - tab_manager->GetWebContentsData(contents3_.get())->NotifyTabIsLoaded(); - EXPECT_FALSE(tab_manager->IsInBackgroundTabOpeningSession()); + tab_manager_->GetWebContentsData(contents3_.get())->NotifyTabIsLoaded(); + EXPECT_FALSE(tab_manager_->IsInBackgroundTabOpeningSession()); EXPECT_FALSE( - tab_manager->stats_collector()->is_in_background_tab_opening_session()); + tab_manager_->stats_collector()->is_in_background_tab_opening_session()); } TEST_F(TabManagerWithExperimentDisabledTest, IsInBackgroundTabOpeningSession) { EXPECT_FALSE(base::FeatureList::IsEnabled( features::kStaggeredBackgroundTabOpeningExperiment)); - TabManager* tab_manager = g_browser_process->GetTabManager(); - tab_manager->ResetMemoryPressureListenerForTest(); - EXPECT_FALSE(tab_manager->IsInBackgroundTabOpeningSession()); + tab_manager_->ResetMemoryPressureListenerForTest(); + EXPECT_FALSE(tab_manager_->IsInBackgroundTabOpeningSession()); EXPECT_FALSE( - tab_manager->stats_collector()->is_in_background_tab_opening_session()); + tab_manager_->stats_collector()->is_in_background_tab_opening_session()); - MaybeThrottleNavigations(tab_manager); - tab_manager->GetWebContentsData(contents1_.get()) + MaybeThrottleNavigations(tab_manager_); + tab_manager_->GetWebContentsData(contents1_.get()) ->DidStartNavigation(nav_handle1_.get()); - tab_manager->GetWebContentsData(contents2_.get()) + tab_manager_->GetWebContentsData(contents2_.get()) ->DidStartNavigation(nav_handle1_.get()); - tab_manager->GetWebContentsData(contents3_.get()) + tab_manager_->GetWebContentsData(contents3_.get()) ->DidStartNavigation(nav_handle1_.get()); - EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents1_.get())); - EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents2_.get())); - EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents3_.get())); - EXPECT_FALSE(tab_manager->IsNavigationDelayedForTest(nav_handle1_.get())); - EXPECT_FALSE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); - EXPECT_FALSE(tab_manager->IsNavigationDelayedForTest(nav_handle3_.get())); - EXPECT_TRUE(tab_manager->IsInBackgroundTabOpeningSession()); + EXPECT_TRUE(tab_manager_->IsTabLoadingForTest(contents1_.get())); + EXPECT_TRUE(tab_manager_->IsTabLoadingForTest(contents2_.get())); + EXPECT_TRUE(tab_manager_->IsTabLoadingForTest(contents3_.get())); + EXPECT_FALSE(tab_manager_->IsNavigationDelayedForTest(nav_handle1_.get())); + EXPECT_FALSE(tab_manager_->IsNavigationDelayedForTest(nav_handle2_.get())); + EXPECT_FALSE(tab_manager_->IsNavigationDelayedForTest(nav_handle3_.get())); + EXPECT_TRUE(tab_manager_->IsInBackgroundTabOpeningSession()); EXPECT_TRUE( - tab_manager->stats_collector()->is_in_background_tab_opening_session()); + tab_manager_->stats_collector()->is_in_background_tab_opening_session()); - tab_manager->GetWebContentsData(contents1_.get())->NotifyTabIsLoaded(); - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents1_.get())); - EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents2_.get())); - EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents3_.get())); - EXPECT_TRUE(tab_manager->IsInBackgroundTabOpeningSession()); + tab_manager_->GetWebContentsData(contents1_.get())->NotifyTabIsLoaded(); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents1_.get())); + EXPECT_TRUE(tab_manager_->IsTabLoadingForTest(contents2_.get())); + EXPECT_TRUE(tab_manager_->IsTabLoadingForTest(contents3_.get())); + EXPECT_TRUE(tab_manager_->IsInBackgroundTabOpeningSession()); EXPECT_TRUE( - tab_manager->stats_collector()->is_in_background_tab_opening_session()); + tab_manager_->stats_collector()->is_in_background_tab_opening_session()); - tab_manager->GetWebContentsData(contents2_.get())->NotifyTabIsLoaded(); - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents1_.get())); - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents2_.get())); - EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents3_.get())); - EXPECT_TRUE(tab_manager->IsInBackgroundTabOpeningSession()); + tab_manager_->GetWebContentsData(contents2_.get())->NotifyTabIsLoaded(); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents1_.get())); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents2_.get())); + EXPECT_TRUE(tab_manager_->IsTabLoadingForTest(contents3_.get())); + EXPECT_TRUE(tab_manager_->IsInBackgroundTabOpeningSession()); EXPECT_TRUE( - tab_manager->stats_collector()->is_in_background_tab_opening_session()); + tab_manager_->stats_collector()->is_in_background_tab_opening_session()); // It is still in background tab opening session even if tab3 is brought to // foreground. The session only ends after tab1, tab2 and tab3 have all // finished loading. contents3_->WasShown(); - EXPECT_TRUE(tab_manager->IsInBackgroundTabOpeningSession()); + EXPECT_TRUE(tab_manager_->IsInBackgroundTabOpeningSession()); EXPECT_TRUE( - tab_manager->stats_collector()->is_in_background_tab_opening_session()); + tab_manager_->stats_collector()->is_in_background_tab_opening_session()); - tab_manager->GetWebContentsData(contents3_.get())->NotifyTabIsLoaded(); - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents1_.get())); - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents2_.get())); - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents3_.get())); - EXPECT_FALSE(tab_manager->IsInBackgroundTabOpeningSession()); + tab_manager_->GetWebContentsData(contents3_.get())->NotifyTabIsLoaded(); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents1_.get())); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents2_.get())); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents3_.get())); + EXPECT_FALSE(tab_manager_->IsInBackgroundTabOpeningSession()); EXPECT_FALSE( - tab_manager->stats_collector()->is_in_background_tab_opening_session()); + tab_manager_->stats_collector()->is_in_background_tab_opening_session()); } TEST_F(TabManagerTest, SessionRestoreBeforeBackgroundTabOpeningSession) { - TabManager* tab_manager = g_browser_process->GetTabManager(); - tab_manager->ResetMemoryPressureListenerForTest(); + tab_manager_->ResetMemoryPressureListenerForTest(); PrepareTabs(); // Start session restore. - tab_manager->OnSessionRestoreStartedLoadingTabs(); - EXPECT_TRUE(tab_manager->IsSessionRestoreLoadingTabs()); - EXPECT_FALSE(tab_manager->IsInBackgroundTabOpeningSession()); + tab_manager_->OnSessionRestoreStartedLoadingTabs(); + EXPECT_TRUE(tab_manager_->IsSessionRestoreLoadingTabs()); + EXPECT_FALSE(tab_manager_->IsInBackgroundTabOpeningSession()); EXPECT_FALSE( - tab_manager->stats_collector()->is_in_background_tab_opening_session()); + tab_manager_->stats_collector()->is_in_background_tab_opening_session()); - tab_manager->GetWebContentsData(contents1_.get()) + tab_manager_->GetWebContentsData(contents1_.get()) ->SetIsInSessionRestore(true); - tab_manager->GetWebContentsData(contents2_.get()) + tab_manager_->GetWebContentsData(contents2_.get()) ->SetIsInSessionRestore(false); - tab_manager->GetWebContentsData(contents3_.get()) + tab_manager_->GetWebContentsData(contents3_.get()) ->SetIsInSessionRestore(false); // Do not enter BackgroundTabOpening session if the background tab is in // session restore. EXPECT_EQ(content::NavigationThrottle::PROCEED, - tab_manager->MaybeThrottleNavigation(throttle1_.get())); - EXPECT_FALSE(tab_manager->IsInBackgroundTabOpeningSession()); + tab_manager_->MaybeThrottleNavigation(throttle1_.get())); + EXPECT_FALSE(tab_manager_->IsInBackgroundTabOpeningSession()); EXPECT_FALSE( - tab_manager->stats_collector()->is_in_background_tab_opening_session()); + tab_manager_->stats_collector()->is_in_background_tab_opening_session()); // Enter BackgroundTabOpening session when there are background tabs not in // session restore, though the first background tab can still proceed. EXPECT_EQ(content::NavigationThrottle::PROCEED, - tab_manager->MaybeThrottleNavigation(throttle2_.get())); - EXPECT_TRUE(tab_manager->IsInBackgroundTabOpeningSession()); + tab_manager_->MaybeThrottleNavigation(throttle2_.get())); + EXPECT_TRUE(tab_manager_->IsInBackgroundTabOpeningSession()); EXPECT_TRUE( - tab_manager->stats_collector()->is_in_background_tab_opening_session()); + tab_manager_->stats_collector()->is_in_background_tab_opening_session()); EXPECT_EQ(content::NavigationThrottle::DEFER, - tab_manager->MaybeThrottleNavigation(throttle3_.get())); - EXPECT_TRUE(tab_manager->IsInBackgroundTabOpeningSession()); + tab_manager_->MaybeThrottleNavigation(throttle3_.get())); + EXPECT_TRUE(tab_manager_->IsInBackgroundTabOpeningSession()); EXPECT_TRUE( - tab_manager->stats_collector()->is_in_background_tab_opening_session()); + tab_manager_->stats_collector()->is_in_background_tab_opening_session()); // Stop session restore. - tab_manager->OnSessionRestoreFinishedLoadingTabs(); - EXPECT_FALSE(tab_manager->IsSessionRestoreLoadingTabs()); - EXPECT_TRUE(tab_manager->IsInBackgroundTabOpeningSession()); + tab_manager_->OnSessionRestoreFinishedLoadingTabs(); + EXPECT_FALSE(tab_manager_->IsSessionRestoreLoadingTabs()); + EXPECT_TRUE(tab_manager_->IsInBackgroundTabOpeningSession()); EXPECT_TRUE( - tab_manager->stats_collector()->is_in_background_tab_opening_session()); + tab_manager_->stats_collector()->is_in_background_tab_opening_session()); } TEST_F(TabManagerTest, SessionRestoreAfterBackgroundTabOpeningSession) { - TabManager* tab_manager = g_browser_process->GetTabManager(); - tab_manager->ResetMemoryPressureListenerForTest(); + tab_manager_->ResetMemoryPressureListenerForTest(); PrepareTabs(); - EXPECT_FALSE(tab_manager->IsSessionRestoreLoadingTabs()); - EXPECT_FALSE(tab_manager->IsInBackgroundTabOpeningSession()); + EXPECT_FALSE(tab_manager_->IsSessionRestoreLoadingTabs()); + EXPECT_FALSE(tab_manager_->IsInBackgroundTabOpeningSession()); EXPECT_FALSE( - tab_manager->stats_collector()->is_in_background_tab_opening_session()); + tab_manager_->stats_collector()->is_in_background_tab_opening_session()); // Start background tab opening session. EXPECT_EQ(content::NavigationThrottle::PROCEED, - tab_manager->MaybeThrottleNavigation(throttle1_.get())); - EXPECT_TRUE(tab_manager->IsInBackgroundTabOpeningSession()); + tab_manager_->MaybeThrottleNavigation(throttle1_.get())); + EXPECT_TRUE(tab_manager_->IsInBackgroundTabOpeningSession()); EXPECT_TRUE( - tab_manager->stats_collector()->is_in_background_tab_opening_session()); + tab_manager_->stats_collector()->is_in_background_tab_opening_session()); EXPECT_EQ(content::NavigationThrottle::DEFER, - tab_manager->MaybeThrottleNavigation(throttle2_.get())); - EXPECT_TRUE(tab_manager->IsInBackgroundTabOpeningSession()); + tab_manager_->MaybeThrottleNavigation(throttle2_.get())); + EXPECT_TRUE(tab_manager_->IsInBackgroundTabOpeningSession()); EXPECT_TRUE( - tab_manager->stats_collector()->is_in_background_tab_opening_session()); + tab_manager_->stats_collector()->is_in_background_tab_opening_session()); // Now session restore starts after background tab opening session starts. - tab_manager->OnSessionRestoreStartedLoadingTabs(); - EXPECT_TRUE(tab_manager->IsSessionRestoreLoadingTabs()); - EXPECT_TRUE(tab_manager->IsInBackgroundTabOpeningSession()); + tab_manager_->OnSessionRestoreStartedLoadingTabs(); + EXPECT_TRUE(tab_manager_->IsSessionRestoreLoadingTabs()); + EXPECT_TRUE(tab_manager_->IsInBackgroundTabOpeningSession()); EXPECT_TRUE( - tab_manager->stats_collector()->is_in_background_tab_opening_session()); + tab_manager_->stats_collector()->is_in_background_tab_opening_session()); // The following background tabs are still delayed if they are not in session // restore. - tab_manager->GetWebContentsData(contents3_.get()) + tab_manager_->GetWebContentsData(contents3_.get()) ->SetIsInSessionRestore(false); EXPECT_EQ(content::NavigationThrottle::DEFER, - tab_manager->MaybeThrottleNavigation(throttle3_.get())); + tab_manager_->MaybeThrottleNavigation(throttle3_.get())); // The background tab opening session ends after existing tracked tabs have // finished loading. - tab_manager->GetWebContentsData(contents1_.get())->NotifyTabIsLoaded(); - tab_manager->GetWebContentsData(contents2_.get())->NotifyTabIsLoaded(); - tab_manager->GetWebContentsData(contents3_.get())->NotifyTabIsLoaded(); - EXPECT_FALSE(tab_manager->IsInBackgroundTabOpeningSession()); + tab_manager_->GetWebContentsData(contents1_.get())->NotifyTabIsLoaded(); + tab_manager_->GetWebContentsData(contents2_.get())->NotifyTabIsLoaded(); + tab_manager_->GetWebContentsData(contents3_.get())->NotifyTabIsLoaded(); + EXPECT_FALSE(tab_manager_->IsInBackgroundTabOpeningSession()); EXPECT_FALSE( - tab_manager->stats_collector()->is_in_background_tab_opening_session()); + tab_manager_->stats_collector()->is_in_background_tab_opening_session()); } TEST_F(TabManagerTest, IsTabRestoredInForeground) { - TabManager* tab_manager = g_browser_process->GetTabManager(); - std::unique_ptr<WebContents> contents(CreateWebContents()); contents->WasShown(); - tab_manager->OnWillRestoreTab(contents.get()); - EXPECT_TRUE(tab_manager->IsTabRestoredInForeground(contents.get())); + tab_manager_->OnWillRestoreTab(contents.get()); + EXPECT_TRUE(tab_manager_->IsTabRestoredInForeground(contents.get())); contents.reset(CreateWebContents()); contents->WasHidden(); - tab_manager->OnWillRestoreTab(contents.get()); - EXPECT_FALSE(tab_manager->IsTabRestoredInForeground(contents.get())); + tab_manager_->OnWillRestoreTab(contents.get()); + EXPECT_FALSE(tab_manager_->IsTabRestoredInForeground(contents.get())); } TEST_F(TabManagerTest, EnablePageAlmostIdleSignal) { @@ -1260,68 +1242,67 @@ scoped_feature_list.InitAndEnableFeature(features::kPageAlmostIdle); EXPECT_TRUE(base::FeatureList::IsEnabled(features::kPageAlmostIdle)); - TabManager* tab_manager = g_browser_process->GetTabManager(); - tab_manager->resource_coordinator_signal_observer_.reset( + tab_manager_->resource_coordinator_signal_observer_.reset( new TabManager::ResourceCoordinatorSignalObserver()); - tab_manager->ResetMemoryPressureListenerForTest(); + tab_manager_->ResetMemoryPressureListenerForTest(); EXPECT_EQ(TabManager::BackgroundTabLoadingMode::kStaggered, - tab_manager->background_tab_loading_mode_); + tab_manager_->background_tab_loading_mode_); - MaybeThrottleNavigations(tab_manager); - tab_manager->GetWebContentsData(contents1_.get()) + MaybeThrottleNavigations(tab_manager_); + tab_manager_->GetWebContentsData(contents1_.get()) ->DidStartNavigation(nav_handle1_.get()); - EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents1_.get())); - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents2_.get())); - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents3_.get())); - EXPECT_FALSE(tab_manager->IsNavigationDelayedForTest(nav_handle1_.get())); - EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); - EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle3_.get())); + EXPECT_TRUE(tab_manager_->IsTabLoadingForTest(contents1_.get())); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents2_.get())); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents3_.get())); + EXPECT_FALSE(tab_manager_->IsNavigationDelayedForTest(nav_handle1_.get())); + EXPECT_TRUE(tab_manager_->IsNavigationDelayedForTest(nav_handle2_.get())); + EXPECT_TRUE(tab_manager_->IsNavigationDelayedForTest(nav_handle3_.get())); // Simulate tab 1 has finished loading through WebContentsObserver API. // Since the page idle signal feature is enabled, this shouldn't start // next loading. - tab_manager->GetWebContentsData(contents1_.get())->DidStopLoading(); + tab_manager_->GetWebContentsData(contents1_.get())->DidStopLoading(); // Tab 2 and Tab 3 are still pending because the DidStopLoading signal from // WebContentsObserver is disabled when PageAlmostIdle signal is enabled. - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents2_.get())); - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents3_.get())); - EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); - EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle3_.get())); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents2_.get())); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents3_.get())); + EXPECT_TRUE(tab_manager_->IsNavigationDelayedForTest(nav_handle2_.get())); + EXPECT_TRUE(tab_manager_->IsNavigationDelayedForTest(nav_handle3_.get())); // Simulate tab 1 has finished loading by receiving idle signal from resource // coordinator. Since the page idle signal feature is enabled, this should // start next loading. - tab_manager->resource_coordinator_signal_observer_->OnPageAlmostIdle( + tab_manager_->resource_coordinator_signal_observer_->OnPageAlmostIdle( contents1_.get()); // Tab 2 should start loading right away. - EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents2_.get())); - EXPECT_FALSE(tab_manager->IsNavigationDelayedForTest(nav_handle2_.get())); + EXPECT_TRUE(tab_manager_->IsTabLoadingForTest(contents2_.get())); + EXPECT_FALSE(tab_manager_->IsNavigationDelayedForTest(nav_handle2_.get())); // Tab 3 is still pending. - EXPECT_FALSE(tab_manager->IsTabLoadingForTest(contents3_.get())); - EXPECT_TRUE(tab_manager->IsNavigationDelayedForTest(nav_handle3_.get())); + EXPECT_FALSE(tab_manager_->IsTabLoadingForTest(contents3_.get())); + EXPECT_TRUE(tab_manager_->IsNavigationDelayedForTest(nav_handle3_.get())); // Simulate tab 2 has finished loading by receiving idle signal from resource // coordinator. - tab_manager->resource_coordinator_signal_observer_->OnPageAlmostIdle( + tab_manager_->resource_coordinator_signal_observer_->OnPageAlmostIdle( contents2_.get()); // Tab 3 should start loading now in staggered loading mode. - EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents3_.get())); - EXPECT_FALSE(tab_manager->IsNavigationDelayedForTest(nav_handle3_.get())); + EXPECT_TRUE(tab_manager_->IsTabLoadingForTest(contents3_.get())); + EXPECT_FALSE(tab_manager_->IsNavigationDelayedForTest(nav_handle3_.get())); // |ignored_web_contents| is not managed by TabManager, thus will be ignored // and shouldn't cause any crash or side effect. WebContents* ignored_web_contents = WebContentsTester::CreateTestWebContents(browser_context(), nullptr); - tab_manager->resource_coordinator_signal_observer_->OnPageAlmostIdle( + tab_manager_->resource_coordinator_signal_observer_->OnPageAlmostIdle( ignored_web_contents); - EXPECT_TRUE(tab_manager->IsTabLoadingForTest(contents3_.get())); - EXPECT_FALSE(tab_manager->IsNavigationDelayedForTest(nav_handle3_.get())); + EXPECT_TRUE(tab_manager_->IsTabLoadingForTest(contents3_.get())); + EXPECT_FALSE(tab_manager_->IsNavigationDelayedForTest(nav_handle3_.get())); } } // namespace resource_coordinator
diff --git a/chrome/browser/resources/chromeos/login/oobe_welcome.js b/chrome/browser/resources/chromeos/login/oobe_welcome.js index 867a4e4..8263678c 100644 --- a/chrome/browser/resources/chromeos/login/oobe_welcome.js +++ b/chrome/browser/resources/chromeos/login/oobe_welcome.js
@@ -326,7 +326,7 @@ */ onDefaultNetworkChanged_: function(event) { var state = event.detail; - this.defaultNetworkGuid_ = state.GUID; + this.defaultNetworkGuid_ = (state ? state.GUID : ''); this.isConnected_ = !!state && state.ConnectionState == CrOnc.ConnectionState.CONNECTED; if (!state || state.GUID != this.networkLastSelectedGuid_) @@ -346,6 +346,7 @@ */ onNetworkListNetworkItemSelected_: function(event) { var state = event.detail; + assert(state); // If the user has not previously made a selection and the default network // is selected and connected, continue to the next screen. if (this.networkLastSelectedGuid_ == '' && @@ -359,7 +360,10 @@ // is pending connection attempt. So even if new selection is currently // connected, it may get disconnected at any time. // So just send one more connection request to cancel current attempts. - this.networkLastSelectedGuid_ = state.GUID; + this.networkLastSelectedGuid_ = (state ? state.GUID : ''); + + if (!state) + return; var self = this; var networkStateCopy = Object.assign({}, state);
diff --git a/chrome/browser/resources/chromeos/network_ui/network_ui.js b/chrome/browser/resources/chromeos/network_ui/network_ui.js index 1875b60..6a2d731 100644 --- a/chrome/browser/resources/chromeos/network_ui/network_ui.js +++ b/chrome/browser/resources/chromeos/network_ui/network_ui.js
@@ -268,6 +268,7 @@ * @return {!HTMLTableRowElement} The created tr element for the expanded row. */ var createExpandedRow = function(state, baseRow) { + assert(state); var guid = state.GUID || ''; var expandedRow = createTableRowElement(); expandedRow.className = 'state-table-row';
diff --git a/chrome/browser/resources/extensions/extensions.js b/chrome/browser/resources/extensions/extensions.js index d46ea50a..663f8382b 100644 --- a/chrome/browser/resources/extensions/extensions.js +++ b/chrome/browser/resources/extensions/extensions.js
@@ -108,7 +108,7 @@ var dragTarget = document.documentElement; /** @private {extensions.DragAndDropHandler} */ this.dragWrapperHandler_ = - new extensions.DragAndDropHandler(true, dragTarget); + new extensions.DragAndDropHandler(true, false, dragTarget); dragTarget.addEventListener('extension-drag-started', function() { ExtensionSettings.showOverlay($('drop-target-overlay')); });
diff --git a/chrome/browser/resources/local_ntp/local_ntp.js b/chrome/browser/resources/local_ntp/local_ntp.js index 55b4513b..985543b 100644 --- a/chrome/browser/resources/local_ntp/local_ntp.js +++ b/chrome/browser/resources/local_ntp/local_ntp.js
@@ -656,6 +656,12 @@ // Update the fakebox style to match the current key capturing state. setFakeboxFocus(searchboxApiHandle.isKeyCaptureEnabled); + // Also tell the browser that we're capturing, otherwise it's possible that + // both fakebox and Omnibox have visible focus at the same time, see + // crbug.com/792850. + if (searchboxApiHandle.isKeyCaptureEnabled) { + searchboxApiHandle.startCapturingKeyStrokes(); + } // Load the Doodle. After the first request completes (getting cached // data), issue a second request for fresh Doodle data.
diff --git a/chrome/browser/resources/md_extensions/compiled_resources2.gyp b/chrome/browser/resources/md_extensions/compiled_resources2.gyp index 19d7921..8c5dffac 100644 --- a/chrome/browser/resources/md_extensions/compiled_resources2.gyp +++ b/chrome/browser/resources/md_extensions/compiled_resources2.gyp
@@ -32,6 +32,7 @@ '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:assert', '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:cr', '<(DEPTH)/ui/webui/resources/js/cr/ui/compiled_resources2.gyp:drag_wrapper', + '<(EXTERNS_GYP):developer_private', ], 'includes': ['../../../../third_party/closure_compiler/compile_js2.gypi'], },
diff --git a/chrome/browser/resources/md_extensions/detail_view.html b/chrome/browser/resources/md_extensions/detail_view.html index 1820013..ab06307 100644 --- a/chrome/browser/resources/md_extensions/detail_view.html +++ b/chrome/browser/resources/md_extensions/detail_view.html
@@ -163,7 +163,7 @@ margin: 0; } - #remove-extension { + button[is='cr-link-row'] { width: 100%; } @@ -364,6 +364,14 @@ <button class="icon-external" is="paper-icon-button-light" aria-labelledby="optionLabel" actionable></button> </div> + <button class="hr" hidden="[[!data.manifestHomePageUrl.length]]" + is="cr-link-row" icon-class="icon-external" id="developerWebsite" + label="$i18n{developerWebsite}" on-tap="onDeveloperWebSiteTap_"> + </button> + <button class="hr" hidden="[[!data.webStoreUrl.length]]" + is="cr-link-row" icon-class="icon-external" id="viewInStore" + label="$i18n{viewInStore}" on-tap="onViewInStoreTap_"> + </button> <div class="section block"> <div class="section-title">$i18n{itemSource}</div> <div id="source" class="section-content">
diff --git a/chrome/browser/resources/md_extensions/detail_view.js b/chrome/browser/resources/md_extensions/detail_view.js index 7ffeff8..96b31bd 100644 --- a/chrome/browser/resources/md_extensions/detail_view.js +++ b/chrome/browser/resources/md_extensions/detail_view.js
@@ -117,18 +117,6 @@ * @return {boolean} * @private */ - shouldShowHomepageButton_: function() { - // Note: we ignore |data.homePage.specified| - we use an extension's - // webstore entry as a homepage if the extension didn't explicitly specify - // a homepage. (|url| can still be unset in the case of unpacked - // extensions.) - return this.data.homePage.url.length > 0; - }, - - /** - * @return {boolean} - * @private - */ shouldShowOptionsLink_: function() { return !!this.data.optionsPage; }, @@ -202,19 +190,28 @@ }, /** @private */ - onIconClick_: function(e) { - e.preventDefault(); + onDeveloperWebSiteTap_: function() { + this.delegate.openUrl(this.data.manifestHomePageUrl); + }, + + /** @private */ + onViewInStoreTap_: function() { + this.delegate.openUrl(this.data.webStoreUrl); }, /** * @param {!chrome.developerPrivate.DependentExtension} item + * @return {string} * @private */ computeDependentEntry_: function(item) { return loadTimeData.getStringF('itemDependentEntry', item.name, item.id); }, - /** @private */ + /** + * @return {string} + * @private + */ computeSourceString_: function() { return this.data.locationText || extensions.getItemSourceString(extensions.getItemSource(this.data));
diff --git a/chrome/browser/resources/md_extensions/drag_and_drop_handler.js b/chrome/browser/resources/md_extensions/drag_and_drop_handler.js index f79bb43..862c3a4 100644 --- a/chrome/browser/resources/md_extensions/drag_and_drop_handler.js +++ b/chrome/browser/resources/md_extensions/drag_and_drop_handler.js
@@ -7,21 +7,27 @@ /** * @param {boolean} dragEnabled + * @param {boolean} isMdExtensions * @param {!EventTarget} target * @constructor * @implements cr.ui.DragWrapperDelegate */ - function DragAndDropHandler(dragEnabled, target) { + function DragAndDropHandler(dragEnabled, isMdExtensions, target) { this.dragEnabled = dragEnabled; + + // Behavior is different for dropped directories between MD and non-MD + // extensions pages. + // TODO(devlin): Delete the non-MD codepath and remove this variable when + // MD extensions launches. + /** @private {boolean} */ + this.isMdExtensions_ = isMdExtensions; + /** @private {!EventTarget} */ this.eventTarget_ = target; } - // TODO(devlin): Un-chrome.send-ify this implementation. + // TODO(devlin): Finish un-chrome.send-ifying this implementation. DragAndDropHandler.prototype = { - /** @type {boolean} */ - dragEnabled: false, - /** @override */ shouldAcceptDrag: function(e) { // External Extension installation can be disabled globally, e.g. while a @@ -40,6 +46,9 @@ /** @override */ doDragEnter: function() { chrome.send('startDrag'); + if (this.isMdExtensions_) + chrome.developerPrivate.notifyDragInstallInProgress(); + this.eventTarget_.dispatchEvent( new CustomEvent('extension-drag-started')); }, @@ -61,27 +70,56 @@ if (e.dataTransfer.files.length != 1) return; - let toSend = ''; + let handled = false; + // Files lack a check if they're a directory, but we can find out through // its item entry. - for (let i = 0; i < e.dataTransfer.items.length; ++i) { - if (e.dataTransfer.items[i].kind == 'file' && - e.dataTransfer.items[i].webkitGetAsEntry().isDirectory) { - toSend = 'installDroppedDirectory'; - break; - } - } - // Only process files that look like extensions. Other files should - // navigate the browser normally. - if (!toSend && - /\.(crx|user\.js|zip)$/i.test(e.dataTransfer.files[0].name)) { - toSend = 'installDroppedFile'; + let item = e.dataTransfer.items[0]; + if (item.kind === 'file' && item.webkitGetAsEntry().isDirectory) { + handled = true; + this.handleDirectoryDrop_(); + } else if (/\.(crx|user\.js|zip)$/i.test(e.dataTransfer.files[0].name)) { + // Only process files that look like extensions. Other files should + // navigate the browser normally. + handled = true; + this.handleFileDrop_(); } - if (toSend) { + if (handled) e.preventDefault(); - chrome.send(toSend); + }, + + /** + * Handles a dropped file. + * @private + */ + handleFileDrop_: function() { + // Packaged files always go through chrome.send (for now). + chrome.send('installDroppedFile'); + }, + + /** + * Handles a dropped directory. + * @private + */ + handleDirectoryDrop_: function() { + // Dropped directories either go through developerPrivate or chrome.send + // depending on if this is the MD page. + if (!this.isMdExtensions_) { + chrome.send('installDroppedDirectory'); + return; } + + // TODO(devlin): Update this to use extensions.Service when it's not + // shared between the MD and non-MD pages. + chrome.developerPrivate.loadUnpacked( + {failQuietly: true, populateError: true, useDraggedPath: true}, + (loadError) => { + if (loadError) { + this.eventTarget_.dispatchEvent(new CustomEvent( + 'drag-and-drop-load-error', {detail: loadError})); + } + }); }, /** @private */
diff --git a/chrome/browser/resources/md_extensions/drop_overlay.js b/chrome/browser/resources/md_extensions/drop_overlay.js index feeddba5..a1071ef 100644 --- a/chrome/browser/resources/md_extensions/drop_overlay.js +++ b/chrome/browser/resources/md_extensions/drop_overlay.js
@@ -7,17 +7,22 @@ Polymer({ is: 'extensions-drop-overlay', + + /** @override */ created: function() { this.hidden = true; const dragTarget = document.documentElement; this.dragWrapperHandler_ = - new extensions.DragAndDropHandler(true, dragTarget); + new extensions.DragAndDropHandler(true, true, dragTarget); dragTarget.addEventListener('extension-drag-started', () => { this.hidden = false; }); dragTarget.addEventListener('extension-drag-ended', () => { this.hidden = true; }); + dragTarget.addEventListener('drag-and-drop-load-error', (e) => { + this.fire('load-error', e.detail); + }); this.dragWrapper_ = new cr.ui.DragWrapper(dragTarget, this.dragWrapperHandler_); },
diff --git a/chrome/browser/resources/md_extensions/item.js b/chrome/browser/resources/md_extensions/item.js index 7b76628..d9a1546 100644 --- a/chrome/browser/resources/md_extensions/item.js +++ b/chrome/browser/resources/md_extensions/item.js
@@ -45,6 +45,11 @@ inspectItemView(id, view) {} /** + * @param {string} url + */ + openUrl(url) {} + + /** * @param {string} id * @return {!Promise} */
diff --git a/chrome/browser/resources/md_extensions/manager.html b/chrome/browser/resources/md_extensions/manager.html index 88ec5e2..becb5669 100644 --- a/chrome/browser/resources/md_extensions/manager.html +++ b/chrome/browser/resources/md_extensions/manager.html
@@ -60,7 +60,6 @@ on-pack-tap="onPackTap_" delegate="[[delegate]]" on-cr-toolbar-menu-tap="onMenuButtonTap_" on-search-changed="onFilterChanged_" - on-load-error="onLoadError_" <if expr="chromeos"> on-kiosk-tap="onKioskTap_" kiosk-enabled="[[kioskEnabled_]]" @@ -81,8 +80,7 @@ delegate="[[delegate]]" in-dev-mode="[[inDevMode]]" filter="[[filter]]" hidden$="[[!didInitPage_]]" slot="view" apps="[[apps_]]" extensions="[[extensions_]]" - on-show-install-warnings="onShowInstallWarnings_" - on-load-error="onLoadError_"> + on-show-install-warnings="onShowInstallWarnings_"> </extensions-item-list> <template id="details-view" is="cr-lazy-render"> <extensions-detail-view delegate="[[delegate]]" slot="view"
diff --git a/chrome/browser/resources/md_extensions/manager.js b/chrome/browser/resources/md_extensions/manager.js index 1d3983c1..bdf2e3f6 100644 --- a/chrome/browser/resources/md_extensions/manager.js +++ b/chrome/browser/resources/md_extensions/manager.js
@@ -125,6 +125,7 @@ }, listeners: { + 'load-error': 'onLoadError_', 'view-exit-finish': 'onViewExitFinish_', },
diff --git a/chrome/browser/resources/md_extensions/service.js b/chrome/browser/resources/md_extensions/service.js index b4e2c9f..db23c63 100644 --- a/chrome/browser/resources/md_extensions/service.js +++ b/chrome/browser/resources/md_extensions/service.js
@@ -174,6 +174,14 @@ }); } + /** + * @param {string} url + * @override + */ + openUrl(url) { + window.open(url); + } + /** @override */ reloadItem(id) { return new Promise(function(resolve, reject) {
diff --git a/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js b/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js index 7fb1411e..1626f7c3 100644 --- a/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js +++ b/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js
@@ -959,6 +959,8 @@ return 'media-router:hangout'; case media_router.SinkIconType.EDUCATION: return 'media-router:education'; + case media_router.SinkIconType.WIRED_DISPLAY: + return 'media-router:tv'; case media_router.SinkIconType.GENERIC: return 'media-router:tv'; default:
diff --git a/chrome/browser/resources/media_router/media_router_data.js b/chrome/browser/resources/media_router/media_router_data.js index a3d4861f..2c3c3ad 100644 --- a/chrome/browser/resources/media_router/media_router_data.js +++ b/chrome/browser/resources/media_router/media_router_data.js
@@ -97,7 +97,8 @@ MEETING: 3, HANGOUT: 4, EDUCATION: 5, - GENERIC: 6, + WIRED_DISPLAY: 6, + GENERIC: 7, }; /**
diff --git a/chrome/browser/resources/settings/languages_page/languages.js b/chrome/browser/resources/settings/languages_page/languages.js index d90b7753..4f3528e 100644 --- a/chrome/browser/resources/settings/languages_page/languages.js +++ b/chrome/browser/resources/settings/languages_page/languages.js
@@ -141,7 +141,8 @@ 'preferredLanguagesPrefChanged_(' + 'prefs.' + preferredLanguagesPrefName + '.value, languages)', 'spellCheckDictionariesPrefChanged_(' + - 'prefs.spellcheck.dictionaries.value.*, languages)', + 'prefs.spellcheck.dictionaries.value.*, ' + + 'prefs.spellcheck.forced_dictionaries.value.*, languages)', 'translateLanguagesPrefChanged_(' + 'prefs.translate_blocked_languages.value.*, languages)', 'updateRemovableLanguages_(' + @@ -278,12 +279,46 @@ spellCheckDictionariesPrefChanged_: function() { var spellCheckSet = this.makeSetFromArray_(/** @type {!Array<string>} */ ( this.getPref('spellcheck.dictionaries').value)); + var spellCheckForcedSet = + this.makeSetFromArray_(/** @type {!Array<string>} */ ( + this.getPref('spellcheck.forced_dictionaries').value)); for (var i = 0; i < this.languages.enabled.length; i++) { var languageState = this.languages.enabled[i]; this.set( - 'languages.enabled.' + i + '.spellCheckEnabled', + `languages.enabled.${i}.spellCheckEnabled`, !!spellCheckSet.has(languageState.language.code)); + this.set( + `languages.enabled.${i}.isManaged`, + !!spellCheckForcedSet.has(languageState.language.code)); } + + this.set( + 'languages.forcedSpellCheckLanguages', + this.getForcedSpellCheckLanguages_(this.languages.enabled)); + }, + + /** + * Returns an array of language codes for the spellcheck languages that are + * managed by policy, but that are not "enabled" languages. + * @param {!Array<!LanguageState>} enabledLanguages An array of enabled + * languages. + * @return {!Array<!string>} + * @private + */ + getForcedSpellCheckLanguages_: function(enabledLanguages) { + var enabledSet = this.makeSetFromArray_(/** @type {!Array<string>} */ ( + enabledLanguages.map(x => x.language.code))); + var spellCheckForcedDictionaries = /** @type {!Array<string>} */ ( + this.getPref('spellcheck.forced_dictionaries').value); + + var forcedLanguages = []; + for (var i = 0; i < spellCheckForcedDictionaries.length; i++) { + var code = spellCheckForcedDictionaries[i]; + if (!enabledSet.has(code) && this.supportedLanguageMap_.has(code)) { + forcedLanguages.push(this.supportedLanguageMap_.get(code)); + } + } + return forcedLanguages; }, /** @private */ @@ -366,10 +401,14 @@ for (var l = 0; l < enabledLanguageStates.length; l++) this.enabledLanguageSet_.add(enabledLanguageStates[l].language.code); + var forcedSpellCheckLanguages = + this.getForcedSpellCheckLanguages_(enabledLanguageStates); + var model = /** @type {!LanguagesModel} */ ({ supported: supportedLanguages, enabled: enabledLanguageStates, translateTarget: translateTarget, + forcedSpellCheckLanguages: forcedSpellCheckLanguages, }); if (cr.isChromeOS || cr.isWindows) @@ -403,8 +442,12 @@ var pref = this.getPref(preferredLanguagesPrefName); var enabledLanguageCodes = pref.value.split(','); var spellCheckPref = this.getPref('spellcheck.dictionaries'); + var spellCheckForcedPref = this.getPref('spellcheck.forced_dictionaries'); var spellCheckSet = this.makeSetFromArray_( - /** @type {!Array<string>} */ (spellCheckPref.value)); + /** @type {!Array<string>} */ ( + spellCheckPref.value.concat(spellCheckForcedPref.value))); + var spellCheckForcedSet = this.makeSetFromArray_( + /** @type {!Array<string>} */ (spellCheckForcedPref.value)); var translateBlockedPref = this.getPref('translate_blocked_languages'); var translateBlockedSet = this.makeSetFromArray_( @@ -427,6 +470,7 @@ !translateBlockedSet.has(translateCode) && translateCode != translateTarget && (!prospectiveUILanguage || code != prospectiveUILanguage); + languageState.isManaged = !!spellCheckForcedSet.has(code); enabledLanguageStates.push(languageState); } return enabledLanguageStates;
diff --git a/chrome/browser/resources/settings/languages_page/languages_page.html b/chrome/browser/resources/settings/languages_page/languages_page.html index 76bec8e9..bf3b6af 100644 --- a/chrome/browser/resources/settings/languages_page/languages_page.html +++ b/chrome/browser/resources/settings/languages_page/languages_page.html
@@ -13,6 +13,7 @@ <link rel="import" href="chrome://resources/cr_elements/cr_expand_button/cr_expand_button.html"> <link rel="import" href="chrome://resources/cr_elements/cr_lazy_render/cr_lazy_render.html"> <link rel="import" href="chrome://resources/cr_elements/cr_toggle/cr_toggle.html"> +<link rel="import" href="chrome://resources/cr_elements/policy/cr_policy_pref_indicator.html"> <link rel="import" href="chrome://resources/cr_elements/icons.html"> <link rel="import" href="add_languages_dialog.html"> <link rel="import" href="languages.html"> @@ -216,17 +217,27 @@ </div> <iron-collapse id="spellCheckCollapse" opened="[[spellCheckOpened_]]"> <div class="list-frame vertical-list"> - <template is="dom-repeat" items="[[languages.enabled]]"> + <template is="dom-repeat" items="[[spellCheckLanguages_]]"> <div class="list-item"> - <div class="start" on-tap="onSpellCheckChange_" - actionable$="[[item.language.supportsSpellcheck]]"> - [[item.language.displayName]] - </div> - <cr-toggle on-change="onSpellCheckChange_" - disabled="[[!item.language.supportsSpellcheck]]" - checked="[[item.spellCheckEnabled]]" - aria-label$="[[item.language.displayName]]"> - </cr-toggle> + <template is="dom-if" if="[[!item.isManaged]]"> + <div class="start" on-tap="onSpellCheckChange_" + actionable$="[[item.language.supportsSpellcheck]]"> + [[item.language.displayName]] + </div> + <cr-toggle on-change="onSpellCheckChange_" + disabled="[[!item.language.supportsSpellcheck]]" + checked="[[item.spellCheckEnabled]]" + aria-label$="[[item.language.displayName]]"> + </cr-toggle> + </template> + <template is="dom-if" if="[[item.isManaged]]"> + <div class="start"> + [[item.language.displayName]] + </div> + <cr-policy-pref-indicator + pref="[[prefs.spellcheck.forced_dictionaries]]"> + </cr-policy-pref-indicator> + </template> </div> </template> <div class="list-item" on-tap="onEditDictionaryTap_" actionable>
diff --git a/chrome/browser/resources/settings/languages_page/languages_page.js b/chrome/browser/resources/settings/languages_page/languages_page.js index eef8e64..5b05ca0d 100644 --- a/chrome/browser/resources/settings/languages_page/languages_page.js +++ b/chrome/browser/resources/settings/languages_page/languages_page.js
@@ -53,7 +53,16 @@ spellCheckSecondaryText_: { type: String, value: '', - computed: 'getSpellCheckSecondaryText_(languages.enabled.*)', + computed: 'getSpellCheckSecondaryText_(languages.enabled.*, ' + + 'languages.forcedSpellCheckLanguages.*)', + }, + + /** @private */ + spellCheckLanguages_: { + type: Array, + value: function() { + return []; + }, }, // </if> @@ -100,6 +109,11 @@ }, }, + observers: [ + 'updateSpellcheckLanguages_(languages.enabled.*, ' + + 'languages.forcedSpellCheckLanguages.*)', + ], + /** * Stamps and opens the Add Languages dialog, registering a listener to * disable the dialog's dom-if again on close. @@ -407,8 +421,8 @@ */ getSpellCheckSecondaryText_: function() { var enabledSpellCheckLanguages = - this.languages.enabled.filter(function(languageState) { - return languageState.spellCheckEnabled && + this.getSpellCheckLanguages_().filter(function(languageState) { + return (languageState.spellCheckEnabled || languageState.isManaged) && languageState.language.supportsSpellcheck; }); switch (enabledSpellCheckLanguages.length) { @@ -438,6 +452,35 @@ }, /** + * Returns an array of enabled languages, plus spellcheck languages that are + * forced by policy. + * @return {!Array<!LanguageState|!ForcedLanguageState>} + * @private + */ + getSpellCheckLanguages_: function() { + return this.languages.enabled.concat( + this.languages.forcedSpellCheckLanguages.map( + language => ({'language': language, isManaged: true}))); + }, + + /** @private */ + updateSpellcheckLanguages_: function() { + this.set('spellCheckLanguages_', this.getSpellCheckLanguages_()); + + // Notify Polymer of subproperties that might have changed on the items in + // the spellCheckLanguages_ array, to make sure the UI updates. Polymer + // would otherwise not notice the changes in the subproperties, as some of + // them are references to those from |this.languages.enabled|. It would be + // possible to |this.linkPaths()| objects from |this.languages.enabled| to + // |this.spellCheckLanguages_|, but that would require complex housekeeping + // to |this.unlinkPaths()| as |this.languages.enabled| changes. + for (var i = 0; i < this.spellCheckLanguages_.length; i++) { + this.notifyPath(`spellCheckLanguages_.${i}.isManaged`); + this.notifyPath(`spellCheckLanguages_.${i}.spellCheckEnabled`); + } + }, + + /** * Opens the Custom Dictionary page. * @private */
diff --git a/chrome/browser/resources/settings/languages_page/languages_types.js b/chrome/browser/resources/settings/languages_page/languages_types.js index 8d0833f..ffe5132 100644 --- a/chrome/browser/resources/settings/languages_page/languages_types.js +++ b/chrome/browser/resources/settings/languages_page/languages_types.js
@@ -14,11 +14,21 @@ * removable: boolean, * spellCheckEnabled: boolean, * translateEnabled: boolean, + * isManaged: boolean, * }} */ var LanguageState; /** + * Settings and state for a policy-enforced spellcheck language. + * @typedef {{ + * language: !chrome.languageSettingsPrivate.Language, + * isManaged: boolean, + * }} + */ +var ForcedLanguageState; + +/** * Input method data to expose to consumers (Chrome OS only). * supported: an array of supported input methods set once at initialization. * enabled: an array of the currently enabled input methods. @@ -43,12 +53,15 @@ * from the actually used language (navigator.language). Chrome OS and * Windows only. * inputMethods: the InputMethodsModel (Chrome OS only). + * forcedSpellCheckLanguages: an array of spellcheck languages that are not in + * |enabled|. * @typedef {{ * supported: !Array<!chrome.languageSettingsPrivate.Language>, * enabled: !Array<!LanguageState>, * translateTarget: string, * prospectiveUILanguage: (string|undefined), * inputMethods: (!InputMethodsModel|undefined), + * forcedSpellCheckLanguages: !Array<!chrome.languageSettingsPrivate.Language> * }} */ var LanguagesModel;
diff --git a/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog.html b/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog.html index 5f697cc..28df42c 100644 --- a/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog.html +++ b/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog.html
@@ -183,9 +183,10 @@ on-tap="onCancelTap_"> $i18n{cancelButtonText} </paper-button> - <paper-button class="action-button" + <paper-button id="addPrinterButton" class="action-button" on-tap="addPressed_" - disabled="[[!newPrinter.printerName]]"> + disabled="[[!canAddPrinter_(newPrinter.printerName, + newPrinter.printerAddress)]]"> $i18n{addPrinterButtonText} </paper-button> </div>
diff --git a/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog.js b/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog.js index ccd0c66..b39b627 100644 --- a/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog.js +++ b/chrome/browser/resources/settings/printing_page/cups_add_printer_dialog.js
@@ -198,6 +198,52 @@ onProtocolChange_: function(event) { this.set('newPrinter.printerProtocol', event.target.value); }, + + /** + * This function uses regular expressions to determine whether the provided + * printer address is valid. Address can be either an ipv4/6 address or a + * hostname followed by an optional port. + * NOTE: The regular expression for hostnames will allow hostnames that are + * over 255 characters. + * @param {String} name + * @param {String} address + * @return {boolean} Whether the add printer button is enabled. + * @private + */ + canAddPrinter_: function(name, address) { + if (!name || !address) + return false; + + var hostnamePrefix = '([a-z\\d]|[a-z\\d][a-z\\d\\-]{0,61}[a-z\\d])'; + + // Matches an arbitrary number of 'prefix patterns' which are separated by a + // dot. + var hostnameSuffix = `(\\.${hostnamePrefix})*`; + + // Matches an optional port at the end of the address. + var portNumber = '(:\\d+)?'; + + var ipv6Full = '(([a-f\\d]){1,4}(:(:)?([a-f\\d]){1,4}){1,7})'; + + // Special cases for addresses using a shorthand notation. + var ipv6Prefix = '(::([a-f\\d]){1,4})'; + var ipv6Suffix = '(([a-f\\d]){1,4}::)'; + var ipv6Combined = `(${ipv6Full}|${ipv6Prefix}|${ipv6Suffix})`; + var ipv6WithPort = `(\\[${ipv6Combined}\\]${portNumber})`; + + // Matches valid hostnames and ipv4 addresses. + var hostnameRegex = + new RegExp(`^${hostnamePrefix}${hostnameSuffix}${portNumber}$`, 'i'); + + // Matches valid ipv6 addresses. + var ipv6AddressRegex = + new RegExp(`^(${ipv6Combined}|${ipv6WithPort})$`, 'i'); + + var invalidIpv6Regex = new RegExp('.*::.*::.*'); + + return hostnameRegex.test(address) || + (ipv6AddressRegex.test(address) && !invalidIpv6Regex.test(address)); + }, }); Polymer({
diff --git a/chrome/browser/resources/settings/site_settings/site_data_details_subpage.html b/chrome/browser/resources/settings/site_settings/site_data_details_subpage.html index 5544d8f..92cc647 100644 --- a/chrome/browser/resources/settings/site_settings/site_data_details_subpage.html +++ b/chrome/browser/resources/settings/site_settings/site_data_details_subpage.html
@@ -23,8 +23,8 @@ </style> <template is="dom-repeat" items="[[entries_]]"> <div class="settings-box" first$="[[!index]]"> - <div class="start">[[getEntryDescription_(item)]]</div> - <cr-expand-button expanded="{{item.expanded_}}"> + <cr-expand-button class="start" expanded="{{item.expanded_}}"> + [[getEntryDescription_(item)]] </cr-expand-button> <div class="separator"></div> <button is="paper-icon-button-light" data-id-path$="[[item.idPath]]"
diff --git a/chrome/browser/safe_browsing/download_protection/download_protection_service.h b/chrome/browser/safe_browsing/download_protection/download_protection_service.h index f44babc6..3c207e35 100644 --- a/chrome/browser/safe_browsing/download_protection/download_protection_service.h +++ b/chrome/browser/safe_browsing/download_protection/download_protection_service.h
@@ -223,16 +223,15 @@ const net::X509Certificate& issuer, std::vector<std::string>* whitelist_strings); - // If kDownloadAttribution feature is enabled, identify referrer chain info of - // a download. This function also records UMA stats of download attribution - // result. + // Identify referrer chain info of a download. This function also records UMA + // stats of download attribution result. std::unique_ptr<ReferrerChain> IdentifyReferrerChain( const content::DownloadItem& item); - // If kDownloadAttribution feature is enabled, identify referrer chain of the - // PPAPI download based on the frame URL where the download is initiated. - // Then add referrer chain info to ClientDownloadRequest proto. This function - // also records UMA stats of download attribution result. + // Identify referrer chain of the PPAPI download based on the frame URL where + // the download is initiated. Then add referrer chain info to + // ClientDownloadRequest proto. This function also records UMA stats of + // download attribution result. void AddReferrerChainToPPAPIClientDownloadRequest( const GURL& initiating_frame_url, const GURL& initiating_main_frame_url,
diff --git a/chrome/browser/safe_browsing/safe_browsing_navigation_observer.cc b/chrome/browser/safe_browsing/safe_browsing_navigation_observer.cc index 1a3da85e..29d50acc 100644 --- a/chrome/browser/safe_browsing/safe_browsing_navigation_observer.cc +++ b/chrome/browser/safe_browsing/safe_browsing_navigation_observer.cc
@@ -38,7 +38,7 @@ target_tab_id(-1), frame_id(-1), last_updated(base::Time::Now()), - is_user_initiated(false), + navigation_initiation(ReferrerChainEntry::UNDEFINED), has_committed(false) {} NavigationEvent::NavigationEvent(NavigationEvent&& nav_event) @@ -50,7 +50,7 @@ target_tab_id(std::move(nav_event.target_tab_id)), frame_id(nav_event.frame_id), last_updated(nav_event.last_updated), - is_user_initiated(nav_event.is_user_initiated), + navigation_initiation(nav_event.navigation_initiation), has_committed(nav_event.has_committed) {} NavigationEvent& NavigationEvent::operator=(NavigationEvent&& nav_event) { @@ -61,7 +61,7 @@ target_tab_id = nav_event.target_tab_id; frame_id = nav_event.frame_id; last_updated = nav_event.last_updated; - is_user_initiated = nav_event.is_user_initiated; + navigation_initiation = nav_event.navigation_initiation; has_committed = nav_event.has_committed; server_redirect_urls = std::move(nav_event.server_redirect_urls); return *this; @@ -118,22 +118,28 @@ auto it = navigation_handle_map_.find(navigation_handle); // It is possible to see multiple DidStartNavigation(..) with the same // navigation_handle (e.g. cross-process transfer). If that's the case, - // we need to copy the is_user_initiated field. - if (it != navigation_handle_map_.end()) { - nav_event->is_user_initiated = it->second->is_user_initiated; + // we need to copy the navigation_initiation field. + if (it != navigation_handle_map_.end() && + it->second->navigation_initiation != ReferrerChainEntry::UNDEFINED) { + nav_event->navigation_initiation = it->second->navigation_initiation; } else { // If this is the first time we see this navigation_handle, create a new // NavigationEvent, and decide if it is triggered by user. - if ((has_user_gesture_ && - !SafeBrowsingNavigationObserverManager::IsUserGestureExpired( - last_user_gesture_timestamp_)) || - !navigation_handle->IsRendererInitiated()) { - nav_event->is_user_initiated = true; - if (has_user_gesture_) { - manager_->OnUserGestureConsumed(web_contents(), - last_user_gesture_timestamp_); - has_user_gesture_ = false; - } + if (!navigation_handle->IsRendererInitiated()) { + nav_event->navigation_initiation = ReferrerChainEntry::BROWSER_INITIATED; + } else if (has_user_gesture_ && + !SafeBrowsingNavigationObserverManager::IsUserGestureExpired( + last_user_gesture_timestamp_)) { + nav_event->navigation_initiation = + ReferrerChainEntry::RENDERER_INITIATED_WITH_USER_GESTURE; + } else { + nav_event->navigation_initiation = + ReferrerChainEntry::RENDERER_INITIATED_WITHOUT_USER_GESTURE; + } + if (has_user_gesture_) { + manager_->OnUserGestureConsumed(web_contents(), + last_user_gesture_timestamp_); + has_user_gesture_ = false; } }
diff --git a/chrome/browser/safe_browsing/safe_browsing_navigation_observer.h b/chrome/browser/safe_browsing/safe_browsing_navigation_observer.h index 52589f3..0d95c5c5 100644 --- a/chrome/browser/safe_browsing/safe_browsing_navigation_observer.h +++ b/chrome/browser/safe_browsing/safe_browsing_navigation_observer.h
@@ -9,6 +9,7 @@ #include "base/supports_user_data.h" #include "components/content_settings/core/browser/content_settings_observer.h" #include "components/content_settings/core/common/content_settings.h" +#include "components/safe_browsing/proto/csd.pb.h" #include "content/public/browser/web_contents_observer.h" #include "url/gurl.h" @@ -30,27 +31,40 @@ NavigationEvent& operator=(NavigationEvent&& nav_event); ~NavigationEvent(); - GURL source_url; // URL that caused this navigation to occur. - // TODO(jialiul): source_url may be incorrect when - // navigation involves frames targeting each other. - // http://crbug.com/651895. - GURL source_main_frame_url; // Main frame url of the source_url. Could be the - // same as source_url, if source_url was loaded - // in main frame. - GURL original_request_url; // The original request URL of this navigation. - std::vector<GURL> server_redirect_urls; // Server redirect url chain. - // Empty if there is no server - // redirect. If set, last url in this - // vector is the destination url. - int source_tab_id; // Which tab contains the frame with source_url. Tab ID is - // returned by SessionTabHelper::IdForTab. This ID is - // immutable for a given tab and unique across Chrome - // within the current session. - int target_tab_id; // Which tab this request url is targeting to. - int frame_id; // Frame tree node ID of the frame where this navigation takes - // place. - base::Time last_updated; // When this NavigationEvent was last updated. - bool is_user_initiated; // browser_initiated || has_user_gesture. + // URL that caused this navigation to occur. + GURL source_url; + + // Main frame url of the source_url. Could be the same as source_url, if + // source_url was loaded in main frame. + GURL source_main_frame_url; + + // The original request URL of this navigation. + GURL original_request_url; + + // Server redirect url chain. Empty if there is no server redirect. If set, + // last url in this vector is the destination url. + std::vector<GURL> server_redirect_urls; + + // Which tab contains the frame with source_url. Tab ID is returned by + // SessionTabHelper::IdForTab. This ID is immutable for a given tab and unique + // across Chrome within the current session. + int source_tab_id; + + // Which tab this request url is targeting to. + int target_tab_id; + + // Frame tree node ID of the frame where this navigation takes place. + int frame_id; + + // When this NavigationEvent was last updated. + base::Time last_updated; + + // If this navigation is triggered by browser or renderer, and if it is + // associated with any user gesture. + ReferrerChainEntry::NavigationInitiation navigation_initiation; + + // Whether this a committed navigation. Navigation leads to download is not + // committed. bool has_committed; const GURL& GetDestinationUrl() const { @@ -59,6 +73,12 @@ else return original_request_url; } + + bool IsUserInitiated() const { + return navigation_initiation == ReferrerChainEntry::BROWSER_INITIATED || + navigation_initiation == + ReferrerChainEntry::RENDERER_INITIATED_WITH_USER_GESTURE; + } }; // Structure to keep track of resolved IP address of a host.
diff --git a/chrome/browser/safe_browsing/safe_browsing_navigation_observer_browsertest.cc b/chrome/browser/safe_browsing/safe_browsing_navigation_observer_browsertest.cc index 649d7590..ef934a8 100644 --- a/chrome/browser/safe_browsing/safe_browsing_navigation_observer_browsertest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_navigation_observer_browsertest.cc
@@ -268,13 +268,14 @@ // Since this test uses javascript to mimic clicking on a link (no actual // user gesture), and DidGetUserInteraction() does not respond to - // ExecuteScript(), is_user_initiated field in resulting NavigationEvents - // will always be false. Therefore, we need to make some adjustment to - // relevant NavigationEvent. + // ExecuteScript(), navigation_transition field in resulting + // NavigationEvents will always be RENDERER_INITIATED_WITHOUT_USER_GESTURE. + // Therefore, we need to make some adjustment to relevant NavigationEvent. for (std::size_t i = 0U; i < navigation_event_list()->Size(); i++) { auto* nav_event = navigation_event_list()->Get(i); if (nav_event->source_url == page_url) { - nav_event->is_user_initiated = true; + nav_event->navigation_initiation = + ReferrerChainEntry::RENDERER_INITIATED_WITH_USER_GESTURE; return; } } @@ -311,7 +312,7 @@ EXPECT_EQ(expected_original_request_url, actual_nav_event->original_request_url); EXPECT_EQ(expected_destination_url, actual_nav_event->GetDestinationUrl()); - EXPECT_EQ(expected_is_user_initiated, actual_nav_event->is_user_initiated); + EXPECT_EQ(expected_is_user_initiated, actual_nav_event->IsUserInitiated()); EXPECT_EQ(expected_has_committed, actual_nav_event->has_committed); EXPECT_EQ(expected_has_server_redirect, !actual_nav_event->server_redirect_urls.empty()); @@ -326,6 +327,7 @@ const GURL& expected_referrer_main_frame_url, bool expected_is_retargeting, const std::vector<GURL>& expected_server_redirects, + ReferrerChainEntry::NavigationInitiation expected_navigation_initiation, const ReferrerChainEntry& actual_entry) { EXPECT_EQ(expected_url.spec(), actual_entry.url()); if (expected_main_frame_url.is_empty()) { @@ -363,6 +365,8 @@ actual_entry.server_redirect_chain(i).url()); } } + EXPECT_EQ(expected_navigation_initiation, + actual_entry.navigation_initiation()); } // Identify referrer chain of a DownloadItem and populate |referrer_chain|. @@ -485,6 +489,7 @@ GURL(), // referrer_main_frame_url false, // is_retargeting std::vector<GURL>(), // server redirects + ReferrerChainEntry::BROWSER_INITIATED, referrer_chain.Get(0)); } // Click on a link and start download on the same page. @@ -519,15 +524,17 @@ ReferrerChain referrer_chain; IdentifyReferrerChainForDownload(GetDownload(), &referrer_chain); ASSERT_EQ(2, referrer_chain.size()); - VerifyReferrerChainEntry(download_url, // url - GURL(), // main_frame_url - ReferrerChainEntry::EVENT_URL, // type - test_server_ip, // ip_address - initial_url, // referrer_url - GURL(), // referrer_main_frame_url - false, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(0)); + VerifyReferrerChainEntry( + download_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::EVENT_URL, // type + test_server_ip, // ip_address + initial_url, // referrer_url + GURL(), // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITH_USER_GESTURE, + referrer_chain.Get(0)); VerifyReferrerChainEntry(initial_url, // url GURL(), // main_frame_url ReferrerChainEntry::LANDING_PAGE, // type @@ -536,6 +543,7 @@ GURL(), // referrer_main_frame_url false, // is_retargeting std::vector<GURL>(), // server redirects + ReferrerChainEntry::BROWSER_INITIATED, referrer_chain.Get(1)); } @@ -573,15 +581,17 @@ ReferrerChain referrer_chain; IdentifyReferrerChainForDownload(GetDownload(), &referrer_chain); ASSERT_EQ(2, referrer_chain.size()); - VerifyReferrerChainEntry(download_url, // url - GURL(), // main_frame_url - ReferrerChainEntry::EVENT_URL, // type - test_server_ip, // ip_address - initial_url, // referrer_url - GURL(), // referrer_main_frame_url - false, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(0)); + VerifyReferrerChainEntry( + download_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::EVENT_URL, // type + test_server_ip, // ip_address + initial_url, // referrer_url + GURL(), // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITH_USER_GESTURE, + referrer_chain.Get(0)); VerifyReferrerChainEntry(initial_url, // url GURL(), // main_frame_url ReferrerChainEntry::LANDING_PAGE, // type @@ -590,6 +600,7 @@ GURL(), // referrer_main_frame_url false, // is_retargeting std::vector<GURL>(), // server redirects + ReferrerChainEntry::BROWSER_INITIATED, referrer_chain.Get(1)); } @@ -637,15 +648,17 @@ ReferrerChain referrer_chain; IdentifyReferrerChainForDownload(GetDownload(), &referrer_chain); ASSERT_EQ(2, referrer_chain.size()); - VerifyReferrerChainEntry(download_url, // url - GURL(), // main_frame_url - ReferrerChainEntry::EVENT_URL, // type - test_server_ip, // ip_address - initial_url, // referrer_url - GURL(), // referrer_main_frame_url - true, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(0)); + VerifyReferrerChainEntry( + download_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::EVENT_URL, // type + test_server_ip, // ip_address + initial_url, // referrer_url + GURL(), // referrer_main_frame_url + true, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITH_USER_GESTURE, + referrer_chain.Get(0)); VerifyReferrerChainEntry(initial_url, // url GURL(), // main_frame_url ReferrerChainEntry::LANDING_PAGE, // type @@ -654,6 +667,7 @@ GURL(), // referrer_main_frame_url false, // is_retargeting std::vector<GURL>(), // server redirects + ReferrerChainEntry::BROWSER_INITIATED, referrer_chain.Get(1)); } @@ -702,24 +716,28 @@ ReferrerChain referrer_chain; IdentifyReferrerChainForDownload(GetDownload(), &referrer_chain); ASSERT_EQ(3, referrer_chain.size()); - VerifyReferrerChainEntry(download_url, // url - GURL(), // main_frame_url - ReferrerChainEntry::EVENT_URL, // type - test_server_ip, // ip_address - redirect_url, // referrer_url - GURL(), // referrer_main_frame_url - false, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(0)); - VerifyReferrerChainEntry(redirect_url, // url - GURL(), // main_frame_url - ReferrerChainEntry::CLIENT_REDIRECT, // type - test_server_ip, // ip_address - initial_url, // referrer_url - GURL(), // referrer_main_frame_url - false, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(1)); + VerifyReferrerChainEntry( + download_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::EVENT_URL, // type + test_server_ip, // ip_address + redirect_url, // referrer_url + GURL(), // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITHOUT_USER_GESTURE, + referrer_chain.Get(0)); + VerifyReferrerChainEntry( + redirect_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::CLIENT_REDIRECT, // type + test_server_ip, // ip_address + initial_url, // referrer_url + GURL(), // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITH_USER_GESTURE, + referrer_chain.Get(1)); VerifyReferrerChainEntry(initial_url, // url GURL(), // main_frame_url ReferrerChainEntry::LANDING_PAGE, // type @@ -728,6 +746,7 @@ GURL(), // referrer_main_frame_url false, // is_retargeting std::vector<GURL>(), // server redirects + ReferrerChainEntry::BROWSER_INITIATED, referrer_chain.Get(2)); } @@ -782,24 +801,28 @@ ReferrerChain referrer_chain; IdentifyReferrerChainForDownload(GetDownload(), &referrer_chain); ASSERT_EQ(3, referrer_chain.size()); - VerifyReferrerChainEntry(download_url, // url - GURL(), // main_frame_url - ReferrerChainEntry::EVENT_URL, // type - test_server_ip, // ip_address - redirect_url, // referrer_url - GURL(), // referrer_main_frame_url - false, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(0)); - VerifyReferrerChainEntry(redirect_url, // url - GURL(), // main_frame_url - ReferrerChainEntry::CLIENT_REDIRECT, // type - test_server_ip, // ip_address - initial_url, // referrer_url - GURL(), // referrer_main_frame_url - true, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(1)); + VerifyReferrerChainEntry( + download_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::EVENT_URL, // type + test_server_ip, // ip_address + redirect_url, // referrer_url + GURL(), // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITHOUT_USER_GESTURE, + referrer_chain.Get(0)); + VerifyReferrerChainEntry( + redirect_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::CLIENT_REDIRECT, // type + test_server_ip, // ip_address + initial_url, // referrer_url + GURL(), // referrer_main_frame_url + true, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITH_USER_GESTURE, + referrer_chain.Get(1)); VerifyReferrerChainEntry(initial_url, // url GURL(), // main_frame_url ReferrerChainEntry::LANDING_PAGE, // type @@ -808,6 +831,7 @@ GURL(), // referrer_main_frame_url false, // is_retargeting std::vector<GURL>(), // server redirects + ReferrerChainEntry::BROWSER_INITIATED, referrer_chain.Get(2)); } @@ -865,33 +889,39 @@ ReferrerChain referrer_chain; IdentifyReferrerChainForDownload(GetDownload(), &referrer_chain); ASSERT_EQ(4, referrer_chain.size()); - VerifyReferrerChainEntry(download_url, // url - GURL(), // main_frame_url - ReferrerChainEntry::EVENT_URL, // type - test_server_ip, // ip_address - second_redirect_url, // referrer_url - GURL(), // referrer_main_frame_url - false, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(0)); - VerifyReferrerChainEntry(second_redirect_url, // url - GURL(), // main_frame_url - ReferrerChainEntry::CLIENT_REDIRECT, // type - test_server_ip, // ip_address - first_redirect_url, // referrer_url - GURL(), // referrer_main_frame_url - false, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(1)); - VerifyReferrerChainEntry(first_redirect_url, // url - GURL(), // main_frame_url - ReferrerChainEntry::CLIENT_REDIRECT, // type - test_server_ip, // ip_address - initial_url, // referrer_url - GURL(), // referrer_main_frame_url - false, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(2)); + VerifyReferrerChainEntry( + download_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::EVENT_URL, // type + test_server_ip, // ip_address + second_redirect_url, // referrer_url + GURL(), // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITHOUT_USER_GESTURE, + referrer_chain.Get(0)); + VerifyReferrerChainEntry( + second_redirect_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::CLIENT_REDIRECT, // type + test_server_ip, // ip_address + first_redirect_url, // referrer_url + GURL(), // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITHOUT_USER_GESTURE, + referrer_chain.Get(1)); + VerifyReferrerChainEntry( + first_redirect_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::CLIENT_REDIRECT, // type + test_server_ip, // ip_address + initial_url, // referrer_url + GURL(), // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITH_USER_GESTURE, + referrer_chain.Get(2)); VerifyReferrerChainEntry(initial_url, // url GURL(), // main_frame_url ReferrerChainEntry::LANDING_PAGE, // type @@ -900,6 +930,7 @@ GURL(), // referrer_main_frame_url false, // is_retargeting std::vector<GURL>(), // server redirects + ReferrerChainEntry::BROWSER_INITIATED, referrer_chain.Get(3)); } @@ -936,15 +967,17 @@ ReferrerChain referrer_chain; IdentifyReferrerChainForDownload(GetDownload(), &referrer_chain); ASSERT_EQ(2, referrer_chain.size()); - VerifyReferrerChainEntry(download_url, // url - GURL(), // main_frame_url - ReferrerChainEntry::EVENT_URL, // type - test_server_ip, // ip_address - initial_url, // referrer_url - GURL(), // referrer_main_frame_url - false, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(0)); + VerifyReferrerChainEntry( + download_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::EVENT_URL, // type + test_server_ip, // ip_address + initial_url, // referrer_url + GURL(), // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITH_USER_GESTURE, + referrer_chain.Get(0)); VerifyReferrerChainEntry(initial_url, // url GURL(), // main_frame_url ReferrerChainEntry::LANDING_PAGE, // type @@ -953,6 +986,7 @@ GURL(), // referrer_main_frame_url false, // is_retargeting std::vector<GURL>(), // server redirects + ReferrerChainEntry::BROWSER_INITIATED, referrer_chain.Get(1)); } @@ -999,24 +1033,28 @@ ReferrerChain referrer_chain; IdentifyReferrerChainForDownload(GetDownload(), &referrer_chain); ASSERT_EQ(3, referrer_chain.size()); - VerifyReferrerChainEntry(download_url, // url - GURL(), // main_frame_url - ReferrerChainEntry::EVENT_URL, // type - test_server_ip, // ip_address - redirect_url, // referrer_url - GURL(), // referrer_main_frame_url - false, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(0)); - VerifyReferrerChainEntry(redirect_url, // url - GURL(), // main_frame_url - ReferrerChainEntry::CLIENT_REDIRECT, // type - test_server_ip, // ip_address - initial_url, // referrer_url - GURL(), // referrer_main_frame_url - false, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(1)); + VerifyReferrerChainEntry( + download_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::EVENT_URL, // type + test_server_ip, // ip_address + redirect_url, // referrer_url + GURL(), // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITHOUT_USER_GESTURE, + referrer_chain.Get(0)); + VerifyReferrerChainEntry( + redirect_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::CLIENT_REDIRECT, // type + test_server_ip, // ip_address + initial_url, // referrer_url + GURL(), // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITH_USER_GESTURE, + referrer_chain.Get(1)); VerifyReferrerChainEntry(initial_url, // url GURL(), // main_frame_url ReferrerChainEntry::LANDING_PAGE, // type @@ -1025,6 +1063,7 @@ GURL(), // referrer_main_frame_url false, // is_retargeting std::vector<GURL>(), // server redirects + ReferrerChainEntry::BROWSER_INITIATED, referrer_chain.Get(2)); } @@ -1081,24 +1120,28 @@ ReferrerChain referrer_chain; IdentifyReferrerChainForDownload(GetDownload(), &referrer_chain); ASSERT_EQ(3, referrer_chain.size()); - VerifyReferrerChainEntry(download_url, // url - GURL(), // main_frame_url - ReferrerChainEntry::EVENT_URL, // type - test_server_ip, // ip_address - blank_url, // referrer_url - GURL(), // referrer_main_frame_url - false, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(0)); - VerifyReferrerChainEntry(blank_url, // url - GURL(), // main_frame_url - ReferrerChainEntry::CLIENT_REDIRECT, // type - "", // ip_address - initial_url, // referrer_url - GURL(), // referrer_main_frame_url - true, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(1)); + VerifyReferrerChainEntry( + download_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::EVENT_URL, // type + test_server_ip, // ip_address + blank_url, // referrer_url + GURL(), // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITHOUT_USER_GESTURE, + referrer_chain.Get(0)); + VerifyReferrerChainEntry( + blank_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::CLIENT_REDIRECT, // type + "", // ip_address + initial_url, // referrer_url + GURL(), // referrer_main_frame_url + true, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITH_USER_GESTURE, + referrer_chain.Get(1)); VerifyReferrerChainEntry(initial_url, // url GURL(), // main_frame_url ReferrerChainEntry::LANDING_PAGE, // type @@ -1107,6 +1150,7 @@ GURL(), // referrer_main_frame_url false, // is_retargeting std::vector<GURL>(), // server redirects + ReferrerChainEntry::BROWSER_INITIATED, referrer_chain.Get(2)); } @@ -1168,24 +1212,28 @@ ReferrerChain referrer_chain; IdentifyReferrerChainForDownload(GetDownload(), &referrer_chain); ASSERT_EQ(3, referrer_chain.size()); - VerifyReferrerChainEntry(short_download_url, // url - GURL(), // main_frame_url - ReferrerChainEntry::EVENT_URL, // type - "", // ip_address - blank_url, // referrer_url - GURL(), // referrer_main_frame_url - false, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(0)); - VerifyReferrerChainEntry(blank_url, // url - GURL(), // main_frame_url - ReferrerChainEntry::CLIENT_REDIRECT, // type - "", // ip_address - initial_url, // referrer_url - GURL(), // referrer_main_frame_url - true, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(1)); + VerifyReferrerChainEntry( + short_download_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::EVENT_URL, // type + "", // ip_address + blank_url, // referrer_url + GURL(), // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITHOUT_USER_GESTURE, + referrer_chain.Get(0)); + VerifyReferrerChainEntry( + blank_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::CLIENT_REDIRECT, // type + "", // ip_address + initial_url, // referrer_url + GURL(), // referrer_main_frame_url + true, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITH_USER_GESTURE, + referrer_chain.Get(1)); VerifyReferrerChainEntry(initial_url, // url GURL(), // main_frame_url ReferrerChainEntry::LANDING_PAGE, // type @@ -1194,6 +1242,7 @@ GURL(), // referrer_main_frame_url false, // is_retargeting std::vector<GURL>(), // server redirects + ReferrerChainEntry::BROWSER_INITIATED, referrer_chain.Get(2)); } @@ -1283,33 +1332,39 @@ ReferrerChain referrer_chain; IdentifyReferrerChainForDownload(GetDownload(), &referrer_chain); ASSERT_EQ(4, referrer_chain.size()); - VerifyReferrerChainEntry(download_url, // url - GURL(), // main_frame_url - ReferrerChainEntry::EVENT_URL, // type - test_server_ip, // ip_address - iframe_url, // referrer_url - multi_frame_test_url, // referrer_main_frame_url - false, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(0)); - VerifyReferrerChainEntry(iframe_url, // url - multi_frame_test_url, // main_frame_url - ReferrerChainEntry::LANDING_PAGE, // type - test_server_ip, // ip_address - GURL(), // referrer_url - multi_frame_test_url, // referrer_main_frame_url - false, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(1)); - VerifyReferrerChainEntry(multi_frame_test_url, // url - GURL(), // main_frame_url - ReferrerChainEntry::CLIENT_REDIRECT, // type - test_server_ip, // ip_address - initial_url, // referrer_url - GURL(), // referrer_main_frame_url - false, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(2)); + VerifyReferrerChainEntry( + download_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::EVENT_URL, // type + test_server_ip, // ip_address + iframe_url, // referrer_url + multi_frame_test_url, // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITH_USER_GESTURE, + referrer_chain.Get(0)); + VerifyReferrerChainEntry( + iframe_url, // url + multi_frame_test_url, // main_frame_url + ReferrerChainEntry::LANDING_PAGE, // type + test_server_ip, // ip_address + GURL(), // referrer_url + multi_frame_test_url, // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITHOUT_USER_GESTURE, + referrer_chain.Get(1)); + VerifyReferrerChainEntry( + multi_frame_test_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::CLIENT_REDIRECT, // type + test_server_ip, // ip_address + initial_url, // referrer_url + GURL(), // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITH_USER_GESTURE, + referrer_chain.Get(2)); VerifyReferrerChainEntry(initial_url, // url GURL(), // main_frame_url ReferrerChainEntry::LANDING_REFERRER, // type @@ -1318,6 +1373,7 @@ GURL(), // referrer_main_frame_url false, // is_retargeting std::vector<GURL>(), // server redirects + ReferrerChainEntry::BROWSER_INITIATED, referrer_chain.Get(3)); } @@ -1424,42 +1480,50 @@ ReferrerChain referrer_chain; IdentifyReferrerChainForDownload(GetDownload(), &referrer_chain); EXPECT_EQ(5, referrer_chain.size()); - VerifyReferrerChainEntry(download_url, // url - GURL(), // main_frame_url - ReferrerChainEntry::EVENT_URL, // type - test_server_ip, // ip_address - blank_url, // referrer_url - GURL(), // referrer_main_frame_url - false, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(0)); - VerifyReferrerChainEntry(blank_url, // url - GURL(), // main_frame_url - ReferrerChainEntry::CLIENT_REDIRECT, // type - "", // ip_address - iframe_retargeting_url, // referrer_url - multi_frame_test_url, // referrer_main_frame_url - true, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(1)); - VerifyReferrerChainEntry(iframe_retargeting_url, // url - multi_frame_test_url, // main_frame_url - ReferrerChainEntry::LANDING_PAGE, // type - test_server_ip, // ip_address - GURL(), // referrer_url - multi_frame_test_url, // referrer_main_frame_url - false, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(2)); - VerifyReferrerChainEntry(multi_frame_test_url, // url - GURL(), // main_frame_url - ReferrerChainEntry::CLIENT_REDIRECT, // type - test_server_ip, // ip_address - initial_url, // referrer_url - GURL(), // referrer_main_frame_url - false, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(3)); + VerifyReferrerChainEntry( + download_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::EVENT_URL, // type + test_server_ip, // ip_address + blank_url, // referrer_url + GURL(), // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITHOUT_USER_GESTURE, + referrer_chain.Get(0)); + VerifyReferrerChainEntry( + blank_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::CLIENT_REDIRECT, // type + "", // ip_address + iframe_retargeting_url, // referrer_url + multi_frame_test_url, // referrer_main_frame_url + true, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITH_USER_GESTURE, + referrer_chain.Get(1)); + VerifyReferrerChainEntry( + iframe_retargeting_url, // url + multi_frame_test_url, // main_frame_url + ReferrerChainEntry::LANDING_PAGE, // type + test_server_ip, // ip_address + GURL(), // referrer_url + multi_frame_test_url, // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITHOUT_USER_GESTURE, + referrer_chain.Get(2)); + VerifyReferrerChainEntry( + multi_frame_test_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::CLIENT_REDIRECT, // type + test_server_ip, // ip_address + initial_url, // referrer_url + GURL(), // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITH_USER_GESTURE, + referrer_chain.Get(3)); VerifyReferrerChainEntry(initial_url, // url GURL(), // main_frame_url ReferrerChainEntry::LANDING_REFERRER, // type @@ -1468,6 +1532,7 @@ GURL(), // referrer_main_frame_url false, // is_retargeting std::vector<GURL>(), // server redirects + ReferrerChainEntry::BROWSER_INITIATED, referrer_chain.Get(4)); } @@ -1523,33 +1588,39 @@ ReferrerChain referrer_chain; IdentifyReferrerChainForDownload(GetDownload(), &referrer_chain); EXPECT_EQ(4, referrer_chain.size()); - VerifyReferrerChainEntry(download_url, // url - GURL(), // main_frame_url - ReferrerChainEntry::EVENT_URL, // type - test_server_ip, // ip_address - landing_url, // referrer_url - GURL(), // referrer_main_frame_url - false, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(0)); - VerifyReferrerChainEntry(landing_url, // url - GURL(), // main_frame_url - ReferrerChainEntry::LANDING_PAGE, // type - test_server_ip, // ip_address - redirect_url, // referrer_url - GURL(), // referrer_main_frame_url - false, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(1)); - VerifyReferrerChainEntry(redirect_url, // url - GURL(), // main_frame_url - ReferrerChainEntry::CLIENT_REDIRECT, // type - test_server_ip, // ip_address - initial_url, // referrer_url - GURL(), // referrer_main_frame_url - false, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(2)); + VerifyReferrerChainEntry( + download_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::EVENT_URL, // type + test_server_ip, // ip_address + landing_url, // referrer_url + GURL(), // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITH_USER_GESTURE, + referrer_chain.Get(0)); + VerifyReferrerChainEntry( + landing_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::LANDING_PAGE, // type + test_server_ip, // ip_address + redirect_url, // referrer_url + GURL(), // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITHOUT_USER_GESTURE, + referrer_chain.Get(1)); + VerifyReferrerChainEntry( + redirect_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::CLIENT_REDIRECT, // type + test_server_ip, // ip_address + initial_url, // referrer_url + GURL(), // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITH_USER_GESTURE, + referrer_chain.Get(2)); VerifyReferrerChainEntry( initial_url, // url GURL(), // main_frame_url @@ -1559,7 +1630,7 @@ GURL(), // referrer_main_frame_url is empty for the same reason. false, // is_retargeting std::vector<GURL>(), // server redirects - referrer_chain.Get(3)); + ReferrerChainEntry::BROWSER_INITIATED, referrer_chain.Get(3)); } // Click three links before reaching download. @@ -1628,24 +1699,28 @@ ReferrerChain referrer_chain; IdentifyReferrerChainForDownload(GetDownload(), &referrer_chain); EXPECT_EQ(3, referrer_chain.size()); - VerifyReferrerChainEntry(download_url, // url - GURL(), // main_frame_url - ReferrerChainEntry::EVENT_URL, // type - test_server_ip, // ip_address - landing_url, // referrer_url - GURL(), // referrer_main_frame_url - false, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(0)); - VerifyReferrerChainEntry(landing_url, // url - GURL(), // main_frame_url - ReferrerChainEntry::LANDING_PAGE, // type - test_server_ip, // ip_address - landing_referrer_url, // referrer_url - GURL(), // referrer_main_frame_url - false, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(1)); + VerifyReferrerChainEntry( + download_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::EVENT_URL, // type + test_server_ip, // ip_address + landing_url, // referrer_url + GURL(), // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITH_USER_GESTURE, + referrer_chain.Get(0)); + VerifyReferrerChainEntry( + landing_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::LANDING_PAGE, // type + test_server_ip, // ip_address + landing_referrer_url, // referrer_url + GURL(), // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITH_USER_GESTURE, + referrer_chain.Get(1)); VerifyReferrerChainEntry( landing_referrer_url, // url GURL(), // main_frame_url @@ -1655,6 +1730,7 @@ GURL(), // referrer_main_frame_url is empty for the same reason. false, // is_retargeting std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITH_USER_GESTURE, referrer_chain.Get(2)); // page_before_landing_referrer_url is not in referrer chain. } @@ -1707,24 +1783,28 @@ browser()->tab_strip_model()->GetActiveWebContents(), &referrer_chain); EXPECT_EQ(3, referrer_chain.size()); - VerifyReferrerChainEntry(landing_url, // url - GURL(), // main_frame_url - ReferrerChainEntry::LANDING_PAGE, // type - test_server_ip, // ip_address - redirect_url, // referrer_url - GURL(), // referrer_main_frame_url - false, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(0)); - VerifyReferrerChainEntry(redirect_url, // url - GURL(), // main_frame_url - ReferrerChainEntry::CLIENT_REDIRECT, // type - test_server_ip, // ip_address - initial_url, // referrer_url - GURL(), // referrer_main_frame_url - false, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(1)); + VerifyReferrerChainEntry( + landing_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::LANDING_PAGE, // type + test_server_ip, // ip_address + redirect_url, // referrer_url + GURL(), // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITHOUT_USER_GESTURE, + referrer_chain.Get(0)); + VerifyReferrerChainEntry( + redirect_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::CLIENT_REDIRECT, // type + test_server_ip, // ip_address + initial_url, // referrer_url + GURL(), // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITH_USER_GESTURE, + referrer_chain.Get(1)); VerifyReferrerChainEntry( initial_url, // url GURL(), // main_frame_url @@ -1734,7 +1814,7 @@ GURL(), // referrer_main_frame_url is empty for the same reason. false, // is_retargeting std::vector<GURL>(), // server redirects - referrer_chain.Get(2)); + ReferrerChainEntry::BROWSER_INITIATED, referrer_chain.Get(2)); } // Click a link which redirects to a page that triggers PPAPI download without @@ -1784,24 +1864,28 @@ browser()->tab_strip_model()->GetActiveWebContents(), &referrer_chain); EXPECT_EQ(3, referrer_chain.size()); - VerifyReferrerChainEntry(hosting_url, // url - GURL(), // main_frame_url - ReferrerChainEntry::CLIENT_REDIRECT, // type - test_server_ip, // ip_address - redirect_url, // referrer_url - GURL(), // referrer_main_frame_url - false, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(0)); - VerifyReferrerChainEntry(redirect_url, // url - GURL(), // main_frame_url - ReferrerChainEntry::CLIENT_REDIRECT, // type - test_server_ip, // ip_address - landing_url, // referrer_url - GURL(), // referrer_main_frame_url - false, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(1)); + VerifyReferrerChainEntry( + hosting_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::CLIENT_REDIRECT, // type + test_server_ip, // ip_address + redirect_url, // referrer_url + GURL(), // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITHOUT_USER_GESTURE, + referrer_chain.Get(0)); + VerifyReferrerChainEntry( + redirect_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::CLIENT_REDIRECT, // type + test_server_ip, // ip_address + landing_url, // referrer_url + GURL(), // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITH_USER_GESTURE, + referrer_chain.Get(1)); VerifyReferrerChainEntry(landing_url, // url GURL(), // main_frame_url ReferrerChainEntry::LANDING_PAGE, // type @@ -1810,6 +1894,7 @@ GURL(), false, // is_retargeting std::vector<GURL>(), // server redirects + ReferrerChainEntry::BROWSER_INITIATED, referrer_chain.Get(2)); } @@ -1854,6 +1939,7 @@ GURL(), // referrer_main_frame_url false, // is_retargeting {request_url, download_url}, // server redirects + ReferrerChainEntry::BROWSER_INITIATED, referrer_chain.Get(0)); } @@ -1904,6 +1990,7 @@ GURL(), // referrer_main_frame_url false, // is_retargeting {request_url, redirect_url, destination_url}, + ReferrerChainEntry::BROWSER_INITIATED, referrer_chain.Get(0)); } @@ -1949,15 +2036,17 @@ ReferrerChain referrer_chain; IdentifyReferrerChainForDownload(GetDownload(), &referrer_chain); ASSERT_EQ(2, referrer_chain.size()); - VerifyReferrerChainEntry(download_url, // url - GURL(), // main_frame_url - ReferrerChainEntry::EVENT_URL, // type - test_server_ip, // ip_address - initial_url, // referrer_url - GURL(), // referrer_main_frame_url - true, // is_retargeting - {request_url, download_url}, // server redirects - referrer_chain.Get(0)); + VerifyReferrerChainEntry( + download_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::EVENT_URL, // type + test_server_ip, // ip_address + initial_url, // referrer_url + GURL(), // referrer_main_frame_url + true, // is_retargeting + {request_url, download_url}, // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITH_USER_GESTURE, + referrer_chain.Get(0)); VerifyReferrerChainEntry(initial_url, // url GURL(), // main_frame_url ReferrerChainEntry::LANDING_PAGE, // type @@ -1966,6 +2055,7 @@ GURL(), // referrer_main_frame_url false, // is_retargeting std::vector<GURL>(), // server redirects + ReferrerChainEntry::BROWSER_INITIATED, referrer_chain.Get(1)); } @@ -2041,6 +2131,7 @@ GURL(), // referrer_main_frame_url false, // is_retargeting std::vector<GURL>(), // server redirects + ReferrerChainEntry::BROWSER_INITIATED, referrer_chain.Get(0)); } @@ -2077,6 +2168,7 @@ GURL(), // referrer_main_frame_url false, // is_retargeting std::vector<GURL>(), // server redirects + ReferrerChainEntry::BROWSER_INITIATED, referrer_chain.Get(0)); } @@ -2111,15 +2203,17 @@ ASSERT_EQ(2, referrer_chain.size()); // Verify url fragment is cleared in referrer chain. - VerifyReferrerChainEntry(expected_landing_url, // url - GURL(), // main_frame_url - ReferrerChainEntry::LANDING_PAGE, // type - test_server_ip, // ip_address - expected_landing_referrer_url_with_query, - GURL(), // referrer_main_frame_url - false, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(0)); + VerifyReferrerChainEntry( + expected_landing_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::LANDING_PAGE, // type + test_server_ip, // ip_address + expected_landing_referrer_url_with_query, + GURL(), // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITH_USER_GESTURE, + referrer_chain.Get(0)); VerifyReferrerChainEntry( expected_landing_referrer_url_with_query, // url GURL(), // main_frame_url @@ -2129,6 +2223,7 @@ GURL(), // referrer_main_frame_url is empty for the same reason. false, // is_retargeting std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITH_USER_GESTURE, referrer_chain.Get(1)); } @@ -2147,15 +2242,17 @@ IdentifyReferrerChainForDownload(GetDownload(), &referrer_chain); SafeBrowsingNavigationObserverManager::SanitizeReferrerChain(&referrer_chain); ASSERT_EQ(2, referrer_chain.size()); - VerifyReferrerChainEntry(test_server_origin, // url - GURL(), // main_frame_url - ReferrerChainEntry::EVENT_URL, // type - test_server_ip, // ip_address - test_server_origin, // referrer_url - GURL(), // referrer_main_frame_url - false, // is_retargeting - std::vector<GURL>(), // server redirects - referrer_chain.Get(0)); + VerifyReferrerChainEntry( + test_server_origin, // url + GURL(), // main_frame_url + ReferrerChainEntry::EVENT_URL, // type + test_server_ip, // ip_address + test_server_origin, // referrer_url + GURL(), // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITH_USER_GESTURE, + referrer_chain.Get(0)); VerifyReferrerChainEntry(test_server_origin, // url GURL(), // main_frame_url ReferrerChainEntry::LANDING_PAGE, // type @@ -2164,6 +2261,7 @@ GURL(), // referrer_main_frame_url false, // is_retargeting std::vector<GURL>(), // server redirects + ReferrerChainEntry::BROWSER_INITIATED, referrer_chain.Get(1)); }
diff --git a/chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager.cc b/chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager.cc index f1e52d9c..d3dbc58ff 100644 --- a/chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager.cc +++ b/chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager.cc
@@ -132,7 +132,7 @@ // looks for the retargeting navigation event. if (nav_event->source_url.is_empty() && nav_event->source_main_frame_url.is_empty() && - !nav_event->is_user_initiated) { + !nav_event->IsUserInitiated()) { // If there is a server redirection immediately after retargeting, we // need to adjust our search url to the original request. if (!nav_event->server_redirect_urls.empty()) { @@ -250,6 +250,7 @@ GetOrigin(entry_copy.referrer_main_frame_url())); entry->set_is_retargeting(entry_copy.is_retargeting()); entry->set_navigation_time_msec(entry_copy.navigation_time_msec()); + entry->set_navigation_initiation(entry_copy.navigation_initiation()); for (int j = 0; j < entry_copy.server_redirect_chain_size(); j++) { ReferrerChainEntry::ServerRedirect* server_redirect_entry = entry->add_server_redirect_chain(); @@ -434,7 +435,7 @@ int source_render_frame_id, GURL target_url, content::WebContents* target_web_contents, - bool not_yet_in_tabstrip) { + bool renderer_initiated) { DCHECK(source_web_contents); DCHECK(target_web_contents); @@ -458,14 +459,18 @@ nav_event->original_request_url = cleaned_target_url; nav_event->target_tab_id = SessionTabHelper::IdForTab(target_web_contents); nav_event->frame_id = rfh ? rfh->GetFrameTreeNodeId() : -1; + auto it = user_gesture_map_.find(source_web_contents); - if (it != user_gesture_map_.end() && - !SafeBrowsingNavigationObserverManager::IsUserGestureExpired( - it->second)) { - nav_event->is_user_initiated = true; - OnUserGestureConsumed(it->first, it->second); + if (it == user_gesture_map_.end() || + SafeBrowsingNavigationObserverManager::IsUserGestureExpired(it->second)) { + nav_event->navigation_initiation = + ReferrerChainEntry::RENDERER_INITIATED_WITHOUT_USER_GESTURE; } else { - nav_event->is_user_initiated = false; + OnUserGestureConsumed(it->first, it->second); + nav_event->navigation_initiation = + renderer_initiated + ? ReferrerChainEntry::RENDERER_INITIATED_WITH_USER_GESTURE + : ReferrerChainEntry::BROWSER_INITIATED; } navigation_event_list_.RecordNavigationEvent(std::move(nav_event)); @@ -530,6 +535,8 @@ ReferrerChainEntry::URLType type) { std::unique_ptr<ReferrerChainEntry> referrer_chain_entry = base::MakeUnique<ReferrerChainEntry>(); + referrer_chain_entry->set_navigation_initiation( + nav_event->navigation_initiation); const GURL destination_url = nav_event->GetDestinationUrl(); referrer_chain_entry->set_url(ShortURLForReporting(destination_url)); if (destination_main_frame_url.is_valid() && @@ -583,7 +590,7 @@ GURL last_main_frame_url_traced(last_nav_event_traced->source_main_frame_url); while (current_user_gesture_count < user_gesture_count_limit) { // Back trace to the next nav_event that was initiated by the user. - while (!last_nav_event_traced->is_user_initiated) { + while (!last_nav_event_traced->IsUserInitiated()) { last_nav_event_traced = navigation_event_list_.FindNavigationEvent( last_nav_event_traced->source_url, last_nav_event_traced->source_main_frame_url, @@ -602,14 +609,11 @@ current_user_gesture_count++; - - // If the source_url and source_main_frame_url of current navigation event - // are empty, and is_user_initiated is true, this is a browser initiated - // navigation (e.g. trigged by typing in address bar, clicking on bookmark, - // etc). We reached the end of the referrer chain. - if (last_nav_event_traced->source_url.is_empty() && - last_nav_event_traced->source_main_frame_url.is_empty()) { - DCHECK(last_nav_event_traced->is_user_initiated); + // If this is a browser initiated navigation (e.g. trigged by typing in + // address bar, clicking on bookmark, etc). We reached the end of the + // referrer chain. + if (last_nav_event_traced->navigation_initiation == + ReferrerChainEntry::BROWSER_INITIATED) { return; }
diff --git a/chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager.h b/chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager.h index 66ce2cc6..22d502c 100644 --- a/chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager.h +++ b/chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager.h
@@ -195,7 +195,7 @@ int source_render_frame_id, GURL target_url, content::WebContents* target_web_contents, - bool not_yet_in_tabstrip); + bool renderer_initiated); private: friend class base::RefCountedThreadSafe<
diff --git a/chrome/browser/safe_browsing/safe_browsing_navigation_observer_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_navigation_observer_unittest.cc index ea2bc69e..6beafcd 100644 --- a/chrome/browser/safe_browsing/safe_browsing_navigation_observer_unittest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_navigation_observer_unittest.cc
@@ -42,16 +42,17 @@ delete navigation_observer_; BrowserWithTestWindowTest::TearDown(); } - void VerifyNavigationEvent(const GURL& expected_source_url, - const GURL& expected_source_main_frame_url, - const GURL& expected_original_request_url, - const GURL& expected_destination_url, - int expected_source_tab, - int expected_target_tab, - bool expected_is_user_initiated, - bool expected_has_committed, - bool expected_has_server_redirect, - NavigationEvent* actual_nav_event) { + void VerifyNavigationEvent( + const GURL& expected_source_url, + const GURL& expected_source_main_frame_url, + const GURL& expected_original_request_url, + const GURL& expected_destination_url, + int expected_source_tab, + int expected_target_tab, + ReferrerChainEntry::NavigationInitiation expected_nav_initiation, + bool expected_has_committed, + bool expected_has_server_redirect, + NavigationEvent* actual_nav_event) { EXPECT_EQ(expected_source_url, actual_nav_event->source_url); EXPECT_EQ(expected_source_main_frame_url, actual_nav_event->source_main_frame_url); @@ -60,7 +61,7 @@ EXPECT_EQ(expected_destination_url, actual_nav_event->GetDestinationUrl()); EXPECT_EQ(expected_source_tab, actual_nav_event->source_tab_id); EXPECT_EQ(expected_target_tab, actual_nav_event->target_tab_id); - EXPECT_EQ(expected_is_user_initiated, actual_nav_event->is_user_initiated); + EXPECT_EQ(expected_nav_initiation, actual_nav_event->navigation_initiation); EXPECT_EQ(expected_has_committed, actual_nav_event->has_committed); EXPECT_EQ(expected_has_server_redirect, !actual_nav_event->server_redirect_urls.empty()); @@ -170,9 +171,9 @@ GURL("http://foo/1"), // destination_url tab_id, // source_tab_id tab_id, // target_tab_id - true, // is_user_initiated - true, // has_committed - false, // has_server_redirect + ReferrerChainEntry::BROWSER_INITIATED, + true, // has_committed + false, // has_server_redirect nav_list->Get(0U)); } @@ -187,16 +188,17 @@ browser()->tab_strip_model()->GetWebContentsAt(0)); auto* nav_list = navigation_event_list(); ASSERT_EQ(1U, nav_list->Size()); - VerifyNavigationEvent(GURL("http://foo/0"), // source_url - GURL("http://foo/0"), // source_main_frame_url - GURL("http://foo/3"), // original_request_url - GURL("http://redirect/1"), // destination_url - tab_id, // source_tab_id - tab_id, // target_tab_id - false, // is_user_initiated - true, // has_committed - true, // has_server_redirect - nav_list->Get(0U)); + VerifyNavigationEvent( + GURL("http://foo/0"), // source_url + GURL("http://foo/0"), // source_main_frame_url + GURL("http://foo/3"), // original_request_url + GURL("http://redirect/1"), // destination_url + tab_id, // source_tab_id + tab_id, // target_tab_id + ReferrerChainEntry::RENDERER_INITIATED_WITHOUT_USER_GESTURE, + true, // has_committed + true, // has_server_redirect + nav_list->Get(0U)); } TEST_F(SBNavigationObserverTest, TestCleanUpStaleNavigationEvents) {
diff --git a/chrome/browser/spellchecker/OWNERS b/chrome/browser/spellchecker/OWNERS index 1a4f0301..1ca3018 100644 --- a/chrome/browser/spellchecker/OWNERS +++ b/chrome/browser/spellchecker/OWNERS
@@ -1,4 +1,6 @@ groby@chromium.org rouslan@chromium.org +per-file spellcheck_language_policy_handler*=macourteau@chromium.org + # COMPONENT: UI>Browser>Spellcheck
diff --git a/chrome/browser/spellchecker/spellcheck_factory.cc b/chrome/browser/spellchecker/spellcheck_factory.cc index 148ec20..99e0e63 100644 --- a/chrome/browser/spellchecker/spellcheck_factory.cc +++ b/chrome/browser/spellchecker/spellcheck_factory.cc
@@ -70,6 +70,8 @@ user_prefs::PrefRegistrySyncable* user_prefs) { user_prefs->RegisterListPref(spellcheck::prefs::kSpellCheckDictionaries, base::MakeUnique<base::ListValue>()); + user_prefs->RegisterListPref(spellcheck::prefs::kSpellCheckForcedDictionaries, + base::MakeUnique<base::ListValue>()); // Continue registering kSpellCheckDictionary for preference migration. // TODO(estade): remove: crbug.com/751275 user_prefs->RegisterStringPref(
diff --git a/chrome/browser/spellchecker/spellcheck_language_policy_handler.cc b/chrome/browser/spellchecker/spellcheck_language_policy_handler.cc new file mode 100644 index 0000000..4d6f77b5 --- /dev/null +++ b/chrome/browser/spellchecker/spellcheck_language_policy_handler.cc
@@ -0,0 +1,59 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/spellchecker/spellcheck_language_policy_handler.h" + +#include "base/memory/ptr_util.h" +#include "base/strings/string_split.h" +#include "base/strings/string_util.h" +#include "base/values.h" +#include "chrome/common/pref_names.h" +#include "components/policy/policy_constants.h" +#include "components/prefs/pref_value_map.h" +#include "components/spellcheck/browser/pref_names.h" +#include "components/spellcheck/common/spellcheck_common.h" + +SpellcheckLanguagePolicyHandler::SpellcheckLanguagePolicyHandler() + : TypeCheckingPolicyHandler(policy::key::kSpellcheckLanguage, + base::Value::Type::LIST) {} + +SpellcheckLanguagePolicyHandler::~SpellcheckLanguagePolicyHandler() = default; + +bool SpellcheckLanguagePolicyHandler::CheckPolicySettings( + const policy::PolicyMap& policies, + policy::PolicyErrorMap* errors) { + const base::Value* value = nullptr; + if (!CheckAndGetValue(policies, errors, &value)) + return false; + return true; +} + +void SpellcheckLanguagePolicyHandler::ApplyPolicySettings( + const policy::PolicyMap& policies, + PrefValueMap* prefs) { + const base::Value* value = policies.GetValue(policy_name()); + if (!value) + return; + + const base::Value::ListStorage& languages = value->GetList(); + + std::unique_ptr<base::ListValue> forced_language_list = + base::MakeUnique<base::ListValue>(); + for (const base::Value& language : languages) { + std::string current_language = + spellcheck::GetCorrespondingSpellCheckLanguage( + base::TrimWhitespaceASCII(language.GetString(), base::TRIM_ALL) + .as_string()); + if (!current_language.empty()) { + forced_language_list->GetList().push_back(base::Value(current_language)); + } else { + LOG(WARNING) << "Unknown language requested: \"" << language << "\""; + } + } + + prefs->SetValue(spellcheck::prefs::kEnableSpellcheck, + base::MakeUnique<base::Value>(true)); + prefs->SetValue(spellcheck::prefs::kSpellCheckForcedDictionaries, + std::move(forced_language_list)); +}
diff --git a/chrome/browser/spellchecker/spellcheck_language_policy_handler.h b/chrome/browser/spellchecker/spellcheck_language_policy_handler.h new file mode 100644 index 0000000..4967d57 --- /dev/null +++ b/chrome/browser/spellchecker/spellcheck_language_policy_handler.h
@@ -0,0 +1,28 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_LANGUAGE_POLICY_HANDLER_H_ +#define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_LANGUAGE_POLICY_HANDLER_H_ + +#include "base/macros.h" +#include "components/policy/core/browser/configuration_policy_handler.h" + +// ConfigurationPolicyHandler for the SpellcheckLanguage policy. +class SpellcheckLanguagePolicyHandler + : public policy::TypeCheckingPolicyHandler { + public: + SpellcheckLanguagePolicyHandler(); + ~SpellcheckLanguagePolicyHandler() override; + + // ConfigurationPolicyHandler: + bool CheckPolicySettings(const policy::PolicyMap& policies, + policy::PolicyErrorMap* errors) override; + void ApplyPolicySettings(const policy::PolicyMap& policies, + PrefValueMap* prefs) override; + + private: + DISALLOW_COPY_AND_ASSIGN(SpellcheckLanguagePolicyHandler); +}; + +#endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_LANGUAGE_POLICY_HANDLER_H_
diff --git a/chrome/browser/spellchecker/spellcheck_service.cc b/chrome/browser/spellchecker/spellcheck_service.cc index 79b95080..17ed6382 100644 --- a/chrome/browser/spellchecker/spellcheck_service.cc +++ b/chrome/browser/spellchecker/spellcheck_service.cc
@@ -11,6 +11,7 @@ #include "base/strings/string_split.h" #include "base/supports_user_data.h" #include "base/synchronization/waitable_event.h" +#include "base/values.h" #include "build/build_config.h" #include "chrome/browser/spellchecker/spellcheck_factory.h" #include "chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h" @@ -84,19 +85,24 @@ pref_change_registrar_.Add( spellcheck::prefs::kSpellCheckDictionaries, - base::Bind(&SpellcheckService::OnSpellCheckDictionariesChanged, - base::Unretained(this))); + base::BindRepeating(&SpellcheckService::OnSpellCheckDictionariesChanged, + base::Unretained(this))); + pref_change_registrar_.Add( + spellcheck::prefs::kSpellCheckForcedDictionaries, + base::BindRepeating(&SpellcheckService::OnSpellCheckDictionariesChanged, + base::Unretained(this))); pref_change_registrar_.Add( spellcheck::prefs::kSpellCheckUseSpellingService, - base::Bind(&SpellcheckService::OnUseSpellingServiceChanged, - base::Unretained(this))); + base::BindRepeating(&SpellcheckService::OnUseSpellingServiceChanged, + base::Unretained(this))); pref_change_registrar_.Add( prefs::kAcceptLanguages, - base::Bind(&SpellcheckService::OnAcceptLanguagesChanged, - base::Unretained(this))); - pref_change_registrar_.Add(spellcheck::prefs::kEnableSpellcheck, - base::Bind(&SpellcheckService::InitForAllRenderers, - base::Unretained(this))); + base::BindRepeating(&SpellcheckService::OnAcceptLanguagesChanged, + base::Unretained(this))); + pref_change_registrar_.Add( + spellcheck::prefs::kEnableSpellcheck, + base::BindRepeating(&SpellcheckService::InitForAllRenderers, + base::Unretained(this))); custom_dictionary_.reset(new SpellcheckCustomDictionary(context_->GetPath())); custom_dictionary_->AddObserver(this); @@ -216,12 +222,19 @@ PrefService* prefs = user_prefs::UserPrefs::Get(context_); DCHECK(prefs); - const base::ListValue* dictionary_values = + const base::ListValue* user_dictionaries = prefs->GetList(spellcheck::prefs::kSpellCheckDictionaries); + const base::ListValue* forced_dictionaries = + prefs->GetList(spellcheck::prefs::kSpellCheckForcedDictionaries); - for (const auto& dictionary_value : *dictionary_values) { - std::string dictionary; - dictionary_value.GetAsString(&dictionary); + // Merge both lists of dictionaries. Use a set to avoid duplicates. + std::set<std::string> dictionaries; + for (const auto& dictionary_value : user_dictionaries->GetList()) + dictionaries.insert(dictionary_value.GetString()); + for (const auto& dictionary_value : forced_dictionaries->GetList()) + dictionaries.insert(dictionary_value.GetString()); + + for (const auto& dictionary : dictionaries) { hunspell_dictionaries_.push_back( base::MakeUnique<SpellcheckHunspellDictionary>( dictionary,
diff --git a/chrome/browser/ssl/security_state_tab_helper_browsertest.cc b/chrome/browser/ssl/security_state_tab_helper_browsertest.cc index d4b1e18..876326d 100644 --- a/chrome/browser/ssl/security_state_tab_helper_browsertest.cc +++ b/chrome/browser/ssl/security_state_tab_helper_browsertest.cc
@@ -240,11 +240,9 @@ void CheckSecureConnectionExplanation( const content::SecurityStyleExplanation& explanation, Browser* browser) { - EXPECT_EQ(l10n_util::GetStringUTF8(IDS_STRONG_SSL_SUMMARY), - explanation.summary); - content::WebContents* web_contents = browser->tab_strip_model()->GetActiveWebContents(); + security_state::SecurityInfo security_info; SecurityStateTabHelper::FromWebContents(web_contents) ->GetSecurityInfo(&security_info); @@ -253,6 +251,10 @@ int ssl_version = net::SSLConnectionStatusToVersion(security_info.connection_status); net::SSLVersionToString(&protocol, ssl_version); + EXPECT_EQ(l10n_util::GetStringFUTF8(IDS_STRONG_SSL_SUMMARY, + base::ASCIIToUTF16(protocol)), + explanation.summary); + bool is_aead, is_tls13; uint16_t cipher_suite = net::SSLConnectionStatusToCipherSuite(security_info.connection_status); @@ -2364,12 +2366,17 @@ // TLS settings, so it should remain at WebSecurityStyleSecure. EXPECT_EQ(blink::kWebSecurityStyleSecure, observer.latest_security_style()); - // The messages explaining the security style do, however, get - // downgraded: SECURE_PROTOCOL_AND_CIPHERSUITE should not show up when - // the TLS settings are obsolete. + security_state::SecurityInfo security_info; + SecurityStateTabHelper::FromWebContents(web_contents) + ->GetSecurityInfo(&security_info); + const char* protocol; + int ssl_version = + net::SSLConnectionStatusToVersion(security_info.connection_status); + net::SSLVersionToString(&protocol, ssl_version); for (const auto& explanation : observer.latest_explanations().secure_explanations) { - EXPECT_NE(l10n_util::GetStringUTF8(IDS_STRONG_SSL_SUMMARY), + EXPECT_NE(l10n_util::GetStringFUTF8(IDS_STRONG_SSL_SUMMARY, + base::ASCIIToUTF16(protocol)), explanation.summary); }
diff --git a/chrome/browser/storage/storage_info_fetcher.cc b/chrome/browser/storage/storage_info_fetcher.cc index 7aa1748db..28e841ae 100644 --- a/chrome/browser/storage/storage_info_fetcher.cc +++ b/chrome/browser/storage/storage_info_fetcher.cc
@@ -80,7 +80,7 @@ Release(); } -void StorageInfoFetcher::OnUsageClearedInternal(storage::QuotaStatusCode code) { +void StorageInfoFetcher::OnUsageClearedInternal(blink::QuotaStatusCode code) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); quota_manager_->ResetUsageTracker(type_to_delete_); @@ -90,7 +90,7 @@ base::Bind(&StorageInfoFetcher::OnClearCompleted, this, code)); } -void StorageInfoFetcher::OnClearCompleted(storage::QuotaStatusCode code) { +void StorageInfoFetcher::OnClearCompleted(blink::QuotaStatusCode code) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); clear_callback_.Run(code);
diff --git a/chrome/browser/storage/storage_info_fetcher.h b/chrome/browser/storage/storage_info_fetcher.h index 50465cf..6b111f9e 100644 --- a/chrome/browser/storage/storage_info_fetcher.h +++ b/chrome/browser/storage/storage_info_fetcher.h
@@ -20,8 +20,7 @@ public: using FetchCallback = base::Callback<void(const storage::UsageInfoEntries&)>; - using ClearCallback = - base::Callback<void(storage::QuotaStatusCode code)>; + using ClearCallback = base::Callback<void(blink::QuotaStatusCode code)>; explicit StorageInfoFetcher(Profile* profile); @@ -49,10 +48,10 @@ void OnFetchCompleted(); // Called when usage has been cleared. - void OnUsageClearedInternal(storage::QuotaStatusCode code); + void OnUsageClearedInternal(blink::QuotaStatusCode code); // Reports back to all observers that storage has been deleted. - void OnClearCompleted(storage::QuotaStatusCode code); + void OnClearCompleted(blink::QuotaStatusCode code); // The quota manager to use to calculate the storage usage. storage::QuotaManager* quota_manager_;
diff --git a/chrome/browser/subresource_filter/subresource_filter_settings_browsertest.cc b/chrome/browser/subresource_filter/subresource_filter_settings_browsertest.cc index 873cb32..1409c70 100644 --- a/chrome/browser/subresource_filter/subresource_filter_settings_browsertest.cc +++ b/chrome/browser/subresource_filter/subresource_filter_settings_browsertest.cc
@@ -65,6 +65,33 @@ } IN_PROC_BROWSER_TEST_F(SubresourceFilterSettingsBrowserTest, + ContentSettingsWhitelistGlobal_DoNotActivate) { + ASSERT_NO_FATAL_FAILURE( + SetRulesetToDisallowURLsWithPathSuffix("included_script.js")); + GURL url(GetTestUrl("subresource_filter/frame_with_included_script.html")); + ConfigureAsPhishingURL(url); + + ui_test_utils::NavigateToURL(browser(), url); + EXPECT_FALSE(WasParsedScriptElementLoaded(web_contents()->GetMainFrame())); + + content::ConsoleObserverDelegate console_observer(web_contents(), + kActivationConsoleMessage); + web_contents()->SetDelegate(&console_observer); + + // Simulate globally allowing ads via content settings. + HostContentSettingsMap* settings_map = + HostContentSettingsMapFactory::GetForProfile(browser()->profile()); + settings_map->SetDefaultContentSetting( + ContentSettingsType::CONTENT_SETTINGS_TYPE_ADS, CONTENT_SETTING_ALLOW); + + ui_test_utils::NavigateToURL(browser(), url); + EXPECT_TRUE(WasParsedScriptElementLoaded(web_contents()->GetMainFrame())); + + // No message for loads that are not activated. + EXPECT_TRUE(console_observer.message().empty()); +} + +IN_PROC_BROWSER_TEST_F(SubresourceFilterSettingsBrowserTest, ContentSettingsAllowWithNoPageActivation_DoNotActivate) { ASSERT_NO_FATAL_FAILURE( SetRulesetToDisallowURLsWithPathSuffix("included_script.js"));
diff --git a/chrome/browser/sync/test/integration/sync_test.h b/chrome/browser/sync/test/integration/sync_test.h index 898ecd5..aec2910 100644 --- a/chrome/browser/sync/test/integration/sync_test.h +++ b/chrome/browser/sync/test/integration/sync_test.h
@@ -12,6 +12,7 @@ #include "base/compiler_specific.h" #include "base/macros.h" #include "base/process/process.h" +#include "chrome/browser/extensions/install_verifier.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sync/test/integration/configuration_refresher.h" #include "chrome/test/base/in_process_browser_test.h" @@ -463,6 +464,9 @@ // Profile object is created. If empty, no preexisting file will be written. std::string preexisting_preferences_file_contents_; + // Disable extension install verification. + extensions::ScopedInstallVerifierBypassForTest ignore_install_verification_; + DISALLOW_COPY_AND_ASSIGN(SyncTest); };
diff --git a/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc b/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc index 30f36873e..e3206a3 100644 --- a/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc +++ b/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc
@@ -196,7 +196,7 @@ void DidGetUsageAndQuota(const storage::StatusCallback& callback, int64_t* usage_out, int64_t* quota_out, - storage::QuotaStatusCode status, + blink::QuotaStatusCode status, int64_t usage, int64_t quota) { *usage_out = usage; @@ -464,10 +464,10 @@ origin_, type_)); } -storage::QuotaStatusCode CannedSyncableFileSystem::GetUsageAndQuota( +blink::QuotaStatusCode CannedSyncableFileSystem::GetUsageAndQuota( int64_t* usage, int64_t* quota) { - return RunOnThread<storage::QuotaStatusCode>( + return RunOnThread<blink::QuotaStatusCode>( io_task_runner_.get(), FROM_HERE, base::BindOnce(&CannedSyncableFileSystem::DoGetUsageAndQuota, base::Unretained(this), usage, quota));
diff --git a/chrome/browser/sync_file_system/local/canned_syncable_file_system.h b/chrome/browser/sync_file_system/local/canned_syncable_file_system.h index 4d3eaf2..f531d197a 100644 --- a/chrome/browser/sync_file_system/local/canned_syncable_file_system.h +++ b/chrome/browser/sync_file_system/local/canned_syncable_file_system.h
@@ -25,6 +25,7 @@ #include "storage/common/fileapi/file_system_types.h" #include "storage/common/fileapi/file_system_util.h" #include "storage/common/quota/quota_types.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" namespace base { class SingleThreadTaskRunner; @@ -151,7 +152,7 @@ base::File::Error DeleteFileSystem(); // Retrieves the quota and usage. - storage::QuotaStatusCode GetUsageAndQuota(int64_t* usage, int64_t* quota); + blink::QuotaStatusCode GetUsageAndQuota(int64_t* usage, int64_t* quota); // ChangeTracker related methods. They run on file task runner. void GetChangedURLsInTracker(storage::FileSystemURLSet* urls);
diff --git a/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc b/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc index de43b584..f0c1d784 100644 --- a/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc +++ b/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc
@@ -611,7 +611,7 @@ // Record the initial usage (likely 0). int64_t initial_usage = -1; int64_t quota = -1; - EXPECT_EQ(storage::kQuotaStatusOk, + EXPECT_EQ(blink::QuotaStatusCode::kOk, file_system.GetUsageAndQuota(&initial_usage, "a)); // Create a file and directory in the file_system. @@ -637,7 +637,7 @@ // At this point the usage must be greater than the initial usage. int64_t new_usage = -1; - EXPECT_EQ(storage::kQuotaStatusOk, + EXPECT_EQ(blink::QuotaStatusCode::kOk, file_system.GetUsageAndQuota(&new_usage, "a)); EXPECT_GT(new_usage, initial_usage); @@ -673,7 +673,7 @@ EXPECT_TRUE(urls.empty()); // The quota usage data must have reflected the deletion. - EXPECT_EQ(storage::kQuotaStatusOk, + EXPECT_EQ(blink::QuotaStatusCode::kOk, file_system.GetUsageAndQuota(&new_usage, "a)); EXPECT_EQ(new_usage, initial_usage); @@ -699,7 +699,7 @@ // Record the initial usage (likely 0). int64_t initial_usage = -1; int64_t quota = -1; - EXPECT_EQ(storage::kQuotaStatusOk, + EXPECT_EQ(blink::QuotaStatusCode::kOk, file_system.GetUsageAndQuota(&initial_usage, "a)); // Create a file and directory in the file_system. @@ -713,7 +713,7 @@ // At this point the usage must be greater than the initial usage. int64_t new_usage = -1; - EXPECT_EQ(storage::kQuotaStatusOk, + EXPECT_EQ(blink::QuotaStatusCode::kOk, file_system.GetUsageAndQuota(&new_usage, "a)); EXPECT_GT(new_usage, initial_usage); @@ -740,7 +740,7 @@ EXPECT_TRUE(urls.empty()); // The quota usage data must have reflected the deletion. - EXPECT_EQ(storage::kQuotaStatusOk, + EXPECT_EQ(blink::QuotaStatusCode::kOk, file_system.GetUsageAndQuota(&new_usage, "a)); EXPECT_EQ(new_usage, initial_usage); @@ -806,7 +806,7 @@ // Record the usage. int64_t usage = -1, new_usage = -1; int64_t quota = -1; - EXPECT_EQ(storage::kQuotaStatusOk, + EXPECT_EQ(blink::QuotaStatusCode::kOk, file_system.GetUsageAndQuota(&usage, "a)); // Here in the local filesystem we have: @@ -833,7 +833,7 @@ // Check if the usage has been increased by (kTestFileData1 - kTestFileData0). const int updated_size = arraysize(kTestFileData1) - arraysize(kTestFileData0); - EXPECT_EQ(storage::kQuotaStatusOk, + EXPECT_EQ(blink::QuotaStatusCode::kOk, file_system.GetUsageAndQuota(&new_usage, "a)); EXPECT_EQ(updated_size, new_usage - usage); @@ -880,7 +880,7 @@ // Creating a file/directory must have increased the usage more than // the size of kTestFileData2. new_usage = usage; - EXPECT_EQ(storage::kQuotaStatusOk, + EXPECT_EQ(blink::QuotaStatusCode::kOk, file_system.GetUsageAndQuota(&new_usage, "a)); EXPECT_GT(new_usage, static_cast<int64_t>(usage + arraysize(kTestFileData2) - 1));
diff --git a/chrome/browser/sync_file_system/local/syncable_file_system_unittest.cc b/chrome/browser/sync_file_system/local/syncable_file_system_unittest.cc index 0c0c5bef..1839bd5 100644 --- a/chrome/browser/sync_file_system/local/syncable_file_system_unittest.cc +++ b/chrome/browser/sync_file_system/local/syncable_file_system_unittest.cc
@@ -30,7 +30,6 @@ using storage::FileSystemURL; using storage::FileSystemURLSet; using storage::QuotaManager; -using storage::QuotaStatusCode; namespace sync_file_system { @@ -129,7 +128,7 @@ const int64_t kQuota = 12345 * 1024; QuotaManager::kSyncableStorageDefaultHostQuota = kQuota; int64_t usage, quota; - EXPECT_EQ(storage::kQuotaStatusOk, + EXPECT_EQ(blink::QuotaStatusCode::kOk, file_system_.GetUsageAndQuota(&usage, "a)); // Returned quota must be what we overrode. Usage must be greater than 0 @@ -146,7 +145,7 @@ file_system_.TruncateFile(URL("dir/foo"), kFileSizeToExtend)); int64_t new_usage; - EXPECT_EQ(storage::kQuotaStatusOk, + EXPECT_EQ(blink::QuotaStatusCode::kOk, file_system_.GetUsageAndQuota(&new_usage, "a)); EXPECT_EQ(kFileSizeToExtend, new_usage - usage); @@ -157,7 +156,7 @@ file_system_.TruncateFile(URL("dir/foo"), kFileSizeToExtend + 1)); usage = new_usage; - EXPECT_EQ(storage::kQuotaStatusOk, + EXPECT_EQ(blink::QuotaStatusCode::kOk, file_system_.GetUsageAndQuota(&new_usage, "a)); EXPECT_EQ(usage, new_usage); @@ -166,7 +165,7 @@ file_system_.DeleteFileSystem()); // Now the usage must be zero. - EXPECT_EQ(storage::kQuotaStatusOk, + EXPECT_EQ(blink::QuotaStatusCode::kOk, file_system_.GetUsageAndQuota(&usage, "a)); EXPECT_EQ(0, usage);
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.cc b/chrome/browser/ui/ash/chrome_shell_delegate.cc index 8cd1d09..9017d62 100644 --- a/chrome/browser/ui/ash/chrome_shell_delegate.cc +++ b/chrome/browser/ui/ash/chrome_shell_delegate.cc
@@ -377,11 +377,6 @@ Navigate(¶ms); } -gfx::Image ChromeShellDelegate::GetDeprecatedAcceleratorImage() const { - return ui::ResourceBundle::GetSharedInstance().GetImageNamed( - IDR_BLUETOOTH_KEYBOARD); -} - std::unique_ptr<keyboard::KeyboardUI> ChromeShellDelegate::CreateKeyboardUI() { return base::MakeUnique<ChromeKeyboardUI>( ProfileManager::GetActiveUserProfile());
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.h b/chrome/browser/ui/ash/chrome_shell_delegate.h index e4d6a6c64..9241c54 100644 --- a/chrome/browser/ui/ash/chrome_shell_delegate.h +++ b/chrome/browser/ui/ash/chrome_shell_delegate.h
@@ -43,7 +43,6 @@ ash::AccessibilityDelegate* CreateAccessibilityDelegate() override; base::string16 GetProductName() const override; void OpenKeyboardShortcutHelpPage() const override; - gfx::Image GetDeprecatedAcceleratorImage() const override; ui::InputDeviceControllerClient* GetInputDeviceControllerClient() override; // content::NotificationObserver override:
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc index 6b6429c9..d0a4aa6 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc
@@ -192,10 +192,11 @@ DCHECK(!instance_); instance_ = this; - // ShelfModel initializes the app list item. + // ShelfModel initializes the app list item and back button. DCHECK(model_); - DCHECK_EQ(1, model_->item_count()); - DCHECK_EQ(ash::kAppListId, model_->items()[0].id.app_id); + DCHECK_EQ(2, model_->item_count()); + DCHECK_EQ(ash::kBackButtonId, model_->items()[0].id.app_id); + DCHECK_EQ(ash::kAppListId, model_->items()[1].id.app_id); // Start observing the shelf controller. if (ConnectToShelfController()) { @@ -972,8 +973,10 @@ profile()->GetPrefs(), launcher_controller_helper_.get()); int index = 0; - // Skip app list items if it exists. - if (model_->items()[0].type == ash::TYPE_APP_LIST) + // Skip the app list and back button if they exist. + if (model_->items()[0].type == ash::TYPE_BACK_BUTTON) + ++index; + if (model_->items()[1].type == ash::TYPE_APP_LIST) ++index; // Apply pins in two steps. At the first step, go through the list of apps to @@ -1243,16 +1246,22 @@ DCHECK(shelf_controller_) << " Unexpected model sync"; DCHECK(!applying_remote_shelf_model_changes_) << " Unexpected model change"; + // Ignore the back button; it should already exist in the local ShelfModel. + if (item.id.app_id == ash::kBackButtonId) { + DCHECK_EQ(0, model_->ItemIndexByID(item.id)); + return; + } + // Ignore the AppList item; it should already exist in the local ShelfModel. if (item.id.app_id == ash::kAppListId) { - DCHECK_EQ(0, model_->ItemIndexByID(item.id)); + DCHECK_EQ(1, model_->ItemIndexByID(item.id)); return; } // Ash items should be sent without images for efficiency. DCHECK(item.image.isNull()) << " Chrome does not need item images from Ash"; DCHECK_LE(index, model_->item_count()) << " Index out of bounds"; - DCHECK_GT(index, 0) << " Items can not preceed the AppList"; + DCHECK_GT(index, 1) << " Items can not preceed the AppList"; index = std::min(std::max(index, 1), model_->item_count()); base::AutoReset<bool> reset(&applying_remote_shelf_model_changes_, true); model_->AddAt(index, item); @@ -1389,6 +1398,7 @@ shelf_controller_->MoveShelfItem(item.id, target_index); // Update the pin position preference as needed. + DCHECK_NE(ash::TYPE_BACK_BUTTON, item.type); DCHECK_NE(ash::TYPE_APP_LIST, item.type); if (ItemTypeIsPinned(item) && should_sync_pin_changes_) SyncPinPosition(item.id);
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc index 7be0099..0b1954c 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
@@ -1288,8 +1288,8 @@ const Extension* extension1 = LoadAndLaunchPlatformApp("launch", "Launched"); ui::BaseWindow* window1 = CreateAppWindow(browser()->profile(), extension1)->GetBaseWindow(); - const ash::ShelfItem& item = GetLastLauncherItem(); + const ash::ShelfItem item = GetLastLauncherItem(); EXPECT_EQ(ash::TYPE_APP, item.type); EXPECT_EQ(ash::STATUS_RUNNING, item.status); @@ -1557,8 +1557,9 @@ AltNumberBrowserTabbing) { // Get the number of items in the browser menu. EXPECT_EQ(0u, chrome::GetTotalBrowserCount()); - // The first activation should create a browser at index 1 (App List @ 0). - const ash::ShelfID browser_id = shelf_model()->items()[1].id; + // The first activation should create a browser at index 2 (App List @ 0 and + // back button @ 1). + const ash::ShelfID browser_id = shelf_model()->items()[2].id; SelectItem(browser_id, ui::ET_KEY_RELEASED); EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); // A second activation should not create a new instance. @@ -2050,7 +2051,7 @@ EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); EXPECT_EQ(1, browser()->tab_strip_model()->count()); EXPECT_EQ(0, browser()->tab_strip_model()->active_index()); - EXPECT_EQ(2, shelf_model()->item_count()); + EXPECT_EQ(3, shelf_model()->item_count()); aura::Window* window = browser()->window()->GetNativeWindow(); @@ -2061,7 +2062,7 @@ EXPECT_EQ(browser_id, id); ash::ShelfID app_id = CreateShortcut("app1"); - EXPECT_EQ(3, shelf_model()->item_count()); + EXPECT_EQ(4, shelf_model()->item_count()); // Create and activate a new tab for "app1" and expect an application ShelfID. SelectItem(app_id); @@ -2126,8 +2127,8 @@ // Get the number of items in the shelf and browser menu. int item_count = shelf_model()->item_count(); - // At least App List should exist. - ASSERT_GE(item_count, 1); + // At least App List and back button should exist. + ASSERT_GE(item_count, 2); size_t browser_count = NumberOfDetectedLauncherBrowsers(false); // Open a settings window. Number of browser items should remain unchanged, @@ -2276,13 +2277,15 @@ IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); } -// Chrome's ShelfModel should have AppList and browser items and delegates. +// Chrome's ShelfModel should have back button, AppList and browser items and +// delegates. IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, ShelfModelInitialization) { - EXPECT_EQ(2, shelf_model()->item_count()); - EXPECT_EQ(ash::kAppListId, shelf_model()->items()[0].id.app_id); - EXPECT_TRUE( - shelf_model()->GetShelfItemDelegate(shelf_model()->items()[0].id)); - EXPECT_EQ(extension_misc::kChromeAppId, shelf_model()->items()[1].id.app_id); + EXPECT_EQ(3, shelf_model()->item_count()); + EXPECT_EQ(ash::kBackButtonId, shelf_model()->items()[0].id.app_id); + EXPECT_EQ(ash::kAppListId, shelf_model()->items()[1].id.app_id); EXPECT_TRUE( shelf_model()->GetShelfItemDelegate(shelf_model()->items()[1].id)); + EXPECT_EQ(extension_misc::kChromeAppId, shelf_model()->items()[2].id.app_id); + EXPECT_TRUE( + shelf_model()->GetShelfItemDelegate(shelf_model()->items()[2].id)); }
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc index 458e1ca..aea03a3 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc
@@ -506,13 +506,13 @@ virtual void SetUpMultiUserScenario(syncer::SyncChangeList* user_a, syncer::SyncChangeList* user_b) { InitLauncherController(); - EXPECT_EQ("AppList, Chrome", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome", GetPinnedAppStatus()); // Set an empty pinned pref to begin with. syncer::SyncChangeList sync_list; InsertAddPinChange(&sync_list, 0, extension_misc::kChromeAppId); SendPinChanges(sync_list, true); - EXPECT_EQ("AppList, Chrome", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome", GetPinnedAppStatus()); // Assume all applications have been added already. extension_service_->AddExtension(extension1_.get()); @@ -525,7 +525,7 @@ extension_service_->AddExtension(extension8_.get()); extension_service_->AddExtension(extension_platform_app_.get()); // There should be nothing in the list by now. - EXPECT_EQ("AppList, Chrome", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome", GetPinnedAppStatus()); // Set user a preferences. InsertAddPinChange(user_a, 0, extension1_->id()); @@ -875,6 +875,9 @@ case ash::TYPE_APP_LIST: result += "AppList"; break; + case ash::TYPE_BACK_BUTTON: + result += "Back"; + break; default: result += "Unknown"; break; @@ -1297,8 +1300,9 @@ TEST_F(ChromeLauncherControllerTest, DefaultApps) { InitLauncherController(); - // The model should only contain the browser shortcut and app list items. - EXPECT_EQ(2, model_->item_count()); + // The model should only contain the browser shortcut, app list and back + // button items. + EXPECT_EQ(3, model_->item_count()); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension2_->id())); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension3_->id())); @@ -1306,7 +1310,7 @@ // Installing |extension3_| should add it to the launcher - behind the // chrome icon. extension_service_->AddExtension(extension3_.get()); - EXPECT_EQ("AppList, Chrome, App3", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App3", GetPinnedAppStatus()); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension2_->id())); } @@ -1342,7 +1346,7 @@ EXPECT_FALSE(launcher_controller_->IsAppPinned(arc_app_id2)); EXPECT_TRUE(launcher_controller_->IsAppPinned(extension3_->id())); EXPECT_FALSE(launcher_controller_->IsAppPinned(arc_app_id3)); - EXPECT_EQ("AppList, App1, Chrome, App2, App3", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, App1, Chrome, App2, App3", GetPinnedAppStatus()); // Persist pin state, we don't have active pin for ARC apps yet, but pin // model should have it. @@ -1367,15 +1371,15 @@ EXPECT_TRUE(launcher_controller_->IsAppPinned(extension3_->id())); EXPECT_FALSE(launcher_controller_->IsAppPinned(arc_app_id3)); - EXPECT_EQ("AppList, App1, Chrome, Fake App 0, App2, Fake App 1, App3", + EXPECT_EQ("Back, AppList, App1, Chrome, Fake App 0, App2, Fake App 1, App3", GetPinnedAppStatus()); // Now move pins on ARC enabled platform. - model_->Move(1, 4); - model_->Move(3, 1); - model_->Move(3, 5); + model_->Move(2, 5); model_->Move(4, 2); - EXPECT_EQ("AppList, App2, Fake App 1, Chrome, App1, Fake App 0, App3", + model_->Move(4, 6); + model_->Move(5, 3); + EXPECT_EQ("Back, AppList, App2, Fake App 1, Chrome, App1, Fake App 0, App3", GetPinnedAppStatus()); copy_sync_list = app_service_->GetAllSyncData(syncer::APP_LIST); @@ -1401,12 +1405,12 @@ EXPECT_FALSE(launcher_controller_->IsAppPinned(arc_app_id2)); EXPECT_TRUE(launcher_controller_->IsAppPinned(extension3_->id())); EXPECT_FALSE(launcher_controller_->IsAppPinned(arc_app_id3)); - EXPECT_EQ("AppList, App2, Chrome, App1, App3", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, App2, Chrome, App1, App3", GetPinnedAppStatus()); // Now move/remove pins on ARC disabled platform. - model_->Move(4, 2); + model_->Move(5, 3); launcher_controller_->UnpinAppWithID(extension2_->id()); - EXPECT_EQ("AppList, App3, Chrome, App1", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, App3, Chrome, App1", GetPinnedAppStatus()); EnablePlayStore(true); SendListOfArcApps(); @@ -1417,7 +1421,7 @@ EXPECT_TRUE(launcher_controller_->IsAppPinned(arc_app_id2)); EXPECT_TRUE(launcher_controller_->IsAppPinned(extension3_->id())); EXPECT_FALSE(launcher_controller_->IsAppPinned(arc_app_id3)); - EXPECT_EQ("AppList, Fake App 1, App3, Chrome, App1, Fake App 0", + EXPECT_EQ("Back, AppList, Fake App 1, App3, Chrome, App1, Fake App 0", GetPinnedAppStatus()); } @@ -1463,7 +1467,8 @@ GetPinnableForAppID(extension4_->id(), profile())); // Check the order of shelf pinned apps - EXPECT_EQ("AppList, App2, App4, App1, Chrome, App3", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, App2, App4, App1, Chrome, App3", + GetPinnedAppStatus()); } // Check that the restauration of launcher items is happening in the same order @@ -1482,7 +1487,7 @@ EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension2_->id())); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension3_->id())); - EXPECT_EQ("AppList, Chrome", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome", GetPinnedAppStatus()); // Installing |extension3_| should add it to the shelf - behind the // chrome icon. @@ -1490,18 +1495,18 @@ extension_service_->AddExtension(extension3_.get()); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension2_->id())); - EXPECT_EQ("AppList, Chrome, App3", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App3", GetPinnedAppStatus()); // Installing |extension2_| should add it to the launcher - behind the // chrome icon, but in first location. extension_service_->AddExtension(extension2_.get()); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); - EXPECT_EQ("AppList, Chrome, App2, App3", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App2, App3", GetPinnedAppStatus()); // Installing |extension1_| should add it to the launcher - behind the // chrome icon, but in first location. extension_service_->AddExtension(extension1_.get()); - EXPECT_EQ("AppList, Chrome, App1, App2, App3", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App1, App2, App3", GetPinnedAppStatus()); } // Check that the restauration of launcher items is happening in the same order @@ -1520,25 +1525,25 @@ EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension2_->id())); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension3_->id())); - EXPECT_EQ("AppList, Chrome", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome", GetPinnedAppStatus()); // Installing |extension2_| should add it to the launcher - behind the // chrome icon. extension_service_->AddExtension(extension2_.get()); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension3_->id())); - EXPECT_EQ("AppList, Chrome, App2", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App2", GetPinnedAppStatus()); // Installing |extension1_| should add it to the launcher - behind the // chrome icon, but in first location. extension_service_->AddExtension(extension1_.get()); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension3_->id())); - EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App1, App2", GetPinnedAppStatus()); // Installing |extension3_| should add it to the launcher - behind the // chrome icon, but in first location. extension_service_->AddExtension(extension3_.get()); - EXPECT_EQ("AppList, Chrome, App1, App2, App3", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App1, App2, App3", GetPinnedAppStatus()); } // Check that the restauration of launcher items is happening in the same order @@ -1558,7 +1563,7 @@ EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension2_->id())); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension3_->id())); - EXPECT_EQ("AppList, Chrome", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome", GetPinnedAppStatus()); // Installing |extension2_| should add it to the shelf - behind the // chrome icon. @@ -1566,18 +1571,18 @@ extension_service_->AddExtension(extension2_.get()); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension3_->id())); - EXPECT_EQ("AppList, Chrome, App2", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App2", GetPinnedAppStatus()); // Installing |extension1_| should add it to the launcher - behind the // chrome icon, but in first location. extension_service_->AddExtension(extension1_.get()); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension3_->id())); - EXPECT_EQ("AppList, App1, Chrome, App2", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, App1, Chrome, App2", GetPinnedAppStatus()); // Installing |extension3_| should add it to the launcher - behind the // chrome icon, but in first location. extension_service_->AddExtension(extension3_.get()); - EXPECT_EQ("AppList, App1, Chrome, App2, App3", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, App1, Chrome, App2, App3", GetPinnedAppStatus()); } // Check that syncing to a different state does the correct thing. @@ -1592,11 +1597,11 @@ // The shelf layout has always one static item at the beginning (App List). extension_service_->AddExtension(extension2_.get()); - EXPECT_EQ("AppList, Chrome, App2", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App2", GetPinnedAppStatus()); extension_service_->AddExtension(extension1_.get()); - EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App1, App2", GetPinnedAppStatus()); extension_service_->AddExtension(extension3_.get()); - EXPECT_EQ("AppList, Chrome, App1, App2, App3", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App1, App2, App3", GetPinnedAppStatus()); // Change the order with increasing chrome position and decreasing position. syncer::SyncChangeList sync_list1; @@ -1605,7 +1610,7 @@ InsertAddPinChange(&sync_list1, 2, extension2_->id()); InsertAddPinChange(&sync_list1, 3, extension_misc::kChromeAppId); SendPinChanges(sync_list1, true); - EXPECT_EQ("AppList, App3, App1, App2, Chrome", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, App3, App1, App2, Chrome", GetPinnedAppStatus()); syncer::SyncChangeList sync_list2; InsertAddPinChange(&sync_list2, 0, extension2_->id()); @@ -1613,7 +1618,7 @@ InsertAddPinChange(&sync_list2, 2, extension_misc::kChromeAppId); InsertAddPinChange(&sync_list2, 3, extension1_->id()); SendPinChanges(sync_list2, true); - EXPECT_EQ("AppList, App2, App3, Chrome, App1", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, App2, App3, Chrome, App1", GetPinnedAppStatus()); // Check that the chrome icon can also be at the first possible location. syncer::SyncChangeList sync_list3; @@ -1621,97 +1626,99 @@ InsertAddPinChange(&sync_list3, 1, extension2_->id()); InsertAddPinChange(&sync_list3, 2, extension1_->id()); SendPinChanges(sync_list3, true); - EXPECT_EQ("AppList, Chrome, App3, App2, App1", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App3, App2, App1", GetPinnedAppStatus()); // Check that unloading of extensions works as expected. extension_service_->UnloadExtension(extension1_->id(), UnloadedExtensionReason::UNINSTALL); - EXPECT_EQ("AppList, Chrome, App3, App2", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App3, App2", GetPinnedAppStatus()); extension_service_->UnloadExtension(extension2_->id(), UnloadedExtensionReason::UNINSTALL); - EXPECT_EQ("AppList, Chrome, App3", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App3", GetPinnedAppStatus()); // Check that an update of an extension does not crash the system. extension_service_->UnloadExtension(extension3_->id(), UnloadedExtensionReason::UPDATE); - EXPECT_EQ("AppList, Chrome, App3", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App3", GetPinnedAppStatus()); } // Test the V1 app interaction flow: run it, activate it, close it. TEST_F(ChromeLauncherControllerTest, V1AppRunActivateClose) { InitLauncherController(); - // The model should only contain the browser shortcut and app list items. - EXPECT_EQ(2, model_->item_count()); + // The model should only contain the browser shortcut, app list and back + // button items. + EXPECT_EQ(3, model_->item_count()); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); EXPECT_EQ(nullptr, launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); // Reporting that the app is running should create a new shelf item. launcher_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_RUNNING); - EXPECT_EQ(3, model_->item_count()); - EXPECT_EQ(ash::TYPE_APP, model_->items()[2].type); - EXPECT_EQ(ash::STATUS_RUNNING, model_->items()[2].status); + EXPECT_EQ(4, model_->item_count()); + EXPECT_EQ(ash::TYPE_APP, model_->items()[3].type); + EXPECT_EQ(ash::STATUS_RUNNING, model_->items()[3].status); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); EXPECT_NE(nullptr, launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); // Reporting that the app is running again should have no effect. launcher_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_RUNNING); - EXPECT_EQ(3, model_->item_count()); - EXPECT_EQ(ash::STATUS_RUNNING, model_->items()[2].status); + EXPECT_EQ(4, model_->item_count()); + EXPECT_EQ(ash::STATUS_RUNNING, model_->items()[3].status); // Reporting that the app is closed should remove its shelf item. launcher_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_CLOSED); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); EXPECT_EQ(nullptr, launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); // Reporting that the app is closed again should have no effect. launcher_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_CLOSED); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); } // Test the V1 app interaction flow: pin it, run it, close it, unpin it. TEST_F(ChromeLauncherControllerTest, V1AppPinRunCloseUnpin) { InitLauncherController(); - // The model should only contain the browser shortcut and app list items. - EXPECT_EQ(2, model_->item_count()); + // The model should only contain the browser shortcut, app list and back + // button items. + EXPECT_EQ(3, model_->item_count()); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); EXPECT_EQ(nullptr, launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); // Pinning the app should create a new shelf item. launcher_controller_->PinAppWithID(extension1_->id()); - EXPECT_EQ(3, model_->item_count()); - EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[2].type); - EXPECT_EQ(ash::STATUS_CLOSED, model_->items()[2].status); + EXPECT_EQ(4, model_->item_count()); + EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[3].type); + EXPECT_EQ(ash::STATUS_CLOSED, model_->items()[3].status); EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); EXPECT_NE(nullptr, launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); // Reporting that the app is running should just update the existing item. launcher_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_RUNNING); - EXPECT_EQ(3, model_->item_count()); - EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[2].type); - EXPECT_EQ(ash::STATUS_RUNNING, model_->items()[2].status); + EXPECT_EQ(4, model_->item_count()); + EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[3].type); + EXPECT_EQ(ash::STATUS_RUNNING, model_->items()[3].status); EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); EXPECT_NE(nullptr, launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); // Reporting that the app is closed should just update the existing item. launcher_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_CLOSED); - EXPECT_EQ(3, model_->item_count()); - EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[2].type); - EXPECT_EQ(ash::STATUS_CLOSED, model_->items()[2].status); + EXPECT_EQ(4, model_->item_count()); + EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[3].type); + EXPECT_EQ(ash::STATUS_CLOSED, model_->items()[3].status); EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); EXPECT_NE(nullptr, launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); // Unpinning the app should remove its shelf item. launcher_controller_->UnpinAppWithID(extension1_->id()); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); EXPECT_EQ(nullptr, launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); @@ -1720,42 +1727,44 @@ // Test the V1 app interaction flow: run it, pin it, close it, unpin it. TEST_F(ChromeLauncherControllerTest, V1AppRunPinCloseUnpin) { InitLauncherController(); - // The model should only contain the browser shortcut and app list items. - EXPECT_EQ(2, model_->item_count()); + + // The model should only contain the browser shortcut, app list and back + // button items. + EXPECT_EQ(3, model_->item_count()); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); EXPECT_EQ(nullptr, launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); // Reporting that the app is running should create a new shelf item. launcher_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_RUNNING); - EXPECT_EQ(3, model_->item_count()); - EXPECT_EQ(ash::TYPE_APP, model_->items()[2].type); - EXPECT_EQ(ash::STATUS_RUNNING, model_->items()[2].status); + EXPECT_EQ(4, model_->item_count()); + EXPECT_EQ(ash::TYPE_APP, model_->items()[3].type); + EXPECT_EQ(ash::STATUS_RUNNING, model_->items()[3].status); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); EXPECT_NE(nullptr, launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); // Pinning the app should just update the existing item. launcher_controller_->PinAppWithID(extension1_->id()); - EXPECT_EQ(3, model_->item_count()); - EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[2].type); - EXPECT_EQ(ash::STATUS_RUNNING, model_->items()[2].status); + EXPECT_EQ(4, model_->item_count()); + EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[3].type); + EXPECT_EQ(ash::STATUS_RUNNING, model_->items()[3].status); EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); EXPECT_NE(nullptr, launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); // Reporting that the app is closed should just update the existing item. launcher_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_CLOSED); - EXPECT_EQ(3, model_->item_count()); - EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[2].type); - EXPECT_EQ(ash::STATUS_CLOSED, model_->items()[2].status); + EXPECT_EQ(4, model_->item_count()); + EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[3].type); + EXPECT_EQ(ash::STATUS_CLOSED, model_->items()[3].status); EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); EXPECT_NE(nullptr, launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); // Unpinning the app should remove its shelf item. launcher_controller_->UnpinAppWithID(extension1_->id()); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); EXPECT_EQ(nullptr, launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); @@ -1764,42 +1773,44 @@ // Test the V1 app interaction flow: pin it, run it, unpin it, close it. TEST_F(ChromeLauncherControllerTest, V1AppPinRunUnpinClose) { InitLauncherController(); - // The model should only contain the browser shortcut and app list items. - EXPECT_EQ(2, model_->item_count()); + + // The model should only contain the browser shortcut, app list and back + // button items. + EXPECT_EQ(3, model_->item_count()); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); EXPECT_EQ(nullptr, launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); // Pinning the app should create a new shelf item. launcher_controller_->PinAppWithID(extension1_->id()); - EXPECT_EQ(3, model_->item_count()); - EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[2].type); - EXPECT_EQ(ash::STATUS_CLOSED, model_->items()[2].status); + EXPECT_EQ(4, model_->item_count()); + EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[3].type); + EXPECT_EQ(ash::STATUS_CLOSED, model_->items()[3].status); EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); EXPECT_NE(nullptr, launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); // Reporting that the app is running should just update the existing item. launcher_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_RUNNING); - EXPECT_EQ(3, model_->item_count()); - EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[2].type); - EXPECT_EQ(ash::STATUS_RUNNING, model_->items()[2].status); + EXPECT_EQ(4, model_->item_count()); + EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[3].type); + EXPECT_EQ(ash::STATUS_RUNNING, model_->items()[3].status); EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); EXPECT_NE(nullptr, launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); // Unpinning the app should just update the existing item. launcher_controller_->UnpinAppWithID(extension1_->id()); - EXPECT_EQ(3, model_->item_count()); - EXPECT_EQ(ash::TYPE_APP, model_->items()[2].type); - EXPECT_EQ(ash::STATUS_RUNNING, model_->items()[2].status); + EXPECT_EQ(4, model_->item_count()); + EXPECT_EQ(ash::TYPE_APP, model_->items()[3].type); + EXPECT_EQ(ash::STATUS_RUNNING, model_->items()[3].status); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); EXPECT_NE(nullptr, launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); // Reporting that the app is closed should remove its shelf item. launcher_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_CLOSED); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id())); EXPECT_EQ(nullptr, launcher_controller_->GetItem(ash::ShelfID(extension1_->id()))); @@ -1808,17 +1819,19 @@ // Ensure unpinned V1 app ordering is properly restored after user changes. TEST_F(ChromeLauncherControllerTest, CheckRunningV1AppOrder) { InitLauncherController(); - // The model should only contain the browser shortcut and app list items. - EXPECT_EQ(2, model_->item_count()); + + // The model should only contain the browser shortcut, app list and back + // button items. + EXPECT_EQ(3, model_->item_count()); // Add a few running applications. launcher_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_RUNNING); launcher_controller_->SetV1AppStatus(extension2_->id(), ash::STATUS_RUNNING); launcher_controller_->SetV1AppStatus(extension3_->id(), ash::STATUS_RUNNING); - EXPECT_EQ(5, model_->item_count()); + EXPECT_EQ(6, model_->item_count()); // Note that this not only checks the order of applications but also the // running type. - EXPECT_EQ("AppList, Chrome, app1, app2, app3", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, app1, app2, app3", GetPinnedAppStatus()); // Remember the current order of applications for the current user. const AccountId& current_account_id = @@ -1827,32 +1840,32 @@ // Switch some items and check that restoring a user which was not yet // remembered changes nothing. - model_->Move(2, 3); - EXPECT_EQ("AppList, Chrome, app2, app1, app3", GetPinnedAppStatus()); + model_->Move(3, 4); + EXPECT_EQ("Back, AppList, Chrome, app2, app1, app3", GetPinnedAppStatus()); const AccountId second_fake_account_id( AccountId::FromUserEmail("second-fake-user@fake.com")); RestoreUnpinnedRunningApplicationOrder(second_fake_account_id); - EXPECT_EQ("AppList, Chrome, app2, app1, app3", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, app2, app1, app3", GetPinnedAppStatus()); // Restoring the stored user should however do the right thing. RestoreUnpinnedRunningApplicationOrder(current_account_id); - EXPECT_EQ("AppList, Chrome, app1, app2, app3", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, app1, app2, app3", GetPinnedAppStatus()); // Switch again some items and even delete one - making sure that the missing // item gets properly handled. - model_->Move(3, 4); + model_->Move(4, 5); launcher_controller_->SetV1AppStatus(extension1_->id(), ash::STATUS_CLOSED); - EXPECT_EQ("AppList, Chrome, app3, app2", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, app3, app2", GetPinnedAppStatus()); RestoreUnpinnedRunningApplicationOrder(current_account_id); - EXPECT_EQ("AppList, Chrome, app2, app3", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, app2, app3", GetPinnedAppStatus()); // Check that removing more items does not crash and changes nothing. launcher_controller_->SetV1AppStatus(extension2_->id(), ash::STATUS_CLOSED); RestoreUnpinnedRunningApplicationOrder(current_account_id); - EXPECT_EQ("AppList, Chrome, app3", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, app3", GetPinnedAppStatus()); launcher_controller_->SetV1AppStatus(extension3_->id(), ash::STATUS_CLOSED); RestoreUnpinnedRunningApplicationOrder(current_account_id); - EXPECT_EQ("AppList, Chrome", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome", GetPinnedAppStatus()); } TEST_P(ChromeLauncherControllerWithArcTest, ArcDeferredLaunch) { @@ -2267,27 +2280,30 @@ EXPECT_TRUE(launcher_controller_->IsAppPinned(arc_app_id)); EXPECT_TRUE(launcher_controller_->IsAppPinned(extension2_->id())); - EXPECT_EQ("AppList, Chrome, App1, Fake App 0, App2", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App1, Fake App 0, App2", + GetPinnedAppStatus()); // In opt-out mode, only system apps are available and can't be uninstalled. // Skip the rest of the test. if (arc::ShouldArcAlwaysStart()) return; UninstallArcApps(); EXPECT_FALSE(launcher_controller_->IsAppPinned(arc_app_id)); - EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App1, App2", GetPinnedAppStatus()); SendListOfArcApps(); EXPECT_FALSE(launcher_controller_->IsAppPinned(arc_app_id)); - EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App1, App2", GetPinnedAppStatus()); // Opt-Out/Opt-In remove item from the shelf. launcher_controller_->PinAppWithID(arc_app_id); - EXPECT_EQ("AppList, Chrome, App1, App2, Fake App 0", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App1, App2, Fake App 0", + GetPinnedAppStatus()); EnablePlayStore(false); - EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App1, App2", GetPinnedAppStatus()); EnablePlayStore(true); - EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App1, App2", GetPinnedAppStatus()); SendListOfArcApps(); - EXPECT_EQ("AppList, Chrome, App1, App2, Fake App 0", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App1, App2, Fake App 0", + GetPinnedAppStatus()); } // Validates that ARC app pins persist across OptOut/OptIn. @@ -2312,7 +2328,7 @@ EXPECT_TRUE(launcher_controller_->IsAppPinned(arc_app_id1)); EXPECT_TRUE(launcher_controller_->IsAppPinned(extension2_->id())); EXPECT_TRUE(launcher_controller_->IsAppPinned(arc_app_id2)); - EXPECT_EQ("AppList, Chrome, App1, Fake App 1, App2, Fake App 0", + EXPECT_EQ("Back, AppList, Chrome, App1, Fake App 1, App2, Fake App 0", GetPinnedAppStatus()); // TODO(victorhsieh): Implement opt-out. @@ -2320,7 +2336,7 @@ return; EnablePlayStore(false); - EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App1, App2", GetPinnedAppStatus()); EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); EXPECT_FALSE(launcher_controller_->IsAppPinned(arc_app_id1)); EXPECT_TRUE(launcher_controller_->IsAppPinned(extension2_->id())); @@ -2335,7 +2351,7 @@ EXPECT_TRUE(launcher_controller_->IsAppPinned(extension2_->id())); EXPECT_TRUE(launcher_controller_->IsAppPinned(arc_app_id2)); - EXPECT_EQ("AppList, Chrome, App1, Fake App 1, App2, Fake App 0", + EXPECT_EQ("Back, AppList, Chrome, App1, Fake App 1, App2, Fake App 0", GetPinnedAppStatus()); } @@ -2415,12 +2431,12 @@ // Create a browser item in the LauncherController. InitLauncherController(); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); { // Create a "windowed gmail app". std::unique_ptr<V1App> v1_app( CreateRunningV1App(profile(), extension_misc::kGmailAppId, kGmailUrl)); - EXPECT_EQ(3, model_->item_count()); + EXPECT_EQ(4, model_->item_count()); // After switching to a second user the item should be gone. std::string user2 = "user2"; @@ -2430,14 +2446,14 @@ const AccountId account_id( multi_user_util::GetAccountIdFromProfile(profile())); SwitchActiveUser(account_id2); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); // After switching back the item should be back. SwitchActiveUser(account_id); - EXPECT_EQ(3, model_->item_count()); + EXPECT_EQ(4, model_->item_count()); // Note we destroy now the gmail app with the closure end. } - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); } // Check edge cases with multi profile V1 apps in the shelf. @@ -2457,23 +2473,23 @@ // Create a "windowed gmail app". std::unique_ptr<V1App> v1_app( CreateRunningV1App(profile2, extension_misc::kGmailAppId, kGmailUrl)); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); // However - switching to the user should show it. SwitchActiveUser(account_id2); - EXPECT_EQ(3, model_->item_count()); + EXPECT_EQ(4, model_->item_count()); // Second test: Remove the app when the user is not active and see that it // works. SwitchActiveUser(account_id); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); // Note: the closure ends and the browser will go away. } - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); SwitchActiveUser(account_id2); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); SwitchActiveUser(account_id); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); } // Check edge case where a visiting V1 app gets closed (crbug.com/321374). @@ -2495,28 +2511,28 @@ // Create a "windowed gmail app". std::unique_ptr<V1App> v1_app(CreateRunningV1App( profile(), extension_misc::kGmailAppId, kGmailLaunchURL)); - EXPECT_EQ(3, model_->item_count()); + EXPECT_EQ(4, model_->item_count()); // Transfer the app to the other screen and switch users. manager->ShowWindowForUser(v1_app->browser()->window()->GetNativeWindow(), account_id2); - EXPECT_EQ(3, model_->item_count()); + EXPECT_EQ(4, model_->item_count()); SwitchActiveUser(account_id2); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); } // After the app was destroyed, switch back. (which caused already a crash). SwitchActiveUser(account_id); // Create the same app again - which was also causing the crash. - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); { // Create a "windowed gmail app". std::unique_ptr<V1App> v1_app(CreateRunningV1App( profile(), extension_misc::kGmailAppId, kGmailLaunchURL)); - EXPECT_EQ(3, model_->item_count()); + EXPECT_EQ(4, model_->item_count()); } SwitchActiveUser(account_id2); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); } // Check edge cases with multi profile V1 apps in the shelf. @@ -2537,23 +2553,23 @@ // Create a "windowed gmail app". std::unique_ptr<V1App> v1_app( CreateRunningV1App(profile(), extension_misc::kGmailAppId, kGmailUrl)); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); // However - switching to the user should show it. SwitchActiveUser(account_id); - EXPECT_EQ(3, model_->item_count()); + EXPECT_EQ(4, model_->item_count()); // Second test: Remove the app when the user is not active and see that it // works. SwitchActiveUser(account_id2); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); v1_app.reset(); } - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); SwitchActiveUser(account_id); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); SwitchActiveUser(account_id2); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); } // Check that activating an item which is on another user's desktop, will bring @@ -2600,25 +2616,27 @@ // Check the shelf model used by ShelfWindowWatcher. ash::ShelfModel* shelf_model = ash::Shell::Get()->shelf_model(); - ASSERT_EQ(1, shelf_model->item_count()); - EXPECT_EQ(ash::TYPE_APP_LIST, shelf_model->items()[0].type); + ASSERT_EQ(2, shelf_model->item_count()); + EXPECT_EQ(ash::TYPE_BACK_BUTTON, shelf_model->items()[0].type); + EXPECT_EQ(ash::TYPE_APP_LIST, shelf_model->items()[1].type); // Add an app panel window; ShelfWindowWatcher will add a shelf item. V2App panel(profile(), extension_platform_app_.get(), extensions::AppWindow::WINDOW_TYPE_PANEL); - ASSERT_EQ(2, shelf_model->item_count()); - EXPECT_EQ(ash::TYPE_APP_PANEL, shelf_model->items()[1].type); + ASSERT_EQ(3, shelf_model->item_count()); + EXPECT_EQ(ash::TYPE_APP_PANEL, shelf_model->items()[2].type); // After switching users the item should go away. TestingProfile* profile2 = CreateMultiUserProfile("user2"); SwitchActiveUser(multi_user_util::GetAccountIdFromProfile(profile2)); - ASSERT_EQ(1, shelf_model->item_count()); - EXPECT_EQ(ash::TYPE_APP_LIST, shelf_model->items()[0].type); + ASSERT_EQ(2, shelf_model->item_count()); + EXPECT_EQ(ash::TYPE_BACK_BUTTON, shelf_model->items()[0].type); + EXPECT_EQ(ash::TYPE_APP_LIST, shelf_model->items()[1].type); // And it should come back when switching back. SwitchActiveUser(multi_user_util::GetAccountIdFromProfile(profile())); - ASSERT_EQ(2, shelf_model->item_count()); - EXPECT_EQ(ash::TYPE_APP_PANEL, shelf_model->items()[1].type); + ASSERT_EQ(3, shelf_model->item_count()); + EXPECT_EQ(ash::TYPE_APP_PANEL, shelf_model->items()[2].type); } // Check that a running windowed V1 application will be properly pinned and @@ -2634,16 +2652,16 @@ // The shelf layout has always one static item at the beginning (App List). extension_service_->AddExtension(extension1_.get()); - EXPECT_EQ("AppList, Chrome, App1", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App1", GetPinnedAppStatus()); extension_service_->AddExtension(extension2_.get()); // No new app icon will be generated. - EXPECT_EQ("AppList, Chrome, App1", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App1", GetPinnedAppStatus()); // Set the app status as running, which will add an unpinned item. launcher_controller_->SetV1AppStatus(extension2_->id(), ash::STATUS_RUNNING); - EXPECT_EQ("AppList, Chrome, App1, app2", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App1, app2", GetPinnedAppStatus()); extension_service_->AddExtension(extension3_.get()); - EXPECT_EQ("AppList, Chrome, App1, App3, app2", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App1, App3, app2", GetPinnedAppStatus()); // Now request to pin all items, which will pin the running unpinned items. syncer::SyncChangeList sync_list1; @@ -2651,7 +2669,7 @@ InsertAddPinChange(&sync_list1, 1, extension2_->id()); InsertAddPinChange(&sync_list1, 2, extension1_->id()); SendPinChanges(sync_list1, true); - EXPECT_EQ("AppList, Chrome, App3, App2, App1", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App3, App2, App1", GetPinnedAppStatus()); // Removing the requirement for app 2 to be pinned should convert it back to // running but not pinned. It should move towards the end of the shelf, after @@ -2660,11 +2678,11 @@ InsertAddPinChange(&sync_list2, 0, extension3_->id()); InsertAddPinChange(&sync_list2, 1, extension1_->id()); SendPinChanges(sync_list2, true); - EXPECT_EQ("AppList, Chrome, App3, App1, app2", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App3, App1, app2", GetPinnedAppStatus()); // Removing an item should simply close it and everything should shift. SendPinChanges(syncer::SyncChangeList(), true); - EXPECT_EQ("AppList, Chrome, App3, app2", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App3, app2", GetPinnedAppStatus()); } // Check that a running unpinned V2 application will be properly pinned and @@ -2678,15 +2696,16 @@ SendPinChanges(sync_list0, true); // The shelf layout has always one static item at the beginning (app List). extension_service_->AddExtension(extension1_.get()); - EXPECT_EQ("AppList, Chrome, App1", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App1", GetPinnedAppStatus()); extension_service_->AddExtension(extension_platform_app_.get()); // No new app icon will be generated. - EXPECT_EQ("AppList, Chrome, App1", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App1", GetPinnedAppStatus()); // Add an unpinned but running V2 app. CreateRunningV2App(extension_platform_app_->id()); - EXPECT_EQ("AppList, Chrome, App1, *platform_app", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App1, *platform_app", GetPinnedAppStatus()); extension_service_->AddExtension(extension3_.get()); - EXPECT_EQ("AppList, Chrome, App1, App3, *platform_app", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App1, App3, *platform_app", + GetPinnedAppStatus()); // Now request to pin all items, which should pin the running unpinned item. syncer::SyncChangeList sync_list1; @@ -2694,7 +2713,8 @@ InsertAddPinChange(&sync_list1, 1, extension_platform_app_->id()); InsertAddPinChange(&sync_list1, 2, extension1_->id()); SendPinChanges(sync_list1, true); - EXPECT_EQ("AppList, Chrome, App3, *Platform_App, App1", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App3, *Platform_App, App1", + GetPinnedAppStatus()); // Removing the requirement for app 2 to be pinned should convert it back to // running but not pinned. It should move towards the end of the shelf, after @@ -2703,13 +2723,14 @@ InsertAddPinChange(&sync_list2, 0, extension3_->id()); InsertAddPinChange(&sync_list2, 1, extension1_->id()); SendPinChanges(sync_list2, true); - EXPECT_EQ("AppList, Chrome, App3, App1, *platform_app", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App3, App1, *platform_app", + GetPinnedAppStatus()); // Removing an item should simply close it and everything should shift. syncer::SyncChangeList sync_list3; InsertAddPinChange(&sync_list3, 0, extension3_->id()); SendPinChanges(sync_list3, true); - EXPECT_EQ("AppList, Chrome, App3, *platform_app", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App3, *platform_app", GetPinnedAppStatus()); } // Each user has a different set of applications pinned. Check that when @@ -2722,21 +2743,23 @@ // Show user 1. SendPinChanges(user_a, true); - EXPECT_EQ("AppList, App1, App2, App3, *Platform_App, App4, App5, Chrome", - GetPinnedAppStatus()); + EXPECT_EQ( + "Back, AppList, App1, App2, App3, *Platform_App, App4, App5, Chrome", + GetPinnedAppStatus()); // Show user 2. SendPinChanges(user_b, true); - EXPECT_EQ("AppList, App6, App7, App8, Chrome", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, App6, App7, App8, Chrome", GetPinnedAppStatus()); // Switch back to 1. SendPinChanges(user_a, true); - EXPECT_EQ("AppList, App1, App2, App3, *Platform_App, App4, App5, Chrome", - GetPinnedAppStatus()); + EXPECT_EQ( + "Back, AppList, App1, App2, App3, *Platform_App, App4, App5, Chrome", + GetPinnedAppStatus()); // Switch back to 2. SendPinChanges(user_b, true); - EXPECT_EQ("AppList, App6, App7, App8, Chrome", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, App6, App7, App8, Chrome", GetPinnedAppStatus()); } // Each user has a different set of applications pinned, and one user has an @@ -2753,22 +2776,24 @@ // Show user 1. SendPinChanges(user_a, true); - EXPECT_EQ("AppList, App1, App2, App3, *Platform_App, App4, App5, Chrome", - GetPinnedAppStatus()); + EXPECT_EQ( + "Back, AppList, App1, App2, App3, *Platform_App, App4, App5, Chrome", + GetPinnedAppStatus()); // Show user 2. SendPinChanges(user_b, true); - EXPECT_EQ("AppList, App6, App7, App8, Chrome, *platform_app", + EXPECT_EQ("Back, AppList, App6, App7, App8, Chrome, *platform_app", GetPinnedAppStatus()); // Switch back to 1. SendPinChanges(user_a, true); - EXPECT_EQ("AppList, App1, App2, App3, *Platform_App, App4, App5, Chrome", - GetPinnedAppStatus()); + EXPECT_EQ( + "Back, AppList, App1, App2, App3, *Platform_App, App4, App5, Chrome", + GetPinnedAppStatus()); // Switch back to 2. SendPinChanges(user_b, true); - EXPECT_EQ("AppList, App6, App7, App8, Chrome, *platform_app", + EXPECT_EQ("Back, AppList, App6, App7, App8, Chrome, *platform_app", GetPinnedAppStatus()); } @@ -2788,20 +2813,22 @@ // Show user 1. SendPinChanges(user_a, true); SetShelfChromeIconIndex(5); - EXPECT_EQ("AppList, App1, App2, App3, *Platform_App, App4, Chrome, App5", - GetPinnedAppStatus()); + EXPECT_EQ( + "Back, AppList, App1, App2, App3, *Platform_App, App4, Chrome, App5", + GetPinnedAppStatus()); // Show user 2. SendPinChanges(user_b, true); SetShelfChromeIconIndex(4); - EXPECT_EQ("AppList, App6, App7, App8, Chrome, *platform_app", + EXPECT_EQ("Back, AppList, App6, App7, App8, Chrome, *platform_app", GetPinnedAppStatus()); // Switch back to 1. SendPinChanges(user_a, true); SetShelfChromeIconIndex(5); - EXPECT_EQ("AppList, App1, App2, App3, *Platform_App, App4, Chrome, App5", - GetPinnedAppStatus()); + EXPECT_EQ( + "Back, AppList, App1, App2, App3, *Platform_App, App4, Chrome, App5", + GetPinnedAppStatus()); } TEST_F(ChromeLauncherControllerTest, Policy) { @@ -2823,17 +2850,17 @@ // Only |extension1_| should get pinned. |extension2_| is specified but not // installed, and |extension3_| is part of the default set, but that shouldn't // take effect when the policy override is in place. - ASSERT_EQ(3, model_->item_count()); - EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[1].type); + ASSERT_EQ(4, model_->item_count()); + EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[2].type); EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension2_->id())); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension3_->id())); // Installing |extension2_| should add it to the launcher. extension_service_->AddExtension(extension2_.get()); - ASSERT_EQ(4, model_->item_count()); - EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[1].type); + ASSERT_EQ(5, model_->item_count()); EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[2].type); + EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[3].type); EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); EXPECT_TRUE(launcher_controller_->IsAppPinned(extension2_->id())); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension3_->id())); @@ -2843,8 +2870,8 @@ policy_value.Remove(0, NULL); profile()->GetTestingPrefService()->SetManagedPref( prefs::kPolicyPinnedLauncherApps, policy_value.CreateDeepCopy()); - EXPECT_EQ(4, model_->item_count()); - EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[2].type); + EXPECT_EQ(5, model_->item_count()); + EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[3].type); EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id())); EXPECT_TRUE(launcher_controller_->IsAppPinned(extension2_->id())); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension3_->id())); @@ -2940,10 +2967,10 @@ InitLauncherController(); // Default pins should contain Gmail. Pref is not syncing now. - EXPECT_EQ("AppList, Chrome, App3", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App3", GetPinnedAppStatus()); extension_service_->AddExtension(extension2_.get()); - EXPECT_EQ("AppList, Chrome, App3", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App3", GetPinnedAppStatus()); // Initially pins are imported from legacy pref based model. base::ListValue value; @@ -2953,32 +2980,32 @@ StartPrefSyncServiceForPins(value); // Imported pins contain App2. App2 should be added to pins now. - EXPECT_EQ("AppList, Chrome, App2, App3", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App2, App3", GetPinnedAppStatus()); // extension4_ is in the pin list. extension_service_->AddExtension(extension4_.get()); // extension5_ is not in the pin list. extension_service_->AddExtension(extension5_.get()); - EXPECT_EQ("AppList, Chrome, App4, App2, App3", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App4, App2, App3", GetPinnedAppStatus()); // Apply app sync, unpin one app and pin new one. syncer::SyncChangeList sync_list; InsertAddPinChange(&sync_list, -1, extension3_->id()); InsertAddPinChange(&sync_list, 3, extension5_->id()); SendPinChanges(sync_list, false); - EXPECT_EQ("AppList, Chrome, App4, App2, App5", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App4, App2, App5", GetPinnedAppStatus()); // At this point changing old pref based model does not affect pin model. InsertPrefValue(&value, 3, extension5_->id()); StopPrefSyncService(); StartPrefSyncServiceForPins(value); - EXPECT_EQ("AppList, Chrome, App4, App2, App5", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App4, App2, App5", GetPinnedAppStatus()); // Next Chrome start should preserve pins. RecreateLauncherController()->Init(); StopPrefSyncService(); StartPrefSyncService(syncer::SyncDataList()); - EXPECT_EQ("AppList, Chrome, App4, App2, App5", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App4, App2, App5", GetPinnedAppStatus()); } TEST_F(ChromeLauncherControllerTest, PendingInsertionOrder) { @@ -3114,8 +3141,9 @@ InitLauncherControllerWithBrowser(); - // The model should only contain the browser shortcut and app list items. - EXPECT_EQ(2, model_->item_count()); + // The model should only contain the browser shortcut, app list and back + // button items. + EXPECT_EQ(3, model_->item_count()); EXPECT_FALSE(launcher_controller_->IsAppPinned(extension3_->id())); // Installing |extension3_| pins it to the launcher. @@ -3227,20 +3255,20 @@ multi_user_util::GetAccountIdFromProfile(profile())); const AccountId account_id2( multi_user_util::GetAccountIdFromProfile(profile2)); - // Check that there is a browser and a app launcher. - EXPECT_EQ(2, model_->item_count()); + // Check that there is a browser, back button and a app launcher. + EXPECT_EQ(3, model_->item_count()); // Add a v2 app. V2App v2_app(profile(), extension1_.get()); - EXPECT_EQ(3, model_->item_count()); + EXPECT_EQ(4, model_->item_count()); // After switching users the item should go away. SwitchActiveUser(account_id2); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); // And it should come back when switching back. SwitchActiveUser(account_id); - EXPECT_EQ(3, model_->item_count()); + EXPECT_EQ(4, model_->item_count()); } // Check that V2 applications are creating items properly in edge cases: @@ -3255,36 +3283,36 @@ multi_user_util::GetAccountIdFromProfile(profile())); const AccountId account_id2( multi_user_util::GetAccountIdFromProfile(profile2)); - // Check that there is a browser and a app launcher. - EXPECT_EQ(2, model_->item_count()); + // Check that there is a browser, back button and a app launcher. + EXPECT_EQ(3, model_->item_count()); // Switch to an inactive user. SwitchActiveUser(account_id2); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); // Add the v2 app to the inactive user and check that no item was added to // the launcher. { V2App v2_app(profile(), extension1_.get()); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); // Switch to the primary user and check that the item is shown. SwitchActiveUser(account_id); - EXPECT_EQ(3, model_->item_count()); + EXPECT_EQ(4, model_->item_count()); // Switch to the second user and check that the item goes away - even if the // item gets closed. SwitchActiveUser(account_id2); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); } // After the application was killed there should be still 2 items. - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); // Switching then back to the default user should not show the additional item // anymore. SwitchActiveUser(account_id); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); } // Check that V2 applications will be made visible on the target desktop if @@ -3369,39 +3397,39 @@ const AccountId account_id2( multi_user_util::GetAccountIdFromProfile(profile2)); SwitchActiveUser(account_id); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); V2App v2_app_1(profile(), extension1_.get()); - EXPECT_EQ(3, model_->item_count()); + EXPECT_EQ(4, model_->item_count()); { // Hide and show the app. v2_app_1.window()->Hide(); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); v2_app_1.window()->Show(extensions::AppWindow::SHOW_ACTIVE); - EXPECT_EQ(3, model_->item_count()); + EXPECT_EQ(4, model_->item_count()); } { // Switch user, hide and show the app and switch back. SwitchActiveUser(account_id2); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); v2_app_1.window()->Hide(); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); v2_app_1.window()->Show(extensions::AppWindow::SHOW_ACTIVE); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); SwitchActiveUser(account_id); - EXPECT_EQ(3, model_->item_count()); + EXPECT_EQ(4, model_->item_count()); } { // Switch user, hide the app, switch back and then show it again. SwitchActiveUser(account_id2); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); v2_app_1.window()->Hide(); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); SwitchActiveUser(account_id); // The following expectation does not work in current impl. It was working @@ -3411,22 +3439,22 @@ // EXPECT_EQ(2, model_->item_count()); v2_app_1.window()->Show(extensions::AppWindow::SHOW_ACTIVE); - EXPECT_EQ(3, model_->item_count()); + EXPECT_EQ(4, model_->item_count()); } { // Create a second app, hide and show it and then hide both apps. V2App v2_app_2(profile(), extension1_.get()); - EXPECT_EQ(3, model_->item_count()); + EXPECT_EQ(4, model_->item_count()); v2_app_2.window()->Hide(); - EXPECT_EQ(3, model_->item_count()); + EXPECT_EQ(4, model_->item_count()); v2_app_2.window()->Show(extensions::AppWindow::SHOW_ACTIVE); - EXPECT_EQ(3, model_->item_count()); + EXPECT_EQ(4, model_->item_count()); v2_app_1.window()->Hide(); v2_app_2.window()->Hide(); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); } } @@ -3582,8 +3610,9 @@ TestLauncherControllerHelper* helper = new TestLauncherControllerHelper; SetLauncherControllerHelper(helper); - EXPECT_EQ(ash::TYPE_APP_LIST, model_->items()[0].type); - EXPECT_EQ(ash::TYPE_BROWSER_SHORTCUT, model_->items()[1].type); + EXPECT_EQ(ash::TYPE_BACK_BUTTON, model_->items()[0].type); + EXPECT_EQ(ash::TYPE_APP_LIST, model_->items()[1].type); + EXPECT_EQ(ash::TYPE_BROWSER_SHORTCUT, model_->items()[2].type); TabStripModel* tab_strip_model = browser()->tab_strip_model(); EXPECT_EQ(0, tab_strip_model->count()); @@ -3598,17 +3627,19 @@ EXPECT_TRUE(launcher_controller_->IsAppPinned("1")); launcher_controller_->PinAppWithID("2"); - EXPECT_EQ(ash::TYPE_APP_LIST, model_->items()[0].type); - EXPECT_EQ(ash::TYPE_BROWSER_SHORTCUT, model_->items()[1].type); - EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[2].type); + EXPECT_EQ(ash::TYPE_BACK_BUTTON, model_->items()[0].type); + EXPECT_EQ(ash::TYPE_APP_LIST, model_->items()[1].type); + EXPECT_EQ(ash::TYPE_BROWSER_SHORTCUT, model_->items()[2].type); EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[3].type); + EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[4].type); // Move browser shortcut item from index 1 to index 3. - model_->Move(1, 3); - EXPECT_EQ(ash::TYPE_APP_LIST, model_->items()[0].type); - EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[1].type); + model_->Move(2, 4); + EXPECT_EQ(ash::TYPE_BACK_BUTTON, model_->items()[0].type); + EXPECT_EQ(ash::TYPE_APP_LIST, model_->items()[1].type); EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[2].type); - EXPECT_EQ(ash::TYPE_BROWSER_SHORTCUT, model_->items()[3].type); + EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[3].type); + EXPECT_EQ(ash::TYPE_BROWSER_SHORTCUT, model_->items()[4].type); RecreateLauncherController(); helper = new TestLauncherControllerHelper(profile()); @@ -3618,10 +3649,11 @@ launcher_controller_->Init(); // Check ShelfItems are restored after resetting ChromeLauncherController. - EXPECT_EQ(ash::TYPE_APP_LIST, model_->items()[0].type); - EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[1].type); + EXPECT_EQ(ash::TYPE_BACK_BUTTON, model_->items()[0].type); + EXPECT_EQ(ash::TYPE_APP_LIST, model_->items()[1].type); EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[2].type); - EXPECT_EQ(ash::TYPE_BROWSER_SHORTCUT, model_->items()[3].type); + EXPECT_EQ(ash::TYPE_PINNED_APP, model_->items()[3].type); + EXPECT_EQ(ash::TYPE_BROWSER_SHORTCUT, model_->items()[4].type); } // Verifies pinned apps are persisted and restored. @@ -3765,7 +3797,7 @@ // Initial run, ARC is not managed and disabled, Play Store pin should be // available. ValidateArcState(false, false, arc::ArcSessionManager::State::STOPPED, - "AppList, Chrome, Play Store"); + "Back, AppList, Chrome, Play Store"); // ARC is managed and enabled, Play Store pin should be available. // Note: NEGOTIATING_TERMS_OF_SERVICE here means that opt-in flow starts. @@ -3774,39 +3806,39 @@ base::RunLoop().RunUntilIdle(); ValidateArcState(true, true, arc::ArcSessionManager::State::NEGOTIATING_TERMS_OF_SERVICE, - "AppList, Chrome, Play Store"); + "Back, AppList, Chrome, Play Store"); // ARC is managed and disabled, Play Store pin should not be available. profile()->GetTestingPrefService()->SetManagedPref( arc::prefs::kArcEnabled, std::make_unique<base::Value>(false)); base::RunLoop().RunUntilIdle(); ValidateArcState(false, true, arc::ArcSessionManager::State::STOPPED, - "AppList, Chrome"); + "Back, AppList, Chrome"); // ARC is not managed and disabled, Play Store pin should be available. profile()->GetTestingPrefService()->RemoveManagedPref( arc::prefs::kArcEnabled); base::RunLoop().RunUntilIdle(); ValidateArcState(false, false, arc::ArcSessionManager::State::STOPPED, - "AppList, Chrome, Play Store"); + "Back, AppList, Chrome, Play Store"); // ARC is not managed and enabled, Play Store pin should be available. EnablePlayStore(true); ValidateArcState(true, false, arc::ArcSessionManager::State::NEGOTIATING_TERMS_OF_SERVICE, - "AppList, Chrome, Play Store"); + "Back, AppList, Chrome, Play Store"); // User disables ARC. ARC is not managed and disabled, Play Store pin should // be automatically removed. EnablePlayStore(false); ValidateArcState(false, false, arc::ArcSessionManager::State::STOPPED, - "AppList, Chrome"); + "Back, AppList, Chrome"); // Even if re-enable it again, Play Store pin does not appear automatically. EnablePlayStore(true); ValidateArcState(true, false, arc::ArcSessionManager::State::NEGOTIATING_TERMS_OF_SERVICE, - "AppList, Chrome"); + "Back, AppList, Chrome"); } // Test the application menu of a shelf item with multiple ARC windows. @@ -4239,7 +4271,7 @@ InsertAddPinChange(&sync_list, 1, extension3_->id()); SendPinChanges(sync_list, true); - EXPECT_EQ("AppList, Chrome, App1, App2, App3", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App1, App2, App3", GetPinnedAppStatus()); const syncer::StringOrdinal position_chrome = app_service_->GetPinPosition(extension_misc::kChromeAppId); @@ -4256,8 +4288,8 @@ // Move Chrome between App1 and App2. // Note, move target_index is in context when moved element is removed from // array first. - model_->Move(1, 2); - EXPECT_EQ("AppList, App1, Chrome, App2, App3", GetPinnedAppStatus()); + model_->Move(2, 3); + EXPECT_EQ("Back, AppList, App1, Chrome, App2, App3", GetPinnedAppStatus()); // Expect sync positions for only Chrome is updated and its resolution is // after all duplicated ordinals. @@ -4287,7 +4319,7 @@ InsertAddPinChange(&sync_list, 1, extension2_->id()); SendPinChanges(sync_list, true); - EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App1, App2", GetPinnedAppStatus()); syncer::SyncDataList copy_sync_list = app_service_->GetAllSyncData(syncer::APP_LIST); @@ -4296,13 +4328,13 @@ RecreateLauncherController()->Init(); // Pinned state should not change. - EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App1, App2", GetPinnedAppStatus()); launcher_controller_->UnpinAppWithID(extension2_->id()); - EXPECT_EQ("AppList, Chrome, App1", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App1", GetPinnedAppStatus()); // Resume syncing and sync information overrides local copy. StartAppSyncService(copy_sync_list); - EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus()); + EXPECT_EQ("Back, AppList, Chrome, App1, App2", GetPinnedAppStatus()); } // Ensure Ash and Chrome ShelfModel changes are synchronized correctly. @@ -4314,30 +4346,32 @@ launcher_controller->test_shelf_controller(); EXPECT_EQ(0u, shelf_controller->added_count()); EXPECT_EQ(0u, shelf_controller->removed_count()); - EXPECT_EQ(1, model_->item_count()); - EXPECT_EQ(ash::kAppListId, model_->items()[0].id.app_id); - EXPECT_EQ(ash::TYPE_APP_LIST, model_->items()[0].type); - EXPECT_FALSE(model_->GetShelfItemDelegate(model_->items()[0].id)); + EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(ash::kBackButtonId, model_->items()[0].id.app_id); + EXPECT_EQ(ash::TYPE_BACK_BUTTON, model_->items()[0].type); + EXPECT_EQ(ash::kAppListId, model_->items()[1].id.app_id); + EXPECT_EQ(ash::TYPE_APP_LIST, model_->items()[1].type); + EXPECT_FALSE(model_->GetShelfItemDelegate(model_->items()[1].id)); // Init creates the browser item and its delegate in Chrome's ShelfModel. // Ash's ShelfController should be notified about the update and delegate. launcher_controller->Init(); base::RunLoop().RunUntilIdle(); - EXPECT_EQ(2, model_->item_count()); + EXPECT_EQ(3, model_->item_count()); EXPECT_EQ(1u, shelf_controller->added_count()); EXPECT_EQ(0u, shelf_controller->removed_count()); EXPECT_LE(0u, shelf_controller->updated_count()); EXPECT_EQ(1u, shelf_controller->set_delegate_count()); - EXPECT_EQ(extension_misc::kChromeAppId, model_->items()[1].id.app_id); - EXPECT_EQ(ash::TYPE_BROWSER_SHORTCUT, model_->items()[1].type); - EXPECT_TRUE(model_->GetShelfItemDelegate(model_->items()[1].id)); - EXPECT_FALSE(model_->items()[1].title.empty()); + EXPECT_EQ(extension_misc::kChromeAppId, model_->items()[2].id.app_id); + EXPECT_EQ(ash::TYPE_BROWSER_SHORTCUT, model_->items()[2].type); + EXPECT_TRUE(model_->GetShelfItemDelegate(model_->items()[2].id)); + EXPECT_FALSE(model_->items()[2].title.empty()); // Add a shelf item using the ShelfController interface. ash::ShelfItem item; item.type = ash::TYPE_PINNED_APP; item.id = ash::ShelfID(kDummyAppId); - shelf_controller->AddShelfItem(2, item); + shelf_controller->AddShelfItem(3, item); base::RunLoop().RunUntilIdle(); EXPECT_EQ(2u, shelf_controller->added_count()); EXPECT_EQ(0u, shelf_controller->removed_count()); @@ -4350,14 +4384,14 @@ // Add an item to Chrome's model; ShelfController should be notified. model_->Add(item); - EXPECT_EQ(3, model_->item_count()); + EXPECT_EQ(4, model_->item_count()); base::RunLoop().RunUntilIdle(); EXPECT_EQ(3u, shelf_controller->added_count()); EXPECT_EQ(1u, shelf_controller->removed_count()); // Remove an item from Chrome's model; ShelfController should be notified. - model_->RemoveItemAt(2); - EXPECT_EQ(2, model_->item_count()); + model_->RemoveItemAt(3); + EXPECT_EQ(3, model_->item_count()); base::RunLoop().RunUntilIdle(); EXPECT_EQ(3u, shelf_controller->added_count()); EXPECT_EQ(2u, shelf_controller->removed_count());
diff --git a/chrome/browser/ui/ash/system_tray_client.cc b/chrome/browser/ui/ash/system_tray_client.cc index 048c1fc2..7325031a 100644 --- a/chrome/browser/ui/ash/system_tray_client.cc +++ b/chrome/browser/ui/ash/system_tray_client.cc
@@ -341,13 +341,10 @@ return; } - if (base::CommandLine::ForCurrentProcess()->HasSwitch( - chromeos::switches::kNetworkSettingsConfig)) { + if (chromeos::switches::IsNetworkSettingsConfigEnabled()) chromeos::InternetConfigDialog::ShowDialogForNetworkState(network_state); - - } else { + else chromeos::NetworkConfigView::ShowForNetworkId(network_id); - } } void SystemTrayClient::ShowNetworkCreate(const std::string& type) { @@ -360,8 +357,7 @@ ShowNetworkSettingsHelper(network_id, false /* show_configure */); return; } - if (base::CommandLine::ForCurrentProcess()->HasSwitch( - chromeos::switches::kNetworkSettingsConfig)) { + if (chromeos::switches::IsNetworkSettingsConfigEnabled()) { // TODO(stevenjb): Pass ONC type to ShowNetworkCreate once NetworkConfigView // is deprecated. std::string onc_type =
diff --git a/chrome/browser/ui/autofill/password_generation_popup_controller.h b/chrome/browser/ui/autofill/password_generation_popup_controller.h index 7525dabb..f5ca9a4 100644 --- a/chrome/browser/ui/autofill/password_generation_popup_controller.h +++ b/chrome/browser/ui/autofill/password_generation_popup_controller.h
@@ -17,13 +17,13 @@ class PasswordGenerationPopupController : public AutofillPopupViewDelegate { public: // Space above and below help section. - static const int kHelpVerticalPadding = 15; + static constexpr int kHelpVerticalPadding = 15; // Spacing between the border of the popup and any text. - static const int kHorizontalPadding = 16; + static constexpr int kHorizontalPadding = 16; // Desired height of the password section. - static const int kPopupPasswordSectionHeight = 62; + static constexpr int kPopupPasswordSectionHeight = 62; // Called by the view when the password was accepted. virtual void PasswordAccepted() = 0;
diff --git a/chrome/browser/ui/cocoa/translate/translate_bubble_controller.mm b/chrome/browser/ui/cocoa/translate/translate_bubble_controller.mm index 6e7c46f..105f3d8 100644 --- a/chrome/browser/ui/cocoa/translate/translate_bubble_controller.mm +++ b/chrome/browser/ui/cocoa/translate/translate_bubble_controller.mm
@@ -426,7 +426,7 @@ l10n_util::GetNSStringWithFixup(IDS_TRANSLATE_BUBBLE_TRANSLATED); NSTextField* textLabel = [self addText:message toView:view]; - message = l10n_util::GetNSStringWithFixup(IDS_TRANSLATE_BUBBLE_ADVANCED); + message = l10n_util::GetNSStringWithFixup(IDS_TRANSLATE_BUBBLE_ADVANCED_LINK); NSButton* advancedLinkButton = [self addLinkButtonWithText:message action:@selector(handleAdvancedLinkButtonPressed:) @@ -471,7 +471,7 @@ NSString* message = l10n_util::GetNSString(IDS_TRANSLATE_BUBBLE_COULD_NOT_TRANSLATE); NSTextField* textLabel = [self addText:message toView:view]; - message = l10n_util::GetNSStringWithFixup(IDS_TRANSLATE_BUBBLE_ADVANCED); + message = l10n_util::GetNSStringWithFixup(IDS_TRANSLATE_BUBBLE_ADVANCED_LINK); NSButton* advancedLinkButton = [self addLinkButtonWithText:message action:@selector(handleAdvancedLinkButtonPressed:)
diff --git a/chrome/browser/ui/libgtkui/app_indicator_icon.cc b/chrome/browser/ui/libgtkui/app_indicator_icon.cc index 3cd9b93..f7943a2 100644 --- a/chrome/browser/ui/libgtkui/app_indicator_icon.cc +++ b/chrome/browser/ui/libgtkui/app_indicator_icon.cc
@@ -92,8 +92,9 @@ case base::nix::DESKTOP_ENVIRONMENT_PANTHEON: case base::nix::DESKTOP_ENVIRONMENT_UNITY: return true; - case base::nix::DESKTOP_ENVIRONMENT_KDE3: + case base::nix::DESKTOP_ENVIRONMENT_CINNAMON: case base::nix::DESKTOP_ENVIRONMENT_GNOME: + case base::nix::DESKTOP_ENVIRONMENT_KDE3: case base::nix::DESKTOP_ENVIRONMENT_OTHER: case base::nix::DESKTOP_ENVIRONMENT_XFCE: return false;
diff --git a/chrome/browser/ui/libgtkui/gtk_ui.cc b/chrome/browser/ui/libgtkui/gtk_ui.cc index 1fdcb45..1daea8f 100644 --- a/chrome/browser/ui/libgtkui/gtk_ui.cc +++ b/chrome/browser/ui/libgtkui/gtk_ui.cc
@@ -408,11 +408,13 @@ } #endif +#if GTK_MAJOR_VERSION > 2 using GdkSetAllowedBackendsFn = void (*)(const gchar*); // Place this function pointers in read-only memory after being resolved to // prevent it being tampered with. See crbug.com/771365 for details. PROTECTED_MEMORY_SECTION base::ProtectedMemory<GdkSetAllowedBackendsFn> g_gdk_set_allowed_backends; +#endif } // namespace @@ -599,6 +601,7 @@ std::unique_ptr<base::Environment> env(base::Environment::Create()); switch (base::nix::GetDesktopEnvironment(env.get())) { + case base::nix::DESKTOP_ENVIRONMENT_CINNAMON: case base::nix::DESKTOP_ENVIRONMENT_GNOME: case base::nix::DESKTOP_ENVIRONMENT_PANTHEON: case base::nix::DESKTOP_ENVIRONMENT_UNITY:
diff --git a/chrome/browser/ui/libgtkui/settings_provider_gsettings.cc b/chrome/browser/ui/libgtkui/settings_provider_gsettings.cc index f0dd3cc..fee7763 100644 --- a/chrome/browser/ui/libgtkui/settings_provider_gsettings.cc +++ b/chrome/browser/ui/libgtkui/settings_provider_gsettings.cc
@@ -6,12 +6,15 @@ #include <gio/gio.h> +#include "base/environment.h" +#include "base/nix/xdg_util.h" #include "chrome/browser/ui/libgtkui/gtk_ui.h" #include "chrome/browser/ui/libgtkui/gtk_util.h" namespace { -const char kGeneralPreferencesSchema[] = "org.gnome.desktop.wm.preferences"; +const char kGnomePreferencesSchema[] = "org.gnome.desktop.wm.preferences"; +const char kCinnamonPreferencesSchema[] = "org.cinnamon.muffin"; const char kButtonLayoutKey[] = "button-layout"; const char kButtonLayoutChangedSignal[] = "changed::button-layout"; @@ -29,38 +32,54 @@ // Public interface: SettingsProviderGSettings::SettingsProviderGSettings(GtkUi* delegate) - : delegate_(delegate), settings_(nullptr) { + : delegate_(delegate) { DCHECK(delegate_); + // Of all the supported distros, this code path should only be used by + // Ubuntu 14.04 (all the others have a sufficent gtk version to use the + // gtk3 API). The default in 14.04 is Unity, but Cinnamon has enough + // usage to justify also checking its value. + std::unique_ptr<base::Environment> env(base::Environment::Create()); + const gchar* settings_schema = + base::nix::GetDesktopEnvironment(env.get()) == + base::nix::DESKTOP_ENVIRONMENT_CINNAMON + ? settings_schema = kCinnamonPreferencesSchema + : settings_schema = kGnomePreferencesSchema; + if (!g_settings_schema_source_lookup(g_settings_schema_source_get_default(), - kGeneralPreferencesSchema, FALSE) || - !(settings_ = g_settings_new(kGeneralPreferencesSchema))) { - LOG(ERROR) << "Unable to create a gsettings client - setting button layout " - "to default"; + settings_schema, FALSE) || + !(button_settings_ = g_settings_new(settings_schema))) { ParseAndStoreButtonValue(kDefaultButtonString); - return; + } else { + // Get the inital value of the keys we're interested in. + OnDecorationButtonLayoutChanged(button_settings_, kButtonLayoutKey); + signal_button_id_ = g_signal_connect( + button_settings_, kButtonLayoutChangedSignal, + G_CALLBACK(OnDecorationButtonLayoutChangedThunk), this); } - // Get the inital value of the keys we're interested in. - OnDecorationButtonLayoutChanged(settings_, kButtonLayoutKey); - signal_button_id_ = - g_signal_connect(settings_, kButtonLayoutChangedSignal, - G_CALLBACK(OnDecorationButtonLayoutChangedThunk), this); - - OnMiddleClickActionChanged(settings_, kMiddleClickActionKey); - signal_middle_click_id_ = - g_signal_connect(settings_, kMiddleClickActionChangedSignal, - G_CALLBACK(OnMiddleClickActionChangedThunk), this); + // If this fails, the default action has already been set in gtk_ui.cc. + if (g_settings_schema_source_lookup(g_settings_schema_source_get_default(), + kGnomePreferencesSchema, FALSE) && + (click_settings_ = g_settings_new(kGnomePreferencesSchema))) { + OnMiddleClickActionChanged(click_settings_, kMiddleClickActionKey); + signal_middle_click_id_ = + g_signal_connect(click_settings_, kMiddleClickActionChangedSignal, + G_CALLBACK(OnMiddleClickActionChangedThunk), this); + } } SettingsProviderGSettings::~SettingsProviderGSettings() { - if (settings_) { + if (button_settings_) { if (signal_button_id_) - g_signal_handler_disconnect(settings_, signal_button_id_); - if (signal_middle_click_id_) - g_signal_handler_disconnect(settings_, signal_middle_click_id_); + g_signal_handler_disconnect(button_settings_, signal_button_id_); + g_free(button_settings_); } - g_free(settings_); + if (click_settings_) { + if (signal_middle_click_id_) + g_signal_handler_disconnect(click_settings_, signal_middle_click_id_); + g_free(click_settings_); + } } // Private:
diff --git a/chrome/browser/ui/libgtkui/settings_provider_gsettings.h b/chrome/browser/ui/libgtkui/settings_provider_gsettings.h index d1463ce5..295f041 100644 --- a/chrome/browser/ui/libgtkui/settings_provider_gsettings.h +++ b/chrome/browser/ui/libgtkui/settings_provider_gsettings.h
@@ -42,7 +42,8 @@ GtkUi* delegate_; - GSettings* settings_; + GSettings* button_settings_ = nullptr; + GSettings* click_settings_ = nullptr; gulong signal_button_id_; gulong signal_middle_click_id_;
diff --git a/chrome/browser/ui/search/instant_controller.cc b/chrome/browser/ui/search/instant_controller.cc index c8af05a..b17124e 100644 --- a/chrome/browser/ui/search/instant_controller.cc +++ b/chrome/browser/ui/search/instant_controller.cc
@@ -34,17 +34,6 @@ } } - void DidFinishNavigation( - content::NavigationHandle* navigation_handle) override { - // TODO(treib): Verify if this is necessary - NavigationEntryCommitted - // should already cover all cases. - if (navigation_handle->HasCommitted() && - navigation_handle->IsInMainFrame() && - search::IsInstantNTP(web_contents())) { - callback_.Run(); - } - } - base::Closure callback_; DISALLOW_COPY_AND_ASSIGN(TabObserver);
diff --git a/chrome/browser/ui/translate/translate_bubble_view_state_transition.h b/chrome/browser/ui/translate/translate_bubble_view_state_transition.h index ee231fa..88f5732 100644 --- a/chrome/browser/ui/translate/translate_bubble_view_state_transition.h +++ b/chrome/browser/ui/translate/translate_bubble_view_state_transition.h
@@ -79,6 +79,12 @@ BUBBLE_NOT_SHOWN_WEB_CONTENTS_NOT_ACTIVE, BUBBLE_NOT_SHOWN_EDITABLE_FIELD_IS_ACTIVE, + // The user clicked the advanced menu item. + ADVANCED_MENU_CLICKED, + + // The user clicked the advanced button. + ADVANCED_BUTTON_CLICKED, + TRANSLATE_BUBBLE_UI_EVENT_MAX };
diff --git a/chrome/browser/ui/views/ash/time_to_first_present_recorder_browsertest.cc b/chrome/browser/ui/views/ash/time_to_first_present_recorder_browsertest.cc index 7fd5c01a..fbc435e 100644 --- a/chrome/browser/ui/views/ash/time_to_first_present_recorder_browsertest.cc +++ b/chrome/browser/ui/views/ash/time_to_first_present_recorder_browsertest.cc
@@ -8,13 +8,12 @@ #include "chrome/test/base/in_process_browser_test.h" #include "content/public/common/service_manager_connection.h" #include "services/service_manager/public/cpp/connector.h" -#include "ui/gl/gl_switches.h" +#include "ui/gl/gl_switches_util.h" using TimeToFirstPresentRecorderTest = InProcessBrowserTest; IN_PROC_BROWSER_TEST_F(TimeToFirstPresentRecorderTest, VerifyTimeCalculated) { - if (!base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnablePresentationCallback)) + if (!gl::IsPresentationCallbackEnabled()) return; ash::mojom::TimeToFirstPresentRecorderTestApiPtr recorder_test_api;
diff --git a/chrome/browser/ui/views/chrome_cleaner_dialog_win.cc b/chrome/browser/ui/views/chrome_cleaner_dialog_win.cc index 8a623d8..6c799d9 100644 --- a/chrome/browser/ui/views/chrome_cleaner_dialog_win.cc +++ b/chrome/browser/ui/views/chrome_cleaner_dialog_win.cc
@@ -63,7 +63,7 @@ set_margins(ChromeLayoutProvider::Get()->GetDialogInsetsForContentType( views::TEXT, views::TEXT)); - SetLayoutManager(new views::FillLayout()); + SetLayoutManager(std::make_unique<views::FillLayout>()); views::Label* label = new views::Label( l10n_util::GetStringUTF16(IDS_CHROME_CLEANUP_PROMPT_EXPLANATION)); label->SetMultiLine(true); @@ -132,7 +132,7 @@ DCHECK(dialog_controller_); views::View* footnote_view = new views::View(); - footnote_view->SetLayoutManager(new views::BoxLayout( + footnote_view->SetLayoutManager(std::make_unique<views::BoxLayout>( views::BoxLayout::kVertical, ChromeLayoutProvider::Get()->GetInsetsMetric( views::INSETS_DIALOG_SUBSECTION))); logs_permission_checkbox_ = new views::Checkbox(
diff --git a/chrome/browser/ui/views/collected_cookies_views.cc b/chrome/browser/ui/views/collected_cookies_views.cc index db162186..f142b72f8 100644 --- a/chrome/browser/ui/views/collected_cookies_views.cc +++ b/chrome/browser/ui/views/collected_cookies_views.cc
@@ -217,10 +217,10 @@ ChromeLayoutProvider::Get()->GetDistanceMetric( DISTANCE_RELATED_CONTROL_VERTICAL_SMALL), dialog_insets.right()); - content_->SetLayoutManager( - new views::BoxLayout(views::BoxLayout::kHorizontal, layout_insets, - ChromeLayoutProvider::Get()->GetDistanceMetric( - DISTANCE_RELATED_CONTROL_HORIZONTAL_SMALL))); + content_->SetLayoutManager(std::make_unique<views::BoxLayout>( + views::BoxLayout::kHorizontal, layout_insets, + ChromeLayoutProvider::Get()->GetDistanceMetric( + DISTANCE_RELATED_CONTROL_HORIZONTAL_SMALL))); content_->AddChildView(info_image_); content_->AddChildView(label_); UpdateVisibility(false, CONTENT_SETTING_BLOCK, base::string16()); @@ -563,7 +563,7 @@ std::unique_ptr<views::View> CollectedCookiesViews::CreateButtonsPane() { auto view = std::make_unique<views::View>(); - view->SetLayoutManager(new views::FillLayout); + view->SetLayoutManager(std::make_unique<views::FillLayout>()); { auto allowed = std::make_unique<views::View>();
diff --git a/chrome/browser/ui/views/conflicting_module_view_win.cc b/chrome/browser/ui/views/conflicting_module_view_win.cc index a426da4a..292f26e 100644 --- a/chrome/browser/ui/views/conflicting_module_view_win.cc +++ b/chrome/browser/ui/views/conflicting_module_view_win.cc
@@ -135,10 +135,10 @@ void ConflictingModuleView::Init() { ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); - SetLayoutManager( - new views::BoxLayout(views::BoxLayout::kHorizontal, gfx::Insets(), - ChromeLayoutProvider::Get()->GetDistanceMetric( - views::DISTANCE_RELATED_LABEL_HORIZONTAL))); + SetLayoutManager(std::make_unique<views::BoxLayout>( + views::BoxLayout::kHorizontal, gfx::Insets(), + ChromeLayoutProvider::Get()->GetDistanceMetric( + views::DISTANCE_RELATED_LABEL_HORIZONTAL))); views::ImageView* icon = new views::ImageView(); icon->SetImage(rb.GetImageSkiaNamed(IDR_INPUT_ALERT_MENU));
diff --git a/chrome/browser/ui/views/content_setting_bubble_contents.cc b/chrome/browser/ui/views/content_setting_bubble_contents.cc index 71446ce0..a17121d 100644 --- a/chrome/browser/ui/views/content_setting_bubble_contents.cc +++ b/chrome/browser/ui/views/content_setting_bubble_contents.cc
@@ -570,7 +570,7 @@ if (extra_views.size() == 1) return extra_views.front(); views::View* container = new views::View(); - container->SetLayoutManager(new views::BoxLayout( + container->SetLayoutManager(std::make_unique<views::BoxLayout>( views::BoxLayout::kHorizontal, gfx::Insets(), layout->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_HORIZONTAL))); for (auto* extra_view : extra_views)
diff --git a/chrome/browser/ui/views/content_setting_domain_list_view.cc b/chrome/browser/ui/views/content_setting_domain_list_view.cc index 43e8ea0..1616bdc 100644 --- a/chrome/browser/ui/views/content_setting_domain_list_view.cc +++ b/chrome/browser/ui/views/content_setting_domain_list_view.cc
@@ -14,8 +14,8 @@ ContentSettingDomainListView::ContentSettingDomainListView( const base::string16& title, const std::set<std::string>& domains) { - auto layout = std::make_unique<views::BoxLayout>(views::BoxLayout::kVertical); - SetLayoutManager(layout.release()); + SetLayoutManager( + std::make_unique<views::BoxLayout>(views::BoxLayout::kVertical)); auto title_label = std::make_unique<views::Label>(title); title_label->SetMultiLine(true);
diff --git a/chrome/browser/ui/views/critical_notification_bubble_view.cc b/chrome/browser/ui/views/critical_notification_bubble_view.cc index e473094..0fc2b8f 100644 --- a/chrome/browser/ui/views/critical_notification_bubble_view.cc +++ b/chrome/browser/ui/views/critical_notification_bubble_view.cc
@@ -120,7 +120,7 @@ void CriticalNotificationBubbleView::Init() { bubble_created_ = base::TimeTicks::Now(); - SetLayoutManager(new views::FillLayout()); + SetLayoutManager(std::make_unique<views::FillLayout>()); views::Label* message = new views::Label(); message->SetMultiLine(true);
diff --git a/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views.cc b/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views.cc index 578d6fd..766418b9 100644 --- a/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views.cc +++ b/chrome/browser/ui/views/desktop_capture/desktop_media_picker_views.cc
@@ -64,7 +64,7 @@ pane_(new views::TabbedPane()) { const ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); - SetLayoutManager(new views::BoxLayout( + SetLayoutManager(std::make_unique<views::BoxLayout>( views::BoxLayout::kVertical, provider->GetDialogInsetsForContentType(views::TEXT, views::CONTROL), provider->GetDistanceMetric(DISTANCE_RELATED_CONTROL_VERTICAL_SMALL)));
diff --git a/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc b/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc index 211dcb49..65673b2c 100644 --- a/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc +++ b/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc
@@ -93,7 +93,8 @@ RatingsView(double rating, int rating_count) : rating_(rating), rating_count_(rating_count) { set_id(ExtensionInstallDialogView::kRatingsViewId); - SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal)); + SetLayoutManager( + std::make_unique<views::BoxLayout>(views::BoxLayout::kHorizontal)); } ~RatingsView() override {} @@ -692,10 +693,10 @@ ExpandableContainerView::DetailsView::DetailsView( const PermissionDetails& details) : state_(0) { - SetLayoutManager( - new views::BoxLayout(views::BoxLayout::kVertical, gfx::Insets(), - ChromeLayoutProvider::Get()->GetDistanceMetric( - DISTANCE_RELATED_CONTROL_VERTICAL_SMALL))); + SetLayoutManager(std::make_unique<views::BoxLayout>( + views::BoxLayout::kVertical, gfx::Insets(), + ChromeLayoutProvider::Get()->GetDistanceMetric( + DISTANCE_RELATED_CONTROL_VERTICAL_SMALL))); for (auto& detail : details) { views::Label* detail_label = new views::Label(PrepareForDisplay(detail, false));
diff --git a/chrome/browser/ui/views/extensions/extension_installed_bubble_view.cc b/chrome/browser/ui/views/extensions/extension_installed_bubble_view.cc index 5d6d6d9..61a1b3a 100644 --- a/chrome/browser/ui/views/extensions/extension_installed_bubble_view.cc +++ b/chrome/browser/ui/views/extensions/extension_installed_bubble_view.cc
@@ -251,9 +251,9 @@ // Extra info can include a promo for signing into sync. ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); - std::unique_ptr<views::BoxLayout> layout(new views::BoxLayout( + auto layout = std::make_unique<views::BoxLayout>( views::BoxLayout::kVertical, gfx::Insets(), - provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_VERTICAL))); + provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_VERTICAL)); layout->set_minimum_cross_axis_size(kRightColumnWidth); // Indent by the size of the icon. layout->set_inside_border_insets(gfx::Insets( @@ -263,7 +263,7 @@ 0, 0)); layout->set_cross_axis_alignment( views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); - SetLayoutManager(layout.release()); + SetLayoutManager(std::move(layout)); if (controller_->options() & ExtensionInstalledBubble::HOW_TO_USE) AddChildView(CreateLabel(controller_->GetHowToUseDescription()));
diff --git a/chrome/browser/ui/views/extensions/extension_popup.cc b/chrome/browser/ui/views/extensions/extension_popup.cc index 296a4db..deadc4eb 100644 --- a/chrome/browser/ui/views/extensions/extension_popup.cc +++ b/chrome/browser/ui/views/extensions/extension_popup.cc
@@ -55,7 +55,7 @@ : BubbleDialogDelegateView(anchor_view, arrow), host_(host) { inspect_with_devtools_ = show_action == SHOW_AND_INSPECT; set_margins(gfx::Insets()); - SetLayoutManager(new views::FillLayout()); + SetLayoutManager(std::make_unique<views::FillLayout>()); AddChildView(GetExtensionView(host)); GetExtensionView(host)->set_container(this); // ExtensionPopup closes itself on very specific de-activation conditions.
diff --git a/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc b/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc index 87f225f1..7e949fa 100644 --- a/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc +++ b/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc
@@ -162,7 +162,7 @@ gfx::Size(extension_misc::EXTENSION_ICON_SMALL, extension_misc::EXTENSION_ICON_SMALL))) { ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); - SetLayoutManager(new views::BoxLayout( + SetLayoutManager(std::make_unique<views::BoxLayout>( views::BoxLayout::kVertical, provider->GetDialogInsetsForContentType(views::TEXT, views::TEXT), provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_VERTICAL)));
diff --git a/chrome/browser/ui/views/extensions/media_galleries_dialog_views.cc b/chrome/browser/ui/views/extensions/media_galleries_dialog_views.cc index 70746ce..512b820 100644 --- a/chrome/browser/ui/views/extensions/media_galleries_dialog_views.cc +++ b/chrome/browser/ui/views/extensions/media_galleries_dialog_views.cc
@@ -131,7 +131,7 @@ const int small_vertical_padding = provider->GetDistanceMetric(DISTANCE_RELATED_CONTROL_VERTICAL_SMALL); ScrollableView* scroll_container = new ScrollableView(); - scroll_container->SetLayoutManager(new views::BoxLayout( + scroll_container->SetLayoutManager(std::make_unique<views::BoxLayout>( views::BoxLayout::kVertical, gfx::Insets(), small_vertical_padding)); scroll_container->SetBorder( views::CreateEmptyBorder(vertical_padding, 0, vertical_padding, 0));
diff --git a/chrome/browser/ui/views/extensions/media_gallery_checkbox_view.cc b/chrome/browser/ui/views/extensions/media_gallery_checkbox_view.cc index 30853f0..60fe721 100644 --- a/chrome/browser/ui/views/extensions/media_gallery_checkbox_view.cc +++ b/chrome/browser/ui/views/extensions/media_gallery_checkbox_view.cc
@@ -29,7 +29,8 @@ views::ButtonListener* button_listener, views::ContextMenuController* menu_controller) { DCHECK(button_listener != NULL); - SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal)); + SetLayoutManager( + std::make_unique<views::BoxLayout>(views::BoxLayout::kHorizontal)); ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); const gfx::Insets dialog_insets = provider->GetInsetsMetric(views::INSETS_DIALOG);
diff --git a/chrome/browser/ui/views/extensions/pwa_confirmation_view.cc b/chrome/browser/ui/views/extensions/pwa_confirmation_view.cc index 0027787..4ae988a3 100644 --- a/chrome/browser/ui/views/extensions/pwa_confirmation_view.cc +++ b/chrome/browser/ui/views/extensions/pwa_confirmation_view.cc
@@ -140,14 +140,15 @@ int icon_label_spacing = layout_provider->GetDistanceMetric( views::DISTANCE_RELATED_CONTROL_HORIZONTAL); - SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, - gfx::Insets(), icon_label_spacing)); + SetLayoutManager(std::make_unique<views::BoxLayout>( + views::BoxLayout::kHorizontal, gfx::Insets(), icon_label_spacing)); AddChildView(CreateIconView(web_app_info_.icons).release()); views::View* labels = new views::View(); AddChildView(labels); - labels->SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical)); + labels->SetLayoutManager( + std::make_unique<views::BoxLayout>(views::BoxLayout::kVertical)); labels->AddChildView(CreateNameLabel(web_app_info_.title).release()); labels->AddChildView(
diff --git a/chrome/browser/ui/views/extensions/request_file_system_dialog_view.cc b/chrome/browser/ui/views/extensions/request_file_system_dialog_view.cc index 72ffa5f7..6b6b53c7 100644 --- a/chrome/browser/ui/views/extensions/request_file_system_dialog_view.cc +++ b/chrome/browser/ui/views/extensions/request_file_system_dialog_view.cc
@@ -120,7 +120,7 @@ placeholder_offsets[1] + volume_name.length()), bold_style); - SetLayoutManager(new views::FillLayout()); + SetLayoutManager(std::make_unique<views::FillLayout>()); AddChildView(label); }
diff --git a/chrome/browser/ui/views/external_protocol_dialog.cc b/chrome/browser/ui/views/external_protocol_dialog.cc index 01e94498..a764f63 100644 --- a/chrome/browser/ui/views/external_protocol_dialog.cc +++ b/chrome/browser/ui/views/external_protocol_dialog.cc
@@ -103,7 +103,7 @@ set_margins( provider->GetDialogInsetsForContentType(views::CONTROL, views::CONTROL)); - SetLayoutManager(new views::FillLayout()); + SetLayoutManager(std::make_unique<views::FillLayout>()); DCHECK(delegate_->GetMessageText().empty()); remember_decision_checkbox_ =
diff --git a/chrome/browser/ui/views/feature_promos/feature_promo_bubble_view.cc b/chrome/browser/ui/views/feature_promos/feature_promo_bubble_view.cc index f82da996..4ff146a9 100644 --- a/chrome/browser/ui/views/feature_promos/feature_promo_bubble_view.cc +++ b/chrome/browser/ui/views/feature_promos/feature_promo_bubble_view.cc
@@ -65,7 +65,7 @@ views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER); box_layout->set_cross_axis_alignment( views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER); - SetLayoutManager(box_layout.release()); + SetLayoutManager(std::move(box_layout)); AddChildView(new views::Label(l10n_util::GetStringUTF16(string_specifier))); if (activation_action == ActivationAction::DO_NOT_ACTIVATE) {
diff --git a/chrome/browser/ui/views/find_bar_view.cc b/chrome/browser/ui/views/find_bar_view.cc index c608b5f..5a32a67 100644 --- a/chrome/browser/ui/views/find_bar_view.cc +++ b/chrome/browser/ui/views/find_bar_view.cc
@@ -199,12 +199,10 @@ find_text_->SetBorder(views::NullBorder()); - views::BoxLayout* manager = new views::BoxLayout( + auto* manager = SetLayoutManager(std::make_unique<views::BoxLayout>( views::BoxLayout::kHorizontal, gfx::Insets(provider->GetInsetsMetric(INSETS_TOAST) - horizontal_margin), - 0); - - SetLayoutManager(manager); + 0)); manager->SetFlexForView(find_text_, 1); } @@ -300,6 +298,14 @@ return size; } +void FindBarView::AddedToWidget() { + // Since the find bar now works/looks like a location bar bubble, make sure it + // doesn't get dark themed in incognito mode. + if (find_bar_host_->browser_view()->browser()->profile()->GetProfileType() == + Profile::INCOGNITO_PROFILE) + SetNativeTheme(ui::NativeTheme::GetInstanceForNativeUi()); +} + //////////////////////////////////////////////////////////////////////////////// // FindBarView, DropdownBarHostDelegate implementation:
diff --git a/chrome/browser/ui/views/find_bar_view.h b/chrome/browser/ui/views/find_bar_view.h index a6c0f995..22e4af9b 100644 --- a/chrome/browser/ui/views/find_bar_view.h +++ b/chrome/browser/ui/views/find_bar_view.h
@@ -88,6 +88,10 @@ // views::ViewTargeterDelegate: views::View* TargetForRect(View* root, const gfx::Rect& rect) override; + protected: + // views::View overrides: + void AddedToWidget() override; + private: // Starts finding |search_text|. If the text is empty, stops finding. void Find(const base::string16& search_text);
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index b4182a4..71ed5e2 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -2105,7 +2105,7 @@ GetThemeProvider()->GetColor(ThemeProperties::COLOR_CONTROL_BACKGROUND))); contents_container_->AddChildView(devtools_web_view_); contents_container_->AddChildView(contents_web_view_); - contents_container_->SetLayoutManager(new ContentsLayoutManager( + contents_container_->SetLayoutManager(std::make_unique<ContentsLayoutManager>( devtools_web_view_, contents_web_view_)); AddChildView(contents_container_); set_contents_view(contents_container_); @@ -2119,9 +2119,10 @@ if (IsExperimentalTabStripEnabled()) { tabstrip_ = new TabStripExperimental(browser_->tab_strip_model()); top_container_->AddChildView(tabstrip_); // Takes ownership. - } else -#endif + } else { // Avoid a "} else" which will trigger presubmit warning. +#else { +#endif // TabStrip takes ownership of the controller. BrowserTabStripController* tabstrip_controller = new BrowserTabStripController(browser_->tab_strip_model(), this); @@ -2150,7 +2151,7 @@ immersive_mode_controller_->Init(this); - BrowserViewLayout* browser_view_layout = new BrowserViewLayout; + auto browser_view_layout = std::make_unique<BrowserViewLayout>(); browser_view_layout->Init(new BrowserViewLayoutDelegateImpl(this), browser(), this, @@ -2161,7 +2162,7 @@ contents_container_, GetContentsLayoutManager(), immersive_mode_controller_.get()); - SetLayoutManager(browser_view_layout); + SetLayoutManager(std::move(browser_view_layout)); #if defined(OS_WIN) // Create a custom JumpList and add it to an observer of TabRestoreService
diff --git a/chrome/browser/ui/views/frame/browser_view_layout_unittest.cc b/chrome/browser/ui/views/frame/browser_view_layout_unittest.cc index 4c9f6690..c75888b3 100644 --- a/chrome/browser/ui/views/frame/browser_view_layout_unittest.cc +++ b/chrome/browser/ui/views/frame/browser_view_layout_unittest.cc
@@ -154,8 +154,9 @@ contents_container_->AddChildView(devtools_web_view_); contents_container_->AddChildView(contents_web_view_); ContentsLayoutManager* contents_layout_manager = - new ContentsLayoutManager(devtools_web_view_, contents_web_view_); - contents_container_->SetLayoutManager(contents_layout_manager); + contents_container_->SetLayoutManager( + std::make_unique<ContentsLayoutManager>(devtools_web_view_, + contents_web_view_)); root_view_->AddChildView(contents_container_);
diff --git a/chrome/browser/ui/views/frame/desktop_linux_browser_frame_view_layout_unittest.cc b/chrome/browser/ui/views/frame/desktop_linux_browser_frame_view_layout_unittest.cc index b9f6c07..8ba56246 100644 --- a/chrome/browser/ui/views/frame/desktop_linux_browser_frame_view_layout_unittest.cc +++ b/chrome/browser/ui/views/frame/desktop_linux_browser_frame_view_layout_unittest.cc
@@ -11,8 +11,6 @@ #include "ui/views/controls/button/image_button.h" #include "ui/views/test/views_test_base.h" -using NNBFVL = DesktopLinuxBrowserFrameViewLayout; - namespace { constexpr int kWindowWidth = 500; @@ -140,15 +138,16 @@ delegate_.reset(new TestLayoutDelegate); nav_button_provider_ = base::MakeUnique<::TestNavButtonProvider>(); - layout_manager_ = new NNBFVL(nav_button_provider_.get()); - layout_manager_->set_delegate(delegate_.get()); - layout_manager_->set_extra_caption_y(0); - layout_manager_->set_forced_window_caption_spacing_for_test(0); + auto layout = std::make_unique<DesktopLinuxBrowserFrameViewLayout>( + nav_button_provider_.get()); + layout->set_delegate(delegate_.get()); + layout->set_extra_caption_y(0); + layout->set_forced_window_caption_spacing_for_test(0); widget_ = new views::Widget; widget_->Init(CreateParams(views::Widget::InitParams::TYPE_POPUP)); root_view_ = widget_->GetRootView(); root_view_->SetSize(gfx::Size(kWindowWidth, kWindowWidth)); - root_view_->SetLayoutManager(layout_manager_); + layout_manager_ = root_view_->SetLayoutManager(std::move(layout)); minimize_button_ = InitWindowCaptionButton(VIEW_ID_MINIMIZE_BUTTON); maximize_button_ = InitWindowCaptionButton(VIEW_ID_MAXIMIZE_BUTTON); @@ -194,7 +193,7 @@ views::Widget* widget_ = nullptr; views::View* root_view_ = nullptr; - NNBFVL* layout_manager_ = nullptr; + DesktopLinuxBrowserFrameViewLayout* layout_manager_ = nullptr; std::unique_ptr<TestLayoutDelegate> delegate_; std::unique_ptr<views::NavButtonProvider> nav_button_provider_;
diff --git a/chrome/browser/ui/views/frame/hosted_app_button_container.cc b/chrome/browser/ui/views/frame/hosted_app_button_container.cc index c7a7986b..d2a5f0c 100644 --- a/chrome/browser/ui/views/frame/hosted_app_button_container.cc +++ b/chrome/browser/ui/views/frame/hosted_app_button_container.cc
@@ -66,7 +66,7 @@ std::make_unique<views::BoxLayout>(views::BoxLayout::kHorizontal); layout->set_cross_axis_alignment( views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER); - SetLayoutManager(layout.release()); + SetLayoutManager(std::move(layout)); std::vector<std::unique_ptr<ContentSettingImageModel>> models = ContentSettingImageModel::GenerateContentSettingImageModels();
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc index b019aad..d72acddf 100644 --- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc +++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
@@ -75,7 +75,7 @@ window_title_(nullptr), frame_background_(new views::FrameBackground()) { layout_->set_delegate(this); - SetLayoutManager(layout_); + SetLayoutManager(std::unique_ptr<views::LayoutManager>(layout_)); minimize_button_ = InitWindowCaptionButton(IDR_MINIMIZE, IDR_MINIMIZE_H,
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_unittest.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_unittest.cc index 3393d9ed..22c6efad 100644 --- a/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_unittest.cc +++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_unittest.cc
@@ -95,15 +95,15 @@ views::ViewsTestBase::SetUp(); delegate_.reset(new TestLayoutDelegate); - layout_manager_ = new OBFVL(); - layout_manager_->set_delegate(delegate_.get()); - layout_manager_->set_extra_caption_y(0); - layout_manager_->set_forced_window_caption_spacing_for_test(0); + auto layout = std::make_unique<OBFVL>(); + layout->set_delegate(delegate_.get()); + layout->set_extra_caption_y(0); + layout->set_forced_window_caption_spacing_for_test(0); widget_ = new views::Widget; widget_->Init(CreateParams(views::Widget::InitParams::TYPE_POPUP)); root_view_ = widget_->GetRootView(); root_view_->SetSize(gfx::Size(kWindowWidth, kWindowWidth)); - root_view_->SetLayoutManager(layout_manager_); + layout_manager_ = root_view_->SetLayoutManager(std::move(layout)); // Add the caption buttons. We use fake images because we're modeling the // Windows assets here, while the linux version uses differently sized
diff --git a/chrome/browser/ui/views/fullscreen_control/fullscreen_control_host.cc b/chrome/browser/ui/views/fullscreen_control/fullscreen_control_host.cc index 2cdae8d..a4e9221 100644 --- a/chrome/browser/ui/views/fullscreen_control/fullscreen_control_host.cc +++ b/chrome/browser/ui/views/fullscreen_control/fullscreen_control_host.cc
@@ -62,7 +62,7 @@ return; } - if (browser_view_->IsFullscreen()) { + if (IsExitUiNeeded()) { if (IsVisible()) { float control_bottom = static_cast<float>( fullscreen_control_popup_.GetFinalBounds().bottom()); @@ -98,8 +98,8 @@ } void FullscreenControlHost::OnGestureEvent(ui::GestureEvent* event) { - if (event->type() == ui::ET_GESTURE_LONG_PRESS && - browser_view_->IsFullscreen() && !IsVisible()) { + if (event->type() == ui::ET_GESTURE_LONG_PRESS && IsExitUiNeeded() && + !IsVisible()) { ShowForInputEntryMethod(InputEntryMethod::TOUCH); } } @@ -132,3 +132,8 @@ Hide(true); } } + +bool FullscreenControlHost::IsExitUiNeeded() { + return browser_view_->IsFullscreen() && + browser_view_->ShouldHideUIForFullscreen(); +}
diff --git a/chrome/browser/ui/views/fullscreen_control/fullscreen_control_host.h b/chrome/browser/ui/views/fullscreen_control/fullscreen_control_host.h index 9778193..0d43229 100644 --- a/chrome/browser/ui/views/fullscreen_control/fullscreen_control_host.h +++ b/chrome/browser/ui/views/fullscreen_control/fullscreen_control_host.h
@@ -55,6 +55,7 @@ void ShowForInputEntryMethod(InputEntryMethod input_entry_method); void OnVisibilityChanged(); void OnTouchPopupTimeout(); + bool IsExitUiNeeded(); InputEntryMethod input_entry_method_ = InputEntryMethod::NOT_ACTIVE;
diff --git a/chrome/browser/ui/views/fullscreen_control/fullscreen_control_view.cc b/chrome/browser/ui/views/fullscreen_control/fullscreen_control_view.cc index 6524278d..2617e17a 100644 --- a/chrome/browser/ui/views/fullscreen_control/fullscreen_control_view.cc +++ b/chrome/browser/ui/views/fullscreen_control/fullscreen_control_view.cc
@@ -37,7 +37,7 @@ close_image_view->SetImage(gfx::CreateVectorIcon( vector_icons::kCloseIcon, kCloseIconSize, SK_ColorWHITE)); AddChildView(close_image_view.release()); - SetLayoutManager(new views::FillLayout()); + SetLayoutManager(std::make_unique<views::FillLayout>()); } private: @@ -61,7 +61,7 @@ : on_button_pressed_(on_button_pressed), exit_fullscreen_button_(new CloseFullscreenButton(this)) { AddChildView(exit_fullscreen_button_); - SetLayoutManager(new views::FillLayout()); + SetLayoutManager(std::make_unique<views::FillLayout>()); exit_fullscreen_button_->SetPreferredSize( gfx::Size(kCircleButtonDiameter, kCircleButtonDiameter)); }
diff --git a/chrome/browser/ui/views/ime/ime_window_view.cc b/chrome/browser/ui/views/ime/ime_window_view.cc index 408ea18..cc9f6d0 100644 --- a/chrome/browser/ui/views/ime/ime_window_view.cc +++ b/chrome/browser/ui/views/ime/ime_window_view.cc
@@ -53,7 +53,7 @@ web_view_->SetFocusBehavior(FocusBehavior::NEVER); AddChildView(web_view_); - SetLayoutManager(new views::FillLayout); + SetLayoutManager(std::make_unique<views::FillLayout>()); Layout(); // TODO(shuchen): supports auto cursor/composition aligning for
diff --git a/chrome/browser/ui/views/importer/import_lock_dialog_view.cc b/chrome/browser/ui/views/importer/import_lock_dialog_view.cc index d777b45..30e9bbd1 100644 --- a/chrome/browser/ui/views/importer/import_lock_dialog_view.cc +++ b/chrome/browser/ui/views/importer/import_lock_dialog_view.cc
@@ -48,7 +48,7 @@ ImportLockDialogView::ImportLockDialogView( const base::Callback<void(bool)>& callback) : callback_(callback) { - SetLayoutManager(new views::FillLayout()); + SetLayoutManager(std::make_unique<views::FillLayout>()); views::Label* description_label = new views::Label(l10n_util::GetStringUTF16(IDS_IMPORTER_LOCK_TEXT)); description_label->SetBorder(views::CreateEmptyBorder(
diff --git a/chrome/browser/ui/views/intent_picker_bubble_view.cc b/chrome/browser/ui/views/intent_picker_bubble_view.cc index 1d52ede..57f478f 100644 --- a/chrome/browser/ui/views/intent_picker_bubble_view.cc +++ b/chrome/browser/ui/views/intent_picker_bubble_view.cc
@@ -215,9 +215,8 @@ // Creates a view to hold the views for each app. views::View* scrollable_view = new views::View(); - views::BoxLayout* scrollable_layout = - new views::BoxLayout(views::BoxLayout::kVertical); - scrollable_view->SetLayoutManager(scrollable_layout); + scrollable_view->SetLayoutManager( + std::make_unique<views::BoxLayout>(views::BoxLayout::kVertical)); size_t i = 0; size_t to_erase = app_info_.size();
diff --git a/chrome/browser/ui/views/location_bar/keyword_hint_view.cc b/chrome/browser/ui/views/location_bar/keyword_hint_view.cc index b9eb9a0..3f37b89 100644 --- a/chrome/browser/ui/views/location_bar/keyword_hint_view.cc +++ b/chrome/browser/ui/views/location_bar/keyword_hint_view.cc
@@ -54,7 +54,7 @@ chip_container_->SetBackground(base::MakeUnique<BackgroundWith1PxBorder>( tab_bg_color, tab_border_color)); chip_container_->AddChildView(chip_label_); - chip_container_->SetLayoutManager(new views::FillLayout()); + chip_container_->SetLayoutManager(std::make_unique<views::FillLayout>()); AddChildView(chip_container_); trailing_label_ =
diff --git a/chrome/browser/ui/views/location_bar/zoom_bubble_view.cc b/chrome/browser/ui/views/location_bar/zoom_bubble_view.cc index 61e4b24..b602e61 100644 --- a/chrome/browser/ui/views/location_bar/zoom_bubble_view.cc +++ b/chrome/browser/ui/views/location_bar/zoom_bubble_view.cc
@@ -274,14 +274,14 @@ const ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); const int spacing = provider->GetDistanceMetric(DISTANCE_UNRELATED_CONTROL_HORIZONTAL); - views::BoxLayout* box_layout = new views::BoxLayout( + auto box_layout = std::make_unique<views::BoxLayout>( views::BoxLayout::kHorizontal, provider->GetInsetsMetric(INSETS_TOAST) - margins(), spacing); box_layout->set_main_axis_alignment( views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER); box_layout->set_cross_axis_alignment( views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER); - SetLayoutManager(box_layout); + SetLayoutManager(std::move(box_layout)); // Calculate child views margins in |this| client view. const int label_vertical_spacing =
diff --git a/chrome/browser/ui/views/network_profile_bubble_view.cc b/chrome/browser/ui/views/network_profile_bubble_view.cc index 9f0621e4..2dcc57c 100644 --- a/chrome/browser/ui/views/network_profile_bubble_view.cc +++ b/chrome/browser/ui/views/network_profile_bubble_view.cc
@@ -77,7 +77,7 @@ } void NetworkProfileBubbleView::Init() { - SetLayoutManager(new views::FillLayout()); + SetLayoutManager(std::make_unique<views::FillLayout>()); views::Label* label = new views::Label( l10n_util::GetStringFUTF16(IDS_PROFILE_ON_NETWORK_WARNING, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)));
diff --git a/chrome/browser/ui/views/outdated_upgrade_bubble_view.cc b/chrome/browser/ui/views/outdated_upgrade_bubble_view.cc index 1e5498a..091a498 100644 --- a/chrome/browser/ui/views/outdated_upgrade_bubble_view.cc +++ b/chrome/browser/ui/views/outdated_upgrade_bubble_view.cc
@@ -151,7 +151,7 @@ } void OutdatedUpgradeBubbleView::Init() { - SetLayoutManager(new views::FillLayout()); + SetLayoutManager(std::make_unique<views::FillLayout>()); views::Label* text_label = new views::Label(l10n_util::GetStringUTF16(IDS_UPGRADE_BUBBLE_TEXT)); text_label->SetMultiLine(true);
diff --git a/chrome/browser/ui/views/page_info/page_info_bubble_view.cc b/chrome/browser/ui/views/page_info/page_info_bubble_view.cc index 62db838..f1b91158 100644 --- a/chrome/browser/ui/views/page_info/page_info_bubble_view.cc +++ b/chrome/browser/ui/views/page_info/page_info_bubble_view.cc
@@ -216,7 +216,7 @@ site_settings_link->set_listener(listener); site_settings_link->SetUnderline(false); auto link_section = std::make_unique<views::View>(); - link_section->SetLayoutManager(new views::BoxLayout( + link_section->SetLayoutManager(std::make_unique<views::BoxLayout>( views::BoxLayout::kHorizontal, gfx::Insets(0, side_margin))); link_section->AddChildView(site_settings_link); return link_section; @@ -329,7 +329,7 @@ layout->StartRow(0, label_column_status); reset_decisions_label_container_ = new views::View(); reset_decisions_label_container_->SetLayoutManager( - new views::BoxLayout(views::BoxLayout::kHorizontal)); + std::make_unique<views::BoxLayout>(views::BoxLayout::kHorizontal)); layout->AddView(reset_decisions_label_container_, 1, 1, GridLayout::FILL, GridLayout::LEADING); @@ -413,14 +413,14 @@ (password_reuse_button_container_->width() - kSpacingBetweenButtons) >= (change_password_button_->CalculatePreferredSize().width() + whitelist_password_reuse_button_->CalculatePreferredSize().width()); - views::BoxLayout* layout = - new views::BoxLayout(can_fit_in_one_line ? views::BoxLayout::kHorizontal - : views::BoxLayout::kVertical, - gfx::Insets(), kSpacingBetweenButtons); + auto layout = std::make_unique<views::BoxLayout>( + can_fit_in_one_line ? views::BoxLayout::kHorizontal + : views::BoxLayout::kVertical, + gfx::Insets(), kSpacingBetweenButtons); // Make buttons left-aligned. For RTL languages, buttons will automatically // become right-aligned. layout->set_main_axis_alignment(views::BoxLayout::MAIN_AXIS_ALIGNMENT_START); - password_reuse_button_container_->SetLayoutManager(layout); + password_reuse_button_container_->SetLayoutManager(std::move(layout)); #if defined(OS_WIN) || defined(OS_CHROMEOS) password_reuse_button_container_->AddChildView(change_password_button_); @@ -935,9 +935,8 @@ views::View* PageInfoBubbleView::CreateSiteSettingsView() { views::View* site_settings_view = new views::View(); - views::BoxLayout* box_layout = - new views::BoxLayout(views::BoxLayout::kVertical); - site_settings_view->SetLayoutManager(box_layout); + auto* box_layout = site_settings_view->SetLayoutManager( + std::make_unique<views::BoxLayout>(views::BoxLayout::kVertical)); box_layout->set_cross_axis_alignment( views::BoxLayout::CROSS_AXIS_ALIGNMENT_STRETCH);
diff --git a/chrome/browser/ui/views/passwords/account_chooser_dialog_view.cc b/chrome/browser/ui/views/passwords/account_chooser_dialog_view.cc index 53de1ca6..930c81eba 100644 --- a/chrome/browser/ui/views/passwords/account_chooser_dialog_view.cc +++ b/chrome/browser/ui/views/passwords/account_chooser_dialog_view.cc
@@ -55,7 +55,7 @@ content::mojom::URLLoaderFactory* loader_factory) { views::View* list_view = new views::View; list_view->SetLayoutManager( - new views::BoxLayout(views::BoxLayout::kVertical)); + std::make_unique<views::BoxLayout>(views::BoxLayout::kVertical)); int item_height = 0; for (const auto& form : forms) { std::pair<base::string16, base::string16> titles = @@ -178,7 +178,7 @@ } void AccountChooserDialogView::InitWindow() { - SetLayoutManager(new views::FillLayout()); + SetLayoutManager(std::make_unique<views::FillLayout>()); AddChildView( CreateCredentialsView(controller_->GetLocalForms(), this, content::BrowserContext::GetDefaultStoragePartition(
diff --git a/chrome/browser/ui/views/passwords/auto_signin_first_run_dialog_view.cc b/chrome/browser/ui/views/passwords/auto_signin_first_run_dialog_view.cc index 9ca20e4..d152993 100644 --- a/chrome/browser/ui/views/passwords/auto_signin_first_run_dialog_view.cc +++ b/chrome/browser/ui/views/passwords/auto_signin_first_run_dialog_view.cc
@@ -86,7 +86,7 @@ SetBorder(views::CreateEmptyBorder( ChromeLayoutProvider::Get()->GetDialogInsetsForContentType(views::TEXT, views::TEXT))); - SetLayoutManager(new views::FillLayout()); + SetLayoutManager(std::make_unique<views::FillLayout>()); std::pair<base::string16, gfx::Range> text_content = controller_->GetAutoSigninText();
diff --git a/chrome/browser/ui/views/passwords/manage_password_items_view.cc b/chrome/browser/ui/views/passwords/manage_password_items_view.cc index cfe058b..aab01ea 100644 --- a/chrome/browser/ui/views/passwords/manage_password_items_view.cc +++ b/chrome/browser/ui/views/passwords/manage_password_items_view.cc
@@ -224,8 +224,7 @@ DCHECK_EQ(password_manager::ui::MANAGE_STATE, model()->state()); if (model()->local_credentials().empty()) { - views::LayoutManager* layout = new views::FillLayout(); - SetLayoutManager(layout); + SetLayoutManager(std::make_unique<views::FillLayout>()); views::Label* no_passwords_label = new views::Label( l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_NO_PASSWORDS), CONTEXT_BODY_TEXT_SMALL);
diff --git a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc index 2c4d6fb5..106a0c7 100644 --- a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc +++ b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
@@ -381,7 +381,7 @@ ManagePasswordsBubbleView* parent) : parent_(parent), observed_browser_(this) { - SetLayoutManager(new views::FillLayout); + SetLayoutManager(std::make_unique<views::FillLayout>()); const autofill::PasswordForm& form = parent_->model()->pending_password(); CredentialsItemView* credential; base::string16 upper_text, lower_text = form.username_value; @@ -893,8 +893,7 @@ } void ManagePasswordsBubbleView::Init() { - SetLayoutManager(new views::FillLayout); - + SetLayoutManager(std::make_unique<views::FillLayout>()); CreateChild(); }
diff --git a/chrome/browser/ui/views/payments/credit_card_editor_view_controller.cc b/chrome/browser/ui/views/payments/credit_card_editor_view_controller.cc index 04c4f132..b25ad0a 100644 --- a/chrome/browser/ui/views/payments/credit_card_editor_view_controller.cc +++ b/chrome/browser/ui/views/payments/credit_card_editor_view_controller.cc
@@ -191,14 +191,14 @@ // 6dp is added to the bottom padding, for a total of 12 between the icons and // the first input field. constexpr int kRowBottomPadding = 6; - views::BoxLayout* layout = new views::BoxLayout( + auto layout = std::make_unique<views::BoxLayout>( views::BoxLayout::kVertical, gfx::Insets(kRowBottomPadding, kPaymentRequestRowHorizontalInsets), kRowVerticalSpacing); layout->set_main_axis_alignment(views::BoxLayout::MAIN_AXIS_ALIGNMENT_START); layout->set_cross_axis_alignment( views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); - view->SetLayoutManager(layout); + view->SetLayoutManager(std::move(layout)); // "Cards accepted" label is "hint" grey. view->AddChildView(CreateHintLabel(GetAcceptedCardTypesText( @@ -208,9 +208,8 @@ // 8dp padding is required between icons. constexpr int kPaddingBetweenCardIcons = 8; std::unique_ptr<views::View> icons_row = base::MakeUnique<views::View>(); - views::BoxLayout* icons_layout = new views::BoxLayout( - views::BoxLayout::kHorizontal, gfx::Insets(), kPaddingBetweenCardIcons); - icons_row->SetLayoutManager(icons_layout); + icons_row->SetLayoutManager(std::make_unique<views::BoxLayout>( + views::BoxLayout::kHorizontal, gfx::Insets(), kPaddingBetweenCardIcons)); std::string selected_network = credit_card_to_edit_ ? autofill::data_util::GetPaymentRequestData( @@ -246,9 +245,9 @@ // link. if (IsEditingServerCard()) { std::unique_ptr<views::View> data_source = base::MakeUnique<views::View>(); - auto data_source_layout = base::MakeUnique<views::BoxLayout>( - views::BoxLayout::kHorizontal, gfx::Insets(), kPaddingBetweenCardIcons); - data_source->SetLayoutManager(data_source_layout.release()); + data_source->SetLayoutManager(std::make_unique<views::BoxLayout>( + views::BoxLayout::kHorizontal, gfx::Insets(), + kPaddingBetweenCardIcons)); // "From Google Payments". data_source->AddChildView( @@ -346,7 +345,7 @@ return nullptr; std::unique_ptr<views::View> button_view = base::MakeUnique<views::View>(); - button_view->SetLayoutManager(new views::FillLayout); + button_view->SetLayoutManager(std::make_unique<views::FillLayout>()); // The button to add new billing addresses. std::unique_ptr<views::Button> add_button(
diff --git a/chrome/browser/ui/views/payments/editor_view_controller.cc b/chrome/browser/ui/views/payments/editor_view_controller.cc index cdb7c7d..276f154 100644 --- a/chrome/browser/ui/views/payments/editor_view_controller.cc +++ b/chrome/browser/ui/views/payments/editor_view_controller.cc
@@ -58,7 +58,7 @@ // This is the space between the input field and the error label. constexpr int kErrorLabelTopPadding = 6; layout->set_inside_border_insets(gfx::Insets(kErrorLabelTopPadding, 0, 0, 0)); - view->SetLayoutManager(layout.release()); + view->SetLayoutManager(std::move(layout)); std::unique_ptr<views::Label> error_label = base::MakeUnique<views::Label>(error, CONTEXT_DEPRECATED_SMALL); @@ -138,11 +138,11 @@ } void EditorViewController::FillContentView(views::View* content_view) { - views::BoxLayout* layout = new views::BoxLayout(views::BoxLayout::kVertical); + auto layout = std::make_unique<views::BoxLayout>(views::BoxLayout::kVertical); layout->set_main_axis_alignment(views::BoxLayout::MAIN_AXIS_ALIGNMENT_START); layout->set_cross_axis_alignment( views::BoxLayout::CROSS_AXIS_ALIGNMENT_STRETCH); - content_view->SetLayoutManager(layout); + content_view->SetLayoutManager(std::move(layout)); // No insets. Child views below are responsible for their padding. // An editor can optionally have a header view specific to it. @@ -436,7 +436,7 @@ layout->SkipColumns(1); std::unique_ptr<views::View> error_label_view = base::MakeUnique<views::View>(); - error_label_view->SetLayoutManager(new views::FillLayout); + error_label_view->SetLayoutManager(std::make_unique<views::FillLayout>()); error_labels_[field.type] = error_label_view.get(); if (IsEditingExistingItem() && !error_message.empty()) AddOrUpdateErrorMessageForField(field.type, error_message);
diff --git a/chrome/browser/ui/views/payments/error_message_view_controller.cc b/chrome/browser/ui/views/payments/error_message_view_controller.cc index 426e2698..594bc2e 100644 --- a/chrome/browser/ui/views/payments/error_message_view_controller.cc +++ b/chrome/browser/ui/views/payments/error_message_view_controller.cc
@@ -49,13 +49,13 @@ } void ErrorMessageViewController::FillContentView(views::View* content_view) { - views::BoxLayout* layout = new views::BoxLayout( + auto layout = std::make_unique<views::BoxLayout>( views::BoxLayout::kVertical, gfx::Insets(0, kPaymentRequestRowHorizontalInsets), 0); layout->set_main_axis_alignment(views::BoxLayout::MAIN_AXIS_ALIGNMENT_START); layout->set_cross_axis_alignment( views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); - content_view->SetLayoutManager(layout); + content_view->SetLayoutManager(std::move(layout)); std::unique_ptr<views::Label> label = base::MakeUnique<views::Label>( l10n_util::GetStringUTF16(IDS_PAYMENTS_ERROR_MESSAGE));
diff --git a/chrome/browser/ui/views/payments/order_summary_view_controller.cc b/chrome/browser/ui/views/payments/order_summary_view_controller.cc index 334700a3..a0d1db93 100644 --- a/chrome/browser/ui/views/payments/order_summary_view_controller.cc +++ b/chrome/browser/ui/views/payments/order_summary_view_controller.cc
@@ -156,11 +156,11 @@ } void OrderSummaryViewController::FillContentView(views::View* content_view) { - views::BoxLayout* layout = new views::BoxLayout(views::BoxLayout::kVertical); + auto layout = std::make_unique<views::BoxLayout>(views::BoxLayout::kVertical); layout->set_main_axis_alignment(views::BoxLayout::MAIN_AXIS_ALIGNMENT_START); layout->set_cross_axis_alignment( views::BoxLayout::CROSS_AXIS_ALIGNMENT_STRETCH); - content_view->SetLayoutManager(layout); + content_view->SetLayoutManager(std::move(layout)); bool is_mixed_currency = spec()->IsMixedCurrency(); // Set the ID for the first few line items labels, for testing.
diff --git a/chrome/browser/ui/views/payments/payment_method_view_controller.cc b/chrome/browser/ui/views/payments/payment_method_view_controller.cc index 0a085b5..d8aa1c7 100644 --- a/chrome/browser/ui/views/payments/payment_method_view_controller.cc +++ b/chrome/browser/ui/views/payments/payment_method_view_controller.cc
@@ -120,7 +120,7 @@ gfx::Insets(kPaymentRequestRowVerticalInsets, 0)); box_layout->set_cross_axis_alignment( views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); - card_info_container->SetLayoutManager(box_layout.release()); + card_info_container->SetLayoutManager(std::move(box_layout)); base::string16 label = instrument_->GetLabel(); if (!label.empty()) @@ -213,7 +213,7 @@ layout->set_main_axis_alignment(views::BoxLayout::MAIN_AXIS_ALIGNMENT_START); layout->set_cross_axis_alignment( views::BoxLayout::CROSS_AXIS_ALIGNMENT_STRETCH); - content_view->SetLayoutManager(layout.release()); + content_view->SetLayoutManager(std::move(layout)); base::string16 sub_header = GetCardTypesAreAcceptedText(spec()->supported_card_types_set()); @@ -231,9 +231,9 @@ PaymentMethodViewController::CreateExtraFooterView() { auto extra_view = base::MakeUnique<views::View>(); - extra_view->SetLayoutManager( - new views::BoxLayout(views::BoxLayout::kHorizontal, gfx::Insets(), - kPaymentRequestButtonSpacing)); + extra_view->SetLayoutManager(std::make_unique<views::BoxLayout>( + views::BoxLayout::kHorizontal, gfx::Insets(), + kPaymentRequestButtonSpacing)); views::LabelButton* button = views::MdTextButton::CreateSecondaryUiButton( this, l10n_util::GetStringUTF16(IDS_PAYMENTS_ADD_CARD));
diff --git a/chrome/browser/ui/views/payments/payment_request_dialog_view.cc b/chrome/browser/ui/views/payments/payment_request_dialog_view.cc index 3d107d2d..db07676 100644 --- a/chrome/browser/ui/views/payments/payment_request_dialog_view.cc +++ b/chrome/browser/ui/views/payments/payment_request_dialog_view.cc
@@ -71,7 +71,7 @@ DCHECK_CURRENTLY_ON(content::BrowserThread::UI); request->spec()->AddObserver(this); - SetLayoutManager(new views::FillLayout()); + SetLayoutManager(std::make_unique<views::FillLayout>()); view_stack_ = base::MakeUnique<ViewStack>(); view_stack_->set_owned_by_client();
diff --git a/chrome/browser/ui/views/payments/payment_request_item_list.cc b/chrome/browser/ui/views/payments/payment_request_item_list.cc index e476ce94..3420c0e6 100644 --- a/chrome/browser/ui/views/payments/payment_request_item_list.cc +++ b/chrome/browser/ui/views/payments/payment_request_item_list.cc
@@ -202,10 +202,9 @@ std::unique_ptr<views::View> PaymentRequestItemList::CreateListView() { std::unique_ptr<views::View> content_view = base::MakeUnique<views::View>(); - views::BoxLayout* layout = - new views::BoxLayout(views::BoxLayout::kVertical, - gfx::Insets(kPaymentRequestRowVerticalInsets, 0), 0); - content_view->SetLayoutManager(layout); + content_view->SetLayoutManager(std::make_unique<views::BoxLayout>( + views::BoxLayout::kVertical, + gfx::Insets(kPaymentRequestRowVerticalInsets, 0), 0)); for (auto& item : items_) content_view->AddChildView(item.release());
diff --git a/chrome/browser/ui/views/payments/payment_request_sheet_controller.cc b/chrome/browser/ui/views/payments/payment_request_sheet_controller.cc index 7c7b96f..cf1a391e 100644 --- a/chrome/browser/ui/views/payments/payment_request_sheet_controller.cc +++ b/chrome/browser/ui/views/payments/payment_request_sheet_controller.cc
@@ -364,8 +364,9 @@ base::MakeUnique<views::View>(); trailing_buttons_container->SetLayoutManager( - new views::BoxLayout(views::BoxLayout::kHorizontal, gfx::Insets(), - kPaymentRequestButtonSpacing)); + std::make_unique<views::BoxLayout>(views::BoxLayout::kHorizontal, + gfx::Insets(), + kPaymentRequestButtonSpacing)); #if defined(OS_MACOSX) AddSecondaryButton(trailing_buttons_container.get());
diff --git a/chrome/browser/ui/views/payments/payment_request_views_util.cc b/chrome/browser/ui/views/payments/payment_request_views_util.cc index 48a0a94..e87a80b 100644 --- a/chrome/browser/ui/views/payments/payment_request_views_util.cc +++ b/chrome/browser/ui/views/payments/payment_request_views_util.cc
@@ -69,7 +69,7 @@ views::BoxLayout::kVertical, gfx::Insets(), 0); layout->set_cross_axis_alignment( views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); - container->SetLayoutManager(layout.release()); + container->SetLayoutManager(std::move(layout)); if (!s1.empty()) { const int text_style = type == AddressStyleType::DETAILED @@ -259,12 +259,12 @@ std::unique_ptr<views::View> CreateProductLogoFooterView() { std::unique_ptr<views::View> content_view = base::MakeUnique<views::View>(); - views::BoxLayout* layout = - new views::BoxLayout(views::BoxLayout::kHorizontal, gfx::Insets(), 0); + auto layout = std::make_unique<views::BoxLayout>( + views::BoxLayout::kHorizontal, gfx::Insets(), 0); layout->set_main_axis_alignment(views::BoxLayout::MAIN_AXIS_ALIGNMENT_START); layout->set_cross_axis_alignment( views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); - content_view->SetLayoutManager(layout); + content_view->SetLayoutManager(std::move(layout)); // Adds the Chrome logo image. std::unique_ptr<views::ImageView> chrome_logo = @@ -375,11 +375,11 @@ DCHECK(accessible_content); std::unique_ptr<views::View> container = base::MakeUnique<views::View>(); - std::unique_ptr<views::BoxLayout> layout = base::MakeUnique<views::BoxLayout>( - views::BoxLayout::kVertical, gfx::Insets(), 0); + auto layout = std::make_unique<views::BoxLayout>(views::BoxLayout::kVertical, + gfx::Insets(), 0); layout->set_cross_axis_alignment( views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); - container->SetLayoutManager(layout.release()); + container->SetLayoutManager(std::move(layout)); if (shipping_option) { const base::string16& text = base::UTF8ToUTF16(shipping_option->label);
diff --git a/chrome/browser/ui/views/payments/payment_sheet_view_controller.cc b/chrome/browser/ui/views/payments/payment_sheet_view_controller.cc index 8ad78045..fee876f 100644 --- a/chrome/browser/ui/views/payments/payment_sheet_view_controller.cc +++ b/chrome/browser/ui/views/payments/payment_sheet_view_controller.cc
@@ -152,7 +152,6 @@ std::unique_ptr<PaymentRequestRowView> row = base::MakeUnique<PaymentRequestRowView>(listener, clickable, row_insets); views::GridLayout* layout = views::GridLayout::CreateAndInstall(row.get()); - row->SetLayoutManager(layout); views::ColumnSet* columns = layout->AddColumnSet(0); // A column for the section name. @@ -414,7 +413,6 @@ void PaymentSheetViewController::FillContentView(views::View* content_view) { views::GridLayout* layout = views::GridLayout::CreateAndInstall(content_view); - content_view->SetLayoutManager(layout); views::ColumnSet* columns = layout->AddColumnSet(0); columns->AddColumn(views::GridLayout::FILL, views::GridLayout::CENTER, 1, views::GridLayout::USE_PREF, 0, 0); @@ -731,7 +729,6 @@ views::GridLayout* layout = views::GridLayout::CreateAndInstall(content_view.get()); - content_view->SetLayoutManager(layout); views::ColumnSet* columns = layout->AddColumnSet(0); columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 1, views::GridLayout::USE_PREF, 0, 0); @@ -911,13 +908,13 @@ std::unique_ptr<views::View> PaymentSheetViewController::CreateDataSourceRow() { std::unique_ptr<views::View> content_view = base::MakeUnique<views::View>(); - views::BoxLayout* layout = - new views::BoxLayout(views::BoxLayout::kVertical, - gfx::Insets(0, kPaymentRequestRowHorizontalInsets)); + auto layout = std::make_unique<views::BoxLayout>( + views::BoxLayout::kVertical, + gfx::Insets(0, kPaymentRequestRowHorizontalInsets)); layout->set_main_axis_alignment(views::BoxLayout::MAIN_AXIS_ALIGNMENT_START); layout->set_cross_axis_alignment( views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); - content_view->SetLayoutManager(layout); + content_view->SetLayoutManager(std::move(layout)); base::string16 data_source; // If no transaction has been completed so far, choose which string to display
diff --git a/chrome/browser/ui/views/payments/profile_list_view_controller.cc b/chrome/browser/ui/views/payments/profile_list_view_controller.cc index 328edaed..ae5fa57 100644 --- a/chrome/browser/ui/views/payments/profile_list_view_controller.cc +++ b/chrome/browser/ui/views/payments/profile_list_view_controller.cc
@@ -192,7 +192,7 @@ views::BoxLayout::MAIN_AXIS_ALIGNMENT_START); layout->set_cross_axis_alignment( views::BoxLayout::CROSS_AXIS_ALIGNMENT_STRETCH); - header_view->SetLayoutManager(layout.release()); + header_view->SetLayoutManager(std::move(layout)); auto label = base::MakeUnique<views::Label>( spec()->selected_shipping_option_error().empty() @@ -392,7 +392,7 @@ layout->set_main_axis_alignment(views::BoxLayout::MAIN_AXIS_ALIGNMENT_START); layout->set_cross_axis_alignment( views::BoxLayout::CROSS_AXIS_ALIGNMENT_STRETCH); - content_view->SetLayoutManager(layout.release()); + content_view->SetLayoutManager(std::move(layout)); std::unique_ptr<views::View> header_view = CreateHeaderView(); if (header_view) content_view->AddChildView(header_view.release()); @@ -405,9 +405,9 @@ ProfileListViewController::CreateExtraFooterView() { auto extra_view = base::MakeUnique<views::View>(); - extra_view->SetLayoutManager( - new views::BoxLayout(views::BoxLayout::kHorizontal, gfx::Insets(), - kPaymentRequestButtonSpacing)); + extra_view->SetLayoutManager(std::make_unique<views::BoxLayout>( + views::BoxLayout::kHorizontal, gfx::Insets(), + kPaymentRequestButtonSpacing)); views::LabelButton* button = views::MdTextButton::CreateSecondaryUiButton( this, l10n_util::GetStringUTF16(GetSecondaryButtonTextId()));
diff --git a/chrome/browser/ui/views/payments/shipping_option_view_controller.cc b/chrome/browser/ui/views/payments/shipping_option_view_controller.cc index 22d7b2b..e5afb160 100644 --- a/chrome/browser/ui/views/payments/shipping_option_view_controller.cc +++ b/chrome/browser/ui/views/payments/shipping_option_view_controller.cc
@@ -112,7 +112,7 @@ } void ShippingOptionViewController::FillContentView(views::View* content_view) { - content_view->SetLayoutManager(new views::FillLayout); + content_view->SetLayoutManager(std::make_unique<views::FillLayout>()); content_view->AddChildView(shipping_option_list_.CreateListView().release()); }
diff --git a/chrome/browser/ui/views/payments/view_stack.cc b/chrome/browser/ui/views/payments/view_stack.cc index b3e6c81..0b4673c6 100644 --- a/chrome/browser/ui/views/payments/view_stack.cc +++ b/chrome/browser/ui/views/payments/view_stack.cc
@@ -13,7 +13,7 @@ ViewStack::ViewStack() : slide_in_animator_(base::MakeUnique<views::BoundsAnimator>(this)), slide_out_animator_(base::MakeUnique<views::BoundsAnimator>(this)) { - SetLayoutManager(new views::FillLayout()); + SetLayoutManager(std::make_unique<views::FillLayout>()); slide_out_animator_->AddObserver(this); slide_in_animator_->AddObserver(this);
diff --git a/chrome/browser/ui/views/permission_bubble/permission_prompt_impl.cc b/chrome/browser/ui/views/permission_bubble/permission_prompt_impl.cc index 4088aaa..f77678a 100644 --- a/chrome/browser/ui/views/permission_bubble/permission_prompt_impl.cc +++ b/chrome/browser/ui/views/permission_bubble/permission_prompt_impl.cc
@@ -118,7 +118,7 @@ #endif ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); - SetLayoutManager(new views::BoxLayout( + SetLayoutManager(std::make_unique<views::BoxLayout>( views::BoxLayout::kVertical, gfx::Insets(), provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_VERTICAL))); @@ -126,7 +126,7 @@ views::View* label_container = new views::View(); int indent = provider->GetDistanceMetric(DISTANCE_SUBSECTION_HORIZONTAL_INDENT); - label_container->SetLayoutManager(new views::BoxLayout( + label_container->SetLayoutManager(std::make_unique<views::BoxLayout>( views::BoxLayout::kHorizontal, gfx::Insets(0, indent), provider->GetDistanceMetric(views::DISTANCE_RELATED_LABEL_HORIZONTAL))); views::ImageView* icon = new views::ImageView();
diff --git a/chrome/browser/ui/views/profiles/profile_chooser_view.cc b/chrome/browser/ui/views/profiles/profile_chooser_view.cc index 933da78..f2c1d96b 100644 --- a/chrome/browser/ui/views/profiles/profile_chooser_view.cc +++ b/chrome/browser/ui/views/profiles/profile_chooser_view.cc
@@ -787,12 +787,12 @@ // Sets an overall horizontal layout. views::View* view = new views::View(); - views::BoxLayout* layout = new views::BoxLayout( + auto layout = std::make_unique<views::BoxLayout>( views::BoxLayout::kHorizontal, gfx::Insets(kMenuEdgeMargin), provider->GetDistanceMetric(DISTANCE_UNRELATED_CONTROL_HORIZONTAL)); layout->set_cross_axis_alignment( views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); - view->SetLayoutManager(layout); + view->SetLayoutManager(std::move(layout)); // Adds the sync problem icon. views::ImageView* sync_problem_icon = new views::ImageView(); @@ -804,11 +804,11 @@ views::View* vertical_view = new views::View(); const int small_vertical_spacing = provider->GetDistanceMetric(DISTANCE_RELATED_CONTROL_VERTICAL_SMALL); - views::BoxLayout* vertical_layout = new views::BoxLayout( + auto vertical_layout = std::make_unique<views::BoxLayout>( views::BoxLayout::kVertical, gfx::Insets(), small_vertical_spacing); vertical_layout->set_cross_axis_alignment( views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); - vertical_view->SetLayoutManager(vertical_layout); + vertical_view->SetLayoutManager(std::move(vertical_layout)); // Adds the title. views::Label* title_label = new views::Label( @@ -859,7 +859,7 @@ // of hover_button->SetBorder() because the latter creates a border with the // same color as the button. views::View* view = new views::View(); - view->SetLayoutManager(new views::FillLayout()); + view->SetLayoutManager(std::make_unique<views::FillLayout>()); view->SetBorder( views::CreateSolidBorder(kMenuEdgeMargin, SK_ColorTRANSPARENT)); auto current_profile_photo = std::make_unique<BadgedProfilePhoto>( @@ -898,9 +898,9 @@ account_consistency_enabled ? provider->GetDistanceMetric(DISTANCE_CONTENT_LIST_VERTICAL_MULTI) : provider->GetDistanceMetric(DISTANCE_CONTENT_LIST_VERTICAL_SINGLE); - view->SetLayoutManager( - new views::BoxLayout(views::BoxLayout::kVertical, - gfx::Insets(content_list_vert_spacing, 0), 0)); + view->SetLayoutManager(std::make_unique<views::BoxLayout>( + views::BoxLayout::kVertical, gfx::Insets(content_list_vert_spacing, 0), + 0)); auto current_profile_photo = std::make_unique<BadgedProfilePhoto>( GetProfileBadgeType(browser_->profile()), avatar_item.icon); @@ -950,13 +950,12 @@ browser_->profile()->GetOriginalProfile()); if (signin_manager->IsSigninAllowed()) { views::View* extra_links_view = new views::View(); - views::BoxLayout* extra_links_layout = new views::BoxLayout( + extra_links_view->SetLayoutManager(std::make_unique<views::BoxLayout>( views::BoxLayout::kVertical, gfx::Insets(provider->GetDistanceMetric( views::DISTANCE_RELATED_CONTROL_VERTICAL), kMenuEdgeMargin), - kMenuEdgeMargin); - extra_links_view->SetLayoutManager(extra_links_layout); + kMenuEdgeMargin)); views::Label* promo = new views::Label(l10n_util::GetStringUTF16(IDS_PROFILES_SIGNIN_PROMO)); promo->SetMultiLine(true); @@ -997,7 +996,7 @@ // future, once the final asset is ready. constexpr int kIllustrationPromoOverlap = 48; views::View* view = new views::View(); - view->SetLayoutManager(new views::BoxLayout( + view->SetLayoutManager(std::make_unique<views::BoxLayout>( views::BoxLayout::kVertical, gfx::Insets(), -kIllustrationPromoOverlap)); ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); @@ -1008,7 +1007,7 @@ view->AddChildView(illustration); views::View* promo_button_view = new views::View(); - promo_button_view->SetLayoutManager(new views::BoxLayout( + promo_button_view->SetLayoutManager(std::make_unique<views::BoxLayout>( views::BoxLayout::kVertical, gfx::Insets(0, kMenuEdgeMargin, kMenuEdgeMargin, kMenuEdgeMargin), kMenuEdgeMargin));
diff --git a/chrome/browser/ui/views/profiles/user_manager_view.cc b/chrome/browser/ui/views/profiles/user_manager_view.cc index 7e49f8f..d4ab2c3 100644 --- a/chrome/browser/ui/views/profiles/user_manager_view.cc +++ b/chrome/browser/ui/views/profiles/user_manager_view.cc
@@ -63,7 +63,7 @@ const GURL& url) : parent_(parent), web_view_(web_view), email_address_(email_address) { AddChildView(web_view_); - SetLayoutManager(new views::FillLayout()); + SetLayoutManager(std::make_unique<views::FillLayout>()); web_view_->GetWebContents()->SetDelegate(this); web_view_->LoadInitialURL(url); @@ -322,7 +322,7 @@ web_view_ = new views::WebView(system_profile); web_view_->set_allow_accelerators(true); AddChildView(web_view_); - SetLayoutManager(new views::FillLayout); + SetLayoutManager(std::make_unique<views::FillLayout>()); AddAccelerator(ui::Accelerator(ui::VKEY_W, ui::EF_CONTROL_DOWN)); AddAccelerator(ui::Accelerator(ui::VKEY_F4, ui::EF_ALT_DOWN));
diff --git a/chrome/browser/ui/views/translate/translate_bubble_view.cc b/chrome/browser/ui/views/translate/translate_bubble_view.cc index 38ebd8d59..e3d1a61 100644 --- a/chrome/browser/ui/views/translate/translate_bubble_view.cc +++ b/chrome/browser/ui/views/translate/translate_bubble_view.cc
@@ -162,6 +162,32 @@ return ui::DIALOG_BUTTON_NONE; } +base::string16 TranslateBubbleView::GetWindowTitle() const { + // The 2016Q2 UI doesn't use a window title. + if (Use2016Q2UI()) + return base::string16(); + int id = 0; + switch (model_->GetViewState()) { + case TranslateBubbleModel::VIEW_STATE_BEFORE_TRANSLATE: + id = IDS_TRANSLATE_BUBBLE_BEFORE_TRANSLATE_TITLE; + break; + case TranslateBubbleModel::VIEW_STATE_TRANSLATING: + id = IDS_TRANSLATE_BUBBLE_TRANSLATING; + break; + case TranslateBubbleModel::VIEW_STATE_AFTER_TRANSLATE: + id = IDS_TRANSLATE_BUBBLE_TRANSLATED_TITLE; + break; + case TranslateBubbleModel::VIEW_STATE_ERROR: + id = IDS_TRANSLATE_BUBBLE_COULD_NOT_TRANSLATE_TITLE; + break; + case TranslateBubbleModel::VIEW_STATE_ADVANCED: + id = IDS_TRANSLATE_BUBBLE_ADVANCED_TITLE; + break; + } + + return l10n_util::GetStringUTF16(id); +} + void TranslateBubbleView::Init() { SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical)); @@ -201,7 +227,7 @@ } bool TranslateBubbleView::ShouldShowCloseButton() const { - return Use2016Q2UI(); + return true; } void TranslateBubbleView::WindowClosing() { @@ -276,17 +302,29 @@ const ui::Event* event) { if (!denial_menu_runner_) { denial_menu_model_.reset(new ui::SimpleMenuModel(this)); + denial_menu_model_->AddItem( DenialMenuItem::NEVER_TRANSLATE_LANGUAGE, l10n_util::GetStringFUTF16( IDS_TRANSLATE_BUBBLE_NEVER_TRANSLATE_LANG, model_->GetLanguageNameAt(model_->GetOriginalLanguageIndex()))); - denial_menu_model_->AddSeparator(ui::NORMAL_SEPARATOR); + // TODO(crbug.com/793925): Blacklisting should probably not be possible in + // incognito mode as it leaves a trace of the user. + if (model_->CanBlacklistSite()) { + if (Use2016Q2UI()) { + denial_menu_model_->AddSeparator(ui::NORMAL_SEPARATOR); + } - denial_menu_model_->AddItemWithStringId( - DenialMenuItem::NEVER_TRANSLATE_SITE, - IDS_TRANSLATE_BUBBLE_NEVER_TRANSLATE_SITE); + denial_menu_model_->AddItemWithStringId( + DenialMenuItem::NEVER_TRANSLATE_SITE, + IDS_TRANSLATE_BUBBLE_NEVER_TRANSLATE_SITE); + } + + if (!Use2016Q2UI()) { + denial_menu_model_->AddItemWithStringId( + DenialMenuItem::MORE_OPTIONS, IDS_TRANSLATE_BUBBLE_ADVANCED_BUTTON); + } denial_menu_runner_.reset( new views::MenuRunner(denial_menu_model_.get(), 0)); @@ -306,21 +344,27 @@ } void TranslateBubbleView::ExecuteCommand(int command_id, int event_flags) { - model_->DeclineTranslation(); switch (command_id) { case DenialMenuItem::NEVER_TRANSLATE_LANGUAGE: - model_->SetNeverTranslateLanguage(true); translate::ReportUiAction( translate::NEVER_TRANSLATE_LANGUAGE_MENU_CLICKED); + model_->SetNeverTranslateLanguage(true); + model_->DeclineTranslation(); + GetWidget()->Close(); break; case DenialMenuItem::NEVER_TRANSLATE_SITE: - model_->SetNeverTranslateSite(true); translate::ReportUiAction(translate::NEVER_TRANSLATE_SITE_MENU_CLICKED); + model_->SetNeverTranslateSite(true); + model_->DeclineTranslation(); + GetWidget()->Close(); + break; + case DenialMenuItem::MORE_OPTIONS: + translate::ReportUiAction(translate::ADVANCED_MENU_CLICKED); + SwitchView(TranslateBubbleModel::VIEW_STATE_ADVANCED); break; default: NOTREACHED(); } - GetWidget()->Close(); } void TranslateBubbleView::StyledLabelLinkClicked(views::StyledLabel* label, @@ -358,7 +402,6 @@ after_translate_view_(NULL), error_view_(NULL), advanced_view_(NULL), - denial_combobox_(NULL), source_language_combobox_(NULL), target_language_combobox_(NULL), before_always_translate_checkbox_(NULL), @@ -443,6 +486,11 @@ : translate::ALWAYS_TRANSLATE_UNCHECKED); break; } + case BUTTON_ID_ADVANCED: { + SwitchView(TranslateBubbleModel::VIEW_STATE_ADVANCED); + translate::ReportUiAction(translate::ADVANCED_BUTTON_CLICKED); + break; + } } } @@ -468,31 +516,6 @@ void TranslateBubbleView::HandleComboboxPerformAction( TranslateBubbleView::ComboboxID sender_id) { switch (sender_id) { - case COMBOBOX_ID_DENIAL: { - model_->DeclineTranslation(); - DenialComboboxIndex index = - static_cast<DenialComboboxIndex>(denial_combobox_->selected_index()); - switch (index) { - case DenialComboboxIndex::DONT_TRANSLATE: - translate::ReportUiAction(translate::NOPE_MENU_CLICKED); - break; - case DenialComboboxIndex::NEVER_TRANSLATE_LANGUAGE: - model_->SetNeverTranslateLanguage(true); - translate::ReportUiAction( - translate::NEVER_TRANSLATE_LANGUAGE_MENU_CLICKED); - break; - case DenialComboboxIndex::NEVER_TRANSLATE_SITE: - model_->SetNeverTranslateSite(true); - translate::ReportUiAction( - translate::NEVER_TRANSLATE_SITE_MENU_CLICKED); - break; - default: - NOTREACHED(); - break; - } - GetWidget()->Close(); - break; - } case COMBOBOX_ID_SOURCE_LANGUAGE: { if (model_->GetOriginalLanguageIndex() == source_language_combobox_->selected_index()) { @@ -519,7 +542,7 @@ } void TranslateBubbleView::UpdateChildVisibilities() { - // Update the statew of the always translate checkbox + // Update the state of the always translate checkbox if (advanced_always_translate_checkbox_) advanced_always_translate_checkbox_->SetChecked(should_always_translate_); if (before_always_translate_checkbox_) @@ -528,6 +551,8 @@ views::View* view = child_at(i); view->SetVisible(view == GetCurrentView()); } + if (!Use2016Q2UI() && GetWidget()) + GetWidget()->UpdateWindowTitle(); // BoxLayout only considers visible children, so ensure any newly visible // child views are positioned correctly. Layout(); @@ -605,17 +630,14 @@ style_info); styled_label->SizeToFit(kQuestionWidth); layout->AddView(styled_label); - } else { - layout->AddView(new views::Label( - l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_BEFORE_TRANSLATE))); - layout->AddView( - CreateLink(this, IDS_TRANSLATE_BUBBLE_ADVANCED, LINK_ID_ADVANCED)); } + const int vertical_spacing = + provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_VERTICAL); + // In an incognito window, the "Always translate" checkbox shouldn't be shown. if (Use2016Q2UI() && !is_in_incognito_window_) { - layout->AddPaddingRow(0, provider->GetDistanceMetric( - views::DISTANCE_RELATED_CONTROL_VERTICAL)); + layout->AddPaddingRow(0, vertical_spacing); layout->StartRow(0, COLUMN_SET_ID_MESSAGE); layout->SkipColumns(1); before_always_translate_checkbox_ = new views::Checkbox( @@ -625,8 +647,7 @@ layout->AddView(before_always_translate_checkbox_); } - layout->AddPaddingRow(0, provider->GetDistanceMetric( - views::DISTANCE_UNRELATED_CONTROL_VERTICAL)); + layout->AddPaddingRow(0, vertical_spacing); layout->StartRow(0, COLUMN_SET_ID_CONTENT); views::LabelButton* accept_button = @@ -638,39 +659,12 @@ accept_button->set_id(BUTTON_ID_TRANSLATE); layout->AddView(accept_button); accept_button->SetIsDefault(true); - if (Use2016Q2UI()) { - denial_menu_button_ = new views::MenuButton( - l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_OPTIONS_MENU_BUTTON), - this, true); - denial_menu_button_->SetStyleDeprecated(views::Button::STYLE_BUTTON); - layout->AddView(denial_menu_button_); - } else { - // Can the site of the current page be blacklisted? This will be false for - // example for file:///... URLs. - const bool can_blacklist_site = model_->CanBlacklistSite(); - - // Number of items in the combobox. - const size_t menu_size = static_cast<size_t>( - can_blacklist_site ? DenialComboboxIndex::MENU_SIZE - : DenialComboboxIndex::MENU_SIZE_NO_BLACKLIST); - - std::vector<base::string16> items(menu_size); - items[static_cast<size_t>(DenialComboboxIndex::DONT_TRANSLATE)] = - l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_DENY); - items[static_cast<size_t>(DenialComboboxIndex::NEVER_TRANSLATE_LANGUAGE)] = - l10n_util::GetStringFUTF16(IDS_TRANSLATE_BUBBLE_NEVER_TRANSLATE_LANG, - original_language_name); - if (can_blacklist_site) { - items[static_cast<size_t>(DenialComboboxIndex::NEVER_TRANSLATE_SITE)] = - l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_NEVER_TRANSLATE_SITE); - } - denial_combobox_model_.reset(new ui::SimpleComboboxModel(items)); - denial_combobox_ = new views::Combobox(denial_combobox_model_.get(), - views::Combobox::STYLE_ACTION); - denial_combobox_->set_id(COMBOBOX_ID_DENIAL); - denial_combobox_->set_listener(this); - layout->AddView(denial_combobox_); - } + const bool show_dropdown_arrow = Use2016Q2UI(); + denial_menu_button_ = new views::MenuButton( + l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_OPTIONS_MENU_BUTTON), this, + show_dropdown_arrow); + denial_menu_button_->SetStyleDeprecated(views::Button::STYLE_BUTTON); + layout->AddView(denial_menu_button_); return view; } @@ -678,8 +672,6 @@ views::View* TranslateBubbleView::CreateViewTranslating() { base::string16 target_language_name = model_->GetLanguageNameAt(model_->GetTargetLanguageIndex()); - views::Label* label = new views::Label( - l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_TRANSLATING)); views::View* view = new views::View(); views::GridLayout* layout = views::GridLayout::CreateAndInstall(view); @@ -709,10 +701,18 @@ cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, GridLayout::USE_PREF, 0, 0); - layout->StartRow(0, COLUMN_SET_ID_MESSAGE); - if (Use2016Q2UI()) + if (Use2016Q2UI()) { + layout->StartRow(0, COLUMN_SET_ID_MESSAGE); AddIconToLayout(layout); - layout->AddView(label); + views::Label* label = new views::Label( + l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_TRANSLATING)); + layout->AddView(label); + } else { + cs->AddPaddingColumn(0, provider->GetDistanceMetric( + views::DISTANCE_RELATED_BUTTON_HORIZONTAL)); + cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, + GridLayout::USE_PREF, 0, 0); + } layout->AddPaddingRow(0, provider->GetDistanceMetric( views::DISTANCE_UNRELATED_CONTROL_VERTICAL)); @@ -724,14 +724,18 @@ revert_button->set_id(BUTTON_ID_SHOW_ORIGINAL); revert_button->SetEnabled(false); layout->AddView(revert_button); + if (!Use2016Q2UI()) { + views::LabelButton* button = views::MdTextButton::CreateSecondaryUiButton( + this, l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ADVANCED_BUTTON)); + button->set_id(BUTTON_ID_ADVANCED); + button->SetEnabled(false); + layout->AddView(button); + } return view; } views::View* TranslateBubbleView::CreateViewAfterTranslate() { - views::Label* label = new views::Label( - l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_TRANSLATED)); - views::View* view = new views::View(); views::GridLayout* layout = views::GridLayout::CreateAndInstall(view); @@ -745,13 +749,13 @@ ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); views::ColumnSet* cs = layout->AddColumnSet(COLUMN_SET_ID_MESSAGE); - + const int button_spacing = + provider->GetDistanceMetric(views::DISTANCE_RELATED_BUTTON_HORIZONTAL); // TODO(ftang) Restore icon without causing layout defects: crbug.com/610351 cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, GridLayout::USE_PREF, 0, 0); - cs->AddPaddingColumn(0, provider->GetDistanceMetric( - views::DISTANCE_RELATED_BUTTON_HORIZONTAL)); + cs->AddPaddingColumn(0, button_spacing); cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, GridLayout::USE_PREF, 0, 0); cs->AddPaddingColumn(1, 0); @@ -761,10 +765,18 @@ cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, GridLayout::USE_PREF, 0, 0); - layout->StartRow(0, COLUMN_SET_ID_MESSAGE); - layout->AddView(label); - layout->AddView( - CreateLink(this, IDS_TRANSLATE_BUBBLE_ADVANCED, LINK_ID_ADVANCED)); + if (Use2016Q2UI()) { + layout->StartRow(0, COLUMN_SET_ID_MESSAGE); + views::Label* label = new views::Label( + l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_TRANSLATED)); + layout->AddView(label); + layout->AddView( + CreateLink(this, IDS_TRANSLATE_BUBBLE_ADVANCED_LINK, LINK_ID_ADVANCED)); + } else { + cs->AddPaddingColumn(0, button_spacing); + cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, + GridLayout::USE_PREF, 0, 0); + } layout->AddPaddingRow(0, provider->GetDistanceMetric( views::DISTANCE_UNRELATED_CONTROL_VERTICAL)); @@ -774,14 +786,17 @@ this, l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_REVERT)); button->set_id(BUTTON_ID_SHOW_ORIGINAL); layout->AddView(button); + if (!Use2016Q2UI()) { + views::LabelButton* button = views::MdTextButton::CreateSecondaryUiButton( + this, l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ADVANCED_BUTTON)); + button->set_id(BUTTON_ID_ADVANCED); + layout->AddView(button); + } return view; } views::View* TranslateBubbleView::CreateViewError() { - views::Label* label = new views::Label( - l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_COULD_NOT_TRANSLATE)); - views::View* view = new views::View(); views::GridLayout* layout = views::GridLayout::CreateAndInstall(view); @@ -795,13 +810,14 @@ ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); views::ColumnSet* cs = layout->AddColumnSet(COLUMN_SET_ID_MESSAGE); + const int button_spacing = + provider->GetDistanceMetric(views::DISTANCE_RELATED_BUTTON_HORIZONTAL); // TODO(ftang) Restore icon without causing layout defects: crbug.com/610351 cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, GridLayout::USE_PREF, 0, 0); - cs->AddPaddingColumn(0, provider->GetDistanceMetric( - views::DISTANCE_RELATED_BUTTON_HORIZONTAL)); + cs->AddPaddingColumn(0, button_spacing); cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, GridLayout::USE_PREF, 0, 0); cs->AddPaddingColumn(1, 0); @@ -811,10 +827,18 @@ cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, GridLayout::USE_PREF, 0, 0); - layout->StartRow(0, COLUMN_SET_ID_MESSAGE); - layout->AddView(label); - layout->AddView( - CreateLink(this, IDS_TRANSLATE_BUBBLE_ADVANCED, LINK_ID_ADVANCED)); + if (Use2016Q2UI()) { + layout->StartRow(0, COLUMN_SET_ID_MESSAGE); + views::Label* label = new views::Label( + l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_COULD_NOT_TRANSLATE)); + layout->AddView(label); + layout->AddView( + CreateLink(this, IDS_TRANSLATE_BUBBLE_ADVANCED_LINK, LINK_ID_ADVANCED)); + } else { + cs->AddPaddingColumn(0, button_spacing); + cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, + GridLayout::USE_PREF, 0, 0); + } layout->AddPaddingRow(0, provider->GetDistanceMetric( views::DISTANCE_UNRELATED_CONTROL_VERTICAL)); @@ -824,6 +848,12 @@ this, l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_TRY_AGAIN)); button->set_id(BUTTON_ID_TRY_AGAIN); layout->AddView(button); + if (!Use2016Q2UI()) { + views::LabelButton* button = views::MdTextButton::CreateSecondaryUiButton( + this, l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ADVANCED_BUTTON)); + button->set_id(BUTTON_ID_ADVANCED); + layout->AddView(button); + } return view; } @@ -914,8 +944,7 @@ layout->AddView(advanced_always_translate_checkbox_); } - layout->AddPaddingRow(0, provider->GetDistanceMetric( - views::DISTANCE_UNRELATED_CONTROL_VERTICAL)); + layout->AddPaddingRow(0, vertical_spacing); layout->StartRow(0, COLUMN_SET_ID_BUTTONS); // TODO(estade): this should use CreateExtraView().
diff --git a/chrome/browser/ui/views/translate/translate_bubble_view.h b/chrome/browser/ui/views/translate/translate_bubble_view.h index 57ba526..839a37b 100644 --- a/chrome/browser/ui/views/translate/translate_bubble_view.h +++ b/chrome/browser/ui/views/translate/translate_bubble_view.h
@@ -36,10 +36,6 @@ class View; } -namespace ui { -class SimpleComboboxModel; -} - class TranslateBubbleView : public LocationBarBubbleDelegateView, public views::ButtonListener, public views::ComboboxListener, @@ -49,19 +45,12 @@ public views::StyledLabelListener, public content::WebContentsObserver { public: - // Commands shown in the action-style combobox. The value corresponds to the - // position in the combobox menu. - enum class DenialComboboxIndex { - DONT_TRANSLATE = 0, - NEVER_TRANSLATE_LANGUAGE = 1, - SEPARATOR = 2, - MENU_SIZE_NO_BLACKLIST = SEPARATOR, - NEVER_TRANSLATE_SITE = 3, - MENU_SIZE = 4, - }; - // Item IDs for the denial button's menu. - enum DenialMenuItem { NEVER_TRANSLATE_LANGUAGE, NEVER_TRANSLATE_SITE }; + enum DenialMenuItem { + NEVER_TRANSLATE_LANGUAGE, + NEVER_TRANSLATE_SITE, + MORE_OPTIONS + }; ~TranslateBubbleView() override; @@ -88,6 +77,7 @@ // views::BubbleDialogDelegateView methods. int GetDialogButtons() const override; + base::string16 GetWindowTitle() const override; void Init() override; void ButtonPressed(views::Button* sender, const ui::Event& event) override; @@ -147,10 +137,10 @@ BUTTON_ID_SHOW_ORIGINAL, BUTTON_ID_TRY_AGAIN, BUTTON_ID_ALWAYS_TRANSLATE, + BUTTON_ID_ADVANCED, }; enum ComboboxID { - COMBOBOX_ID_DENIAL, COMBOBOX_ID_SOURCE_LANGUAGE, COMBOBOX_ID_TARGET_LANGUAGE, }; @@ -163,6 +153,7 @@ const ::base::string16&); FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, TranslateButton); FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, TranslateButtonIn2016Q2UI); + FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, CloseButton); FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, CloseButtonIn2016Q2UI); FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, AdvancedLink); FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, AdvancedLinkIn2016Q2UI); @@ -180,6 +171,12 @@ FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, CancelButtonReturningAfterTranslate); FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, CancelButtonReturningError); + FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, + DenialMenuNeverTranslateLanguage); + FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, + DenialMenuRespectsBlacklistSite); + FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewTest, + DenialMenuNeverTranslateSite); FRIEND_TEST_ALL_PREFIXES(TranslateLanguageBrowserTest, TranslateAndRevert); FRIEND_TEST_ALL_PREFIXES(TranslateBubbleViewBrowserTest, CheckNeverTranslateThisSiteBlacklist); @@ -243,11 +240,9 @@ views::View* error_view_; views::View* advanced_view_; - std::unique_ptr<ui::SimpleComboboxModel> denial_combobox_model_; std::unique_ptr<LanguageComboboxModel> source_language_combobox_model_; std::unique_ptr<LanguageComboboxModel> target_language_combobox_model_; - views::Combobox* denial_combobox_; views::Combobox* source_language_combobox_; views::Combobox* target_language_combobox_;
diff --git a/chrome/browser/ui/views/translate/translate_bubble_view_browsertest.cc b/chrome/browser/ui/views/translate/translate_bubble_view_browsertest.cc index 03fbbbb..bbc1767c7 100644 --- a/chrome/browser/ui/views/translate/translate_bubble_view_browsertest.cc +++ b/chrome/browser/ui/views/translate/translate_bubble_view_browsertest.cc
@@ -25,8 +25,8 @@ #include "components/translate/core/common/language_detection_details.h" #include "content/public/browser/notification_details.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/base/models/simple_combobox_model.h" -#include "ui/views/controls/combobox/combobox.h" +#include "ui/events/keycodes/dom/dom_code.h" +#include "ui/views/controls/button/menu_button.h" class TranslateBubbleViewBrowserTest : public InProcessBrowserTest { public: @@ -132,37 +132,3 @@ browser()->tab_strip_model()->GetActiveWebContents(), false); } - -IN_PROC_BROWSER_TEST_F(TranslateBubbleViewBrowserTest, - CheckNeverTranslateThisSiteBlacklist) { - EXPECT_FALSE(TranslateBubbleView::GetCurrentBubble()); - - // Show a French page and wait until the bubble is shown. - GURL french_url = ui_test_utils::GetTestUrl( - base::FilePath(), base::FilePath(FILE_PATH_LITERAL("french_page.html"))); - NavigateAndWaitForLanguageDetection(french_url, "fr"); - const TranslateBubbleView* const bubble = - TranslateBubbleView::GetCurrentBubble(); - EXPECT_TRUE(bubble); - - // Since this is a file:/// URL, we should not be able to blacklist. - EXPECT_FALSE(bubble->model_->CanBlacklistSite()); - - ASSERT_FALSE(base::FeatureList::IsEnabled(translate::kTranslateUI2016Q2)); - EXPECT_TRUE(bubble->denial_combobox_); - - // Check the combobox contains the correct items. - EXPECT_EQ( - bubble->denial_combobox_->GetRowCount(), - static_cast<int>( - TranslateBubbleView::DenialComboboxIndex::MENU_SIZE_NO_BLACKLIST)); - EXPECT_EQ(bubble->denial_combobox_->GetTextForRow(0), - l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_DENY)); - EXPECT_EQ( - bubble->denial_combobox_->GetTextForRow(1), - l10n_util::GetStringFUTF16(IDS_TRANSLATE_BUBBLE_NEVER_TRANSLATE_LANG, - base::ASCIIToUTF16("French"))); - - chrome::CloseWindow(browser()); - EXPECT_FALSE(TranslateBubbleView::GetCurrentBubble()); -}
diff --git a/chrome/browser/ui/views/translate/translate_bubble_view_unittest.cc b/chrome/browser/ui/views/translate/translate_bubble_view_unittest.cc index bd58b238..5a245a0 100644 --- a/chrome/browser/ui/views/translate/translate_bubble_view_unittest.cc +++ b/chrome/browser/ui/views/translate/translate_bubble_view_unittest.cc
@@ -18,12 +18,13 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/events/event_constants.h" #include "ui/events/event_utils.h" +#include "ui/events/keycodes/dom/dom_code.h" #include "ui/gfx/range/range.h" #include "ui/views/bubble/bubble_frame_view.h" #include "ui/views/controls/button/checkbox.h" +#include "ui/views/controls/button/menu_button.h" #include "ui/views/controls/combobox/combobox.h" #include "ui/views/controls/styled_label.h" -#include "ui/views/test/combobox_test_api.h" #include "ui/views/test/views_test_base.h" #include "ui/views/widget/widget.h" @@ -189,8 +190,15 @@ views::ViewsTestBase::TearDown(); } - views::Combobox* denial_combobox() { return bubble_->denial_combobox_; } bool denial_button_clicked() { return mock_model_->translation_declined_; } + void TriggerDenialMenu() { + bubble_->denial_menu_button_->OnKeyPressed(ui::KeyEvent( + ui::ET_KEY_PRESSED, ui::VKEY_RETURN, ui::DomCode::ENTER, ui::EF_NONE)); + } + + ui::SimpleMenuModel* denial_menu_model() { + return bubble_->denial_menu_model_.get(); + } std::unique_ptr<views::Widget> anchor_widget_; MockTranslateBubbleModel* mock_model_; @@ -234,41 +242,54 @@ EXPECT_TRUE(mock_model_->translation_declined_); } -TEST_F(TranslateBubbleViewTest, ComboboxNope) { +TEST_F(TranslateBubbleViewTest, CloseButton) { + TurnOnTranslate2016Q2UIFlag(); CreateAndShowBubble(); - views::test::ComboboxTestApi test_api(denial_combobox()); - EXPECT_FALSE(denial_button_clicked()); + EXPECT_FALSE(mock_model_->translate_called_); + EXPECT_FALSE(mock_model_->translation_declined_); EXPECT_FALSE(bubble_->GetWidget()->IsClosed()); - test_api.PerformActionAt(static_cast<int>( - TranslateBubbleView::DenialComboboxIndex::DONT_TRANSLATE)); - EXPECT_TRUE(denial_button_clicked()); - EXPECT_TRUE(bubble_->GetWidget()->IsClosed()); + // Press the "Close" button. + bubble_->GetBubbleFrameView()->ButtonPressed( + bubble_->GetBubbleFrameView()->GetCloseButtonForTest(), + ui::MouseEvent(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), + ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE)); + + EXPECT_FALSE(mock_model_->translate_called_); + EXPECT_TRUE(mock_model_->translation_declined_); } -TEST_F(TranslateBubbleViewTest, ComboboxNeverTranslateLanguage) { +TEST_F(TranslateBubbleViewTest, DenialMenuNeverTranslateLanguage) { CreateAndShowBubble(); - views::test::ComboboxTestApi test_api(denial_combobox()); + EXPECT_FALSE(bubble_->GetWidget()->IsClosed()); EXPECT_FALSE(mock_model_->never_translate_language_); EXPECT_FALSE(denial_button_clicked()); - test_api.PerformActionAt(static_cast<int>( - TranslateBubbleView::DenialComboboxIndex::NEVER_TRANSLATE_LANGUAGE)); + TriggerDenialMenu(); + const int index = bubble_->denial_menu_model_->GetIndexOfCommandId( + TranslateBubbleView::NEVER_TRANSLATE_LANGUAGE); + bubble_->denial_menu_model_->ActivatedAt(index); + EXPECT_TRUE(denial_button_clicked()); EXPECT_TRUE(mock_model_->never_translate_language_); EXPECT_TRUE(bubble_->GetWidget()->IsClosed()); } -TEST_F(TranslateBubbleViewTest, ComboboxNeverTranslateSite) { +TEST_F(TranslateBubbleViewTest, DenialMenuNeverTranslateSite) { + // NEVER_TRANSLATE_SITE should only show up for sites that can be blacklisted. + mock_model_->SetCanBlacklistSite(true); CreateAndShowBubble(); - views::test::ComboboxTestApi test_api(denial_combobox()); + EXPECT_FALSE(mock_model_->never_translate_site_); EXPECT_FALSE(denial_button_clicked()); EXPECT_FALSE(bubble_->GetWidget()->IsClosed()); - test_api.PerformActionAt(static_cast<int>( - TranslateBubbleView::DenialComboboxIndex::NEVER_TRANSLATE_SITE)); + TriggerDenialMenu(); + const int index = bubble_->denial_menu_model_->GetIndexOfCommandId( + TranslateBubbleView::NEVER_TRANSLATE_SITE); + bubble_->denial_menu_model_->ActivatedAt(index); + EXPECT_TRUE(denial_button_clicked()); EXPECT_TRUE(mock_model_->never_translate_site_); EXPECT_TRUE(bubble_->GetWidget()->IsClosed()); @@ -478,44 +499,15 @@ EXPECT_EQ(TranslateBubbleModel::VIEW_STATE_ERROR, bubble_->GetViewState()); } -TEST_F(TranslateBubbleViewTest, ComboboxCanBlacklistSite) { - EXPECT_TRUE(mock_model_->CanBlacklistSite()); - CreateAndShowBubble(); - views::Combobox* const combobox = denial_combobox(); - EXPECT_FALSE(denial_button_clicked()); - EXPECT_FALSE(bubble_->GetWidget()->IsClosed()); - // Check menu rows are DENY, NEVER_TRANSLATE_LANG, [SEPARATOR], and - // NEVER_TRANSLATE_SITE. - EXPECT_EQ(4, combobox->GetRowCount()); - EXPECT_EQ(l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_DENY), - combobox->GetTextForRow(static_cast<size_t>( - TranslateBubbleView::DenialComboboxIndex::DONT_TRANSLATE))); - EXPECT_EQ( - l10n_util::GetStringFUTF16(IDS_TRANSLATE_BUBBLE_NEVER_TRANSLATE_LANG, - base::ASCIIToUTF16("English")), - combobox->GetTextForRow(static_cast<size_t>( - TranslateBubbleView::DenialComboboxIndex::NEVER_TRANSLATE_LANGUAGE))); - EXPECT_EQ( - l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_NEVER_TRANSLATE_SITE), - combobox->GetTextForRow(static_cast<size_t>( - TranslateBubbleView::DenialComboboxIndex::NEVER_TRANSLATE_SITE))); -} - -TEST_F(TranslateBubbleViewTest, ComboboxCantBlacklistSite) { +TEST_F(TranslateBubbleViewTest, DenialMenuRespectsBlacklistSite) { mock_model_->SetCanBlacklistSite(false); CreateAndShowBubble(); - views::Combobox* const combobox = denial_combobox(); - // views::test::ComboboxTestApi test_api(combobox); - EXPECT_FALSE(denial_button_clicked()); - EXPECT_FALSE(bubble_->GetWidget()->IsClosed()); - // Check the menu rows are DENY and NEVER_TRANSLATE_LANG. - EXPECT_EQ(2, combobox->GetRowCount()); - EXPECT_EQ(l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_DENY), - combobox->GetTextForRow(static_cast<size_t>( - TranslateBubbleView::DenialComboboxIndex::DONT_TRANSLATE))); - EXPECT_EQ( - l10n_util::GetStringFUTF16(IDS_TRANSLATE_BUBBLE_NEVER_TRANSLATE_LANG, - base::ASCIIToUTF16("English")), - combobox->GetTextForRow(static_cast<size_t>( - TranslateBubbleView::DenialComboboxIndex::NEVER_TRANSLATE_LANGUAGE))); + + TriggerDenialMenu(); + // NEVER_TRANSLATE_SITE shouldn't show up for sites that can't be blacklisted. + EXPECT_EQ(-1, bubble_->denial_menu_model_->GetIndexOfCommandId( + TranslateBubbleView::NEVER_TRANSLATE_SITE)); + // Verify that the menu is populated so previous check makes sense. + EXPECT_GE(0, bubble_->denial_menu_model_->GetIndexOfCommandId( + TranslateBubbleView::NEVER_TRANSLATE_LANGUAGE)); }
diff --git a/chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc index 51fef1a..8e78373 100644 --- a/chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc
@@ -86,11 +86,10 @@ return; } - // Make sure all our network technologies are turned on. On OOBE, the user + // Make sure all physical network technologies are enabled. On OOBE, the user // should be able to select any of the available networks on the device. NetworkStateHandler* handler = NetworkHandler::Get()->network_state_handler(); - handler->SetTechnologyEnabled(NetworkTypePattern::NonVirtual(), - true, + handler->SetTechnologyEnabled(NetworkTypePattern::Physical(), true, chromeos::network_handler::ErrorCallback()); base::DictionaryValue network_screen_params;
diff --git a/chrome/browser/ui/webui/extensions/extension_settings_browsertest.h b/chrome/browser/ui/webui/extensions/extension_settings_browsertest.h index 3fe6ed4..a971fcbc 100644 --- a/chrome/browser/ui/webui/extensions/extension_settings_browsertest.h +++ b/chrome/browser/ui/webui/extensions/extension_settings_browsertest.h
@@ -9,6 +9,7 @@ #include "base/files/file_path.h" #include "base/macros.h" +#include "chrome/browser/extensions/install_verifier.h" #include "chrome/test/base/web_ui_browser_test.h" #include "extensions/browser/scoped_ignore_content_verifier_for_test.h" #include "extensions/browser/test_management_policy.h" @@ -61,6 +62,9 @@ // Disable extension content verification. extensions::ScopedIgnoreContentVerifierForTest ignore_content_verification_; + // Disable extension install verification. + extensions::ScopedInstallVerifierBypassForTest ignore_install_verification_; + // Used to enable the error console. std::unique_ptr<extensions::FeatureSwitch::ScopedOverride> error_console_override_;
diff --git a/chrome/browser/ui/webui/extensions/extensions_ui.cc b/chrome/browser/ui/webui/extensions/extensions_ui.cc index d70bdf2..32b59b1 100644 --- a/chrome/browser/ui/webui/extensions/extensions_ui.cc +++ b/chrome/browser/ui/webui/extensions/extensions_ui.cc
@@ -144,6 +144,13 @@ source->AddLocalizedString("noExtensionsOrApps", IDS_MD_EXTENSIONS_NO_INSTALLED_ITEMS); source->AddLocalizedString("noDescription", IDS_MD_EXTENSIONS_NO_DESCRIPTION); + // TODO(dschuyler): define "viewInStore" as IDS_MD_EXTENSIONS_VIEW_IN_STORE. + source->AddLocalizedString("viewInStore", + IDS_APPLICATION_INFO_WEB_STORE_LINK); + // TODO(dschuyler): define "developerWebsite" as + // IDS_MD_EXTENSIONS_DEVELOPER_WEBSITE. + source->AddLocalizedString("developerWebsite", + IDS_APPLICATION_INFO_HOMEPAGE_LINK); source->AddLocalizedString("noSearchResults", IDS_SEARCH_NO_RESULTS); source->AddLocalizedString("searchResults", IDS_SEARCH_RESULTS); source->AddLocalizedString("dropToInstall",
diff --git a/chrome/browser/ui/webui/media_router/media_router_webui_message_handler.cc b/chrome/browser/ui/webui/media_router/media_router_webui_message_handler.cc index 554519e75..e5525d3 100644 --- a/chrome/browser/ui/webui/media_router/media_router_webui_message_handler.cc +++ b/chrome/browser/ui/webui/media_router/media_router_webui_message_handler.cc
@@ -113,7 +113,7 @@ const MediaSink& sink = sink_with_cast_modes.sink; sink_val->SetString("id", sink.id()); sink_val->SetString("name", sink.name()); - sink_val->SetInteger("iconType", sink.icon_type()); + sink_val->SetInteger("iconType", static_cast<int>(sink.icon_type())); if (sink.description()) sink_val->SetString("description", *sink.description());
diff --git a/chrome/browser/ui/webui/print_preview/extension_printer_handler.cc b/chrome/browser/ui/webui/print_preview/extension_printer_handler.cc index e99d344..1eb03961 100644 --- a/chrome/browser/ui/webui/print_preview/extension_printer_handler.cc +++ b/chrome/browser/ui/webui/print_preview/extension_printer_handler.cc
@@ -45,7 +45,7 @@ using extensions::ExtensionRegistry; using extensions::ListBuilder; using extensions::UsbPrinterManifestData; -using printing::PWGRasterConverter; +using printing::PwgRasterConverter; namespace { @@ -253,8 +253,8 @@ weak_ptr_factory_.GetWeakPtr(), std::move(callback))); } -void ExtensionPrinterHandler::SetPWGRasterConverterForTesting( - std::unique_ptr<PWGRasterConverter> pwg_raster_converter) { +void ExtensionPrinterHandler::SetPwgRasterConverterForTesting( + std::unique_ptr<PwgRasterConverter> pwg_raster_converter) { pwg_raster_converter_ = std::move(pwg_raster_converter); } @@ -266,12 +266,12 @@ std::unique_ptr<extensions::PrinterProviderPrintJob> job, PrintJobCallback callback) { if (!pwg_raster_converter_) { - pwg_raster_converter_ = PWGRasterConverter::CreateDefault(); + pwg_raster_converter_ = PwgRasterConverter::CreateDefault(); } pwg_raster_converter_->Start( data.get(), - PWGRasterConverter::GetConversionSettings(printer_description, page_size), - PWGRasterConverter::GetBitmapSettings(printer_description, ticket), + PwgRasterConverter::GetConversionSettings(printer_description, page_size), + PwgRasterConverter::GetBitmapSettings(printer_description, ticket), base::BindOnce(&UpdateJobFileInfo, std::move(job), std::move(callback))); }
diff --git a/chrome/browser/ui/webui/print_preview/extension_printer_handler.h b/chrome/browser/ui/webui/print_preview/extension_printer_handler.h index 7ec540ce..005ad93 100644 --- a/chrome/browser/ui/webui/print_preview/extension_printer_handler.h +++ b/chrome/browser/ui/webui/print_preview/extension_printer_handler.h
@@ -37,7 +37,7 @@ } namespace printing { -class PWGRasterConverter; +class PwgRasterConverter; } // Implementation of PrinterHandler interface backed by printerProvider @@ -71,8 +71,8 @@ private: friend class ExtensionPrinterHandlerTest; - void SetPWGRasterConverterForTesting( - std::unique_ptr<printing::PWGRasterConverter> pwg_raster_converter); + void SetPwgRasterConverterForTesting( + std::unique_ptr<printing::PwgRasterConverter> pwg_raster_converter); // Converts |data| to PWG raster format (from PDF) for a printer described // by |printer_description|. @@ -109,7 +109,7 @@ Profile* const profile_; GetPrintersDoneCallback done_callback_; PrintJobCallback print_job_callback_; - std::unique_ptr<printing::PWGRasterConverter> pwg_raster_converter_; + std::unique_ptr<printing::PwgRasterConverter> pwg_raster_converter_; int pending_enumeration_count_ = 0; base::WeakPtrFactory<ExtensionPrinterHandler> weak_ptr_factory_;
diff --git a/chrome/browser/ui/webui/print_preview/extension_printer_handler_unittest.cc b/chrome/browser/ui/webui/print_preview/extension_printer_handler_unittest.cc index 771236a7..a7cee65 100644 --- a/chrome/browser/ui/webui/print_preview/extension_printer_handler_unittest.cc +++ b/chrome/browser/ui/webui/print_preview/extension_printer_handler_unittest.cc
@@ -53,7 +53,7 @@ using extensions::PrinterProviderAPI; using extensions::PrinterProviderPrintJob; using extensions::TestExtensionEnvironment; -using printing::PWGRasterConverter; +using printing::PwgRasterConverter; namespace { @@ -276,13 +276,13 @@ return std::string(memory->front_as<char>(), memory->size()); } -// Fake PWGRasterConverter used in the tests. -class FakePWGRasterConverter : public PWGRasterConverter { +// Fake PwgRasterConverter used in the tests. +class FakePwgRasterConverter : public PwgRasterConverter { public: - FakePWGRasterConverter() : fail_conversion_(false), initialized_(false) {} - ~FakePWGRasterConverter() override = default; + FakePwgRasterConverter() : fail_conversion_(false), initialized_(false) {} + ~FakePwgRasterConverter() override = default; - // PWGRasterConverter implementation. It writes |data| to a temp file. + // PwgRasterConverter implementation. It writes |data| to a temp file. // Also, remembers conversion and bitmap settings passed into the method. void Start(base::RefCountedMemory* data, const printing::PdfRenderSettings& conversion_settings, @@ -337,7 +337,7 @@ bool fail_conversion_; bool initialized_; - DISALLOW_COPY_AND_ASSIGN(FakePWGRasterConverter); + DISALLOW_COPY_AND_ASSIGN(FakePwgRasterConverter); }; // Information about received print requests. @@ -472,9 +472,9 @@ extension_printer_handler_ = base::MakeUnique<ExtensionPrinterHandler>(env_.profile()); - auto pwg_raster_converter = base::MakeUnique<FakePWGRasterConverter>(); + auto pwg_raster_converter = base::MakeUnique<FakePwgRasterConverter>(); pwg_raster_converter_ = pwg_raster_converter.get(); - extension_printer_handler_->SetPWGRasterConverterForTesting( + extension_printer_handler_->SetPwgRasterConverterForTesting( std::move(pwg_raster_converter)); } @@ -494,7 +494,7 @@ std::unique_ptr<ExtensionPrinterHandler> extension_printer_handler_; // Owned by |extension_printer_handler_|. - FakePWGRasterConverter* pwg_raster_converter_ = nullptr; + FakePwgRasterConverter* pwg_raster_converter_ = nullptr; private: DISALLOW_COPY_AND_ASSIGN(ExtensionPrinterHandlerTest);
diff --git a/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc index eda15c6..f8e08de 100644 --- a/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc +++ b/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc
@@ -1075,8 +1075,7 @@ arraysize(localized_strings)); html_source->AddBoolean("networkSettingsConfig", - base::CommandLine::ForCurrentProcess()->HasSwitch( - chromeos::switches::kNetworkSettingsConfig)); + chromeos::switches::IsNetworkSettingsConfigEnabled()); html_source->AddString("networkGoogleNameserversLearnMoreUrl", chrome::kGoogleNameserversLearnMoreURL);
diff --git a/chrome/browser/ui/webui/settings/site_settings_handler.cc b/chrome/browser/ui/webui/settings/site_settings_handler.cc index 39445a17..db2bba1 100644 --- a/chrome/browser/ui/webui/settings/site_settings_handler.cc +++ b/chrome/browser/ui/webui/settings/site_settings_handler.cc
@@ -45,7 +45,6 @@ #include "extensions/common/permissions/api_permission.h" #include "extensions/common/permissions/permissions_data.h" #include "storage/browser/quota/quota_manager.h" -#include "storage/common/quota/quota_status_code.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/text/bytes_formatting.h" @@ -248,8 +247,8 @@ } } -void SiteSettingsHandler::OnUsageInfoCleared(storage::QuotaStatusCode code) { - if (code == storage::kQuotaStatusOk) { +void SiteSettingsHandler::OnUsageInfoCleared(blink::QuotaStatusCode code) { + if (code == blink::QuotaStatusCode::kOk) { CallJavascriptFunction("settings.WebsiteUsagePrivateApi.onUsageCleared", base::Value(clearing_origin_)); }
diff --git a/chrome/browser/ui/webui/settings/site_settings_handler.h b/chrome/browser/ui/webui/settings/site_settings_handler.h index 460e51d..457223f 100644 --- a/chrome/browser/ui/webui/settings/site_settings_handler.h +++ b/chrome/browser/ui/webui/settings/site_settings_handler.h
@@ -16,6 +16,7 @@ #include "content/public/browser/host_zoom_map.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" class HostContentSettingsMap; class Profile; @@ -45,7 +46,7 @@ // Usage info. void OnGetUsageInfo(const storage::UsageInfoEntries& entries); - void OnUsageInfoCleared(storage::QuotaStatusCode code); + void OnUsageInfoCleared(blink::QuotaStatusCode code); #if defined(OS_CHROMEOS) // Alert the Javascript that the |kEnableDRM| pref has changed.
diff --git a/chrome/browser/ui/webui/settings_utils_linux.cc b/chrome/browser/ui/webui/settings_utils_linux.cc index 447b0a7d..ae3ef2a 100644 --- a/chrome/browser/ui/webui/settings_utils_linux.cc +++ b/chrome/browser/ui/webui/settings_utils_linux.cc
@@ -94,6 +94,7 @@ bool launched = false; switch (base::nix::GetDesktopEnvironment(env.get())) { + case base::nix::DESKTOP_ENVIRONMENT_CINNAMON: case base::nix::DESKTOP_ENVIRONMENT_GNOME: case base::nix::DESKTOP_ENVIRONMENT_PANTHEON: case base::nix::DESKTOP_ENVIRONMENT_UNITY: {
diff --git a/chrome/browser/ui/window_sizer/window_sizer_ash_uitest.cc b/chrome/browser/ui/window_sizer/window_sizer_ash_uitest.cc index c989957c..ce3a394f 100644 --- a/chrome/browser/ui/window_sizer/window_sizer_ash_uitest.cc +++ b/chrome/browser/ui/window_sizer/window_sizer_ash_uitest.cc
@@ -31,8 +31,8 @@ ash::ShelfView* shelf_view = ash::Shelf::ForWindow(root)->GetShelfViewForTesting(); const views::ViewModel* view_model = shelf_view->view_model_for_test(); - EXPECT_EQ(2, view_model->view_size()); - gfx::Rect bounds = view_model->view_at(1)->GetBoundsInScreen(); + EXPECT_EQ(3, view_model->view_size()); + gfx::Rect bounds = view_model->view_at(2)->GetBoundsInScreen(); wm::ConvertRectFromScreen(root, &bounds); return bounds; }
diff --git a/chrome/browser/vr/BUILD.gn b/chrome/browser/vr/BUILD.gn index b9b8122..a822fa8 100644 --- a/chrome/browser/vr/BUILD.gn +++ b/chrome/browser/vr/BUILD.gn
@@ -41,6 +41,9 @@ "elements/content_element.h", "elements/controller.cc", "elements/controller.h", + "elements/corner_radii.h", + "elements/disc_button.cc", + "elements/disc_button.h", "elements/draw_phase.cc", "elements/draw_phase.h", "elements/exclusive_screen_toast_texture.cc", @@ -74,8 +77,6 @@ "elements/simple_textured_element.h", "elements/spinner.cc", "elements/spinner.h", - "elements/suggestion.cc", - "elements/suggestion.h", "elements/system_indicator_texture.cc", "elements/system_indicator_texture.h", "elements/text.cc", @@ -237,7 +238,7 @@ "animation_player_unittest.cc", "databinding/binding_unittest.cc", "databinding/vector_binding_unittest.cc", - "elements/button_unittest.cc", + "elements/disc_button_unittest.cc", "elements/exit_prompt_unittest.cc", "elements/linear_layout_unittest.cc", "elements/rect_unittest.cc",
diff --git a/chrome/browser/vr/assets.cc b/chrome/browser/vr/assets.cc index f12b1c0..8e4d813 100644 --- a/chrome/browser/vr/assets.cc +++ b/chrome/browser/vr/assets.cc
@@ -13,13 +13,18 @@ #include "base/version.h" #include "chrome/browser/vr/metrics_helper.h" #include "content/public/browser/browser_thread.h" +#include "third_party/skia/include/core/SkBitmap.h" +#include "ui/gfx/codec/jpeg_codec.h" +#include "ui/gfx/codec/png_codec.h" namespace vr { namespace { -static const base::FilePath::CharType kEnvironmentFileName[] = - FILE_PATH_LITERAL("environment"); +static const base::FilePath::CharType kBackgroundFileNamePng[] = + FILE_PATH_LITERAL("background.png"); +static const base::FilePath::CharType kBackgroundFileNameJpeg[] = + FILE_PATH_LITERAL("background.jpeg"); } // namespace @@ -69,18 +74,60 @@ const base::Version& component_version, const base::FilePath& component_install_dir, OnAssetsLoadedCallback on_loaded) { - std::string environment; - if (!base::ReadFileToString( - component_install_dir.Append(kEnvironmentFileName), &environment)) { + std::string background_file_content; + base::FilePath background_file_path; + bool is_png = false; + + if (base::PathExists(component_install_dir.Append(kBackgroundFileNamePng))) { + background_file_path = component_install_dir.Append(kBackgroundFileNamePng); + is_png = true; + } else if (base::PathExists( + component_install_dir.Append(kBackgroundFileNameJpeg))) { + background_file_path = + component_install_dir.Append(kBackgroundFileNameJpeg); + } else { task_runner->PostTask( - FROM_HERE, base::BindOnce(std::move(on_loaded), false, std::string(), - component_version)); + FROM_HERE, + base::BindOnce(std::move(on_loaded), AssetsLoadStatus::kNotFound, + nullptr, component_version)); return; } - task_runner->PostTask(FROM_HERE, - base::BindOnce(std::move(on_loaded), true, environment, - component_version)); + if (!base::ReadFileToString(background_file_path, &background_file_content)) { + task_runner->PostTask( + FROM_HERE, + base::BindOnce(std::move(on_loaded), AssetsLoadStatus::kParseFailure, + nullptr, component_version)); + return; + } + + std::unique_ptr<SkBitmap> background_image; + if (is_png) { + background_image = base::MakeUnique<SkBitmap>(); + if (!gfx::PNGCodec::Decode(reinterpret_cast<const unsigned char*>( + background_file_content.data()), + background_file_content.size(), + background_image.get())) { + background_image = nullptr; + } + } else { + background_image = gfx::JPEGCodec::Decode( + reinterpret_cast<const unsigned char*>(background_file_content.data()), + background_file_content.size()); + } + + if (!background_image) { + task_runner->PostTask( + FROM_HERE, + base::BindOnce(std::move(on_loaded), AssetsLoadStatus::kInvalidContent, + nullptr, component_version)); + return; + } + + task_runner->PostTask( + FROM_HERE, + base::BindOnce(std::move(on_loaded), AssetsLoadStatus::kSuccess, + std::move(background_image), component_version)); } Assets::Assets()
diff --git a/chrome/browser/vr/assets.h b/chrome/browser/vr/assets.h index 0226df4..46b36dc5 100644 --- a/chrome/browser/vr/assets.h +++ b/chrome/browser/vr/assets.h
@@ -12,6 +12,9 @@ #include "base/files/file_path.h" #include "base/memory/weak_ptr.h" #include "base/version.h" +#include "chrome/browser/vr/assets_load_status.h" + +class SkBitmap; namespace base { class DictionaryValue; @@ -21,7 +24,7 @@ namespace vr { -constexpr uint32_t kCompatibleMajorVrAssetsComponentVersion = 0; +constexpr uint32_t kCompatibleMajorVrAssetsComponentVersion = 1; class MetricsHelper; struct AssetsSingletonTrait; @@ -35,8 +38,8 @@ // performed on a worker thread. class Assets { public: - typedef base::OnceCallback<void(bool success, - std::string environment, + typedef base::OnceCallback<void(AssetsLoadStatus status, + std::unique_ptr<SkBitmap> background_image, const base::Version& component_version)> OnAssetsLoadedCallback;
diff --git a/chrome/browser/vr/assets_load_status.h b/chrome/browser/vr/assets_load_status.h index e9b61e8..20683b0 100644 --- a/chrome/browser/vr/assets_load_status.h +++ b/chrome/browser/vr/assets_load_status.h
@@ -15,9 +15,11 @@ // reference in // //tools/metrics/histograms/histograms.xml. enum class AssetsLoadStatus : int { - kSuccess = 0, // Assets loaded successfully. - kParseFailure = 1, // Failed to load assets. - kInvalidContent = 2, // Content of assets files is invalid. + kSuccess = 0, // Assets loaded successfully. + kParseFailure = 1, // Failed to load assets. + kInvalidContent = + 2, // Content of assets files is invalid, e.g. it couldn't be decoded. + kNotFound = 3, // Could not find asset files. }; } // namespace vr
diff --git a/chrome/browser/vr/elements/button.cc b/chrome/browser/vr/elements/button.cc index af69d92..9374c93 100644 --- a/chrome/browser/vr/elements/button.cc +++ b/chrome/browser/vr/elements/button.cc
@@ -6,6 +6,7 @@ #include "base/bind.h" #include "base/memory/ptr_util.h" +#include "chrome/browser/vr/elements/invisible_hit_target.h" #include "chrome/browser/vr/elements/rect.h" #include "chrome/browser/vr/elements/ui_element.h" #include "chrome/browser/vr/elements/ui_element_name.h" @@ -18,50 +19,42 @@ namespace { -constexpr float kIconScaleFactor = 0.5f; constexpr float kHitPlaneScaleFactorHovered = 1.2f; constexpr float kDefaultHoverOffsetDMM = 0.048f; + } // namespace -Button::Button(base::Callback<void()> click_handler, - const gfx::VectorIcon& icon) +Button::Button(base::RepeatingCallback<void()> click_handler) : click_handler_(click_handler), hover_offset_(kDefaultHoverOffsetDMM) { set_hit_testable(false); auto background = base::MakeUnique<Rect>(); background->SetType(kTypeButtonBackground); background->set_bubble_events(true); + background->set_contributes_to_parent_bounds(false); background->SetTransitionedProperties({TRANSFORM}); background->set_hit_testable(false); background_ = background.get(); AddChild(std::move(background)); - auto vector_icon = base::MakeUnique<VectorIcon>(512); - vector_icon->SetType(kTypeButtonForeground); - vector_icon->SetIcon(icon); - vector_icon->set_bubble_events(true); - vector_icon->SetTransitionedProperties({TRANSFORM}); - vector_icon->set_hit_testable(false); - foreground_ = vector_icon.get(); - AddChild(std::move(vector_icon)); - auto hit_plane = base::MakeUnique<InvisibleHitTarget>(); hit_plane->SetType(kTypeButtonHitTarget); hit_plane->set_bubble_events(true); + hit_plane->set_contributes_to_parent_bounds(false); hit_plane_ = hit_plane.get(); - foreground_->AddChild(std::move(hit_plane)); + AddChild(std::move(hit_plane)); EventHandlers event_handlers; event_handlers.hover_enter = - base::Bind(&Button::HandleHoverEnter, base::Unretained(this)); + base::BindRepeating(&Button::HandleHoverEnter, base::Unretained(this)); event_handlers.hover_move = - base::Bind(&Button::HandleHoverMove, base::Unretained(this)); + base::BindRepeating(&Button::HandleHoverMove, base::Unretained(this)); event_handlers.hover_leave = - base::Bind(&Button::HandleHoverLeave, base::Unretained(this)); + base::BindRepeating(&Button::HandleHoverLeave, base::Unretained(this)); event_handlers.button_down = - base::Bind(&Button::HandleButtonDown, base::Unretained(this)); + base::BindRepeating(&Button::HandleButtonDown, base::Unretained(this)); event_handlers.button_up = - base::Bind(&Button::HandleButtonUp, base::Unretained(this)); + base::BindRepeating(&Button::HandleButtonUp, base::Unretained(this)); set_event_handlers(event_handlers); } @@ -98,50 +91,45 @@ void Button::HandleButtonUp() { down_ = false; OnStateUpdated(); - if (hovered_ && click_handler_) + if (hovered() && click_handler_) click_handler_.Run(); } void Button::OnStateUpdated() { pressed_ = hovered_ ? down_ : false; - if (hovered_) { + if (hovered()) { background_->SetTranslate(0.0, 0.0, hover_offset_); - foreground_->SetTranslate(0.0, 0.0, hover_offset_); hit_plane_->SetScale(kHitPlaneScaleFactorHovered, kHitPlaneScaleFactorHovered, 1.0f); } else { background_->SetTranslate(0.0, 0.0, 0.0); - foreground_->SetTranslate(0.0, 0.0, 0.0); hit_plane_->SetScale(1.0f, 1.0f, 1.0f); } - background_->SetColor(colors_.GetBackgroundColor(hovered_, pressed_)); - foreground_->SetColor(colors_.GetForegroundColor(disabled_)); } void Button::OnSetDrawPhase() { background_->SetDrawPhase(draw_phase()); - foreground_->SetDrawPhase(draw_phase()); hit_plane_->SetDrawPhase(draw_phase()); } void Button::OnSetName() { background_->set_owner_name_for_test(name()); - foreground_->set_owner_name_for_test(name()); hit_plane_->set_owner_name_for_test(name()); } +void Button::OnSetSize(const gfx::SizeF& size) { + background_->SetSize(size.width(), size.height()); + hit_plane_->SetSize(size.width(), size.height()); +} + void Button::NotifyClientSizeAnimated(const gfx::SizeF& size, int target_property_id, cc::Animation* animation) { if (target_property_id == BOUNDS) { background_->SetSize(size.width(), size.height()); - background_->set_corner_radius(size.width() * 0.5f); // Creates a circle. - foreground_->SetSize(size.width() * kIconScaleFactor, - size.height() * kIconScaleFactor); hit_plane_->SetSize(size.width(), size.height()); - hit_plane_->set_corner_radius(size.width() * 0.5f); // Creates a circle. } UiElement::NotifyClientSizeAnimated(size, target_property_id, animation); }
diff --git a/chrome/browser/vr/elements/button.h b/chrome/browser/vr/elements/button.h index f9cd0ca..84529bdc 100644 --- a/chrome/browser/vr/elements/button.h +++ b/chrome/browser/vr/elements/button.h
@@ -10,10 +10,8 @@ #include "base/callback.h" #include "base/macros.h" #include "chrome/browser/vr/elements/draw_phase.h" -#include "chrome/browser/vr/elements/invisible_hit_target.h" #include "chrome/browser/vr/elements/ui_element.h" #include "chrome/browser/vr/model/color_scheme.h" -#include "ui/gfx/vector_icon_types.h" namespace gfx { class PointF; @@ -22,21 +20,19 @@ namespace vr { class Rect; -class VectorIcon; // Button has a circle as the background and a vector icon as the foreground. // When hovered, background and foreground both move forward on Z axis. // This matches the Daydream disk-style button. class Button : public UiElement { public: - Button(base::Callback<void()> click_handler, const gfx::VectorIcon& icon); + explicit Button(base::RepeatingCallback<void()> click_handler); ~Button() override; void Render(UiElementRenderer* renderer, const CameraModel& model) const final; Rect* background() const { return background_; } - VectorIcon* foreground() const { return foreground_; } UiElement* hit_plane() const { return hit_plane_; } void SetButtonColors(const ButtonColors& colors); @@ -45,30 +41,38 @@ // method and the associated field can be removed. void set_hover_offset(float hover_offset) { hover_offset_ = hover_offset; } + protected: + bool hovered() const { return hovered_; } + bool down() const { return down_; } + bool pressed() const { return pressed_; } + bool disabled() const { return disabled_; } + const ButtonColors& colors() const { return colors_; } + float hover_offset() const { return hover_offset_; } + + void OnSetDrawPhase() override; + void OnSetName() override; + void OnSetSize(const gfx::SizeF& size) override; + void NotifyClientSizeAnimated(const gfx::SizeF& size, + int target_property_id, + cc::Animation* animation) override; + virtual void OnStateUpdated(); + private: void HandleHoverEnter(); void HandleHoverMove(const gfx::PointF& position); void HandleHoverLeave(); void HandleButtonDown(); void HandleButtonUp(); - void OnStateUpdated(); - void OnSetDrawPhase() override; - void OnSetName() override; - void NotifyClientSizeAnimated(const gfx::SizeF& size, - int target_property_id, - cc::Animation* animation) override; bool down_ = false; - bool hovered_ = false; bool pressed_ = false; bool disabled_ = false; - base::Callback<void()> click_handler_; - float hover_offset_; + base::RepeatingCallback<void()> click_handler_; ButtonColors colors_; + float hover_offset_; Rect* background_; - VectorIcon* foreground_; UiElement* hit_plane_; DISALLOW_COPY_AND_ASSIGN(Button);
diff --git a/chrome/browser/vr/elements/content_element.cc b/chrome/browser/vr/elements/content_element.cc index b7a9f29..9c84f55b 100644 --- a/chrome/browser/vr/elements/content_element.cc +++ b/chrome/browser/vr/elements/content_element.cc
@@ -105,6 +105,13 @@ bool ContentElement::OnBeginFrame(const base::TimeTicks& time, const gfx::Vector3dF& look_at) { + // TODO(mthiesse): This projection matrix is always going to be a frame + // behind when computing the content size. We'll need to address this somehow + // when we allow content resizing, or we could end up triggering an extra + // incorrect resize. + if (projection_matrix_.IsIdentity()) + return false; + // Determine if the projected size of the content quad changed more than a // given threshold. If so, propagate this info so that the content's // resolution and size can be adjusted. For the calculation, we cannot take
diff --git a/chrome/browser/vr/elements/corner_radii.h b/chrome/browser/vr/elements/corner_radii.h new file mode 100644 index 0000000..a2dd158 --- /dev/null +++ b/chrome/browser/vr/elements/corner_radii.h
@@ -0,0 +1,36 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_VR_ELEMENTS_CORNER_RADII_H_ +#define CHROME_BROWSER_VR_ELEMENTS_CORNER_RADII_H_ + +#include <algorithm> + +namespace vr { + +struct CornerRadii { + float upper_left; + float upper_right; + float lower_left; + float lower_right; + + bool IsZero() const { + return upper_right == 0.0f && upper_left == 0.0f && lower_right == 0.0f && + lower_left == 0.0f; + } + + bool AllEqual() const { + return upper_left == upper_right && upper_left == lower_right && + upper_left == lower_left; + } + + float MaxRadius() const { + return std::max(upper_left, + std::max(upper_right, std::max(lower_left, lower_right))); + } +}; + +} // namespace vr + +#endif // CHROME_BROWSER_VR_ELEMENTS_CORNER_RADII_H_
diff --git a/chrome/browser/vr/elements/disc_button.cc b/chrome/browser/vr/elements/disc_button.cc new file mode 100644 index 0000000..6d45241 --- /dev/null +++ b/chrome/browser/vr/elements/disc_button.cc
@@ -0,0 +1,80 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/vr/elements/disc_button.h" + +#include "base/memory/ptr_util.h" +#include "chrome/browser/vr/elements/rect.h" +#include "chrome/browser/vr/elements/ui_element.h" +#include "chrome/browser/vr/elements/ui_element_name.h" +#include "chrome/browser/vr/elements/vector_icon.h" +#include "chrome/browser/vr/ui_scene_constants.h" + +#include "ui/gfx/geometry/point_f.h" + +namespace vr { + +namespace { + +constexpr float kIconScaleFactor = 0.5f; + +} // namespace + +DiscButton::DiscButton(base::RepeatingCallback<void()> click_handler, + const gfx::VectorIcon& icon) + : Button(click_handler) { + auto vector_icon = base::MakeUnique<VectorIcon>(512); + vector_icon->SetType(kTypeButtonForeground); + vector_icon->SetIcon(icon); + vector_icon->set_bubble_events(true); + vector_icon->SetTransitionedProperties({TRANSFORM}); + vector_icon->set_hit_testable(false); + foreground_ = vector_icon.get(); + + // We now need to reparent the hit target so that it is a child of the + // newly-created foreground. + auto target = RemoveChild(hit_plane()); + vector_icon->AddChild(std::move(target)); + AddChild(std::move(vector_icon)); +} + +DiscButton::~DiscButton() = default; + +void DiscButton::OnStateUpdated() { + Button::OnStateUpdated(); + + if (hovered()) { + foreground_->SetTranslate(0.0, 0.0, hover_offset()); + } else { + foreground_->SetTranslate(0.0, 0.0, 0.0); + } + + foreground_->SetColor(colors().GetForegroundColor(disabled())); +} + +void DiscButton::OnSetDrawPhase() { + Button::OnSetDrawPhase(); + foreground_->SetDrawPhase(draw_phase()); +} + +void DiscButton::OnSetName() { + Button::OnSetName(); + foreground_->set_owner_name_for_test(name()); +} + +void DiscButton::NotifyClientSizeAnimated(const gfx::SizeF& size, + int target_property_id, + cc::Animation* animation) { + Button::NotifyClientSizeAnimated(size, target_property_id, animation); + if (target_property_id == BOUNDS) { + background()->SetSize(size.width(), size.height()); + background()->set_corner_radius(size.width() * 0.5f); // Creates a circle. + foreground()->SetSize(size.width() * kIconScaleFactor, + size.height() * kIconScaleFactor); + hit_plane()->SetSize(size.width(), size.height()); + hit_plane()->set_corner_radius(size.width() * 0.5f); // Creates a circle. + } +} + +} // namespace vr
diff --git a/chrome/browser/vr/elements/disc_button.h b/chrome/browser/vr/elements/disc_button.h new file mode 100644 index 0000000..86b977b --- /dev/null +++ b/chrome/browser/vr/elements/disc_button.h
@@ -0,0 +1,44 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_VR_ELEMENTS_DISC_BUTTON_H_ +#define CHROME_BROWSER_VR_ELEMENTS_DISC_BUTTON_H_ + +#include <memory> + +#include "base/callback.h" +#include "base/macros.h" +#include "chrome/browser/vr/elements/button.h" +#include "ui/gfx/vector_icon_types.h" + +namespace vr { + +class VectorIcon; + +// A disc button has a circle as the background and a vector icon as the +// foreground. When hovered, background and foreground both move forward on Z +// axis. This matches the Daydream disk-style button. +class DiscButton : public Button { + public: + DiscButton(base::RepeatingCallback<void()> click_handler, + const gfx::VectorIcon& icon); + ~DiscButton() override; + + VectorIcon* foreground() const { return foreground_; } + + private: + void OnStateUpdated() override; + void OnSetDrawPhase() override; + void OnSetName() override; + void NotifyClientSizeAnimated(const gfx::SizeF& size, + int target_property_id, + cc::Animation* animation) override; + + VectorIcon* foreground_; + DISALLOW_COPY_AND_ASSIGN(DiscButton); +}; + +} // namespace vr + +#endif // CHROME_BROWSER_VR_ELEMENTS_DISC_BUTTON_H_
diff --git a/chrome/browser/vr/elements/button_unittest.cc b/chrome/browser/vr/elements/disc_button_unittest.cc similarity index 80% rename from chrome/browser/vr/elements/button_unittest.cc rename to chrome/browser/vr/elements/disc_button_unittest.cc index c23676d..da521ce 100644 --- a/chrome/browser/vr/elements/button_unittest.cc +++ b/chrome/browser/vr/elements/disc_button_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/vr/elements/button.h" +#include "chrome/browser/vr/elements/disc_button.h" #include "cc/animation/transform_operation.h" #include "cc/animation/transform_operations.h" @@ -17,8 +17,9 @@ namespace vr { -TEST(Button, HoverTest) { - Button button(base::Callback<void()>(), vector_icons::kMicrophoneIcon); +TEST(DiscButton, HoverTest) { + DiscButton button(base::RepeatingCallback<void()>(), + vector_icons::kMicrophoneIcon); button.SetSize(1.0f, 1.0f); button.set_hover_offset(0.5f); @@ -44,8 +45,9 @@ EXPECT_TRUE(hit_plane_op_hover.scale.x - hit_plane_op.scale.x > 0.f); } -TEST(Button, SizePropagatesToSubElements) { - Button button(base::Callback<void()>(), vector_icons::kMicrophoneIcon); +TEST(DiscButton, SizePropagatesToSubElements) { + DiscButton button(base::RepeatingCallback<void()>(), + vector_icons::kMicrophoneIcon); gfx::SizeF size(1000.0f, 1000.0f); gfx::SizeF icon_size = size; icon_size.Scale(0.5f); @@ -68,8 +70,9 @@ } } -TEST(Button, DrawPhasePropagatesToSubElements) { - Button button(base::Callback<void()>(), vector_icons::kMicrophoneIcon); +TEST(DiscButton, DrawPhasePropagatesToSubElements) { + DiscButton button(base::RepeatingCallback<void()>(), + vector_icons::kMicrophoneIcon); button.SetDrawPhase(kPhaseOverlayForeground); for (auto& child : button.children()) { @@ -77,8 +80,9 @@ } } -TEST(Button, NamePropagatesToSubElements) { - Button button(base::Callback<void()>(), vector_icons::kMicrophoneIcon); +TEST(DiscButton, NamePropagatesToSubElements) { + DiscButton button(base::RepeatingCallback<void()>(), + vector_icons::kMicrophoneIcon); button.SetName(kCloseButton); for (auto& child : button.children()) {
diff --git a/chrome/browser/vr/elements/full_screen_rect.cc b/chrome/browser/vr/elements/full_screen_rect.cc index 2c7743c..0b0130f 100644 --- a/chrome/browser/vr/elements/full_screen_rect.cc +++ b/chrome/browser/vr/elements/full_screen_rect.cc
@@ -17,7 +17,7 @@ gfx::Transform m; m.Scale3d(2.0f, 2.0f, 1.0f); renderer->DrawGradientQuad(m, edge_color(), center_color(), - computed_opacity(), size(), corner_radius()); + computed_opacity(), size(), corner_radii()); } bool FullScreenRect::IsWorldPositioned() const {
diff --git a/chrome/browser/vr/elements/rect.cc b/chrome/browser/vr/elements/rect.cc index a1aa5df..5fce65e 100644 --- a/chrome/browser/vr/elements/rect.cc +++ b/chrome/browser/vr/elements/rect.cc
@@ -43,7 +43,7 @@ void Rect::Render(UiElementRenderer* renderer, const CameraModel& model) const { renderer->DrawGradientQuad(model.view_proj_matrix * world_space_transform(), edge_color_, center_color_, computed_opacity(), - size(), corner_radius()); + size(), corner_radii()); } } // namespace vr
diff --git a/chrome/browser/vr/elements/reticle.cc b/chrome/browser/vr/elements/reticle.cc index 1f7e0cd..721e247 100644 --- a/chrome/browser/vr/elements/reticle.cc +++ b/chrome/browser/vr/elements/reticle.cc
@@ -76,6 +76,7 @@ Reticle::Reticle(UiScene* scene, Model* model) : scene_(scene), model_(model) { SetName(kReticle); + SetDrawPhase(kPhaseForeground); set_hit_testable(false); SetVisible(true); }
diff --git a/chrome/browser/vr/elements/shadow.cc b/chrome/browser/vr/elements/shadow.cc index b785eca1..42076b7 100644 --- a/chrome/browser/vr/elements/shadow.cc +++ b/chrome/browser/vr/elements/shadow.cc
@@ -146,6 +146,8 @@ kXMaxShadowGradientFactor), gfx::Tween::FloatValueBetween(depth_, kYMinShadowGradientFactor, kYMaxShadowGradientFactor)); + if (children().size() == 1u) + set_corner_radius(children().front()->corner_radii().MaxRadius()); } Shadow::Renderer::Renderer()
diff --git a/chrome/browser/vr/elements/suggestion.cc b/chrome/browser/vr/elements/suggestion.cc deleted file mode 100644 index 9d82fc4..0000000 --- a/chrome/browser/vr/elements/suggestion.cc +++ /dev/null
@@ -1,25 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/vr/elements/suggestion.h" - -#include "base/bind.h" - -namespace vr { - -Suggestion::Suggestion(base::Callback<void(GURL)> navigate_callback) - : navigate_callback_(navigate_callback) { - EventHandlers event_handlers; - event_handlers.button_up = - base::Bind(&Suggestion::HandleButtonClick, base::Unretained(this)); - set_event_handlers(event_handlers); -} - -Suggestion::~Suggestion() = default; - -void Suggestion::HandleButtonClick() { - navigate_callback_.Run(destination_); -} - -} // namespace vr
diff --git a/chrome/browser/vr/elements/suggestion.h b/chrome/browser/vr/elements/suggestion.h deleted file mode 100644 index fd5c7b9..0000000 --- a/chrome/browser/vr/elements/suggestion.h +++ /dev/null
@@ -1,36 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_VR_ELEMENTS_SUGGESTION_H_ -#define CHROME_BROWSER_VR_ELEMENTS_SUGGESTION_H_ - -#include "chrome/browser/vr/elements/ui_element.h" -#include "url/gurl.h" - -namespace vr { - -// This class is a wrapper to assist in base::Bind operations. A suggestion must -// bind to both a URL and a browser interface to trigger navigations. Attempting -// to bind both necessitates lambda capture, which base::Bind cannot do. This -// workaround simplifies the problem. If UI elements gain the ability to use the -// VR UI to browser interface, we could eliminate this class. -class Suggestion : public UiElement { - public: - explicit Suggestion(base::Callback<void(GURL)> navigate_callback); - ~Suggestion() override; - - void set_destination(GURL gurl) { destination_ = gurl; } - - private: - void HandleButtonClick(); - - base::Callback<void(GURL)> navigate_callback_; - GURL destination_; - - DISALLOW_COPY_AND_ASSIGN(Suggestion); -}; - -} // namespace vr - -#endif // CHROME_BROWSER_VR_ELEMENTS_SUGGESTION_H_
diff --git a/chrome/browser/vr/elements/text.cc b/chrome/browser/vr/elements/text.cc index 1a5b930..8c746d1 100644 --- a/chrome/browser/vr/elements/text.cc +++ b/chrome/browser/vr/elements/text.cc
@@ -13,15 +13,31 @@ #include "ui/gfx/geometry/vector2d.h" #include "ui/gfx/render_text.h" +namespace vr { + namespace { + constexpr float kCursorWidthRatio = 0.07f; +constexpr int kTextPixelPerDmm = 1100; + +int DmmToPixel(float dmm) { + return static_cast<int>(dmm * kTextPixelPerDmm); } -namespace vr { +float PixelToDmm(int pixel) { + return static_cast<float>(pixel) / kTextPixelPerDmm; +} + +bool IsFixedWidthLayout(TextLayoutMode mode) { + return mode == kSingleLineFixedWidth || mode == kMultiLineFixedWidth; +} + +} // namespace class TextTexture : public UiTexture { public: - explicit TextTexture(float font_height) : font_height_(font_height) {} + explicit TextTexture(float font_height_dmms) + : font_height_dmms_(font_height_dmms) {} ~TextTexture() override {} void SetText(const base::string16& text) { SetAndDirty(&text_, text); } @@ -32,7 +48,10 @@ SetAndDirty(&alignment_, alignment); } - void SetMultiLine(bool multiline) { SetAndDirty(&multiline_, multiline); } + void SetTextLayoutMode(TextLayoutMode mode) { + SetAndDirty(&text_layout_mode_, mode); + } + void SetCursorEnabled(bool enabled) { SetAndDirty(&cursor_enabled_, enabled); } @@ -51,34 +70,39 @@ // the texture. This allows for deeper unit testing of the Text element // without having to mock canvases and simulate frame rendering. The state of // the texture is modified here. - std::vector<std::unique_ptr<gfx::RenderText>> LayOutText( - const gfx::Size& texture_size); + void LayOutText(); + + const std::vector<std::unique_ptr<gfx::RenderText>>& lines() { + return lines_; + } private: + void OnMeasureSize() override { LayOutText(); } + gfx::Size GetPreferredTextureSize(int width) const override { - return gfx::Size(width, width); + return gfx::Size(GetDrawnSize().width(), GetDrawnSize().height()); } void Draw(SkCanvas* sk_canvas, const gfx::Size& texture_size) override; gfx::SizeF size_; base::string16 text_; - // These dimensions are in meters. - float font_height_ = 0; + float font_height_dmms_ = 0; float text_width_ = 0; TextAlignment alignment_ = kTextAlignmentCenter; - bool multiline_ = true; + TextLayoutMode text_layout_mode_ = kMultiLineFixedWidth; SkColor color_ = SK_ColorBLACK; bool cursor_enabled_ = false; int cursor_position_ = 0; gfx::Rect cursor_bounds_; + std::vector<std::unique_ptr<gfx::RenderText>> lines_; DISALLOW_COPY_AND_ASSIGN(TextTexture); }; -Text::Text(int maximum_width_pixels, float font_height_meters) - : TexturedElement(maximum_width_pixels), - texture_(base::MakeUnique<TextTexture>(font_height_meters)) {} +Text::Text(float font_height_dmms) + : TexturedElement(0), + texture_(base::MakeUnique<TextTexture>(font_height_dmms)) {} Text::~Text() {} void Text::SetText(const base::string16& text) { @@ -93,8 +117,9 @@ texture_->SetAlignment(alignment); } -void Text::SetMultiLine(bool multiline) { - texture_->SetMultiLine(multiline); +void Text::SetTextLayoutMode(TextLayoutMode mode) { + text_layout_mode_ = mode; + texture_->SetTextLayoutMode(mode); } void Text::SetCursorEnabled(bool enabled) { @@ -120,13 +145,24 @@ bounds.height() * scale * kCursorWidthRatio, bounds.height() * scale); } -void Text::OnSetSize(gfx::SizeF size) { +void Text::OnSetSize(const gfx::SizeF& size) { texture_->SetTextWidth(size.width()); } -std::vector<std::unique_ptr<gfx::RenderText>> Text::LayOutTextForTest( - const gfx::Size& texture_size) { - return texture_->LayOutText(texture_size); +void Text::UpdateElementSize() { + gfx::SizeF drawn_size = GetTexture()->GetDrawnSize(); + // Width calculated from PixelToDmm may be different from the width saved in + // stale_size due to float percision. So use the value in stale_size for fixed + // width text layout. + float width = IsFixedWidthLayout(text_layout_mode_) + ? stale_size().width() + : PixelToDmm(drawn_size.width()); + SetSize(width, PixelToDmm(drawn_size.height())); +} + +const std::vector<std::unique_ptr<gfx::RenderText>>& Text::LayOutTextForTest() { + texture_->LayOutText(); + return texture_->lines(); } gfx::SizeF Text::GetTextureSizeForTest() const { @@ -137,34 +173,36 @@ return texture_.get(); } -std::vector<std::unique_ptr<gfx::RenderText>> TextTexture::LayOutText( - const gfx::Size& texture_size) { +void TextTexture::LayOutText() { gfx::FontList fonts; - float pixels_per_meter = texture_size.width() / text_width_; - int pixel_font_height = static_cast<int>(font_height_ * pixels_per_meter); + int pixel_font_height = DmmToPixel(font_height_dmms_); GetDefaultFontList(pixel_font_height, text_, &fonts); - gfx::Rect text_bounds(texture_size.width(), 0); + gfx::Rect text_bounds; + if (text_layout_mode_ == kSingleLineFixedHeight) { + text_bounds.set_height(pixel_font_height); + } else { + text_bounds.set_width(DmmToPixel(text_width_)); + } TextRenderParameters parameters; parameters.color = color_; parameters.text_alignment = alignment_; - parameters.wrapping_behavior = - multiline_ ? kWrappingBehaviorWrap : kWrappingBehaviorNoWrap; + parameters.wrapping_behavior = text_layout_mode_ == kMultiLineFixedWidth + ? kWrappingBehaviorWrap + : kWrappingBehaviorNoWrap; parameters.cursor_enabled = cursor_enabled_; parameters.cursor_position = cursor_position_; - std::vector<std::unique_ptr<gfx::RenderText>> lines = + lines_ = // TODO(vollick): if this subsumes all text, then we should probably move // this function into this class. PrepareDrawStringRect(text_, fonts, &text_bounds, parameters); if (cursor_enabled_) - cursor_bounds_ = lines.front()->GetUpdatedCursorBounds(); + cursor_bounds_ = lines_.front()->GetUpdatedCursorBounds(); // Note, there is no padding here whatsoever. size_ = gfx::SizeF(text_bounds.size()); - - return lines; } void TextTexture::Draw(SkCanvas* sk_canvas, const gfx::Size& texture_size) { @@ -172,8 +210,7 @@ gfx::Canvas gfx_canvas(&paint_canvas, 1.0f); gfx::Canvas* canvas = &gfx_canvas; - auto lines = LayOutText(texture_size); - for (auto& render_text : lines) + for (auto& render_text : lines_) render_text->Draw(canvas); }
diff --git a/chrome/browser/vr/elements/text.h b/chrome/browser/vr/elements/text.h index bf5ae6e..d20a8f7 100644 --- a/chrome/browser/vr/elements/text.h +++ b/chrome/browser/vr/elements/text.h
@@ -20,16 +20,22 @@ class TextTexture; +enum TextLayoutMode { + kSingleLineFixedWidth, + kSingleLineFixedHeight, + kMultiLineFixedWidth, +}; + class Text : public TexturedElement { public: - Text(int maximum_width_pixels, float font_height_meters); + explicit Text(float font_height_dmms); ~Text() override; void SetText(const base::string16& text); void SetColor(SkColor color); void SetTextAlignment(UiTexture::TextAlignment alignment); - void SetMultiLine(bool multiline); + void SetTextLayoutMode(TextLayoutMode mode); // This text element does not typically feature a cursor, but since the cursor // position is deterined while laying out text, a parent may wish to supply @@ -45,15 +51,16 @@ // texture size, relative to the upper-left corner of the element. gfx::RectF GetCursorBounds() const; - void OnSetSize(gfx::SizeF size) override; + void OnSetSize(const gfx::SizeF& size) override; + void UpdateElementSize() override; - std::vector<std::unique_ptr<gfx::RenderText>> LayOutTextForTest( - const gfx::Size& texture_size); + const std::vector<std::unique_ptr<gfx::RenderText>>& LayOutTextForTest(); gfx::SizeF GetTextureSizeForTest() const; private: UiTexture* GetTexture() const override; + TextLayoutMode text_layout_mode_ = kMultiLineFixedWidth; std::unique_ptr<TextTexture> texture_; DISALLOW_COPY_AND_ASSIGN(Text); };
diff --git a/chrome/browser/vr/elements/text_input.cc b/chrome/browser/vr/elements/text_input.cc index eb7ef36..ac7ebd9 100644 --- a/chrome/browser/vr/elements/text_input.cc +++ b/chrome/browser/vr/elements/text_input.cc
@@ -16,13 +16,12 @@ namespace vr { -TextInput::TextInput(int maximum_width_pixels, - float font_height_meters, +TextInput::TextInput(float font_height_meters, OnFocusChangedCallback focus_changed_callback, OnInputEditedCallback input_edit_callback) : focus_changed_callback_(focus_changed_callback), input_edit_callback_(input_edit_callback) { - auto text = base::MakeUnique<Text>(maximum_width_pixels, font_height_meters); + auto text = base::MakeUnique<Text>(font_height_meters); text->SetType(kTypeTextInputHint); text->SetDrawPhase(kPhaseForeground); text->set_hit_testable(false); @@ -30,12 +29,12 @@ text->set_x_anchoring(LEFT); text->set_x_centering(LEFT); text->SetSize(1, 1); - text->SetMultiLine(false); + text->SetTextLayoutMode(TextLayoutMode::kSingleLineFixedWidth); text->SetTextAlignment(UiTexture::kTextAlignmentLeft); hint_element_ = text.get(); this->AddChild(std::move(text)); - text = base::MakeUnique<Text>(maximum_width_pixels, font_height_meters); + text = base::MakeUnique<Text>(font_height_meters); text->SetType(kTypeTextInputText); text->SetDrawPhase(kPhaseForeground); text->set_hit_testable(true); @@ -44,7 +43,7 @@ text->set_x_centering(LEFT); text->set_bubble_events(true); text->SetSize(1, 1); - text->SetMultiLine(false); + text->SetTextLayoutMode(TextLayoutMode::kSingleLineFixedWidth); text->SetTextAlignment(UiTexture::kTextAlignmentLeft); text->SetCursorEnabled(true); text_element_ = text.get(); @@ -61,8 +60,6 @@ cursor->SetColor(SK_ColorBLUE); cursor_element_ = cursor.get(); text_element_->AddChild(std::move(cursor)); - - set_bounds_contain_children(true); } TextInput::~TextInput() {} @@ -142,7 +139,7 @@ return SetCursorBlinkState(time); } -void TextInput::OnSetSize(gfx::SizeF size) { +void TextInput::OnSetSize(const gfx::SizeF& size) { hint_element_->SetSize(size.width(), size.height()); text_element_->SetSize(size.width(), size.height()); }
diff --git a/chrome/browser/vr/elements/text_input.h b/chrome/browser/vr/elements/text_input.h index 438af9f..1ba81038 100644 --- a/chrome/browser/vr/elements/text_input.h +++ b/chrome/browser/vr/elements/text_input.h
@@ -28,8 +28,7 @@ // Called when the user commits text while this element is focused. typedef base::RepeatingCallback<void(const TextInputInfo&)> OnInputCommittedCallback; - TextInput(int maximum_width_pixels, - float font_height_meters, + TextInput(float font_height_meters, OnFocusChangedCallback focus_changed_callback, OnInputEditedCallback input_edit_callback); ~TextInput() override; @@ -55,7 +54,7 @@ bool OnBeginFrame(const base::TimeTicks& time, const gfx::Vector3dF& look_at) final; - void OnSetSize(gfx::SizeF size) final; + void OnSetSize(const gfx::SizeF& size) final; void OnSetName() final; Text* get_hint_element() { return hint_element_; }
diff --git a/chrome/browser/vr/elements/text_unittest.cc b/chrome/browser/vr/elements/text_unittest.cc index 3c87cbf..a931c5d 100644 --- a/chrome/browser/vr/elements/text_unittest.cc +++ b/chrome/browser/vr/elements/text_unittest.cc
@@ -13,16 +13,14 @@ TEST(Text, MultiLine) { const float kInitialSize = 1.0f; - const gfx::Size texture_size({512, 512}); // Create an initialize a text element with a long string. - auto text = base::MakeUnique<Text>(texture_size.width(), 0.020); + auto text = base::MakeUnique<Text>(0.020); text->SetSize(kInitialSize, 0); text->SetText(base::UTF8ToUTF16(std::string(1000, 'x'))); // Make sure we get multiple lines of rendered text from the string. - auto layout = text->LayOutTextForTest(texture_size); - size_t initial_num_lines = layout.size(); + size_t initial_num_lines = text->LayOutTextForTest().size(); auto initial_size = text->GetTextureSizeForTest(); EXPECT_GT(initial_num_lines, 1u); EXPECT_GT(initial_size.height(), 0.f); @@ -30,14 +28,12 @@ // Reduce the field width, and ensure that the number of lines increases along // with the texture height. text->SetSize(kInitialSize / 2, 0); - layout = text->LayOutTextForTest(texture_size); - EXPECT_GT(layout.size(), initial_num_lines); + EXPECT_GT(text->LayOutTextForTest().size(), initial_num_lines); EXPECT_GT(text->GetTextureSizeForTest().height(), initial_size.height()); // Enforce single-line rendering. - text->SetMultiLine(false); - layout = text->LayOutTextForTest(texture_size); - EXPECT_EQ(layout.size(), 1u); + text->SetTextLayoutMode(kSingleLineFixedWidth); + EXPECT_EQ(text->LayOutTextForTest().size(), 1u); EXPECT_LT(text->GetTextureSizeForTest().height(), initial_size.height()); }
diff --git a/chrome/browser/vr/elements/textured_element.cc b/chrome/browser/vr/elements/textured_element.cc index ef7c044..695a7d4b 100644 --- a/chrome/browser/vr/elements/textured_element.cc +++ b/chrome/browser/vr/elements/textured_element.cc
@@ -34,7 +34,6 @@ DCHECK(provider); provider_ = provider; DCHECK(GetTexture()); - texture_size_ = GetTexture()->GetPreferredTextureSize(maximum_width_); GetTexture()->OnInitialized(); initialized_ = true; } @@ -54,6 +53,11 @@ !(GetTexture()->dirty() || g_rerender_if_not_dirty_for_testing_) || !IsVisible()) return false; + GetTexture()->MeasureSize(); + DCHECK(GetTexture()->measured()); + texture_size_ = GetTexture()->GetPreferredTextureSize(maximum_width_); + // PreferredTextureSize might change due to text element has new layout or new + // text. So we need to get the latest value before create surface. surface_ = provider_->MakeSurface(texture_size_); DCHECK(surface_.get()); GetTexture()->DrawAndLayout(surface_->getCanvas(), texture_size_);
diff --git a/chrome/browser/vr/elements/textured_element.h b/chrome/browser/vr/elements/textured_element.h index 58786c171..b188141 100644 --- a/chrome/browser/vr/elements/textured_element.h +++ b/chrome/browser/vr/elements/textured_element.h
@@ -52,7 +52,7 @@ protected: virtual UiTexture* GetTexture() const = 0; - void UpdateElementSize(); + virtual void UpdateElementSize(); bool PrepareToDraw() final;
diff --git a/chrome/browser/vr/elements/ui_element.cc b/chrome/browser/vr/elements/ui_element.cc index 4d49901..da6fb60e 100644 --- a/chrome/browser/vr/elements/ui_element.cc +++ b/chrome/browser/vr/elements/ui_element.cc
@@ -203,7 +203,7 @@ OnSetSize(gfx::SizeF(width, height)); } -void UiElement::OnSetSize(gfx::SizeF size) {} +void UiElement::OnSetSize(const gfx::SizeF& size) {} void UiElement::SetVisible(bool visible) { SetOpacity(visible ? opacity_when_visible_ : 0.0); @@ -314,18 +314,21 @@ if (point.x() < 0.0f || point.x() > 1.0f || point.y() < 0.0f || point.y() > 1.0f) { return false; - } else if (corner_radius() == 0.f) { + } else if (corner_radii_.IsZero()) { return point.x() >= 0.0f && point.x() <= 1.0f && point.y() >= 0.0f && point.y() <= 1.0f; - } else if (size().width() == size().height() && - corner_radius() == size().width() / 2) { - return (point - gfx::PointF(0.5, 0.5)).LengthSquared() < 0.25; } float width = size().width(); float height = size().height(); - SkRRect rrect = SkRRect::MakeRectXY(SkRect::MakeWH(width, height), - corner_radius(), corner_radius()); + SkRRect rrect; + SkVector radii[4] = { + {corner_radii_.upper_left, corner_radii_.upper_left}, + {corner_radii_.upper_right, corner_radii_.upper_right}, + {corner_radii_.lower_right, corner_radii_.lower_right}, + {corner_radii_.lower_left, corner_radii_.lower_left}, + }; + rrect.setRectRadii(SkRect::MakeWH(width, height), radii); float left = std::min(point.x() * width, width - kHitTestResolutionInMeter); float top = std::min(point.y() * height, height - kHitTestResolutionInMeter); @@ -410,7 +413,7 @@ *os << DebugName() << kReset << " " << kCyan << DrawPhaseToString(draw_phase_) << " " << kReset; - if (draw_phase_ != kPhaseNone && !size().IsEmpty()) { + if (!size().IsEmpty()) { *os << kRed << "[" << size().width() << ", " << size().height() << "] " << kReset; } @@ -587,9 +590,9 @@ } gfx::RectF bounds; - bool first = false; for (auto& child : children_) { - if (!child->IsVisible() || child->size().IsEmpty()) { + if (!child->IsVisible() || child->size().IsEmpty() || + !child->contributes_to_parent_bounds()) { continue; } gfx::Point3F child_center(child->local_origin()); @@ -598,18 +601,13 @@ gfx::RectF(child_center.x() - 0.5 * child->size().width(), child_center.y() - 0.5 * child->size().height(), child->size().width(), child->size().height()); - if (first) { - bounds = local_rect; - first = false; - } else { - bounds.Union(local_rect); - } + bounds.Union(local_rect); } bounds.Inset(-x_padding_, -y_padding_); bounds.set_origin(bounds.CenterPoint()); - size_ = bounds.size(); local_origin_ = bounds.origin(); + SetSize(bounds.width(), bounds.height()); } void UiElement::LayOutChildren() {
diff --git a/chrome/browser/vr/elements/ui_element.h b/chrome/browser/vr/elements/ui_element.h index 2fda3df..688063bb 100644 --- a/chrome/browser/vr/elements/ui_element.h +++ b/chrome/browser/vr/elements/ui_element.h
@@ -16,6 +16,7 @@ #include "cc/animation/transform_operations.h" #include "chrome/browser/vr/animation_player.h" #include "chrome/browser/vr/databinding/binding_base.h" +#include "chrome/browser/vr/elements/corner_radii.h" #include "chrome/browser/vr/elements/draw_phase.h" #include "chrome/browser/vr/elements/ui_element_iterator.h" #include "chrome/browser/vr/elements/ui_element_name.h" @@ -218,7 +219,7 @@ gfx::SizeF size() const; void SetSize(float width, float hight); - virtual void OnSetSize(gfx::SizeF size); + virtual void OnSetSize(const gfx::SizeF& size); gfx::PointF local_origin() const { return local_origin_; } @@ -239,9 +240,18 @@ float opacity() const { return opacity_; } virtual void SetOpacity(float opacity); - float corner_radius() const { return corner_radius_; } + CornerRadii corner_radii() const { return corner_radii_; } + void set_corner_radii(const CornerRadii& radii) { corner_radii_ = radii; } + + float corner_radius() const { + DCHECK(corner_radii_.AllEqual()); + return corner_radii_.upper_left; + } + + // Syntax sugar for setting all corner radii to the same value. void set_corner_radius(float corner_radius) { - corner_radius_ = corner_radius; + set_corner_radii( + {corner_radius, corner_radius, corner_radius, corner_radius}); } float computed_opacity() const; @@ -274,6 +284,13 @@ bounds_contain_children_ = bounds_contain_children; } + bool contributes_to_parent_bounds() const { + return contributes_to_parent_bounds_; + } + void set_contributes_to_parent_bounds(bool value) { + contributes_to_parent_bounds_ = value; + } + float x_padding() const { return x_padding_; } float y_padding() const { return y_padding_; } void set_padding(float x_padding, float y_padding) { @@ -459,7 +476,7 @@ // The corner radius of the object. Analogous to the CSS property, // border-radius. This is in meters (same units as |size|). - float corner_radius_ = 0.0f; + CornerRadii corner_radii_ = {0, 0, 0, 0}; // The computed opacity, incorporating opacity of parent objects. float computed_opacity_ = 1.0f; @@ -486,6 +503,7 @@ // size to accommodate all descendants, adding in the padding below along the // x and y axes. bool bounds_contain_children_ = false; + bool contributes_to_parent_bounds_ = true; float x_padding_ = 0.0f; float y_padding_ = 0.0f;
diff --git a/chrome/browser/vr/elements/ui_texture.cc b/chrome/browser/vr/elements/ui_texture.cc index 25ae33b7..711bfec 100644 --- a/chrome/browser/vr/elements/ui_texture.cc +++ b/chrome/browser/vr/elements/ui_texture.cc
@@ -51,6 +51,13 @@ Draw(canvas, texture_size); } +void UiTexture::MeasureSize() { + OnMeasureSize(); + measured_ = true; +} + +void UiTexture::OnMeasureSize() {} + bool UiTexture::LocalHitTest(const gfx::PointF& point) const { return false; }
diff --git a/chrome/browser/vr/elements/ui_texture.h b/chrome/browser/vr/elements/ui_texture.h index 6f4eaacb..86eeb197 100644 --- a/chrome/browser/vr/elements/ui_texture.h +++ b/chrome/browser/vr/elements/ui_texture.h
@@ -34,10 +34,14 @@ virtual ~UiTexture(); void DrawAndLayout(SkCanvas* canvas, const gfx::Size& texture_size); + void MeasureSize(); + // TODO(bshe): make this pure virtual. + virtual void OnMeasureSize(); virtual gfx::Size GetPreferredTextureSize(int maximum_width) const = 0; virtual gfx::SizeF GetDrawnSize() const = 0; virtual bool LocalHitTest(const gfx::PointF& point) const; + bool measured() const { return measured_; } bool dirty() const { return dirty_; } void OnInitialized(); @@ -126,12 +130,17 @@ static bool IsRTL(); static void SetForceFontFallbackFailureForTesting(bool force); - void set_dirty() { dirty_ = true; } + void set_dirty() { + measured_ = false; + dirty_ = true; + } + SkColor foreground_color() const; SkColor background_color() const; private: bool dirty_ = true; + bool measured_ = false; base::Optional<SkColor> foreground_color_; base::Optional<SkColor> background_color_;
diff --git a/chrome/browser/vr/elements/url_bar_texture.cc b/chrome/browser/vr/elements/url_bar_texture.cc index 8054e1b..ed27c15 100644 --- a/chrome/browser/vr/elements/url_bar_texture.cc +++ b/chrome/browser/vr/elements/url_bar_texture.cc
@@ -152,6 +152,8 @@ void UrlBarTexture::SetColors(const UrlBarColors& colors) { SetAndDirty(&colors_, colors); + if (dirty()) + url_dirty_ = true; } SkColor UrlBarTexture::BackButtonColor() const {
diff --git a/chrome/browser/vr/elements/url_bar_texture.h b/chrome/browser/vr/elements/url_bar_texture.h index 3f230885..487c1cc 100644 --- a/chrome/browser/vr/elements/url_bar_texture.h +++ b/chrome/browser/vr/elements/url_bar_texture.h
@@ -58,6 +58,7 @@ security_state::SecurityLevel security_level, RenderTextWrapper* render_text, const UrlBarColors& colors); + bool url_dirty() const { return url_dirty_; } std::unique_ptr<gfx::RenderText> url_render_text_;
diff --git a/chrome/browser/vr/elements/url_bar_texture_unittest.cc b/chrome/browser/vr/elements/url_bar_texture_unittest.cc index 7d79e1b..54ffff1 100644 --- a/chrome/browser/vr/elements/url_bar_texture_unittest.cc +++ b/chrome/browser/vr/elements/url_bar_texture_unittest.cc
@@ -28,15 +28,15 @@ // TODO(cjgrant): Use ColorScheme instead of hardcoded values // where it makes sense. -static const SkColor kEmphasizedColor = 0xFF000000; +static const SkColor kEmphasizedColor = SK_ColorBLACK; static const SkColor kDeemphasizedColor = 0xFF5A5A5A; static const SkColor kSecureColor = gfx::kGoogleGreen700; static const SkColor kWarningColor = gfx::kGoogleRed700; -static const SkColor kIncognitoDeemphasizedColor = 0xFF878787; -static const SkColor kIncognitoEmphasizedColor = 0xFFEDEDED; -static const SkColor kIncognitoSecureColor = 0xFFEDEDED; -static const SkColor kIncognitoWarningColor = 0xFFEDEDED; +static const SkColor kIncognitoDeemphasizedColor = 0xCCFFFFFF; +static const SkColor kIncognitoEmphasizedColor = 0xFFFFFFFF; +static const SkColor kIncognitoSecureColor = 0xFFFFFFFF; +static const SkColor kIncognitoWarningColor = 0xFFFFFFFF; static constexpr int kUrlWidthPixels = 1024; @@ -98,6 +98,7 @@ const base::string16& security_text() { return rendered_security_text_; } const gfx::Rect url_rect() { return rendered_url_text_rect_; } const gfx::Rect security_rect() { return rendered_security_text_rect_; } + bool url_dirty() const { return UrlBarTexture::url_dirty(); } private: void OnUnsupportedFeature(UiUnsupportedMode mode) { @@ -322,4 +323,14 @@ EXPECT_EQ(texture.url_text(), base::UTF8ToUTF16("https://host.com/page")); } +TEST(UrlBarTexture, ColorChange) { + TestUrlBarTexture texture; + texture.DrawURL(GURL("https://short.com/")); + EXPECT_FALSE(texture.url_dirty()); + UrlBarColors colors; + colors.insecure = SK_ColorRED; + texture.SetColors(colors); + EXPECT_TRUE(texture.url_dirty()); +} + } // namespace vr
diff --git a/chrome/browser/vr/features.gni b/chrome/browser/vr/features.gni new file mode 100644 index 0000000..9707e9d7 --- /dev/null +++ b/chrome/browser/vr/features.gni
@@ -0,0 +1,13 @@ +# Copyright 2017 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/chrome_build.gni") +import("//device/vr/features/features.gni") + +assert(enable_vr) + +declare_args() { + # Whether to register and subsequently download the VR assets component. + register_vr_assets_component = is_chrome_branded +}
diff --git a/chrome/browser/vr/model/color_scheme.cc b/chrome/browser/vr/model/color_scheme.cc index 756b5eb6..7603272d 100644 --- a/chrome/browser/vr/model/color_scheme.cc +++ b/chrome/browser/vr/model/color_scheme.cc
@@ -32,8 +32,8 @@ normal_scheme.floor_grid = 0x26FFFFFF; normal_scheme.element_foreground = 0xFF333333; normal_scheme.element_background = 0xCCB3B3B3; - normal_scheme.element_background_hover = 0xFFCCCCCC; - normal_scheme.element_background_down = 0xFFF3F3F3; + normal_scheme.element_background_hover = 0xCCE3E3E3; + normal_scheme.element_background_down = 0xCCF3F3F3; normal_scheme.button_colors.foreground = 0x87000000; normal_scheme.button_colors.background = normal_scheme.element_background; normal_scheme.button_colors.background_hover = @@ -117,6 +117,12 @@ normal_scheme.omnibox_hint = 0xFF999999; normal_scheme.omnibox_suggestion_content = 0xFF595959; normal_scheme.omnibox_suggestion_description = 0xFF5595FE; + normal_scheme.suggestion_button_colors.foreground = + normal_scheme.omnibox_suggestion_content; + normal_scheme.suggestion_button_colors.background = + normal_scheme.omnibox_background; + normal_scheme.suggestion_button_colors.background_hover = 0xFFE0E0E0; + normal_scheme.suggestion_button_colors.background_down = 0xFFE0E0E0; normal_scheme.cursor = 0xFF5595FE; g_fullscreen_scheme.Get() = normal_scheme; @@ -144,12 +150,12 @@ g_incognito_scheme.Get() = normal_scheme; ColorScheme& incognito_scheme = g_incognito_scheme.Get(); incognito_scheme.world_background = 0xFF2E2E2E; - incognito_scheme.world_background_text = 0xFF878787; + incognito_scheme.world_background_text = 0x99FFFFFF; incognito_scheme.floor = 0xFF282828; incognito_scheme.ceiling = 0xFF2F2F2F; incognito_scheme.floor_grid = 0xCC595959; - incognito_scheme.element_foreground = 0xFFBCBCBC; - incognito_scheme.element_background = 0xCC454545; + incognito_scheme.element_foreground = 0xFFFFFFFF; + incognito_scheme.element_background = 0xFF454545; incognito_scheme.element_background_hover = 0xCC505050; incognito_scheme.element_background_down = 0xCC888888; incognito_scheme.button_colors.foreground = @@ -162,13 +168,13 @@ incognito_scheme.button_colors.background_down = fullscreen_scheme.element_background_down; - incognito_scheme.url_bar.secure = 0xFFEDEDED; + incognito_scheme.url_bar.secure = 0xFFFFFFFF; incognito_scheme.url_bar.insecure = incognito_scheme.url_bar.secure; incognito_scheme.url_bar.emphasized = incognito_scheme.url_bar.secure; - incognito_scheme.url_bar.deemphasized = 0xFF878787; + incognito_scheme.url_bar.deemphasized = 0xCCFFFFFF; incognito_scheme.url_bar.offline_page_warning = incognito_scheme.url_bar.secure; - incognito_scheme.url_bar.separator = 0xFF474747; + incognito_scheme.url_bar.separator = 0x1FFFFFFF; incognito_scheme.url_bar.back_button.background = incognito_scheme.element_background; incognito_scheme.url_bar.back_button.background_down = @@ -192,6 +198,18 @@ incognito_scheme.prompt_secondary_button_colors.background = 0x80FFFFFF; incognito_scheme.prompt_secondary_button_colors.background_hover = 0xFF8C8C8C; incognito_scheme.prompt_secondary_button_colors.background_down = 0xE6FFFFFF; + incognito_scheme.omnibox_background = 0xFF454545; + incognito_scheme.omnibox_icon = 0xCCFFFFFF; + incognito_scheme.omnibox_text = 0xCCFFFFFF; + incognito_scheme.omnibox_hint = 0x80FFFFFF; + incognito_scheme.omnibox_suggestion_content = 0xCCFFFFFF; + incognito_scheme.omnibox_suggestion_description = 0xCCFFFFFF; + incognito_scheme.suggestion_button_colors.foreground = + incognito_scheme.omnibox_suggestion_content; + incognito_scheme.suggestion_button_colors.background = + incognito_scheme.omnibox_background; + incognito_scheme.suggestion_button_colors.background_hover = 0xFF656565; + incognito_scheme.suggestion_button_colors.background_down = 0xFF656565; initialized = true; }
diff --git a/chrome/browser/vr/model/color_scheme.h b/chrome/browser/vr/model/color_scheme.h index 4ff5cb9..1607456 100644 --- a/chrome/browser/vr/model/color_scheme.h +++ b/chrome/browser/vr/model/color_scheme.h
@@ -109,6 +109,7 @@ SkColor omnibox_hint; SkColor omnibox_suggestion_content; SkColor omnibox_suggestion_description; + ButtonColors suggestion_button_colors; SkColor cursor; };
diff --git a/chrome/browser/vr/renderers/gradient_quad_renderer.cc b/chrome/browser/vr/renderers/gradient_quad_renderer.cc index 14f5f2f..ac694ddc 100644 --- a/chrome/browser/vr/renderers/gradient_quad_renderer.cc +++ b/chrome/browser/vr/renderers/gradient_quad_renderer.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/vr/renderers/gradient_quad_renderer.h" +#include "chrome/browser/vr/elements/corner_radii.h" #include "chrome/browser/vr/renderers/textured_quad_renderer.h" #include "chrome/browser/vr/vr_gl_util.h" #include "ui/gfx/geometry/size_f.h" @@ -27,7 +28,10 @@ static constexpr char const* kVertexShader = SHADER( precision mediump float; uniform mat4 u_ModelViewProjMatrix; - uniform vec2 u_CornerOffset; + uniform vec2 u_ULCornerOffset; + uniform vec2 u_URCornerOffset; + uniform vec2 u_LRCornerOffset; + uniform vec2 u_LLCornerOffset; attribute vec4 a_Position; attribute vec2 a_CornerPosition; attribute vec2 a_OffsetScale; @@ -36,9 +40,19 @@ void main() { v_CornerPosition = a_CornerPosition; + vec2 corner_offset; + if (a_Position[0] < 0.0 && a_Position[1] > 0.0) { + corner_offset = u_ULCornerOffset; + } else if (a_Position[0] > 0.0 && a_Position[1] > 0.0) { + corner_offset = u_URCornerOffset; + } else if (a_Position[0] > 0.0 && a_Position[1] < 0.0) { + corner_offset = u_LRCornerOffset; + } else if (a_Position[0] < 0.0 && a_Position[1] < 0.0) { + corner_offset = u_LLCornerOffset; + } vec4 position = vec4( - a_Position[0] + u_CornerOffset[0] * a_OffsetScale[0], - a_Position[1] + u_CornerOffset[1] * a_OffsetScale[1], + a_Position[0] + corner_offset[0] * a_OffsetScale[0], + a_Position[1] + corner_offset[1] * a_OffsetScale[1], a_Position[2], a_Position[3]); v_Position = position.xy; @@ -73,14 +87,27 @@ ); // clang-format on +void SetCornerOffset(GLuint handle, float radius, const gfx::SizeF& size) { + if (radius == 0.0f) + glUniform2f(handle, 0.0, 0.0); + else + glUniform2f(handle, radius / size.width(), radius / size.height()); +} + } // namespace GradientQuadRenderer::GradientQuadRenderer() : BaseRenderer(kVertexShader, kFragmentShader) { model_view_proj_matrix_handle_ = glGetUniformLocation(program_handle_, "u_ModelViewProjMatrix"); - corner_offset_handle_ = - glGetUniformLocation(program_handle_, "u_CornerOffset"); + ul_corner_offset_handle_ = + glGetUniformLocation(program_handle_, "u_ULCornerOffset"); + ur_corner_offset_handle_ = + glGetUniformLocation(program_handle_, "u_URCornerOffset"); + lr_corner_offset_handle_ = + glGetUniformLocation(program_handle_, "u_LRCornerOffset"); + ll_corner_offset_handle_ = + glGetUniformLocation(program_handle_, "u_LLCornerOffset"); corner_position_handle_ = glGetAttribLocation(program_handle_, "a_CornerPosition"); offset_scale_handle_ = glGetAttribLocation(program_handle_, "a_OffsetScale"); @@ -96,7 +123,7 @@ SkColor center_color, float opacity, const gfx::SizeF& element_size, - float corner_radius) { + const CornerRadii& radii) { glUseProgram(program_handle_); glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); @@ -121,12 +148,10 @@ VOID_OFFSET(kCornerPositionDataOffset)); glEnableVertexAttribArray(corner_position_handle_); - if (corner_radius == 0.0f) { - glUniform2f(corner_offset_handle_, 0.0, 0.0); - } else { - glUniform2f(corner_offset_handle_, corner_radius / element_size.width(), - corner_radius / element_size.height()); - } + SetCornerOffset(ul_corner_offset_handle_, radii.upper_left, element_size); + SetCornerOffset(ur_corner_offset_handle_, radii.upper_right, element_size); + SetCornerOffset(lr_corner_offset_handle_, radii.lower_right, element_size); + SetCornerOffset(ll_corner_offset_handle_, radii.lower_left, element_size); // Set the edge color to the fog color so that it seems to fade out. SetColorUniform(edge_color_handle_, edge_color); @@ -137,7 +162,7 @@ glUniformMatrix4fv(model_view_proj_matrix_handle_, 1, false, MatrixToGLArray(model_view_proj_matrix).data()); - if (corner_radius == 0.0f) { + if (radii.IsZero()) { glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, VOID_OFFSET(kInnerRectOffset)); } else {
diff --git a/chrome/browser/vr/renderers/gradient_quad_renderer.h b/chrome/browser/vr/renderers/gradient_quad_renderer.h index 495808e..54da2814 100644 --- a/chrome/browser/vr/renderers/gradient_quad_renderer.h +++ b/chrome/browser/vr/renderers/gradient_quad_renderer.h
@@ -16,6 +16,8 @@ namespace vr { +struct CornerRadii; + class GradientQuadRenderer : public BaseRenderer { public: GradientQuadRenderer(); @@ -26,11 +28,14 @@ SkColor center_color, float opacity, const gfx::SizeF& element_size, - float corner_radius); + const CornerRadii& radii); private: GLuint model_view_proj_matrix_handle_; - GLuint corner_offset_handle_; + GLuint ul_corner_offset_handle_; + GLuint ur_corner_offset_handle_; + GLuint lr_corner_offset_handle_; + GLuint ll_corner_offset_handle_; GLuint corner_position_handle_; GLuint offset_scale_handle_; GLuint opacity_handle_;
diff --git a/chrome/browser/vr/test/fake_ui_element_renderer.cc b/chrome/browser/vr/test/fake_ui_element_renderer.cc index 527e1bd..82680d1 100644 --- a/chrome/browser/vr/test/fake_ui_element_renderer.cc +++ b/chrome/browser/vr/test/fake_ui_element_renderer.cc
@@ -17,7 +17,7 @@ const gfx::Transform& view_proj_matrix, const gfx::RectF& copy_rect, float opacity, - gfx::SizeF element_size, + const gfx::SizeF& element_size, float corner_radius) { opacity_ = opacity; called_ = true; @@ -28,8 +28,8 @@ const SkColor edge_color, const SkColor center_color, float opacity, - gfx::SizeF element_size, - float corner_radius) { + const gfx::SizeF& element_size, + const CornerRadii& corner_radii) { opacity_ = opacity; called_ = true; }
diff --git a/chrome/browser/vr/test/fake_ui_element_renderer.h b/chrome/browser/vr/test/fake_ui_element_renderer.h index 143d63d1..8bb65fd 100644 --- a/chrome/browser/vr/test/fake_ui_element_renderer.h +++ b/chrome/browser/vr/test/fake_ui_element_renderer.h
@@ -23,15 +23,15 @@ const gfx::Transform& view_proj_matrix, const gfx::RectF& copy_rect, float opacity, - gfx::SizeF element_size, + const gfx::SizeF& element_size, float corner_radius) override; void DrawGradientQuad(const gfx::Transform& view_proj_matrix, const SkColor edge_color, const SkColor center_color, float opacity, - gfx::SizeF element_size, - float corner_radius) override; + const gfx::SizeF& element_size, + const CornerRadii& corner_radii) override; void DrawGradientGridQuad(const gfx::Transform& view_proj_matrix, const SkColor edge_color,
diff --git a/chrome/browser/vr/test/vr_browser_test.cc b/chrome/browser/vr/test/vr_browser_test.cc new file mode 100644 index 0000000..59671db --- /dev/null +++ b/chrome/browser/vr/test/vr_browser_test.cc
@@ -0,0 +1,226 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <cstring> + +#include "base/bind.h" +#include "base/callback.h" +#include "base/command_line.h" +#include "base/environment.h" +#include "base/files/file_path.h" +#include "base/files/file_util.h" +#include "base/strings/utf_string_conversions.h" +#include "base/test/scoped_feature_list.h" +#include "base/threading/platform_thread.h" +#include "base/time/time.h" +#include "build/build_config.h" +#include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/tabs/tab_strip_model.h" +#include "chrome/browser/vr/test/vr_browser_test.h" +#include "chrome/common/chrome_features.h" +#include "chrome/test/base/in_process_browser_test.h" +#include "chrome/test/base/ui_test_utils.h" +#include "content/public/browser/web_contents.h" +#include "content/public/common/content_features.h" +#include "content/public/common/content_switches.h" +#include "content/public/test/browser_test_utils.h" +#include "url/gurl.h" + +namespace vr { + +constexpr base::TimeDelta VrBrowserTest::kPollCheckIntervalShort; +constexpr base::TimeDelta VrBrowserTest::kPollCheckIntervalLong; +constexpr base::TimeDelta VrBrowserTest::kPollTimeoutShort; +constexpr base::TimeDelta VrBrowserTest::kPollTimeoutLong; +constexpr char VrBrowserTest::kVrOverrideEnvVar[]; +constexpr char VrBrowserTest::kVrOverrideVal[]; +constexpr char VrBrowserTest::kVrConfigPathEnvVar[]; +constexpr char VrBrowserTest::kVrConfigPathVal[]; +constexpr char VrBrowserTest::kVrLogPathEnvVar[]; +constexpr char VrBrowserTest::kVrLogPathVal[]; + +VrBrowserTest::VrBrowserTest() : env_(base::Environment::Create()) {} + +VrBrowserTest::~VrBrowserTest() = default; + +// We need an std::string that is an absolute file path, which requires +// platform-specific logic since Windows uses std::wstring instead of +// std::string for FilePaths, but SetVar only accepts std::string +#ifdef OS_WIN +#define MAKE_ABSOLUTE(x) \ + base::WideToUTF8( \ + base::MakeAbsoluteFilePath(base::FilePath(base::UTF8ToWide(x))).value()) +#else +#define MAKE_ABSOLUTE(x) base::MakeAbsoluteFilePath(base::FilePath(x)).value() +#endif + +void VrBrowserTest::SetUp() { + // Set the environment variable to use the mock OpenVR client + EXPECT_TRUE(env_->SetVar(kVrOverrideEnvVar, MAKE_ABSOLUTE(kVrOverrideVal))); + EXPECT_TRUE( + env_->SetVar(kVrConfigPathEnvVar, MAKE_ABSOLUTE(kVrConfigPathVal))); + EXPECT_TRUE(env_->SetVar(kVrLogPathEnvVar, MAKE_ABSOLUTE(kVrLogPathVal))); + + // Make sure the WebVR, Gamepad, and OpenVR features are enabled + base::CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnableWebVR); + scoped_feature_list_.InitWithFeatures( + {features::kOpenVR, features::kGamepadExtensions}, {}); + InProcessBrowserTest::SetUp(); +} + +GURL VrBrowserTest::GetHtmlTestFile(const std::string& test_name) { + return ui_test_utils::GetTestUrl( + base::FilePath(FILE_PATH_LITERAL("android/webvr_instrumentation/html")), +#ifdef OS_WIN + base::FilePath(base::UTF8ToWide(test_name + ".html") +#else + base::FilePath(test_name + ".html") +#endif + )); +} + +content::WebContents* VrBrowserTest::GetFirstTabWebContents() { + return browser()->tab_strip_model()->GetWebContentsAt(0); +} + +void VrBrowserTest::LoadUrlAndAwaitInitialization(const GURL& url) { + ui_test_utils::NavigateToURL(browser(), url); + EXPECT_TRUE(PollJavaScriptBoolean( + "isInitializationComplete()", kPollTimeoutShort, + browser()->tab_strip_model()->GetActiveWebContents())) + << "Timed out waiting for JavaScript test initialization."; +} + +bool VrBrowserTest::VrDisplayFound(content::WebContents* web_contents) { + return RunJavaScriptAndExtractBoolOrFail("vrDisplay != null", web_contents); +} + +VrBrowserTest::TestStatus VrBrowserTest::CheckTestStatus( + content::WebContents* web_contents) { + std::string result_string = + RunJavaScriptAndExtractStringOrFail("resultString", web_contents); + bool test_passed = + RunJavaScriptAndExtractBoolOrFail("testPassed", web_contents); + if (test_passed) { + return VrBrowserTest::TestStatus::STATUS_PASSED; + } else if (!test_passed && result_string == "") { + return VrBrowserTest::TestStatus::STATUS_RUNNING; + } else { + // !test_passed && result_string != "" + return VrBrowserTest::TestStatus::STATUS_FAILED; + } +} + +void VrBrowserTest::EndTest(content::WebContents* web_contents) { + switch (CheckTestStatus(web_contents)) { + case VrBrowserTest::TestStatus::STATUS_PASSED: + break; + case VrBrowserTest::TestStatus::STATUS_FAILED: + FAIL() << "JavaScript testharness failed with result: " + << RunJavaScriptAndExtractStringOrFail("resultString", + web_contents); + break; + case VrBrowserTest::TestStatus::STATUS_RUNNING: + FAIL() << "Attempted to end test in C++ without finishing in JavaScript"; + break; + default: + FAIL() << "Received unknown test status."; + } +} + +bool VrBrowserTest::PollJavaScriptBoolean(const std::string& bool_expression, + const base::TimeDelta& timeout, + content::WebContents* web_contents) { + return BlockOnConditionUnsafe( + base::BindRepeating(RunJavaScriptAndExtractBoolOrFail, bool_expression, + web_contents), + timeout); +} + +void VrBrowserTest::WaitOnJavaScriptStep(content::WebContents* web_contents) { + // Make sure we aren't trying to wait on a JavaScript test step without the + // code to do so. + bool code_available = RunJavaScriptAndExtractBoolOrFail( + "typeof javascriptDone !== 'undefined'", web_contents); + EXPECT_TRUE(code_available) << "Attempted to wait on a JavaScript test step " + << "without the code to do so. You either forgot " + << "to import webvr_e2e.js or " + << "are incorrectly using a C++ function."; + + // Actually wait for the step to finish + bool success = + PollJavaScriptBoolean("javascriptDone", kPollTimeoutLong, web_contents); + + // Check what state we're in to make sure javascriptDone wasn't called + // because the test failed. + VrBrowserTest::TestStatus test_status = CheckTestStatus(web_contents); + if (!success || test_status == VrBrowserTest::TestStatus::STATUS_FAILED) { + // Failure states: Either polling failed or polling succeeded, but because + // the test failed. + std::string reason; + if (!success) { + reason = "Polling JavaScript boolean javascriptDone timed out."; + } else { + reason = + "Polling JavaScript boolean javascriptDone succeeded, but test " + "failed."; + } + + std::string result_string = + RunJavaScriptAndExtractStringOrFail("resultString", web_contents); + if (result_string == "") { + reason += " Did not obtain specific reason from testharness."; + } else { + reason += " Testharness reported failure: " + result_string; + } + FAIL() << reason; + } + + // Reset the synchronization boolean + EXPECT_TRUE(content::ExecuteScript(web_contents, "javascriptDone = false")); +} + +void VrBrowserTest::ExecuteStepAndWait(const std::string& step_function, + content::WebContents* web_contents) { + EXPECT_TRUE(content::ExecuteScript(web_contents, step_function)); + WaitOnJavaScriptStep(web_contents); +} + +bool VrBrowserTest::BlockOnConditionUnsafe( + base::RepeatingCallback<bool()> condition, + const base::TimeDelta& timeout, + const base::TimeDelta& period) { + base::Time start = base::Time::Now(); + bool successful = false; + while (base::Time::Now() - start < timeout) { + successful = condition.Run(); + if (successful) { + break; + } + base::PlatformThread::Sleep(period); + } + return successful; +} + +bool VrBrowserTest::RunJavaScriptAndExtractBoolOrFail( + const std::string& js_expression, + content::WebContents* web_contents) { + bool result; + EXPECT_TRUE(content::ExecuteScriptAndExtractBool( + web_contents, + "window.domAutomationController.send(" + js_expression + ")", &result)); + return result; +} + +std::string VrBrowserTest::RunJavaScriptAndExtractStringOrFail( + const std::string& js_expression, + content::WebContents* web_contents) { + std::string result; + EXPECT_TRUE(content::ExecuteScriptAndExtractString( + web_contents, + "window.domAutomationController.send(" + js_expression + ")", &result)); + return result; +} + +} // namespace vr
diff --git a/chrome/browser/vr/test/vr_browser_test.h b/chrome/browser/vr/test/vr_browser_test.h new file mode 100644 index 0000000..9e19f3b --- /dev/null +++ b/chrome/browser/vr/test/vr_browser_test.h
@@ -0,0 +1,125 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_VR_TEST_VR_BROWSER_TEST_H_ +#define CHROME_BROWSER_VR_TEST_VR_BROWSER_TEST_H_ + +#include "base/callback.h" +#include "base/environment.h" +#include "base/test/scoped_feature_list.h" +#include "base/time/time.h" +#include "chrome/test/base/in_process_browser_test.h" +#include "content/public/browser/web_contents.h" +#include "url/gurl.h" + +#define REQUIRES_GPU(x) DISABLED_##x + +namespace vr { + +// Base browser test class for running VR-related tests. +// This is essentially a C++ port of the way Android does similar tests in +// //chrome/android/javatests/src/.../browser/vr_shell/VrTestFramework.java +class VrBrowserTest : public InProcessBrowserTest { + public: + static constexpr base::TimeDelta kPollCheckIntervalShort = + base::TimeDelta::FromMilliseconds(50); + static constexpr base::TimeDelta kPollCheckIntervalLong = + base::TimeDelta::FromMilliseconds(100); + static constexpr base::TimeDelta kPollTimeoutShort = + base::TimeDelta::FromMilliseconds(1000); + static constexpr base::TimeDelta kPollTimeoutLong = + base::TimeDelta::FromMilliseconds(10000); + static constexpr char kVrOverrideEnvVar[] = "VR_OVERRIDE"; + static constexpr char kVrOverrideVal[] = "./mock_vr_clients/"; + static constexpr char kVrConfigPathEnvVar[] = "VR_CONFIG_PATH"; + static constexpr char kVrConfigPathVal[] = "./"; + static constexpr char kVrLogPathEnvVar[] = "VR_LOG_PATH"; + static constexpr char kVrLogPathVal[] = "./"; + enum class TestStatus { + STATUS_RUNNING = 0, + STATUS_PASSED = 1, + STATUS_FAILED = 2 + }; + + VrBrowserTest(); + ~VrBrowserTest() override; + + void SetUp() override; + + // Returns a GURL to the VR test HTML file of the given name, e.g. + // GetHtmlTestFile("foo") returns a GURL for the foo.html file in the VR + // test HTML directory. + GURL GetHtmlTestFile(const std::string& test_name); + + // Convenience function for accessing the WebContents belonging to the first + // tab open in the browser. + content::WebContents* GetFirstTabWebContents(); + + // Loads the given GURL and blocks until the JavaScript on the page has + // signalled that pre-test initialization is complete. + void LoadUrlAndAwaitInitialization(const GURL& url); + + // Returns true if the JavaScript in the given WebContents has found a + // WebVR VRDisplay, false otherwise. + static bool VrDisplayFound(content::WebContents* web_contents); + + // Retrieves the current status of the JavaScript test and returns an enum + // corresponding to it. + static TestStatus CheckTestStatus(content::WebContents* web_contents); + + // Asserts that the JavaScript test code completed successfully. + static void EndTest(content::WebContents* web_contents); + + // Blocks until the given JavaScript expression evaluates to true or the + // timeout is reached. Returns true if the expression evaluated to true or + // false on timeout. + static bool PollJavaScriptBoolean(const std::string& bool_expression, + const base::TimeDelta& timeout, + content::WebContents* web_contents); + + // Blocks until the JavaScript in the given WebContents signals that it is + // finished. + static void WaitOnJavaScriptStep(content::WebContents* web_contents); + + // Executes the given step/JavaScript expression and blocks until JavaScript + // signals that it is finished. + static void ExecuteStepAndWait(const std::string& step_function, + content::WebContents* web_contents); + + // Blocks until the given callback returns true or the timeout is reached. + // Returns true if the condition successfully resolved or false on timeout. + // This is unsafe because it relies on the provided callback checking a result + // from a different thread. This isn't an issue when blocking on some + // JavaScript condition to be true, but could be problematic if forced into + // use elsewhere. + static bool BlockOnConditionUnsafe( + base::RepeatingCallback<bool()> condition, + const base::TimeDelta& timeout = kPollTimeoutLong, + const base::TimeDelta& period = kPollCheckIntervalLong); + + // Convenience function for ensuring ExecuteScriptAndExtractBool runs + // successfully and for directly getting the result instead of needing to pass + // a pointer to be filled. + static bool RunJavaScriptAndExtractBoolOrFail( + const std::string& js_expression, + content::WebContents* web_contents); + + // Convenience function for ensuring ExecuteScripteAndExtractString runs + // successfully and for directly getting the result instead of needing to pass + // a pointer to be filled. + static std::string RunJavaScriptAndExtractStringOrFail( + const std::string& js_expression, + content::WebContents* web_contents); + + protected: + std::unique_ptr<base::Environment> env_; + + private: + base::test::ScopedFeatureList scoped_feature_list_; + DISALLOW_COPY_AND_ASSIGN(VrBrowserTest); +}; + +} // namespace vr + +#endif // CHROME_BROWSER_VR_TEST_VR_BROWSER_TEST_H_
diff --git a/chrome/browser/vr/test/vr_transition_utils.cc b/chrome/browser/vr/test/vr_transition_utils.cc new file mode 100644 index 0000000..762af57 --- /dev/null +++ b/chrome/browser/vr/test/vr_transition_utils.cc
@@ -0,0 +1,30 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/vr/test/vr_transition_utils.h" +#include "chrome/browser/vr/test/vr_browser_test.h" +#include "content/public/browser/web_contents.h" +#include "content/public/test/browser_test_utils.h" + +namespace vr { + +void enterPresentation(content::WebContents* web_contents) { + // ExecuteScript runs with a user gesture, so we can just directly call + // requestPresent instead of having to do the hacky workaround the + // instrumentation tests use of actually sending a click event to the canvas. + EXPECT_TRUE(content::ExecuteScript(web_contents, "onVrRequestPresent()")); +} + +void enterPresentationAndWait(content::WebContents* web_contents) { + enterPresentation(web_contents); + VrBrowserTest::WaitOnJavaScriptStep(web_contents); +} + +void enterPresentationOrFail(content::WebContents* web_contents) { + enterPresentation(web_contents); + EXPECT_TRUE(VrBrowserTest::PollJavaScriptBoolean( + "vrDisplay.isPresenting", VrBrowserTest::kPollTimeoutLong, web_contents)); +} + +} // namespace vr
diff --git a/chrome/browser/vr/test/vr_transition_utils.h b/chrome/browser/vr/test/vr_transition_utils.h new file mode 100644 index 0000000..20457f6 --- /dev/null +++ b/chrome/browser/vr/test/vr_transition_utils.h
@@ -0,0 +1,18 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_VR_TEST_VR_TRANSITION_UTILS_H_ +#define CHROME_BROWSER_VR_TEST_VR_TRANSITION_UTILS_H_ + +#include "content/public/browser/web_contents.h" + +namespace vr { + +void enterPresentation(content::WebContents* web_contents); +void enterPresentationAndWait(content::WebContents* web_contents); +void enterPresentationOrFail(content::WebContents* web_contents); + +} // namespace vr + +#endif // CHROME_BROWSER_VR_TEST_VR_TRANSITION_UTILS_H_
diff --git a/chrome/browser/vr/testapp/BUILD.gn b/chrome/browser/vr/testapp/BUILD.gn index 9d7bdc0..077650d 100644 --- a/chrome/browser/vr/testapp/BUILD.gn +++ b/chrome/browser/vr/testapp/BUILD.gn
@@ -8,6 +8,10 @@ sources = [ "gl_renderer.cc", "gl_renderer.h", + "test_keyboard_delegate.cc", + "test_keyboard_delegate.h", + "test_keyboard_renderer.cc", + "test_keyboard_renderer.h", "vr_test_context.cc", "vr_test_context.h", "vr_testapp.cc",
diff --git a/chrome/browser/vr/testapp/keyboard.png b/chrome/browser/vr/testapp/keyboard.png new file mode 100644 index 0000000..5b569d1 --- /dev/null +++ b/chrome/browser/vr/testapp/keyboard.png Binary files differ
diff --git a/chrome/browser/vr/testapp/test_keyboard_delegate.cc b/chrome/browser/vr/testapp/test_keyboard_delegate.cc new file mode 100644 index 0000000..edeaec3 --- /dev/null +++ b/chrome/browser/vr/testapp/test_keyboard_delegate.cc
@@ -0,0 +1,96 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/vr/testapp/test_keyboard_delegate.h" + +#include "base/memory/ptr_util.h" +#include "base/strings/utf_string_conversion_utils.h" +#include "base/strings/utf_string_conversions.h" +#include "ui/events/event.h" +#include "ui/events/keycodes/dom/dom_code.h" + +namespace vr { + +namespace { + +constexpr gfx::SizeF kKeyboardSize = {1.2f, 0.37f}; +constexpr gfx::Vector2dF kKeyboardTranslate = {0, -0.1}; + +} // namespace + +TestKeyboardDelegate::TestKeyboardDelegate() + : renderer_(base::MakeUnique<TestKeyboardRenderer>()) {} + +TestKeyboardDelegate::~TestKeyboardDelegate() {} + +void TestKeyboardDelegate::ShowKeyboard() { + editing_ = true; +} + +void TestKeyboardDelegate::HideKeyboard() { + editing_ = false; +} + +void TestKeyboardDelegate::SetTransform(const gfx::Transform& transform) { + world_space_transform_ = transform; +} + +bool TestKeyboardDelegate::HitTest(const gfx::Point3F& ray_origin, + const gfx::Point3F& ray_target, + gfx::Point3F* hit_position) { + // TODO(ymalik): Add hittesting logic for the keyboard. + return false; +} + +void TestKeyboardDelegate::Draw(const CameraModel& model) { + if (!editing_) + return; + + // We try to simulate what the gvr keyboard does here by scaling and + // translating the keyboard on top of the provided transform. + gfx::Transform world_space_transform = world_space_transform_; + world_space_transform.Scale(kKeyboardSize.width(), kKeyboardSize.height()); + world_space_transform.Translate(kKeyboardTranslate); + renderer_->Draw(model, world_space_transform); +} + +void TestKeyboardDelegate::Initialize(vr::SkiaSurfaceProvider* provider, + UiElementRenderer* renderer) { + renderer_->Initialize(provider, renderer); +} + +bool TestKeyboardDelegate::HandleInput(ui::Event* e) { + DCHECK(keyboard_interface_); + DCHECK(e->IsKeyEvent()); + if (!editing_) + return false; + + auto* event = e->AsKeyEvent(); + switch (event->key_code()) { + case ui::VKEY_RETURN: + input_info_.text.clear(); + input_info_.selection_start = input_info_.selection_end = 0; + keyboard_interface_->OnInputCommitted(input_info_); + break; + case ui::VKEY_BACK: + input_info_.text.pop_back(); + input_info_.selection_start--; + input_info_.selection_end--; + keyboard_interface_->OnInputEdited(input_info_); + break; + default: + std::string character; + base::WriteUnicodeCharacter(event->GetText(), &character); + input_info_.text = input_info_.text.append(base::UTF8ToUTF16(character)); + input_info_.selection_start++; + input_info_.selection_end++; + keyboard_interface_->OnInputEdited(input_info_); + break; + } + // We want to continue handling this keypress if the Ctrl key is down so + // that we can do things like duming the tree in editing mode. + return !event->IsControlDown(); +} + +} // namespace vr
diff --git a/chrome/browser/vr/testapp/test_keyboard_delegate.h b/chrome/browser/vr/testapp/test_keyboard_delegate.h new file mode 100644 index 0000000..47d9ba5 --- /dev/null +++ b/chrome/browser/vr/testapp/test_keyboard_delegate.h
@@ -0,0 +1,58 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_VR_TESTAPP_TEST_KEYBOARD_DELEGATE_H_ +#define CHROME_BROWSER_VR_TESTAPP_TEST_KEYBOARD_DELEGATE_H_ + +#include "base/macros.h" +#include "chrome/browser/vr/keyboard_delegate.h" +#include "chrome/browser/vr/keyboard_ui_interface.h" +#include "chrome/browser/vr/model/text_input_info.h" +#include "chrome/browser/vr/testapp/test_keyboard_renderer.h" +#include "ui/gfx/transform.h" + +namespace gfx { +class Point3F; +} // namespace gfx + +namespace ui { +class Event; +} // namespace ui + +namespace vr { + +class UiElementRenderer; +struct CameraModel; + +class TestKeyboardDelegate : public KeyboardDelegate { + public: + TestKeyboardDelegate(); + ~TestKeyboardDelegate() override; + + void ShowKeyboard() override; + void HideKeyboard() override; + void SetTransform(const gfx::Transform& transform) override; + bool HitTest(const gfx::Point3F& ray_origin, + const gfx::Point3F& ray_target, + gfx::Point3F* hit_position) override; + void Draw(const CameraModel& model) override; + + void Initialize(SkiaSurfaceProvider* provider, UiElementRenderer* renderer); + void SetUiInterface(KeyboardUiInterface* keyboard) { + keyboard_interface_ = keyboard; + } + void UpdateInput(const vr::TextInputInfo& info) { input_info_ = info; } + bool HandleInput(ui::Event* e); + + private: + std::unique_ptr<TestKeyboardRenderer> renderer_; + KeyboardUiInterface* keyboard_interface_ = nullptr; + gfx::Transform world_space_transform_; + bool editing_; + TextInputInfo input_info_; +}; + +} // namespace vr + +#endif // CHROME_BROWSER_VR_TESTAPP_TEST_KEYBOARD_DELEGATE_H_
diff --git a/chrome/browser/vr/testapp/test_keyboard_renderer.cc b/chrome/browser/vr/testapp/test_keyboard_renderer.cc new file mode 100644 index 0000000..e88a7479 --- /dev/null +++ b/chrome/browser/vr/testapp/test_keyboard_renderer.cc
@@ -0,0 +1,59 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/vr/testapp/test_keyboard_renderer.h" + +#include "base/files/file_util.h" +#include "base/memory/ptr_util.h" +#include "base/path_service.h" +#include "base/strings/utf_string_conversion_utils.h" +#include "chrome/browser/vr/skia_surface_provider.h" +#include "chrome/browser/vr/ui_element_renderer.h" +#include "third_party/skia/include/core/SkCanvas.h" +#include "ui/gfx/codec/png_codec.h" + +namespace vr { + +namespace { +constexpr char kKeyboardImagePath[] = "chrome/browser/vr/testapp/keyboard.png"; +} // namespace + +TestKeyboardRenderer::TestKeyboardRenderer() = default; +TestKeyboardRenderer::~TestKeyboardRenderer() = default; + +void TestKeyboardRenderer::Initialize(SkiaSurfaceProvider* provider, + UiElementRenderer* renderer) { + renderer_ = renderer; + + // Note that we simply render an image for the keyboard and the actual input + // is provided by the physical keyboard. + // Read and decode keyboard image. + base::FilePath dir; + PathService::Get(base::DIR_CURRENT, &dir); + dir = dir.Append(base::FilePath().AppendASCII(kKeyboardImagePath)); + DCHECK(base::PathExists(dir)); + std::string file_contents; + base::ReadFileToString(dir, &file_contents); + const unsigned char* data = + reinterpret_cast<const unsigned char*>(file_contents.data()); + SkBitmap bitmap; + gfx::PNGCodec::Decode(data, file_contents.length(), &bitmap); + + drawn_size_.SetSize(bitmap.width(), bitmap.height()); + surface_ = provider->MakeSurface(drawn_size_); + DCHECK(surface_); + + surface_->getCanvas()->drawBitmap(bitmap, 0, 0); + texture_handle_ = provider->FlushSurface(surface_.get(), texture_handle_); +} + +void TestKeyboardRenderer::Draw(const CameraModel& model, + const gfx::Transform& world_space_transform) { + renderer_->DrawTexturedQuad( + texture_handle_, UiElementRenderer::kTextureLocationLocal, + model.view_proj_matrix * world_space_transform, gfx::RectF(0, 0, 1, 1), 1, + {drawn_size_.width(), drawn_size_.height()}, 0); +} + +} // namespace vr
diff --git a/chrome/browser/vr/testapp/test_keyboard_renderer.h b/chrome/browser/vr/testapp/test_keyboard_renderer.h new file mode 100644 index 0000000..fcc72c3 --- /dev/null +++ b/chrome/browser/vr/testapp/test_keyboard_renderer.h
@@ -0,0 +1,43 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_VR_TESTAPP_TEST_KEYBOARD_RENDERER_H_ +#define CHROME_BROWSER_VR_TESTAPP_TEST_KEYBOARD_RENDERER_H_ + +#include "base/macros.h" +#include "third_party/skia/include/core/SkSurface.h" +#include "ui/gfx/geometry/size_f.h" +#include "ui/gl/gl_bindings.h" + +namespace gfx { +class Transform; +} // namespace gfx + +namespace vr { + +class SkiaSurfaceProvider; +class UiElementRenderer; +struct CameraModel; + +class TestKeyboardRenderer { + public: + TestKeyboardRenderer(); + ~TestKeyboardRenderer(); + + void Initialize(SkiaSurfaceProvider* provider, UiElementRenderer* renderer); + void Draw(const CameraModel& model, + const gfx::Transform& world_space_transform); + + private: + GLuint texture_handle_; + sk_sp<SkSurface> surface_; + gfx::Size drawn_size_; + UiElementRenderer* renderer_ = nullptr; + + DISALLOW_COPY_AND_ASSIGN(TestKeyboardRenderer); +}; + +} // namespace vr + +#endif // CHROME_BROWSER_VR_TESTAPP_TEST_KEYBOARD_RENDERER_H_
diff --git a/chrome/browser/vr/testapp/vr_test_context.cc b/chrome/browser/vr/testapp/vr_test_context.cc index 0e977af..322ae37 100644 --- a/chrome/browser/vr/testapp/vr_test_context.cc +++ b/chrome/browser/vr/testapp/vr_test_context.cc
@@ -11,12 +11,12 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/vr/controller_mesh.h" -#include "chrome/browser/vr/keyboard_delegate.h" #include "chrome/browser/vr/model/model.h" #include "chrome/browser/vr/model/omnibox_suggestions.h" #include "chrome/browser/vr/model/toolbar_state.h" #include "chrome/browser/vr/speech_recognizer.h" #include "chrome/browser/vr/test/constants.h" +#include "chrome/browser/vr/testapp/test_keyboard_delegate.h" #include "chrome/browser/vr/text_input_delegate.h" #include "chrome/browser/vr/ui.h" #include "chrome/browser/vr/ui_element_renderer.h" @@ -32,6 +32,7 @@ #include "ui/base/resource/resource_bundle.h" #include "ui/events/event.h" #include "ui/events/keycodes/dom/dom_code.h" +#include "ui/gfx/codec/png_codec.h" #include "ui/gfx/font_list.h" #include "ui/gfx/geometry/angle_conversions.h" @@ -58,31 +59,6 @@ } // namespace -// This stub delegate does nothing today, but can be expanded to offer -// legitimate keyboard support if required. -class TestKeyboardDelegate : KeyboardDelegate { - public: - // KeyboardDelegate implemenation. - void ShowKeyboard() override {} - void HideKeyboard() override {} - void SetTransform(const gfx::Transform&) override {} - bool HitTest(const gfx::Point3F& ray_origin, - const gfx::Point3F& ray_target, - gfx::Point3F* hit_position) override { - return false; - } - void Draw(const CameraModel&) override {} - - // Testapp-specific hooks. - void SetUiInterface(vr::KeyboardUiInterface* keyboard) { - keyboard_interface_ = keyboard; - } - void UpdateInput(const vr::TextInputInfo& info) {} - - private: - vr::KeyboardUiInterface* keyboard_interface_ = nullptr; -}; - VrTestContext::VrTestContext() : view_scale_factor_(kDefaultViewScaleFactor) { base::FilePath pak_path; PathService::Get(base::DIR_MODULE, &pak_path); @@ -94,11 +70,11 @@ // TODO(cjgrant): Remove this when the keyboard is enabled by default. base::FeatureList::InitializeInstance("VrBrowserKeyboard", ""); - text_input_delegate_ = base::MakeUnique<vr::TextInputDelegate>(); - keyboard_delegate_ = base::MakeUnique<vr::TestKeyboardDelegate>(); + text_input_delegate_ = base::MakeUnique<TextInputDelegate>(); + keyboard_delegate_ = base::MakeUnique<TestKeyboardDelegate>(); - ui_ = base::MakeUnique<Ui>(this, nullptr, nullptr, text_input_delegate_.get(), - UiInitialState()); + ui_ = base::MakeUnique<Ui>(this, nullptr, keyboard_delegate_.get(), + text_input_delegate_.get(), UiInitialState()); text_input_delegate_->SetRequestFocusCallback( base::BindRepeating(&vr::Ui::RequestFocus, base::Unretained(ui_.get()))); @@ -158,6 +134,9 @@ if (event->type() != ui::ET_KEY_PRESSED) { return; } + if (keyboard_delegate_->HandleInput(event)) { + return; + } switch (event->AsKeyEvent()->code()) { case ui::DomCode::ESCAPE: view_scale_factor_ = kDefaultViewScaleFactor; @@ -332,6 +311,9 @@ ui_->OnGlInitialized(content_texture_id, UiElementRenderer::kTextureLocationLocal, false); + keyboard_delegate_->Initialize(ui_->scene()->SurfaceProviderForTesting(), + ui_->ui_element_renderer()); + ui_->ui_element_renderer()->SetUpController( ControllerMesh::LoadFromResources()); } @@ -458,7 +440,6 @@ void VrTestContext::OnExitVrPromptResult(vr::ExitVrPromptChoice choice, vr::UiUnsupportedMode reason) { - LOG(ERROR) << "exit prompt result: " << choice; if (reason == UiUnsupportedMode::kVoiceSearchNeedsRecordAudioOsPermission && choice == CHOICE_EXIT) { voice_search_enabled_ = true;
diff --git a/chrome/browser/vr/text_input_unittest.cc b/chrome/browser/vr/text_input_unittest.cc index a97fbf7..b1a006c1 100644 --- a/chrome/browser/vr/text_input_unittest.cc +++ b/chrome/browser/vr/text_input_unittest.cc
@@ -78,7 +78,7 @@ base::MakeUnique<StrictMock<MockTextInputDelegate>>(); text_input_info_ = base::MakeUnique<TextInputInfo>(); auto text_input = UiSceneCreator::CreateTextInput( - 512, 1, model_, text_input_info_.get(), text_input_delegate_.get()); + 1, model_, text_input_info_.get(), text_input_delegate_.get()); text_input_ = text_input.get(); scene_->AddUiElement(k2dBrowsingForeground, std::move(text_input)); EXPECT_TRUE(OnBeginFrame()); @@ -167,7 +167,7 @@ UiScene scene; auto instance = - base::MakeUnique<TextInput>(512, 10, TextInput::OnFocusChangedCallback(), + base::MakeUnique<TextInput>(10, TextInput::OnFocusChangedCallback(), TextInput::OnInputEditedCallback()); instance->SetName(kOmniboxTextField); instance->SetSize(1, 0); @@ -190,7 +190,7 @@ UiScene scene; auto instance = - base::MakeUnique<TextInput>(512, 10, TextInput::OnFocusChangedCallback(), + base::MakeUnique<TextInput>(10, TextInput::OnFocusChangedCallback(), TextInput::OnInputEditedCallback()); instance->SetName(kOmniboxTextField); instance->SetSize(1, 0);
diff --git a/chrome/browser/vr/text_perftest.cc b/chrome/browser/vr/text_perftest.cc index b400f5ab..b36f48c 100644 --- a/chrome/browser/vr/text_perftest.cc +++ b/chrome/browser/vr/text_perftest.cc
@@ -19,7 +19,6 @@ namespace { -constexpr int kMaximumTextWidthPixels = 512; constexpr size_t kNumberOfRuns = 35; constexpr float kFontHeightMeters = 0.05f; constexpr float kTextWidthMeters = 1.0f; @@ -33,8 +32,7 @@ base::MakeUnique<GlTestEnvironment>(kPixelHalfScreen); provider_ = base::MakeUnique<GaneshSurfaceProvider>(); - text_element_ = - base::MakeUnique<Text>(kMaximumTextWidthPixels, kFontHeightMeters); + text_element_ = base::MakeUnique<Text>(kFontHeightMeters); text_element_->SetSize(kTextWidthMeters, 0); text_element_->Initialize(provider_.get()); }
diff --git a/chrome/browser/vr/ui_element_renderer.cc b/chrome/browser/vr/ui_element_renderer.cc index 8d4fe8e..1ede7fb 100644 --- a/chrome/browser/vr/ui_element_renderer.cc +++ b/chrome/browser/vr/ui_element_renderer.cc
@@ -53,7 +53,7 @@ const gfx::Transform& model_view_proj_matrix, const gfx::RectF& copy_rect, float opacity, - gfx::SizeF element_size, + const gfx::SizeF& element_size, float corner_radius) { // TODO(vollick): handle drawing this degenerate situation crbug.com/768922 if (corner_radius * 2.0 > element_size.width() || @@ -73,12 +73,11 @@ const SkColor edge_color, const SkColor center_color, float opacity, - gfx::SizeF element_size, - float corner_radius) { + const gfx::SizeF& element_size, + const CornerRadii& radii) { FlushIfNecessary(gradient_quad_renderer_.get()); gradient_quad_renderer_->Draw(model_view_proj_matrix, edge_color, - center_color, opacity, element_size, - corner_radius); + center_color, opacity, element_size, radii); } void UiElementRenderer::DrawGradientGridQuad(
diff --git a/chrome/browser/vr/ui_element_renderer.h b/chrome/browser/vr/ui_element_renderer.h index defd98f3..a48b8a8 100644 --- a/chrome/browser/vr/ui_element_renderer.h +++ b/chrome/browser/vr/ui_element_renderer.h
@@ -62,15 +62,15 @@ const gfx::Transform& model_view_proj_matrix, const gfx::RectF& copy_rect, float opacity, - gfx::SizeF element_size, + const gfx::SizeF& element_size, float corner_radius); VIRTUAL_FOR_MOCKS void DrawGradientQuad( const gfx::Transform& model_view_proj_matrix, const SkColor edge_color, const SkColor center_color, float opacity, - gfx::SizeF element_size, - float corner_radius); + const gfx::SizeF& element_size, + const CornerRadii& radii); VIRTUAL_FOR_MOCKS void DrawGradientGridQuad( const gfx::Transform& model_view_proj_matrix, const SkColor edge_color,
diff --git a/chrome/browser/vr/ui_input_manager_unittest.cc b/chrome/browser/vr/ui_input_manager_unittest.cc index 5ed7a12..4ae412d9 100644 --- a/chrome/browser/vr/ui_input_manager_unittest.cc +++ b/chrome/browser/vr/ui_input_manager_unittest.cc
@@ -58,8 +58,7 @@ class MockTextInput : public TextInput { public: MockTextInput() - : TextInput(512, - 1, + : TextInput(1, base::RepeatingCallback<void(bool)>(), base::RepeatingCallback<void(const TextInputInfo&)>()) {} ~MockTextInput() override = default;
diff --git a/chrome/browser/vr/ui_scene.cc b/chrome/browser/vr/ui_scene.cc index 573d2e9..0ea84e1 100644 --- a/chrome/browser/vr/ui_scene.cc +++ b/chrome/browser/vr/ui_scene.cc
@@ -24,52 +24,13 @@ namespace { -constexpr float kTolerance = 1e-5f; - -// Returns true if two elements are in the same plane. -bool ArePlanar(const UiElement& e1, const UiElement& e2) { - gfx::Vector3dF n1 = e1.GetNormal(); - gfx::Vector3dF n2 = e2.GetNormal(); - if (!base::IsApproximatelyEqual(n1.x(), n2.x(), kTolerance) || - !base::IsApproximatelyEqual(n1.y(), n2.y(), kTolerance) || - !base::IsApproximatelyEqual(n1.z(), n2.z(), kTolerance)) { - return false; - } - return base::IsApproximatelyEqual( - 0.0f, gfx::DotProduct(n1, e1.GetCenter() - e2.GetCenter()), kTolerance); -} - template <typename P> UiScene::Elements GetVisibleElements(UiElement* root, - UiElement* reticle_element, P predicate) { - Reticle* reticle = static_cast<Reticle*>(reticle_element); - UiElement* target = reticle ? reticle->TargetElement() : nullptr; UiScene::Elements elements; - int reticle_parent_id = 0; for (auto& element : *root) { - if (element.IsVisible() && predicate(&element)) { + if (element.IsVisible() && predicate(&element)) elements.push_back(&element); - if (target && target->id() == element.id()) { - reticle_parent_id = element.id(); - // Draw the reticle after the last child that resides in the same plane - // as this element. This way, the reticle can't be partially hidden as - // it passes across portions of a composite element. By walking the - // element's subtree in reverse pre-order, we start at the last-rendered - // child and work backwards, possibly as far as the originally targeted - // element. - for (auto& child : base::Reversed(element)) { - if (predicate(&child) && ArePlanar(element, child)) { - reticle_parent_id = child.id(); - break; - } - } - } - } - if (reticle_parent_id == element.id()) { - elements.push_back(reticle); - reticle->SetDrawPhase(element.draw_phase()); - } } return elements; } @@ -212,8 +173,7 @@ UiScene::Elements UiScene::GetVisible2dBrowsingElements() const { return GetVisibleElements( - GetUiElementByName(k2dBrowsingRoot), GetUiElementByName(kReticle), - [](UiElement* element) { + GetUiElementByName(k2dBrowsingRoot), [](UiElement* element) { return element->draw_phase() == kPhaseForeground || element->draw_phase() == kPhaseFloorCeiling || element->draw_phase() == kPhaseBackground; @@ -222,8 +182,7 @@ UiScene::Elements UiScene::GetVisible2dBrowsingOverlayElements() const { return GetVisibleElements( - GetUiElementByName(k2dBrowsingRoot), GetUiElementByName(kReticle), - [](UiElement* element) { + GetUiElementByName(k2dBrowsingRoot), [](UiElement* element) { return element->draw_phase() == kPhaseOverlayBackground || element->draw_phase() == kPhaseOverlayForeground; }); @@ -231,8 +190,7 @@ UiScene::Elements UiScene::GetVisibleSplashScreenElements() const { return GetVisibleElements( - GetUiElementByName(kSplashScreenRoot), GetUiElementByName(kReticle), - [](UiElement* element) { + GetUiElementByName(kSplashScreenRoot), [](UiElement* element) { return element->draw_phase() == kPhaseOverlayBackground || element->draw_phase() == kPhaseOverlayForeground; }); @@ -240,36 +198,20 @@ UiScene::Elements UiScene::GetVisibleWebVrOverlayForegroundElements() const { return GetVisibleElements( - GetUiElementByName(kWebVrRoot), GetUiElementByName(kReticle), - [](UiElement* element) { + GetUiElementByName(kWebVrRoot), [](UiElement* element) { return element->draw_phase() == kPhaseOverlayForeground; }); } UiScene::Elements UiScene::GetVisibleControllerElements() const { - return GetVisibleElements( - GetUiElementByName(kControllerGroup), nullptr, [](UiElement* element) { - if (element->name() == kReticle) { - Reticle* reticle = static_cast<Reticle*>(element); - // If the reticle has a non-null target element, - // it would have been positioned elsewhere. - bool need_to_add_reticle = !reticle->TargetElement(); - if (need_to_add_reticle) { - // We must always update the reticle's draw phase when it is - // included in a list of elements we vend. The other controller - // elements are drawn in the foreground phase, so we will update the - // reticle to match here. - reticle->SetDrawPhase(kPhaseForeground); - } - return need_to_add_reticle; - } - return element->draw_phase() == kPhaseForeground; - }); + return GetVisibleElements(GetUiElementByName(kControllerGroup), + [](UiElement* element) { + return element->draw_phase() == kPhaseForeground; + }); } UiScene::Elements UiScene::GetVisibleKeyboardElements() const { return GetVisibleElements(GetUiElementByName(kKeyboard), - GetUiElementByName(kReticle), [](UiElement* element) { return element->draw_phase() == kPhaseForeground; });
diff --git a/chrome/browser/vr/ui_scene.h b/chrome/browser/vr/ui_scene.h index 33a0773..d49378c 100644 --- a/chrome/browser/vr/ui_scene.h +++ b/chrome/browser/vr/ui_scene.h
@@ -75,6 +75,8 @@ void OnGlInitialized(SkiaSurfaceProvider* provider); + SkiaSurfaceProvider* SurfaceProviderForTesting() { return provider_; } + private: void InitializeElement(UiElement* element);
diff --git a/chrome/browser/vr/ui_scene_constants.h b/chrome/browser/vr/ui_scene_constants.h index 2ecbd80d..3fa7df53 100644 --- a/chrome/browser/vr/ui_scene_constants.h +++ b/chrome/browser/vr/ui_scene_constants.h
@@ -87,13 +87,9 @@ static constexpr int kToastTimeoutSeconds = kWebVrUrlToastTimeoutSeconds; static constexpr float kSplashScreenTextDistance = 2.5f; -static constexpr float kSplashScreenTextFontHeightM = - 0.05f * kSplashScreenTextDistance; -static constexpr float kSplashScreenTextWidthM = - 0.9f * kSplashScreenTextDistance; -static constexpr float kSplashScreenTextHeightM = - 0.08f * kSplashScreenTextDistance; -static constexpr float kSplashScreenTextVerticalOffset = -0.18f; +static constexpr float kSplashScreenTextFontHeightDMM = 0.05f; +static constexpr float kSplashScreenTextWidthDMM = 0.9f; +static constexpr float kSplashScreenTextVerticalOffsetDMM = -0.072f; static constexpr float kSplashScreenMinDurationSeconds = 3; static constexpr float kButtonDiameterDMM = 0.088f; @@ -152,8 +148,9 @@ static constexpr float kSpinnerWidth = kCloseButtonWidth; static constexpr float kSpinnerHeight = kCloseButtonHeight; -static constexpr float kSpinnerVerticalOffset = kSplashScreenTextVerticalOffset; static constexpr float kSpinnerDistance = kSplashScreenTextDistance; +static constexpr float kSpinnerVerticalOffset = + kSplashScreenTextVerticalOffsetDMM * kSpinnerDistance; static constexpr float kTimeoutMessageHorizontalPaddingDMM = 0.04f; static constexpr float kTimeoutMessageVerticalPaddingDMM = 0.024f;
diff --git a/chrome/browser/vr/ui_scene_creator.cc b/chrome/browser/vr/ui_scene_creator.cc index 4b1ebb3..216af244 100644 --- a/chrome/browser/vr/ui_scene_creator.cc +++ b/chrome/browser/vr/ui_scene_creator.cc
@@ -14,6 +14,7 @@ #include "chrome/browser/vr/elements/button.h" #include "chrome/browser/vr/elements/content_element.h" #include "chrome/browser/vr/elements/controller.h" +#include "chrome/browser/vr/elements/disc_button.h" #include "chrome/browser/vr/elements/draw_phase.h" #include "chrome/browser/vr/elements/exit_prompt.h" #include "chrome/browser/vr/elements/full_screen_rect.h" @@ -27,7 +28,6 @@ #include "chrome/browser/vr/elements/scaled_depth_adjuster.h" #include "chrome/browser/vr/elements/simple_textured_element.h" #include "chrome/browser/vr/elements/spinner.h" -#include "chrome/browser/vr/elements/suggestion.h" #include "chrome/browser/vr/elements/text.h" #include "chrome/browser/vr/elements/text_input.h" #include "chrome/browser/vr/elements/throbber.h" @@ -76,7 +76,15 @@ base::Unretained(view), setter))); } -typedef VectorBinding<OmniboxSuggestion, Suggestion> SuggestionSetBinding; +template <typename T, typename... Args> +std::unique_ptr<T> Create(UiElementName name, DrawPhase phase, Args&&... args) { + auto element = base::MakeUnique<T>(std::forward<Args>(args)...); + element->SetName(name); + element->SetDrawPhase(phase); + return element; +} + +typedef VectorBinding<OmniboxSuggestion, Button> SuggestionSetBinding; typedef typename SuggestionSetBinding::ElementBinding SuggestionBinding; void OnSuggestionModelAdded(UiScene* scene, @@ -98,26 +106,25 @@ icon_box->SetSize(kSuggestionIconFieldWidthDMM, kSuggestionHeightDMM); icon_box->AddChild(std::move(icon)); - auto content_text = - base::MakeUnique<Text>(1024, kSuggestionContentTextHeightDMM); + auto content_text = base::MakeUnique<Text>(kSuggestionContentTextHeightDMM); content_text->SetDrawPhase(kPhaseForeground); content_text->SetType(kTypeOmniboxSuggestionContentText); content_text->set_hit_testable(false); + content_text->SetTextLayoutMode(TextLayoutMode::kSingleLineFixedWidth); content_text->SetSize(kSuggestionTextFieldWidthDMM, 0); content_text->SetTextAlignment(UiTexture::kTextAlignmentLeft); - content_text->SetMultiLine(false); BindColor(model, content_text.get(), &ColorScheme::omnibox_suggestion_content, &Text::SetColor); Text* p_content_text = content_text.get(); auto description_text = - base::MakeUnique<Text>(1024, kSuggestionDescriptionTextHeightDMM); + base::MakeUnique<Text>(kSuggestionDescriptionTextHeightDMM); description_text->SetDrawPhase(kPhaseForeground); description_text->SetType(kTypeOmniboxSuggestionDescriptionText); description_text->set_hit_testable(false); + content_text->SetTextLayoutMode(TextLayoutMode::kSingleLineFixedWidth); description_text->SetSize(kSuggestionTextFieldWidthDMM, 0); description_text->SetTextAlignment(UiTexture::kTextAlignmentLeft); - description_text->SetMultiLine(false); BindColor(model, description_text.get(), &ColorScheme::omnibox_suggestion_description, &Text::SetColor); Text* p_description_text = description_text.get(); @@ -140,42 +147,50 @@ suggestion_layout->AddChild(std::move(text_layout)); suggestion_layout->AddChild(std::move(right_margin)); - auto background = base::MakeUnique<Rect>(); + auto background = Create<Button>( + kNone, kPhaseForeground, + base::BindRepeating( + [](UiBrowserInterface* b, Model* m, SuggestionBinding* e) { + b->Navigate(e->model()->destination); + // TODO(vollick): set this as a side effect of navigating. + m->omnibox_input_active = false; + }, + base::Unretained(browser), base::Unretained(model), + base::Unretained(element_binding))); + background->SetType(kTypeOmniboxSuggestionBackground); - background->SetDrawPhase(kPhaseForeground); background->set_hit_testable(true); background->set_bubble_events(true); background->set_bounds_contain_children(true); - background->SetColor(SK_ColorGREEN); + background->set_hover_offset(0.0); + BindButtonColors(model, background.get(), + &ColorScheme::suggestion_button_colors, + &Button::SetButtonColors); background->AddChild(std::move(suggestion_layout)); - BindColor(model, background.get(), &ColorScheme::omnibox_background, - &Rect::SetColor); - - auto suggestion = base::MakeUnique<Suggestion>(base::Bind( - [](UiBrowserInterface* browser, Model* m, GURL gurl) { - browser->Navigate(gurl); - m->omnibox_input_active = false; - }, - base::Unretained(browser), base::Unretained(model))); - suggestion->set_bounds_contain_children(true); - suggestion->AddChild(std::move(background)); element_binding->bindings().push_back( VR_BIND_FUNC(base::string16, SuggestionBinding, element_binding, model()->content, Text, p_content_text, SetText)); element_binding->bindings().push_back( - VR_BIND_FUNC(base::string16, SuggestionBinding, element_binding, - model()->description, Text, p_description_text, SetText)); + base::MakeUnique<Binding<base::string16>>( + base::BindRepeating( + [](SuggestionBinding* m) { return m->model()->description; }, + base::Unretained(element_binding)), + base::BindRepeating( + [](Text* v, const base::string16& text) { + v->SetVisibleImmediately(!text.empty()); + v->set_requires_layout(!text.empty()); + if (!text.empty()) { + v->SetText(text); + } + }, + base::Unretained(p_description_text)))); element_binding->bindings().push_back( VR_BIND(AutocompleteMatch::Type, SuggestionBinding, element_binding, model()->type, VectorIcon, p_icon, SetIcon(AutocompleteMatch::TypeToVectorIcon(value)))); - element_binding->bindings().push_back(VR_BIND_FUNC( - GURL, SuggestionBinding, element_binding, model()->destination, - Suggestion, suggestion.get(), set_destination)); - - element_binding->set_view(suggestion.get()); - scene->AddUiElement(kOmniboxSuggestions, std::move(suggestion)); + element_binding->set_view(background.get()); + scene->AddUiElement(kOmniboxSuggestions, std::move(background)); } void OnSuggestionModelRemoved(UiScene* scene, SuggestionBinding* binding) { @@ -199,14 +214,6 @@ return to_return; } -template <typename T, typename... Args> -std::unique_ptr<T> Create(UiElementName name, DrawPhase phase, Args&&... args) { - auto element = base::MakeUnique<T>(std::forward<Args>(args)...); - element->SetName(name); - element->SetDrawPhase(phase); - return element; -} - } // namespace UiSceneCreator::UiSceneCreator(UiBrowserInterface* browser, @@ -331,14 +338,12 @@ // Create transient exit warning. auto scaler = base::MakeUnique<ScaledDepthAdjuster>(kExitWarningDistance); - auto exit_warning_text = - base::MakeUnique<Text>(1024, kExitWarningFontHeightDMM); + auto exit_warning_text = base::MakeUnique<Text>(kExitWarningFontHeightDMM); exit_warning_text->SetName(kExitWarningText); exit_warning_text->SetDrawPhase(kPhaseOverlayForeground); exit_warning_text->SetText( l10n_util::GetStringUTF16(IDS_VR_BROWSER_UNSUPPORTED_PAGE)); exit_warning_text->SetSize(kExitWarningTextWidthDMM, 0); - exit_warning_text->SetMultiLine(true); exit_warning_text->SetVisible(true); exit_warning_text->set_hit_testable(false); BindColor(model_, exit_warning_text.get(), @@ -508,17 +513,19 @@ std::move(transient_parent)); // Add "Powered by Chrome" text. - auto text = base::MakeUnique<Text>(512, kSplashScreenTextFontHeightM); + auto text_scaler = + base::MakeUnique<ScaledDepthAdjuster>(kSplashScreenTextDistance); + auto text = base::MakeUnique<Text>(kSplashScreenTextFontHeightDMM); BindColor(model_, text.get(), &ColorScheme::splash_screen_text_color, &Text::SetColor); text->SetText(l10n_util::GetStringUTF16(IDS_VR_POWERED_BY_CHROME_MESSAGE)); text->SetName(kSplashScreenText); text->SetDrawPhase(kPhaseOverlayForeground); text->set_hit_testable(false); - text->SetSize(kSplashScreenTextWidthM, kSplashScreenTextHeightM); - text->SetTranslate(0, kSplashScreenTextVerticalOffset, - -kSplashScreenTextDistance); - scene_->AddUiElement(kSplashScreenTransientParent, std::move(text)); + text->SetSize(kSplashScreenTextWidthDMM, 0); + text->SetTranslate(0, kSplashScreenTextVerticalOffsetDMM, 0); + text_scaler->AddChild(std::move(text)); + scene_->AddUiElement(kSplashScreenTransientParent, std::move(text_scaler)); // Add splash screen background. auto bg = base::MakeUnique<FullScreenRect>(); @@ -585,7 +592,7 @@ kTimeoutMessageIconHeightDMM); auto timeout_text = - Create<Text>(kWebVrTimeoutMessageText, kPhaseOverlayForeground, 512, + Create<Text>(kWebVrTimeoutMessageText, kPhaseOverlayForeground, kTimeoutMessageTextFontHeightDMM); timeout_text->SetText( l10n_util::GetStringUTF16(IDS_VR_WEB_VR_TIMEOUT_MESSAGE)); @@ -597,7 +604,7 @@ auto button_scaler = base::MakeUnique<ScaledDepthAdjuster>(kTimeoutButtonDepthOffset); - auto button = Create<Button>( + auto button = Create<DiscButton>( kWebVrTimeoutMessageButton, kPhaseOverlayForeground, base::Bind(&UiBrowserInterface::ExitPresent, base::Unretained(browser_)), vector_icons::kClose16Icon); @@ -609,12 +616,12 @@ kWebVrTimeoutMessageButtonDiameterDMM); button->AddBinding(VR_BIND_FUNC(bool, Model, model_, web_vr_timeout_state == kWebVrTimedOut, - Button, button.get(), SetVisible)); + DiscButton, button.get(), SetVisible)); BindButtonColors(model_, button.get(), &ColorScheme::button_colors, - &Button::SetButtonColors); + &DiscButton::SetButtonColors); auto timeout_button_text = - Create<Text>(kWebVrTimeoutMessageButtonText, kPhaseOverlayForeground, 512, + Create<Text>(kWebVrTimeoutMessageButtonText, kPhaseOverlayForeground, kTimeoutMessageTextFontHeightDMM); // Disk-style button text is not uppercase. See crbug.com/787654. @@ -637,7 +644,7 @@ } void UiSceneCreator::CreateUnderDevelopmentNotice() { - auto text = base::MakeUnique<Text>(512, kUnderDevelopmentNoticeFontHeightDMM); + auto text = base::MakeUnique<Text>(kUnderDevelopmentNoticeFontHeightDMM); BindColor(model_, text.get(), &ColorScheme::world_background_text, &Text::SetColor); text->SetText(l10n_util::GetStringUTF16(IDS_VR_UNDER_DEVELOPMENT_NOTICE)); @@ -733,11 +740,11 @@ } void UiSceneCreator::CreateVoiceSearchUiGroup() { - auto voice_search_button = - Create<Button>(kVoiceSearchButton, kPhaseForeground, - base::Bind(&UiBrowserInterface::SetVoiceSearchActive, - base::Unretained(browser_), true), - vector_icons::kMicrophoneIcon); + auto voice_search_button = Create<DiscButton>( + kVoiceSearchButton, kPhaseForeground, + base::BindRepeating(&UiBrowserInterface::SetVoiceSearchActive, + base::Unretained(browser_), true), + vector_icons::kMicrophoneIcon); voice_search_button->SetSize(kVoiceSearchButtonDiameterDMM, kVoiceSearchButtonDiameterDMM); voice_search_button->set_hover_offset(kButtonZOffsetHoverDMM); @@ -754,7 +761,7 @@ base::Bind([](UiElement* e, const bool& v) { e->SetVisible(v); }, voice_search_button.get()))); BindButtonColors(model_, voice_search_button.get(), - &ColorScheme::button_colors, &Button::SetButtonColors); + &ColorScheme::button_colors, &DiscButton::SetButtonColors); scene_->AddUiElement(kUrlBar, std::move(voice_search_button)); auto speech_recognition_root = base::MakeUnique<UiElement>(); @@ -788,7 +795,7 @@ }, speech_result_parent))); auto speech_result = - base::MakeUnique<Text>(256, kVoiceSearchRecognitionResultTextHeight); + base::MakeUnique<Text>(kVoiceSearchRecognitionResultTextHeight); speech_result->SetName(kSpeechRecognitionResultText); speech_result->SetDrawPhase(kPhaseForeground); speech_result->SetTranslate(0.f, kSpeechRecognitionResultTextYOffset, 0.f); @@ -890,17 +897,17 @@ microphone_icon->SetSize(kCloseButtonWidth, kCloseButtonHeight); scene_->AddUiElement(kSpeechRecognitionListening, std::move(microphone_icon)); - auto close_button = - Create<Button>(kSpeechRecognitionListeningCloseButton, kPhaseForeground, - base::Bind(&UiBrowserInterface::SetVoiceSearchActive, - base::Unretained(browser_), false), - vector_icons::kClose16Icon); + auto close_button = Create<DiscButton>( + kSpeechRecognitionListeningCloseButton, kPhaseForeground, + base::BindRepeating(&UiBrowserInterface::SetVoiceSearchActive, + base::Unretained(browser_), false), + vector_icons::kClose16Icon); close_button->SetSize(kVoiceSearchCloseButtonWidth, kVoiceSearchCloseButtonHeight); close_button->set_hover_offset(kButtonZOffsetHoverDMM * kContentDistance); close_button->SetTranslate(0.0, -kVoiceSearchCloseButtonYOffset, 0.f); BindButtonColors(model_, close_button.get(), &ColorScheme::button_colors, - &Button::SetButtonColors); + &DiscButton::SetButtonColors); scene_->AddUiElement(kSpeechRecognitionListening, std::move(close_button)); UiElement* browser_foregroud = @@ -982,13 +989,12 @@ } std::unique_ptr<TextInput> UiSceneCreator::CreateTextInput( - int maximum_width_pixels, float font_height_meters, Model* model, TextInputInfo* text_input_model, TextInputDelegate* text_input_delegate) { auto text_input = base::MakeUnique<TextInput>( - maximum_width_pixels, font_height_meters, + font_height_meters, base::BindRepeating( [](Model* model, bool focused) { model->editing_input = focused; }, base::Unretained(model)), @@ -1141,11 +1147,13 @@ e->SetTranslate(0, y_offset, 0); }, omnibox_container.get()))); + BindColor(model_, omnibox_container.get(), &ColorScheme::omnibox_background, + &Rect::SetColor); scene_->AddUiElement(kOmniboxRoot, std::move(omnibox_container)); float width = kOmniboxWidthDMM - 2 * kOmniboxTextMarginDMM; auto omnibox_text_field = - CreateTextInput(1024, kOmniboxTextHeightDMM, model_, + CreateTextInput(kOmniboxTextHeightDMM, model_, &model_->omnibox_text_field_info, text_input_delegate_); omnibox_text_field->set_input_committed_callback(base::BindRepeating( [](Model* model, UiBrowserInterface* browser, const TextInputInfo& text) { @@ -1225,18 +1233,18 @@ scene_->AddUiElement(kOmniboxContainer, std::move(suggestions_layout)); - auto close_button = Create<Button>( + auto close_button = Create<DiscButton>( kOmniboxCloseButton, kPhaseForeground, base::BindRepeating([](Model* m) { m->omnibox_input_active = false; }, base::Unretained(model_)), - vector_icons::kClose16Icon); + vector_icons::kBackArrowIcon); close_button->SetSize(kOmniboxCloseButtonDiameterDMM, kOmniboxCloseButtonDiameterDMM); close_button->SetTranslate(0, kOmniboxCloseButtonVerticalOffsetDMM, 0); close_button->SetRotate(1, 0, 0, atan(kOmniboxCloseButtonVerticalOffsetDMM)); close_button->set_hover_offset(kButtonZOffsetHoverDMM); BindButtonColors(model_, close_button.get(), &ColorScheme::button_colors, - &Button::SetButtonColors); + &DiscButton::SetButtonColors); scene_->AddUiElement(kOmniboxRoot, std::move(close_button)); } @@ -1284,14 +1292,14 @@ } }, base::Unretained(model_), base::Unretained(browser_)); - std::unique_ptr<Button> element = - Create<Button>(kCloseButton, kPhaseForeground, click_handler, - vector_icons::kClose16Icon); + std::unique_ptr<DiscButton> element = + Create<DiscButton>(kCloseButton, kPhaseForeground, click_handler, + vector_icons::kClose16Icon); element->SetSize(kCloseButtonWidth, kCloseButtonHeight); element->set_hover_offset(kButtonZOffsetHoverDMM * kCloseButtonDistance); element->SetTranslate(0, kCloseButtonVerticalOffset, -kCloseButtonDistance); BindButtonColors(model_, element.get(), &ColorScheme::button_colors, - &Button::SetButtonColors); + &DiscButton::SetButtonColors); // Close button is a special control element that needs to be hidden when // in WebVR, but it needs to be visible when in cct or fullscreen. @@ -1406,9 +1414,8 @@ UiElement, backplane.get(), SetVisible)); std::unique_ptr<Shadow> shadow = base::MakeUnique<Shadow>(); - shadow->SetDrawPhase(kPhaseForeground); shadow->SetName(kAudioPermissionPromptShadow); - shadow->set_corner_radius(kContentCornerRadius); + shadow->SetDrawPhase(kPhaseForeground); std::unique_ptr<AudioPermissionPrompt> prompt = base::MakeUnique<AudioPermissionPrompt>(
diff --git a/chrome/browser/vr/ui_scene_creator.h b/chrome/browser/vr/ui_scene_creator.h index de5dd7a1..2ad517e 100644 --- a/chrome/browser/vr/ui_scene_creator.h +++ b/chrome/browser/vr/ui_scene_creator.h
@@ -31,7 +31,6 @@ void CreateScene(); static std::unique_ptr<TextInput> CreateTextInput( - int maximum_width_pixels, float font_height_meters, Model* model, TextInputInfo* text_input_model,
diff --git a/chrome/browser/vr/ui_unittest.cc b/chrome/browser/vr/ui_unittest.cc index 84d97b77..4be7ed6d 100644 --- a/chrome/browser/vr/ui_unittest.cc +++ b/chrome/browser/vr/ui_unittest.cc
@@ -11,6 +11,7 @@ #include "base/strings/utf_string_conversions.h" #include "chrome/browser/vr/elements/button.h" #include "chrome/browser/vr/elements/content_element.h" +#include "chrome/browser/vr/elements/disc_button.h" #include "chrome/browser/vr/elements/exit_prompt.h" #include "chrome/browser/vr/elements/rect.h" #include "chrome/browser/vr/elements/ui_element.h" @@ -164,7 +165,7 @@ base::IsApproximatelyEqual(arg.height(), other.height(), tolerance); } -void VerifyButtonColor(Button* button, +void VerifyButtonColor(DiscButton* button, SkColor foreground_color, SkColor background_color, const std::string& trace_name) { @@ -909,6 +910,7 @@ UiElement* suggestion = suggestions->children().front().get(); ASSERT_NE(suggestion, nullptr); EXPECT_CALL(*browser_, Navigate(gurl)).Times(1); + suggestion->OnHoverEnter({0, 0}); suggestion->OnButtonDown({0, 0}); suggestion->OnButtonUp({0, 0}); } @@ -941,8 +943,8 @@ TEST_F(UiTest, CloseButtonColorBindings) { CreateScene(kInCct, kNotInWebVr); EXPECT_TRUE(IsVisible(kCloseButton)); - Button* button = - static_cast<Button*>(scene_->GetUiElementByName(kCloseButton)); + DiscButton* button = + static_cast<DiscButton*>(scene_->GetUiElementByName(kCloseButton)); for (int i = 0; i < ColorScheme::kNumModes; i++) { ColorScheme::Mode mode = static_cast<ColorScheme::Mode>(i); SCOPED_TRACE(mode); @@ -997,44 +999,6 @@ ui_->OnAppButtonClicked(); } -TEST(UiReticleTest, ReticleRenderedOnPlanarChildren) { - UiScene scene; - Model model; - - auto reticle = base::MakeUnique<Reticle>(&scene, &model); - reticle->SetDrawPhase(kPhaseNone); - scene.root_element().AddChild(std::move(reticle)); - - auto element = base::MakeUnique<UiElement>(); - UiElement* parent = element.get(); - parent->SetDrawPhase(kPhaseForeground); - parent->SetName(k2dBrowsingRoot); - scene.root_element().AddChild(std::move(element)); - model.reticle.target_element_id = parent->id(); - - // Add 4 children to the parent: - // - Parent (hit element, initially having reticle) - // - Planar - // - Planar but offset (should receive reticle) - // - Parallel - // - Rotated - for (int i = 0; i < 4; i++) { - element = base::MakeUnique<UiElement>(); - element->SetDrawPhase(kPhaseForeground); - parent->AddChild(std::move(element)); - } - parent->children()[1]->SetTranslate(1, 0, 0); - parent->children()[2]->SetTranslate(0, 0, -1); - parent->children()[3]->SetRotate(1, 0, 0, 1); - scene.OnBeginFrame(MsToTicks(0), kForwardVector); - - // Sorted set should have 1 parent, 4 children and 1 reticle. - UiScene::Elements sorted = scene.GetVisible2dBrowsingElements(); - EXPECT_EQ(6u, sorted.size()); - // Reticle should be after the parent and first two children. - EXPECT_EQ(sorted[3]->name(), kReticle); -} - // This test ensures that the render order matches the expected tree state. All // phases are merged, as the order is the same. Unnamed and unrenderable // elements are skipped. @@ -1048,79 +1012,6 @@ } } -TEST_F(UiTest, ReticleStacking) { - CreateScene(kNotInCct, kNotInWebVr); - UiElement* content = scene_->GetUiElementByName(kContentQuad); - EXPECT_TRUE(content); - model_->reticle.target_element_id = content->id(); - auto unsorted = scene_->GetVisible2dBrowsingElements(); - auto sorted = UiRenderer::GetElementsInDrawOrder(unsorted); - bool saw_target = false; - for (auto* e : sorted) { - if (e == content) { - saw_target = true; - } else if (saw_target) { - EXPECT_EQ(kReticle, e->name()); - break; - } - } - - EXPECT_TRUE(saw_target); - - auto controller_elements = scene_->GetVisibleControllerElements(); - bool saw_reticle = false; - for (auto* e : controller_elements) { - if (e->name() == kReticle) { - saw_reticle = true; - } - } - EXPECT_FALSE(saw_reticle); -} - -TEST_F(UiTest, ReticleStackingAtopForeground) { - CreateScene(kNotInCct, kNotInWebVr); - UiElement* element = scene_->GetUiElementByName(kContentQuad); - EXPECT_TRUE(element); - element->SetDrawPhase(kPhaseOverlayForeground); - model_->reticle.target_element_id = element->id(); - auto unsorted = scene_->GetVisible2dBrowsingOverlayElements(); - auto sorted = UiRenderer::GetElementsInDrawOrder(unsorted); - bool saw_target = false; - for (auto* e : sorted) { - if (e == element) { - saw_target = true; - } else if (saw_target) { - EXPECT_EQ(kReticle, e->name()); - break; - } - } - EXPECT_TRUE(saw_target); - - auto controller_elements = scene_->GetVisibleControllerElements(); - bool saw_reticle = false; - for (auto* e : controller_elements) { - if (e->name() == kReticle) { - saw_reticle = true; - } - } - EXPECT_FALSE(saw_reticle); -} - -TEST_F(UiTest, ReticleStackingWithControllerElements) { - CreateScene(kNotInCct, kNotInWebVr); - UiElement* element = scene_->GetUiElementByName(kReticle); - EXPECT_TRUE(element); - element->SetDrawPhase(kPhaseBackground); - EXPECT_NE(scene_->GetUiElementByName(kLaser)->draw_phase(), - element->draw_phase()); - model_->reticle.target_element_id = 0; - auto unsorted = scene_->GetVisibleControllerElements(); - auto sorted = UiRenderer::GetElementsInDrawOrder(unsorted); - EXPECT_EQ(element->DebugName(), sorted.back()->DebugName()); - EXPECT_EQ(scene_->GetUiElementByName(kLaser)->draw_phase(), - element->draw_phase()); -} - // Tests that transient elements will show, even if there is a long delay // between when they are asked to appear and when we issue the first frame with // them visible.
diff --git a/chrome/browser/vr/webvr_transition_browser_test.cc b/chrome/browser/vr/webvr_transition_browser_test.cc new file mode 100644 index 0000000..b86684b --- /dev/null +++ b/chrome/browser/vr/webvr_transition_browser_test.cc
@@ -0,0 +1,27 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/vr/test/vr_browser_test.h" +#include "chrome/browser/vr/test/vr_transition_utils.h" +#include "content/public/test/browser_test_utils.h" + +// Browser test equivalent of +// chrome/android/javatests/src/.../browser/vr_shell/WebVrTransitionTest.java. +// End-to-end tests for transitioning between WebVR's magic window and +// presentation modes. + +namespace vr { + +// Tests that a successful requestPresent call actually enters VR +IN_PROC_BROWSER_TEST_F(VrBrowserTest, REQUIRES_GPU(TestPresentation)) { + LoadUrlAndAwaitInitialization( + GetHtmlTestFile("test_requestPresent_enters_vr")); + enterPresentationAndWait(GetFirstTabWebContents()); + EXPECT_TRUE(RunJavaScriptAndExtractBoolOrFail("vrDisplay.isPresenting", + GetFirstTabWebContents())) + << "Was not presenting after requestPresent"; + EndTest(GetFirstTabWebContents()); +} + +} // namespace vr
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index 8d5dd20..d1ad56b 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc
@@ -810,6 +810,14 @@ // Disables apps on the login screen. By default, they are allowed and can be // installed through policy. const char kDisableLoginScreenApps[] = "disable-login-screen-apps"; + +// Enables out-of-process ash and mus (ui service). See //ash/README.md +const char kMash[] = "mash"; + +// Provides the name of the mojo service running in a mash utility process. +// NOTE: Used by the Chrome OS crash_reporter to identify mash processes. If you +// change or remove the flag please update platform2/crash_reporter. +const char kMashServiceName[] = "mash-service-name"; #endif // defined(OS_CHROMEOS) #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_CHROMEOS) @@ -955,16 +963,6 @@ const char kWindows10CustomTitlebar[] = "windows10-custom-titlebar"; #endif // defined(OS_WIN) -#if BUILDFLAG(ENABLE_MUS) -// Enables Mus+ash (out-of-process ash and mus). See //ash/README.md -const char kMash[] = "mash"; - -// Provides the name of the mojo service running in a mash utility process. -// NOTE: Used by the Chrome OS crash_reporter to identify mash processes. If you -// change or remove the flag please update platform2/crash_reporter. -const char kMashServiceName[] = "mash-service-name"; -#endif - #if BUILDFLAG(ENABLE_PRINT_PREVIEW) && !defined(OFFICIAL_BUILD) // Enables support to debug printing subsystem. const char kDebugPrint[] = "debug-print";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index bcf7d1d2..948a98c 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h
@@ -249,6 +249,8 @@ extern const char kCroshCommand[]; extern const char kDisableLoggingRedirect[]; extern const char kDisableLoginScreenApps[]; +extern const char kMash[]; +extern const char kMashServiceName[]; #endif // defined(OS_CHROMEOS) #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_CHROMEOS) @@ -296,12 +298,6 @@ extern const char kWindows10CustomTitlebar[]; #endif // defined(OS_WIN) -#if BUILDFLAG(ENABLE_MUS) -extern const char kMash[]; -extern const char kMashServiceName[]; -extern const char kMus[]; -#endif - #if BUILDFLAG(ENABLE_PRINT_PREVIEW) && !defined(OFFICIAL_BUILD) extern const char kDebugPrint[]; #endif
diff --git a/chrome/common/crash_keys.cc b/chrome/common/crash_keys.cc index e0343e9a..9f8d130 100644 --- a/chrome/common/crash_keys.cc +++ b/chrome/common/crash_keys.cc
@@ -37,9 +37,6 @@ const char kViewCount[] = "view-count"; -const char kUserCloudPolicyManagerConnectTrace[] = - "user-cloud-policy-manager-connect-trace"; - size_t RegisterChromeCrashKeys() { // The following keys may be chunked by the underlying crash logging system, // but ultimately constitute a single key-value pair. @@ -65,9 +62,6 @@ {kViewCount, kSmallSize}, - // Temporary for https://crbug.com/685996. - {kUserCloudPolicyManagerConnectTrace, kMediumSize}, - // TODO(sunnyps): Remove after fixing crbug.com/724999. {"gl-context-set-current-stack-trace", kMediumSize}, };
diff --git a/chrome/common/crash_keys.h b/chrome/common/crash_keys.h index 6d05785..90837a0d8 100644 --- a/chrome/common/crash_keys.h +++ b/chrome/common/crash_keys.h
@@ -80,11 +80,6 @@ // Numbers of active views. extern const char kViewCount[]; -// TEMPORARY: Stack trace for the previous call of the -// UserCloudPolicyManager::Connect() method. The value is set when we trigger a -// browser crash due to an attempt to connect twice. https://crbug.com/685996. -extern const char kUserCloudPolicyManagerConnectTrace[]; - } // namespace crash_keys #endif // CHROME_COMMON_CRASH_KEYS_H_
diff --git a/chrome/common/extensions/api/developer_private.idl b/chrome/common/extensions/api/developer_private.idl index 720c32c..80ccc55 100644 --- a/chrome/common/extensions/api/developer_private.idl +++ b/chrome/common/extensions/api/developer_private.idl
@@ -207,6 +207,7 @@ Location location; DOMString? locationText; ManifestError[] manifestErrors; + DOMString manifestHomePageUrl; boolean mustRemainInstalled; DOMString name; boolean offlineEnabled; @@ -223,6 +224,7 @@ boolean userMayModify; DOMString version; ExtensionView[] views; + DOMString webStoreUrl; }; dictionary ProfileInfo { @@ -320,6 +322,11 @@ // associated with the identifier will be loaded, and the file chooser // will be skipped. DOMString? retryGuid; + + // True if the function should try to load an extension from the drop data + // of the page. notifyDragInstallInProgress() needs to be called prior to + // this being used. This cannot be used with |retryGuid|. + boolean? useDraggedPath; }; enum PackStatus { @@ -490,6 +497,7 @@ callback RequestFileSourceCallback = void (RequestFileSourceResponse response); callback LoadErrorCallback = void (optional LoadError error); + callback DragInstallInProgressCallback = void (DOMString loadGuid); interface Functions { // Runs auto update for extensions and apps immediately. @@ -551,6 +559,10 @@ static void loadUnpacked(optional LoadUnpackedOptions options, optional LoadErrorCallback callback); + // Notifies the browser that a user began a drag in order to install an + // extension. + static void notifyDragInstallInProgress(); + // Loads an extension / app. // |directory| : The directory to load the extension from. static void loadDirectory( @@ -588,7 +600,7 @@ static void openDevTools(OpenDevToolsProperties properties, optional VoidCallback callback); - // Delete reported extension erors. + // Delete reported extension errors. // |properties| : The properties specifying the errors to remove. static void deleteExtensionErrors( DeleteExtensionErrorsProperties properties,
diff --git a/chrome/common/extensions/docs/templates/articles/hosting.html b/chrome/common/extensions/docs/templates/articles/hosting.html index ac80368..800560e 100644 --- a/chrome/common/extensions/docs/templates/articles/hosting.html +++ b/chrome/common/extensions/docs/templates/articles/hosting.html
@@ -1,97 +1,71 @@ -<h1>Hosting</h1> +<h1>Hosting and Updating</h1> -<p class="warning"><b>Warning:</b> -As of Chrome 33, -Windows users can only download extensions -hosted in the Chrome Web store, -except for installs via -<a href="https://support.google.com/chrome/a/answer/188453">enterprise policy</a> -or -<a href="getstarted#unpacked">developer mode</a> - (see - <a href="http://blog.chromium.org/2013/11/protecting-windows-users-from-malicious.html">Protecting Windows users from malicious extensions</a>). -As of Chrome 44, no external installs are allowed from a path to a local .crx on Mac -(see -<a href="http://blog.chromium.org/2015/05/continuing-to-protect-chrome-users-from.html">Continuing to protect Chrome users from malicious extensions</a>). +<h2 id="hosting">Hosting</h2> + +<p> + Extensions must be uploaded through the + <a href="https://chrome.google.com/webstore/developer/dashboard"> + Developer Dashboard</a> + and are + <a href="/webstore">distributed</a> in the + <a href="https://chrome.google.com/webstore/category/extensions"> + Chrome Web Store</a> to + <a href="http://blog.chromium.org/2015/05/continuing-to-protect-chrome-users-from.html"> + protect users from malicious extensions</a>. + Allow users to add an extension through the web store + from a designated website by enabling + <a href="/webstore/inline_installation">inline installation</a>. </p> <p> -This page tells you how to host <code>.crx</code> files -on your own server. -If you distribute your extension, app, or theme solely through the -<a href="http://chrome.google.com/webstore">Chrome Web Store</a>, -you don't need this page. -Instead, consult the <a href="/webstore">store developer documentation</a>. + There are three exceptions to the Chrome Web Store hosting rule: + <ol> + <li>Extensions that are distributed through the + <a href="https://support.google.com/chrome/a/answer/188453"> + enterprise policy</a>.</li> + <li>Unpacked extension directories from a local machine while in + <a href="getstarted#unpacked">developer mode</a>.</li> + <li><a href="/linux_hosting">Hosting for Linux</a> installations.</li> + </ol> </p> <p> -By convention, extensions, -installable web apps, and themes are served—whether -by the Chrome Web Store or by a custom server—as -<code>.crx</code> files. -When you upload a ZIP file with the -<a href="https://chrome.google.com/webstore/developer/dashboard">Chrome Developer Dashboard</a>, -the dashboard creates the <code>.crx</code> file for you. + <a href="/hosting_changes">Read more about the hosting policy</a>. +</p> +<h2 id="updating">Updating</h2> + +<p> + Extensions are automatically updated without user intervention, + just like the Chrome Browser. </p> <p> -If you aren't publishing using the dashboard, -you need to create the <code>.crx</code> file yourself, -as described in <a href="packaging">Packaging</a>. -You can also specify -<a href="autoupdate">autoupdate</a> information to ensure that -your users will have the latest copy of the <code>.crx</code> file. + To update an extension, + the version number will need to increase in the manifest: </p> -<p> -A server that hosts <code>.crx</code> files -must use appropriate HTTP headers, -so that users can install the file -by clicking a link to it. -</p> +<pre data-filename="manifest.json"> + { + ... + <b>"version": "1.5",</b> + ... + } + }</pre> + <pre data-filename="manifest.json"> + { + ... + <b>"version": "1.6",</b> + ... + } + } +</pre> <p> -Google Chrome considers a file to be installable -if <b>either</b> of the following is true: -</p> - -<ul> - <li> - The file has the content type - <code>application/x-chrome-extension</code> - </li> - <li> - The file suffix is <code>.crx</code> - and <b>both</b> of the following are true: - <ul> - <li> - The file <b>is not</b> served with - the HTTP header <code>X-Content-Type-Options: nosniff</code> - </li> - <li> - The file <b>is</b> served - with one of the following content types: - <ul> - <li> empty string </li> - <li> "text/plain" </li> - <li> "application/octet-stream" </li> - <li> "unknown/unknown" </li> - <li> "application/unknown" </li> - <li> "*/*" </li> - </ul> - </li> - </ul> - </li> -</ul> - -<p> -The most common reason for failing to recognize an installable file -is that the server sends the header -<code>X-Content-Type-Options: nosniff</code>. -The second most common reason -is that the server sends an unknown content type—one -that isn't in the previous list. -To fix an HTTP header issue, -either change the configuration of the server -or try hosting the <code>.crx</code> file at another server. + Re-<a href="/packaging">package</a> the updated extension and locate it in the + <a href="https://chrome.google.com/webstore/developer/dashboard"> + Developer Dashboard</a>. + Select <strong>Edit</strong>, upload the new package, + and hit <strong>Publish</strong>. + The extension will automatically update for users + after the new version is published. </p>
diff --git a/chrome/common/extensions/docs/templates/articles/linux_hosting.html b/chrome/common/extensions/docs/templates/articles/linux_hosting.html new file mode 100644 index 0000000..dae19b70 --- /dev/null +++ b/chrome/common/extensions/docs/templates/articles/linux_hosting.html
@@ -0,0 +1,77 @@ +<h1>Hosting for Linux</h1> + +<p> + Extensions hosted on a server outside of the + <a href="http://chrome.google.com/webstore">Chrome Web Store</a> + can only be installed by Linux users. + This page describes how to serve <code>.crx</code> files + from a personal server. + If distributing an extension or theme solely through the + <a href="http://chrome.google.com/webstore">Chrome Web Store</a>, + consult the <a href="/webstore">store developer documentation</a>. +</p> + +<p> + Extensions and themes are served as <code>.crx</code> files. + When uploading through the + <a href="https://chrome.google.com/webstore/developer/dashboard">Chrome Developer Dashboard</a>, + the dashboard creates the <code>.crx</code> file automatically. + If published on a personal server, + the <code>.crx</code> file will need to be created locally, + as described in <a href="packaging">Packaging</a>. + <a href="autoupdate">Autoupdate</a> information can be included + to ensure users always have the latest copy. +</p> + +<p> + A server that hosts <code>.crx</code> files + must use appropriate HTTP headers, + so that users can install the file + by clicking a link to it. +</p> + +<p> + Google Chrome considers a file to be installable + if <b>either</b> of the following is true: +</p> + +<ul> + <li> + The file has the content type + <code>application/x-chrome-extension</code> + </li> + <li> + The file suffix is <code>.crx</code> + and <b>both</b> of the following are true: + <ul> + <li> + The file <b>is not</b> served with + the HTTP header <code>X-Content-Type-Options: nosniff</code> + </li> + <li> + The file <b>is</b> served + with one of the following content types: + <ul> + <li> empty string </li> + <li> "text/plain" </li> + <li> "application/octet-stream" </li> + <li> "unknown/unknown" </li> + <li> "application/unknown" </li> + <li> "*/*" </li> + </ul> + </li> + </ul> + </li> +</ul> + +<p> + The most common reason for failing to recognize an installable file + is that the server sends the header + <code>X-Content-Type-Options: nosniff</code>. + The second most common reason + is that the server sends an unknown content type—one + that isn't in the previous list. + To fix an HTTP header issue, + either change the configuration of the server + or try hosting the <code>.crx</code> file at another server. +</p>
diff --git a/chrome/common/extensions/docs/templates/json/chrome_sidenav.json b/chrome/common/extensions/docs/templates/json/chrome_sidenav.json index cca56a4..5d152652 100644 --- a/chrome/common/extensions/docs/templates/json/chrome_sidenav.json +++ b/chrome/common/extensions/docs/templates/json/chrome_sidenav.json
@@ -535,10 +535,6 @@ "href": "/extensions/overview" }, { - "title": "Hosting Changes", - "href": "/extensions/hosting_changes" - }, - { "title": "Extension Quality Guidelines FAQ", "href": "/extensions/single_purpose" }, @@ -624,10 +620,14 @@ "href": "/extensions/hosting", "items": [ { - "title": "Hosting", + "title": "Hosting and Updating", "href": "/extensions/hosting" }, { + "title": "Hosting Policy Changes", + "href": "/extensions/hosting_changes" + }, + { "title": "Packaging", "href": "/extensions/packaging" }, @@ -636,10 +636,6 @@ "href": "/webstore/one_time_payments" }, { - "title": "Autoupdating", - "href": "/extensions/autoupdate" - }, - { "title": "Other Deployment Options", "href": "/extensions/external_extensions" },
diff --git a/chrome/common/extensions/docs/templates/public/extensions/linux_hosting.html b/chrome/common/extensions/docs/templates/public/extensions/linux_hosting.html new file mode 100644 index 0000000..b01f3c8 --- /dev/null +++ b/chrome/common/extensions/docs/templates/public/extensions/linux_hosting.html
@@ -0,0 +1 @@ +{{+partials.standard_extensions_article article:articles.linux_hosting/}}
diff --git a/chrome/common/extensions/docs/templates/public/extensions/redirects.json b/chrome/common/extensions/docs/templates/public/extensions/redirects.json index e74fc064..a4ecb32 100644 --- a/chrome/common/extensions/docs/templates/public/extensions/redirects.json +++ b/chrome/common/extensions/docs/templates/public/extensions/redirects.json
@@ -12,5 +12,6 @@ "cloudMessagingV1": "https://developers.google.com/cloud-messaging/chrome/client", "pushMessaging": "https://developers.google.com/cloud-messaging/chrome/client", "gcm_tos": "https://developers.google.com/terms/", - "gcm_server": "https://developers.google.com/cloud-messaging/server" + "gcm_server": "https://developers.google.com/cloud-messaging/server", + "autoupdate": "hosting" }
diff --git a/chrome/common/media_router/media_sink.h b/chrome/common/media_router/media_sink.h index a7feae96..c4ebd9f9 100644 --- a/chrome/common/media_router/media_sink.h +++ b/chrome/common/media_router/media_sink.h
@@ -20,14 +20,21 @@ // IconTypes are listed in the order in which sinks should be sorted. // The order must stay in sync with // chrome/browser/resources/media_router/media_router_data.js. -enum SinkIconType { - CAST, - CAST_AUDIO_GROUP, - CAST_AUDIO, - MEETING, - HANGOUT, - EDUCATION, - GENERIC +// +// NOTE: This enum is used for recording the MediaRouter.Sink.SelectedType +// metrics, so if we want to reorder it, we must create a separate enum that +// preserves the ordering, and map from this enum to the new one in +// MediaRouterMetrics::RecordMediaSinkType(). +enum class SinkIconType { + CAST = 0, + CAST_AUDIO_GROUP = 1, + CAST_AUDIO = 2, + MEETING = 3, + HANGOUT = 4, + EDUCATION = 5, + WIRED_DISPLAY = 6, + GENERIC = 7, + TOTAL_COUNT = 8 // Add new types above this line. }; // Represents a sink to which media can be routed.
diff --git a/chrome/common/media_router/mojo/media_router.mojom b/chrome/common/media_router/mojo/media_router.mojom index 594900e2..6105f9a 100644 --- a/chrome/common/media_router/mojo/media_router.mojom +++ b/chrome/common/media_router/mojo/media_router.mojom
@@ -13,6 +13,7 @@ import "url/mojo/origin.mojom"; import "url/mojo/url.mojom"; +// This must stay in sync with ash.mojom.SinkIconType. enum SinkIconType { CAST, CAST_AUDIO_GROUP, @@ -20,6 +21,7 @@ MEETING, HANGOUT, EDUCATION, + WIRED_DISPLAY, GENERIC };
diff --git a/chrome/common/media_router/mojo/media_router_struct_traits.h b/chrome/common/media_router/mojo/media_router_struct_traits.h index d69cd259..bde46e71 100644 --- a/chrome/common/media_router/mojo/media_router_struct_traits.h +++ b/chrome/common/media_router/mojo/media_router_struct_traits.h
@@ -262,8 +262,12 @@ return media_router::mojom::SinkIconType::HANGOUT; case media_router::SinkIconType::EDUCATION: return media_router::mojom::SinkIconType::EDUCATION; + case media_router::SinkIconType::WIRED_DISPLAY: + return media_router::mojom::SinkIconType::WIRED_DISPLAY; case media_router::SinkIconType::GENERIC: return media_router::mojom::SinkIconType::GENERIC; + case media_router::SinkIconType::TOTAL_COUNT: + break; } NOTREACHED() << "Unknown sink icon type " << static_cast<int>(icon_type); return media_router::mojom::SinkIconType::GENERIC; @@ -290,6 +294,9 @@ case media_router::mojom::SinkIconType::EDUCATION: *output = media_router::SinkIconType::EDUCATION; return true; + case media_router::mojom::SinkIconType::WIRED_DISPLAY: + *output = media_router::SinkIconType::WIRED_DISPLAY; + return true; case media_router::mojom::SinkIconType::GENERIC: *output = media_router::SinkIconType::GENERIC; return true;
diff --git a/chrome/installer/linux/debian/dist_package_versions.json b/chrome/installer/linux/debian/dist_package_versions.json index 7b9c8ec4..9ece0e76 100644 --- a/chrome/installer/linux/debian/dist_package_versions.json +++ b/chrome/installer/linux/debian/dist_package_versions.json
@@ -1,26 +1,23 @@ { "Debian 10 (Buster)": { - "gconf-service": "3.2.6-4+b1", "libasound2": "1.1.3-5", "libatk-bridge2.0-0": "2.26.0-1", "libatk1.0-0": "2.26.0-2", - "libc6": "2.24-17", + "libc6": "2.25-3", "libcairo2": "1.15.8-2", "libcups2": "2.2.6-2", - "libdbus-1-3": "1.12.0-1", - "libdconf1": "0.26.1-1", + "libdbus-1-3": "1.12.2-1", "libexpat1": "2.2.3-2", - "libfontconfig1": "2.12.3-0.2", - "libgcc1": "1:7.2.0-14", - "libgconf-2-4": "3.2.6-4+b1", + "libfontconfig1": "2.12.6-0.1", + "libgcc1": "1:7.2.0-17", "libgdk-pixbuf2.0-0": "2.36.11-1", "libglib2.0-0": "2.54.1-1", "libgtk-3-0": "3.22.24-3", - "libnspr4": "2:4.16-1", - "libnss3": "2:3.33-1", + "libnspr4": "2:4.16-1+b1", + "libnss3": "2:3.34-1", "libpango-1.0-0": "1.40.12-1", "libpangocairo-1.0-0": "1.40.12-1", - "libstdc++6": "7.2.0-14", + "libstdc++6": "7.2.0-17", "libx11-6": "2:1.6.4-3", "libx11-xcb1": "2:1.6.4-3", "libxcb1": "1.12-1", @@ -36,7 +33,6 @@ "libxtst6": "2:1.2.3-1" }, "Debian 8 (Jessie)": { - "gconf-service": "3.2.6-3", "libasound2": "1.0.28-1", "libatk-bridge2.0-0": "2.14.0-2", "libatk1.0-0": "2.14.0-1", @@ -44,11 +40,9 @@ "libcairo2": "1.14.0-2.1+deb8u2", "libcups2": "1.7.5-11+deb8u1", "libdbus-1-3": "1.8.22-0+deb8u1", - "libdconf1": "0.22.0-1", "libexpat1": "2.1.0-6+deb8u4", "libfontconfig1": "2.11.0-6.3+deb8u1", "libgcc1": "1:4.9.2-10", - "libgconf-2-4": "3.2.6-3", "libgdk-pixbuf2.0-0": "2.31.1-2+deb8u6", "libglib2.0-0": "2.42.1-1+b1", "libgtk-3-0": "3.14.5-1+deb8u1", @@ -57,34 +51,31 @@ "libpango-1.0-0": "1.36.8-3", "libpangocairo-1.0-0": "1.36.8-3", "libstdc++6": "4.9.2-10", - "libx11-6": "2:1.6.2-3", - "libx11-xcb1": "2:1.6.2-3", + "libx11-6": "2:1.6.2-3+deb8u1", + "libx11-xcb1": "2:1.6.2-3+deb8u1", "libxcb1": "1.10-3+b1", "libxcomposite1": "1:0.4.4-1", - "libxcursor1": "1:1.1.14-1+b1", + "libxcursor1": "1:1.1.14-1+deb8u1", "libxdamage1": "1:1.1.4-2+b1", "libxext6": "2:1.3.3-1", - "libxfixes3": "1:5.0.1-2+b2", - "libxi6": "2:1.7.4-1+b2", - "libxrandr2": "2:1.4.2-1+b1", + "libxfixes3": "1:5.0.1-2+deb8u1", + "libxi6": "2:1.7.4-1+deb8u1", + "libxrandr2": "2:1.4.2-1+deb8u1", "libxrender1": "1:0.9.8-1+b1", "libxss1": "1:1.2.2-1", - "libxtst6": "2:1.2.2-1+b1" + "libxtst6": "2:1.2.2-1+deb8u1" }, "Debian 9 (Stretch)": { - "gconf-service": "3.2.6-4+b1", "libasound2": "1.1.3-5", "libatk-bridge2.0-0": "2.22.0-2", "libatk1.0-0": "2.22.0-1", "libc6": "2.24-11+deb9u1", "libcairo2": "1.14.8-1", "libcups2": "2.2.1-8", - "libdbus-1-3": "1.10.22-0+deb9u1", - "libdconf1": "0.26.0-2+b1", + "libdbus-1-3": "1.10.24-0+deb9u1", "libexpat1": "2.2.0-2+deb9u1", "libfontconfig1": "2.11.0-6.7+b1", "libgcc1": "1:6.3.0-18", - "libgconf-2-4": "3.2.6-4+b1", "libgdk-pixbuf2.0-0": "2.36.5-2+deb9u1", "libglib2.0-0": "2.50.3-2", "libgtk-3-0": "3.22.11-1", @@ -97,7 +88,7 @@ "libx11-xcb1": "2:1.6.4-3", "libxcb1": "1.12-1", "libxcomposite1": "1:0.4.4-2", - "libxcursor1": "1:1.1.14-1+b4", + "libxcursor1": "1:1.1.14-1+deb9u1", "libxdamage1": "1:1.1.4-2+b3", "libxext6": "2:1.3.3-1+b2", "libxfixes3": "1:5.0.3-1", @@ -108,7 +99,6 @@ "libxtst6": "2:1.2.3-1" }, "Ubuntu 14.04 (Trusty)": { - "gconf-service": "3.2.6-0ubuntu2", "libasound2": "1.0.27.2-3ubuntu7", "libatk-bridge2.0-0": "2.10.2-2ubuntu1", "libatk1.0-0": "2.10.0-2ubuntu2", @@ -116,11 +106,9 @@ "libcairo2": "1.13.0~20140204-0ubuntu1.1", "libcups2": "1.7.2-0ubuntu1.7", "libdbus-1-3": "1.6.18-0ubuntu4.4", - "libdconf1": "0.20.0-1", "libexpat1": "2.1.0-4ubuntu1.4", "libfontconfig1": "2.11.0-0ubuntu4.2", "libgcc1": "1:4.9.3-0ubuntu4", - "libgconf-2-4": "3.2.6-0ubuntu2", "libgdk-pixbuf2.0-0": "2.30.7-0ubuntu1.7", "libglib2.0-0": "2.40.2-0ubuntu1", "libgtk-3-0": "3.10.8-0ubuntu1.4", @@ -133,7 +121,7 @@ "libx11-xcb1": "2:1.6.2-1ubuntu2", "libxcb1": "1.10-2ubuntu1", "libxcomposite1": "1:0.4.4-1", - "libxcursor1": "1:1.1.14-1", + "libxcursor1": "1:1.1.14-1ubuntu0.14.04.1", "libxdamage1": "1:1.1.4-1ubuntu1", "libxext6": "2:1.3.2-1ubuntu0.0.14.04.1", "libxfixes3": "1:5.0.1-1ubuntu1.1", @@ -144,7 +132,6 @@ "libxtst6": "2:1.2.2-1" }, "Ubuntu 16.04 (Xenial)": { - "gconf-service": "3.2.6-3ubuntu6", "libasound2": "1.1.0-0ubuntu1", "libatk-bridge2.0-0": "2.18.1-2ubuntu1", "libatk1.0-0": "2.18.0-1", @@ -152,11 +139,9 @@ "libcairo2": "1.14.6-1", "libcups2": "2.1.3-4ubuntu0.3", "libdbus-1-3": "1.10.6-1ubuntu3.1", - "libdconf1": "0.24.0-2", "libexpat1": "2.1.0-7ubuntu0.16.04.3", "libfontconfig1": "2.11.94-0ubuntu1.1", "libgcc1": "1:6.0.1-0ubuntu1", - "libgconf-2-4": "3.2.6-3ubuntu6", "libgdk-pixbuf2.0-0": "2.32.2-1ubuntu1.3", "libglib2.0-0": "2.48.2-0ubuntu1", "libgtk-3-0": "3.18.9-1ubuntu3.3", @@ -169,7 +154,7 @@ "libx11-xcb1": "2:1.6.3-1ubuntu2", "libxcb1": "1.11.1-1ubuntu1", "libxcomposite1": "1:0.4.4-1", - "libxcursor1": "1:1.1.14-1", + "libxcursor1": "1:1.1.14-1ubuntu0.16.04.1", "libxdamage1": "1:1.1.4-2", "libxext6": "2:1.3.3-1", "libxfixes3": "1:5.0.1-2", @@ -180,7 +165,6 @@ "libxtst6": "2:1.2.2-1" }, "Ubuntu 17.04 (Zesty)": { - "gconf-service": "3.2.6-3ubuntu7", "libasound2": "1.1.3-5", "libatk-bridge2.0-0": "2.22.0-1ubuntu1", "libatk1.0-0": "2.22.0-1", @@ -188,11 +172,9 @@ "libcairo2": "1.14.8-1", "libcups2": "2.2.2-1ubuntu1", "libdbus-1-3": "1.10.10-1ubuntu2", - "libdconf1": "0.26.0-2", "libexpat1": "2.2.0-2ubuntu0.1", "libfontconfig1": "2.11.94-0ubuntu2", "libgcc1": "1:6.3.0-12ubuntu2", - "libgconf-2-4": "3.2.6-3ubuntu7", "libgdk-pixbuf2.0-0": "2.36.5-3ubuntu0.2", "libglib2.0-0": "2.52.0-1", "libgtk-3-0": "3.22.11-0ubuntu3", @@ -205,7 +187,7 @@ "libx11-xcb1": "2:1.6.4-3", "libxcb1": "1.11.1-1ubuntu1", "libxcomposite1": "1:0.4.4-2", - "libxcursor1": "1:1.1.14-1", + "libxcursor1": "1:1.1.14-1ubuntu0.17.04.1", "libxdamage1": "1:1.1.4-2", "libxext6": "2:1.3.3-1", "libxfixes3": "1:5.0.3-1", @@ -216,7 +198,6 @@ "libxtst6": "2:1.2.3-1" }, "Ubuntu 17.10 (Artful)": { - "gconf-service": "3.2.6-4ubuntu1", "libasound2": "1.1.3-5", "libatk-bridge2.0-0": "2.26.0-1ubuntu1", "libatk1.0-0": "2.26.0-2ubuntu1", @@ -224,11 +205,9 @@ "libcairo2": "1.14.10-1ubuntu1", "libcups2": "2.2.4-7ubuntu3", "libdbus-1-3": "1.10.22-1ubuntu1", - "libdconf1": "0.26.0-2", "libexpat1": "2.2.3-1", "libfontconfig1": "2.11.94-0ubuntu2", "libgcc1": "1:7.2.0-8ubuntu3", - "libgconf-2-4": "3.2.6-4ubuntu1", "libgdk-pixbuf2.0-0": "2.36.11-1", "libglib2.0-0": "2.54.1-1ubuntu1", "libgtk-3-0": "3.22.25-0ubuntu0.1", @@ -241,7 +220,7 @@ "libx11-xcb1": "2:1.6.4-3", "libxcb1": "1.12-1ubuntu1", "libxcomposite1": "1:0.4.4-2", - "libxcursor1": "1:1.1.14-3", + "libxcursor1": "1:1.1.14-3ubuntu0.1", "libxdamage1": "1:1.1.4-3", "libxext6": "2:1.3.3-1", "libxfixes3": "1:5.0.3-1",
diff --git a/chrome/installer/linux/debian/update_dist_package_versions.py b/chrome/installer/linux/debian/update_dist_package_versions.py index 45df2707..e065630 100755 --- a/chrome/installer/linux/debian/update_dist_package_versions.py +++ b/chrome/installer/linux/debian/update_dist_package_versions.py
@@ -35,7 +35,6 @@ } PACKAGE_FILTER = set([ - "gconf-service", "libasound2", "libatk1.0-0", "libatk-bridge2.0-0", @@ -43,11 +42,9 @@ "libcairo2", "libcups2", "libdbus-1-3", - "libdconf1", "libexpat1", "libfontconfig1", "libgcc1", - "libgconf-2-4", "libgdk-pixbuf2.0-0", "libglib2.0-0", "libgtk-3-0",
diff --git a/chrome/installer/linux/rpm/dist_package_provides.json b/chrome/installer/linux/rpm/dist_package_provides.json index 6166758..662c70f 100644 --- a/chrome/installer/linux/rpm/dist_package_provides.json +++ b/chrome/installer/linux/rpm/dist_package_provides.json
@@ -57,7 +57,6 @@ "libdbus-1.so.3()(64bit)", "libdbus-1.so.3(LIBDBUS_1_3)(64bit)", "libdbus-1.so.3(LIBDBUS_PRIVATE_1.11.18)(64bit)", - "libdconf.so.1()(64bit)", "libdl.so.2()(64bit)", "libdl.so.2(GLIBC_2.2.5)(64bit)", "libdl.so.2(GLIBC_2.3.3)(64bit)", @@ -77,7 +76,6 @@ "libgcc_s.so.1(GCC_4.3.0)(64bit)", "libgcc_s.so.1(GCC_4.7.0)(64bit)", "libgcc_s.so.1(GCC_4.8.0)(64bit)", - "libgconf-2.so.4()(64bit)", "libgdk-3.so.0()(64bit)", "libgdk_pixbuf-2.0.so.0()(64bit)", "libgio-2.0.so.0()(64bit)", @@ -131,6 +129,7 @@ "libnss3.so(NSS_3.30)(64bit)", "libnss3.so(NSS_3.31)(64bit)", "libnss3.so(NSS_3.33)(64bit)", + "libnss3.so(NSS_3.34)(64bit)", "libnss3.so(NSS_3.4)(64bit)", "libnss3.so(NSS_3.5)(64bit)", "libnss3.so(NSS_3.6)(64bit)", @@ -298,7 +297,6 @@ "libdbus-1.so.3()(64bit)", "libdbus-1.so.3(LIBDBUS_1_3)(64bit)", "libdbus-1.so.3(LIBDBUS_PRIVATE_1.11.18)(64bit)", - "libdconf.so.1()(64bit)", "libdl.so.2()(64bit)", "libdl.so.2(GLIBC_2.2.5)(64bit)", "libdl.so.2(GLIBC_2.3.3)(64bit)", @@ -319,7 +317,6 @@ "libgcc_s.so.1(GCC_4.7.0)(64bit)", "libgcc_s.so.1(GCC_4.8.0)(64bit)", "libgcc_s.so.1(GCC_7.0.0)(64bit)", - "libgconf-2.so.4()(64bit)", "libgdk-3.so.0()(64bit)", "libgdk_pixbuf-2.0.so.0()(64bit)", "libgio-2.0.so.0()(64bit)", @@ -374,6 +371,7 @@ "libnss3.so(NSS_3.30)(64bit)", "libnss3.so(NSS_3.31)(64bit)", "libnss3.so(NSS_3.33)(64bit)", + "libnss3.so(NSS_3.34)(64bit)", "libnss3.so(NSS_3.4)(64bit)", "libnss3.so(NSS_3.5)(64bit)", "libnss3.so(NSS_3.6)(64bit)", @@ -545,7 +543,6 @@ "libdbus-1.so.3()(64bit)", "libdbus-1.so.3(LIBDBUS_1_3)(64bit)", "libdbus-1.so.3(LIBDBUS_PRIVATE_1.12.0)(64bit)", - "libdconf.so.1()(64bit)", "libdl.so.2()(64bit)", "libdl.so.2(GLIBC_2.2.5)(64bit)", "libdl.so.2(GLIBC_2.3.3)(64bit)", @@ -565,7 +562,6 @@ "libgcc_s.so.1(GCC_4.7.0)(64bit)", "libgcc_s.so.1(GCC_4.8.0)(64bit)", "libgcc_s.so.1(GCC_7.0.0)(64bit)", - "libgconf-2.so.4()(64bit)", "libgdk-3.so.0()(64bit)", "libgdk_pixbuf-2.0.so.0()(64bit)", "libgio-2.0.so.0()(64bit)", @@ -621,6 +617,7 @@ "libnss3.so(NSS_3.30)(64bit)", "libnss3.so(NSS_3.31)(64bit)", "libnss3.so(NSS_3.33)(64bit)", + "libnss3.so(NSS_3.34)(64bit)", "libnss3.so(NSS_3.4)(64bit)", "libnss3.so(NSS_3.5)(64bit)", "libnss3.so(NSS_3.6)(64bit)", @@ -845,8 +842,6 @@ "libcups.so.2()(64bit)", "libdbus-1.so.3", "libdbus-1.so.3()(64bit)", - "libdconf.so.1", - "libdconf.so.1()(64bit)", "libdl.so.2", "libdl.so.2()(64bit)", "libdl.so.2(GLIBC_2.0)", @@ -889,8 +884,6 @@ "libgcc_s.so.1(GCC_4.8.0)", "libgcc_s.so.1(GCC_4.8.0)(64bit)", "libgcc_s.so.1(GLIBC_2.0)", - "libgconf-2.so.4", - "libgconf-2.so.4()(64bit)", "libgdk-3.so.0", "libgdk-3.so.0()(64bit)", "libgdk_pixbuf-2.0.so.0", @@ -1300,8 +1293,6 @@ "libcups.so.2()(64bit)", "libdbus-1.so.3", "libdbus-1.so.3()(64bit)", - "libdconf.so.1", - "libdconf.so.1()(64bit)", "libdl.so.2", "libdl.so.2()(64bit)", "libdl.so.2(GLIBC_2.0)", @@ -1346,8 +1337,6 @@ "libgcc_s.so.1(GCC_7.0.0)", "libgcc_s.so.1(GCC_7.0.0)(64bit)", "libgcc_s.so.1(GLIBC_2.0)", - "libgconf-2.so.4", - "libgconf-2.so.4()(64bit)", "libgdk-3.so.0", "libgdk-3.so.0()(64bit)", "libgdk_pixbuf-2.0.so.0", @@ -1631,6 +1620,8 @@ "libstdc++.so.6(GLIBCXX_3.4.22)(64bit)", "libstdc++.so.6(GLIBCXX_3.4.23)", "libstdc++.so.6(GLIBCXX_3.4.23)(64bit)", + "libstdc++.so.6(GLIBCXX_3.4.24)", + "libstdc++.so.6(GLIBCXX_3.4.24)(64bit)", "libstdc++.so.6(GLIBCXX_3.4.3)", "libstdc++.so.6(GLIBCXX_3.4.3)(64bit)", "libstdc++.so.6(GLIBCXX_3.4.4)",
diff --git a/chrome/installer/linux/rpm/update_package_provides.py b/chrome/installer/linux/rpm/update_package_provides.py index 843f215..9eaf50a 100755 --- a/chrome/installer/linux/rpm/update_package_provides.py +++ b/chrome/installer/linux/rpm/update_package_provides.py
@@ -33,12 +33,10 @@ "libcairo.so", "libcups.so", "libdbus-1.so", - "libdconf.so", "libdl.so", "libexpat.so", "libfontconfig.so", "libgcc_s.so", - "libgconf-2.so", "libgdk-3.so", "libgdk_pixbuf-2.0.so", "libgio-2.0.so",
diff --git a/chrome/renderer/searchbox/searchbox.cc b/chrome/renderer/searchbox/searchbox.cc index 3a6bc70..fe5638d3 100644 --- a/chrome/renderer/searchbox/searchbox.cc +++ b/chrome/renderer/searchbox/searchbox.cc
@@ -212,19 +212,21 @@ SearchBox::SearchBox(content::RenderFrame* render_frame) : content::RenderFrameObserver(render_frame), content::RenderFrameObserverTracker<SearchBox>(render_frame), + binding_(this), + can_run_js_in_renderframe_(false), page_seq_no_(0), is_focused_(false), is_input_in_progress_(false), is_key_capture_enabled_(false), most_visited_items_cache_(kMaxInstantMostVisitedItemCacheSize), - binding_(this), weak_ptr_factory_(this) { - // Note: This class may execute JS in |render_frame| in response to IPCs (via - // the SearchBoxExtension::Dispatch* methods). However, for cross-process - // navigations, a "provisional frame" is created at first, and it's illegal - // to execute any JS in it before it's actually swapped in, i.e.m before the - // navigation has committed. So we only hook up the Mojo interfaces in - // RenderFrameObserver::DidCommitProvisionalLoad. See crbug.com/765101. + // Connect to the embedded search interface in the browser. + chrome::mojom::EmbeddedSearchConnectorAssociatedPtr connector; + render_frame->GetRemoteAssociatedInterfaces()->GetInterface(&connector); + chrome::mojom::EmbeddedSearchClientAssociatedPtrInfo embedded_search_client; + binding_.Bind(mojo::MakeRequest(&embedded_search_client)); + connector->Connect(mojo::MakeRequest(&embedded_search_service_), + std::move(embedded_search_client)); } SearchBox::~SearchBox() = default; @@ -321,8 +323,10 @@ void SearchBox::ChromeIdentityCheckResult(const base::string16& identity, bool identity_match) { - SearchBoxExtension::DispatchChromeIdentityCheckResult( - render_frame()->GetWebFrame(), identity, identity_match); + if (can_run_js_in_renderframe_) { + SearchBoxExtension::DispatchChromeIdentityCheckResult( + render_frame()->GetWebFrame(), identity, identity_match); + } } void SearchBox::FocusChanged(OmniboxFocusState new_focus_state, @@ -340,21 +344,26 @@ if (reason != OMNIBOX_FOCUS_CHANGE_TYPING) { is_key_capture_enabled_ = key_capture_enabled; DVLOG(1) << render_frame() << " KeyCaptureChange"; - SearchBoxExtension::DispatchKeyCaptureChange( - render_frame()->GetWebFrame()); + if (can_run_js_in_renderframe_) { + SearchBoxExtension::DispatchKeyCaptureChange( + render_frame()->GetWebFrame()); + } } } bool is_focused = new_focus_state == OMNIBOX_FOCUS_VISIBLE; if (is_focused != is_focused_) { is_focused_ = is_focused; DVLOG(1) << render_frame() << " FocusChange"; - SearchBoxExtension::DispatchFocusChange(render_frame()->GetWebFrame()); + if (can_run_js_in_renderframe_) + SearchBoxExtension::DispatchFocusChange(render_frame()->GetWebFrame()); } } void SearchBox::HistorySyncCheckResult(bool sync_history) { - SearchBoxExtension::DispatchHistorySyncCheckResult( - render_frame()->GetWebFrame(), sync_history); + if (can_run_js_in_renderframe_) { + SearchBoxExtension::DispatchHistorySyncCheckResult( + render_frame()->GetWebFrame(), sync_history); + } } void SearchBox::MostVisitedChanged( @@ -367,18 +376,23 @@ } most_visited_items_cache_.AddItems(items); - SearchBoxExtension::DispatchMostVisitedChanged(render_frame()->GetWebFrame()); + if (can_run_js_in_renderframe_) { + SearchBoxExtension::DispatchMostVisitedChanged( + render_frame()->GetWebFrame()); + } } void SearchBox::SetInputInProgress(bool is_input_in_progress) { - if (is_input_in_progress_ != is_input_in_progress) { - is_input_in_progress_ = is_input_in_progress; - DVLOG(1) << render_frame() << " SetInputInProgress"; - if (is_input_in_progress_) { + if (is_input_in_progress_ == is_input_in_progress) + return; + + is_input_in_progress_ = is_input_in_progress; + DVLOG(1) << render_frame() << " SetInputInProgress"; + if (can_run_js_in_renderframe_) { + if (is_input_in_progress_) SearchBoxExtension::DispatchInputStart(render_frame()->GetWebFrame()); - } else { + else SearchBoxExtension::DispatchInputCancel(render_frame()->GetWebFrame()); - } } } @@ -388,7 +402,8 @@ return; theme_info_ = theme_info; - SearchBoxExtension::DispatchThemeChange(render_frame()->GetWebFrame()); + if (can_run_js_in_renderframe_) + SearchBoxExtension::DispatchThemeChange(render_frame()->GetWebFrame()); } GURL SearchBox::GetURLForMostVisitedItem(InstantRestrictedID item_id) const { @@ -398,16 +413,7 @@ void SearchBox::DidCommitProvisionalLoad(bool is_new_navigation, bool is_same_document_navigation) { - if (binding_.is_bound()) - return; - - // Connect to the embedded search interface in the browser. - chrome::mojom::EmbeddedSearchConnectorAssociatedPtr connector; - render_frame()->GetRemoteAssociatedInterfaces()->GetInterface(&connector); - chrome::mojom::EmbeddedSearchClientAssociatedPtrInfo embedded_search_client; - binding_.Bind(mojo::MakeRequest(&embedded_search_client)); - connector->Connect(mojo::MakeRequest(&embedded_search_service_), - std::move(embedded_search_client)); + can_run_js_in_renderframe_ = true; } void SearchBox::OnDestruct() {
diff --git a/chrome/renderer/searchbox/searchbox.h b/chrome/renderer/searchbox/searchbox.h index f3796cd7..aaade1b 100644 --- a/chrome/renderer/searchbox/searchbox.h +++ b/chrome/renderer/searchbox/searchbox.h
@@ -143,14 +143,29 @@ // Returns the URL of the Most Visited item specified by the |item_id|. GURL GetURLForMostVisitedItem(InstantRestrictedID item_id) const; + // The connection to the EmbeddedSearch service in the browser process. + chrome::mojom::EmbeddedSearchAssociatedPtr embedded_search_service_; + mojo::AssociatedBinding<chrome::mojom::EmbeddedSearchClient> binding_; + + // Whether it's legal to execute JavaScript in |render_frame()|. + // This class may want to execute JS in response to IPCs (via the + // SearchBoxExtension::Dispatch* methods). However, for cross-process + // navigations, a "provisional frame" is created at first, and it's illegal + // to execute any JS in it before it is actually swapped in, i.e. before the + // navigation has committed. So this only gets set to true in + // RenderFrameObserver::DidCommitProvisionalLoad. See crbug.com/765101. + // Note: If crbug.com/794942 ever gets resolved, then it might be possible to + // move the mojo connection code from the ctor to DidCommitProvisionalLoad and + // avoid this bool. + bool can_run_js_in_renderframe_; + + // The Instant state. int page_seq_no_; bool is_focused_; bool is_input_in_progress_; bool is_key_capture_enabled_; InstantRestrictedIDCache<InstantMostVisitedItem> most_visited_items_cache_; ThemeBackgroundInfo theme_info_; - chrome::mojom::EmbeddedSearchAssociatedPtr embedded_search_service_; - mojo::AssociatedBinding<chrome::mojom::EmbeddedSearchClient> binding_; base::WeakPtrFactory<SearchBox> weak_ptr_factory_;
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 52a817e8..bc79fc82 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -318,7 +318,7 @@ ":test_support", ] - if (is_chromeos && enable_mus) { + if (is_chromeos) { sources += [ "base/browser_tests_main_chromeos.cc", "base/mash_browser_tests_main.cc", @@ -363,7 +363,12 @@ defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ] if (is_win) { - data += [ "$root_out_dir/chrome_200_percent.pak" ] + data += [ + "$root_out_dir/chrome_200_percent.pak", + + # Needed for VR browser tests + "//third_party/WebKit/LayoutTests/resources/testharness.js", + ] deps += [ "//chrome/app:chrome_dll_resources" ] } if (is_chromeos) { @@ -1830,7 +1835,14 @@ "../browser/ui/views/accessibility/invert_bubble_view_browsertest.cc", "../browser/ui/views/settings_reset_prompt_dialog_browsertest.cc", "../browser/ui/views/uninstall_view_browsertest.cc", + "../browser/vr/test/vr_browser_test.cc", + "../browser/vr/test/vr_browser_test.h", + "../browser/vr/test/vr_transition_utils.cc", + "../browser/vr/test/vr_transition_utils.h", + "../browser/vr/webvr_transition_browser_test.cc", ] + + data_deps += [ "../../device/vr:openvr_mock" ] } if (is_mac || is_win) { sources += [ @@ -3242,6 +3254,7 @@ "../browser/extensions/external_provider_impl_unittest.cc", "../browser/extensions/favicon_downloader_unittest.cc", "../browser/extensions/install_tracker_unittest.cc", + "../browser/extensions/install_verifier_unittest.cc", "../browser/extensions/menu_manager_unittest.cc", "../browser/extensions/ntp_overridden_bubble_delegate_unittest.cc", "../browser/extensions/pack_extension_unittest.cc",
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/TestContentProvider.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/TestContentProvider.java index ee8dd3bc..2922901 100644 --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/TestContentProvider.java +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/TestContentProvider.java
@@ -65,7 +65,7 @@ private String mDataFilePath; // Content providers can be accessed from multiple threads. - private Object mLock = new Object(); + private final Object mLock = new Object(); public static String createContentUrl(String target) { return CONTENT_SCHEME + AUTHORITY + "/" + target;
diff --git a/chrome/test/data/extensions/platform_apps/windows_api_properties/main.js b/chrome/test/data/extensions/platform_apps/windows_api_properties/main.js index 63e52de0..a72b4e2 100644 --- a/chrome/test/data/extensions/platform_apps/windows_api_properties/main.js +++ b/chrome/test/data/extensions/platform_apps/windows_api_properties/main.js
@@ -33,34 +33,73 @@ } -var tests = [ - - makeEventTest('onMinimized', function() { current.minimize(); }), - makeEventTest('onMaximized', function() { current.maximize(); }), - makeEventTest('onRestored', function() { - current.minimize(); - current.restore(); - }), - makeEventTest('onRestored', function() { - current.maximize(); - current.restore(); - }), - makeEventTest('onBoundsChanged', function() { - current.outerBounds.setPosition(5, 5); - }), - makeEventTest('onBoundsChanged', function() { - current.outerBounds.setSize(150, 150); - }), - makeEventTest('onBoundsChanged', function() { - current.innerBounds.setPosition(40, 40); - }), - makeEventTest('onBoundsChanged', function() { - current.innerBounds.setSize(100, 100); - }) - -]; +var tests = { + minimized: [ + makeEventTest( + 'onMinimized', + function() { + current.minimize(); + }), + ], + maximized: [ + makeEventTest( + 'onMaximized', + function() { + current.maximize(); + }), + ], + restored: [ + makeEventTest( + 'onRestored', + function() { + var doRestore = function() { + current.onMinimized.removeListener(doRestore); + current.restore(); + }; + current.onMinimized.addListener(doRestore); + current.minimize(); + }), + makeEventTest( + 'onRestored', + function() { + var doRestore = function() { + current.onMaximized.removeListener(doRestore); + current.restore(); + }; + current.onMaximized.addListener(doRestore); + current.maximize(); + }) + ], + boundsChanged: [ + makeEventTest( + 'onBoundsChanged', + function() { + current.outerBounds.setPosition(5, 5); + }), + makeEventTest( + 'onBoundsChanged', + function() { + current.outerBounds.setSize(150, 150); + }), + makeEventTest( + 'onBoundsChanged', + function() { + current.innerBounds.setPosition(40, 40); + }), + makeEventTest( + 'onBoundsChanged', + function() { + current.innerBounds.setSize(100, 100); + }) + ], +}; chrome.runtime.getBackgroundPage(function(page) { bg = page; - chrome.test.runTests(tests); + chrome.test.getConfig(function(config) { + if (config.customArg in tests) + chrome.test.runTests(tests[config.customArg]); + else + chrome.test.fail('Test "' + config.customArg + '"" doesnt exist!'); + }); });
diff --git a/chrome/test/data/policy/gpo/fuzzer.dict b/chrome/test/data/policy/gpo/fuzzer.dict index 8f1be985..ef0b00f 100644 --- a/chrome/test/data/policy/gpo/fuzzer.dict +++ b/chrome/test/data/policy/gpo/fuzzer.dict
@@ -10,12 +10,12 @@ kRegistryPathSeparator = "\\\x00" kActionTriggerPrefix = "*\x00*\x00" -kActionTriggerDeleteValues[] = "d\x00e\x00l\x00e\x00t\x00e\x00v\x00a\x00l\x00u\x00e\x00s\x00" -kActionTriggerDel[] = "d\x00e\x00l\x00.\x00" -kActionTriggerDelVals[] = "d\x00e\x00l\x00v\x00a\x00l\x00s\x00" -kActionTriggerDeleteKeys[] = "d\x00e\x00l\x00e\x00t\x00e\x00k\x00e\x00y\x00s\x00" -kActionTriggerSecureKey[] = "s\x00e\x00c\x00u\x00r\x00e\x00k\x00e\x00y\x00" -kActionTriggerSoft[] = "s\x00o\x00f\x00t\x00" +kActionTriggerDeleteValues = "d\x00e\x00l\x00e\x00t\x00e\x00v\x00a\x00l\x00u\x00e\x00s\x00" +kActionTriggerDel = "d\x00e\x00l\x00.\x00" +kActionTriggerDelVals = "d\x00e\x00l\x00v\x00a\x00l\x00s\x00" +kActionTriggerDeleteKeys = "d\x00e\x00l\x00e\x00t\x00e\x00k\x00e\x00y\x00s\x00" +kActionTriggerSecureKey = "s\x00e\x00c\x00u\x00r\x00e\x00k\x00e\x00y\x00" +kActionTriggerSoft = "s\x00o\x00f\x00t\x00" REG_SZ = "\x01" REG_DWORD_LITTLE_ENDIAN = "\x04"
diff --git a/chrome/test/data/policy/policy_test_cases.json b/chrome/test/data/policy/policy_test_cases.json index f8d0205..e5bb58b 100644 --- a/chrome/test/data/policy/policy_test_cases.json +++ b/chrome/test/data/policy/policy_test_cases.json
@@ -871,7 +871,7 @@ }, "DefaultDownloadDirectory": { - "os": ["win", "linux", "mac", "chbromeos"], + "os": ["win", "linux", "mac", "chromeos"], "test_policy": { "DefaultDownloadDirectory": "${user_home}/test-downloads" }, "can_be_recommended": true, "pref_mappings": [ @@ -886,6 +886,20 @@ ] }, + "SpellcheckLanguage": { + "os": ["win", "linux", "chromeos"], + "test_policy": { "SpellcheckLanguage": [ "fr" ] }, + "pref_mappings": [ + { "pref": "spellcheck.forced_dictionaries", + "indicator_tests": [ + { "policy": { "SpellcheckLanguage": [ "en-US" ] } }, + { "policy": { "SpellcheckLanguage": [ "en-US", "ru", "sk" ] } }, + { "policy": { "SpellcheckLanguage": [] } } + ] + } + ] + }, + "ExtensionInstallBlacklist": { "os": ["win", "linux", "mac", "chromeos"], "test_policy": { "ExtensionInstallBlacklist": ["*"] }, @@ -2718,6 +2732,14 @@ ] }, + "SecondaryGoogleAccountSigninAllowed": { + "os": ["chromeos"], + "test_policy": { "SecondaryGoogleAccountSigninAllowed": false }, + "pref_mappings": [ + { "pref": "account_consistency_mirror.required" } + ] + }, + "NativeMessagingBlacklist": { "os": ["win", "linux", "mac"], "test_policy": { "NativeMessagingBlacklist": ["*"] },
diff --git a/chrome/test/data/webui/extensions/extension_detail_view_test.js b/chrome/test/data/webui/extensions/extension_detail_view_test.js index 20d573a..79ef69d 100644 --- a/chrome/test/data/webui/extensions/extension_detail_view_test.js +++ b/chrome/test/data/webui/extensions/extension_detail_view_test.js
@@ -106,8 +106,19 @@ item.set('data.optionsPage', {openInTab: true, url: optionsUrl}); expectTrue(testIsVisible('#extensions-options')); - // TODO(devlin): Add checks for homepage once it's added back to the - // mocks. + item.set('data.manifestHomePageUrl', 'http://example.com'); + Polymer.dom.flush(); + expectTrue(testIsVisible('#developerWebsite')); + item.set('data.manifestHomePageUrl', ''); + Polymer.dom.flush(); + expectFalse(testIsVisible('#developerWebsite')); + + item.set('data.webStoreUrl', 'http://example.com'); + Polymer.dom.flush(); + expectTrue(testIsVisible('#viewInStore')); + item.set('data.webStoreUrl', ''); + Polymer.dom.flush(); + expectFalse(testIsVisible('#viewInStore')); expectFalse(testIsVisible('#id-section')); expectFalse(testIsVisible('#inspectable-views'));
diff --git a/chrome/test/data/webui/settings/cups_printer_page_tests.js b/chrome/test/data/webui/settings/cups_printer_page_tests.js index b85dbd7..87667a8 100644 --- a/chrome/test/data/webui/settings/cups_printer_page_tests.js +++ b/chrome/test/data/webui/settings/cups_printer_page_tests.js
@@ -73,10 +73,14 @@ var address = addDialog.$$('#printerAddressInput'); assertTrue(!!name); - name.value = 'Test Printer'; + name.value = 'Test printer'; assertTrue(!!address); address.value = '127.0.0.1'; + + var addButton = addDialog.$$('#addPrinterButton'); + assertTrue(!!addButton); + assertFalse(addButton.disabled); } function clickAddButton(dialog) { @@ -141,6 +145,62 @@ }); }); + test('ValidIPV4', function() { + var dialog = document.createElement('add-printer-manually-dialog'); + expectTrue(dialog.canAddPrinter_('Test printer', '127.0.0.1')); + }); + + test('ValidIPV4WithPort', function() { + var dialog = document.createElement('add-printer-manually-dialog'); + expectTrue(dialog.canAddPrinter_('Test printer', '127.0.1.183:1234')); + }); + + test('ValidIPV6', function() { + var dialog = document.createElement('add-printer-manually-dialog'); + + // Test the full ipv6 address scheme. + expectTrue(dialog.canAddPrinter_('Test printer', '1:2:a3:ff4:5:6:7:8')); + + // Test the shorthand prefix scheme. + expectTrue(dialog.canAddPrinter_('Test printer', '::255')); + + // Test the shorthand suffix scheme. + expectTrue(dialog.canAddPrinter_('Test printer', '1::')); + }); + + test('ValidIPV6WithPort', function() { + var dialog = document.createElement('add-printer-manually-dialog'); + + expectTrue(dialog.canAddPrinter_('Test printer', '[1:2:aa2:4]:12')); + expectTrue(dialog.canAddPrinter_('Test printer', '[::255]:54')); + expectTrue(dialog.canAddPrinter_('Test printer', '[1::]:7899')); + }); + + test('InvalidIPV6', function() { + var dialog = document.createElement('add-printer-manually-dialog'); + + expectFalse(dialog.canAddPrinter_('Test printer', '1:2:3:4:5:6:7:8:9')); + expectFalse(dialog.canAddPrinter_('Test printer', '1:2:3:aa:a1245:2')); + expectFalse(dialog.canAddPrinter_('Test printer', '1:2:3:za:2')); + expectFalse(dialog.canAddPrinter_('Test printer', '1:::22')); + expectFalse(dialog.canAddPrinter_('Test printer', '1::2::3')); + }); + + test('ValidHostname', function() { + var dialog = document.createElement('add-printer-manually-dialog'); + + expectTrue(dialog.canAddPrinter_('Test printer', 'hello-world.com')); + expectTrue(dialog.canAddPrinter_('Test printer', 'hello.world.com:12345')); + }); + + test('InvalidHostname', function() { + var dialog = document.createElement('add-printer-manually-dialog'); + + expectFalse(dialog.canAddPrinter_('Test printer', 'helloworld!123.com')); + expectFalse(dialog.canAddPrinter_('Test printer', 'helloworld123-.com')); + expectFalse(dialog.canAddPrinter_('Test printer', '-helloworld123.com')); + }); + /** * Test that clicking on Add opens the model select page. */
diff --git a/chrome/test/data/webui/settings/fake_language_settings_private.js b/chrome/test/data/webui/settings/fake_language_settings_private.js index f7c0fb1f..670fcc7 100644 --- a/chrome/test/data/webui/settings/fake_language_settings_private.js +++ b/chrome/test/data/webui/settings/fake_language_settings_private.js
@@ -360,6 +360,10 @@ type: chrome.settingsPrivate.PrefType.LIST, value: ['en-US'], }, { + key: 'spellcheck.forced_dictionaries', + type: chrome.settingsPrivate.PrefType.LIST, + value: [], + }, { key: 'translate.enabled', type: chrome.settingsPrivate.PrefType.BOOLEAN, value: true,
diff --git a/chrome/test/data/webui/settings/languages_page_tests.js b/chrome/test/data/webui/settings/languages_page_tests.js index ae251e4..2faeedf 100644 --- a/chrome/test/data/webui/settings/languages_page_tests.js +++ b/chrome/test/data/webui/settings/languages_page_tests.js
@@ -440,6 +440,14 @@ assertFalse(triggerRow.classList.contains('two-line')); assertEquals( 0, triggerRow.querySelector('.secondary').textContent.length); + + // Force-enable a language via policy. + languageHelper.setPrefValue('spellcheck.forced_dictionaries', ['nb']); + + // The second row should no longer be empty. + assertTrue(triggerRow.classList.contains('two-line')); + assertLT( + 0, triggerRow.querySelector('.secondary').textContent.length); } }); });
diff --git a/chromecast/crash/cast_crash_keys.cc b/chromecast/crash/cast_crash_keys.cc index d6e9b8f..15d9c1e 100644 --- a/chromecast/crash/cast_crash_keys.cc +++ b/chromecast/crash/cast_crash_keys.cc
@@ -30,9 +30,6 @@ // media/: {"zero-encode-details", ::crash_keys::kSmallSize}, - // Temporary for https://crbug.com/685996. - {"user-cloud-policy-manager-connect-trace", ::crash_keys::kMediumSize}, - // TODO(sunnyps): Remove after fixing crbug.com/724999. {"gl-context-set-current-stack-trace", ::crash_keys::kMediumSize}, };
diff --git a/chromeos/CHROMEOS_LKGM b/chromeos/CHROMEOS_LKGM index 9fa8e46c..1c8e1879 100644 --- a/chromeos/CHROMEOS_LKGM +++ b/chromeos/CHROMEOS_LKGM
@@ -1 +1 @@ -10213.0.0 \ No newline at end of file +10216.0.0 \ No newline at end of file
diff --git a/chromeos/chromeos_switches.cc b/chromeos/chromeos_switches.cc index 0980a99..73fb7581 100644 --- a/chromeos/chromeos_switches.cc +++ b/chromeos/chromeos_switches.cc
@@ -293,6 +293,9 @@ // Disables material design Error screen. const char kDisableMdErrorScreen[] = "disable-md-error-screen"; +// Disables Settings based network configuration dialogs. +const char kDisableNetworkSettingsConfig[] = "disable-network-settings-config"; + // Enables notifications about captive portals in session. const char kEnableNetworkPortalNotification[] = "enable-network-portal-notification"; @@ -435,9 +438,6 @@ // devices in other categories this flag must be missing. const char kNeedArcMigrationPolicyCheck[] = "need-arc-migration-policy-check"; -// Enables Settings based network config in MD Settings. -const char kNetworkSettingsConfig[] = "network-settings-config"; - // An optional comma-separated list of IDs of apps that can be used to take // notes. If unset, a hardcoded list is used instead. const char kNoteTakingAppIds[] = "note-taking-app-ids"; @@ -654,5 +654,10 @@ kDisableSigninFrameClientCertUserSelection); } +bool IsNetworkSettingsConfigEnabled() { + return !base::CommandLine::ForCurrentProcess()->HasSwitch( + chromeos::switches::kDisableNetworkSettingsConfig); +} + } // namespace switches } // namespace chromeos
diff --git a/chromeos/chromeos_switches.h b/chromeos/chromeos_switches.h index 5dbb84d..07884718 100644 --- a/chromeos/chromeos_switches.h +++ b/chromeos/chromeos_switches.h
@@ -90,6 +90,7 @@ CHROMEOS_EXPORT extern const char kTetherStub[]; CHROMEOS_EXPORT extern const char kDisableMdOobe[]; CHROMEOS_EXPORT extern const char kDisableMdErrorScreen[]; +CHROMEOS_EXPORT extern const char kDisableNetworkSettingsConfig[]; CHROMEOS_EXPORT extern const char kEnableNetworkPortalNotification[]; CHROMEOS_EXPORT extern const char kEnablePhysicalKeyboardAutocorrect[]; CHROMEOS_EXPORT extern const char kEnableRequestTabletSite[]; @@ -130,7 +131,6 @@ CHROMEOS_EXPORT extern const char kMemoryPressureThresholds[]; CHROMEOS_EXPORT extern const char kNaturalScrollDefault[]; CHROMEOS_EXPORT extern const char kNeedArcMigrationPolicyCheck[]; -CHROMEOS_EXPORT extern const char kNetworkSettingsConfig[]; CHROMEOS_EXPORT extern const char kNoteTakingAppIds[]; CHROMEOS_EXPORT extern const char kOobeBootstrappingMaster[]; CHROMEOS_EXPORT extern const char kOobeForceShowScreen[]; @@ -179,6 +179,9 @@ // Returns true if voice interaction is enabled. CHROMEOS_EXPORT bool IsVoiceInteractionEnabled(); +// Returns true if Settings based network configuration is enabled. +CHROMEOS_EXPORT bool IsNetworkSettingsConfigEnabled(); + // Returns true if Zip Archiver is enabled for unpacking files. CHROMEOS_EXPORT bool IsZipArchiverUnpackerEnabled();
diff --git a/chromeos/network/client_cert_resolver.cc b/chromeos/network/client_cert_resolver.cc index a358ad69..5c479b4e 100644 --- a/chromeos/network/client_cert_resolver.cc +++ b/chromeos/network/client_cert_resolver.cc
@@ -123,9 +123,13 @@ bool operator()(const CertAndIssuer& cert_and_issuer) { if (!pattern.issuer().Empty() || !pattern.subject().Empty()) { + // Allow UTF-8 inside PrintableStrings in client certificates. See + // crbug.com/770323 and crbug.com/788655. + net::X509Certificate::UnsafeCreateOptions options; + options.printable_string_is_utf8 = true; scoped_refptr<net::X509Certificate> x509_cert = net::x509_util::CreateX509CertificateFromCERTCertificate( - cert_and_issuer.cert.get()); + cert_and_issuer.cert.get(), {}, options); if (!x509_cert) return false; if (!pattern.issuer().Empty() &&
diff --git a/chromeos/network/client_cert_resolver_unittest.cc b/chromeos/network/client_cert_resolver_unittest.cc index 2041f97..92f9366 100644 --- a/chromeos/network/client_cert_resolver_unittest.cc +++ b/chromeos/network/client_cert_resolver_unittest.cc
@@ -32,6 +32,7 @@ #include "crypto/scoped_test_nss_db.h" #include "net/base/net_errors.h" #include "net/cert/nss_cert_database_chromeos.h" +#include "net/cert/pem_tokenizer.h" #include "net/cert/x509_certificate.h" #include "net/cert/x509_util_nss.h" #include "net/test/cert_test_util.h" @@ -43,10 +44,10 @@ namespace { -const char* kWifiStub = "wifi_stub"; -const char* kWifiSSID = "wifi_ssid"; -const char* kUserProfilePath = "user_profile"; -const char* kUserHash = "user_hash"; +constexpr char kWifiStub[] = "wifi_stub"; +constexpr char kWifiSSID[] = "wifi_ssid"; +constexpr char kUserProfilePath[] = "user_profile"; +constexpr char kUserHash[] = "user_hash"; } // namespace @@ -106,9 +107,10 @@ } } - // Imports a client certificate. Its PKCS#11 ID is stored in |test_cert_id_|. - // If |import_issuer| is true, also imports the CA cert (stored as PEM in - // test_ca_cert_pem_) that issued the client certificate. + // Imports a client certificate. After a subsequent StartCertLoader() + // invocation, the PKCS#11 ID of the imported certificate will be stored in + // |test_cert_id_|. If |import_issuer| is true, also imports the CA cert + // (stored as PEM in test_ca_cert_pem_) that issued the client certificate. void SetupTestCerts(const std::string& prefix, bool import_issuer) { // Load a CA cert. net::ScopedCERTCertificateList ca_cert_list = @@ -134,6 +136,35 @@ ASSERT_TRUE(test_client_cert_.get()); } + // Imports a client certificate with a subject CommonName encoded as + // PrintableString, but containing invalid characters. It is imported into the + // user slot. After a subsequent StartCertLoader() invocation, the PKCS#11 ID + // of the imported certificate will be stored in |test_cert_id_|. + void SetupTestCertWithBadPrintableString() { + base::FilePath certs_dir = net::GetTestNetDataDirectory().AppendASCII( + "parse_certificate_unittest"); + ASSERT_TRUE(net::ImportSensitiveKeyFromFile( + certs_dir, "v3_certificate_template.pk8", test_nssdb_.slot())); + + std::string file_data; + ASSERT_TRUE(base::ReadFileToString( + certs_dir.AppendASCII( + "subject_printable_string_containing_utf8_client_cert.pem"), + &file_data)); + + net::PEMTokenizer pem_tokenizer(file_data, {"CERTIFICATE"}); + ASSERT_TRUE(pem_tokenizer.GetNext()); + std::string cert_der(pem_tokenizer.data()); + ASSERT_FALSE(pem_tokenizer.GetNext()); + + test_client_cert_ = net::x509_util::CreateCERTCertificateFromBytes( + reinterpret_cast<const uint8_t*>(cert_der.data()), cert_der.size()); + ASSERT_TRUE(test_client_cert_); + + ASSERT_TRUE(net::ImportClientCertToSlot(test_client_cert_.get(), + test_nssdb_.slot())); + } + void SetupTestCertInSystemToken(const std::string& prefix) { test_nsscertdb_->SetSystemSlot( crypto::ScopedPK11Slot(PK11_ReferenceSlot(test_system_nssdb_.slot()))); @@ -190,9 +221,10 @@ } // Sets up a policy with a certificate pattern that matches any client cert - // with a certain Issuer CN. It will match the test client cert. + // with a certain Issuer CN. It will match the test client cert imported by + // SetupTestCerts. void SetupPolicyMatchingIssuerCN(onc::ONCSource onc_source) { - const char* kTestPolicy = + const char* test_policy = "[ { \"GUID\": \"wifi_stub\"," " \"Name\": \"wifi_stub\"," " \"Type\": \"WiFi\"," @@ -214,7 +246,47 @@ std::string error; std::unique_ptr<base::Value> policy_value = base::JSONReader::ReadAndReturnError( - kTestPolicy, base::JSON_ALLOW_TRAILING_COMMAS, nullptr, &error); + test_policy, base::JSON_ALLOW_TRAILING_COMMAS, nullptr, &error); + ASSERT_TRUE(policy_value) << error; + + base::ListValue* policy = nullptr; + ASSERT_TRUE(policy_value->GetAsList(&policy)); + + std::string user_hash = + onc_source == onc::ONC_SOURCE_USER_POLICY ? kUserHash : ""; + managed_config_handler_->SetPolicy( + onc_source, user_hash, *policy, + base::DictionaryValue() /* no global network config */); + } + + // Sets up a policy with a certificate pattern that matches any client cert + // with a Subject Organization set to "Blar". It will match the test client + // cert imported by SetupTestCertWithBadPrintableString. + void SetupPolicyMatchingSubjectOrgForBadPrintableStringCert( + onc::ONCSource onc_source) { + const char* test_policy = + "[ { \"GUID\": \"wifi_stub\"," + " \"Name\": \"wifi_stub\"," + " \"Type\": \"WiFi\"," + " \"WiFi\": {" + " \"Security\": \"WPA-EAP\"," + " \"SSID\": \"wifi_ssid\"," + " \"EAP\": {" + " \"Outer\": \"EAP-TLS\"," + " \"ClientCertType\": \"Pattern\"," + " \"ClientCertPattern\": {" + " \"Subject\": {" + " \"Organization\": \"Blar\"" + " }" + " }" + " }" + " }" + "} ]"; + + std::string error; + std::unique_ptr<base::Value> policy_value = + base::JSONReader::ReadAndReturnError( + test_policy, base::JSON_ALLOW_TRAILING_COMMAS, nullptr, &error); ASSERT_TRUE(policy_value) << error; base::ListValue* policy = nullptr; @@ -230,7 +302,7 @@ void SetupCertificateConfigMatchingIssuerCN( onc::ONCSource onc_source, client_cert::ClientCertConfig* client_cert_config) { - const char* kTestOncPattern = + const char* test_onc_pattern = "{" " \"Issuer\": {" " \"CommonName\": \"B CA\"" @@ -238,8 +310,9 @@ "}"; std::string error; std::unique_ptr<base::Value> onc_pattern_value = - base::JSONReader::ReadAndReturnError( - kTestOncPattern, base::JSON_ALLOW_TRAILING_COMMAS, nullptr, &error); + base::JSONReader::ReadAndReturnError(test_onc_pattern, + base::JSON_ALLOW_TRAILING_COMMAS, + nullptr, &error); ASSERT_TRUE(onc_pattern_value) << error; base::DictionaryValue* onc_pattern_dict; @@ -254,7 +327,7 @@ // particular it will match the test client cert. void SetupPolicyMatchingIssuerPEM(onc::ONCSource onc_source, const std::string& identity) { - const char* kTestPolicyTemplate = + const char* test_policy_template = "[ { \"GUID\": \"wifi_stub\"," " \"Name\": \"wifi_stub\"," " \"Type\": \"WiFi\"," @@ -272,7 +345,7 @@ " }" "} ]"; std::string policy_json = base::StringPrintf( - kTestPolicyTemplate, identity.c_str(), test_ca_cert_pem_.c_str()); + test_policy_template, identity.c_str(), test_ca_cert_pem_.c_str()); std::string error; std::unique_ptr<base::Value> policy_value = @@ -374,6 +447,32 @@ EXPECT_EQ(1, network_properties_changed_count_); } +// Test that matching works on a certificate with invalid characters in a +// PrintableString field. See crbug.com/788655. +TEST_F(ClientCertResolverTest, MatchSubjectOrgOnBadPrintableStringCert) { + ASSERT_NO_FATAL_FAILURE(SetupTestCertWithBadPrintableString()); + + SetupWifi(); + scoped_task_environment_.RunUntilIdle(); + + SetupNetworkHandlers(); + ASSERT_NO_FATAL_FAILURE( + SetupPolicyMatchingSubjectOrgForBadPrintableStringCert( + onc::ONC_SOURCE_USER_POLICY)); + scoped_task_environment_.RunUntilIdle(); + + network_properties_changed_count_ = 0; + StartCertLoader(); + scoped_task_environment_.RunUntilIdle(); + + // Verify that the resolver positively matched the pattern in the policy with + // the test client cert and configured the network. + std::string pkcs11_id; + GetServiceProperty(shill::kEapCertIdProperty, &pkcs11_id); + EXPECT_EQ(test_cert_id_, pkcs11_id); + EXPECT_EQ(1, network_properties_changed_count_); +} + TEST_F(ClientCertResolverTest, ResolveOnCertificatesLoaded) { SetupTestCerts("client_1", true /* import issuer */); SetupWifi();
diff --git a/chromeos/network/network_type_pattern.cc b/chromeos/network/network_type_pattern.cc index 995d8c0..02ad06f 100644 --- a/chromeos/network/network_type_pattern.cc +++ b/chromeos/network/network_type_pattern.cc
@@ -18,6 +18,7 @@ const char kPatternWireless[] = "PatternWireless"; const char kPatternMobile[] = "PatternMobile"; const char kPatternNonVirtual[] = "PatternNonVirtual"; +const char kPatternPhysical[] = "PatternPhysical"; enum NetworkTypeBitFlag { kNetworkTypeNone = 0, @@ -72,6 +73,12 @@ } // static +NetworkTypePattern NetworkTypePattern::Physical() { + return NetworkTypePattern(kNetworkTypeWifi | kNetworkTypeWimax | + kNetworkTypeCellular | kNetworkTypeEthernet); +} + +// static NetworkTypePattern NetworkTypePattern::NonVirtual() { return NetworkTypePattern(~(kNetworkTypeVPN)); } @@ -139,6 +146,11 @@ return pattern_ & other_pattern.pattern_; } +NetworkTypePattern NetworkTypePattern::operator|( + const NetworkTypePattern& other) const { + return NetworkTypePattern(pattern_ | other.pattern_); +} + std::string NetworkTypePattern::ToDebugString() const { if (Equals(Default())) return kPatternDefault; @@ -146,6 +158,8 @@ return kPatternWireless; if (Equals(Mobile())) return kPatternMobile; + if (Equals(Physical())) + return kPatternPhysical; if (Equals(NonVirtual())) return kPatternNonVirtual;
diff --git a/chromeos/network/network_type_pattern.h b/chromeos/network/network_type_pattern.h index 2995b6b..ea55b42 100644 --- a/chromeos/network/network_type_pattern.h +++ b/chromeos/network/network_type_pattern.h
@@ -23,6 +23,9 @@ // Matches Cellular, WiMAX, or Tether networks. static NetworkTypePattern Mobile(); + // Matches Physical networks (i.e. excludes Tether and VPN). + static NetworkTypePattern Physical(); + // Matches non virtual networks. static NetworkTypePattern NonVirtual(); @@ -55,6 +58,8 @@ // See the unit test for examples. bool MatchesPattern(const NetworkTypePattern& other_pattern) const; + NetworkTypePattern operator|(const NetworkTypePattern& other) const; + std::string ToDebugString() const; private:
diff --git a/chromeos/network/network_type_pattern_unittest.cc b/chromeos/network/network_type_pattern_unittest.cc index ccc3264..3ed6ce14 100644 --- a/chromeos/network/network_type_pattern_unittest.cc +++ b/chromeos/network/network_type_pattern_unittest.cc
@@ -19,6 +19,7 @@ default_(NetworkTypePattern::Default()), ethernet_(NetworkTypePattern::Ethernet()), mobile_(NetworkTypePattern::Mobile()), + physical_(NetworkTypePattern::Physical()), non_virtual_(NetworkTypePattern::NonVirtual()), wimax_(NetworkTypePattern::Wimax()), wireless_(NetworkTypePattern::Wireless()), @@ -38,6 +39,7 @@ const NetworkTypePattern default_; const NetworkTypePattern ethernet_; const NetworkTypePattern mobile_; + const NetworkTypePattern physical_; const NetworkTypePattern non_virtual_; const NetworkTypePattern wimax_; const NetworkTypePattern wireless_; @@ -65,6 +67,14 @@ EXPECT_FALSE(wireless_.MatchesType(shill::kTypeEthernet)); EXPECT_FALSE(wireless_.MatchesType(shill::kTypeVPN)); + // Networks managed by Shill (excludes Tether and VPN). + EXPECT_TRUE(physical_.MatchesType(shill::kTypeCellular)); + EXPECT_TRUE(physical_.MatchesType(shill::kTypeWifi)); + EXPECT_TRUE(physical_.MatchesType(shill::kTypeEthernet)); + EXPECT_TRUE(physical_.MatchesType(shill::kTypeWimax)); + EXPECT_FALSE(physical_.MatchesType(kTypeTether)); + EXPECT_FALSE(physical_.MatchesType(shill::kTypeVPN)); + // Non-virtual contains everything except VPN. EXPECT_TRUE(non_virtual_.MatchesType(shill::kTypeCellular)); EXPECT_TRUE(non_virtual_.MatchesType(shill::kTypeWifi)); @@ -121,6 +131,13 @@ EXPECT_TRUE(primitive_wimax.Equals(wimax_)); } +TEST_F(NetworkTypePatternTest, Or) { + NetworkTypePattern compound = wifi_ | cellular_; + EXPECT_TRUE(cellular_.MatchesPattern(compound)); + EXPECT_TRUE(wifi_.MatchesPattern(compound)); + EXPECT_FALSE(ethernet_.MatchesPattern(compound)); +} + TEST_F(NetworkTypePatternTest, ToDebugString) { EXPECT_EQ(default_.ToDebugString(), "PatternDefault"); EXPECT_EQ(wireless_.ToDebugString(), "PatternWireless");
diff --git a/components/BUILD.gn b/components/BUILD.gn index 8762223..58ba2492 100644 --- a/components/BUILD.gn +++ b/components/BUILD.gn
@@ -445,7 +445,8 @@ "//content/test:browsertest_support", "//content/test:test_support", "//device/bluetooth", - "//device/geolocation", + "//device/geolocation/public/cpp:test_support", + "//device/geolocation/public/interfaces", "//ipc:test_support", "//net:test_support", "//printing/features",
diff --git a/components/autofill/content/browser/BUILD.gn b/components/autofill/content/browser/BUILD.gn index e2d7717..94c98d47 100644 --- a/components/autofill/content/browser/BUILD.gn +++ b/components/autofill/content/browser/BUILD.gn
@@ -33,7 +33,6 @@ "//components/user_prefs", "//content/public/browser", "//content/public/common", - "//device/geolocation", "//device/geolocation/public/cpp", "//device/geolocation/public/interfaces", "//gpu/config",
diff --git a/components/autofill/content/browser/risk/fingerprint_browsertest.cc b/components/autofill/content/browser/risk/fingerprint_browsertest.cc index 4ff4ce5..12245ec0 100644 --- a/components/autofill/content/browser/risk/fingerprint_browsertest.cc +++ b/components/autofill/content/browser/risk/fingerprint_browsertest.cc
@@ -15,15 +15,12 @@ #include "components/autofill/content/browser/risk/proto/fingerprint.pb.h" #include "content/public/browser/gpu_data_manager.h" #include "content/public/common/screen_info.h" +#include "content/public/common/service_manager_connection.h" #include "content/public/test/content_browser_test.h" #include "content/public/test/test_utils.h" -#include "device/geolocation/public/interfaces/geolocation.mojom.h" -#include "device/geolocation/public/interfaces/geolocation_context.mojom.h" +#include "device/geolocation/public/cpp/scoped_geolocation_overrider.h" #include "device/geolocation/public/interfaces/geoposition.mojom.h" -#include "mojo/public/cpp/bindings/binding.h" -#include "services/device/public/interfaces/constants.mojom.h" #include "services/service_manager/public/cpp/connector.h" -#include "services/service_manager/public/interfaces/connector.mojom.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/WebKit/public/platform/WebRect.h" @@ -31,41 +28,6 @@ using testing::ElementsAre; -namespace { - -class FakeGeolocation : public device::mojom::GeolocationContext, - public device::mojom::Geolocation { - public: - explicit FakeGeolocation(device::mojom::Geoposition& position) - : binding_context_(this), binding_(this), position_(position) {} - ~FakeGeolocation() override {} - - void Bind(mojo::ScopedMessagePipeHandle handle) { - binding_context_.Bind( - device::mojom::GeolocationContextRequest(std::move(handle))); - } - - // device::mojom::Geolocation implementation: - void QueryNextPosition(QueryNextPositionCallback callback) override { - std::move(callback).Run(position_.Clone()); - } - void SetHighAccuracy(bool high_accuracy) override {} - - // device::mojom::GeolocationContext implementation: - void BindGeolocation(device::mojom::GeolocationRequest request) override { - binding_.Bind(std::move(request)); - } - void SetOverride(device::mojom::GeopositionPtr geoposition) override {} - void ClearOverride() override {} - - private: - mojo::Binding<device::mojom::GeolocationContext> binding_context_; - mojo::Binding<device::mojom::Geolocation> binding_; - device::mojom::Geoposition position_; -}; - -} // namespace - namespace autofill { namespace risk { @@ -123,15 +85,9 @@ position.accuracy = kAccuracy; position.timestamp = base::Time::UnixEpoch() + base::TimeDelta::FromMilliseconds(kGeolocationTime); - fake_geolocation_ = std::make_unique<FakeGeolocation>(position); - service_manager::mojom::ConnectorRequest request; - connector_ = service_manager::Connector::Create(&request); - service_manager::Connector::TestApi test_api(connector_.get()); - test_api.OverrideBinderForTesting( - device::mojom::kServiceName, device::mojom::GeolocationContext::Name_, - base::Bind(&FakeGeolocation::Bind, - base::Unretained(fake_geolocation_.get()))); + geolocation_overrider_ = + std::make_unique<device::ScopedGeolocationOverrider>(position); } void GetFingerprintTestCallback(base::OnceClosure continuation_callback, @@ -242,8 +198,7 @@ const gfx::Rect available_screen_bounds_; const gfx::Rect unavailable_screen_bounds_; - std::unique_ptr<service_manager::Connector> connector_; - std::unique_ptr<FakeGeolocation> fake_geolocation_; + std::unique_ptr<device::ScopedGeolocationOverrider> geolocation_overrider_; // A message loop to block on the asynchronous loading of the fingerprint. base::MessageLoopForUI message_loop_; @@ -264,7 +219,7 @@ base::TimeDelta::FromDays(1), // Ought to be longer than any test run. base::Bind(&AutofillRiskFingerprintTest::GetFingerprintTestCallback, base::Unretained(this), run_loop.QuitWhenIdleClosure()), - connector_.get()); + content::ServiceManagerConnection::GetForProcess()->GetConnector()); // Wait for the callback to be called. run_loop.Run();
diff --git a/components/autofill/core/browser/ui/card_unmask_prompt_controller_impl.cc b/components/autofill/core/browser/ui/card_unmask_prompt_controller_impl.cc index 84d9457..8d023e8 100644 --- a/components/autofill/core/browser/ui/card_unmask_prompt_controller_impl.cc +++ b/components/autofill/core/browser/ui/card_unmask_prompt_controller_impl.cc
@@ -117,7 +117,7 @@ void CardUnmaskPromptControllerImpl::OnUnmaskDialogClosed() { card_unmask_view_ = nullptr; LogOnCloseEvents(); - if (delegate_.get()) + if (delegate_) delegate_->OnUnmaskPromptClosed(); } @@ -208,7 +208,10 @@ pending_response_.should_store_pan = false; } - delegate_->OnUnmaskResponse(pending_response_); + // There is a chance the delegate has disappeared (i.e. tab closed) before the + // unmask response came in. Avoid a crash. + if (delegate_) + delegate_->OnUnmaskResponse(pending_response_); } void CardUnmaskPromptControllerImpl::NewCardLinkClicked() {
diff --git a/components/autofill/core/browser/webdata/autofill_wallet_syncable_service.h b/components/autofill/core/browser/webdata/autofill_wallet_syncable_service.h index 9e823ae9..9b4e92a2 100644 --- a/components/autofill/core/browser/webdata/autofill_wallet_syncable_service.h +++ b/components/autofill/core/browser/webdata/autofill_wallet_syncable_service.h
@@ -76,6 +76,7 @@ FRIEND_TEST_ALL_PREFIXES(AutofillWalletSyncableServiceTest, CopyRelevantMetadataFromDisk_KeepUseStats); FRIEND_TEST_ALL_PREFIXES(AutofillWalletSyncableServiceTest, NewWalletCard); + FRIEND_TEST_ALL_PREFIXES(AutofillWalletSyncableServiceTest, EmptyNameOnCard); syncer::SyncMergeResult SetSyncData(const syncer::SyncDataList& data_list);
diff --git a/components/autofill/core/browser/webdata/autofill_wallet_syncable_service_unittest.cc b/components/autofill/core/browser/webdata/autofill_wallet_syncable_service_unittest.cc index 9c6375b..f407085 100644 --- a/components/autofill/core/browser/webdata/autofill_wallet_syncable_service_unittest.cc +++ b/components/autofill/core/browser/webdata/autofill_wallet_syncable_service_unittest.cc
@@ -222,4 +222,28 @@ EXPECT_EQ(arbitrary_time, wallet_cards.back().use_date()); } +// Verify that name on card can be empty. +TEST(AutofillWalletSyncableServiceTest, EmptyNameOnCard) { + std::vector<CreditCard> wallet_cards; + std::vector<AutofillProfile> wallet_addresses; + syncer::SyncDataList data_list; + + // Create a Sync data for a card and its billing address. + data_list.push_back(CreateSyncDataForWalletCreditCard( + "card1" /* id */, "1" /* billing_address_id */)); + + AutofillWalletSyncableService::PopulateWalletCardsAndAddresses( + data_list, &wallet_cards, &wallet_addresses); + + ASSERT_EQ(1U, wallet_cards.size()); + + // Make sure card holder name can be empty. + EXPECT_TRUE( + wallet_cards.back().GetRawInfo(autofill::CREDIT_CARD_NAME_FULL).empty()); + EXPECT_TRUE( + wallet_cards.back().GetRawInfo(autofill::CREDIT_CARD_NAME_FIRST).empty()); + EXPECT_TRUE( + wallet_cards.back().GetRawInfo(autofill::CREDIT_CARD_NAME_LAST).empty()); +} + } // namespace autofill
diff --git a/components/autofill/ios/browser/autofill_agent.mm b/components/autofill/ios/browser/autofill_agent.mm index 9e85b0bcf..0817635 100644 --- a/components/autofill/ios/browser/autofill_agent.mm +++ b/components/autofill/ios/browser/autofill_agent.mm
@@ -149,6 +149,10 @@ // key/value suggestions if the user hasn't started typing. - (NSArray*)processSuggestions:(NSArray*)suggestions; +// Sends the the |formData| to the JavaScript manager of |webState_| to actually +// fill the data. +- (void)sendDataToWebState:(NSString*)formData; + @end @implementation AutofillAgent { @@ -192,6 +196,8 @@ // The reference is weak because a weak pointer is sent to our // AutofillManagerDelegate. base::WeakPtr<autofill::AutofillPopupDelegate> popupDelegate_; + // The autofill data that needs to be send when the |webState_| is shown. + NSString* pendingFormData_; } - (instancetype)initWithPrefService:(PrefService*)prefService @@ -557,9 +563,15 @@ fieldType:(NSString*)fieldType type:(NSString*)type typedValue:(NSString*)typedValue + isMainFrame:(BOOL)isMainFrame webState:(web::WebState*)webState completionHandler: (SuggestionsAvailableCompletion)completion { + if (!isMainFrame) { + // Filling in iframes is not implemented. + completion(NO); + return; + } web::URLVerificationTrustLevel trustLevel; const GURL pageURL(webState->GetCurrentURL(&trustLevel)); if (trustLevel != web::URLVerificationTrustLevel::kAbsolute) { @@ -645,9 +657,22 @@ [self detachFromWebState]; } +- (void)webStateWasShown:(web::WebState*)webState { + DCHECK_EQ(webState_, webState); + if (pendingFormData_) { + [self sendDataToWebState:pendingFormData_]; + } + pendingFormData_ = nil; +} + - (void)webState:(web::WebState*)webState didSubmitDocumentWithFormNamed:(const std::string&)formName - userInitiated:(BOOL)userInitiated { + userInitiated:(BOOL)userInitiated + isMainFrame:(BOOL)isMainFrame { + if (!isMainFrame) { + // Saving from iframes is not implemented. + return; + } DCHECK_EQ(webState_, webState); if (!prefService_->GetBoolean(autofill::prefs::kAutofillEnabled)) return; @@ -866,14 +891,24 @@ // Stringify the JSON data and send it to the UIWebView-side fillForm method. std::string dataString; base::JSONWriter::Write(*formData.get(), &dataString); + NSString* nsDataString = base::SysUTF8ToNSString(dataString); + if (!webState_->IsVisible()) { + pendingFormData_ = nsDataString; + return; + } + [self sendDataToWebState:nsDataString]; +} + +- (void)sendDataToWebState:(NSString*)formData { + DCHECK(webState_->IsVisible()); // It is possible that the fill was not initiated by selecting a suggestion. // In this case we provide an empty callback. if (!suggestionHandledCompletion_) suggestionHandledCompletion_ = [^{ } copy]; [jsAutofillManager_ - fillForm:base::SysUTF8ToNSString(dataString) + fillForm:formData forceFillFieldName:base::SysUTF16ToNSString(pendingAutocompleteField_) completionHandler:suggestionHandledCompletion_]; suggestionHandledCompletion_ = nil;
diff --git a/components/autofill/ios/browser/fake_autofill_agent.mm b/components/autofill/ios/browser/fake_autofill_agent.mm index 6e52b7b6..d31d9ea 100644 --- a/components/autofill/ios/browser/fake_autofill_agent.mm +++ b/components/autofill/ios/browser/fake_autofill_agent.mm
@@ -55,6 +55,7 @@ fieldType:(NSString*)fieldType type:(NSString*)type typedValue:(NSString*)typedValue + isMainFrame:(BOOL)isMainFrame webState:(web::WebState*)webState completionHandler: (SuggestionsAvailableCompletion)completion {
diff --git a/components/autofill/ios/browser/form_suggestion_provider.h b/components/autofill/ios/browser/form_suggestion_provider.h index d4ad1f0..5b889bd 100644 --- a/components/autofill/ios/browser/form_suggestion_provider.h +++ b/components/autofill/ios/browser/form_suggestion_provider.h
@@ -30,6 +30,7 @@ fieldType:(NSString*)fieldType type:(NSString*)type typedValue:(NSString*)typedValue + isMainFrame:(BOOL)isMainFrame webState:(web::WebState*)webState completionHandler: (SuggestionsAvailableCompletion)completion;
diff --git a/components/cloud_devices/common/cloud_device_description.cc b/components/cloud_devices/common/cloud_device_description.cc index d4036ce..af2ca39 100644 --- a/components/cloud_devices/common/cloud_device_description.cc +++ b/components/cloud_devices/common/cloud_device_description.cc
@@ -9,42 +9,26 @@ #include "base/json/json_reader.h" #include "base/json/json_writer.h" #include "base/logging.h" -#include "base/memory/ptr_util.h" #include "base/values.h" #include "components/cloud_devices/common/cloud_device_description_consts.h" namespace cloud_devices { -CloudDeviceDescription::CloudDeviceDescription() { - Reset(); -} - -CloudDeviceDescription::~CloudDeviceDescription() { -} - -void CloudDeviceDescription::Reset() { - root_.reset(new base::DictionaryValue); +CloudDeviceDescription::CloudDeviceDescription() + : root_(std::make_unique<base::DictionaryValue>()) { root_->SetString(json::kVersion, json::kVersion10); } -bool CloudDeviceDescription::InitFromDictionary( - std::unique_ptr<base::DictionaryValue> root) { - if (!root) - return false; - Reset(); - root_ = std::move(root); - std::string version; - root_->GetString(json::kVersion, &version); - return version == json::kVersion10; -} +CloudDeviceDescription::~CloudDeviceDescription() = default; bool CloudDeviceDescription::InitFromString(const std::string& json) { - std::unique_ptr<base::Value> parsed = base::JSONReader::Read(json); - base::DictionaryValue* description = nullptr; - if (!parsed || !parsed->GetAsDictionary(&description)) + auto parsed = base::DictionaryValue::From(base::JSONReader::Read(json)); + if (!parsed) return false; - ignore_result(parsed.release()); - return InitFromDictionary(base::WrapUnique(description)); + + root_ = std::move(parsed); + const base::Value* version = root_->FindKey(json::kVersion); + return version && version->GetString() == json::kVersion10; } std::string CloudDeviceDescription::ToString() const { @@ -63,7 +47,7 @@ base::DictionaryValue* CloudDeviceDescription::CreateItem( const std::string& path) { - return root_->SetDictionary(path, base::MakeUnique<base::DictionaryValue>()); + return root_->SetDictionary(path, std::make_unique<base::DictionaryValue>()); } const base::ListValue* CloudDeviceDescription::GetListItem( @@ -75,7 +59,7 @@ base::ListValue* CloudDeviceDescription::CreateListItem( const std::string& path) { - return root_->SetList(path, base::MakeUnique<base::ListValue>()); + return root_->SetList(path, std::make_unique<base::ListValue>()); } } // namespace cloud_devices
diff --git a/components/cloud_devices/common/cloud_device_description.h b/components/cloud_devices/common/cloud_device_description.h index eb6e207..c840424b 100644 --- a/components/cloud_devices/common/cloud_device_description.h +++ b/components/cloud_devices/common/cloud_device_description.h
@@ -8,7 +8,6 @@ #include <memory> #include <string> -#include "base/callback.h" #include "base/macros.h" namespace base { @@ -26,9 +25,6 @@ CloudDeviceDescription(); ~CloudDeviceDescription(); - void Reset(); - - bool InitFromDictionary(std::unique_ptr<base::DictionaryValue> root); bool InitFromString(const std::string& json); std::string ToString() const;
diff --git a/components/crash/core/common/BUILD.gn b/components/crash/core/common/BUILD.gn index e7692042..e995b54 100644 --- a/components/crash/core/common/BUILD.gn +++ b/components/crash/core/common/BUILD.gn
@@ -57,12 +57,18 @@ } else if (use_stubs) { sources += [ "crash_key_stubs.cc" ] } else { - include_dirs = [ "//third_party/breakpad/breakpad/src/" ] + include_dirs = [ "//third_party/breakpad/breakpad/src" ] - sources += [ - "crash_key_breakpad.cc", - "crash_key_internal.h", - ] + if (is_ios) { + sources += [ "crash_key_breakpad_ios.mm" ] + + configs += [ "//build/config/compiler:enable_arc" ] + } else { + sources += [ + "crash_key_breakpad.cc", + "crash_key_internal.h", + ] + } deps += [ "//third_party/breakpad:client" ] }
diff --git a/components/crash/core/common/DEPS b/components/crash/core/common/DEPS new file mode 100644 index 0000000..ef815737 --- /dev/null +++ b/components/crash/core/common/DEPS
@@ -0,0 +1,4 @@ +include_rules = [ + "+third_party/breakpad/breakpad/src/client/ios/Breakpad.h", + "+third_party/breakpad/breakpad/src/client/ios/BreakpadController.h", +]
diff --git a/components/crash/core/common/crash_key_breakpad.cc b/components/crash/core/common/crash_key_breakpad.cc index 3375e72..47b9597 100644 --- a/components/crash/core/common/crash_key_breakpad.cc +++ b/components/crash/core/common/crash_key_breakpad.cc
@@ -14,8 +14,8 @@ #include "components/crash/core/common/crash_key_base_support.h" #include "components/crash/core/common/crash_key_internal.h" -#if (defined(OS_MACOSX) && !defined(OS_IOS)) || defined(OS_WIN) -#error "This file should not be used when Crashpad is available." +#if defined(OS_MACOSX) || defined(OS_IOS) || defined(OS_WIN) +#error "This file should not be used when Crashpad is available, nor on iOS." #endif namespace crash_reporter {
diff --git a/components/crash/core/common/crash_key_breakpad_ios.mm b/components/crash/core/common/crash_key_breakpad_ios.mm new file mode 100644 index 0000000..b476937 --- /dev/null +++ b/components/crash/core/common/crash_key_breakpad_ios.mm
@@ -0,0 +1,76 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/crash/core/common/crash_key.h" + +#include <dispatch/dispatch.h> + +#include "base/strings/sys_string_conversions.h" +#include "components/crash/core/common/crash_key_base_support.h" +#import "third_party/breakpad/breakpad/src/client/ios/Breakpad.h" +#import "third_party/breakpad/breakpad/src/client/ios/BreakpadController.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +// The iOS Breakpad implementation internally uses a LongStringDictionary, +// which performs the same chunking done by crash_key_breakpad.cc. This class +// implementation therefore just wraps the iOS Breakpad interface. + +namespace crash_reporter { +namespace internal { + +namespace { + +// Accessing the BreakpadRef is done on an async queue, so serialize the +// access to the current thread, as the CrashKeyString API is sync. This +// matches //ios/chrome/browser/crash_report/breakpad_helper.mm. +void WithBreakpadRefSync(void (^block)(BreakpadRef ref)) { + dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); + + [[BreakpadController sharedInstance] withBreakpadRef:^(BreakpadRef ref) { + block(ref); + dispatch_semaphore_signal(semaphore); + }]; + dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER); +} + +} // namespace + +void CrashKeyStringImpl::Set(base::StringPiece value) { + NSString* key = base::SysUTF8ToNSString(name_); + NSString* value_ns = base::SysUTF8ToNSString(value.as_string()); + + WithBreakpadRefSync(^(BreakpadRef ref) { + BreakpadSetKeyValue(ref, key, value_ns); + }); +} + +void CrashKeyStringImpl::Clear() { + NSString* key = base::SysUTF8ToNSString(name_); + + WithBreakpadRefSync(^(BreakpadRef ref) { + BreakpadRemoveKeyValue(ref, key); + }); +} + +bool CrashKeyStringImpl::is_set() const { + __block bool is_set = false; + NSString* key = base::SysUTF8ToNSString(name_); + + WithBreakpadRefSync(^(BreakpadRef ref) { + is_set = BreakpadKeyValue(ref, key) != nil; + }); + + return is_set; +} + +} // namespace internal + +void InitializeCrashKeys() { + InitializeCrashKeyBaseSupport(); +} + +} // namespace crash_reporter
diff --git a/components/cronet/android/BUILD.gn b/components/cronet/android/BUILD.gn index 9cf1ed7..0ec7cb9 100644 --- a/components/cronet/android/BUILD.gn +++ b/components/cronet/android/BUILD.gn
@@ -1213,6 +1213,7 @@ "$target_gen_dir/cronet_impl_native_proguard.cfg", "//AUTHORS", "//chrome/VERSION", + "api_version.txt", "cronet_impl_common_proguard.cfg", "cronet_impl_platform_proguard.cfg", ]
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.h index 611402b..fbf7642c 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.h +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.h
@@ -137,6 +137,12 @@ // persists data usage to memory when pref is disabled. void SetDataUsageReportingEnabled(bool enabled); + // Returns |data_usage_map_|. + const DataReductionProxyCompressionStats::SiteUsageMap& + DataUsageMapForTesting() const { + return data_usage_map_; + } + private: // Enum to track the state of loading data usage from storage. enum CurrentDataUsageLoadStatus { NOT_LOADED = 0, LOADING = 1, LOADED = 2 };
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats_unittest.cc index e37d6b02..567d486 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats_unittest.cc
@@ -142,10 +142,6 @@ now_delta_ += base::TimeDelta::FromHours(hours); } - DataReductionProxyCompressionStats::SiteUsageMap* DataUsageMap() { - return &compression_stats_->data_usage_map_; - } - void SetUpPrefs() { CreatePrefList(prefs::kDailyHttpOriginalContentLength); CreatePrefList(prefs::kDailyHttpReceivedContentLength); @@ -1298,7 +1294,7 @@ DeleteBrowsingHistory(now, now); base::RunLoop().RunUntilIdle(); - ASSERT_TRUE(DataUsageMap()->empty()); + ASSERT_TRUE(compression_stats()->DataUsageMapForTesting().empty()); auto expected_data_usage = base::MakeUnique<std::vector<data_reduction_proxy::DataUsageBucket>>(
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_data_use_observer.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_data_use_observer.cc index 7e70c06..2cecfe72 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_data_use_observer.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_data_use_observer.cc
@@ -132,4 +132,10 @@ } } +void DataReductionProxyDataUseObserver::OnPageDidFinishLoad( + data_use_measurement::DataUse* data_use) { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + // TODO(dougarnett): 781885 - estimate data saving for NoScript. +} + } // namespace data_reduction_proxy
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_data_use_observer.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_data_use_observer.h index aec49c3e..efef0bd97 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_data_use_observer.h +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_data_use_observer.h
@@ -37,7 +37,8 @@ void OnPageLoadCommit(data_use_measurement::DataUse* data_use) override; void OnPageResourceLoad(const net::URLRequest& request, data_use_measurement::DataUse* data_use) override; - void OnPageLoadComplete(data_use_measurement::DataUse* data_use) override {} + void OnPageDidFinishLoad(data_use_measurement::DataUse* data_use) override; + void OnPageLoadConcluded(data_use_measurement::DataUse* data_use) override {} // |data_reduction_proxy_io_data_| owns |this| and is destroyed only after // |this| is destroyed in the IO thread.
diff --git a/components/data_use_measurement/core/data_use_ascriber.h b/components/data_use_measurement/core/data_use_ascriber.h index 4c38b5c..b61bf98 100644 --- a/components/data_use_measurement/core/data_use_ascriber.h +++ b/components/data_use_measurement/core/data_use_ascriber.h
@@ -48,9 +48,14 @@ virtual void OnPageResourceLoad(const net::URLRequest& request, DataUse* data_use) = 0; + // The DidFinishLoad event occurred for the main frame. That is, the page + // load is nominally done (however, the page can still issue more network + // requests between this event and |OnPageLoadConcluded|. + virtual void OnPageDidFinishLoad(DataUse* data_use) = 0; + // The page load completed. This is when the tab is closed or another // navigation starts due to omnibox search, link clicks, page reload, etc. - virtual void OnPageLoadComplete(DataUse* data_use) = 0; + virtual void OnPageLoadConcluded(DataUse* data_use) = 0; }; DataUseAscriber();
diff --git a/components/exo/client_controlled_shell_surface.cc b/components/exo/client_controlled_shell_surface.cc index 1bdaeb0..3724628 100644 --- a/components/exo/client_controlled_shell_surface.cc +++ b/components/exo/client_controlled_shell_surface.cc
@@ -363,6 +363,17 @@ orientation_compositor_lock_.reset(); } +bool ClientControlledShellSurface::IsTouchEnabled(Surface* surface) const { + // The target for input events is selected by recursively hit-testing surfaces + // in the surface tree. During client-driven dragging/resizing, capture is set + // on the root surface. When capture is reset to a different target, mouse + // events are redirected from the old to the new target, but touch/gesture + // events are cancelled. To avoid prematurely ending the drag/resize, ensure + // that the target and capture windows are the same by disabling touch input + // for all but the root surface. + return surface == root_surface(); +} + //////////////////////////////////////////////////////////////////////////////// // aura::WindowObserver overrides: void ClientControlledShellSurface::OnWindowBoundsChanged( @@ -533,6 +544,8 @@ } aura::Window* ClientControlledShellSurface::GetDragWindow() { + // Set capture on the root surface rather than the focus surface, because + // the client may destroy the latter during dragging/resizing. return root_surface() ? root_surface()->window() : nullptr; }
diff --git a/components/exo/client_controlled_shell_surface.h b/components/exo/client_controlled_shell_surface.h index aff25d2..e152472 100644 --- a/components/exo/client_controlled_shell_surface.h +++ b/components/exo/client_controlled_shell_surface.h
@@ -101,6 +101,7 @@ // Overridden from SurfaceDelegate: void OnSurfaceCommit() override; + bool IsTouchEnabled(Surface* surface) const override; // Overridden from views::WidgetDelegate: bool CanResize() const override;
diff --git a/components/exo/shell_surface_base.cc b/components/exo/shell_surface_base.cc index b431039..217e491a 100644 --- a/components/exo/shell_surface_base.cc +++ b/components/exo/shell_surface_base.cc
@@ -608,6 +608,10 @@ } } +bool ShellSurfaceBase::IsTouchEnabled(Surface*) const { + return true; +} + void ShellSurfaceBase::OnSetFrame(SurfaceFrameType type) { // TODO(reveman): Allow frame to change after surface has been enabled. switch (type) {
diff --git a/components/exo/shell_surface_base.h b/components/exo/shell_surface_base.h index d0860fb0..54ccf3a9 100644 --- a/components/exo/shell_surface_base.h +++ b/components/exo/shell_surface_base.h
@@ -157,6 +157,7 @@ // Overridden from SurfaceDelegate: void OnSurfaceCommit() override; + bool IsTouchEnabled(Surface* surface) const override; void OnSetFrame(SurfaceFrameType type) override; void OnSetParent(Surface* parent, const gfx::Point& position) override;
diff --git a/components/exo/sub_surface.cc b/components/exo/sub_surface.cc index e29b755..871899143 100644 --- a/components/exo/sub_surface.cc +++ b/components/exo/sub_surface.cc
@@ -106,7 +106,11 @@ if (is_synchronized_) return true; - return parent_ ? parent_->IsSynchronized() : false; + return parent_ && parent_->IsSynchronized(); +} + +bool SubSurface::IsTouchEnabled(Surface* surface) const { + return !parent_ || parent_->IsTouchEnabled(surface); } ////////////////////////////////////////////////////////////////////////////////
diff --git a/components/exo/sub_surface.h b/components/exo/sub_surface.h index fbd7ad97..4663036 100644 --- a/components/exo/sub_surface.h +++ b/components/exo/sub_surface.h
@@ -51,6 +51,7 @@ // Overridden from SurfaceDelegate: void OnSurfaceCommit() override; bool IsSurfaceSynchronized() const override; + bool IsTouchEnabled(Surface* surface) const override; void OnSetFrame(SurfaceFrameType type) override {} void OnSetParent(Surface* parent, const gfx::Point& position) override {}
diff --git a/components/exo/surface.cc b/components/exo/surface.cc index 70c976d3..b530ad6 100644 --- a/components/exo/surface.cc +++ b/components/exo/surface.cc
@@ -166,6 +166,9 @@ if (!surface) return false; + if (event.IsTouchEvent() && !surface->IsTouchEnabled(surface)) + return false; + gfx::Point local_point = event.location(); if (window->parent()) aura::Window::ConvertPointToTarget(window->parent(), window, @@ -606,7 +609,11 @@ } bool Surface::IsSynchronized() const { - return delegate_ ? delegate_->IsSurfaceSynchronized() : false; + return delegate_ && delegate_->IsSurfaceSynchronized(); +} + +bool Surface::IsTouchEnabled(Surface* surface) const { + return !delegate_ || delegate_->IsTouchEnabled(surface); } bool Surface::HasHitTestRegion() const {
diff --git a/components/exo/surface.h b/components/exo/surface.h index eacb0b1..312d9c6d 100644 --- a/components/exo/surface.h +++ b/components/exo/surface.h
@@ -174,6 +174,9 @@ // Returns true if surface is in synchronized mode. bool IsSynchronized() const; + // Returns true if surface should receive touch events. + bool IsTouchEnabled(Surface* surface) const; + // Returns false if the hit test region is empty. bool HasHitTestRegion() const;
diff --git a/components/exo/surface_delegate.h b/components/exo/surface_delegate.h index eb5f79f0..8c8406d 100644 --- a/components/exo/surface_delegate.h +++ b/components/exo/surface_delegate.h
@@ -23,6 +23,11 @@ // double-buffered state should be synchronized with parent surface. virtual bool IsSurfaceSynchronized() const = 0; + // Returns true if surface should receive touch events. + // TODO(domlaskowski): Remove once client-driven dragging/resizing is removed + // in crbug.com/795119. + virtual bool IsTouchEnabled(Surface* surface) const = 0; + // Called when surface was requested to use a specific frame type. virtual void OnSetFrame(SurfaceFrameType type) = 0;
diff --git a/components/exo/surface_tree_host.cc b/components/exo/surface_tree_host.cc index 5a95020..23b8131 100644 --- a/components/exo/surface_tree_host.cc +++ b/components/exo/surface_tree_host.cc
@@ -217,6 +217,10 @@ return false; } +bool SurfaceTreeHost::IsTouchEnabled(Surface*) const { + return true; +} + //////////////////////////////////////////////////////////////////////////////// // cc::BeginFrameObserverBase overrides:
diff --git a/components/exo/surface_tree_host.h b/components/exo/surface_tree_host.h index dcc4e2f..274a168 100644 --- a/components/exo/surface_tree_host.h +++ b/components/exo/surface_tree_host.h
@@ -90,6 +90,7 @@ // Overridden from SurfaceDelegate: void OnSurfaceCommit() override; bool IsSurfaceSynchronized() const override; + bool IsTouchEnabled(Surface* surface) const override; void OnSetFrame(SurfaceFrameType type) override {} void OnSetParent(Surface* parent, const gfx::Point& position) override {}
diff --git a/components/ntp_snippets/remote/remote_suggestions_scheduler_impl.cc b/components/ntp_snippets/remote/remote_suggestions_scheduler_impl.cc index caf734f..84b58a13 100644 --- a/components/ntp_snippets/remote/remote_suggestions_scheduler_impl.cc +++ b/components/ntp_snippets/remote/remote_suggestions_scheduler_impl.cc
@@ -66,10 +66,10 @@ // The values of each array specify a default time interval for the intervals // defined by the enum FetchingInterval. The default time intervals defined in // the arrays can be overridden using different variation parameters. -const double kDefaultFetchingIntervalHoursRareNtpUser[] = {192.0, 96.0, 48.0, - 48.0, 10.0, 10.0}; +const double kDefaultFetchingIntervalHoursRareNtpUser[] = {192.0, 96.0, 24.0, + 24.0, 4.0, 4.0}; const double kDefaultFetchingIntervalHoursActiveNtpUser[] = {96.0, 48.0, 24.0, - 24.0, 10.0, 10.0}; + 24.0, 4.0, 4.0}; const double kDefaultFetchingIntervalHoursActiveSuggestionsConsumer[] = { 48.0, 24.0, 12.0, 12.0, 1.0, 1.0};
diff --git a/components/ntp_snippets/remote/remote_suggestions_scheduler_impl_unittest.cc b/components/ntp_snippets/remote/remote_suggestions_scheduler_impl_unittest.cc index 026d79f..b763983af 100644 --- a/components/ntp_snippets/remote/remote_suggestions_scheduler_impl_unittest.cc +++ b/components/ntp_snippets/remote/remote_suggestions_scheduler_impl_unittest.cc
@@ -906,7 +906,7 @@ // Open NTP again after too short delay (one minute missing). UserClassifier // defaults to UserClass::ACTIVE_NTP_USER - we work with the default interval // for this class here. This time no fetch is executed. - test_clock()->Advance(base::TimeDelta::FromHours(10) - + test_clock()->Advance(base::TimeDelta::FromHours(4) - base::TimeDelta::FromMinutes(1)); scheduler()->OnSuggestionsSurfaceOpened(); @@ -971,11 +971,12 @@ std::move(signal_fetch_done).Run(Status::Success()); // Open NTP again after too short delay. This time no fetch is executed. - test_clock()->Advance(base::TimeDelta::FromHours(5)); + test_clock()->Advance(base::TimeDelta::FromHours(4) - + base::TimeDelta::FromMinutes(1)); scheduler()->OnSuggestionsSurfaceOpened(); // Open NTP after another delay, now together long enough to issue a fetch. - test_clock()->Advance(base::TimeDelta::FromHours(7)); + test_clock()->Advance(base::TimeDelta::FromMinutes(2)); EXPECT_CALL(*provider(), RefetchInTheBackground(_)); scheduler()->OnSuggestionsSurfaceOpened(); }
diff --git a/components/ntp_snippets/user_classifier.cc b/components/ntp_snippets/user_classifier.cc index 8427080b..8c00124 100644 --- a/components/ntp_snippets/user_classifier.cc +++ b/components/ntp_snippets/user_classifier.cc
@@ -46,9 +46,9 @@ const char kActiveConsumerClicksAtLeastOncePerHoursParam[] = "user_classifier_active_consumer_clicks_at_least_once_per_hours"; -// The previous value in production was 72, i.e. 3 days. The new value is a -// cautios shift in the direction we want (having slightly more rare users). -const double kRareUserOpensNTPAtMostOncePerHours = 66; +// The previous value in production was 66, i.e. 2.75 days. The new value is a +// shift in the direction we want (having more active users). +const double kRareUserOpensNTPAtMostOncePerHours = 96; const char kRareUserOpensNTPAtMostOncePerHoursParam[] = "user_classifier_rare_user_opens_ntp_at_most_once_per_hours";
diff --git a/components/offline_pages/core/model/offline_page_model_taskified.cc b/components/offline_pages/core/model/offline_page_model_taskified.cc index 54ebac3..cc14fd1 100644 --- a/components/offline_pages/core/model/offline_page_model_taskified.cc +++ b/components/offline_pages/core/model/offline_page_model_taskified.cc
@@ -264,6 +264,16 @@ return archive_manager_->GetPersistentArchivesDir(); } +bool OfflinePageModelTaskified::IsArchiveInInternalDir( + const base::FilePath& file_path) const { + DCHECK(!file_path.empty()); + + // TODO(jianli): Update this once persistent archives are moved into the + // public directory. + return archive_manager_->GetTemporaryArchivesDir().IsParent(file_path) || + archive_manager_->GetPersistentArchivesDir().IsParent(file_path); +} + ClientPolicyController* OfflinePageModelTaskified::GetPolicyController() { return policy_controller_.get(); }
diff --git a/components/offline_pages/core/model/offline_page_model_taskified.h b/components/offline_pages/core/model/offline_page_model_taskified.h index 710e605..8c0f1877 100644 --- a/components/offline_pages/core/model/offline_page_model_taskified.h +++ b/components/offline_pages/core/model/offline_page_model_taskified.h
@@ -107,6 +107,7 @@ const base::FilePath& GetArchiveDirectory( const std::string& name_space) const override; + bool IsArchiveInInternalDir(const base::FilePath& file_path) const override; ClientPolicyController* GetPolicyController() override;
diff --git a/components/offline_pages/core/offline_page_model.h b/components/offline_pages/core/offline_page_model.h index 63f999d..5f0ea0d 100644 --- a/components/offline_pages/core/offline_page_model.h +++ b/components/offline_pages/core/offline_page_model.h
@@ -201,6 +201,10 @@ virtual const base::FilePath& GetArchiveDirectory( const std::string& name_space) const = 0; + // Returns whether given archive file is in the internal directory. + virtual bool IsArchiveInInternalDir( + const base::FilePath& file_path) const = 0; + // Returns the logger. Ownership is retained by the model. virtual OfflineEventLogger* GetLogger() = 0; };
diff --git a/components/offline_pages/core/offline_page_model_impl.cc b/components/offline_pages/core/offline_page_model_impl.cc index a5c7bfd1..80f91ab 100644 --- a/components/offline_pages/core/offline_page_model_impl.cc +++ b/components/offline_pages/core/offline_page_model_impl.cc
@@ -685,6 +685,16 @@ return archive_manager_->GetPersistentArchivesDir(); } +bool OfflinePageModelImpl::IsArchiveInInternalDir( + const base::FilePath& file_path) const { + DCHECK(!file_path.empty()); + + // TODO(jianli): Update this once persisten archives are moved into the public + // directory. + return archive_manager_->GetTemporaryArchivesDir().IsParent(file_path) || + archive_manager_->GetPersistentArchivesDir().IsParent(file_path); +} + void OfflinePageModelImpl::CheckMetadataConsistency() { DCHECK(is_loaded_);
diff --git a/components/offline_pages/core/offline_page_model_impl.h b/components/offline_pages/core/offline_page_model_impl.h index 7941c179..d2ac42df 100644 --- a/components/offline_pages/core/offline_page_model_impl.h +++ b/components/offline_pages/core/offline_page_model_impl.h
@@ -106,6 +106,7 @@ const MultipleOfflinePageItemCallback& callback) override; const base::FilePath& GetArchiveDirectory( const std::string& name_space) const override; + bool IsArchiveInInternalDir(const base::FilePath& file_path) const override; ClientPolicyController* GetPolicyController() override;
diff --git a/components/offline_pages/core/stub_offline_page_model.cc b/components/offline_pages/core/stub_offline_page_model.cc index b640a6f..c101d11 100644 --- a/components/offline_pages/core/stub_offline_page_model.cc +++ b/components/offline_pages/core/stub_offline_page_model.cc
@@ -59,6 +59,10 @@ const std::string& name_space) const { return archive_directory_; } +bool StubOfflinePageModel::IsArchiveInInternalDir( + const base::FilePath& file_path) const { + return archive_directory_.IsParent(file_path); +} ClientPolicyController* StubOfflinePageModel::GetPolicyController() { return &policy_controller_;
diff --git a/components/offline_pages/core/stub_offline_page_model.h b/components/offline_pages/core/stub_offline_page_model.h index d2f72d74..bef41562 100644 --- a/components/offline_pages/core/stub_offline_page_model.h +++ b/components/offline_pages/core/stub_offline_page_model.h
@@ -63,6 +63,7 @@ const MultipleOfflinePageItemCallback& callback) override; const base::FilePath& GetArchiveDirectory( const std::string& name_space) const override; + bool IsArchiveInInternalDir(const base::FilePath& file_path) const override; ClientPolicyController* GetPolicyController() override; OfflineEventLogger* GetLogger() override;
diff --git a/components/os_crypt/BUILD.gn b/components/os_crypt/BUILD.gn index ee8500b..0f8bbbc 100644 --- a/components/os_crypt/BUILD.gn +++ b/components/os_crypt/BUILD.gn
@@ -97,8 +97,6 @@ sources += [ "key_storage_libsecret.cc", "key_storage_libsecret.h", - "libsecret_task_runner_linux.cc", - "libsecret_task_runner_linux.h", "libsecret_util_linux.cc", "libsecret_util_linux.h", ]
diff --git a/components/os_crypt/key_storage_config_linux.h b/components/os_crypt/key_storage_config_linux.h index 78cbcf8..6199cbd 100644 --- a/components/os_crypt/key_storage_config_linux.h +++ b/components/os_crypt/key_storage_config_linux.h
@@ -33,9 +33,6 @@ bool should_use_preference; // Preferences are stored in a separate file in the user data directory. base::FilePath user_data_path; - // Communication with the backend via dbus needs to happen on a specific - // thread. Currently, only KWallet needs to use dbus. - scoped_refptr<base::SequencedTaskRunner> dbus_task_runner; private: DISALLOW_COPY_AND_ASSIGN(Config);
diff --git a/components/os_crypt/key_storage_kwallet.cc b/components/os_crypt/key_storage_kwallet.cc index f60022c..aa4b3d4 100644 --- a/components/os_crypt/key_storage_kwallet.cc +++ b/components/os_crypt/key_storage_kwallet.cc
@@ -8,17 +8,12 @@ #include "base/base64.h" #include "base/rand_util.h" -#include "base/sequenced_task_runner.h" #include "components/os_crypt/kwallet_dbus.h" #include "dbus/bus.h" -KeyStorageKWallet::KeyStorageKWallet( - base::nix::DesktopEnvironment desktop_env, - std::string app_name, - scoped_refptr<base::SequencedTaskRunner> dbus_task_runner) - : desktop_env_(desktop_env), - app_name_(std::move(app_name)), - dbus_task_runner_(dbus_task_runner) {} +KeyStorageKWallet::KeyStorageKWallet(base::nix::DesktopEnvironment desktop_env, + std::string app_name) + : desktop_env_(desktop_env), app_name_(std::move(app_name)) {} KeyStorageKWallet::~KeyStorageKWallet() { // The handle is shared between programs that are using the same wallet. @@ -28,12 +23,7 @@ kwallet_dbus_->GetSessionBus()->ShutdownAndBlock(); } -base::SequencedTaskRunner* KeyStorageKWallet::GetTaskRunner() { - return dbus_task_runner_.get(); -} - bool KeyStorageKWallet::Init() { - DCHECK(dbus_task_runner_->RunsTasksInCurrentSequence()); // Initialize using the production KWalletDBus. return InitWithKWalletDBus(nullptr); } @@ -90,8 +80,6 @@ } std::string KeyStorageKWallet::GetKeyImpl() { - DCHECK(dbus_task_runner_->RunsTasksInCurrentSequence()); - // Get handle KWalletDBus::Error error = kwallet_dbus_->Open(wallet_name_, app_name_, &handle_);
diff --git a/components/os_crypt/key_storage_kwallet.h b/components/os_crypt/key_storage_kwallet.h index e5d14f1..3be64d8 100644 --- a/components/os_crypt/key_storage_kwallet.h +++ b/components/os_crypt/key_storage_kwallet.h
@@ -12,15 +12,10 @@ #include "components/os_crypt/key_storage_linux.h" #include "components/os_crypt/kwallet_dbus.h" -namespace base { -class SequencedTaskRunner; -} - class KeyStorageKWallet : public KeyStorageLinux { public: KeyStorageKWallet(base::nix::DesktopEnvironment desktop_env, - std::string app_name, - scoped_refptr<base::SequencedTaskRunner> dbus_task_runner); + std::string app_name); ~KeyStorageKWallet() override; // Initialize using an optional KWalletDBus mock. @@ -29,7 +24,6 @@ protected: // KeyStorageLinux - base::SequencedTaskRunner* GetTaskRunner() override; bool Init() override; std::string GetKeyImpl() override; @@ -53,7 +47,6 @@ std::string wallet_name_; const std::string app_name_; std::unique_ptr<KWalletDBus> kwallet_dbus_; - scoped_refptr<base::SequencedTaskRunner> const dbus_task_runner_; DISALLOW_COPY_AND_ASSIGN(KeyStorageKWallet); };
diff --git a/components/os_crypt/key_storage_kwallet_unittest.cc b/components/os_crypt/key_storage_kwallet_unittest.cc index 68ff9698..9f9b7da 100644 --- a/components/os_crypt/key_storage_kwallet_unittest.cc +++ b/components/os_crypt/key_storage_kwallet_unittest.cc
@@ -6,7 +6,6 @@ #include "base/logging.h" #include "base/nix/xdg_util.h" -#include "base/test/test_simple_task_runner.h" #include "dbus/message.h" #include "dbus/mock_bus.h" #include "dbus/mock_object_proxy.h" @@ -96,9 +95,7 @@ class KeyStorageKWalletTest : public testing::Test { public: - KeyStorageKWalletTest() - : task_runner_(base::MakeRefCounted<base::TestSimpleTaskRunner>()), - key_storage_kwallet_(kDesktopEnv, "test-app", task_runner_) {} + KeyStorageKWalletTest() : key_storage_kwallet_(kDesktopEnv, "test-app") {} void SetUp() override { kwallet_dbus_mock_ = new StrictMock<MockKWalletDBus>(); @@ -123,7 +120,6 @@ protected: StrictMock<MockKWalletDBus>* kwallet_dbus_mock_; - scoped_refptr<base::TestSimpleTaskRunner> task_runner_; KeyStorageKWallet key_storage_kwallet_; const std::string wallet_name_ = "mollet"; @@ -234,8 +230,7 @@ : public testing::TestWithParam<KWalletDBus::Error> { public: KeyStorageKWalletFailuresTest() - : task_runner_(new base::TestSimpleTaskRunner()), - key_storage_kwallet_(kDesktopEnv, "test-app", task_runner_) {} + : key_storage_kwallet_(kDesktopEnv, "test-app") {} void SetUp() override { // |key_storage_kwallet_| will take ownership of |kwallet_dbus_mock_|. @@ -260,7 +255,6 @@ protected: StrictMock<MockKWalletDBus>* kwallet_dbus_mock_; - scoped_refptr<base::TestSimpleTaskRunner> task_runner_; KeyStorageKWallet key_storage_kwallet_; const std::string wallet_name_ = "mollet";
diff --git a/components/os_crypt/key_storage_libsecret.cc b/components/os_crypt/key_storage_libsecret.cc index 499bb1d..37fd8bb3 100644 --- a/components/os_crypt/key_storage_libsecret.cc +++ b/components/os_crypt/key_storage_libsecret.cc
@@ -6,9 +6,7 @@ #include "base/base64.h" #include "base/rand_util.h" -#include "base/sequenced_task_runner.h" #include "base/strings/string_number_conversions.h" -#include "components/os_crypt/libsecret_task_runner_linux.h" #include "components/os_crypt/libsecret_util_linux.h" namespace { @@ -53,10 +51,6 @@ } // namespace -base::SequencedTaskRunner* KeyStorageLibsecret::GetTaskRunner() { - return os_crypt::GetLibsecretTaskRunner().get(); -} - std::string KeyStorageLibsecret::AddRandomPasswordInLibsecret() { std::string password; base::Base64Encode(base::RandBytesAsString(16), &password);
diff --git a/components/os_crypt/key_storage_libsecret.h b/components/os_crypt/key_storage_libsecret.h index d6335684..617c38f 100644 --- a/components/os_crypt/key_storage_libsecret.h +++ b/components/os_crypt/key_storage_libsecret.h
@@ -10,10 +10,6 @@ #include "base/macros.h" #include "components/os_crypt/key_storage_linux.h" -namespace base { -class SequencedTaskRunner; -} - // Specialisation of KeyStorageLinux that uses Libsecret. class KeyStorageLibsecret : public KeyStorageLinux { public: @@ -22,7 +18,6 @@ protected: // KeyStorageLinux - base::SequencedTaskRunner* GetTaskRunner() override; bool Init() override; std::string GetKeyImpl() override;
diff --git a/components/os_crypt/key_storage_libsecret_unittest.cc b/components/os_crypt/key_storage_libsecret_unittest.cc index d36f50e..5d83d08cf 100644 --- a/components/os_crypt/key_storage_libsecret_unittest.cc +++ b/components/os_crypt/key_storage_libsecret_unittest.cc
@@ -6,7 +6,6 @@ #include "base/logging.h" #include "base/macros.h" -#include "base/test/scoped_task_environment.h" #include "components/os_crypt/key_storage_libsecret.h" #include "components/os_crypt/libsecret_util_linux.h" #include "testing/gtest/include/gtest/gtest.h" @@ -216,8 +215,6 @@ void TearDown() override { MockLibsecretLoader::TearDown(); } private: - base::test::ScopedTaskEnvironment scoped_task_environment_; - DISALLOW_COPY_AND_ASSIGN(LibsecretTest); };
diff --git a/components/os_crypt/key_storage_linux.cc b/components/os_crypt/key_storage_linux.cc index c92624e..9e6f0f27 100644 --- a/components/os_crypt/key_storage_linux.cc +++ b/components/os_crypt/key_storage_linux.cc
@@ -56,7 +56,7 @@ #if defined(USE_LIBSECRET) if (selected_backend == os_crypt::SelectedLinuxBackend::GNOME_ANY || selected_backend == os_crypt::SelectedLinuxBackend::GNOME_LIBSECRET) { - key_storage = std::make_unique<KeyStorageLibsecret>(); + key_storage.reset(new KeyStorageLibsecret()); if (key_storage->WaitForInitOnTaskRunner()) { VLOG(1) << "OSCrypt using Libsecret as backend."; return key_storage; @@ -67,8 +67,7 @@ #if defined(USE_KEYRING) if (selected_backend == os_crypt::SelectedLinuxBackend::GNOME_ANY || selected_backend == os_crypt::SelectedLinuxBackend::GNOME_KEYRING) { - key_storage = - std::make_unique<KeyStorageKeyring>(config.main_thread_runner); + key_storage.reset(new KeyStorageKeyring(config.main_thread_runner)); if (key_storage->WaitForInitOnTaskRunner()) { VLOG(1) << "OSCrypt using Keyring as backend."; return key_storage; @@ -84,8 +83,8 @@ selected_backend == os_crypt::SelectedLinuxBackend::KWALLET ? base::nix::DESKTOP_ENVIRONMENT_KDE4 : base::nix::DESKTOP_ENVIRONMENT_KDE5; - key_storage = std::make_unique<KeyStorageKWallet>( - used_desktop_env, config.product_name, config.dbus_task_runner); + key_storage.reset( + new KeyStorageKWallet(used_desktop_env, config.product_name)); if (key_storage->WaitForInitOnTaskRunner()) { VLOG(1) << "OSCrypt using KWallet as backend."; return key_storage;
diff --git a/components/os_crypt/key_storage_util_linux.cc b/components/os_crypt/key_storage_util_linux.cc index 924b763..14f14c1 100644 --- a/components/os_crypt/key_storage_util_linux.cc +++ b/components/os_crypt/key_storage_util_linux.cc
@@ -57,6 +57,7 @@ return SelectedLinuxBackend::KWALLET; case base::nix::DESKTOP_ENVIRONMENT_KDE5: return SelectedLinuxBackend::KWALLET5; + case base::nix::DESKTOP_ENVIRONMENT_CINNAMON: case base::nix::DESKTOP_ENVIRONMENT_GNOME: case base::nix::DESKTOP_ENVIRONMENT_PANTHEON: case base::nix::DESKTOP_ENVIRONMENT_UNITY:
diff --git a/components/os_crypt/libsecret_task_runner_linux.cc b/components/os_crypt/libsecret_task_runner_linux.cc deleted file mode 100644 index 82d3940..0000000 --- a/components/os_crypt/libsecret_task_runner_linux.cc +++ /dev/null
@@ -1,27 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "components/os_crypt/libsecret_task_runner_linux.h" - -#include "base/task_scheduler/lazy_task_runner.h" - -namespace os_crypt { - -namespace { - -// Use TaskPriority::USER_BLOCKING, because profile initialisation may block on -// initialising OSCrypt, which in turn may contact libsecret. -base::LazySingleThreadTaskRunner g_libsecret_thread_task_runner = - LAZY_SINGLE_THREAD_TASK_RUNNER_INITIALIZER( - base::TaskTraits(base::MayBlock(), base::TaskPriority::USER_BLOCKING), - base::SingleThreadTaskRunnerThreadMode::SHARED); - -} // namespace - -// TODO(crbug.com/571003) Remove this if OSCrypt is the only client of keyring. -scoped_refptr<base::SequencedTaskRunner> GetLibsecretTaskRunner() { - return g_libsecret_thread_task_runner.Get(); -} - -} // namespace os_crypt
diff --git a/components/os_crypt/libsecret_task_runner_linux.h b/components/os_crypt/libsecret_task_runner_linux.h deleted file mode 100644 index d659b31f..0000000 --- a/components/os_crypt/libsecret_task_runner_linux.h +++ /dev/null
@@ -1,21 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef COMPONENTS_OS_CRYPT_LIBSECRET_TASK_RUNNER_LINUX_H_ -#define COMPONENTS_OS_CRYPT_LIBSECRET_TASK_RUNNER_LINUX_H_ - -#include "base/memory/ref_counted.h" -#include "base/sequenced_task_runner.h" - -// Concurrent calls to the libsecret library may sometimes cause erroneous -// behaviour. Use this TaskRunner to remove race conditions between all -// components interacting with libsecret. - -namespace os_crypt { - -scoped_refptr<base::SequencedTaskRunner> GetLibsecretTaskRunner(); - -} // namespace os_crypt - -#endif // COMPONENTS_OS_CRYPT_LIBSECRET_TASK_RUNNER_LINUX_H_
diff --git a/components/pdf/renderer/pdf_accessibility_tree.cc b/components/pdf/renderer/pdf_accessibility_tree.cc index 09ed47b..f711286 100644 --- a/components/pdf/renderer/pdf_accessibility_tree.cc +++ b/components/pdf/renderer/pdf_accessibility_tree.cc
@@ -4,6 +4,7 @@ #include <algorithm> +#include "base/debug/crash_logging.h" #include "base/memory/ptr_util.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversion_utils.h" @@ -192,7 +193,18 @@ for (const auto& node : nodes_) update.nodes.push_back(*node); - CHECK(tree_.Unserialize(update)) << update.ToString() << tree_.error(); + if (!tree_.Unserialize(update)) { + static auto* ax_tree_error = base::debug::AllocateCrashKeyString( + "ax_tree_error", base::debug::CrashKeySize::Size32); + static auto* ax_tree_update = base::debug::AllocateCrashKeyString( + "ax_tree_update", base::debug::CrashKeySize::Size64); + // Temporarily log some additional crash keys so we can try to + // figure out why we're getting bad accessibility trees here. + // http://crbug.com/770886 + base::debug::SetCrashKeyString(ax_tree_error, tree_.error()); + base::debug::SetCrashKeyString(ax_tree_update, update.ToString()); + LOG(FATAL) << tree_.error(); + } content::RenderAccessibility* render_accessibility = GetRenderAccessibility(); if (render_accessibility) render_accessibility->SetPluginTreeSource(this);
diff --git a/components/policy/core/common/BUILD.gn b/components/policy/core/common/BUILD.gn index dcf375c..5db55273 100644 --- a/components/policy/core/common/BUILD.gn +++ b/components/policy/core/common/BUILD.gn
@@ -140,6 +140,7 @@ deps = [ "//base:i18n", "//base/third_party/dynamic_annotations", + "//components/crash/core/common:crash_key", # Remove once https://crbug.com/685996 is fixed. "//components/data_use_measurement/core", "//components/json_schema", "//components/prefs",
diff --git a/components/policy/core/common/DEPS b/components/policy/core/common/DEPS index dd9c59b..9c603e3e 100644 --- a/components/policy/core/common/DEPS +++ b/components/policy/core/common/DEPS
@@ -1,5 +1,6 @@ include_rules = [ "-components/policy/core/browser", + "+components/crash/core/common/crash_key.h", # Remove once https://crbug.com/685996 is fixed. "+components/data_use_measurement/core", "+extensions/features", ]
diff --git a/components/policy/core/common/cloud/cloud_policy_client.cc b/components/policy/core/common/cloud/cloud_policy_client.cc index 0bed5e3..46674d8 100644 --- a/components/policy/core/common/cloud/cloud_policy_client.cc +++ b/components/policy/core/common/cloud/cloud_policy_client.cc
@@ -345,26 +345,20 @@ weak_ptr_factory_.GetWeakPtr())); } -void CloudPolicyClient::UploadCertificate( +void CloudPolicyClient::UploadEnterpriseMachineCertificate( const std::string& certificate_data, const CloudPolicyClient::StatusCallback& callback) { - CHECK(is_registered()); - std::unique_ptr<DeviceManagementRequestJob> request_job( - service_->CreateJob(DeviceManagementRequestJob::TYPE_UPLOAD_CERTIFICATE, - GetRequestContext())); - request_job->SetDMToken(dm_token_); - request_job->SetClientID(client_id_); + UploadCertificate(certificate_data, + em::DeviceCertUploadRequest::ENTERPRISE_MACHINE_CERTIFICATE, + callback); +} - em::DeviceManagementRequest* request = request_job->GetRequest(); - request->mutable_cert_upload_request()->set_device_certificate( - certificate_data); - - const DeviceManagementRequestJob::Callback job_callback = - base::Bind(&CloudPolicyClient::OnCertificateUploadCompleted, - weak_ptr_factory_.GetWeakPtr(), request_job.get(), callback); - - request_jobs_.push_back(std::move(request_job)); - request_jobs_.back()->Start(job_callback); +void CloudPolicyClient::UploadEnterpriseEnrollmentCertificate( + const std::string& certificate_data, + const CloudPolicyClient::StatusCallback& callback) { + UploadCertificate( + certificate_data, + em::DeviceCertUploadRequest::ENTERPRISE_ENROLLMENT_CERTIFICATE, callback); } void CloudPolicyClient::UploadDeviceStatus( @@ -559,6 +553,31 @@ return request_jobs_.size(); } +void CloudPolicyClient::UploadCertificate( + const std::string& certificate_data, + em::DeviceCertUploadRequest::CertificateType certificate_type, + const CloudPolicyClient::StatusCallback& callback) { + CHECK(is_registered()); + std::unique_ptr<DeviceManagementRequestJob> request_job( + service_->CreateJob(DeviceManagementRequestJob::TYPE_UPLOAD_CERTIFICATE, + GetRequestContext())); + request_job->SetDMToken(dm_token_); + request_job->SetClientID(client_id_); + + em::DeviceManagementRequest* request = request_job->GetRequest(); + em::DeviceCertUploadRequest* upload_request = + request->mutable_cert_upload_request(); + upload_request->set_device_certificate(certificate_data); + upload_request->set_certificate_type(certificate_type); + + const DeviceManagementRequestJob::Callback job_callback = base::BindRepeating( + &CloudPolicyClient::OnCertificateUploadCompleted, + weak_ptr_factory_.GetWeakPtr(), request_job.get(), callback); + + request_jobs_.push_back(std::move(request_job)); + request_jobs_.back()->Start(job_callback); +} + void CloudPolicyClient::OnRetryRegister(DeviceManagementRequestJob* job) { DCHECK_EQ(policy_fetch_request_job_.get(), job); // If the initial request managed to get to the server but the response didn't
diff --git a/components/policy/core/common/cloud/cloud_policy_client.h b/components/policy/core/common/cloud/cloud_policy_client.h index 397e2e39..d21c1d2 100644 --- a/components/policy/core/common/cloud/cloud_policy_client.h +++ b/components/policy/core/common/cloud/cloud_policy_client.h
@@ -153,12 +153,21 @@ // Sends an unregistration request to the server. virtual void Unregister(); - // Upload a device certificate to the server. Like FetchPolicy, this method + // Upload a machine certificate to the server. Like FetchPolicy, this method // requires that the client is in a registered state. |certificate_data| must // hold the X.509 certificate data to be sent to the server. The |callback| // will be called when the operation completes. - virtual void UploadCertificate(const std::string& certificate_data, - const StatusCallback& callback); + virtual void UploadEnterpriseMachineCertificate( + const std::string& certificate_data, + const StatusCallback& callback); + + // Upload an enrollment certificate to the server. Like FetchPolicy, this + // method requires that the client is in a registered state. + // |certificate_data| must hold the X.509 certificate data to be sent to the + // server. The |callback| will be called when the operation completes. + virtual void UploadEnterpriseEnrollmentCertificate( + const std::string& certificate_data, + const StatusCallback& callback); // Uploads device/session status to the server. As above, the client must be // in a registered state. If non-null, |device_status| and |session_status| @@ -297,6 +306,16 @@ // A set of (policy type, settings entity ID) pairs to fetch. typedef std::set<std::pair<std::string, std::string>> PolicyTypeSet; + // Upload a certificate to the server. Like FetchPolicy, this method + // requires that the client is in a registered state. |certificate_data| must + // hold the X.509 certificate data to be sent to the server. The |callback| + // will be called when the operation completes. + void UploadCertificate( + const std::string& certificate_data, + enterprise_management::DeviceCertUploadRequest::CertificateType + certificate_type, + const StatusCallback& callback); + // Callback for retries of registration requests. void OnRetryRegister(DeviceManagementRequestJob* job);
diff --git a/components/policy/core/common/cloud/cloud_policy_client_unittest.cc b/components/policy/core/common/cloud/cloud_policy_client_unittest.cc index 56e3374d..2105a5c 100644 --- a/components/policy/core/common/cloud/cloud_policy_client_unittest.cc +++ b/components/policy/core/common/cloud/cloud_policy_client_unittest.cc
@@ -45,7 +45,8 @@ const char kMachineModel[] = "fake-machine-model"; const char kOAuthToken[] = "fake-oauth-token"; const char kDMToken[] = "fake-dm-token"; -const char kDeviceCertificate[] = "fake-device-certificate"; +const char kMachineCertificate[] = "fake-machine-certificate"; +const char kEnrollmentCertificate[] = "fake-enrollment-certificate"; const char kRequisition[] = "fake-requisition"; const char kStateKey[] = "fake-state-key"; const char kPayload[] = "input_payload"; @@ -53,7 +54,6 @@ const char kAssetId[] = "fake-asset-id"; const char kLocation[] = "fake-location"; const char kGcmID[] = "fake-gcm-id"; -const char kEnrollmentCertificate[] = "fake-certificate"; const int64_t kAgeOfCommand = 123123123; const int64_t kLastCommandId = 123456789; @@ -138,8 +138,16 @@ unregistration_request_.mutable_unregister_request(); unregistration_response_.mutable_unregister_response(); - upload_certificate_request_.mutable_cert_upload_request()-> - set_device_certificate(kDeviceCertificate); + upload_machine_certificate_request_.mutable_cert_upload_request() + ->set_device_certificate(kMachineCertificate); + upload_machine_certificate_request_.mutable_cert_upload_request() + ->set_certificate_type( + em::DeviceCertUploadRequest::ENTERPRISE_MACHINE_CERTIFICATE); + upload_enrollment_certificate_request_.mutable_cert_upload_request() + ->set_device_certificate(kEnrollmentCertificate); + upload_enrollment_certificate_request_.mutable_cert_upload_request() + ->set_certificate_type( + em::DeviceCertUploadRequest::ENTERPRISE_ENROLLMENT_CERTIFICATE); upload_certificate_response_.mutable_cert_upload_response(); upload_status_request_.mutable_device_status_report_request(); @@ -271,15 +279,14 @@ MatchProto(unregistration_request_))); } - void ExpectUploadCertificate() { + void ExpectUploadCertificate(const em::DeviceManagementRequest& request) { EXPECT_CALL(service_, CreateJob(DeviceManagementRequestJob::TYPE_UPLOAD_CERTIFICATE, request_context_)) .WillOnce(service_.SucceedJob(upload_certificate_response_)); - EXPECT_CALL(service_, - StartJob(dm_protocol::kValueRequestUploadCertificate, - std::string(), std::string(), kDMToken, client_id_, - MatchProto(upload_certificate_request_))); + EXPECT_CALL(service_, StartJob(dm_protocol::kValueRequestUploadCertificate, + std::string(), std::string(), kDMToken, + client_id_, MatchProto(request))); } void ExpectUploadStatus() { @@ -371,7 +378,8 @@ em::DeviceManagementRequest cert_based_registration_request_; em::DeviceManagementRequest policy_request_; em::DeviceManagementRequest unregistration_request_; - em::DeviceManagementRequest upload_certificate_request_; + em::DeviceManagementRequest upload_machine_certificate_request_; + em::DeviceManagementRequest upload_enrollment_certificate_request_; em::DeviceManagementRequest upload_status_request_; em::DeviceManagementRequest remote_command_request_; em::DeviceManagementRequest attribute_update_permission_request_; @@ -774,28 +782,55 @@ } } -TEST_F(CloudPolicyClientTest, UploadCertificate) { +TEST_F(CloudPolicyClientTest, UploadEnterpriseMachineCertificate) { Register(); - ExpectUploadCertificate(); + ExpectUploadCertificate(upload_machine_certificate_request_); EXPECT_CALL(callback_observer_, OnCallbackComplete(true)).Times(1); - CloudPolicyClient::StatusCallback callback = base::Bind( - &MockStatusCallbackObserver::OnCallbackComplete, - base::Unretained(&callback_observer_)); - client_->UploadCertificate(kDeviceCertificate, callback); + CloudPolicyClient::StatusCallback callback = + base::BindRepeating(&MockStatusCallbackObserver::OnCallbackComplete, + base::Unretained(&callback_observer_)); + client_->UploadEnterpriseMachineCertificate(kMachineCertificate, callback); EXPECT_EQ(DM_STATUS_SUCCESS, client_->status()); } -TEST_F(CloudPolicyClientTest, UploadCertificateEmpty) { +TEST_F(CloudPolicyClientTest, UploadEnterpriseEnrollmentCertificate) { + Register(); + + ExpectUploadCertificate(upload_enrollment_certificate_request_); + EXPECT_CALL(callback_observer_, OnCallbackComplete(true)).Times(1); + CloudPolicyClient::StatusCallback callback = + base::BindRepeating(&MockStatusCallbackObserver::OnCallbackComplete, + base::Unretained(&callback_observer_)); + client_->UploadEnterpriseEnrollmentCertificate(kEnrollmentCertificate, + callback); + EXPECT_EQ(DM_STATUS_SUCCESS, client_->status()); +} + +TEST_F(CloudPolicyClientTest, UploadEnterpriseMachineCertificateEmpty) { Register(); upload_certificate_response_.clear_cert_upload_response(); - ExpectUploadCertificate(); + ExpectUploadCertificate(upload_machine_certificate_request_); EXPECT_CALL(callback_observer_, OnCallbackComplete(false)).Times(1); - CloudPolicyClient::StatusCallback callback = base::Bind( - &MockStatusCallbackObserver::OnCallbackComplete, - base::Unretained(&callback_observer_)); - client_->UploadCertificate(kDeviceCertificate, callback); + CloudPolicyClient::StatusCallback callback = + base::BindRepeating(&MockStatusCallbackObserver::OnCallbackComplete, + base::Unretained(&callback_observer_)); + client_->UploadEnterpriseMachineCertificate(kMachineCertificate, callback); + EXPECT_EQ(DM_STATUS_SUCCESS, client_->status()); +} + +TEST_F(CloudPolicyClientTest, UploadEnterpriseEnrollmentCertificateEmpty) { + Register(); + + upload_certificate_response_.clear_cert_upload_response(); + ExpectUploadCertificate(upload_enrollment_certificate_request_); + EXPECT_CALL(callback_observer_, OnCallbackComplete(false)).Times(1); + CloudPolicyClient::StatusCallback callback = + base::BindRepeating(&MockStatusCallbackObserver::OnCallbackComplete, + base::Unretained(&callback_observer_)); + client_->UploadEnterpriseEnrollmentCertificate(kEnrollmentCertificate, + callback); EXPECT_EQ(DM_STATUS_SUCCESS, client_->status()); } @@ -812,7 +847,7 @@ CloudPolicyClient::StatusCallback callback = base::Bind( &MockStatusCallbackObserver::OnCallbackComplete, base::Unretained(&callback_observer_)); - client_->UploadCertificate(kDeviceCertificate, callback); + client_->UploadEnterpriseMachineCertificate(kMachineCertificate, callback); EXPECT_EQ(DM_STATUS_REQUEST_FAILED, client_->status()); } @@ -886,7 +921,7 @@ CloudPolicyClient::StatusCallback callback2 = base::Bind( &MockStatusCallbackObserver::OnCallbackComplete, base::Unretained(&callback_observer_)); - client_->UploadCertificate(kDeviceCertificate, callback2); + client_->UploadEnterpriseMachineCertificate(kMachineCertificate, callback2); EXPECT_EQ(2, client_->GetActiveRequestCountForTest()); // Now satisfy both active jobs.
diff --git a/components/policy/core/common/cloud/mock_cloud_policy_client.h b/components/policy/core/common/cloud/mock_cloud_policy_client.h index dcee579b..29678d1b 100644 --- a/components/policy/core/common/cloud/mock_cloud_policy_client.h +++ b/components/policy/core/common/cloud/mock_cloud_policy_client.h
@@ -32,7 +32,9 @@ const std::string&)); MOCK_METHOD0(FetchPolicy, void(void)); MOCK_METHOD0(Unregister, void(void)); - MOCK_METHOD2(UploadCertificate, + MOCK_METHOD2(UploadEnterpriseMachineCertificate, + void(const std::string&, const StatusCallback&)); + MOCK_METHOD2(UploadEnterpriseEnrollmentCertificate, void(const std::string&, const StatusCallback&)); MOCK_METHOD3(UploadDeviceStatus, void(const enterprise_management::DeviceStatusReportRequest*,
diff --git a/components/policy/core/common/cloud/user_cloud_policy_manager.cc b/components/policy/core/common/cloud/user_cloud_policy_manager.cc index ed4dfaa..0c643c0 100644 --- a/components/policy/core/common/cloud/user_cloud_policy_manager.cc +++ b/components/policy/core/common/cloud/user_cloud_policy_manager.cc
@@ -8,9 +8,9 @@ #include "base/bind.h" #include "base/bind_helpers.h" -#include "base/debug/crash_logging.h" #include "base/memory/ptr_util.h" #include "base/sequenced_task_runner.h" +#include "components/crash/core/common/crash_key.h" #include "components/policy/core/common/cloud/cloud_external_data_manager.h" #include "components/policy/core/common/cloud/cloud_policy_constants.h" #include "components/policy/core/common/cloud/cloud_policy_service.h" @@ -58,8 +58,10 @@ // TODO(emaxx): Remove the crash key after the crashes tracked at // https://crbug.com/685996 are fixed. if (core()->client()) { - base::debug::SetCrashKeyToStackTrace( - "user-cloud-policy-manager-connect-trace", connect_callstack_); + static crash_reporter::CrashKeyString<1024> connect_callstack_key( + "user-cloud-policy-manager-connect-trace"); + crash_reporter::SetCrashKeyStringToStackTrace(&connect_callstack_key, + connect_callstack_); } else { connect_callstack_ = base::debug::StackTrace(); }
diff --git a/components/policy/resources/policy_templates.json b/components/policy/resources/policy_templates.json index 59f54214c..721d1bb 100644 --- a/components/policy/resources/policy_templates.json +++ b/components/policy/resources/policy_templates.json
@@ -146,7 +146,7 @@ # persistent IDs for all fields (but not for groups!) are needed. These are # specified by the 'id' keys of each policy. NEVER CHANGE EXISTING IDs, # because doing so would break the deployed wire format! -# For your editing convenience: highest ID currently used: 404 +# For your editing convenience: highest ID currently used: 406 # And don't forget to also update the EnterprisePolicies enum of # histograms.xml (run 'python tools/metrics/histograms/update_policies.py'). # @@ -4493,6 +4493,28 @@ 'arc_support': 'When multiple users are logged in, only the primary user can use Android apps.', }, { + 'name': 'SecondaryGoogleAccountSigninAllowed', + 'type': 'main', + 'schema': { 'type': 'boolean' }, + 'supported_on': ['chrome_os:65-'], + 'features': { + # The case where a user is already signed into an unmanaged account from the content area cannot be handled right now and hence this is not dynamic. + 'dynamic_refresh': False, + 'per_profile': True, + }, + 'example_value': False, + 'id': 406, + 'caption': '''Allow Multiple Sign-in Within the Browser''', + 'tags': [], + 'desc': '''This setting allows users to switch between Google accounts within the content area of their browser window after they sign into their <ph name="PRODUCT_OS_NAME">$2<ex>Google Chrome OS</ex></ph> device. + + If this policy is set to false, signing in to a different account from non-Incognito browser content area will not be allowed. + + If this policy is unset or set to true, the default behavior will be used: signing in to a different account from the browser content area will be allowed, except for child accounts where it will be blocked for non-Incognito content area. + + In case signing in to a different account shouldn't be allowed via the Incognito mode, consider blocking that mode using the IncognitoModeAvailability policy.''', + }, + { 'name': 'InstantEnabled', 'type': 'main', 'schema': { 'type': 'boolean' }, @@ -10714,12 +10736,10 @@ 'caption': '''Origins to be treated as secure context.''', 'tags': ['system-security'], 'desc': ''' - The policy specifies a list of origins (URLs) to be treated as secure - context. The intent is to allow organizations to set up a staging server - for internal web developments. - This is the same as the --unsafely-treat-insecure-origin-as-secure flag. - For more information on secure contexts, see https://www.w3.org/TR/secure-contexts/ - ''' + The policy specifies a list of origins (URLs) to be treated as secure context. The intent is to allow organizations to set up a staging server for internal web development, so that their developers can test out features requiring secure contexts without having to deploy TLS on the staging server. + Setting a list of URLs in this policy has the same effect as setting the command-line flag '--unsafely-treat-insecure-origin-as-secure' to a comma-separated list of the same URLs. If the policy is set, it will override the command-line flag. + For more information on secure contexts, see https://www.w3.org/TR/secure-contexts/ + ''' }, { 'name': 'DefaultDownloadDirectory', @@ -10787,6 +10807,32 @@ If this policy is set to False, sites with abusive experiences will be allowed to open new windows or tabs. If this policy is left not set, True will be used.''', }, + { + 'name': 'SpellcheckLanguage', + 'type': 'list', + 'schema': { + 'type': 'array', + 'items': { 'type': 'string' } + }, + # Spell checking is provided by macOS, so can't be controlled on Mac. + 'supported_on': ['chrome.win:65-', 'chrome.linux:65-', 'chrome_os:65-'], + 'features': { + 'can_be_recommended': False, + 'dynamic_refresh': True, + 'per_profile': True, + }, + 'example_value': ['fr', 'es'], + 'id': 405, + 'caption': '''Force enable spellcheck languages''', + 'tags': [], + 'desc': '''Force-enables spellcheck languages. Unrecognized languages in that list will be ignored. + + If you enable this policy, spellcheck will be enabled for the languages specified, in addition to the languages for which the user has enabled spellcheck. + + If you do not set this policy, or disable it, there will be no change to the user's spellcheck preferences. + + The currently supported languages are: af, bg, ca, cs, da, de, el, en-AU, en-CA, en-GB, en-US, es, es-419, es-AR, es-ES, es-MX, es-US, et, fa, fo, fr, he, hi, hr, hu, id, it, ko, lt, lv, nb, nl, pl, pt-BR, pt-PT, ro, ru, sh, sk, sl, sq, sr, sv, ta, tg, tr, uk, vi.''' + } ], 'messages': {
diff --git a/components/safe_browsing/proto/csd.proto b/components/safe_browsing/proto/csd.proto index 4a5282b..6d8360e 100644 --- a/components/safe_browsing/proto/csd.proto +++ b/components/safe_browsing/proto/csd.proto
@@ -188,10 +188,18 @@ // Whether the frame contains password field. optional bool has_password_field = 4; - // URLs transitions in reverse chronological order, i.e. the top level url - // or the url of the iframe comes first in the list. + // If we can find the complete referrer chain, this field will contains URLs + // transitions from landing referrer to event in reverse chronological + // order, i.e. event url comes first in this list, and landing referrer + // comes last. + // For Safe Browsing Extended Reporting or Scout users, if the referrer + // chain is empty or partially missing, we will add/append recent navigation + // events to this list. The type of these entries will be RECENT_NAVIGATION. repeated ReferrerChainEntry referrer_chain = 5; + // Options and metadata about the above referrer chain. + optional ReferrerChainOptions referrer_chain_options = 7; + // The message contains features of a form. message Form { // Action url of the form. @@ -202,6 +210,8 @@ } repeated Form forms = 6; + + // next available tag number: 8. } repeated Frame frames = 3; @@ -520,11 +530,18 @@ // the leading extension separator. repeated string alternate_extensions = 35; - // URLs transitions from landing referrer to download in reverse chronological - // order, i.e. download url comes first in this list, and landing referrer + // If we can find the complete referrer chain, this field will contains URLs + // transitions from landing referrer to event in reverse chronological + // order, i.e. event url comes first in this list, and landing referrer // comes last. + // For Safe Browsing Extended Reporting or Scout users, if the referrer chain + // is empty or partially missing, we will add/append recent navigation events + // to this list. The type of these entries will be RECENT_NAVIGATION. repeated ReferrerChainEntry referrer_chain = 36; + // Options and metadata about the above referrer chain. + optional ReferrerChainOptions referrer_chain_options = 49; + // Deprecated. optional bool DEPRECATED_download_attribution_finch_enabled = 39 [deprecated = true]; @@ -533,6 +550,14 @@ // The underlying structure of code signature is defined at // https://opensource.apple.com/source/xnu/xnu-2782.1.97/bsd/sys/codesign.h optional bytes udif_code_signature = 40; + + // next available tag number: 50; +} + +message ReferrerChainOptions { + // The number of recent navigations we'd like to collect. This number is + // controlled by Finch parameter and its default value is 0. + optional int32 recent_navigations_to_collect = 1 [default = 0]; } // Please update SafeBrowsingNavigationObserverManager::SanitizeReferrerChain() @@ -557,6 +582,32 @@ CLIENT_REDIRECT = 4; DEPRECATED_SERVER_REDIRECT = 5; // Deprecated + + // For Safe Browsing Extended Reporting or Scout users, if the referrer + // chain is empty or partially missing, we will add/append recent navigation + // events to this list. RECENT_NAVIGATION type is set for these cases. + RECENT_NAVIGATION = 6; + } + + enum NavigationInitiation { + // Convenient default value, should not be used in real ReferrerChainEntry. + UNDEFINED = 0; + + // Navigation is initiated by the browser process. e.g. user enters url into + // address bar, or user opens a bookmark. + BROWSER_INITIATED = 1; + + // Navigation is initiated by the renderer process and there is no user + // gesture associate with this navigation. e.g. + // * redirect via the <meta http-equiv="refresh"> tag + // * change window.location.href + RENDERER_INITIATED_WITHOUT_USER_GESTURE = 2; + + // Navigation is initiated by the renderer process and there is a clear user + // gesture associate with this navigation. e.g. + // * <a> link click + // * using window.history.pushState (i.e. back, forward button interaction) + RENDERER_INITIATED_WITH_USER_GESTURE = 3; } message ServerRedirect { @@ -594,6 +645,11 @@ // The first entry in |server_redirect_chain| should be the original request // url, and the last entry should be the same as |url|. repeated ServerRedirect server_redirect_chain = 8; + + // How this navigation is initiated. + optional NavigationInitiation navigation_initiation = 10; + + // next available tag number: 11. } // End of ReferrerChainEntry message ClientDownloadResponse {
diff --git a/components/security_state/content/content_utils.cc b/components/security_state/content/content_utils.cc index 042b4b1..d6e61d0 100644 --- a/components/security_state/content/content_utils.cc +++ b/components/security_state/content/content_utils.cc
@@ -102,6 +102,7 @@ content::SecurityStyleExplanations* security_style_explanations) { if (security_info.sha1_in_chain) { content::SecurityStyleExplanation explanation( + l10n_util::GetStringUTF8(IDS_CERTIFICATE_TITLE), l10n_util::GetStringUTF8(IDS_SHA1), l10n_util::GetStringUTF8(IDS_SHA1_DESCRIPTION), security_info.certificate, @@ -118,6 +119,7 @@ if (security_info.cert_missing_subject_alt_name) { security_style_explanations->insecure_explanations.push_back( content::SecurityStyleExplanation( + l10n_util::GetStringUTF8(IDS_CERTIFICATE_TITLE), l10n_util::GetStringUTF8(IDS_SUBJECT_ALT_NAME_MISSING), l10n_util::GetStringUTF8(IDS_SUBJECT_ALT_NAME_MISSING_DESCRIPTION), security_info.certificate, @@ -133,6 +135,7 @@ net::MapCertStatusToNetError(security_info.cert_status))); content::SecurityStyleExplanation explanation( + l10n_util::GetStringUTF8(IDS_CERTIFICATE_TITLE), l10n_util::GetStringUTF8(IDS_CERTIFICATE_CHAIN_ERROR), l10n_util::GetStringFUTF8( IDS_CERTIFICATE_CHAIN_ERROR_DESCRIPTION_FORMAT, error_string), @@ -164,6 +167,7 @@ if (!security_info.sha1_in_chain) { security_style_explanations->secure_explanations.push_back( content::SecurityStyleExplanation( + l10n_util::GetStringUTF8(IDS_CERTIFICATE_TITLE), l10n_util::GetStringUTF8(IDS_VALID_SERVER_CERTIFICATE), l10n_util::GetStringFUTF8( IDS_VALID_SERVER_CERTIFICATE_DESCRIPTION, issuer_name), @@ -176,6 +180,7 @@ if (security_info.pkp_bypassed) { security_style_explanations->info_explanations.push_back( content::SecurityStyleExplanation( + l10n_util::GetStringUTF8(IDS_CERTIFICATE_TITLE), l10n_util::GetStringUTF8(IDS_PRIVATE_KEY_PINNING_BYPASSED), l10n_util::GetStringUTF8( IDS_PRIVATE_KEY_PINNING_BYPASSED_DESCRIPTION))); @@ -229,7 +234,8 @@ if (security_info.obsolete_ssl_status == net::OBSOLETE_SSL_NONE) { security_style_explanations->secure_explanations.push_back( content::SecurityStyleExplanation( - l10n_util::GetStringUTF8(IDS_STRONG_SSL_SUMMARY), + l10n_util::GetStringUTF8(IDS_SSL_CONNECTION_TITLE), + l10n_util::GetStringFUTF8(IDS_STRONG_SSL_SUMMARY, protocol_name), l10n_util::GetStringFUTF8(IDS_STRONG_SSL_DESCRIPTION, protocol_name, key_exchange_name, cipher_name))); return; @@ -258,6 +264,7 @@ security_style_explanations->info_explanations.push_back( content::SecurityStyleExplanation( + l10n_util::GetStringUTF8(IDS_SSL_CONNECTION_TITLE), l10n_util::GetStringUTF8(IDS_OBSOLETE_SSL_SUMMARY), base::UTF16ToUTF8( l10n_util::GetStringFUTF16(IDS_OBSOLETE_SSL_DESCRIPTION, @@ -285,6 +292,7 @@ add_secure_explanation = false; security_style_explanations->insecure_explanations.push_back( content::SecurityStyleExplanation( + l10n_util::GetStringUTF8(IDS_RESOURCE_SECURITY_TITLE), l10n_util::GetStringUTF8(IDS_MIXED_ACTIVE_CONTENT_SUMMARY), l10n_util::GetStringUTF8(IDS_MIXED_ACTIVE_CONTENT_DESCRIPTION), nullptr, blink::WebMixedContentContextType::kBlockable)); @@ -299,6 +307,7 @@ add_secure_explanation = false; security_style_explanations->neutral_explanations.push_back( content::SecurityStyleExplanation( + l10n_util::GetStringUTF8(IDS_RESOURCE_SECURITY_TITLE), l10n_util::GetStringUTF8(IDS_MIXED_PASSIVE_CONTENT_SUMMARY), l10n_util::GetStringUTF8(IDS_MIXED_PASSIVE_CONTENT_DESCRIPTION), nullptr, blink::WebMixedContentContextType::kOptionallyBlockable)); @@ -310,6 +319,7 @@ add_secure_explanation = false; security_style_explanations->neutral_explanations.push_back( content::SecurityStyleExplanation( + l10n_util::GetStringUTF8(IDS_RESOURCE_SECURITY_TITLE), l10n_util::GetStringUTF8(IDS_NON_SECURE_FORM_SUMMARY), l10n_util::GetStringUTF8(IDS_NON_SECURE_FORM_DESCRIPTION))); } @@ -333,6 +343,7 @@ add_secure_explanation = false; security_style_explanations->insecure_explanations.push_back( content::SecurityStyleExplanation( + l10n_util::GetStringUTF8(IDS_RESOURCE_SECURITY_TITLE), l10n_util::GetStringUTF8(IDS_CERT_ERROR_ACTIVE_CONTENT_SUMMARY), l10n_util::GetStringUTF8( IDS_CERT_ERROR_ACTIVE_CONTENT_DESCRIPTION))); @@ -347,6 +358,7 @@ add_secure_explanation = false; security_style_explanations->neutral_explanations.push_back( content::SecurityStyleExplanation( + l10n_util::GetStringUTF8(IDS_RESOURCE_SECURITY_TITLE), l10n_util::GetStringUTF8(IDS_CERT_ERROR_PASSIVE_CONTENT_SUMMARY), l10n_util::GetStringUTF8( IDS_CERT_ERROR_PASSIVE_CONTENT_DESCRIPTION))); @@ -357,6 +369,7 @@ DCHECK(security_info.scheme_is_cryptographic); security_style_explanations->secure_explanations.push_back( content::SecurityStyleExplanation( + l10n_util::GetStringUTF8(IDS_RESOURCE_SECURITY_TITLE), l10n_util::GetStringUTF8(IDS_SECURE_RESOURCES_SUMMARY), l10n_util::GetStringUTF8(IDS_SECURE_RESOURCES_DESCRIPTION))); }
diff --git a/components/security_state/content/content_utils_unittest.cc b/components/security_state/content/content_utils_unittest.cc index 8e78e45a4..24b783ca 100644 --- a/components/security_state/content/content_utils_unittest.cc +++ b/components/security_state/content/content_utils_unittest.cc
@@ -8,6 +8,7 @@ #include <vector> #include "base/command_line.h" +#include "base/strings/utf_string_conversions.h" #include "base/test/histogram_tester.h" #include "components/security_state/core/security_state.h" #include "components/security_state/core/switches.h" @@ -173,10 +174,11 @@ bool FindSecurityStyleExplanation( const std::vector<content::SecurityStyleExplanation>& explanations, + const std::string& title, const std::string& summary, content::SecurityStyleExplanation* explanation) { for (const auto& entry : explanations) { - if (entry.summary == summary) { + if (entry.title == title && entry.summary == summary) { *explanation = entry; return true; } @@ -199,12 +201,22 @@ &security_info.connection_status); security_info.key_exchange_group = 29; // X25519 + const char* protocol; + net::SSLVersionToString(&protocol, net::SSL_CONNECTION_VERSION_TLS1_2); + + std::string connection_title = + l10n_util::GetStringUTF8(IDS_SSL_CONNECTION_TITLE); + + std::string tls_1_2_connection_string = l10n_util::GetStringFUTF8( + IDS_STRONG_SSL_SUMMARY, base::ASCIIToUTF16(protocol)); + { content::SecurityStyleExplanations explanations; GetSecurityStyle(security_info, &explanations); content::SecurityStyleExplanation explanation; ASSERT_TRUE(FindSecurityStyleExplanation( - explanations.secure_explanations, "Secure connection", &explanation)); + explanations.secure_explanations, connection_title, + tls_1_2_connection_string, &explanation)); EXPECT_EQ( "The connection to this site is encrypted and authenticated using TLS " "1.2 (a strong protocol), ECDHE_RSA with X25519 (a strong key " @@ -220,7 +232,8 @@ GetSecurityStyle(security_info, &explanations); content::SecurityStyleExplanation explanation; ASSERT_TRUE(FindSecurityStyleExplanation( - explanations.secure_explanations, "Secure connection", &explanation)); + explanations.secure_explanations, connection_title, + tls_1_2_connection_string, &explanation)); EXPECT_EQ( "The connection to this site is encrypted and authenticated using TLS " "1.2 (a strong protocol), ECDHE_RSA (a strong key exchange), and " @@ -238,8 +251,14 @@ content::SecurityStyleExplanations explanations; GetSecurityStyle(security_info, &explanations); content::SecurityStyleExplanation explanation; + + net::SSLVersionToString(&protocol, net::SSL_CONNECTION_VERSION_TLS1_3); + std::string tls_1_3_connection_string = l10n_util::GetStringFUTF8( + IDS_STRONG_SSL_SUMMARY, base::ASCIIToUTF16(protocol)); + ASSERT_TRUE(FindSecurityStyleExplanation( - explanations.secure_explanations, "Secure connection", &explanation)); + explanations.secure_explanations, connection_title, + tls_1_3_connection_string, &explanation)); EXPECT_EQ( "The connection to this site is encrypted and authenticated using TLS " "1.3 (a strong protocol), X25519 (a strong key exchange), and " @@ -266,9 +285,10 @@ content::SecurityStyleExplanations explanations; GetSecurityStyle(security_info, &explanations); content::SecurityStyleExplanation explanation; - ASSERT_TRUE(FindSecurityStyleExplanation(explanations.info_explanations, - "Obsolete connection settings", - &explanation)); + ASSERT_TRUE(FindSecurityStyleExplanation( + explanations.info_explanations, + l10n_util::GetStringUTF8(IDS_SSL_CONNECTION_TITLE), + l10n_util::GetStringUTF8(IDS_OBSOLETE_SSL_SUMMARY), &explanation)); EXPECT_EQ( "The connection to this site uses TLS 1.2 (a strong protocol), " "ECDHE_RSA with X25519 (a strong key exchange), and AES_128_CBC with " @@ -296,6 +316,7 @@ content::SecurityStyleExplanation explanation; EXPECT_TRUE(FindSecurityStyleExplanation( explanations.secure_explanations, + l10n_util::GetStringUTF8(IDS_RESOURCE_SECURITY_TITLE), l10n_util::GetStringUTF8(IDS_SECURE_RESOURCES_SUMMARY), &explanation)); EXPECT_EQ(l10n_util::GetStringUTF8(IDS_SECURE_RESOURCES_DESCRIPTION), explanation.description); @@ -315,6 +336,9 @@ &security_info.connection_status); security_info.key_exchange_group = 29; // X25519 + std::string content_title = + l10n_util::GetStringUTF8(IDS_RESOURCE_SECURITY_TITLE); + security_info.mixed_content_status = security_state::CONTENT_STATUS_DISPLAYED_AND_RAN; { @@ -322,13 +346,13 @@ GetSecurityStyle(security_info, &explanations); content::SecurityStyleExplanation explanation; EXPECT_TRUE(FindSecurityStyleExplanation( - explanations.neutral_explanations, + explanations.neutral_explanations, content_title, l10n_util::GetStringUTF8(IDS_MIXED_PASSIVE_CONTENT_SUMMARY), &explanation)); EXPECT_EQ(l10n_util::GetStringUTF8(IDS_MIXED_PASSIVE_CONTENT_DESCRIPTION), explanation.description); EXPECT_TRUE(FindSecurityStyleExplanation( - explanations.insecure_explanations, + explanations.insecure_explanations, content_title, l10n_util::GetStringUTF8(IDS_MIXED_ACTIVE_CONTENT_SUMMARY), &explanation)); EXPECT_EQ(l10n_util::GetStringUTF8(IDS_MIXED_ACTIVE_CONTENT_DESCRIPTION), @@ -341,11 +365,11 @@ GetSecurityStyle(security_info, &explanations); content::SecurityStyleExplanation explanation; EXPECT_TRUE(FindSecurityStyleExplanation( - explanations.neutral_explanations, + explanations.neutral_explanations, content_title, l10n_util::GetStringUTF8(IDS_MIXED_PASSIVE_CONTENT_SUMMARY), &explanation)); EXPECT_FALSE(FindSecurityStyleExplanation( - explanations.insecure_explanations, + explanations.insecure_explanations, content_title, l10n_util::GetStringUTF8(IDS_MIXED_ACTIVE_CONTENT_SUMMARY), &explanation)); } @@ -356,11 +380,11 @@ GetSecurityStyle(security_info, &explanations); content::SecurityStyleExplanation explanation; EXPECT_FALSE(FindSecurityStyleExplanation( - explanations.neutral_explanations, + explanations.neutral_explanations, content_title, l10n_util::GetStringUTF8(IDS_MIXED_PASSIVE_CONTENT_SUMMARY), &explanation)); EXPECT_TRUE(FindSecurityStyleExplanation( - explanations.insecure_explanations, + explanations.insecure_explanations, content_title, l10n_util::GetStringUTF8(IDS_MIXED_ACTIVE_CONTENT_SUMMARY), &explanation)); } @@ -371,7 +395,7 @@ GetSecurityStyle(security_info, &explanations); content::SecurityStyleExplanation explanation; EXPECT_TRUE(FindSecurityStyleExplanation( - explanations.neutral_explanations, + explanations.neutral_explanations, content_title, l10n_util::GetStringUTF8(IDS_NON_SECURE_FORM_SUMMARY), &explanation)); EXPECT_EQ(l10n_util::GetStringUTF8(IDS_NON_SECURE_FORM_DESCRIPTION), explanation.description); @@ -391,6 +415,9 @@ &security_info.connection_status); security_info.key_exchange_group = 29; // X25519 + std::string content_title = + l10n_util::GetStringUTF8(IDS_RESOURCE_SECURITY_TITLE); + security_info.content_with_cert_errors_status = security_state::CONTENT_STATUS_DISPLAYED_AND_RAN; { @@ -398,14 +425,14 @@ GetSecurityStyle(security_info, &explanations); content::SecurityStyleExplanation explanation; EXPECT_TRUE(FindSecurityStyleExplanation( - explanations.neutral_explanations, + explanations.neutral_explanations, content_title, l10n_util::GetStringUTF8(IDS_CERT_ERROR_PASSIVE_CONTENT_SUMMARY), &explanation)); EXPECT_EQ( l10n_util::GetStringUTF8(IDS_CERT_ERROR_PASSIVE_CONTENT_DESCRIPTION), explanation.description); EXPECT_TRUE(FindSecurityStyleExplanation( - explanations.insecure_explanations, + explanations.insecure_explanations, content_title, l10n_util::GetStringUTF8(IDS_CERT_ERROR_ACTIVE_CONTENT_SUMMARY), &explanation)); EXPECT_EQ( @@ -420,11 +447,11 @@ GetSecurityStyle(security_info, &explanations); content::SecurityStyleExplanation explanation; EXPECT_TRUE(FindSecurityStyleExplanation( - explanations.neutral_explanations, + explanations.neutral_explanations, content_title, l10n_util::GetStringUTF8(IDS_CERT_ERROR_PASSIVE_CONTENT_SUMMARY), &explanation)); ASSERT_FALSE(FindSecurityStyleExplanation( - explanations.insecure_explanations, + explanations.insecure_explanations, content_title, l10n_util::GetStringUTF8(IDS_CERT_ERROR_ACTIVE_CONTENT_SUMMARY), &explanation)); } @@ -436,11 +463,11 @@ GetSecurityStyle(security_info, &explanations); content::SecurityStyleExplanation explanation; ASSERT_FALSE(FindSecurityStyleExplanation( - explanations.neutral_explanations, + explanations.neutral_explanations, content_title, l10n_util::GetStringUTF8(IDS_CERT_ERROR_PASSIVE_CONTENT_SUMMARY), &explanation)); EXPECT_TRUE(FindSecurityStyleExplanation( - explanations.insecure_explanations, + explanations.insecure_explanations, content_title, l10n_util::GetStringUTF8(IDS_CERT_ERROR_ACTIVE_CONTENT_SUMMARY), &explanation)); EXPECT_EQ( @@ -462,6 +489,9 @@ &security_info.connection_status); security_info.key_exchange_group = 29; // X25519 + std::string content_title = + l10n_util::GetStringUTF8(IDS_RESOURCE_SECURITY_TITLE); + security_info.mixed_content_status = security_state::CONTENT_STATUS_DISPLAYED_AND_RAN; security_info.content_with_cert_errors_status = @@ -471,19 +501,19 @@ GetSecurityStyle(security_info, &explanations); content::SecurityStyleExplanation explanation; EXPECT_TRUE(FindSecurityStyleExplanation( - explanations.neutral_explanations, + explanations.neutral_explanations, content_title, l10n_util::GetStringUTF8(IDS_MIXED_PASSIVE_CONTENT_SUMMARY), &explanation)); EXPECT_TRUE(FindSecurityStyleExplanation( - explanations.insecure_explanations, + explanations.insecure_explanations, content_title, l10n_util::GetStringUTF8(IDS_MIXED_ACTIVE_CONTENT_SUMMARY), &explanation)); EXPECT_TRUE(FindSecurityStyleExplanation( - explanations.neutral_explanations, + explanations.neutral_explanations, content_title, l10n_util::GetStringUTF8(IDS_CERT_ERROR_PASSIVE_CONTENT_SUMMARY), &explanation)); EXPECT_TRUE(FindSecurityStyleExplanation( - explanations.insecure_explanations, + explanations.insecure_explanations, content_title, l10n_util::GetStringUTF8(IDS_CERT_ERROR_ACTIVE_CONTENT_SUMMARY), &explanation)); } @@ -593,7 +623,8 @@ // Tests that an explanation using the shorter constructor sets the correct // default values for other fields. TEST(SecurityStateContentUtilsTest, DefaultSecurityStyleExplanation) { - content::SecurityStyleExplanation explanation("summary", "description"); + content::SecurityStyleExplanation explanation("title", "summary", + "description"); EXPECT_EQ(false, !!explanation.certificate); EXPECT_EQ(blink::WebMixedContentContextType::kNotMixedContent,
diff --git a/components/security_state_strings.grdp b/components/security_state_strings.grdp index 27601520..127f977 100644 --- a/components/security_state_strings.grdp +++ b/components/security_state_strings.grdp
@@ -29,7 +29,7 @@ To check this page's status, visit g.co/safebrowsingstatus. </message> <message name="IDS_SHA1" desc="Summary phrase for a security problem where the site's certificate chain contains a SHA1 signature." translateable="false"> - SHA-1 certificate + insecure (SHA-1) </message> <message name="IDS_SHA1_DESCRIPTION" desc="Description of a security problem where the site's certificate chain contains a SHA1 signature." translateable="false"> The certificate chain for this site contains a certificate signed using SHA-1. @@ -40,20 +40,28 @@ <message name="IDS_SUBJECT_ALT_NAME_MISSING_DESCRIPTION" desc="Description of a security problem where the site's certificate is missing a subjectAltName extension." translateable="false"> The certificate for this site does not contain a Subject Alternative Name extension containing a domain name or IP address. </message> + <message name="IDS_CERTIFICATE_TITLE" desc="Title for the certificate section." translateable="false"> + Certificate + </message> + <message name="IDS_CERTIFICATE_CHAIN_ERROR" desc="Summary phrase for a security problem with the site's certificate." translateable="false"> - Certificate error + missing </message> <message name="IDS_CERTIFICATE_CHAIN_ERROR_DESCRIPTION_FORMAT" desc="Description of a security problem with the site's certificate." translateable="false"> - There are issues with the site's certificate chain (<ph name="CERT_ERROR_DESCRIPTION">$1<ex>net::ERR_CERT_AUTHORITY_INVALID</ex></ph>). + This site is missing a valid, trusted certificate (<ph name="CERT_ERROR_DESCRIPTION">$1<ex>net::ERR_CERT_AUTHORITY_INVALID</ex></ph>). </message> <message name="IDS_VALID_SERVER_CERTIFICATE" desc="Summary phrase for a site that has a valid server certificate." translateable="false"> - Valid certificate + valid and trusted </message> <message name="IDS_VALID_SERVER_CERTIFICATE_DESCRIPTION" desc="Description of a site that has a valid server certificate." translateable="false"> The connection to this site is using a valid, trusted server certificate issued by <ph name="ISSUER">$1<ex>Let's Encrypt Authority X3</ex></ph>. </message> + + <message name="IDS_SSL_CONNECTION_TITLE" desc="Title for the SSL connection explanation." translateable="false"> + Connection + </message> <message name="IDS_STRONG_SSL_SUMMARY" desc="Summary phrase for a site that uses a modern, secure TLS protocol and cipher." translateable="false"> - Secure connection + secure (strong <ph name="PROTOCOL_VERSION">$1<ex>TLS 1.2</ex></ph>) </message> <message name="IDS_PRIVATE_KEY_PINNING_BYPASSED" desc="Summary phrase for a security state where Private Key Pinning is ignored because the certificate chains to a locally-trusted root." translateable="false"> Public-Key-Pinning bypassed @@ -65,7 +73,7 @@ The connection to this site is encrypted and authenticated using <ph name="PROTOCOL_VERSION">$1<ex>TLS 1.2</ex></ph> (a strong protocol), <ph name="KEY_EXCHANGE">$2<ex>ECDHE_RSA</ex></ph> (a strong key exchange), and <ph name="CIPHER_SUTE">$3<ex>AES_128_GCM</ex></ph> (a strong cipher). </message> <message name="IDS_OBSOLETE_SSL_SUMMARY" desc="Summary phrase for a site that uses an outdated SSL settings (protocol, key exchange, or cipher)." translateable="false"> - Obsolete connection settings + obsolete connection settings </message> <message name="IDS_OBSOLETE_SSL_DESCRIPTION" desc="Description of a site that uses an outdated TLS protocol or cipher." translateable="false"> The connection to this site uses <ph name="PROTOCOL">$1<ex>TLS 1.0</ex></ph> (<ph name="A_PROTOCOL">$2<ex>an obsolete protocol</ex></ph>), <ph name="KEY_EXCHANGE">$3<ex>ECDHE_RSA</ex></ph> (<ph name="A_KEY_EXCHANGE">$4<ex>an obsolete key exchange</ex></ph>), and <ph name="CIPHER">$5<ex>AES_256_CBC with HMAC-SHA1</ex></ph> (<ph name="A_CIPHER">$6<ex>an obsolete cipher</ex></ph>). @@ -96,38 +104,42 @@ </message> <!-- Mixed Content --> + <message name="IDS_RESOURCE_SECURITY_TITLE" desc="Title for the resources security explanation" translateable="false"> + Resources + </message> + <message name="IDS_SECURE_RESOURCES_SUMMARY" desc="" translateable="false"> - Secure resources + all served securely </message> <message name="IDS_SECURE_RESOURCES_DESCRIPTION" desc="" translateable="false"> All resources on this page are served securely. </message> <message name="IDS_MIXED_PASSIVE_CONTENT_SUMMARY" desc="" translateable="false"> - Mixed content + mixed content </message> <message name="IDS_MIXED_PASSIVE_CONTENT_DESCRIPTION" desc="" translateable="false"> This page includes HTTP resources. </message> <message name="IDS_MIXED_ACTIVE_CONTENT_SUMMARY" desc="" translateable="false"> - Active mixed content + active mixed content </message> <message name="IDS_MIXED_ACTIVE_CONTENT_DESCRIPTION" desc="" translateable="false"> You have recently allowed non-secure content (such as scripts or iframes) to run on this site. </message> <message name="IDS_CERT_ERROR_PASSIVE_CONTENT_SUMMARY" desc="" translateable="false"> - Content with certificate errors + content with certificate errors </message> <message name="IDS_CERT_ERROR_PASSIVE_CONTENT_DESCRIPTION" desc="" translateable="false"> This page includes resources that were loaded with certificate errors. </message> <message name="IDS_CERT_ERROR_ACTIVE_CONTENT_SUMMARY" desc="" translateable="false"> - Active content with certificate errors + active content with certificate errors </message> <message name="IDS_CERT_ERROR_ACTIVE_CONTENT_DESCRIPTION" desc="" translateable="false"> You have recently allowed content loaded with certificate errors (such as scripts or iframes) to run on this site. </message> <message name="IDS_NON_SECURE_FORM_SUMMARY" desc="" translateable="false"> - Non-secure form + non-secure form </message> <message name="IDS_NON_SECURE_FORM_DESCRIPTION" desc="" translateable="false"> This page includes a form with a non-secure "action" attribute.
diff --git a/components/signin/core/browser/chrome_connected_header_helper.cc b/components/signin/core/browser/chrome_connected_header_helper.cc index 7586db5..2c050d11 100644 --- a/components/signin/core/browser/chrome_connected_header_helper.cc +++ b/components/signin/core/browser/chrome_connected_header_helper.cc
@@ -150,12 +150,22 @@ const GURL& url, const std::string& account_id, int profile_mode_mask) { +// If we are not on Chrome OS, an empty |account_id| corresponds to the user not +// signed in to Chrome. Do NOT enforce account consistency otherwise users will +// not be able to use Google services at all. Therefore, send an empty header. +// On Chrome OS, an empty |account_id| corresponds to Public Sessions, Guest +// Sessions and Active Directory logins. Guest Sessions have already been +// filtered upstream and we want to enforce account consistency in Public +// Sessions and Active Directory logins. +#if !defined(OS_CHROMEOS) if (account_id.empty()) return std::string(); +#endif std::vector<std::string> parts; - if (IsUrlEligibleToIncludeGaiaId(url, is_header_request)) { - // Only set the Gaia ID on domains that actually requires it. + if (!account_id.empty() && + IsUrlEligibleToIncludeGaiaId(url, is_header_request)) { + // Only set the Gaia ID on domains that actually require it. parts.push_back( base::StringPrintf("%s=%s", kGaiaIdAttrName, account_id.c_str())); }
diff --git a/components/signin/core/browser/signin_header_helper_unittest.cc b/components/signin/core/browser/signin_header_helper_unittest.cc index 3eb78f4c..fc8db3f 100644 --- a/components/signin/core/browser/signin_header_helper_unittest.cc +++ b/components/signin/core/browser/signin_header_helper_unittest.cc
@@ -122,13 +122,25 @@ std::unique_ptr<BooleanPrefMember> dice_enabled_pref_member_; }; -// Tests that no Mirror request is returned when the user is not signed in (no +#if defined(OS_CHROMEOS) +// Tests that Mirror request is returned on Chrome OS for Public Sessions (no // account id). +TEST_F(SigninHeaderHelperTest, TestMirrorRequestNoAccountIdChromeOS) { + ScopedAccountConsistencyMirror scoped_mirror; + CheckMirrorHeaderRequest(GURL("https://docs.google.com"), "", + "mode=0,enable_account_consistency=true"); + CheckMirrorCookieRequest(GURL("https://docs.google.com"), "", + "mode=0:enable_account_consistency=true"); +} +#else // !defined(OS_CHROMEOS) +// Tests that no Mirror request is returned when the user is not signed in (no +// account id), for non Chrome OS platforms. TEST_F(SigninHeaderHelperTest, TestNoMirrorRequestNoAccountId) { ScopedAccountConsistencyMirror scoped_mirror; CheckMirrorHeaderRequest(GURL("https://docs.google.com"), "", ""); CheckMirrorCookieRequest(GURL("https://docs.google.com"), "", ""); } +#endif // Tests that no Mirror request is returned when the cookies aren't allowed to // be set.
diff --git a/components/spellcheck/browser/pref_names.cc b/components/spellcheck/browser/pref_names.cc index 7c544bf..a6baa15e 100644 --- a/components/spellcheck/browser/pref_names.cc +++ b/components/spellcheck/browser/pref_names.cc
@@ -17,6 +17,9 @@ // List of strings representing the dictionary names for our spell-checker. const char kSpellCheckDictionaries[] = "spellcheck.dictionaries"; +// List of strings representing the dictionary names for our spell-checker. +const char kSpellCheckForcedDictionaries[] = "spellcheck.forced_dictionaries"; + // String which represents whether we use the spelling service. const char kSpellCheckUseSpellingService[] = "spellcheck.use_spelling_service";
diff --git a/components/spellcheck/browser/pref_names.h b/components/spellcheck/browser/pref_names.h index be374e5dc..ba2f422 100644 --- a/components/spellcheck/browser/pref_names.h +++ b/components/spellcheck/browser/pref_names.h
@@ -10,6 +10,7 @@ extern const char kEnableSpellcheck[]; extern const char kSpellCheckDictionaries[]; +extern const char kSpellCheckForcedDictionaries[]; extern const char kSpellCheckDictionary[]; extern const char kSpellCheckUseSpellingService[];
diff --git a/components/storage_monitor/test_media_transfer_protocol_manager_chromeos.cc b/components/storage_monitor/test_media_transfer_protocol_manager_chromeos.cc index dcef664..5431aa55 100644 --- a/components/storage_monitor/test_media_transfer_protocol_manager_chromeos.cc +++ b/components/storage_monitor/test_media_transfer_protocol_manager_chromeos.cc
@@ -63,7 +63,8 @@ const uint32_t file_id, const size_t max_size, const ReadDirectoryCallback& callback) { - callback.Run(std::vector<MtpFileEntry>(), false /* no more entries*/, + callback.Run(std::vector<device::mojom::MtpFileEntry>(), + false /* no more entries*/, true /* error */); } @@ -80,7 +81,7 @@ const std::string& storage_handle, uint32_t file_id, const GetFileInfoCallback& callback) { - callback.Run(MtpFileEntry(), true); + callback.Run(device::mojom::MtpFileEntry(), true); } void TestMediaTransferProtocolManagerChromeOS::RenameObject(
diff --git a/components/sync/protocol/sync_protocol_error.cc b/components/sync/protocol/sync_protocol_error.cc index 215229eb..9aceb78 100644 --- a/components/sync/protocol/sync_protocol_error.cc +++ b/components/sync/protocol/sync_protocol_error.cc
@@ -47,6 +47,8 @@ return ""; } +#undef ENUM_CASE + SyncProtocolError::SyncProtocolError() : error_type(UNKNOWN_ERROR), action(UNKNOWN_ACTION) {}
diff --git a/components/variations/service/variations_field_trial_creator.cc b/components/variations/service/variations_field_trial_creator.cc index d38218c..d7e39f0 100644 --- a/components/variations/service/variations_field_trial_creator.cc +++ b/components/variations/service/variations_field_trial_creator.cc
@@ -42,6 +42,23 @@ VARIATIONS_SEED_EXPIRY_ENUM_SIZE, }; +// Set of different possible values to report for the +// Variations.LoadPermanentConsistencyCountryResult histogram. Values are +// persisted to logs, and should therefore never be renumbered nor reused. +enum LoadPermanentConsistencyCountryResult { + LOAD_COUNTRY_NO_PREF_NO_SEED = 0, + LOAD_COUNTRY_NO_PREF_HAS_SEED, + LOAD_COUNTRY_INVALID_PREF_NO_SEED, + LOAD_COUNTRY_INVALID_PREF_HAS_SEED, + LOAD_COUNTRY_HAS_PREF_NO_SEED_VERSION_EQ, + LOAD_COUNTRY_HAS_PREF_NO_SEED_VERSION_NEQ, + LOAD_COUNTRY_HAS_BOTH_VERSION_EQ_COUNTRY_EQ, + LOAD_COUNTRY_HAS_BOTH_VERSION_EQ_COUNTRY_NEQ, + LOAD_COUNTRY_HAS_BOTH_VERSION_NEQ_COUNTRY_EQ, + LOAD_COUNTRY_HAS_BOTH_VERSION_NEQ_COUNTRY_NEQ, + LOAD_COUNTRY_MAX, +}; + // Gets current form factor and converts it from enum DeviceFormFactor to enum // Study_FormFactor. Study::FormFactor GetCurrentFormFactor() {
diff --git a/components/variations/service/variations_field_trial_creator.h b/components/variations/service/variations_field_trial_creator.h index dceecfb..b7e330d 100644 --- a/components/variations/service/variations_field_trial_creator.h +++ b/components/variations/service/variations_field_trial_creator.h
@@ -33,18 +33,7 @@ // empty if it is not available. std::string GetLatestCountry() const; - // Creates field trials based on the variations seed loaded from local state. - // If there is a problem loading the seed data, all trials specified by the - // seed may not be created. Some field trials are configured to override or - // associate with (for reporting) specific features. These associations are - // registered with |feature_list|. - bool CreateTrialsFromSeed( - std::unique_ptr<const base::FieldTrial::EntropyProvider> - low_entropy_provider, - base::FeatureList* feature_list); - - VariationsSeedStore& seed_store() { return seed_store_; } - + VariationsSeedStore* seed_store() { return &seed_store_; } const VariationsSeedStore& seed_store() const { return seed_store_; } bool create_trials_from_seed_called() const { @@ -96,36 +85,27 @@ // Records the time of the most recent successful fetch. void RecordLastFetchTime(); - // Loads the seed from the variations store into |seed|. If successfull, - // |seed| will contain the loaded data and true is returned. Set as virtual - // so that it can be overridden by tests. + // Loads the seed from the variations store into |seed|. If successful, |seed| + // will contain the loaded data and true is returned. Virtual for testing. virtual bool LoadSeed(VariationsSeed* seed); - // Allow the platform that is used to filter the set of active trials - // to be overridden. + // Allow the platform that is used to filter the set of active trials to be + // overridden. void OverrideVariationsPlatform(Study::Platform platform_override); private: PrefService* local_state() { return seed_store_.local_state(); } - const PrefService* local_state() const { return seed_store_.local_state(); } - // Set of different possible values to report for the - // Variations.LoadPermanentConsistencyCountryResult histogram. This enum must - // be kept consistent with its counterpart in histograms.xml. - enum LoadPermanentConsistencyCountryResult { - LOAD_COUNTRY_NO_PREF_NO_SEED = 0, - LOAD_COUNTRY_NO_PREF_HAS_SEED, - LOAD_COUNTRY_INVALID_PREF_NO_SEED, - LOAD_COUNTRY_INVALID_PREF_HAS_SEED, - LOAD_COUNTRY_HAS_PREF_NO_SEED_VERSION_EQ, - LOAD_COUNTRY_HAS_PREF_NO_SEED_VERSION_NEQ, - LOAD_COUNTRY_HAS_BOTH_VERSION_EQ_COUNTRY_EQ, - LOAD_COUNTRY_HAS_BOTH_VERSION_EQ_COUNTRY_NEQ, - LOAD_COUNTRY_HAS_BOTH_VERSION_NEQ_COUNTRY_EQ, - LOAD_COUNTRY_HAS_BOTH_VERSION_NEQ_COUNTRY_NEQ, - LOAD_COUNTRY_MAX, - }; + // Creates field trials based on the variations seed loaded from local state. + // If there is a problem loading the seed data, all trials specified by the + // seed may not be created. Some field trials are configured to override or + // associate with (for reporting) specific features. These associations are + // registered with |feature_list|. + bool CreateTrialsFromSeed( + std::unique_ptr<const base::FieldTrial::EntropyProvider> + low_entropy_provider, + base::FeatureList* feature_list); VariationsServiceClient* client_;
diff --git a/components/variations/service/variations_field_trial_creator_unittest.cc b/components/variations/service/variations_field_trial_creator_unittest.cc index 55198f4..79cec28 100644 --- a/components/variations/service/variations_field_trial_creator_unittest.cc +++ b/components/variations/service/variations_field_trial_creator_unittest.cc
@@ -5,37 +5,60 @@ #include "components/variations/service/variations_field_trial_creator.h" #include <stddef.h> +#include <memory> #include "base/feature_list.h" #include "base/macros.h" -#include "base/memory/ptr_util.h" -#include "base/message_loop/message_loop.h" #include "base/version.h" -#include "components/metrics/clean_exit_beacon.h" -#include "components/metrics/client_info.h" -#include "components/metrics/metrics_state_manager.h" -#include "components/metrics/test_enabled_state_provider.h" #include "components/prefs/testing_pref_service.h" +#include "components/variations/platform_field_trials.h" #include "components/variations/pref_names.h" +#include "components/variations/proto/variations_seed.pb.h" #include "components/variations/service/variations_service.h" -#include "components/web_resource/resource_request_allowed_notifier_test_util.h" +#include "components/variations/service/variations_service_client.h" #include "testing/gtest/include/gtest/gtest.h" namespace variations { namespace { -// A stub for the metrics state manager. -void StubStoreClientInfo(const metrics::ClientInfo& /* client_info */) {} +// Constants used to create the test seed. +const char kTestSeedStudyName[] = "test"; +const char kTestSeedExperimentName[] = "abc"; +const int kTestSeedExperimentProbability = 100; +const char kTestSeedSerialNumber[] = "123"; -// A stub for the metrics state manager. -std::unique_ptr<metrics::ClientInfo> StubLoadClientInfo() { - return std::unique_ptr<metrics::ClientInfo>(); +// Populates |seed| with simple test data. The resulting seed will contain one +// study called "test", which contains one experiment called "abc" with +// probability weight 100. |seed|'s study field will be cleared before adding +// the new study. +VariationsSeed CreateTestSeed() { + VariationsSeed seed; + Study* study = seed.add_study(); + study->set_name(kTestSeedStudyName); + study->set_default_experiment_name(kTestSeedExperimentName); + Study_Experiment* experiment = study->add_experiment(); + experiment->set_name(kTestSeedExperimentName); + experiment->set_probability_weight(kTestSeedExperimentProbability); + seed.set_serial_number(kTestSeedSerialNumber); + return seed; } +class TestPlatformFieldTrials : public PlatformFieldTrials { + public: + TestPlatformFieldTrials() = default; + ~TestPlatformFieldTrials() override = default; + + // PlatformFieldTrials: + void SetupFieldTrials() override {} + void SetupFeatureControllingFieldTrials( + bool has_seed, + base::FeatureList* feature_list) override {} +}; + class TestVariationsServiceClient : public VariationsServiceClient { public: - TestVariationsServiceClient() {} - ~TestVariationsServiceClient() override {} + TestVariationsServiceClient() = default; + ~TestVariationsServiceClient() override = default; // VariationsServiceClient: std::string GetApplicationLocale() override { return std::string(); } @@ -71,205 +94,108 @@ class TestVariationsFieldTrialCreator : public VariationsFieldTrialCreator { public: - TestVariationsFieldTrialCreator( - std::unique_ptr<web_resource::TestRequestAllowedNotifier> test_notifier, - PrefService* local_state, - TestVariationsServiceClient* client) - : VariationsFieldTrialCreator(local_state, client, UIStringOverrider()), - client_(client) { - SetCreateTrialsFromSeedCalledForTesting(true); - } + TestVariationsFieldTrialCreator(PrefService* local_state, + TestVariationsServiceClient* client) + : VariationsFieldTrialCreator(local_state, client, UIStringOverrider()) {} - ~TestVariationsFieldTrialCreator() override { - delete client_; - client_ = nullptr; - } + ~TestVariationsFieldTrialCreator() override = default; - bool StoreSeed(const std::string& seed_data, - const std::string& seed_signature, - const std::string& country_code, - const base::Time& date_fetched, - bool is_delta_compressed, - bool is_gzip_compressed) { - seed_stored_ = true; - stored_seed_data_ = seed_data; - stored_country_ = country_code; - delta_compressed_seed_ = is_delta_compressed; - gzip_compressed_seed_ = is_gzip_compressed; - return true; + // A convenience wrapper around SetupFieldTrials() which passes default values + // for uninteresting params. + bool SetupFieldTrials() { + std::vector<std::string> variation_ids; + TestPlatformFieldTrials platform_field_trials; + return VariationsFieldTrialCreator::SetupFieldTrials( + "", "", "", std::set<std::string>(), nullptr, + std::make_unique<base::FeatureList>(), &variation_ids, + &platform_field_trials); } private: bool LoadSeed(VariationsSeed* seed) override { - if (!seed_stored_) - return false; - return seed->ParseFromString(stored_seed_data_); + *seed = CreateTestSeed(); + return true; } - bool seed_stored_; - std::string stored_seed_data_; - std::string stored_country_; - bool delta_compressed_seed_; - bool gzip_compressed_seed_; - - TestVariationsServiceClient* client_; - DISALLOW_COPY_AND_ASSIGN(TestVariationsFieldTrialCreator); }; -// A test class used to validate expected functionality in VariationsService. -class TestVariationsService : public VariationsService { - public: - TestVariationsService( - std::unique_ptr<web_resource::TestRequestAllowedNotifier> test_notifier, - PrefService* local_state, - metrics::MetricsStateManager* state_manager) - : VariationsService(base::WrapUnique(new TestVariationsServiceClient()), - std::move(test_notifier), - local_state, - state_manager, - UIStringOverrider()) {} - - ~TestVariationsService() override {} -}; - -// Constants used to create the test seed. -const char kTestSeedStudyName[] = "test"; -const char kTestSeedExperimentName[] = "abc"; -const int kTestSeedExperimentProbability = 100; -const char kTestSeedSerialNumber[] = "123"; - -// Populates |seed| with simple test data. The resulting seed will contain one -// study called "test", which contains one experiment called "abc" with -// probability weight 100. |seed|'s study field will be cleared before adding -// the new study. -VariationsSeed CreateTestSeed() { - VariationsSeed seed; - Study* study = seed.add_study(); - study->set_name(kTestSeedStudyName); - study->set_default_experiment_name(kTestSeedExperimentName); - Study_Experiment* experiment = study->add_experiment(); - experiment->set_name(kTestSeedExperimentName); - experiment->set_probability_weight(kTestSeedExperimentProbability); - seed.set_serial_number(kTestSeedSerialNumber); - return seed; -} - -// Serializes |seed| to protobuf binary format. -std::string SerializeSeed(const VariationsSeed& seed) { - std::string serialized_seed; - seed.SerializeToString(&serialized_seed); - return serialized_seed; -} - } // namespace class FieldTrialCreatorTest : public ::testing::Test { protected: - FieldTrialCreatorTest() - : enabled_state_provider_( - new metrics::TestEnabledStateProvider(false, false)) { + FieldTrialCreatorTest() { VariationsService::RegisterPrefs(prefs_.registry()); - metrics::CleanExitBeacon::RegisterPrefs(prefs_.registry()); - metrics::MetricsStateManager::RegisterPrefs(prefs_.registry()); + global_feature_list_ = base::FeatureList::ClearInstanceForTesting(); } - metrics::MetricsStateManager* GetMetricsStateManager() { - // Lazy-initialize the metrics_state_manager so that it correctly reads the - // stability state from prefs after tests have a chance to initialize it. - if (!metrics_state_manager_) { - metrics_state_manager_ = metrics::MetricsStateManager::Create( - &prefs_, enabled_state_provider_.get(), base::string16(), - base::Bind(&StubStoreClientInfo), base::Bind(&StubLoadClientInfo)); - } - return metrics_state_manager_.get(); + ~FieldTrialCreatorTest() override { + // Clear out any features created by tests in this suite, and restore the + // global feature list. + base::FeatureList::ClearInstanceForTesting(); + base::FeatureList::RestoreInstanceForTesting( + std::move(global_feature_list_)); } protected: TestingPrefServiceSimple prefs_; private: - base::MessageLoop message_loop_; - std::unique_ptr<metrics::TestEnabledStateProvider> enabled_state_provider_; - std::unique_ptr<metrics::MetricsStateManager> metrics_state_manager_; + // The global feature list, which is ignored by tests in this suite. + std::unique_ptr<base::FeatureList> global_feature_list_; DISALLOW_COPY_AND_ASSIGN(FieldTrialCreatorTest); }; -TEST_F(FieldTrialCreatorTest, CreateTrialsFromSeed) { - // Create a local base::FieldTrialList, to hold the field trials created in - // this test. +TEST_F(FieldTrialCreatorTest, SetupFieldTrials_Basic) { + // This local FieldTrialList holds any field trials created in this test. base::FieldTrialList field_trial_list(nullptr); - - // Create a variations service. + TestVariationsServiceClient variations_service_client; TestVariationsFieldTrialCreator field_trial_creator( - base::MakeUnique<web_resource::TestRequestAllowedNotifier>(&prefs_), - &prefs_, new TestVariationsServiceClient()); - field_trial_creator.SetCreateTrialsFromSeedCalledForTesting(false); + &prefs_, &variations_service_client); - // Store a seed. - field_trial_creator.StoreSeed(SerializeSeed(CreateTestSeed()), std::string(), - std::string(), base::Time::Now(), false, false); + // Simulate a seed having been stored recently. prefs_.SetInt64(prefs::kVariationsLastFetchTime, base::Time::Now().ToInternalValue()); // Check that field trials are created from the seed. Since the test study has // only 1 experiment with 100% probability weight, we must be part of it. - EXPECT_TRUE(field_trial_creator.CreateTrialsFromSeed( - std::unique_ptr<const base::FieldTrial::EntropyProvider>(nullptr), - base::FeatureList::GetInstance())); + EXPECT_TRUE(field_trial_creator.SetupFieldTrials()); EXPECT_EQ(kTestSeedExperimentName, base::FieldTrialList::FindFullName(kTestSeedStudyName)); } -TEST_F(FieldTrialCreatorTest, CreateTrialsFromSeedNoLastFetchTime) { - // Create a local base::FieldTrialList, to hold the field trials created in - // this test. +TEST_F(FieldTrialCreatorTest, SetupFieldTrials_NoLastFetchTime) { + // This local FieldTrialList holds any field trials created in this test. base::FieldTrialList field_trial_list(nullptr); - - // Create a variations service + TestVariationsServiceClient variations_service_client; TestVariationsFieldTrialCreator field_trial_creator( - base::MakeUnique<web_resource::TestRequestAllowedNotifier>(&prefs_), - &prefs_, new TestVariationsServiceClient()); - field_trial_creator.SetCreateTrialsFromSeedCalledForTesting(false); + &prefs_, &variations_service_client); - // Store a seed. To simulate a first run, |prefs::kVariationsLastFetchTime| - // is left empty. - field_trial_creator.StoreSeed(SerializeSeed(CreateTestSeed()), std::string(), - std::string(), base::Time::Now(), false, false); + // Simulate a first run by leaving |prefs::kVariationsLastFetchTime| empty. EXPECT_EQ(0, prefs_.GetInt64(prefs::kVariationsLastFetchTime)); // Check that field trials are created from the seed. Since the test study has // only 1 experiment with 100% probability weight, we must be part of it. - EXPECT_TRUE(field_trial_creator.CreateTrialsFromSeed( - std::unique_ptr<const base::FieldTrial::EntropyProvider>(nullptr), - base::FeatureList::GetInstance())); + EXPECT_TRUE(field_trial_creator.SetupFieldTrials()); EXPECT_EQ(base::FieldTrialList::FindFullName(kTestSeedStudyName), kTestSeedExperimentName); } -TEST_F(FieldTrialCreatorTest, CreateTrialsFromOutdatedSeed) { - // Create a local base::FieldTrialList, to hold the field trials created in - // this test. +TEST_F(FieldTrialCreatorTest, SetupFieldTrials_ExpiredSeed) { + // This local FieldTrialList holds any field trials created in this test. base::FieldTrialList field_trial_list(nullptr); - - // Create a variations service. + TestVariationsServiceClient variations_service_client; TestVariationsFieldTrialCreator field_trial_creator( - base::MakeUnique<web_resource::TestRequestAllowedNotifier>(&prefs_), - &prefs_, new TestVariationsServiceClient()); - field_trial_creator.SetCreateTrialsFromSeedCalledForTesting(false); + &prefs_, &variations_service_client); - // Store a seed, with a fetch time 31 days in the past. + // Simulate an expired seed. const base::Time seed_date = base::Time::Now() - base::TimeDelta::FromDays(31); - field_trial_creator.StoreSeed(SerializeSeed(CreateTestSeed()), std::string(), - std::string(), seed_date, false, false); prefs_.SetInt64(prefs::kVariationsLastFetchTime, seed_date.ToInternalValue()); - // Check that field trials are not created from the seed. - EXPECT_FALSE(field_trial_creator.CreateTrialsFromSeed( - std::unique_ptr<const base::FieldTrial::EntropyProvider>(nullptr), - base::FeatureList::GetInstance())); + // Check that field trials are not created from the expired seed. + EXPECT_FALSE(field_trial_creator.SetupFieldTrials()); EXPECT_TRUE(base::FieldTrialList::FindFullName(kTestSeedStudyName).empty()); }
diff --git a/components/variations/service/variations_service.cc b/components/variations/service/variations_service.cc index 26988a5d..e4625fe8 100644 --- a/components/variations/service/variations_service.cc +++ b/components/variations/service/variations_service.cc
@@ -436,7 +436,7 @@ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); std::unique_ptr<VariationsSeed> seed(new VariationsSeed); - if (!field_trial_creator_.seed_store().StoreSeedData( + if (!field_trial_creator_.seed_store()->StoreSeedData( seed_data, seed_signature, country_code, date_fetched, is_delta_compressed, is_gzip_compressed, seed.get())) { return false; @@ -499,14 +499,14 @@ net::LOAD_DO_NOT_SAVE_COOKIES); pending_seed_request_->SetRequestContext(client_->GetURLRequestContext()); bool enable_deltas = false; - if (!field_trial_creator_.seed_store().variations_serial_number().empty() && + if (!field_trial_creator_.seed_store()->variations_serial_number().empty() && !disable_deltas_for_next_request_) { // Tell the server that delta-compressed seeds are supported. enable_deltas = true; // Get the seed only if its serial number doesn't match what we have. // If the fetch is being done over HTTP, encrypt the If-None-Match header. const std::string& original_sn = - field_trial_creator_.seed_store().variations_serial_number(); + field_trial_creator_.seed_store()->variations_serial_number(); if (!url.SchemeIs(url::kHttpsScheme) && base::FeatureList::IsEnabled(kHttpRetryFeature)) { std::string encrypted_sn; @@ -666,7 +666,7 @@ // Update the seed date value in local state (used for expiry check on // next start up), since 304 is a successful response. - field_trial_creator_.seed_store().UpdateSeedDateAndLogDayChange( + field_trial_creator_.seed_store()->UpdateSeedDateAndLogDayChange( response_date); } return; @@ -683,7 +683,7 @@ &is_gzip_compressed)) { // The header does not specify supported instance manipulations, unable to // process data. Details of errors were logged by GetInstanceManipulations. - field_trial_creator_.seed_store().ReportUnsupportedSeedFormatError(); + field_trial_creator_.seed_store()->ReportUnsupportedSeedFormatError(); return; }
diff --git a/components/viz/common/quads/selection.h b/components/viz/common/quads/selection.h index e2e21c0..b27dd41 100644 --- a/components/viz/common/quads/selection.h +++ b/components/viz/common/quads/selection.h
@@ -5,6 +5,8 @@ #ifndef COMPONENTS_VIZ_COMMON_QUADS_SELECTION_H_ #define COMPONENTS_VIZ_COMMON_QUADS_SELECTION_H_ +#include "base/strings/stringprintf.h" + namespace viz { template <typename BoundType> @@ -13,6 +15,11 @@ ~Selection() = default; BoundType start, end; + + std::string ToString() const { + return base::StringPrintf("Selection(%s, %s)", start.ToString().c_str(), + end.ToString().c_str()); + } }; template <typename BoundType>
diff --git a/components/viz/host/host_frame_sink_manager.cc b/components/viz/host/host_frame_sink_manager.cc index dc6023c..7872a99 100644 --- a/components/viz/host/host_frame_sink_manager.cc +++ b/components/viz/host/host_frame_sink_manager.cc
@@ -101,7 +101,8 @@ const RendererSettings& renderer_settings, mojom::CompositorFrameSinkAssociatedRequest request, mojom::CompositorFrameSinkClientPtr client, - mojom::DisplayPrivateAssociatedRequest display_private_request) { + mojom::DisplayPrivateAssociatedRequest display_private_request, + mojom::DisplayClientPtr display_client) { FrameSinkData& data = frame_sink_data_map_[frame_sink_id]; DCHECK(data.IsFrameSinkRegistered()); DCHECK(!data.HasCompositorFrameSinkData()); @@ -112,7 +113,7 @@ frame_sink_manager_->CreateRootCompositorFrameSink( frame_sink_id, surface_handle, force_software_compositing, renderer_settings, std::move(request), std::move(client), - std::move(display_private_request)); + std::move(display_private_request), std::move(display_client)); display_hit_test_query_[frame_sink_id] = base::MakeUnique<HitTestQuery>(); } @@ -213,7 +214,7 @@ DCHECK(data.IsFrameSinkRegistered()); DCHECK(!data.HasCompositorFrameSinkData()); - auto support = CompositorFrameSinkSupport::Create( + auto support = std::make_unique<CompositorFrameSinkSupport>( client, frame_sink_manager_impl_, frame_sink_id, is_root, needs_sync_points); support->SetDestructionCallback(
diff --git a/components/viz/host/host_frame_sink_manager.h b/components/viz/host/host_frame_sink_manager.h index 919d039..3fe0750 100644 --- a/components/viz/host/host_frame_sink_manager.h +++ b/components/viz/host/host_frame_sink_manager.h
@@ -97,7 +97,8 @@ const RendererSettings& renderer_settings, mojom::CompositorFrameSinkAssociatedRequest request, mojom::CompositorFrameSinkClientPtr client, - mojom::DisplayPrivateAssociatedRequest display_private_request); + mojom::DisplayPrivateAssociatedRequest display_private_request, + mojom::DisplayClientPtr display_client); // Creates a connection between client to viz, using |request| and |client|, // that allows the client to submit CompositorFrames. When no longer needed,
diff --git a/components/viz/host/host_frame_sink_manager_unittest.cc b/components/viz/host/host_frame_sink_manager_unittest.cc index e3c90d25..d91d44f 100644 --- a/components/viz/host/host_frame_sink_manager_unittest.cc +++ b/components/viz/host/host_frame_sink_manager_unittest.cc
@@ -20,6 +20,7 @@ #include "components/viz/test/fake_host_frame_sink_client.h" #include "components/viz/test/fake_surface_observer.h" #include "components/viz/test/mock_compositor_frame_sink_client.h" +#include "components/viz/test/mock_display_client.h" #include "services/viz/privileged/interfaces/compositing/frame_sink_manager.mojom.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -73,7 +74,8 @@ const RendererSettings& renderer_settings, mojom::CompositorFrameSinkAssociatedRequest request, mojom::CompositorFrameSinkClientPtr client, - mojom::DisplayPrivateAssociatedRequest display_private_request) override { + mojom::DisplayPrivateAssociatedRequest display_private_request, + mojom::DisplayClientPtr display_client) override { MockCreateRootCompositorFrameSink(frame_sink_id); } MOCK_METHOD1(MockCreateRootCompositorFrameSink, @@ -511,7 +513,8 @@ kFrameSinkChild1, 0 /* surface_handle */, false /* force_software_compositing */, RendererSettings() /* renderer_settings */, nullptr /* request */, - nullptr /* client */, nullptr /* display_private_request */); + nullptr /* client */, nullptr /* display_private_request */, + nullptr /* display_client */); EXPECT_TRUE(DisplayHitTestQueryExists(kFrameSinkChild1)); host().InvalidateFrameSinkId(kFrameSinkChild1); @@ -584,13 +587,14 @@ compositor_frame_sink_associated_info; MockCompositorFrameSinkClient compositor_frame_sink_client; mojom::DisplayPrivateAssociatedPtr display_private; + MockDisplayClient display_client; host().CreateRootCompositorFrameSink( kFrameSinkChild1, 0 /* surface_handle */, false /* force_software_compositing */, RendererSettings() /* renderer_settings */, MakeRequest(&compositor_frame_sink_associated_info), compositor_frame_sink_client.BindInterfacePtr(), - MakeRequest(&display_private)); + MakeRequest(&display_private), display_client.BindInterfacePtr()); EXPECT_TRUE(DisplayHitTestQueryExists(kFrameSinkChild1));
diff --git a/components/viz/service/display/display_unittest.cc b/components/viz/service/display/display_unittest.cc index e17f667..d6ce6fc 100644 --- a/components/viz/service/display/display_unittest.cc +++ b/components/viz/service/display/display_unittest.cc
@@ -97,12 +97,12 @@ class DisplayTest : public testing::Test { public: DisplayTest() - : support_( - CompositorFrameSinkSupport::Create(nullptr, - &manager_, - kArbitraryFrameSinkId, - true /* is_root */, - true /* needs_sync_points */)), + : support_(std::make_unique<CompositorFrameSinkSupport>( + nullptr, + &manager_, + kArbitraryFrameSinkId, + true /* is_root */, + true /* needs_sync_points */)), task_runner_(new base::NullTaskRunner) {} ~DisplayTest() override { support_->EvictCurrentSurface(); } @@ -648,7 +648,7 @@ display_->SetLocalSurfaceId(local_surface_id, 1.f); // Set up second frame sink + display. - auto support2 = CompositorFrameSinkSupport::Create( + auto support2 = std::make_unique<CompositorFrameSinkSupport>( nullptr, &manager_, kAnotherFrameSinkId, true /* is_root */, true /* needs_sync_points */); auto begin_frame_source2 = base::MakeUnique<StubBeginFrameSource>(); @@ -2455,7 +2455,7 @@ MockCompositorFrameSinkClient sub_client; - auto sub_support = CompositorFrameSinkSupport::Create( + auto sub_support = std::make_unique<CompositorFrameSinkSupport>( &sub_client, &manager_, kAnotherFrameSinkId, false /* is_root */, true /* needs_sync_points */);
diff --git a/components/viz/service/display/surface_aggregator_perftest.cc b/components/viz/service/display/surface_aggregator_perftest.cc index 294a68b..ef7bc854 100644 --- a/components/viz/service/display/surface_aggregator_perftest.cc +++ b/components/viz/service/display/surface_aggregator_perftest.cc
@@ -50,7 +50,7 @@ std::vector<std::unique_ptr<CompositorFrameSinkSupport>> child_supports( num_surfaces); for (int i = 0; i < num_surfaces; i++) { - child_supports[i] = CompositorFrameSinkSupport::Create( + child_supports[i] = std::make_unique<CompositorFrameSinkSupport>( nullptr, &manager_, FrameSinkId(1, i + 1), kIsChildRoot, kNeedsSyncPoints); } @@ -104,7 +104,7 @@ frame_builder.Build()); } - auto root_support = CompositorFrameSinkSupport::Create( + auto root_support = std::make_unique<CompositorFrameSinkSupport>( nullptr, &manager_, FrameSinkId(1, num_surfaces + 1), kIsRoot, kNeedsSyncPoints); timer_.Reset();
diff --git a/components/viz/service/display/surface_aggregator_pixeltest.cc b/components/viz/service/display/surface_aggregator_pixeltest.cc index 9f07353d..7e2d9e9 100644 --- a/components/viz/service/display/surface_aggregator_pixeltest.cc +++ b/components/viz/service/display/surface_aggregator_pixeltest.cc
@@ -34,11 +34,12 @@ class SurfaceAggregatorPixelTest : public cc::RendererPixelTest<GLRenderer> { public: SurfaceAggregatorPixelTest() - : support_(CompositorFrameSinkSupport::Create(nullptr, - &manager_, - kArbitraryRootFrameSinkId, - kIsRoot, - kNeedsSyncPoints)) {} + : support_(std::make_unique<CompositorFrameSinkSupport>( + nullptr, + &manager_, + kArbitraryRootFrameSinkId, + kIsRoot, + kNeedsSyncPoints)) {} ~SurfaceAggregatorPixelTest() override { support_->EvictCurrentSurface(); } protected: @@ -101,10 +102,9 @@ // Draws a frame with simple surface embedding. TEST_F(SurfaceAggregatorPixelTest, DrawSimpleAggregatedFrame) { gfx::Size child_size(200, 100); - std::unique_ptr<CompositorFrameSinkSupport> child_support = - CompositorFrameSinkSupport::Create(nullptr, &manager_, - kArbitraryChildFrameSinkId, - kIsChildRoot, kNeedsSyncPoints); + auto child_support = std::make_unique<CompositorFrameSinkSupport>( + nullptr, &manager_, kArbitraryChildFrameSinkId, kIsChildRoot, + kNeedsSyncPoints); LocalSurfaceId child_local_surface_id = allocator_.GenerateId(); SurfaceId child_surface_id(child_support->frame_sink_id(), @@ -184,14 +184,12 @@ // bottom_blue_quad (100x100 @ 0x100) // right_child -> top_blue_quad (100x100 @ 0x0), // bottom_green_quad (100x100 @ 0x100) - std::unique_ptr<CompositorFrameSinkSupport> left_support = - CompositorFrameSinkSupport::Create(nullptr, &manager_, - kArbitraryLeftFrameSinkId, - kIsChildRoot, kNeedsSyncPoints); - std::unique_ptr<CompositorFrameSinkSupport> right_support = - CompositorFrameSinkSupport::Create(nullptr, &manager_, - kArbitraryRightFrameSinkId, - kIsChildRoot, kNeedsSyncPoints); + auto left_support = std::make_unique<CompositorFrameSinkSupport>( + nullptr, &manager_, kArbitraryLeftFrameSinkId, kIsChildRoot, + kNeedsSyncPoints); + auto right_support = std::make_unique<CompositorFrameSinkSupport>( + nullptr, &manager_, kArbitraryRightFrameSinkId, kIsChildRoot, + kNeedsSyncPoints); LocalSurfaceId left_child_local_id = allocator_.GenerateId(); SurfaceId left_child_id(left_support->frame_sink_id(), left_child_local_id); LocalSurfaceId right_child_local_id = allocator_.GenerateId();
diff --git a/components/viz/service/display/surface_aggregator_unittest.cc b/components/viz/service/display/surface_aggregator_unittest.cc index 2fdd6b74..1506b9ed 100644 --- a/components/viz/service/display/surface_aggregator_unittest.cc +++ b/components/viz/service/display/surface_aggregator_unittest.cc
@@ -99,11 +99,12 @@ public: explicit SurfaceAggregatorTest(bool use_damage_rect) : observer_(false), - support_(CompositorFrameSinkSupport::Create(&fake_client_, - &manager_, - kArbitraryRootFrameSinkId, - kRootIsRoot, - kNeedsSyncPoints)), + support_(std::make_unique<CompositorFrameSinkSupport>( + &fake_client_, + &manager_, + kArbitraryRootFrameSinkId, + kRootIsRoot, + kNeedsSyncPoints)), aggregator_(manager_.surface_manager(), nullptr, use_damage_rect) { manager_.surface_manager()->AddObserver(&observer_); } @@ -333,12 +334,12 @@ public: explicit SurfaceAggregatorValidSurfaceTest(bool use_damage_rect) : SurfaceAggregatorTest(use_damage_rect), - child_support_( - CompositorFrameSinkSupport::Create(nullptr, - &manager_, - kArbitraryReservedFrameSinkId, - kChildIsRoot, - kNeedsSyncPoints)) {} + child_support_(std::make_unique<CompositorFrameSinkSupport>( + nullptr, + &manager_, + kArbitraryReservedFrameSinkId, + kChildIsRoot, + kNeedsSyncPoints)) {} SurfaceAggregatorValidSurfaceTest() : SurfaceAggregatorValidSurfaceTest(false) {} @@ -454,7 +455,7 @@ } TEST_F(SurfaceAggregatorValidSurfaceTest, OpacityCopied) { - auto embedded_support = CompositorFrameSinkSupport::Create( + auto embedded_support = std::make_unique<CompositorFrameSinkSupport>( nullptr, &manager_, kArbitraryFrameSinkId1, kRootIsRoot, kNeedsSyncPoints); LocalSurfaceId embedded_local_surface_id = allocator_.GenerateId(); @@ -572,7 +573,7 @@ // embedded_surface has a frame containing only a solid color quad. The solid // color quad should be aggregated into the final frame. TEST_F(SurfaceAggregatorValidSurfaceTest, SimpleSurfaceReference) { - auto embedded_support = CompositorFrameSinkSupport::Create( + auto embedded_support = std::make_unique<CompositorFrameSinkSupport>( nullptr, &manager_, kArbitraryFrameSinkId1, kRootIsRoot, kNeedsSyncPoints); LocalSurfaceId embedded_local_surface_id = allocator_.GenerateId(); @@ -617,14 +618,14 @@ // SurfaceAggregator will embed a fallback Surface, if available. If the primary // Surface is available, though, the fallback will not be used. TEST_F(SurfaceAggregatorValidSurfaceTest, FallbackSurfaceReference) { - auto primary_child_support = CompositorFrameSinkSupport::Create( + auto primary_child_support = std::make_unique<CompositorFrameSinkSupport>( nullptr, &manager_, kArbitraryFrameSinkId1, kChildIsRoot, kNeedsSyncPoints); LocalSurfaceId primary_child_local_surface_id = allocator_.GenerateId(); SurfaceId primary_child_surface_id(primary_child_support->frame_sink_id(), primary_child_local_surface_id); - auto fallback_child_support = CompositorFrameSinkSupport::Create( + auto fallback_child_support = std::make_unique<CompositorFrameSinkSupport>( nullptr, &manager_, kArbitraryFrameSinkId2, kChildIsRoot, kNeedsSyncPoints); LocalSurfaceId fallback_child_local_surface_id = allocator_.GenerateId(); @@ -742,7 +743,7 @@ // surface embedded by a parent SurfaceDrawQuad marked as // stretch_content_to_fill_bounds. TEST_F(SurfaceAggregatorValidSurfaceTest, StretchContentToFillBounds) { - auto primary_child_support = CompositorFrameSinkSupport::Create( + auto primary_child_support = std::make_unique<CompositorFrameSinkSupport>( nullptr, &manager_, kArbitraryFrameSinkId1, kChildIsRoot, kNeedsSyncPoints); LocalSurfaceId primary_child_local_surface_id = allocator_.GenerateId(); @@ -800,7 +801,7 @@ // This test verifies that in the presence of both primary Surface and fallback // Surface, the fallback will not be used. TEST_F(SurfaceAggregatorValidSurfaceTest, FallbackSurfaceReferenceWithPrimary) { - auto primary_child_support = CompositorFrameSinkSupport::Create( + auto primary_child_support = std::make_unique<CompositorFrameSinkSupport>( nullptr, &manager_, kArbitraryFrameSinkId1, kChildIsRoot, kNeedsSyncPoints); LocalSurfaceId primary_child_local_surface_id = allocator_.GenerateId(); @@ -819,7 +820,7 @@ arraysize(primary_child_passes), primary_child_local_surface_id, device_scale_factor); - auto fallback_child_support = CompositorFrameSinkSupport::Create( + auto fallback_child_support = std::make_unique<CompositorFrameSinkSupport>( nullptr, &manager_, kArbitraryFrameSinkId2, kChildIsRoot, kNeedsSyncPoints); LocalSurfaceId fallback_child_local_surface_id = allocator_.GenerateId(); @@ -883,7 +884,7 @@ } TEST_F(SurfaceAggregatorValidSurfaceTest, CopyRequest) { - auto embedded_support = CompositorFrameSinkSupport::Create( + auto embedded_support = std::make_unique<CompositorFrameSinkSupport>( nullptr, &manager_, kArbitraryFrameSinkId1, kChildIsRoot, kNeedsSyncPoints); LocalSurfaceId embedded_local_surface_id = allocator_.GenerateId(); @@ -944,7 +945,7 @@ // Root surface may contain copy requests. TEST_F(SurfaceAggregatorValidSurfaceTest, RootCopyRequest) { - auto embedded_support = CompositorFrameSinkSupport::Create( + auto embedded_support = std::make_unique<CompositorFrameSinkSupport>( nullptr, &manager_, kArbitraryFrameSinkId2, kChildIsRoot, kNeedsSyncPoints); LocalSurfaceId embedded_local_surface_id = allocator_.GenerateId(); @@ -1026,10 +1027,10 @@ } TEST_F(SurfaceAggregatorValidSurfaceTest, UnreferencedSurface) { - auto embedded_support = CompositorFrameSinkSupport::Create( + auto embedded_support = std::make_unique<CompositorFrameSinkSupport>( nullptr, &manager_, kArbitraryFrameSinkId1, kChildIsRoot, kNeedsSyncPoints); - auto parent_support = CompositorFrameSinkSupport::Create( + auto parent_support = std::make_unique<CompositorFrameSinkSupport>( nullptr, &manager_, kArbitraryFrameSinkId2, kRootIsRoot, kNeedsSyncPoints); LocalSurfaceId embedded_local_surface_id = allocator_.GenerateId(); @@ -1551,13 +1552,13 @@ SkBlendMode::kSrcIn, // 5 SkBlendMode::kDstIn, // 6 }; - auto grandchild_support = CompositorFrameSinkSupport::Create( + auto grandchild_support = std::make_unique<CompositorFrameSinkSupport>( nullptr, &manager_, kArbitraryFrameSinkId1, kChildIsRoot, kNeedsSyncPoints); - auto child_one_support = CompositorFrameSinkSupport::Create( + auto child_one_support = std::make_unique<CompositorFrameSinkSupport>( nullptr, &manager_, kArbitraryFrameSinkId2, kChildIsRoot, kNeedsSyncPoints); - auto child_two_support = CompositorFrameSinkSupport::Create( + auto child_two_support = std::make_unique<CompositorFrameSinkSupport>( nullptr, &manager_, kArbitraryFrameSinkId3, kChildIsRoot, kNeedsSyncPoints); int pass_id = 1; @@ -1676,7 +1677,7 @@ // contributing render pass' transform in the aggregate frame should not be // affected. TEST_F(SurfaceAggregatorValidSurfaceTest, AggregateMultiplePassWithTransform) { - auto middle_support = CompositorFrameSinkSupport::Create( + auto middle_support = std::make_unique<CompositorFrameSinkSupport>( nullptr, &manager_, kArbitraryMiddleFrameSinkId, kChildIsRoot, kNeedsSyncPoints); // Innermost child surface. @@ -1846,7 +1847,7 @@ // Tests that damage rects are aggregated correctly when surfaces change. TEST_F(SurfaceAggregatorValidSurfaceTest, AggregateDamageRect) { - auto parent_support = CompositorFrameSinkSupport::Create( + auto parent_support = std::make_unique<CompositorFrameSinkSupport>( nullptr, &manager_, kArbitraryMiddleFrameSinkId, kChildIsRoot, kNeedsSyncPoints); Quad child_quads[] = {Quad::RenderPassQuad(1)}; @@ -2491,7 +2492,7 @@ TEST_F(SurfaceAggregatorWithResourcesTest, TakeResourcesOneSurface) { FakeCompositorFrameSinkClient client; - auto support = CompositorFrameSinkSupport::Create( + auto support = std::make_unique<CompositorFrameSinkSupport>( &client, &manager_, kArbitraryRootFrameSinkId, kRootIsRoot, kNeedsSyncPoints); LocalSurfaceId local_surface_id(7u, base::UnguessableToken::Create()); @@ -2527,7 +2528,7 @@ // surface are returned to the appropriate client. TEST_F(SurfaceAggregatorWithResourcesTest, ReturnResourcesAsSurfacesChange) { FakeCompositorFrameSinkClient client; - auto support = CompositorFrameSinkSupport::Create( + auto support = std::make_unique<CompositorFrameSinkSupport>( &client, &manager_, kArbitraryRootFrameSinkId, kRootIsRoot, kNeedsSyncPoints); LocalSurfaceId local_surface_id1(7u, base::UnguessableToken::Create()); @@ -2565,7 +2566,7 @@ TEST_F(SurfaceAggregatorWithResourcesTest, TakeInvalidResources) { FakeCompositorFrameSinkClient client; - auto support = CompositorFrameSinkSupport::Create( + auto support = std::make_unique<CompositorFrameSinkSupport>( &client, &manager_, kArbitraryRootFrameSinkId, kRootIsRoot, kNeedsSyncPoints); LocalSurfaceId local_surface_id(7u, base::UnguessableToken::Create()); @@ -2598,9 +2599,9 @@ TEST_F(SurfaceAggregatorWithResourcesTest, TwoSurfaces) { FakeCompositorFrameSinkClient client; - auto support1 = CompositorFrameSinkSupport::Create( + auto support1 = std::make_unique<CompositorFrameSinkSupport>( &client, &manager_, FrameSinkId(1, 1), kChildIsRoot, kNeedsSyncPoints); - auto support2 = CompositorFrameSinkSupport::Create( + auto support2 = std::make_unique<CompositorFrameSinkSupport>( &client, &manager_, FrameSinkId(2, 2), kChildIsRoot, kNeedsSyncPoints); LocalSurfaceId local_frame1_id(7u, base::UnguessableToken::Create()); SurfaceId surface1_id(support1->frame_sink_id(), local_frame1_id); @@ -2642,13 +2643,13 @@ // Ensure that aggregator completely ignores Surfaces that reference invalid // resources. TEST_F(SurfaceAggregatorWithResourcesTest, InvalidChildSurface) { - auto root_support = CompositorFrameSinkSupport::Create( + auto root_support = std::make_unique<CompositorFrameSinkSupport>( nullptr, &manager_, kArbitraryRootFrameSinkId, kRootIsRoot, kNeedsSyncPoints); - auto middle_support = CompositorFrameSinkSupport::Create( + auto middle_support = std::make_unique<CompositorFrameSinkSupport>( nullptr, &manager_, kArbitraryMiddleFrameSinkId, kChildIsRoot, kNeedsSyncPoints); - auto child_support = CompositorFrameSinkSupport::Create( + auto child_support = std::make_unique<CompositorFrameSinkSupport>( nullptr, &manager_, kArbitraryFrameSinkId1, kChildIsRoot, kNeedsSyncPoints); LocalSurfaceId root_local_surface_id(7u, kArbitraryToken); @@ -2699,9 +2700,9 @@ } TEST_F(SurfaceAggregatorWithResourcesTest, SecureOutputTexture) { - auto support1 = CompositorFrameSinkSupport::Create( + auto support1 = std::make_unique<CompositorFrameSinkSupport>( nullptr, &manager_, FrameSinkId(1, 1), kChildIsRoot, kNeedsSyncPoints); - auto support2 = CompositorFrameSinkSupport::Create( + auto support2 = std::make_unique<CompositorFrameSinkSupport>( nullptr, &manager_, FrameSinkId(2, 2), kChildIsRoot, kNeedsSyncPoints); LocalSurfaceId local_frame1_id(7u, base::UnguessableToken::Create()); SurfaceId surface1_id(support1->frame_sink_id(), local_frame1_id); @@ -2877,7 +2878,7 @@ // grand child surface quads. TEST_F(SurfaceAggregatorValidSurfaceTest, HasDamageByChangingGrandChildSurface) { - auto grand_child_support = CompositorFrameSinkSupport::Create( + auto grand_child_support = std::make_unique<CompositorFrameSinkSupport>( nullptr, &manager_, kArbitraryMiddleFrameSinkId, kChildIsRoot, kNeedsSyncPoints);
diff --git a/components/viz/service/frame_sinks/compositor_frame_sink_impl.cc b/components/viz/service/frame_sinks/compositor_frame_sink_impl.cc index bad4f16..5fb7caea 100644 --- a/components/viz/service/frame_sinks/compositor_frame_sink_impl.cc +++ b/components/viz/service/frame_sinks/compositor_frame_sink_impl.cc
@@ -17,7 +17,7 @@ mojom::CompositorFrameSinkClientPtr client) : compositor_frame_sink_client_(std::move(client)), compositor_frame_sink_binding_(this, std::move(request)), - support_(CompositorFrameSinkSupport::Create( + support_(std::make_unique<CompositorFrameSinkSupport>( compositor_frame_sink_client_.get(), frame_sink_manager, frame_sink_id,
diff --git a/components/viz/service/frame_sinks/compositor_frame_sink_support.cc b/components/viz/service/frame_sinks/compositor_frame_sink_support.cc index 29c778f..471bd03 100644 --- a/components/viz/service/frame_sinks/compositor_frame_sink_support.cc +++ b/components/viz/service/frame_sinks/compositor_frame_sink_support.cc
@@ -17,17 +17,6 @@ namespace viz { -// static -std::unique_ptr<CompositorFrameSinkSupport> CompositorFrameSinkSupport::Create( - mojom::CompositorFrameSinkClient* client, - FrameSinkManagerImpl* frame_sink_manager, - const FrameSinkId& frame_sink_id, - bool is_root, - bool needs_sync_tokens) { - return std::make_unique<CompositorFrameSinkSupport>( - client, frame_sink_manager, frame_sink_id, is_root, needs_sync_tokens); -} - CompositorFrameSinkSupport::CompositorFrameSinkSupport( mojom::CompositorFrameSinkClient* client, FrameSinkManagerImpl* frame_sink_manager, @@ -75,7 +64,7 @@ } void CompositorFrameSinkSupport::SetDestructionCallback( - base::OnceCallback<void()> callback) { + base::OnceClosure callback) { destruction_callback_ = std::move(callback); }
diff --git a/components/viz/service/frame_sinks/compositor_frame_sink_support.h b/components/viz/service/frame_sinks/compositor_frame_sink_support.h index d6187c9..6228dd8b 100644 --- a/components/viz/service/frame_sinks/compositor_frame_sink_support.h +++ b/components/viz/service/frame_sinks/compositor_frame_sink_support.h
@@ -6,7 +6,6 @@ #define COMPONENTS_VIZ_SERVICE_FRAME_SINKS_COMPOSITOR_FRAME_SINK_SUPPORT_H_ #include <memory> -#include <unordered_set> #include <vector> #include "base/callback.h" @@ -43,14 +42,6 @@ static const uint64_t kFrameIndexStart = 2; - // DEPRECATED(kylechar): It's now possible to use the constructor directly. - static std::unique_ptr<CompositorFrameSinkSupport> Create( - mojom::CompositorFrameSinkClient* client, - FrameSinkManagerImpl* frame_sink_manager, - const FrameSinkId& frame_sink_id, - bool is_root, - bool needs_sync_tokens); - CompositorFrameSinkSupport(mojom::CompositorFrameSinkClient* client, FrameSinkManagerImpl* frame_sink_manager, const FrameSinkId& frame_sink_id, @@ -73,7 +64,7 @@ void SetAggregatedDamageCallback(AggregatedDamageCallback callback); // Sets callback called on destruction. - void SetDestructionCallback(base::OnceCallback<void()> callback); + void SetDestructionCallback(base::OnceClosure callback); // This allows the FrameSinkManagerImpl to pass a BeginFrameSource to use. void SetBeginFrameSource(BeginFrameSource* begin_frame_source); @@ -183,7 +174,7 @@ const bool needs_sync_tokens_; // A callback that will be run at the start of the destructor if set. - base::OnceCallback<void()> destruction_callback_; + base::OnceClosure destruction_callback_; // TODO(crbug.com/754872): Remove once tab capture has moved into VIZ. AggregatedDamageCallback aggregated_damage_callback_;
diff --git a/components/viz/service/frame_sinks/compositor_frame_sink_support_unittest.cc b/components/viz/service/frame_sinks/compositor_frame_sink_support_unittest.cc index 8e6ebdf1..3d55c540 100644 --- a/components/viz/service/frame_sinks/compositor_frame_sink_support_unittest.cc +++ b/components/viz/service/frame_sinks/compositor_frame_sink_support_unittest.cc
@@ -114,7 +114,7 @@ manager_.RegisterFrameSinkId(kArbitraryFrameSinkId); manager_.SetFrameSinkDebugLabel(kArbitraryFrameSinkId, "kArbitraryFrameSinkId"); - support_ = CompositorFrameSinkSupport::Create( + support_ = std::make_unique<CompositorFrameSinkSupport>( &fake_support_client_, &manager_, kArbitraryFrameSinkId, kIsRoot, kNeedsSyncPoints); support_->SetBeginFrameSource(&begin_frame_source_); @@ -503,7 +503,7 @@ manager_.SetFrameSinkDebugLabel(kAnotherArbitraryFrameSinkId, "kAnotherArbitraryFrameSinkId"); MockCompositorFrameSinkClient mock_client; - auto support = CompositorFrameSinkSupport::Create( + auto support = std::make_unique<CompositorFrameSinkSupport>( &mock_client, &manager_, kAnotherArbitraryFrameSinkId, kIsRoot, kNeedsSyncPoints); LocalSurfaceId local_surface_id(6, kArbitraryToken); @@ -529,7 +529,7 @@ manager_.SetFrameSinkDebugLabel(kAnotherArbitraryFrameSinkId, "kAnotherArbitraryFrameSinkId"); MockCompositorFrameSinkClient mock_client; - auto support = CompositorFrameSinkSupport::Create( + auto support = std::make_unique<CompositorFrameSinkSupport>( &mock_client, &manager_, kAnotherArbitraryFrameSinkId, kIsRoot, kNeedsSyncPoints); LocalSurfaceId local_surface_id(7, kArbitraryToken);
diff --git a/components/viz/service/frame_sinks/direct_layer_tree_frame_sink.cc b/components/viz/service/frame_sinks/direct_layer_tree_frame_sink.cc index bbf3e01..f7b9821 100644 --- a/components/viz/service/frame_sinks/direct_layer_tree_frame_sink.cc +++ b/components/viz/service/frame_sinks/direct_layer_tree_frame_sink.cc
@@ -21,6 +21,7 @@ CompositorFrameSinkSupportManager* support_manager, FrameSinkManagerImpl* frame_sink_manager, Display* display, + mojom::DisplayClient* display_client, scoped_refptr<ContextProvider> context_provider, scoped_refptr<ContextProvider> worker_context_provider, scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner, @@ -34,7 +35,8 @@ frame_sink_id_(frame_sink_id), support_manager_(support_manager), frame_sink_manager_(frame_sink_manager), - display_(display) { + display_(display), + display_client_(display_client) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); capabilities_.must_always_swap = true; // Display and DirectLayerTreeFrameSink share a GL context, so sync @@ -47,12 +49,14 @@ CompositorFrameSinkSupportManager* support_manager, FrameSinkManagerImpl* frame_sink_manager, Display* display, + mojom::DisplayClient* display_client, scoped_refptr<VulkanContextProvider> vulkan_context_provider) : LayerTreeFrameSink(std::move(vulkan_context_provider)), frame_sink_id_(frame_sink_id), support_manager_(support_manager), frame_sink_manager_(frame_sink_manager), - display_(display) { + display_(display), + display_client_(display_client) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); capabilities_.must_always_swap = true; } @@ -136,8 +140,11 @@ void DirectLayerTreeFrameSink::DisplayDidReceiveCALayerParams( const gfx::CALayerParams& ca_layer_params) { - // TODO(ccameron): Continue plumbing |ca_layer_params| through to - // ui::AcceleratedWidgetMac. + // If |ca_layer_params| should have content only when there exists a client + // to send it to. + DCHECK(ca_layer_params.is_empty || display_client_); + if (display_client_) + display_client_->OnDisplayReceivedCALayerParams(ca_layer_params); } void DirectLayerTreeFrameSink::DidReceiveCompositorFrameAck(
diff --git a/components/viz/service/frame_sinks/direct_layer_tree_frame_sink.h b/components/viz/service/frame_sinks/direct_layer_tree_frame_sink.h index d19fbee..4044f9a1 100644 --- a/components/viz/service/frame_sinks/direct_layer_tree_frame_sink.h +++ b/components/viz/service/frame_sinks/direct_layer_tree_frame_sink.h
@@ -13,6 +13,7 @@ #include "components/viz/service/display/display_client.h" #include "components/viz/service/frame_sinks/compositor_frame_sink_support.h" #include "components/viz/service/viz_service_export.h" +#include "services/viz/privileged/interfaces/compositing/display_private.mojom.h" #include "services/viz/public/interfaces/compositing/compositor_frame_sink.mojom.h" namespace cc { @@ -39,6 +40,7 @@ CompositorFrameSinkSupportManager* support_manager, FrameSinkManagerImpl* frame_sink_manager, Display* display, + mojom::DisplayClient* display_client, scoped_refptr<ContextProvider> context_provider, scoped_refptr<ContextProvider> worker_context_provider, scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner, @@ -49,6 +51,7 @@ CompositorFrameSinkSupportManager* support_manager, FrameSinkManagerImpl* frame_sink_manager, Display* display, + mojom::DisplayClient* display_client, scoped_refptr<VulkanContextProvider> vulkan_context_provider); ~DirectLayerTreeFrameSink() override; @@ -66,9 +69,6 @@ void DisplayDidReceiveCALayerParams( const gfx::CALayerParams& ca_layer_params) override; - protected: - std::unique_ptr<CompositorFrameSinkSupport> support_; // protected for test. - private: // mojom::CompositorFrameSinkClient implementation: void DidReceiveCompositorFrameAck( @@ -92,12 +92,16 @@ // This class is only meant to be used on a single thread. THREAD_CHECKER(thread_checker_); + std::unique_ptr<CompositorFrameSinkSupport> support_; + const FrameSinkId frame_sink_id_; LocalSurfaceId local_surface_id_; CompositorFrameSinkSupportManager* const support_manager_; FrameSinkManagerImpl* frame_sink_manager_; ParentLocalSurfaceIdAllocator parent_local_surface_id_allocator_; Display* display_; + // |display_client_| may be nullptr on platforms that do not use it. + mojom::DisplayClient* display_client_ = nullptr; gfx::Size last_swap_frame_size_; float device_scale_factor_ = 1.f; bool is_lost_ = false;
diff --git a/components/viz/service/frame_sinks/direct_layer_tree_frame_sink_unittest.cc b/components/viz/service/frame_sinks/direct_layer_tree_frame_sink_unittest.cc index 39198d7..ece69fa 100644 --- a/components/viz/service/frame_sinks/direct_layer_tree_frame_sink_unittest.cc +++ b/components/viz/service/frame_sinks/direct_layer_tree_frame_sink_unittest.cc
@@ -33,8 +33,6 @@ class TestDirectLayerTreeFrameSink : public DirectLayerTreeFrameSink { public: using DirectLayerTreeFrameSink::DirectLayerTreeFrameSink; - - CompositorFrameSinkSupport* support() const { return support_.get(); } }; class TestCompositorFrameSinkSupportManager @@ -50,7 +48,7 @@ const FrameSinkId& frame_sink_id, bool is_root, bool needs_sync_points) override { - return CompositorFrameSinkSupport::Create( + return std::make_unique<CompositorFrameSinkSupport>( client, frame_sink_manager_, frame_sink_id, is_root, needs_sync_points); } @@ -85,9 +83,8 @@ std::move(scheduler), task_runner_); layer_tree_frame_sink_ = std::make_unique<TestDirectLayerTreeFrameSink>( kArbitraryFrameSinkId, &support_manager_, &frame_sink_manager_, - display_.get(), context_provider_, nullptr, task_runner_, - &gpu_memory_buffer_manager_, &bitmap_manager_); - + display_.get(), nullptr /* display_client */, context_provider_, + nullptr, task_runner_, &gpu_memory_buffer_manager_, &bitmap_manager_); layer_tree_frame_sink_->BindToClient(&layer_tree_frame_sink_client_); display_->Resize(display_size_); display_->SetVisible(true);
diff --git a/components/viz/service/frame_sinks/frame_sink_manager_impl.cc b/components/viz/service/frame_sinks/frame_sink_manager_impl.cc index f538fa0..1f348f85 100644 --- a/components/viz/service/frame_sinks/frame_sink_manager_impl.cc +++ b/components/viz/service/frame_sinks/frame_sink_manager_impl.cc
@@ -121,7 +121,8 @@ const RendererSettings& renderer_settings, mojom::CompositorFrameSinkAssociatedRequest request, mojom::CompositorFrameSinkClientPtr client, - mojom::DisplayPrivateAssociatedRequest display_private_request) { + mojom::DisplayPrivateAssociatedRequest display_private_request, + mojom::DisplayClientPtr display_client) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK_NE(surface_handle, gpu::kNullSurfaceHandle); DCHECK_EQ(0u, compositor_frame_sinks_.count(frame_sink_id)); @@ -134,8 +135,8 @@ auto frame_sink = std::make_unique<RootCompositorFrameSinkImpl>( this, frame_sink_id, std::move(display), std::move(begin_frame_source), - std::move(request), std::move(client), - std::move(display_private_request)); + std::move(request), std::move(client), std::move(display_private_request), + std::move(display_client)); SinkAndSupport& entry = compositor_frame_sinks_[frame_sink_id]; DCHECK(entry.support); // |entry| was created by RootCompositorFrameSinkImpl. entry.sink = std::move(frame_sink);
diff --git a/components/viz/service/frame_sinks/frame_sink_manager_impl.h b/components/viz/service/frame_sinks/frame_sink_manager_impl.h index e7e6983..9b36d4f 100644 --- a/components/viz/service/frame_sinks/frame_sink_manager_impl.h +++ b/components/viz/service/frame_sinks/frame_sink_manager_impl.h
@@ -65,7 +65,8 @@ const RendererSettings& renderer_settings, mojom::CompositorFrameSinkAssociatedRequest request, mojom::CompositorFrameSinkClientPtr client, - mojom::DisplayPrivateAssociatedRequest display_private_request) override; + mojom::DisplayPrivateAssociatedRequest display_private_request, + mojom::DisplayClientPtr display_client) override; void CreateCompositorFrameSink( const FrameSinkId& frame_sink_id, mojom::CompositorFrameSinkRequest request,
diff --git a/components/viz/service/frame_sinks/frame_sink_manager_unittest.cc b/components/viz/service/frame_sinks/frame_sink_manager_unittest.cc index e9d916f..22465738 100644 --- a/components/viz/service/frame_sinks/frame_sink_manager_unittest.cc +++ b/components/viz/service/frame_sinks/frame_sink_manager_unittest.cc
@@ -25,8 +25,8 @@ std::unique_ptr<CompositorFrameSinkSupport> CreateCompositorFrameSinkSupport( const FrameSinkId& frame_sink_id) { - return CompositorFrameSinkSupport::Create(nullptr, &manager_, frame_sink_id, - false, false); + return std::make_unique<CompositorFrameSinkSupport>( + nullptr, &manager_, frame_sink_id, false, false); } const BeginFrameSource* GetBeginFrameSource(
diff --git a/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc b/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc index b36fb386..d7094b53 100644 --- a/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc +++ b/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc
@@ -19,11 +19,13 @@ std::unique_ptr<SyntheticBeginFrameSource> synthetic_begin_frame_source, mojom::CompositorFrameSinkAssociatedRequest request, mojom::CompositorFrameSinkClientPtr client, - mojom::DisplayPrivateAssociatedRequest display_private_request) + mojom::DisplayPrivateAssociatedRequest display_private_request, + mojom::DisplayClientPtr display_client) : compositor_frame_sink_client_(std::move(client)), compositor_frame_sink_binding_(this, std::move(request)), + display_client_(std::move(display_client)), display_private_binding_(this, std::move(display_private_request)), - support_(CompositorFrameSinkSupport::Create( + support_(std::make_unique<CompositorFrameSinkSupport>( compositor_frame_sink_client_.get(), frame_sink_manager, frame_sink_id, @@ -130,8 +132,11 @@ void RootCompositorFrameSinkImpl::DisplayDidReceiveCALayerParams( const gfx::CALayerParams& ca_layer_params) { - // TODO(ccameron): Continue plumbing |ca_layer_params| through to - // ui::AcceleratedWidgetMac. + // If |ca_layer_params| should have content only when there exists a client + // to send it to. + DCHECK(ca_layer_params.is_empty || display_client_); + if (display_client_) + display_client_->OnDisplayReceivedCALayerParams(ca_layer_params); } void RootCompositorFrameSinkImpl::DisplayDidDrawAndSwap() {}
diff --git a/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.h b/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.h index 5d5fcad..9d5264ee 100644 --- a/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.h +++ b/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.h
@@ -37,7 +37,8 @@ std::unique_ptr<SyntheticBeginFrameSource> begin_frame_source, mojom::CompositorFrameSinkAssociatedRequest request, mojom::CompositorFrameSinkClientPtr client, - mojom::DisplayPrivateAssociatedRequest display_private_request); + mojom::DisplayPrivateAssociatedRequest display_private_request, + mojom::DisplayClientPtr display_client); ~RootCompositorFrameSinkImpl() override; @@ -82,6 +83,8 @@ mojom::CompositorFrameSinkClientPtr compositor_frame_sink_client_; mojo::AssociatedBinding<mojom::CompositorFrameSink> compositor_frame_sink_binding_; + // |display_client_| may be nullptr on platforms that do not use it. + mojom::DisplayClientPtr display_client_; mojo::AssociatedBinding<mojom::DisplayPrivate> display_private_binding_; // Must be destroyed before |compositor_frame_sink_client_|. This must never
diff --git a/components/viz/service/frame_sinks/surface_references_unittest.cc b/components/viz/service/frame_sinks/surface_references_unittest.cc index 62aa6bd..22c2255 100644 --- a/components/viz/service/frame_sinks/surface_references_unittest.cc +++ b/components/viz/service/frame_sinks/surface_references_unittest.cc
@@ -68,7 +68,7 @@ manager_->RegisterFrameSinkId(frame_sink_id); constexpr bool is_root = false; constexpr bool needs_sync_points = true; - support_ptr = CompositorFrameSinkSupport::Create( + support_ptr = std::make_unique<CompositorFrameSinkSupport>( nullptr, manager_.get(), frame_sink_id, is_root, needs_sync_points); } return *support_ptr;
diff --git a/components/viz/service/frame_sinks/surface_synchronization_unittest.cc b/components/viz/service/frame_sinks/surface_synchronization_unittest.cc index 2a068688..e04c310 100644 --- a/components/viz/service/frame_sinks/surface_synchronization_unittest.cc +++ b/components/viz/service/frame_sinks/surface_synchronization_unittest.cc
@@ -112,7 +112,7 @@ } void CreateFrameSink(const FrameSinkId& frame_sink_id, bool is_root) { - supports_[frame_sink_id] = CompositorFrameSinkSupport::Create( + supports_[frame_sink_id] = std::make_unique<CompositorFrameSinkSupport>( &support_client_, &frame_sink_manager_, frame_sink_id, is_root, kNeedsSyncPoints); } @@ -170,19 +170,19 @@ begin_frame_source_->SetClient(&begin_frame_source_client_); now_src_ = base::MakeUnique<base::SimpleTestTickClock>(); frame_sink_manager_.surface_manager()->AddObserver(&surface_observer_); - supports_[kDisplayFrameSink] = CompositorFrameSinkSupport::Create( + supports_[kDisplayFrameSink] = std::make_unique<CompositorFrameSinkSupport>( &support_client_, &frame_sink_manager_, kDisplayFrameSink, kIsRoot, kNeedsSyncPoints); - supports_[kParentFrameSink] = CompositorFrameSinkSupport::Create( + supports_[kParentFrameSink] = std::make_unique<CompositorFrameSinkSupport>( &support_client_, &frame_sink_manager_, kParentFrameSink, kIsChildRoot, kNeedsSyncPoints); - supports_[kChildFrameSink1] = CompositorFrameSinkSupport::Create( + supports_[kChildFrameSink1] = std::make_unique<CompositorFrameSinkSupport>( &support_client_, &frame_sink_manager_, kChildFrameSink1, kIsChildRoot, kNeedsSyncPoints); - supports_[kChildFrameSink2] = CompositorFrameSinkSupport::Create( + supports_[kChildFrameSink2] = std::make_unique<CompositorFrameSinkSupport>( &support_client_, &frame_sink_manager_, kChildFrameSink2, kIsChildRoot, kNeedsSyncPoints);
diff --git a/components/viz/service/frame_sinks/video_detector_unittest.cc b/components/viz/service/frame_sinks/video_detector_unittest.cc index b1fe23ae..843a0f4 100644 --- a/components/viz/service/frame_sinks/video_detector_unittest.cc +++ b/components/viz/service/frame_sinks/video_detector_unittest.cc
@@ -168,10 +168,9 @@ static uint32_t client_id = 1; FrameSinkId frame_sink_id(client_id++, 0); frame_sink_manager_.RegisterFrameSinkId(frame_sink_id); - std::unique_ptr<CompositorFrameSinkSupport> frame_sink = - CompositorFrameSinkSupport::Create(&frame_sink_client_, - &frame_sink_manager_, frame_sink_id, - is_root, needs_sync_points); + auto frame_sink = std::make_unique<CompositorFrameSinkSupport>( + &frame_sink_client_, &frame_sink_manager_, frame_sink_id, is_root, + needs_sync_points); SendUpdate(frame_sink.get(), gfx::Rect()); return frame_sink; }
diff --git a/components/viz/service/surfaces/surface_hittest_unittest.cc b/components/viz/service/surfaces/surface_hittest_unittest.cc index c97f437..76fbf553 100644 --- a/components/viz/service/surfaces/surface_hittest_unittest.cc +++ b/components/viz/service/surfaces/surface_hittest_unittest.cc
@@ -82,10 +82,10 @@ void SetUp() override { testing::Test::SetUp(); - supports_.push_back(CompositorFrameSinkSupport::Create( + supports_.push_back(std::make_unique<CompositorFrameSinkSupport>( &client_, &frame_sink_manager_, kRootFrameSink, kIsRoot, kNeedsSyncPoints)); - supports_.push_back(CompositorFrameSinkSupport::Create( + supports_.push_back(std::make_unique<CompositorFrameSinkSupport>( &client_, &frame_sink_manager_, kChildFrameSink, kIsChildRoot, kNeedsSyncPoints)); }
diff --git a/components/viz/service/surfaces/surface_unittest.cc b/components/viz/service/surfaces/surface_unittest.cc index c3d160d..6717e9d 100644 --- a/components/viz/service/surfaces/surface_unittest.cc +++ b/components/viz/service/surfaces/surface_unittest.cc
@@ -31,7 +31,7 @@ FrameSinkManagerImpl frame_sink_manager; MockCompositorFrameSinkClient client; - auto support = CompositorFrameSinkSupport::Create( + auto support = std::make_unique<CompositorFrameSinkSupport>( &client, &frame_sink_manager, kArbitraryFrameSinkId, kIsRoot, kNeedsSyncPoints); { @@ -86,7 +86,7 @@ FrameSinkManagerImpl frame_sink_manager( SurfaceManager::LifetimeType::SEQUENCES); SurfaceManager* surface_manager = frame_sink_manager.surface_manager(); - auto support = CompositorFrameSinkSupport::Create( + auto support = std::make_unique<CompositorFrameSinkSupport>( nullptr, &frame_sink_manager, kArbitraryFrameSinkId, kIsRoot, kNeedsSyncPoints); @@ -120,7 +120,7 @@ TEST(SurfaceTest, CopyRequestLifetime) { FrameSinkManagerImpl frame_sink_manager; SurfaceManager* surface_manager = frame_sink_manager.surface_manager(); - auto support = CompositorFrameSinkSupport::Create( + auto support = std::make_unique<CompositorFrameSinkSupport>( nullptr, &frame_sink_manager, kArbitraryFrameSinkId, kIsRoot, kNeedsSyncPoints);
diff --git a/components/viz/test/BUILD.gn b/components/viz/test/BUILD.gn index a5b3a22b..76aeb7e 100644 --- a/components/viz/test/BUILD.gn +++ b/components/viz/test/BUILD.gn
@@ -25,6 +25,8 @@ "fake_surface_observer.h", "mock_compositor_frame_sink_client.cc", "mock_compositor_frame_sink_client.h", + "mock_display_client.cc", + "mock_display_client.h", "mock_helper.h", "ordered_simple_task_runner.cc", "ordered_simple_task_runner.h",
diff --git a/components/viz/test/mock_display_client.cc b/components/viz/test/mock_display_client.cc new file mode 100644 index 0000000..31a7ac8 --- /dev/null +++ b/components/viz/test/mock_display_client.cc
@@ -0,0 +1,19 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/viz/test/mock_display_client.h" + +namespace viz { + +MockDisplayClient::MockDisplayClient() : binding_(this) {} + +MockDisplayClient::~MockDisplayClient() = default; + +mojom::DisplayClientPtr MockDisplayClient::BindInterfacePtr() { + mojom::DisplayClientPtr ptr; + binding_.Bind(MakeRequest(&ptr)); + return ptr; +} + +} // namespace viz
diff --git a/components/viz/test/mock_display_client.h b/components/viz/test/mock_display_client.h new file mode 100644 index 0000000..f78f0a2 --- /dev/null +++ b/components/viz/test/mock_display_client.h
@@ -0,0 +1,32 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_VIZ_TEST_MOCK_DISPLAY_CLIENT_H_ +#define COMPONENTS_VIZ_TEST_MOCK_DISPLAY_CLIENT_H_ + +#include "mojo/public/cpp/bindings/binding.h" +#include "services/viz/privileged/interfaces/compositing/frame_sink_manager.mojom.h" +#include "testing/gmock/include/gmock/gmock.h" + +namespace viz { + +class MockDisplayClient : public mojom::DisplayClient { + public: + MockDisplayClient(); + ~MockDisplayClient() override; + + mojom::DisplayClientPtr BindInterfacePtr(); + + // mojom::CompositorFrameSinkClient implementation. + MOCK_METHOD1(OnDisplayReceivedCALayerParams, void(const gfx::CALayerParams&)); + + private: + mojo::Binding<mojom::DisplayClient> binding_; + + DISALLOW_COPY_AND_ASSIGN(MockDisplayClient); +}; + +} // namespace viz + +#endif // COMPONENTS_VIZ_TEST_MOCK_DISPLAY_CLIENT_H_
diff --git a/components/viz/test/test_frame_sink_manager.h b/components/viz/test/test_frame_sink_manager.h index 5d0bafb9..e66535b 100644 --- a/components/viz/test/test_frame_sink_manager.h +++ b/components/viz/test/test_frame_sink_manager.h
@@ -31,8 +31,8 @@ const RendererSettings& renderer_settings, mojom::CompositorFrameSinkAssociatedRequest request, mojom::CompositorFrameSinkClientPtr client, - mojom::DisplayPrivateAssociatedRequest display_private_request) override { - } + mojom::DisplayPrivateAssociatedRequest display_private_request, + mojom::DisplayClientPtr display_client) override {} void CreateCompositorFrameSink( const FrameSinkId& frame_sink_id, mojom::CompositorFrameSinkRequest request,
diff --git a/components/viz/test/test_layer_tree_frame_sink.cc b/components/viz/test/test_layer_tree_frame_sink.cc index 53b7bb8f1..1fba2ada 100644 --- a/components/viz/test/test_layer_tree_frame_sink.cc +++ b/components/viz/test/test_layer_tree_frame_sink.cc
@@ -101,9 +101,9 @@ constexpr bool is_root = false; constexpr bool needs_sync_points = true; - support_ = CompositorFrameSinkSupport::Create(this, frame_sink_manager_.get(), - frame_sink_id_, is_root, - needs_sync_points); + support_ = std::make_unique<CompositorFrameSinkSupport>( + this, frame_sink_manager_.get(), frame_sink_id_, is_root, + needs_sync_points); client_->SetBeginFrameSource(&external_begin_frame_source_); if (begin_frame_source_) { frame_sink_manager_->RegisterBeginFrameSource(begin_frame_source_.get(),
diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc index d5e4641..d7856938 100644 --- a/content/app/content_main_runner.cc +++ b/content/app/content_main_runner.cc
@@ -659,8 +659,13 @@ service_manager::SandboxTypeFromCommandLine(command_line), params.sandbox_info)); #elif defined(OS_MACOSX) + // Do not initialize the sandbox at this point if the V2 + // sandbox is enabled for the process type. + bool v2_enabled = base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableV2Sandbox); + if (process_type == switches::kRendererProcess || - process_type == switches::kPpapiPluginProcess || + process_type == switches::kPpapiPluginProcess || v2_enabled || (delegate_ && delegate_->DelaySandboxInitialization(process_type))) { // On OS X the renderer sandbox needs to be initialized later in the // startup sequence in RendererMainPlatformDelegate::EnableSandbox().
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn index 5b77db4..bf89326 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn
@@ -1569,6 +1569,8 @@ "shared_worker/worker_storage_partition.h", "site_instance_impl.cc", "site_instance_impl.h", + "site_isolation_policy.cc", + "site_isolation_policy.h", "speech/speech_recognition_dispatcher_host.cc", "speech/speech_recognition_dispatcher_host.h", "speech/speech_recognition_manager_impl.cc", @@ -1813,8 +1815,6 @@ "media/capture/fake_webcontent_capture_machine.h", "media/capture/web_contents_video_capture_device.cc", "media/capture/web_contents_video_capture_device.h", - "media/capture/window_activity_tracker.cc", - "media/capture/window_activity_tracker.h", ] if (use_aura) { sources += [ @@ -1824,16 +1824,12 @@ "media/capture/cursor_renderer_aura.h", "media/capture/desktop_capture_device_aura.cc", "media/capture/desktop_capture_device_aura.h", - "media/capture/window_activity_tracker_aura.cc", - "media/capture/window_activity_tracker_aura.h", ] } if (is_mac) { sources += [ "media/capture/cursor_renderer_mac.h", "media/capture/cursor_renderer_mac.mm", - "media/capture/window_activity_tracker_mac.h", - "media/capture/window_activity_tracker_mac.mm", ] deps += [ "//sandbox/mac:seatbelt" ] } @@ -2265,6 +2261,8 @@ "compositor/gpu_vsync_begin_frame_source.h", "compositor/image_transport_factory.cc", "compositor/image_transport_factory.h", + "compositor/in_process_display_client.cc", + "compositor/in_process_display_client.h", "compositor/offscreen_browser_compositor_output_surface.cc", "compositor/offscreen_browser_compositor_output_surface.h", "compositor/owned_mailbox.cc",
diff --git a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc index c51ad1c9..8730105 100644 --- a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc +++ b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc
@@ -808,8 +808,7 @@ RunAriaTest(FILE_PATH_LITERAL("aria-sort-html-table.html")); } -IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, - DISABLED_AccessibilityAriaSpinButton) { +IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAriaSpinButton) { RunAriaTest(FILE_PATH_LITERAL("aria-spinbutton.html")); } @@ -1342,6 +1341,10 @@ } #endif +IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityInputNumber) { + RunHtmlTest(FILE_PATH_LITERAL("input-number.html")); +} + IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityInputPassword) { RunHtmlTest(FILE_PATH_LITERAL("input-password.html")); }
diff --git a/content/browser/appcache/appcache_quota_client.cc b/content/browser/appcache/appcache_quota_client.cc index 97b6ef7..9c2c470 100644 --- a/content/browser/appcache/appcache_quota_client.cc +++ b/content/browser/appcache/appcache_quota_client.cc
@@ -11,17 +11,18 @@ #include "base/bind.h" #include "base/bind_helpers.h" #include "content/browser/appcache/appcache_service_impl.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" using storage::QuotaClient; namespace { -storage::QuotaStatusCode NetErrorCodeToQuotaStatus(int code) { +blink::QuotaStatusCode NetErrorCodeToQuotaStatus(int code) { if (code == net::OK) - return storage::kQuotaStatusOk; + return blink::QuotaStatusCode::kOk; else if (code == net::ERR_ABORTED) - return storage::kQuotaErrorAbort; + return blink::QuotaStatusCode::kErrorAbort; else - return storage::kQuotaStatusUnknown; + return blink::QuotaStatusCode::kUnknown; } void RunFront(content::AppCacheQuotaClient::RequestQueue* queue) { @@ -117,7 +118,7 @@ DCHECK(!quota_manager_is_destroyed_); if (!service_) { - callback.Run(storage::kQuotaErrorAbort); + callback.Run(blink::QuotaStatusCode::kErrorAbort); return; } @@ -239,7 +240,7 @@ RunFront(&pending_serial_requests_); if (!current_delete_request_callback_.is_null()) { - current_delete_request_callback_.Run(storage::kQuotaErrorAbort); + current_delete_request_callback_.Run(blink::QuotaStatusCode::kErrorAbort); current_delete_request_callback_.Reset(); GetServiceDeleteCallback()->Cancel(); }
diff --git a/content/browser/appcache/appcache_quota_client_unittest.cc b/content/browser/appcache/appcache_quota_client_unittest.cc index 1ba3f2d..53ef9e4 100644 --- a/content/browser/appcache/appcache_quota_client_unittest.cc +++ b/content/browser/appcache/appcache_quota_client_unittest.cc
@@ -33,7 +33,7 @@ kOriginB("http://host:8000"), kOriginOther("http://other"), usage_(0), - delete_status_(storage::kQuotaStatusUnknown), + delete_status_(blink::QuotaStatusCode::kUnknown), num_get_origin_usage_completions_(0), num_get_origins_completions_(0), num_delete_origins_completions_(0), @@ -65,10 +65,10 @@ return origins_; } - storage::QuotaStatusCode DeleteOriginData(storage::QuotaClient* client, - storage::StorageType type, - const GURL& origin) { - delete_status_ = storage::kQuotaStatusUnknown; + blink::QuotaStatusCode DeleteOriginData(storage::QuotaClient* client, + storage::StorageType type, + const GURL& origin) { + delete_status_ = blink::QuotaStatusCode::kUnknown; AsyncDeleteOriginData(client, type, origin); base::RunLoop().RunUntilIdle(); return delete_status_; @@ -140,7 +140,7 @@ origins_ = origins; } - void OnDeleteOriginDataComplete(storage::QuotaStatusCode status) { + void OnDeleteOriginDataComplete(blink::QuotaStatusCode status) { ++num_delete_origins_completions_; delete_status_ = status; } @@ -148,7 +148,7 @@ base::test::ScopedTaskEnvironment scoped_task_environment_; int64_t usage_; std::set<GURL> origins_; - storage::QuotaStatusCode delete_status_; + blink::QuotaStatusCode delete_status_; int num_get_origin_usage_completions_; int num_get_origins_completions_; int num_delete_origins_completions_; @@ -174,8 +174,10 @@ EXPECT_TRUE(GetOriginsForType(client, kPerm).empty()); EXPECT_TRUE(GetOriginsForHost(client, kTemp, kOriginA.host()).empty()); EXPECT_TRUE(GetOriginsForHost(client, kPerm, kOriginA.host()).empty()); - EXPECT_EQ(storage::kQuotaStatusOk, DeleteOriginData(client, kTemp, kOriginA)); - EXPECT_EQ(storage::kQuotaStatusOk, DeleteOriginData(client, kPerm, kOriginA)); + EXPECT_EQ(blink::QuotaStatusCode::kOk, + DeleteOriginData(client, kTemp, kOriginA)); + EXPECT_EQ(blink::QuotaStatusCode::kOk, + DeleteOriginData(client, kPerm, kOriginA)); Call_NotifyAppCacheDestroyed(client); Call_OnQuotaManagerDestroyed(client); @@ -192,9 +194,9 @@ EXPECT_TRUE(GetOriginsForType(client, kPerm).empty()); EXPECT_TRUE(GetOriginsForHost(client, kTemp, kOriginA.host()).empty()); EXPECT_TRUE(GetOriginsForHost(client, kPerm, kOriginA.host()).empty()); - EXPECT_EQ(storage::kQuotaErrorAbort, + EXPECT_EQ(blink::QuotaStatusCode::kErrorAbort, DeleteOriginData(client, kTemp, kOriginA)); - EXPECT_EQ(storage::kQuotaErrorAbort, + EXPECT_EQ(blink::QuotaStatusCode::kErrorAbort, DeleteOriginData(client, kPerm, kOriginA)); Call_OnQuotaManagerDestroyed(client); @@ -269,15 +271,17 @@ // Perm deletions are short circuited in the Client and // should not reach the AppCacheServiceImpl. - EXPECT_EQ(storage::kQuotaStatusOk, DeleteOriginData(client, kPerm, kOriginA)); + EXPECT_EQ(blink::QuotaStatusCode::kOk, + DeleteOriginData(client, kPerm, kOriginA)); EXPECT_EQ(0, mock_service_.delete_called_count()); - EXPECT_EQ(storage::kQuotaStatusOk, DeleteOriginData(client, kTemp, kOriginA)); + EXPECT_EQ(blink::QuotaStatusCode::kOk, + DeleteOriginData(client, kTemp, kOriginA)); EXPECT_EQ(1, mock_service_.delete_called_count()); mock_service_.set_mock_delete_appcaches_for_origin_result( net::ERR_ABORTED); - EXPECT_EQ(storage::kQuotaErrorAbort, + EXPECT_EQ(blink::QuotaStatusCode::kErrorAbort, DeleteOriginData(client, kTemp, kOriginA)); EXPECT_EQ(2, mock_service_.delete_called_count()); @@ -359,7 +363,7 @@ EXPECT_EQ(3, num_delete_origins_completions_); EXPECT_EQ(0, usage_); EXPECT_TRUE(origins_.empty()); - EXPECT_EQ(storage::kQuotaErrorAbort, delete_status_); + EXPECT_EQ(blink::QuotaStatusCode::kErrorAbort, delete_status_); Call_OnQuotaManagerDestroyed(client); } @@ -412,13 +416,13 @@ // Should have been aborted. EXPECT_EQ(1, num_delete_origins_completions_); - EXPECT_EQ(storage::kQuotaErrorAbort, delete_status_); + EXPECT_EQ(blink::QuotaStatusCode::kErrorAbort, delete_status_); // A real completion callback from the service should // be dropped if it comes in after NotifyAppCacheDestroyed. base::RunLoop().RunUntilIdle(); EXPECT_EQ(1, num_delete_origins_completions_); - EXPECT_EQ(storage::kQuotaErrorAbort, delete_status_); + EXPECT_EQ(blink::QuotaStatusCode::kErrorAbort, delete_status_); Call_OnQuotaManagerDestroyed(client); }
diff --git a/content/browser/appcache/appcache_storage_impl.cc b/content/browser/appcache/appcache_storage_impl.cc index 7cbf946c..be08ad05 100644 --- a/content/browser/appcache/appcache_storage_impl.cc +++ b/content/browser/appcache/appcache_storage_impl.cc
@@ -37,6 +37,7 @@ #include "storage/browser/quota/quota_client.h" #include "storage/browser/quota/quota_manager.h" #include "storage/browser/quota/quota_manager_proxy.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" namespace content { @@ -601,7 +602,7 @@ AppCache* newest_cache); void GetQuotaThenSchedule(); - void OnQuotaCallback(storage::QuotaStatusCode status, + void OnQuotaCallback(blink::QuotaStatusCode status, int64_t usage, int64_t quota); @@ -673,11 +674,11 @@ } void AppCacheStorageImpl::StoreGroupAndCacheTask::OnQuotaCallback( - storage::QuotaStatusCode status, + blink::QuotaStatusCode status, int64_t usage, int64_t quota) { if (storage_) { - if (status == storage::kQuotaStatusOk) + if (status == blink::QuotaStatusCode::kOk) space_available_ = std::max(static_cast<int64_t>(0), quota - usage); else space_available_ = 0;
diff --git a/content/browser/appcache/appcache_storage_impl_unittest.cc b/content/browser/appcache/appcache_storage_impl_unittest.cc index b522034..b977de3 100644 --- a/content/browser/appcache/appcache_storage_impl_unittest.cc +++ b/content/browser/appcache/appcache_storage_impl_unittest.cc
@@ -298,7 +298,7 @@ } void CallCallback(const UsageAndQuotaCallback& callback) { - callback.Run(storage::kQuotaStatusOk, 0, kMockQuota); + callback.Run(blink::QuotaStatusCode::kOk, 0, kMockQuota); } bool async_;
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc index a4fbae3..819c5b5 100644 --- a/content/browser/browser_main_loop.cc +++ b/content/browser/browser_main_loop.cc
@@ -84,6 +84,7 @@ #include "content/browser/renderer_host/media/media_stream_manager.h" #include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/service_manager/service_manager_context.h" +#include "content/browser/site_isolation_policy.h" #include "content/browser/speech/speech_recognition_manager_impl.h" #include "content/browser/startup_task_runner.h" #include "content/browser/tracing/background_tracing_manager_impl.h" @@ -93,7 +94,6 @@ #include "content/browser/webui/url_data_manager.h" #include "content/common/content_switches_internal.h" #include "content/common/service_manager/service_manager_connection_impl.h" -#include "content/common/site_isolation_policy.h" #include "content/common/task_scheduler.h" #include "content/public/browser/browser_main_parts.h" #include "content/public/browser/content_browser_client.h" @@ -911,8 +911,6 @@ ChildProcessSecurityPolicyImpl* policy = ChildProcessSecurityPolicyImpl::GetInstance(); policy->AddIsolatedOrigins(SiteIsolationPolicy::GetIsolatedOrigins()); - policy->AddIsolatedOrigins( - GetContentClient()->browser()->GetOriginsRequiringDedicatedProcess()); // Record metrics about which site isolation flags have been turned on. SiteIsolationPolicy::RecordSiteIsolationFlagUsage();
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc index 9d5d4f2..c83e5ba 100644 --- a/content/browser/browser_plugin/browser_plugin_guest.cc +++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -41,7 +41,6 @@ #include "content/common/drag_messages.h" #include "content/common/input/ime_text_span_conversions.h" #include "content/common/input_messages.h" -#include "content/common/site_isolation_policy.h" #include "content/common/text_input_state.h" #include "content/common/view_messages.h" #include "content/public/browser/browser_context.h"
diff --git a/content/browser/browser_side_navigation_browsertest.cc b/content/browser/browser_side_navigation_browsertest.cc index ae06280..a8b3b10a 100644 --- a/content/browser/browser_side_navigation_browsertest.cc +++ b/content/browser/browser_side_navigation_browsertest.cc
@@ -14,7 +14,6 @@ #include "content/browser/loader/resource_dispatcher_host_impl.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/common/frame_messages.h" -#include "content/common/site_isolation_policy.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/notification_types.h" #include "content/public/browser/web_contents.h"
diff --git a/content/browser/browsing_instance.cc b/content/browser/browsing_instance.cc index 33f0ebc..c7ed216 100644 --- a/content/browser/browsing_instance.cc +++ b/content/browser/browsing_instance.cc
@@ -7,7 +7,7 @@ #include "base/command_line.h" #include "base/logging.h" #include "content/browser/site_instance_impl.h" -#include "content/common/site_isolation_policy.h" +#include "content/browser/site_isolation_policy.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/content_browser_client.h" #include "content/public/common/content_switches.h"
diff --git a/content/browser/cache_storage/cache_storage.h b/content/browser/cache_storage/cache_storage.h index 9f50974a..e3b2e71 100644 --- a/content/browser/cache_storage/cache_storage.h +++ b/content/browser/cache_storage/cache_storage.h
@@ -40,6 +40,12 @@ class CacheStorageManager; class CacheStorageScheduler; +namespace cache_storage_manager_unittest { +class CacheStorageManagerTest; +FORWARD_DECLARE_TEST(CacheStorageManagerTest, PersistedCacheKeyUsed); +FORWARD_DECLARE_TEST(CacheStorageManagerTest, TestErrorInitializingCache); +} // namespace cache_storage_manager_unittest + // TODO(jkarlin): Constrain the total bytes used per origin. // CacheStorage holds the set of caches for a given origin. It is @@ -131,9 +137,13 @@ private: friend class CacheStorageCacheHandle; friend class CacheStorageCache; - friend class CacheStorageManagerTest; - FRIEND_TEST_ALL_PREFIXES(CacheStorageManagerTest, PersistedCacheKeyUsed); - FRIEND_TEST_ALL_PREFIXES(CacheStorageManagerTest, TestErrorInitializingCache); + friend class cache_storage_manager_unittest::CacheStorageManagerTest; + FRIEND_TEST_ALL_PREFIXES( + cache_storage_manager_unittest::CacheStorageManagerTest, + PersistedCacheKeyUsed); + FRIEND_TEST_ALL_PREFIXES( + cache_storage_manager_unittest::CacheStorageManagerTest, + TestErrorInitializingCache); class CacheLoader; class MemoryLoader; class SimpleCacheLoader;
diff --git a/content/browser/cache_storage/cache_storage_cache.cc b/content/browser/cache_storage/cache_storage_cache.cc index abf93d284..9254ab8 100644 --- a/content/browser/cache_storage/cache_storage_cache.cc +++ b/content/browser/cache_storage/cache_storage_cache.cc
@@ -569,8 +569,8 @@ BatchDidGetUsageAndQuota( operations, std::move(callback), std::move(bad_message_callback), - 0 /* space_required */, 0 /* side_data_size */, storage::kQuotaStatusOk, - 0 /* usage */, 0 /* quota */); + 0 /* space_required */, 0 /* side_data_size */, + blink::QuotaStatusCode::kOk, 0 /* usage */, 0 /* quota */); } void CacheStorageCache::BatchDidGetUsageAndQuota( @@ -579,7 +579,7 @@ BadMessageCallback bad_message_callback, uint64_t space_required, uint64_t side_data_size, - storage::QuotaStatusCode status_code, + blink::QuotaStatusCode status_code, int64_t usage, int64_t quota) { base::CheckedNumeric<uint64_t> safe_space_required = space_required; @@ -596,7 +596,7 @@ base::BindOnce(std::move(callback), CacheStorageError::kErrorStorage)); return; } - if (status_code != storage::kQuotaStatusOk || + if (status_code != blink::QuotaStatusCode::kOk || safe_space_required.ValueOrDie() > quota) { base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(std::move(callback), @@ -1089,10 +1089,10 @@ base::Time expected_response_time, scoped_refptr<net::IOBuffer> buffer, int buf_len, - storage::QuotaStatusCode status_code, + blink::QuotaStatusCode status_code, int64_t usage, int64_t quota) { - if (status_code != storage::kQuotaStatusOk || (buf_len > quota - usage)) { + if (status_code != blink::QuotaStatusCode::kOk || (buf_len > quota - usage)) { base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(std::move(callback), CacheStorageError::kErrorQuotaExceeded));
diff --git a/content/browser/cache_storage/cache_storage_cache.h b/content/browser/cache_storage/cache_storage_cache.h index 8fc7117..6cd3d3d 100644 --- a/content/browser/cache_storage/cache_storage_cache.h +++ b/content/browser/cache_storage/cache_storage_cache.h
@@ -21,7 +21,7 @@ #include "content/common/service_worker/service_worker_types.h" #include "net/base/io_buffer.h" #include "net/disk_cache/disk_cache.h" -#include "storage/common/quota/quota_status_code.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" #include "third_party/WebKit/public/platform/modules/cache_storage/cache_storage.mojom.h" namespace crypto { @@ -51,6 +51,11 @@ class CacheResponse; } +namespace cache_storage_cache_unittest { +class TestCacheStorageCache; +class CacheStorageCacheTest; +} // namespace cache_storage_cache_unittest + // Represents a ServiceWorker Cache as seen in // https://slightlyoff.github.io/ServiceWorker/spec/service_worker/ The // asynchronous methods are executed serially. Callbacks to the public functions @@ -150,7 +155,7 @@ BadMessageCallback bad_message_callback, uint64_t space_required, uint64_t side_data_size, - storage::QuotaStatusCode status_code, + blink::QuotaStatusCode status_code, int64_t usage, int64_t quota); // Callback passed to operations. If |error| is a real error, invokes @@ -224,8 +229,8 @@ }; friend class base::RefCounted<CacheStorageCache>; - friend class TestCacheStorageCache; - friend class CacheStorageCacheTest; + friend class cache_storage_cache_unittest::TestCacheStorageCache; + friend class cache_storage_cache_unittest::CacheStorageCacheTest; struct PutContext; struct QueryCacheContext; @@ -302,7 +307,7 @@ base::Time expected_response_time, scoped_refptr<net::IOBuffer> buffer, int buf_len, - storage::QuotaStatusCode status_code, + blink::QuotaStatusCode status_code, int64_t usage, int64_t quota); @@ -316,7 +321,7 @@ base::Time expected_response_time, scoped_refptr<net::IOBuffer> buffer, int buf_len, - storage::QuotaStatusCode status_code, + blink::QuotaStatusCode status_code, int64_t usage, int64_t quota); void WriteSideDataDidOpenEntry(ErrorCallback callback, @@ -348,7 +353,7 @@ void PutDidDeleteEntry(std::unique_ptr<PutContext> put_context, blink::mojom::CacheStorageError error); void PutDidGetUsageAndQuota(std::unique_ptr<PutContext> put_context, - storage::QuotaStatusCode status_code, + blink::QuotaStatusCode status_code, int64_t usage, int64_t quota); void PutDidCreateEntry(std::unique_ptr<disk_cache::Entry*> entry_ptr,
diff --git a/content/browser/cache_storage/cache_storage_cache_unittest.cc b/content/browser/cache_storage/cache_storage_cache_unittest.cc index 952cadb..4f92723 100644 --- a/content/browser/cache_storage/cache_storage_cache_unittest.cc +++ b/content/browser/cache_storage/cache_storage_cache_unittest.cc
@@ -52,8 +52,8 @@ using blink::mojom::CacheStorageError; namespace content { +namespace cache_storage_cache_unittest { -namespace { const char kTestData[] = "Hello World"; const char kOrigin[] = "http://example.com"; const char kCacheName[] = "test_cache"; @@ -289,8 +289,6 @@ *result = reason; } -} // namespace - // A CacheStorageCache that can optionally delay during backend creation. class TestCacheStorageCache : public CacheStorageCache { public: @@ -1930,4 +1928,5 @@ CacheStorageCacheTestP, ::testing::Values(false, true)); +} // namespace cache_storage_cache_unittest } // namespace content
diff --git a/content/browser/cache_storage/cache_storage_manager.cc b/content/browser/cache_storage/cache_storage_manager.cc index 30dc6bd..9d00a42bb 100644 --- a/content/browser/cache_storage/cache_storage_manager.cc +++ b/content/browser/cache_storage/cache_storage_manager.cc
@@ -31,7 +31,7 @@ #include "net/base/url_util.h" #include "storage/browser/quota/quota_manager_proxy.h" #include "storage/common/database/database_identifier.h" -#include "storage/common/quota/quota_status_code.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" #include "url/gurl.h" #include "url/origin.h" @@ -49,8 +49,9 @@ DCHECK_CURRENTLY_ON(BrowserThread::IO); base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::BindOnce(callback, rv ? storage::kQuotaStatusOk - : storage::kQuotaErrorAbort)); + FROM_HERE, + base::BindOnce(callback, rv ? blink::QuotaStatusCode::kOk + : blink::QuotaStatusCode::kErrorAbort)); } // Calculate the sum of all cache sizes in this store, but only if all sizes are @@ -123,7 +124,7 @@ FROM_HERE, base::BindOnce(callback, out_origins)); } -void EmptyQuotaStatusCallback(storage::QuotaStatusCode code) {} +void EmptyQuotaStatusCallback(blink::QuotaStatusCode code) {} void AllOriginSizesReported( std::unique_ptr<std::vector<CacheStorageUsageInfo>> usages, @@ -426,7 +427,7 @@ if (IsMemoryBacked()) { base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::BindOnce(callback, storage::kQuotaStatusOk)); + FROM_HERE, base::BindOnce(callback, blink::QuotaStatusCode::kOk)); return; }
diff --git a/content/browser/cache_storage/cache_storage_manager.h b/content/browser/cache_storage/cache_storage_manager.h index d3d126ba..841fea6 100644 --- a/content/browser/cache_storage/cache_storage_manager.h +++ b/content/browser/cache_storage/cache_storage_manager.h
@@ -35,6 +35,10 @@ class CacheStorageQuotaClient; +namespace cache_storage_manager_unittest { +class CacheStorageManagerTest; +} + // Keeps track of a CacheStorage per origin. There is one // CacheStorageManager per ServiceWorkerContextCore. // TODO(jkarlin): Remove CacheStorage from memory once they're no @@ -98,7 +102,7 @@ private: friend class CacheStorageContextImpl; - friend class CacheStorageManagerTest; + friend class cache_storage_manager_unittest::CacheStorageManagerTest; friend class CacheStorageQuotaClient; typedef std::map<GURL, std::unique_ptr<CacheStorage>> CacheStorageMap;
diff --git a/content/browser/cache_storage/cache_storage_manager_unittest.cc b/content/browser/cache_storage/cache_storage_manager_unittest.cc index 823d724..7372078 100644 --- a/content/browser/cache_storage/cache_storage_manager_unittest.cc +++ b/content/browser/cache_storage/cache_storage_manager_unittest.cc
@@ -52,14 +52,14 @@ #include "storage/browser/test/mock_special_storage_policy.h" #include "storage/common/blob_storage/blob_handle.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" #include "third_party/WebKit/public/platform/modules/cache_storage/cache_storage.mojom.h" using blink::mojom::CacheStorageError; using network::mojom::FetchResponseType; namespace content { - -namespace { +namespace cache_storage_manager_unittest { bool IsIndexFileCurrent(const base::FilePath& cache_dir) { base::File::Info info; @@ -104,8 +104,6 @@ int notify_content_changed_count = 0; }; -} // anonymous namespace - // Returns a BlobProtocolHandler that uses |blob_storage_context|. Caller owns // the memory. std::unique_ptr<storage::BlobProtocolHandler> CreateMockBlobProtocolHandler( @@ -554,10 +552,10 @@ void DidGetQuotaOriginUsage(int64_t* out_usage, base::RunLoop* run_loop, - QuotaStatusCode status_code, + blink::QuotaStatusCode status_code, int64_t usage, int64_t quota) { - if (status_code == storage::kQuotaStatusOk) + if (status_code == blink::QuotaStatusCode::kOk) *out_usage = usage; run_loop->Quit(); } @@ -1672,7 +1670,7 @@ } void DeleteOriginCallback(base::RunLoop* run_loop, - storage::QuotaStatusCode status) { + blink::QuotaStatusCode status) { callback_status_ = status; run_loop->Quit(); } @@ -1714,7 +1712,7 @@ base::Bind(&CacheStorageQuotaClientTest::DeleteOriginCallback, base::Unretained(this), base::Unretained(&loop))); loop.Run(); - return callback_status_ == storage::kQuotaStatusOk; + return callback_status_ == blink::QuotaStatusCode::kOk; } bool QuotaDoesSupport(storage::StorageType type) { @@ -1723,7 +1721,7 @@ std::unique_ptr<CacheStorageQuotaClient> quota_client_; - storage::QuotaStatusCode callback_status_; + blink::QuotaStatusCode callback_status_; int64_t callback_quota_usage_ = 0; std::set<GURL> callback_origins_; @@ -1836,4 +1834,5 @@ CacheStorageQuotaClientTestP, ::testing::Values(false, true)); +} // namespace cache_storage_manager_unittest } // namespace content
diff --git a/content/browser/cache_storage/cache_storage_quota_client.cc b/content/browser/cache_storage/cache_storage_quota_client.cc index cfbdbf093..8ac1f97 100644 --- a/content/browser/cache_storage/cache_storage_quota_client.cc +++ b/content/browser/cache_storage/cache_storage_quota_client.cc
@@ -6,6 +6,7 @@ #include "content/browser/cache_storage/cache_storage_manager.h" #include "content/public/browser/browser_thread.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" namespace content { @@ -73,12 +74,12 @@ DCHECK_CURRENTLY_ON(BrowserThread::IO); if (!cache_manager_) { - callback.Run(storage::kQuotaErrorAbort); + callback.Run(blink::QuotaStatusCode::kErrorAbort); return; } if (!DoesSupport(type)) { - callback.Run(storage::kQuotaStatusOk); + callback.Run(blink::QuotaStatusCode::kOk); return; }
diff --git a/content/browser/cache_storage/cache_storage_scheduler_unittest.cc b/content/browser/cache_storage/cache_storage_scheduler_unittest.cc index db0e76c..fe95587d 100644 --- a/content/browser/cache_storage/cache_storage_scheduler_unittest.cc +++ b/content/browser/cache_storage/cache_storage_scheduler_unittest.cc
@@ -11,8 +11,7 @@ #include "testing/gtest/include/gtest/gtest.h" namespace content { - -namespace { +namespace cache_storage_scheduler_unittest { class TestTask { public: @@ -29,8 +28,6 @@ int callback_count_; }; -} // namespace - class CacheStorageSchedulerTest : public testing::Test { protected: CacheStorageSchedulerTest() @@ -79,4 +76,5 @@ EXPECT_FALSE(scheduler_.ScheduledOperations()); } +} // namespace cache_storage_scheduler_unittest } // namespace content
diff --git a/content/browser/child_process_launcher_helper_mac.cc b/content/browser/child_process_launcher_helper_mac.cc index c587091..67e306c8 100644 --- a/content/browser/child_process_launcher_helper_mac.cc +++ b/content/browser/child_process_launcher_helper_mac.cc
@@ -21,7 +21,10 @@ #include "content/public/common/sandboxed_process_launcher_delegate.h" #include "mojo/edk/embedder/scoped_platform_handle.h" #include "sandbox/mac/seatbelt_exec.h" +#include "services/service_manager/sandbox/mac/common_v2.sb.h" #include "services/service_manager/sandbox/mac/renderer_v2.sb.h" +#include "services/service_manager/sandbox/mac/utility.sb.h" +#include "services/service_manager/sandbox/sandbox.h" namespace content { namespace internal { @@ -54,19 +57,42 @@ options->environ = delegate_->GetEnvironment(); - bool no_sandbox = command_line_->HasSwitch(switches::kNoSandbox); + auto sandbox_type = + service_manager::SandboxTypeFromCommandLine(*command_line_); - if (base::FeatureList::IsEnabled(features::kMacV2Sandbox) && - GetProcessType() == switches::kRendererProcess && !no_sandbox) { + bool no_sandbox = command_line_->HasSwitch(switches::kNoSandbox) || + service_manager::IsUnsandboxedSandboxType(sandbox_type); + + bool v2_process = GetProcessType() == switches::kRendererProcess || + GetProcessType() == switches::kUtilityProcess; + + bool use_v2 = + v2_process && base::FeatureList::IsEnabled(features::kMacV2Sandbox); + + if (use_v2 && !no_sandbox) { + // Generate the profile string. + std::string profile = + std::string(service_manager::kSeatbeltPolicyString_common_v2); + + if (GetProcessType() == switches::kRendererProcess) { + profile += service_manager::kSeatbeltPolicyString_renderer_v2; + } else if (GetProcessType() == switches::kUtilityProcess) { + profile += service_manager::kSeatbeltPolicyString_utility; + } + // Disable os logging to com.apple.diagnosticd which is a performance // problem. options->environ.insert(std::make_pair("OS_ACTIVITY_MODE", "disable")); seatbelt_exec_client_ = std::make_unique<sandbox::SeatbeltExecClient>(); - seatbelt_exec_client_->SetProfile( - service_manager::kSeatbeltPolicyString_renderer_v2); + seatbelt_exec_client_->SetProfile(profile); - SetupRendererSandboxParameters(seatbelt_exec_client_.get()); + if (GetProcessType() == switches::kRendererProcess) { + SetupRendererSandboxParameters(seatbelt_exec_client_.get()); + } else { + SetupUtilitySandboxParameters(seatbelt_exec_client_.get(), + *command_line_.get()); + } int pipe = seatbelt_exec_client_->SendProfileAndGetFD();
diff --git a/content/browser/child_process_security_policy_impl.cc b/content/browser/child_process_security_policy_impl.cc index 37139a47..7341dd0 100644 --- a/content/browser/child_process_security_policy_impl.cc +++ b/content/browser/child_process_security_policy_impl.cc
@@ -21,7 +21,7 @@ #include "content/browser/bad_message.h" #include "content/browser/isolated_origin_util.h" #include "content/browser/site_instance_impl.h" -#include "content/common/site_isolation_policy.h" +#include "content/browser/site_isolation_policy.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/child_process_data.h"
diff --git a/content/browser/compositor/gpu_browser_compositor_output_surface.cc b/content/browser/compositor/gpu_browser_compositor_output_surface.cc index 90fef26f3..2694224 100644 --- a/content/browser/compositor/gpu_browser_compositor_output_surface.cc +++ b/content/browser/compositor/gpu_browser_compositor_output_surface.cc
@@ -60,6 +60,10 @@ void GpuBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted( const gpu::SwapBuffersCompleteParams& params) { + if (!params.ca_layer_params.is_empty) + client_->DidReceiveCALayerParams(params.ca_layer_params); + if (!params.texture_in_use_responses.empty()) + client_->DidReceiveTextureInUseResponses(params.texture_in_use_responses); client_->DidReceiveSwapBuffersAck(params.swap_response.swap_id); latency_info_cache_.OnSwapBuffersCompleted(params.swap_response); }
diff --git a/content/browser/compositor/gpu_output_surface_mac.cc b/content/browser/compositor/gpu_output_surface_mac.cc index 5411945e..75429bb 100644 --- a/content/browser/compositor/gpu_output_surface_mac.cc +++ b/content/browser/compositor/gpu_output_surface_mac.cc
@@ -8,11 +8,9 @@ #include "components/viz/service/display/output_surface_frame.h" #include "components/viz/service/display_embedder/compositor_overlay_candidate_validator.h" #include "gpu/GLES2/gl2extchromium.h" -#include "gpu/command_buffer/common/swap_buffers_complete_params.h" #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" #include "ui/accelerated_widget_mac/ca_layer_frame_sink.h" #include "ui/compositor/compositor.h" -#include "ui/display/types/display_snapshot.h" namespace content { @@ -49,19 +47,6 @@ } } -void GpuOutputSurfaceMac::OnGpuSwapBuffersCompleted( - const gpu::SwapBuffersCompleteParams& params) { - DCHECK(!params.ca_layer_params.is_empty); - // TODO(ccameron): Push the call to CALayerFrameSink into |client_|. - ui::CALayerFrameSink* ca_layer_frame_sink = - ui::CALayerFrameSink::FromAcceleratedWidget(widget_); - if (ca_layer_frame_sink) - ca_layer_frame_sink->UpdateCALayerTree(params.ca_layer_params); - client_->DidReceiveTextureInUseResponses(params.texture_in_use_responses); - GpuSurfacelessBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted( - params); -} - void GpuOutputSurfaceMac::SetSurfaceSuspendedForRecycle(bool suspended) { if (suspended) { // It may be that there are frames in-flight from the GPU process back to
diff --git a/content/browser/compositor/gpu_output_surface_mac.h b/content/browser/compositor/gpu_output_surface_mac.h index e6efca4..efe446e 100644 --- a/content/browser/compositor/gpu_output_surface_mac.h +++ b/content/browser/compositor/gpu_output_surface_mac.h
@@ -29,8 +29,6 @@ bool SurfaceIsSuspendForRecycle() const override; // BrowserCompositorOutputSurface implementation. - void OnGpuSwapBuffersCompleted( - const gpu::SwapBuffersCompleteParams& params) override; void SetSurfaceSuspendedForRecycle(bool suspended) override; private:
diff --git a/content/browser/compositor/gpu_process_transport_factory.cc b/content/browser/compositor/gpu_process_transport_factory.cc index 544cfd4..11d3d6b5 100644 --- a/content/browser/compositor/gpu_process_transport_factory.cc +++ b/content/browser/compositor/gpu_process_transport_factory.cc
@@ -39,6 +39,7 @@ #include "content/browser/compositor/browser_compositor_output_surface.h" #include "content/browser/compositor/gpu_browser_compositor_output_surface.h" #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.h" +#include "content/browser/compositor/in_process_display_client.h" #include "content/browser/compositor/offscreen_browser_compositor_output_surface.h" #include "content/browser/compositor/reflector_impl.h" #include "content/browser/compositor/software_browser_compositor_output_surface.h" @@ -181,6 +182,7 @@ std::unique_ptr<ExternalBeginFrameController> external_begin_frame_controller; ReflectorImpl* reflector = nullptr; std::unique_ptr<viz::Display> display; + std::unique_ptr<viz::mojom::DisplayClient> display_client; bool output_is_secure = false; }; @@ -355,21 +357,11 @@ gpu_channel_host->gpu_feature_info() .status_values[gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING] != gpu::kGpuFeatureStatusEnabled) { -#if defined(OS_CHROMEOS) - // TODO(crbug.com/793303): We shouldn't blacklist gpu compositing on - // ChromeOS. - NOTREACHED(); -#endif use_gpu_compositing = false; } // Gpu compositing may have been disabled in the meantime. - if (is_gpu_compositing_disabled_) { -#if defined(OS_CHROMEOS) - // TODO(crbug.com/793303): We shouldn't have gpu disabled on ChromeOS. - NOTREACHED(); -#endif + if (is_gpu_compositing_disabled_) use_gpu_compositing = false; - } // The widget might have been released in the meantime. PerCompositorDataMap::iterator it = @@ -403,11 +395,6 @@ // If not using GL compositing, don't keep the old shared worker context. shared_worker_context_provider_ = nullptr; } else if (!gpu_channel_host) { -#if defined(OS_CHROMEOS) - // TODO(crbug.com/793303): We shouldn't fail to make a GpuChannelHost on - // ChromeOS. - NOTREACHED(); -#endif // Failed to establish a channel, which is a fatal error, so stop trying to // use gpu compositing. use_gpu_compositing = false; @@ -440,14 +427,8 @@ auto result = shared_worker_context_provider_->BindToCurrentThread(); if (result != gpu::ContextResult::kSuccess) { shared_worker_context_provider_ = nullptr; - if (result == gpu::ContextResult::kFatalFailure) { -#if defined(OS_CHROMEOS) - // TODO(crbug.com/793303): We shouldn't have fatal context failures on - // ChromeOS. - NOTREACHED(); -#endif + if (result == gpu::ContextResult::kFatalFailure) use_gpu_compositing = false; - } } } @@ -475,14 +456,8 @@ auto result = context_provider->BindToCurrentThread(); if (result != gpu::ContextResult::kSuccess) { context_provider = nullptr; - if (result == gpu::ContextResult::kFatalFailure) { -#if defined(OS_CHROMEOS) - // TODO(crbug.com/793303): We shouldn't have fatal context failures on - // ChromeOS. - NOTREACHED(); -#endif + if (result == gpu::ContextResult::kFatalFailure) use_gpu_compositing = false; - } } } } @@ -656,6 +631,8 @@ renderer_settings_, compositor->frame_sink_id(), std::move(display_output_surface), std::move(scheduler), compositor->task_runner()); + data->display_client = + std::make_unique<InProcessDisplayClient>(compositor->widget()); GetFrameSinkManager()->RegisterBeginFrameSource(begin_frame_source, compositor->frame_sink_id()); // Note that we are careful not to destroy prior BeginFrameSource objects @@ -676,11 +653,13 @@ ? std::make_unique<viz::DirectLayerTreeFrameSink>( compositor->frame_sink_id(), GetHostFrameSinkManager(), GetFrameSinkManager(), data->display.get(), + data->display_client.get(), static_cast<scoped_refptr<viz::VulkanContextProvider>>( vulkan_context_provider)) : std::make_unique<viz::DirectLayerTreeFrameSink>( compositor->frame_sink_id(), GetHostFrameSinkManager(), - GetFrameSinkManager(), data->display.get(), context_provider, + GetFrameSinkManager(), data->display.get(), + data->display_client.get(), context_provider, shared_worker_context_provider_, compositor->task_runner(), GetGpuMemoryBufferManager(), viz::ServerSharedBitmapManager::current());
diff --git a/content/browser/compositor/in_process_display_client.cc b/content/browser/compositor/in_process_display_client.cc new file mode 100644 index 0000000..e585f17 --- /dev/null +++ b/content/browser/compositor/in_process_display_client.cc
@@ -0,0 +1,42 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/browser/compositor/in_process_display_client.h" + +#if defined(OS_MACOSX) +#include "ui/accelerated_widget_mac/ca_layer_frame_sink.h" +#endif + +namespace content { + +InProcessDisplayClient::InProcessDisplayClient(gfx::AcceleratedWidget widget) + : binding_(this) { +#if defined(OS_MACOSX) + widget_ = widget; +#endif +} + +InProcessDisplayClient::~InProcessDisplayClient() {} + +viz::mojom::DisplayClientPtr InProcessDisplayClient::GetBoundPtr() { + viz::mojom::DisplayClientPtr ptr; + binding_.Bind(mojo::MakeRequest(&ptr)); + return ptr; +} + +void InProcessDisplayClient::OnDisplayReceivedCALayerParams( + const gfx::CALayerParams& ca_layer_params) { +#if defined(OS_MACOSX) + ui::CALayerFrameSink* ca_layer_frame_sink = + ui::CALayerFrameSink::FromAcceleratedWidget(widget_); + if (ca_layer_frame_sink) + ca_layer_frame_sink->UpdateCALayerTree(ca_layer_params); + else + DLOG(WARNING) << "Received frame for non-existent widget."; +#else + DLOG(ERROR) << "Should not receive CALayer params on non-macOS platforms."; +#endif +} + +} // namespace content
diff --git a/content/browser/compositor/in_process_display_client.h b/content/browser/compositor/in_process_display_client.h new file mode 100644 index 0000000..b7635da --- /dev/null +++ b/content/browser/compositor/in_process_display_client.h
@@ -0,0 +1,37 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_BROWSER_COMPOSITOR_IN_PROCESS_DISPLAY_CLIENT_H_ +#define CONTENT_BROWSER_COMPOSITOR_IN_PROCESS_DISPLAY_CLIENT_H_ + +#include "build/build_config.h" +#include "mojo/public/cpp/bindings/binding.h" +#include "services/viz/privileged/interfaces/compositing/display_private.mojom.h" +#include "ui/gfx/native_widget_types.h" + +namespace content { + +// A DisplayClient that can be used to display received +// gfx::CALayerParams in a CALayer tree in this process. +class InProcessDisplayClient : public viz::mojom::DisplayClient { + public: + InProcessDisplayClient(gfx::AcceleratedWidget widget); + ~InProcessDisplayClient() override; + + viz::mojom::DisplayClientPtr GetBoundPtr(); + + private: + // viz::mojom::DisplayClient implementation: + void OnDisplayReceivedCALayerParams( + const gfx::CALayerParams& ca_layer_params) override; + + mojo::Binding<viz::mojom::DisplayClient> binding_; +#if defined(OS_MACOSX) + gfx::AcceleratedWidget widget_; +#endif +}; + +} // namespace content + +#endif // CONTENT_BROWSER_COMPOSITOR_IN_PROCESS_DISPLAY_CLIENT_H_
diff --git a/content/browser/compositor/viz_process_transport_factory.cc b/content/browser/compositor/viz_process_transport_factory.cc index 7cb397c..560816a 100644 --- a/content/browser/compositor/viz_process_transport_factory.cc +++ b/content/browser/compositor/viz_process_transport_factory.cc
@@ -430,6 +430,10 @@ mojo::MakeRequest(&client); viz::mojom::DisplayPrivateAssociatedRequest display_private_request = mojo::MakeRequest(&compositor_data_map_[compositor].display_private); + compositor_data_map_[compositor].display_client = + std::make_unique<InProcessDisplayClient>(compositor->widget()); + viz::mojom::DisplayClientPtr display_client = + compositor_data_map_[compositor].display_client->GetBoundPtr(); #if defined(GPU_SURFACE_HANDLE_IS_ACCELERATED_WINDOW) gpu::SurfaceHandle surface_handle = compositor->widget(); @@ -443,7 +447,7 @@ compositor->frame_sink_id(), surface_handle, compositor->force_software_compositor(), renderer_settings_, std::move(sink_request), std::move(client), - std::move(display_private_request)); + std::move(display_private_request), std::move(display_client)); // Create LayerTreeFrameSink with the browser end of CompositorFrameSink. viz::ClientLayerTreeFrameSink::InitParams params;
diff --git a/content/browser/compositor/viz_process_transport_factory.h b/content/browser/compositor/viz_process_transport_factory.h index 76f3201..7d7a4e8 100644 --- a/content/browser/compositor/viz_process_transport_factory.h +++ b/content/browser/compositor/viz_process_transport_factory.h
@@ -13,6 +13,7 @@ #include "components/viz/common/display/renderer_settings.h" #include "components/viz/common/surfaces/frame_sink_id_allocator.h" #include "content/browser/compositor/image_transport_factory.h" +#include "content/browser/compositor/in_process_display_client.h" #include "mojo/public/cpp/bindings/binding.h" #include "services/viz/privileged/interfaces/compositing/frame_sink_manager.mojom.h" #include "services/viz/public/interfaces/compositing/compositing_mode_watcher.mojom.h" @@ -120,6 +121,7 @@ // Privileged interface that controls the display for a root // CompositorFrameSink. viz::mojom::DisplayPrivateAssociatedPtr display_private; + std::unique_ptr<InProcessDisplayClient> display_client; private: DISALLOW_COPY_AND_ASSIGN(CompositorData);
diff --git a/content/browser/devtools/protocol/devtools_protocol_browsertest.cc b/content/browser/devtools/protocol/devtools_protocol_browsertest.cc index 6e9b778..6e3c942 100644 --- a/content/browser/devtools/protocol/devtools_protocol_browsertest.cc +++ b/content/browser/devtools/protocol/devtools_protocol_browsertest.cc
@@ -212,7 +212,8 @@ override { security_style_explanations->secure_explanations.push_back( SecurityStyleExplanation( - "an explanation", "an explanation description", cert_, + "an explanation title", "an explanation summary", + "an explanation description", cert_, blink::WebMixedContentContextType::kNotMixedContent)); return blink::kWebSecurityStyleNeutral; }
diff --git a/content/browser/devtools/protocol/page_handler.cc b/content/browser/devtools/protocol/page_handler.cc index 297613d..c46045be 100644 --- a/content/browser/devtools/protocol/page_handler.cc +++ b/content/browser/devtools/protocol/page_handler.cc
@@ -291,8 +291,8 @@ WebContentsImpl* web_contents = GetWebContents(); if (!web_contents) return Response::InternalError(); - if (web_contents->IsCrashed() || + web_contents->GetURL().scheme() == url::kDataScheme || (web_contents->GetController().GetVisibleEntry() && web_contents->GetController().GetVisibleEntry()->IsViewSourceMode())) { web_contents->GetController().Reload(bypassCache.fromMaybe(false)
diff --git a/content/browser/devtools/protocol/security_handler.cc b/content/browser/devtools/protocol/security_handler.cc index 8ec8635..47b92ac 100644 --- a/content/browser/devtools/protocol/security_handler.cc +++ b/content/browser/devtools/protocol/security_handler.cc
@@ -89,6 +89,7 @@ explanations->addItem( Security::SecurityStateExplanation::Create() .SetSecurityState(security_style) + .SetTitle(it.title) .SetSummary(it.summary) .SetDescription(it.description) .SetCertificate(std::move(certificate))
diff --git a/content/browser/devtools/protocol/storage_handler.cc b/content/browser/devtools/protocol/storage_handler.cc index e19d123..4e2b2e3 100644 --- a/content/browser/devtools/protocol/storage_handler.cc +++ b/content/browser/devtools/protocol/storage_handler.cc
@@ -16,7 +16,7 @@ #include "content/public/browser/storage_partition.h" #include "storage/browser/quota/quota_client.h" #include "storage/browser/quota/quota_manager.h" -#include "storage/common/quota/quota_status_code.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" #include "url/gurl.h" #include "url/origin.h" @@ -45,12 +45,12 @@ void ReportUsageAndQuotaDataOnUIThread( std::unique_ptr<StorageHandler::GetUsageAndQuotaCallback> callback, - storage::QuotaStatusCode code, + blink::QuotaStatusCode code, int64_t usage, int64_t quota, base::flat_map<storage::QuotaClient::ID, int64_t> usage_breakdown) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - if (code != storage::kQuotaStatusOk) { + if (code != blink::QuotaStatusCode::kOk) { return callback->sendFailure( Response::Error("Quota information is not available")); } @@ -70,7 +70,7 @@ void GotUsageAndQuotaDataCallback( std::unique_ptr<StorageHandler::GetUsageAndQuotaCallback> callback, - storage::QuotaStatusCode code, + blink::QuotaStatusCode code, int64_t usage, int64_t quota, base::flat_map<storage::QuotaClient::ID, int64_t> usage_breakdown) {
diff --git a/content/browser/devtools/protocol/target_auto_attacher.cc b/content/browser/devtools/protocol/target_auto_attacher.cc index b42737c..114a5df6 100644 --- a/content/browser/devtools/protocol/target_auto_attacher.cc +++ b/content/browser/devtools/protocol/target_auto_attacher.cc
@@ -11,6 +11,7 @@ #include "content/browser/frame_host/frame_tree_node.h" #include "content/browser/frame_host/navigation_handle_impl.h" #include "content/browser/frame_host/render_frame_host_impl.h" +#include "content/public/common/browser_side_navigation_policy.h" namespace content { namespace protocol { @@ -140,17 +141,18 @@ } bool TargetAutoAttacher::ShouldThrottleFramesNavigation() { - return auto_attach_ && attach_to_frames_ && wait_for_debugger_on_start_; + return IsBrowserSideNavigationEnabled() && auto_attach_ && + attach_to_frames_ && wait_for_debugger_on_start_; } DevToolsAgentHost* TargetAutoAttacher::AutoAttachToFrame( NavigationHandle* navigation_handle) { if (!ShouldThrottleFramesNavigation()) return nullptr; - bool cross_process = - navigation_handle->GetRenderFrameHost()->IsCrossProcessSubframe(); - if (!cross_process) + if (!navigation_handle->GetRenderFrameHost() || + !navigation_handle->GetRenderFrameHost()->IsCrossProcessSubframe()) { return nullptr; + } scoped_refptr<DevToolsAgentHost> agent_host = RenderFrameDevToolsAgentHost::GetOrCreateForDangling( static_cast<NavigationHandleImpl*>(navigation_handle)
diff --git a/content/browser/dom_storage/dom_storage_browsertest.cc b/content/browser/dom_storage/dom_storage_browsertest.cc index 91e83e0..0691e13 100644 --- a/content/browser/dom_storage/dom_storage_browsertest.cc +++ b/content/browser/dom_storage/dom_storage_browsertest.cc
@@ -18,6 +18,7 @@ #include "content/public/test/content_browser_test_utils.h" #include "content/public/test/test_launcher.h" #include "content/shell/browser/shell.h" +#include "testing/gmock/include/gmock/gmock.h" namespace content { @@ -119,6 +120,37 @@ SimpleTest(GetTestUrl("dom_storage", "verify_data.html"), kNotIncognito); } +// On Windows file://localhost/C:/src/chromium/src/content/test/data/title1.html +// doesn't work. +#if !defined(OS_WIN) +// Regression test for https://crbug.com/776160. The test verifies that there +// is no disagreement between 1) site URL used for browser-side isolation +// enforcement and 2) the origin requested by Blink. Before this bug was fixed, +// (1) was file://localhost/ and (2) was file:// - this led to renderer kills. +IN_PROC_BROWSER_TEST_F(MojoDOMStorageBrowserTest, FileUrlWithHost) { + // Navigate to file://localhost/.../title1.html + GURL regular_file_url = GetTestUrl(nullptr, "title1.html"); + GURL::Replacements host_replacement; + host_replacement.SetHostStr("localhost"); + GURL file_with_host_url = + regular_file_url.ReplaceComponents(host_replacement); + EXPECT_TRUE(NavigateToURL(shell(), file_with_host_url)); + EXPECT_THAT(shell()->web_contents()->GetLastCommittedURL().spec(), + testing::StartsWith("file://localhost/")); + EXPECT_THAT(shell()->web_contents()->GetLastCommittedURL().spec(), + testing::EndsWith("/title1.html")); + + // Verify that window.localStorage works fine. + std::string result; + std::string script = R"( + localStorage["foo"] = "bar"; + domAutomationController.send(localStorage["foo"]); + )"; + EXPECT_TRUE(ExecuteScriptAndExtractString(shell(), script, &result)); + EXPECT_EQ("bar", result); +} +#endif + class DOMStorageMigrationBrowserTest : public DOMStorageBrowserTest { public: void SetUpCommandLine(base::CommandLine* command_line) override {
diff --git a/content/browser/download/parallel_download_utils.cc b/content/browser/download/parallel_download_utils.cc index f559998..1f6b98b 100644 --- a/content/browser/download/parallel_download_utils.cc +++ b/content/browser/download/parallel_download_utils.cc
@@ -164,7 +164,13 @@ } bool IsParallelDownloadEnabled() { - return base::FeatureList::IsEnabled(features::kParallelDownloading); + bool feature_enabled = + base::FeatureList::IsEnabled(features::kParallelDownloading); + // Disabled when |kEnableParallelDownloadFinchKey| Finch config is set to + // false. + bool enabled_parameter = GetFieldTrialParamByFeatureAsBool( + features::kParallelDownloading, kEnableParallelDownloadFinchKey, true); + return feature_enabled && enabled_parameter; } } // namespace content
diff --git a/content/browser/download/parallel_download_utils.h b/content/browser/download/parallel_download_utils.h index fcf7f39b..da051d1 100644 --- a/content/browser/download/parallel_download_utils.h +++ b/content/browser/download/parallel_download_utils.h
@@ -13,6 +13,11 @@ namespace content { +// Finch parameter key value to enable parallel download. Used in enabled +// experiment group that needs other parameters, such as min_slice_size, but +// don't want to actually do parallel download. +constexpr char kEnableParallelDownloadFinchKey[] = "enable_parallel_download"; + // Finch parameter key value for minimum slice size in bytes to use parallel // download. constexpr char kMinSliceSizeFinchKey[] = "min_slice_size";
diff --git a/content/browser/download/parallel_download_utils_unittest.cc b/content/browser/download/parallel_download_utils_unittest.cc index 0d7cad9..10bbf44 100644 --- a/content/browser/download/parallel_download_utils_unittest.cc +++ b/content/browser/download/parallel_download_utils_unittest.cc
@@ -4,7 +4,12 @@ #include "content/browser/download/parallel_download_utils.h" +#include <map> + +#include "base/strings/string_number_conversions.h" +#include "base/test/scoped_feature_list.h" #include "content/public/browser/download_save_info.h" +#include "content/public/common/content_features.h" #include "testing/gtest/include/gtest/gtest.h" namespace content { @@ -137,4 +142,70 @@ EXPECT_EQ(1000, GetMaxContiguousDataBlockSizeFromBeginning(slices)); } +// Test to verify Finch parameters for enabled experiment group is read +// correctly. +TEST(ParallelDownloadUtilsTest, FinchConfigEnabled) { + base::test::ScopedFeatureList feature_list; + std::map<std::string, std::string> params = { + {content::kMinSliceSizeFinchKey, "1234"}, + {content::kParallelRequestCountFinchKey, "6"}, + {content::kParallelRequestDelayFinchKey, "2000"}, + {content::kParallelRequestRemainingTimeFinchKey, "3"}}; + feature_list.InitAndEnableFeatureWithParameters( + features::kParallelDownloading, params); + EXPECT_TRUE(IsParallelDownloadEnabled()); + EXPECT_EQ(GetMinSliceSizeConfig(), 1234); + EXPECT_EQ(GetParallelRequestCountConfig(), 6); + EXPECT_EQ(GetParallelRequestDelayConfig(), base::TimeDelta::FromSeconds(2)); + EXPECT_EQ(GetParallelRequestRemainingTimeConfig(), + base::TimeDelta::FromSeconds(3)); +} + +// Test to verify the disable experiment group will actually disable the +// feature. +TEST(ParallelDownloadUtilsTest, FinchConfigDisabled) { + base::test::ScopedFeatureList feature_list; + feature_list.InitAndDisableFeature(features::kParallelDownloading); + EXPECT_FALSE(IsParallelDownloadEnabled()); +} + +// Test to verify that the Finch parameter |enable_parallel_download| works +// correctly. +TEST(ParallelDownloadUtilsTest, FinchConfigDisabledWithParameter) { + { + base::test::ScopedFeatureList feature_list; + std::map<std::string, std::string> params = { + {content::kMinSliceSizeFinchKey, "4321"}, + {content::kEnableParallelDownloadFinchKey, "false"}}; + feature_list.InitAndEnableFeatureWithParameters( + features::kParallelDownloading, params); + // Use |enable_parallel_download| to disable parallel download in enabled + // experiment group. + EXPECT_FALSE(IsParallelDownloadEnabled()); + EXPECT_EQ(GetMinSliceSizeConfig(), 4321); + } + { + base::test::ScopedFeatureList feature_list; + std::map<std::string, std::string> params = { + {content::kMinSliceSizeFinchKey, "4321"}, + {content::kEnableParallelDownloadFinchKey, "true"}}; + feature_list.InitAndEnableFeatureWithParameters( + features::kParallelDownloading, params); + // Disable only if |enable_parallel_download| sets to false. + EXPECT_TRUE(IsParallelDownloadEnabled()); + EXPECT_EQ(GetMinSliceSizeConfig(), 4321); + } + { + base::test::ScopedFeatureList feature_list; + std::map<std::string, std::string> params = { + {content::kMinSliceSizeFinchKey, "4321"}}; + feature_list.InitAndEnableFeatureWithParameters( + features::kParallelDownloading, params); + // Empty |enable_parallel_download| in an enabled experiment group will have + // no impact. + EXPECT_TRUE(IsParallelDownloadEnabled()); + EXPECT_EQ(GetMinSliceSizeConfig(), 4321); + } +} + } // namespace content
diff --git a/content/browser/fileapi/browser_file_system_helper_unittest.cc b/content/browser/fileapi/browser_file_system_helper_unittest.cc index 54df4df..c1c84c3 100644 --- a/content/browser/fileapi/browser_file_system_helper_unittest.cc +++ b/content/browser/fileapi/browser_file_system_helper_unittest.cc
@@ -24,12 +24,10 @@ #include "url/origin.h" namespace content { -namespace { +namespace browser_file_system_helper_unittest { const int kRendererID = 42; -} // namespace - TEST(BrowserFileSystemHelperTest, PrepareDropDataForChildProcess_FileSystemFiles) { base::ScopedTempDir temp_dir; @@ -185,4 +183,5 @@ p->Remove(kRendererID); } +} // namespace browser_file_system_helper_unittest } // namespace content
diff --git a/content/browser/frame_host/frame_navigation_entry.cc b/content/browser/frame_host/frame_navigation_entry.cc index 2ecfb5d..608c490 100644 --- a/content/browser/frame_host/frame_navigation_entry.cc +++ b/content/browser/frame_host/frame_navigation_entry.cc
@@ -8,7 +8,6 @@ #include "base/strings/utf_string_conversions.h" #include "content/common/page_state_serialization.h" -#include "content/common/site_isolation_policy.h" namespace content {
diff --git a/content/browser/frame_host/frame_tree.cc b/content/browser/frame_host/frame_tree.cc index f7ac86c..30f104e 100644 --- a/content/browser/frame_host/frame_tree.cc +++ b/content/browser/frame_host/frame_tree.cc
@@ -28,7 +28,6 @@ #include "content/common/content_switches_internal.h" #include "content/common/frame_owner_properties.h" #include "content/common/input_messages.h" -#include "content/common/site_isolation_policy.h" #include "third_party/WebKit/common/frame_policy.h" namespace content {
diff --git a/content/browser/frame_host/frame_tree_node.cc b/content/browser/frame_host/frame_tree_node.cc index d2ea7e1..30b4494 100644 --- a/content/browser/frame_host/frame_tree_node.cc +++ b/content/browser/frame_host/frame_tree_node.cc
@@ -22,7 +22,6 @@ #include "content/browser/frame_host/render_frame_host_impl.h" #include "content/browser/renderer_host/render_view_host_impl.h" #include "content/common/frame_messages.h" -#include "content/common/site_isolation_policy.h" #include "content/public/browser/browser_thread.h" #include "content/public/common/browser_side_navigation_policy.h" #include "third_party/WebKit/common/sandbox_flags.h"
diff --git a/content/browser/frame_host/navigation_controller_impl.cc b/content/browser/frame_host/navigation_controller_impl.cc index fdcabe4..1a0255a 100644 --- a/content/browser/frame_host/navigation_controller_impl.cc +++ b/content/browser/frame_host/navigation_controller_impl.cc
@@ -62,7 +62,6 @@ #include "content/browser/renderer_host/render_view_host_impl.h" // Temporary #include "content/browser/site_instance_impl.h" #include "content/common/frame_messages.h" -#include "content/common/site_isolation_policy.h" #include "content/common/view_messages.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/content_browser_client.h" @@ -139,6 +138,10 @@ if (!entry) return false; + // Skip navigations initiated by external applications. + if (entry->GetTransitionType() & ui::PAGE_TRANSITION_FROM_API) + return false; + // We treat (PAGE_TRANSITION_RELOAD | PAGE_TRANSITION_FROM_ADDRESS_BAR), // PAGE_TRANSITION_TYPED or PAGE_TRANSITION_LINK transitions as navigations // which should be treated as reloads. @@ -687,7 +690,7 @@ default: NOTREACHED(); break; - }; + } // The user initiated a load, we don't need to reload anymore. needs_reload_ = false; @@ -785,7 +788,7 @@ default: NOTREACHED(); break; - }; + } entry->set_started_from_context_menu(params.started_from_context_menu); LoadEntry(std::move(entry));
diff --git a/content/browser/frame_host/navigation_controller_impl_browsertest.cc b/content/browser/frame_host/navigation_controller_impl_browsertest.cc index 1229a3e..3bf2fb8 100644 --- a/content/browser/frame_host/navigation_controller_impl_browsertest.cc +++ b/content/browser/frame_host/navigation_controller_impl_browsertest.cc
@@ -29,7 +29,6 @@ #include "content/browser/web_contents/web_contents_impl.h" #include "content/common/frame_messages.h" #include "content/common/page_state_serialization.h" -#include "content/common/site_isolation_policy.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/resource_dispatcher_host.h"
diff --git a/content/browser/frame_host/navigation_controller_impl_unittest.cc b/content/browser/frame_host/navigation_controller_impl_unittest.cc index 7024ee4..c94bb2fd 100644 --- a/content/browser/frame_host/navigation_controller_impl_unittest.cc +++ b/content/browser/frame_host/navigation_controller_impl_unittest.cc
@@ -32,7 +32,6 @@ #include "content/browser/web_contents/web_contents_impl.h" #include "content/common/frame_messages.h" #include "content/common/frame_owner_properties.h" -#include "content/common/site_isolation_policy.h" #include "content/common/view_messages.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents_delegate.h"
diff --git a/content/browser/frame_host/navigation_entry_impl.cc b/content/browser/frame_host/navigation_entry_impl.cc index aadd134..20bb33c 100644 --- a/content/browser/frame_host/navigation_entry_impl.cc +++ b/content/browser/frame_host/navigation_entry_impl.cc
@@ -22,7 +22,6 @@ #include "content/common/content_constants_internal.h" #include "content/common/navigation_params.h" #include "content/common/page_state_serialization.h" -#include "content/common/site_isolation_policy.h" #include "content/public/browser/reload_type.h" #include "content/public/common/browser_side_navigation_policy.h" #include "content/public/common/content_constants.h"
diff --git a/content/browser/frame_host/navigation_handle_impl.cc b/content/browser/frame_host/navigation_handle_impl.cc index 3682467..e78ec32 100644 --- a/content/browser/frame_host/navigation_handle_impl.cc +++ b/content/browser/frame_host/navigation_handle_impl.cc
@@ -27,7 +27,6 @@ #include "content/browser/service_worker/service_worker_navigation_handle.h" #include "content/common/child_process_host_impl.h" #include "content/common/frame_messages.h" -#include "content/common/site_isolation_policy.h" #include "content/public/browser/content_browser_client.h" #include "content/public/browser/navigation_ui_data.h" #include "content/public/browser/site_instance.h"
diff --git a/content/browser/frame_host/navigator_impl.cc b/content/browser/frame_host/navigator_impl.cc index baaeaf9..99feb65 100644 --- a/content/browser/frame_host/navigator_impl.cc +++ b/content/browser/frame_host/navigator_impl.cc
@@ -28,7 +28,6 @@ #include "content/common/frame_messages.h" #include "content/common/navigation_params.h" #include "content/common/page_messages.h" -#include "content/common/site_isolation_policy.h" #include "content/common/view_messages.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/content_browser_client.h"
diff --git a/content/browser/frame_host/navigator_impl_unittest.cc b/content/browser/frame_host/navigator_impl_unittest.cc index 05d8ab6..668680a 100644 --- a/content/browser/frame_host/navigator_impl_unittest.cc +++ b/content/browser/frame_host/navigator_impl_unittest.cc
@@ -20,7 +20,6 @@ #include "content/common/frame.mojom.h" #include "content/common/frame_messages.h" #include "content/common/navigation_params.h" -#include "content/common/site_isolation_policy.h" #include "content/public/browser/navigation_data.h" #include "content/public/browser/stream_handle.h" #include "content/public/common/content_features.h"
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc index d64d6e9..cea73a73 100644 --- a/content/browser/frame_host/render_frame_host_impl.cc +++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -95,7 +95,6 @@ #include "content/common/navigation_subresource_loader_params.h" #include "content/common/render_message_filter.mojom.h" #include "content/common/renderer.mojom.h" -#include "content/common/site_isolation_policy.h" #include "content/common/swapped_out_messages.h" #include "content/common/url_loader_factory_bundle.mojom.h" #include "content/common/widget.mojom.h" @@ -131,8 +130,7 @@ #include "media/media_features.h" #include "media/mojo/interfaces/remoting.mojom.h" #include "media/mojo/services/media_interface_provider.h" -#include "media/mojo/services/video_decode_stats_recorder.h" -#include "media/mojo/services/watch_time_recorder.h" +#include "media/mojo/services/media_metrics_provider.h" #include "mojo/public/cpp/bindings/associated_interface_ptr.h" #include "mojo/public/cpp/bindings/message.h" #include "mojo/public/cpp/bindings/strong_binding.h" @@ -3199,8 +3197,14 @@ base::Unretained(sensor_provider_proxy_.get()))); } - registry_->AddInterface( - base::Bind(&media::WatchTimeRecorder::CreateWatchTimeRecorderProvider)); + registry_->AddInterface(base::BindRepeating( + &media::MediaMetricsProvider::Create, + // Only save decode stats when on-the-record. + GetSiteInstance()->GetBrowserContext()->IsOffTheRecord() + ? nullptr + : GetSiteInstance() + ->GetBrowserContext() + ->GetVideoDecodePerfHistory())); if (base::CommandLine::ForCurrentProcess()->HasSwitch( cc::switches::kEnableGpuBenchmarking)) { @@ -3210,14 +3214,6 @@ registry_->AddInterface( base::BindRepeating(GetRestrictedCookieManager, base::Unretained(this))); - - // Only save decode stats when on-the-record. - if (!GetSiteInstance()->GetBrowserContext()->IsOffTheRecord()) { - media::VideoDecodePerfHistory* video_perf_history = - GetSiteInstance()->GetBrowserContext()->GetVideoDecodePerfHistory(); - registry_->AddInterface(base::BindRepeating( - &media::VideoDecodeStatsRecorder::Create, video_perf_history)); - } } void RenderFrameHostImpl::ResetWaitingState() {
diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc index 99fb653..1e91cb0 100644 --- a/content/browser/frame_host/render_frame_host_manager.cc +++ b/content/browser/frame_host/render_frame_host_manager.cc
@@ -35,10 +35,10 @@ #include "content/browser/renderer_host/render_view_host_factory.h" #include "content/browser/renderer_host/render_view_host_impl.h" #include "content/browser/site_instance_impl.h" +#include "content/browser/site_isolation_policy.h" #include "content/browser/webui/web_ui_controller_factory_registry.h" #include "content/common/frame_messages.h" #include "content/common/frame_owner_properties.h" -#include "content/common/site_isolation_policy.h" #include "content/common/view_messages.h" #include "content/public/browser/child_process_security_policy.h" #include "content/public/browser/content_browser_client.h"
diff --git a/content/browser/frame_host/render_frame_host_manager_browsertest.cc b/content/browser/frame_host/render_frame_host_manager_browsertest.cc index 77de262..bc9d0c4 100644 --- a/content/browser/frame_host/render_frame_host_manager_browsertest.cc +++ b/content/browser/frame_host/render_frame_host_manager_browsertest.cc
@@ -31,7 +31,6 @@ #include "content/browser/webui/web_ui_impl.h" #include "content/common/content_constants_internal.h" #include "content/common/input_messages.h" -#include "content/common/site_isolation_policy.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/render_process_host.h"
diff --git a/content/browser/frame_host/render_frame_host_manager_unittest.cc b/content/browser/frame_host/render_frame_host_manager_unittest.cc index 334e84d..c38b650 100644 --- a/content/browser/frame_host/render_frame_host_manager_unittest.cc +++ b/content/browser/frame_host/render_frame_host_manager_unittest.cc
@@ -31,7 +31,6 @@ #include "content/common/frame_messages.h" #include "content/common/frame_owner_properties.h" #include "content/common/input_messages.h" -#include "content/common/site_isolation_policy.h" #include "content/common/view_messages.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_service.h"
diff --git a/content/browser/frame_host/render_widget_host_view_guest.cc b/content/browser/frame_host/render_widget_host_view_guest.cc index 5a81f6c..d4b94acd 100644 --- a/content/browser/frame_host/render_widget_host_view_guest.cc +++ b/content/browser/frame_host/render_widget_host_view_guest.cc
@@ -28,7 +28,6 @@ #include "content/common/content_switches_internal.h" #include "content/common/frame_messages.h" #include "content/common/input/web_touch_event_traits.h" -#include "content/common/site_isolation_policy.h" #include "content/common/view_messages.h" #include "content/public/common/content_switches.h" #include "gpu/ipc/common/gpu_messages.h"
diff --git a/content/browser/gpu/gpu_data_manager_impl.cc b/content/browser/gpu/gpu_data_manager_impl.cc index fc442119..9236c58 100644 --- a/content/browser/gpu/gpu_data_manager_impl.cc +++ b/content/browser/gpu/gpu_data_manager_impl.cc
@@ -209,12 +209,6 @@ private_->AppendGpuCommandLine(command_line); } -void GpuDataManagerImpl::UpdateRendererWebPrefs( - WebPreferences* prefs) const { - base::AutoLock auto_lock(lock_); - private_->UpdateRendererWebPrefs(prefs); -} - void GpuDataManagerImpl::UpdateGpuPreferences( gpu::GpuPreferences* gpu_preferences) const { base::AutoLock auto_lock(lock_);
diff --git a/content/browser/gpu/gpu_data_manager_impl.h b/content/browser/gpu/gpu_data_manager_impl.h index 6f81e672..eddc5b0 100644 --- a/content/browser/gpu/gpu_data_manager_impl.h +++ b/content/browser/gpu/gpu_data_manager_impl.h
@@ -39,7 +39,6 @@ namespace content { class GpuDataManagerImplPrivate; -struct WebPreferences; class CONTENT_EXPORT GpuDataManagerImpl : public GpuDataManager { public: @@ -123,9 +122,6 @@ // Insert switches into gpu process command line: kUseGL, etc. void AppendGpuCommandLine(base::CommandLine* command_line) const; - // Update WebPreferences for renderer based on blacklisting decisions. - void UpdateRendererWebPrefs(WebPreferences* prefs) const; - // Update GpuPreferences based on blacklisting decisions. void UpdateGpuPreferences(gpu::GpuPreferences* gpu_preferences) const;
diff --git a/content/browser/gpu/gpu_data_manager_impl_private.cc b/content/browser/gpu/gpu_data_manager_impl_private.cc index 8ad3c18..66ffedf3 100644 --- a/content/browser/gpu/gpu_data_manager_impl_private.cc +++ b/content/browser/gpu/gpu_data_manager_impl_private.cc
@@ -32,7 +32,6 @@ #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" #include "gpu/command_buffer/service/gpu_switches.h" #include "gpu/config/gpu_driver_bug_list.h" @@ -800,26 +799,9 @@ } } -void GpuDataManagerImplPrivate::UpdateRendererWebPrefs( - WebPreferences* prefs) const { - DCHECK(prefs); - const base::CommandLine* command_line = - base::CommandLine::ForCurrentProcess(); - // TODO(zmo): Remove this when we check on the renderer side for 2d canvas. - if (command_line->HasSwitch(switches::kDisableGpuCompositing)) { - prefs->accelerated_2d_canvas_enabled = false; - } - if (!ShouldDisableAcceleratedVideoDecode(command_line) && - !command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) { - prefs->pepper_accelerated_video_decode_enabled = true; - } -} - void GpuDataManagerImplPrivate::UpdateGpuPreferences( gpu::GpuPreferences* gpu_preferences) const { DCHECK(gpu_preferences); - - gpu_preferences->gpu_program_cache_size = gpu::ShaderDiskCache::CacheSizeBytes(); }
diff --git a/content/browser/gpu/gpu_data_manager_impl_private.h b/content/browser/gpu/gpu_data_manager_impl_private.h index 369d07b0..19285a60 100644 --- a/content/browser/gpu/gpu_data_manager_impl_private.h +++ b/content/browser/gpu/gpu_data_manager_impl_private.h
@@ -77,8 +77,6 @@ void AppendGpuCommandLine(base::CommandLine* command_line) const; - void UpdateRendererWebPrefs(WebPreferences* prefs) const; - void UpdateGpuPreferences(gpu::GpuPreferences* gpu_preferences) const; void GetBlacklistReasons(base::ListValue* reasons) const;
diff --git a/content/browser/indexed_db/database_impl.cc b/content/browser/indexed_db/database_impl.cc index 3bba482..10c9ce45 100644 --- a/content/browser/indexed_db/database_impl.cc +++ b/content/browser/indexed_db/database_impl.cc
@@ -18,6 +18,7 @@ #include "content/browser/indexed_db/indexed_db_value.h" #include "storage/browser/blob/blob_storage_context.h" #include "storage/browser/quota/quota_manager_proxy.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseException.h" using std::swap; @@ -130,7 +131,7 @@ const IndexedDBDatabaseError& error); void Commit(int64_t transaction_id); void OnGotUsageAndQuotaForCommit(int64_t transaction_id, - storage::QuotaStatusCode status, + blink::QuotaStatusCode status, int64_t usage, int64_t quota); void AckReceivedBlobs(const std::vector<std::string>& uuids); @@ -923,7 +924,7 @@ void DatabaseImpl::IDBSequenceHelper::OnGotUsageAndQuotaForCommit( int64_t transaction_id, - storage::QuotaStatusCode status, + blink::QuotaStatusCode status, int64_t usage, int64_t quota) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); @@ -936,7 +937,7 @@ if (!transaction) return; - if (status == storage::kQuotaStatusOk && + if (status == blink::QuotaStatusCode::kOk && usage + transaction->size() <= quota) { connection_->database()->Commit(transaction); } else {
diff --git a/content/browser/indexed_db/indexed_db_backing_store.h b/content/browser/indexed_db/indexed_db_backing_store.h index 929f8db..ef29185e 100644 --- a/content/browser/indexed_db/indexed_db_backing_store.h +++ b/content/browser/indexed_db/indexed_db_backing_store.h
@@ -61,6 +61,11 @@ struct IndexedDBDataLossInfo; struct IndexedDBValue; +namespace indexed_db_backing_store_unittest { +class IndexedDBBackingStoreTest; +FORWARD_DECLARE_TEST(IndexedDBBackingStoreTest, ReadCorruptionInfo); +} // namespace indexed_db_backing_store_unittest + class CONTENT_EXPORT IndexedDBBackingStore : public base::RefCounted<IndexedDBBackingStore> { public: @@ -619,7 +624,9 @@ void CleanPrimaryJournalIgnoreReturn(); private: - FRIEND_TEST_ALL_PREFIXES(IndexedDBBackingStoreTest, ReadCorruptionInfo); + FRIEND_TEST_ALL_PREFIXES( + indexed_db_backing_store_unittest::IndexedDBBackingStoreTest, + ReadCorruptionInfo); static scoped_refptr<IndexedDBBackingStore> Create( IndexedDBFactory* indexed_db_factory,
diff --git a/content/browser/indexed_db/indexed_db_backing_store_unittest.cc b/content/browser/indexed_db/indexed_db_backing_store_unittest.cc index 652fc66..b41608c5a 100644 --- a/content/browser/indexed_db/indexed_db_backing_store_unittest.cc +++ b/content/browser/indexed_db/indexed_db_backing_store_unittest.cc
@@ -38,8 +38,8 @@ using url::Origin; namespace content { +namespace indexed_db_backing_store_unittest { -namespace { static const size_t kDefaultMaxOpenIteratorsPerDatabase = 50; // Write |content| to |file|. Returns true on success. @@ -1324,9 +1324,6 @@ RunAllTasksUntilIdle(); } -} // namespace - -// Not in the anonymous namespace to friend IndexedDBBackingStore. TEST_F(IndexedDBBackingStoreTest, ReadCorruptionInfo) { // No |path_base|. std::string message; @@ -1417,4 +1414,5 @@ EXPECT_EQ("foo", message); } +} // namespace indexed_db_backing_store_unittest } // namespace content
diff --git a/content/browser/indexed_db/indexed_db_quota_client.cc b/content/browser/indexed_db/indexed_db_quota_client.cc index 5c9bd66e..2198c12 100644 --- a/content/browser/indexed_db/indexed_db_quota_client.cc +++ b/content/browser/indexed_db/indexed_db_quota_client.cc
@@ -13,6 +13,7 @@ #include "content/public/browser/browser_thread.h" #include "net/base/url_util.h" #include "storage/browser/database/database_util.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" #include "url/origin.h" using storage::QuotaClient; @@ -21,11 +22,11 @@ namespace content { namespace { -storage::QuotaStatusCode DeleteOriginDataOnIndexedDBThread( +blink::QuotaStatusCode DeleteOriginDataOnIndexedDBThread( IndexedDBContextImpl* context, const GURL& origin) { context->DeleteForOrigin(origin); - return storage::kQuotaStatusOk; + return blink::QuotaStatusCode::kOk; } int64_t GetOriginUsageOnIndexedDBThread(IndexedDBContextImpl* context, @@ -138,7 +139,7 @@ storage::StorageType type, const DeletionCallback& callback) { if (type != storage::kStorageTypeTemporary) { - callback.Run(storage::kQuotaStatusOk); + callback.Run(blink::QuotaStatusCode::kOk); return; }
diff --git a/content/browser/indexed_db/indexed_db_quota_client_unittest.cc b/content/browser/indexed_db/indexed_db_quota_client_unittest.cc index fa90cef..0b12f0a 100644 --- a/content/browser/indexed_db/indexed_db_quota_client_unittest.cc +++ b/content/browser/indexed_db/indexed_db_quota_client_unittest.cc
@@ -24,6 +24,7 @@ #include "content/public/test/test_utils.h" #include "storage/browser/test/mock_quota_manager.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" // Declared to shorten the line lengths. static const storage::StorageType kTemp = storage::kStorageTypeTemporary; @@ -112,10 +113,10 @@ return origins_; } - storage::QuotaStatusCode DeleteOrigin(storage::QuotaClient* client, - const GURL& origin_url, - storage::StorageType type) { - delete_status_ = storage::kQuotaStatusUnknown; + blink::QuotaStatusCode DeleteOrigin(storage::QuotaClient* client, + const GURL& origin_url, + storage::StorageType type) { + delete_status_ = blink::QuotaStatusCode::kUnknown; client->DeleteOriginData( origin_url, type, base::Bind(&IndexedDBQuotaClientTest::OnDeleteOriginComplete, @@ -150,7 +151,7 @@ origins_ = origins; } - void OnDeleteOriginComplete(storage::QuotaStatusCode code) { + void OnDeleteOriginComplete(blink::QuotaStatusCode code) { delete_status_ = code; } @@ -160,7 +161,7 @@ std::set<GURL> origins_; scoped_refptr<IndexedDBContextImpl> idb_context_; std::unique_ptr<TestBrowserContext> browser_context_; - storage::QuotaStatusCode delete_status_; + blink::QuotaStatusCode delete_status_; base::WeakPtrFactory<IndexedDBQuotaClientTest> weak_factory_; DISALLOW_COPY_AND_ASSIGN(IndexedDBQuotaClientTest); @@ -229,19 +230,18 @@ EXPECT_EQ(1000, GetOriginUsage(&client, kOriginA, kTemp)); EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); - storage::QuotaStatusCode delete_status = - DeleteOrigin(&client, kOriginA, kTemp); - EXPECT_EQ(storage::kQuotaStatusOk, delete_status); + blink::QuotaStatusCode delete_status = DeleteOrigin(&client, kOriginA, kTemp); + EXPECT_EQ(blink::QuotaStatusCode::kOk, delete_status); EXPECT_EQ(0, GetOriginUsage(&client, kOriginA, kTemp)); EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); // IndexedDB only supports temporary storage; requests to delete other types // are no-ops, but should not fail. delete_status = DeleteOrigin(&client, kOriginA, kPerm); - EXPECT_EQ(storage::kQuotaStatusOk, delete_status); + EXPECT_EQ(blink::QuotaStatusCode::kOk, delete_status); delete_status = DeleteOrigin(&client, kOriginA, kSync); - EXPECT_EQ(storage::kQuotaStatusOk, delete_status); + EXPECT_EQ(blink::QuotaStatusCode::kOk, delete_status); } } // namespace content
diff --git a/content/browser/indexed_db/indexed_db_tombstone_sweeper.h b/content/browser/indexed_db/indexed_db_tombstone_sweeper.h index 5ebf2265..5ce9f30 100644 --- a/content/browser/indexed_db/indexed_db_tombstone_sweeper.h +++ b/content/browser/indexed_db/indexed_db_tombstone_sweeper.h
@@ -34,6 +34,10 @@ namespace content { class IndexedDBBackingStore; +namespace indexed_db_tombstone_sweeper_unittest { +class IndexedDBTombstoneSweeperTest; +} + // Facilitates iterating a whole container with an abnormal starting position. // If the starting position is not 0, then the iteration will wrap to the // beginning of the container until the starting position is reached again. @@ -94,7 +98,8 @@ std::map<int64_t, IndexedDBObjectStoreMetadata>; using IndexMetadataMap = std::map<int64_t, IndexedDBIndexMetadata>; - friend class IndexedDBTombstoneSweeperTest; + friend class indexed_db_tombstone_sweeper_unittest:: + IndexedDBTombstoneSweeperTest; enum class Status { SWEEPING, DONE_REACHED_MAX, DONE_ERROR, DONE_COMPLETE };
diff --git a/content/browser/indexed_db/indexed_db_tombstone_sweeper_unittest.cc b/content/browser/indexed_db/indexed_db_tombstone_sweeper_unittest.cc index 820cec2..0376bb7 100644 --- a/content/browser/indexed_db/indexed_db_tombstone_sweeper_unittest.cc +++ b/content/browser/indexed_db/indexed_db_tombstone_sweeper_unittest.cc
@@ -26,7 +26,7 @@ namespace content { class BrowserContext; -namespace { +namespace indexed_db_tombstone_sweeper_unittest { using ::testing::_; using ::testing::Eq; using ::testing::Return; @@ -78,8 +78,6 @@ const char* Name() const override { return "idb_cmp1"; } }; -} // namespace - class IndexedDBTombstoneSweeperTest : public testing::TestWithParam<Mode> { public: IndexedDBTombstoneSweeperTest() {} @@ -248,8 +246,6 @@ base::HistogramTester histogram_tester_; }; -namespace { - TEST_P(IndexedDBTombstoneSweeperTest, EmptyDB) { SetupMockDB(); sweeper_->SetMetadata(&metadata_); @@ -594,6 +590,5 @@ IndexedDBTombstoneSweeperTest, testing::Values(Mode::STATISTICS, Mode::DELETION)); -} // namespace - +} // namespace indexed_db_tombstone_sweeper_unittest } // namespace content
diff --git a/content/browser/indexed_db/indexed_db_transaction.h b/content/browser/indexed_db/indexed_db_transaction.h index 9d05359..e25fdf673 100644 --- a/content/browser/indexed_db/indexed_db_transaction.h +++ b/content/browser/indexed_db/indexed_db_transaction.h
@@ -32,6 +32,19 @@ class IndexedDBCursor; class IndexedDBDatabaseCallbacks; +namespace indexed_db_transaction_unittest { +class IndexedDBTransactionTestMode; +class IndexedDBTransactionTest; +FORWARD_DECLARE_TEST(IndexedDBTransactionTestMode, AbortPreemptive); +FORWARD_DECLARE_TEST(IndexedDBTransactionTestMode, AbortTasks); +FORWARD_DECLARE_TEST(IndexedDBTransactionTest, NoTimeoutReadOnly); +FORWARD_DECLARE_TEST(IndexedDBTransactionTest, SchedulePreemptiveTask); +FORWARD_DECLARE_TEST(IndexedDBTransactionTestMode, ScheduleNormalTask); +FORWARD_DECLARE_TEST(IndexedDBTransactionTestMode, TaskFails); +FORWARD_DECLARE_TEST(IndexedDBTransactionTest, Timeout); +FORWARD_DECLARE_TEST(IndexedDBTransactionTest, IndexedDBObserver); +} // namespace indexed_db_transaction_unittest + class CONTENT_EXPORT IndexedDBTransaction { public: using Operation = base::OnceCallback<leveldb::Status(IndexedDBTransaction*)>; @@ -130,16 +143,30 @@ friend class IndexedDBConnection; friend class base::RefCounted<IndexedDBTransaction>; - FRIEND_TEST_ALL_PREFIXES(IndexedDBTransactionTestMode, AbortPreemptive); - FRIEND_TEST_ALL_PREFIXES(IndexedDBTransactionTestMode, AbortTasks); - FRIEND_TEST_ALL_PREFIXES(IndexedDBTransactionTest, NoTimeoutReadOnly); - FRIEND_TEST_ALL_PREFIXES(IndexedDBTransactionTest, - SchedulePreemptiveTask); - FRIEND_TEST_ALL_PREFIXES(IndexedDBTransactionTestMode, - ScheduleNormalTask); - FRIEND_TEST_ALL_PREFIXES(IndexedDBTransactionTestMode, TaskFails); - FRIEND_TEST_ALL_PREFIXES(IndexedDBTransactionTest, Timeout); - FRIEND_TEST_ALL_PREFIXES(IndexedDBTransactionTest, IndexedDBObserver); + FRIEND_TEST_ALL_PREFIXES( + indexed_db_transaction_unittest::IndexedDBTransactionTestMode, + AbortPreemptive); + FRIEND_TEST_ALL_PREFIXES( + indexed_db_transaction_unittest::IndexedDBTransactionTestMode, + AbortTasks); + FRIEND_TEST_ALL_PREFIXES( + indexed_db_transaction_unittest::IndexedDBTransactionTest, + NoTimeoutReadOnly); + FRIEND_TEST_ALL_PREFIXES( + indexed_db_transaction_unittest::IndexedDBTransactionTest, + SchedulePreemptiveTask); + FRIEND_TEST_ALL_PREFIXES( + indexed_db_transaction_unittest::IndexedDBTransactionTestMode, + ScheduleNormalTask); + FRIEND_TEST_ALL_PREFIXES( + indexed_db_transaction_unittest::IndexedDBTransactionTestMode, + TaskFails); + FRIEND_TEST_ALL_PREFIXES( + indexed_db_transaction_unittest::IndexedDBTransactionTest, + Timeout); + FRIEND_TEST_ALL_PREFIXES( + indexed_db_transaction_unittest::IndexedDBTransactionTest, + IndexedDBObserver); void RunTasksIfStarted();
diff --git a/content/browser/indexed_db/indexed_db_transaction_unittest.cc b/content/browser/indexed_db/indexed_db_transaction_unittest.cc index b5ba5ab1..5afb791 100644 --- a/content/browser/indexed_db/indexed_db_transaction_unittest.cc +++ b/content/browser/indexed_db/indexed_db_transaction_unittest.cc
@@ -26,6 +26,8 @@ #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseException.h" namespace content { +namespace indexed_db_transaction_unittest { + const int kFakeProcessId = 10; class AbortObserver { @@ -503,4 +505,5 @@ IndexedDBTransactionTestMode, ::testing::ValuesIn(kTestModes)); +} // namespace indexed_db_transaction_unittest } // namespace content
diff --git a/content/browser/indexed_db/leveldb/leveldb_unittest.cc b/content/browser/indexed_db/leveldb/leveldb_unittest.cc index 4ec7a8e..a922b1b 100644 --- a/content/browser/indexed_db/leveldb/leveldb_unittest.cc +++ b/content/browser/indexed_db/leveldb/leveldb_unittest.cc
@@ -20,8 +20,8 @@ #include "third_party/leveldatabase/leveldb_chrome.h" namespace content { +namespace leveldb_unittest { -namespace { static const size_t kDefaultMaxOpenIteratorsPerDatabase = 50; class SimpleComparator : public LevelDBComparator { @@ -34,8 +34,6 @@ const char* Name() const override { return "temp_comparator"; } }; -} // namespace - TEST(LevelDBDatabaseTest, CorruptionTest) { base::ScopedTempDir temp_directory; ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); @@ -112,4 +110,5 @@ EXPECT_TRUE(status.ok()); } +} // namespace leveldb_unittest } // namespace content
diff --git a/content/browser/loader/cross_site_document_resource_handler.cc b/content/browser/loader/cross_site_document_resource_handler.cc index 475ead7..293fb28 100644 --- a/content/browser/loader/cross_site_document_resource_handler.cc +++ b/content/browser/loader/cross_site_document_resource_handler.cc
@@ -17,7 +17,7 @@ #include "content/browser/loader/detachable_resource_handler.h" #include "content/browser/loader/resource_request_info_impl.h" #include "content/browser/site_instance_impl.h" -#include "content/common/site_isolation_policy.h" +#include "content/browser/site_isolation_policy.h" #include "content/public/browser/content_browser_client.h" #include "content/public/browser/resource_context.h" #include "content/public/common/content_client.h"
diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc index 99ef6cf8..67035a5 100644 --- a/content/browser/loader/resource_dispatcher_host_impl.cc +++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -69,13 +69,13 @@ #include "content/browser/service_worker/service_worker_context_wrapper.h" #include "content/browser/service_worker/service_worker_navigation_handle_core.h" #include "content/browser/service_worker/service_worker_request_handler.h" +#include "content/browser/site_isolation_policy.h" #include "content/browser/streams/stream.h" #include "content/browser/streams/stream_context.h" #include "content/browser/streams/stream_registry.h" #include "content/common/loader_util.h" #include "content/common/net/url_request_service_worker_data.h" #include "content/common/resource_messages.h" -#include "content/common/site_isolation_policy.h" #include "content/common/view_messages.h" #include "content/public/browser/browser_child_process_host.h" #include "content/public/browser/browser_thread.h"
diff --git a/content/browser/media/capture/aura_window_capture_machine.cc b/content/browser/media/capture/aura_window_capture_machine.cc index 274fce6..91b649ec 100644 --- a/content/browser/media/capture/aura_window_capture_machine.cc +++ b/content/browser/media/capture/aura_window_capture_machine.cc
@@ -189,7 +189,9 @@ DCHECK(!desktop_window_); desktop_window_ = window; - cursor_renderer_.reset(new CursorRendererAura(window, kCursorAlwaysEnabled)); + cursor_renderer_.reset( + new CursorRendererAura(CursorRenderer::CURSOR_DISPLAYED_ALWAYS)); + cursor_renderer_->SetTargetView(window); // Start observing window events. desktop_window_->AddObserver(this); @@ -208,7 +210,6 @@ oracle_proxy_->UpdateCaptureSize(ui::ConvertSizeToPixel( layer, layer->bounds().size())); } - cursor_renderer_->Clear(); } void AuraWindowCaptureMachine::Capture(base::TimeTicks event_time) { @@ -354,7 +355,6 @@ yuv_readback_pipeline_->SetScaler(std::move(scaler)); } - cursor_renderer_->SnapshotCursorState(region_in_frame); yuv_readback_pipeline_->ReadbackYUV( mailbox, sync_token, result->size(), gfx::Rect(region_in_frame.size()), video_frame->stride(media::VideoFrame::kYPlane), @@ -364,7 +364,7 @@ video_frame->stride(media::VideoFrame::kVPlane), video_frame->data(media::VideoFrame::kVPlane), region_in_frame.origin(), base::Bind(&CopyOutputFinishedForVideo, weak_factory_.GetWeakPtr(), - event_time, capture_frame_cb, video_frame, + event_time, capture_frame_cb, video_frame, region_in_frame, base::Passed(&release_callback))); media::LetterboxYUV(video_frame.get(), region_in_frame); return true; @@ -378,6 +378,7 @@ base::TimeTicks event_time, const CaptureFrameCallback& capture_frame_cb, scoped_refptr<media::VideoFrame> target, + const gfx::Rect& region_in_frame, std::unique_ptr<viz::SingleReleaseCallback> release_callback, bool result) { DCHECK_CURRENTLY_ON(BrowserThread::UI); @@ -389,7 +390,8 @@ // still valid). if (machine) { if (machine->cursor_renderer_ && result) - machine->cursor_renderer_->RenderOnVideoFrame(target.get()); + machine->cursor_renderer_->RenderOnVideoFrame(target.get(), + region_in_frame); } else { VLOG(1) << "Aborting capture: AuraWindowCaptureMachine has gone away."; result = false;
diff --git a/content/browser/media/capture/aura_window_capture_machine.h b/content/browser/media/capture/aura_window_capture_machine.h index d5bcc3fa..c3f3593 100644 --- a/content/browser/media/capture/aura_window_capture_machine.h +++ b/content/browser/media/capture/aura_window_capture_machine.h
@@ -102,6 +102,7 @@ base::TimeTicks event_time, const CaptureFrameCallback& capture_frame_cb, scoped_refptr<media::VideoFrame> target, + const gfx::Rect& region_in_frame, std::unique_ptr<viz::SingleReleaseCallback> release_callback, bool result);
diff --git a/content/browser/media/capture/cursor_renderer.cc b/content/browser/media/capture/cursor_renderer.cc index b698f1e..5a1062e5 100644 --- a/content/browser/media/capture/cursor_renderer.cc +++ b/content/browser/media/capture/cursor_renderer.cc
@@ -7,9 +7,13 @@ #include <algorithm> #include <cmath> +#include "base/bind.h" +#include "base/bind_helpers.h" #include "base/logging.h" #include "base/memory/ptr_util.h" +#include "base/numerics/safe_conversions.h" #include "skia/ext/image_operations.h" +#include "ui/gfx/geometry/rect.h" namespace content { @@ -25,137 +29,142 @@ } // namespace -CursorRenderer::CursorRenderer(gfx::NativeView view, - CursorDisplaySetting cursor_display_setting) - : captured_view_(view), - cursor_display_setting_(cursor_display_setting), - tick_clock_(base::DefaultTickClock::GetInstance()), +CursorRenderer::CursorRenderer(CursorDisplaySetting cursor_display_setting) + : cursor_display_setting_(cursor_display_setting), + cursor_(gfx::NativeCursor()), + update_scaled_cursor_bitmap_(false), + mouse_move_behavior_(NOT_MOVING), weak_factory_(this) { - Clear(); + // CursorRenderer can be constructed on any thread, but thereafter must be + // used according to class-level comments. + DETACH_FROM_SEQUENCE(ui_sequence_checker_); + DETACH_FROM_SEQUENCE(render_sequence_checker_); } -CursorRenderer::~CursorRenderer() {} +CursorRenderer::~CursorRenderer() { + DCHECK_CALLED_ON_VALID_SEQUENCE(ui_sequence_checker_); +} base::WeakPtr<CursorRenderer> CursorRenderer::GetWeakPtr() { + DCHECK_CALLED_ON_VALID_SEQUENCE(ui_sequence_checker_); return weak_factory_.GetWeakPtr(); } -void CursorRenderer::Clear() { - last_x_scale_ = 0.0f; - last_y_scale_ = 0.0f; - last_cursor_ = gfx::NativeCursor(); - last_cursor_hot_point_ = gfx::Point(); - scaled_cursor_bitmap_.reset(); - last_mouse_position_x_ = 0; - last_mouse_position_y_ = 0; - last_mouse_movement_timestamp_ = base::TimeTicks::Now(); - if (cursor_display_setting_ == kCursorEnabledOnMouseMovement) { - cursor_displayed_ = false; - } else { - cursor_displayed_ = true; - } -} +void CursorRenderer::SnapshotCursorState() { + DCHECK_CALLED_ON_VALID_SEQUENCE(ui_sequence_checker_); -bool CursorRenderer::SnapshotCursorState(const gfx::Rect& region_in_frame) { - if (!captured_view_) { - DVLOG(2) << "Skipping update with no view being tracked"; - return false; - } + base::AutoLock auto_lock(lock_); - // If we are sharing the root view, or namely the whole screen, we will - // render the mouse cursor. For ordinary view, we only render the mouse - // cursor when the view is active. - if (!IsCapturedViewActive()) { - // Return early if the target view is not active. - DVLOG(2) << "Skipping update on an inactive view"; - Clear(); - return false; - } - - gfx::Size view_size = GetCapturedViewSize(); - if (view_size.IsEmpty()) { - DVLOG(2) << "Skipping update on an empty view"; - Clear(); - return false; - } - - gfx::Point cursor_position = GetCursorPositionInView(); - if (!gfx::Rect(view_size).Contains(cursor_position)) { - DVLOG(2) << "Skipping update with cursor outside the view"; - Clear(); - return false; - } - - if (cursor_display_setting_ == kCursorEnabledOnMouseMovement) { - if (cursor_displayed_) { - // Stop displaying cursor if there has been no mouse movement - base::TimeTicks now = tick_clock_->NowTicks(); - if ((now - last_mouse_movement_timestamp_) > - base::TimeDelta::FromSeconds(MAX_IDLE_TIME_SECONDS)) { - cursor_displayed_ = false; - DVLOG(2) << "Turning off cursor display after idle time"; - } - } - if (!cursor_displayed_) - return false; - } - - const float x_scale = - static_cast<float>(region_in_frame.width()) / view_size.width(); - const float y_scale = - static_cast<float>(region_in_frame.height()) / view_size.height(); - - gfx::NativeCursor cursor = GetLastKnownCursor(); - if (last_cursor_ != cursor || last_x_scale_ != x_scale || - last_y_scale_ != y_scale) { - SkBitmap cursor_bitmap = GetLastKnownCursorImage(&last_cursor_hot_point_); - const int scaled_width = cursor_bitmap.width() * x_scale; - const int scaled_height = cursor_bitmap.height() * y_scale; - if (scaled_width <= 0 || scaled_height <= 0) { - DVLOG(2) << "scaled_width <= 0"; - Clear(); - return false; - } - scaled_cursor_bitmap_ = skia::ImageOperations::Resize( - cursor_bitmap, skia::ImageOperations::RESIZE_BEST, scaled_width, - scaled_height); - - last_cursor_ = cursor; - last_x_scale_ = x_scale; - last_y_scale_ = y_scale; - } - - cursor_position.Offset(-last_cursor_hot_point_.x(), - -last_cursor_hot_point_.y()); - cursor_position_in_frame_ = - gfx::Point(region_in_frame.x() + cursor_position.x() * x_scale, - region_in_frame.y() + cursor_position.y() * y_scale); - return true; -} - -// Helper function to composite a cursor bitmap on a YUV420 video frame. -void CursorRenderer::RenderOnVideoFrame(media::VideoFrame* target) const { - if (scaled_cursor_bitmap_.isNull()) + // In CURSOR_DISPLAYED_ON_MOUSE_MOVEMENT mode, if the user hasn't recently + // moved nor clicked the mouse, do not render the mouse cursor. + if (cursor_display_setting_ == CURSOR_DISPLAYED_ON_MOUSE_MOVEMENT && + mouse_move_behavior_ != RECENTLY_MOVED_OR_CLICKED) { + view_size_ = gfx::Size(); return; + } - DCHECK(target); + // Do not render the mouse cursor if the view is not in the foreground window + // on the user's desktop. + if (!IsCapturedViewActive()) { + view_size_ = gfx::Size(); + return; + } + // Collect current view size and mouse cursor state. + view_size_ = GetCapturedViewSize(); + if (view_size_.IsEmpty()) { + return; + } + cursor_position_ = GetCursorPositionInView(); + if (!gfx::Rect(view_size_).Contains(cursor_position_)) { + view_size_ = gfx::Size(); + return; + } + const gfx::NativeCursor cursor = GetLastKnownCursor(); + if (cursor != cursor_ || !cursor_image_.readyToDraw()) { + cursor_ = cursor; + cursor_image_ = GetLastKnownCursorImage(&cursor_hot_point_); + // Force RenderOnVideoFrame() to re-generate its scaled cursor bitmap. + update_scaled_cursor_bitmap_ = true; + } +} + +bool CursorRenderer::RenderOnVideoFrame(media::VideoFrame* frame, + const gfx::Rect& region_in_frame) { + DCHECK_CALLED_ON_VALID_SEQUENCE(render_sequence_checker_); + DCHECK(frame); + + // Grab the |lock_| to read from shared mouse cursor state, and maybe + // re-render the scaled cursor bitmap. + gfx::Size view_size; + gfx::Point cursor_position; + { + base::AutoLock auto_lock(lock_); + + if (view_size_.IsEmpty() || !cursor_image_.readyToDraw()) { + return false; + } + + view_size = view_size_; + + cursor_position = cursor_position_; + cursor_position.Offset(-cursor_hot_point_.x(), -cursor_hot_point_.y()); + // |cursor_position| is further modified, below; but the |lock_| need not be + // held for that. + + const int scaled_width = + base::saturated_cast<int>((static_cast<int64_t>(cursor_image_.width()) * + region_in_frame.width()) / + view_size.width()); + const int scaled_height = base::saturated_cast<int>( + (static_cast<int64_t>(cursor_image_.height()) * + region_in_frame.height()) / + view_size.height()); + if (scaled_width <= 0 || scaled_height <= 0) { + return false; + } + if (update_scaled_cursor_bitmap_) { + scaled_cursor_bitmap_ = SkBitmap(); + update_scaled_cursor_bitmap_ = false; + } + if (!scaled_cursor_bitmap_.readyToDraw() || + scaled_width != scaled_cursor_bitmap_.width() || + scaled_height != scaled_cursor_bitmap_.height()) { + scaled_cursor_bitmap_ = skia::ImageOperations::Resize( + cursor_image_, skia::ImageOperations::RESIZE_BEST, scaled_width, + scaled_height); + } + } + + // Translate cursor position from view coordinates to video frame content + // coordinates. + cursor_position.set_x(base::saturated_cast<int>( + region_in_frame.x() + + (static_cast<int64_t>(cursor_position.x()) * region_in_frame.width()) / + view_size.width())); + cursor_position.set_y(base::saturated_cast<int>( + region_in_frame.y() + + (static_cast<int64_t>(cursor_position.y()) * region_in_frame.height()) / + view_size.height())); + + // Determine the region of the video frame to be modified. gfx::Rect rect = gfx::IntersectRects( - gfx::Rect(scaled_cursor_bitmap_.width(), scaled_cursor_bitmap_.height()) + - gfx::Vector2d(cursor_position_in_frame_.x(), - cursor_position_in_frame_.y()), - target->visible_rect()); + gfx::Rect(cursor_position, gfx::Size(scaled_cursor_bitmap_.width(), + scaled_cursor_bitmap_.height())), + frame->visible_rect()); + // Render the cursor in the video frame. This loop also performs a simple + // RGB→YUV color space conversion, with alpha-blended compositing. for (int y = rect.y(); y < rect.bottom(); ++y) { - int cursor_y = y - cursor_position_in_frame_.y(); - uint8_t* yplane = target->data(media::VideoFrame::kYPlane) + - y * target->row_bytes(media::VideoFrame::kYPlane); - uint8_t* uplane = target->data(media::VideoFrame::kUPlane) + - (y / 2) * target->row_bytes(media::VideoFrame::kUPlane); - uint8_t* vplane = target->data(media::VideoFrame::kVPlane) + - (y / 2) * target->row_bytes(media::VideoFrame::kVPlane); + int cursor_y = y - cursor_position.y(); + uint8_t* yplane = frame->data(media::VideoFrame::kYPlane) + + y * frame->row_bytes(media::VideoFrame::kYPlane); + uint8_t* uplane = frame->data(media::VideoFrame::kUPlane) + + (y / 2) * frame->row_bytes(media::VideoFrame::kUPlane); + uint8_t* vplane = frame->data(media::VideoFrame::kVPlane) + + (y / 2) * frame->row_bytes(media::VideoFrame::kVPlane); for (int x = rect.x(); x < rect.right(); ++x) { - int cursor_x = x - cursor_position_in_frame_.x(); + int cursor_x = x - cursor_position.x(); SkColor color = scaled_cursor_bitmap_.getColor(cursor_x, cursor_y); int alpha = SkColorGetA(color); int color_r = SkColorGetR(color); @@ -176,29 +185,94 @@ } } } + + return true; } -void CursorRenderer::OnMouseMoved(const gfx::Point& location, - base::TimeTicks timestamp) { - if (!cursor_displayed_) { - if (std::abs(location.x() - last_mouse_position_x_) > MIN_MOVEMENT_PIXELS || - std::abs(location.y() - last_mouse_position_y_) > MIN_MOVEMENT_PIXELS) - cursor_displayed_ = true; +void CursorRenderer::SetNeedsRedrawCallback(base::RepeatingClosure callback) { + DCHECK_CALLED_ON_VALID_SEQUENCE(ui_sequence_checker_); + + needs_redraw_callback_ = std::move(callback); +} + +bool CursorRenderer::IsUserInteractingWithView() const { + DCHECK_CALLED_ON_VALID_SEQUENCE(ui_sequence_checker_); + + return mouse_move_behavior_ == RECENTLY_MOVED_OR_CLICKED; +} + +void CursorRenderer::OnMouseMoved(const gfx::Point& location) { + DCHECK_CALLED_ON_VALID_SEQUENCE(ui_sequence_checker_); + + switch (mouse_move_behavior_) { + case NOT_MOVING: + mouse_move_behavior_ = STARTING_TO_MOVE; + mouse_move_start_location_ = location; + mouse_activity_ended_timer_.Start( + FROM_HERE, base::TimeDelta::FromSeconds(IDLE_TIMEOUT_SECONDS), + base::BindRepeating(&CursorRenderer::OnMouseHasGoneIdle, + base::Unretained(this))); + break; + case STARTING_TO_MOVE: + if (std::abs(location.x() - mouse_move_start_location_.x()) > + MIN_MOVEMENT_PIXELS || + std::abs(location.y() - mouse_move_start_location_.y()) > + MIN_MOVEMENT_PIXELS) { + mouse_move_behavior_ = RECENTLY_MOVED_OR_CLICKED; + mouse_activity_ended_timer_.Reset(); + } + break; + case RECENTLY_MOVED_OR_CLICKED: + mouse_activity_ended_timer_.Reset(); + break; } - if (cursor_displayed_) { - last_mouse_movement_timestamp_ = timestamp; - last_mouse_position_x_ = location.x(); - last_mouse_position_y_ = location.y(); + // If there is sufficient mouse activity, or the cursor should always be + // displayed, snapshot the cursor state and run the redraw callback to show it + // at its new location in the video. + if (mouse_move_behavior_ == RECENTLY_MOVED_OR_CLICKED || + cursor_display_setting_ == CURSOR_DISPLAYED_ALWAYS) { + SnapshotCursorState(); + if (!needs_redraw_callback_.is_null()) { + needs_redraw_callback_.Run(); + } } } -void CursorRenderer::OnMouseClicked(const gfx::Point& location, - base::TimeTicks timestamp) { - cursor_displayed_ = true; - last_mouse_movement_timestamp_ = timestamp; - last_mouse_position_x_ = location.x(); - last_mouse_position_y_ = location.y(); +void CursorRenderer::OnMouseClicked(const gfx::Point& location) { + DCHECK_CALLED_ON_VALID_SEQUENCE(ui_sequence_checker_); + + if (mouse_activity_ended_timer_.IsRunning()) { + mouse_activity_ended_timer_.Reset(); + } else { + mouse_activity_ended_timer_.Start( + FROM_HERE, base::TimeDelta::FromSeconds(IDLE_TIMEOUT_SECONDS), + base::BindRepeating(&CursorRenderer::OnMouseHasGoneIdle, + base::Unretained(this))); + } + mouse_move_behavior_ = RECENTLY_MOVED_OR_CLICKED; + + // Regardless of the |cursor_display_setting_|, snapshot the cursor and run + // the redraw callback to show it at its current location in the video. + SnapshotCursorState(); + if (!needs_redraw_callback_.is_null()) { + needs_redraw_callback_.Run(); + } +} + +void CursorRenderer::OnMouseHasGoneIdle() { + DCHECK_CALLED_ON_VALID_SEQUENCE(ui_sequence_checker_); + + mouse_move_behavior_ = NOT_MOVING; + + // The timer has fired to indicate no further mouse activity. It's a good idea + // to snapshot the cursor and run the redraw callback to ensure it is being + // presented in the video correctly, whether showing its final location or to + // remove it from the video. + SnapshotCursorState(); + if (!needs_redraw_callback_.is_null()) { + needs_redraw_callback_.Run(); + } } } // namespace content
diff --git a/content/browser/media/capture/cursor_renderer.h b/content/browser/media/capture/cursor_renderer.h index c658e33b..40bb12a 100644 --- a/content/browser/media/capture/cursor_renderer.h +++ b/content/browser/media/capture/cursor_renderer.h
@@ -5,64 +5,75 @@ #ifndef CONTENT_BROWSER_MEDIA_CAPTURE_CURSOR_RENDERER_H_ #define CONTENT_BROWSER_MEDIA_CAPTURE_CURSOR_RENDERER_H_ +#include "base/callback.h" #include "base/macros.h" -#include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" -#include "base/time/default_tick_clock.h" -#include "base/time/tick_clock.h" +#include "base/sequence_checker.h" +#include "base/synchronization/lock.h" +#include "base/timer/timer.h" #include "content/common/content_export.h" #include "media/base/video_frame.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/cursor/cursor.h" +#include "ui/gfx/geometry/point.h" +#include "ui/gfx/geometry/size.h" #include "ui/gfx/native_widget_types.h" namespace content { -// Setting to control cursor display based on either mouse movement or always -// forced to be enabled. -enum CursorDisplaySetting { - kCursorAlwaysEnabled, - kCursorEnabledOnMouseMovement -}; - // CursorRenderer is an abstract base class that handles all the -// non-platform-specific common cursor rendering functionality. +// non-platform-specific common cursor rendering functionality. In order to +// track the cursor, the platform-specific implementation will listen to +// mouse events and this base class will process them. // -// In order to track the cursor, the platform-specific implementation -// will listen to mouse events. +// All parts of this class are meant to run on the UI BrowserThread, except for +// RenderOnVideoFrame(), which may be called from any thread. It is up to the +// client code to ensure the CursorRenderer's lifetime while in use across +// multiple threads. class CONTENT_EXPORT CursorRenderer { public: - static std::unique_ptr<CursorRenderer> Create(gfx::NativeView view); + // Setting to control cursor display based on either mouse movement or always + // forced to be enabled. + enum CursorDisplaySetting { + CURSOR_DISPLAYED_ALWAYS, + CURSOR_DISPLAYED_ON_MOUSE_MOVEMENT, + }; - CursorRenderer(gfx::NativeView captured_view, - CursorDisplaySetting cursor_display); + static std::unique_ptr<CursorRenderer> Create(CursorDisplaySetting display); virtual ~CursorRenderer(); - // Clears the cursor state being tracked. Called when there is a need to - // reset the state. - void Clear(); + // Sets a new target view to monitor for mouse cursor updates. + virtual void SetTargetView(gfx::NativeView view) = 0; - // Takes a snapshot of the current cursor state and determines whether - // the cursor will be rendered, which cursor image to render, and at what - // location within |region_in_frame| to render it. Returns true if cursor - // needs to be rendered. - bool SnapshotCursorState(const gfx::Rect& region_in_frame); + // Renders cursor on the given video frame within the content region, + // returning true if |frame| was modified. + bool RenderOnVideoFrame(media::VideoFrame* frame, + const gfx::Rect& region_in_frame); - // Renders cursor on the |target| video frame. - void RenderOnVideoFrame(media::VideoFrame* target) const; + // Sets a callback that will be run whenever RenderOnVideoFrame() should be + // called soon, to update the mouse cursor location or image in the video. + void SetNeedsRedrawCallback(base::RepeatingClosure callback); + + // Returns true if the user has recently interacted with the view. + bool IsUserInteractingWithView() const; // Returns a weak pointer. base::WeakPtr<CursorRenderer> GetWeakPtr(); protected: enum { - // Minium movement before cursor is rendered on frame. + // Minium movement before cursor has been considered intentionally moved by + // the user. MIN_MOVEMENT_PIXELS = 15, - // Maximum idle time allowed before we stop rendering the cursor on frame. - MAX_IDLE_TIME_SECONDS = 2 + // Amount of time to elapse with no mouse activity before the cursor should + // stop showing in the video. Does not apply to CURSOR_DISPLAYED_ALWAYS + // mode, of course. + IDLE_TIMEOUT_SECONDS = 2 }; + explicit CursorRenderer(CursorDisplaySetting display); + // Returns true if the captured view is a part of an active application // window. virtual bool IsCapturedViewActive() = 0; @@ -80,36 +91,66 @@ virtual SkBitmap GetLastKnownCursorImage(gfx::Point* hot_point) = 0; // Called by subclasses to report mouse events within the captured view. - void OnMouseMoved(const gfx::Point& location, base::TimeTicks timestamp); - void OnMouseClicked(const gfx::Point& location, base::TimeTicks timestamp); + void OnMouseMoved(const gfx::Point& location); + void OnMouseClicked(const gfx::Point& location); + + // Called by the |mouse_activity_ended_timer_| once no mouse events have + // occurred for IDLE_TIMEOUT_SECONDS. Also, called by subclasses when changing + // the target view. + void OnMouseHasGoneIdle(); private: friend class CursorRendererAuraTest; friend class CursorRendererMacTest; - const gfx::NativeView captured_view_; + enum MouseMoveBehavior { + NOT_MOVING, // Mouse has not moved recently. + STARTING_TO_MOVE, // Mouse has moved, but not significantly. + RECENTLY_MOVED_OR_CLICKED, // Sufficient mouse activity present. + }; - // Snapshot of cursor, source size, scale, position, and cursor bitmap; - // as of the last call to SnapshotCursorState. - float last_x_scale_; - float last_y_scale_; - gfx::NativeCursor last_cursor_; - gfx::Point cursor_position_in_frame_; - gfx::Point last_cursor_hot_point_; - SkBitmap scaled_cursor_bitmap_; - - // Updated in mouse event listener and used to make a decision on - // when the cursor is rendered. - base::TimeTicks last_mouse_movement_timestamp_; - float last_mouse_position_x_; - float last_mouse_position_y_; - bool cursor_displayed_; + // Takes a snapshot of the current mouse cursor state, for use by + // RenderOnVideoFrame(). + void SnapshotCursorState(); // Controls whether cursor is displayed based on active mouse movement. - CursorDisplaySetting cursor_display_setting_; + const CursorDisplaySetting cursor_display_setting_; - // Allows tests to replace the clock. - base::TickClock* tick_clock_; + // Protects members shared by RenderOnVideoFrame() and the rest of the class. + base::Lock lock_; + + // These are updated by SnapshotCursorState(), then later read within + // RenderOnVideoFrame(). Access is protected by |lock_|. + gfx::Size view_size_; // Empty means "do not show mouse cursor." + gfx::Point cursor_position_; + gfx::NativeCursor cursor_; + gfx::Point cursor_hot_point_; + SkBitmap cursor_image_; + // Flag set to invalidate |scaled_cursor_bitmap_|. + bool update_scaled_cursor_bitmap_; + + // A cache of the current scaled cursor bitmap. This is only accessed by the + // thread calling RenderOnVideoFrame(). + SkBitmap scaled_cursor_bitmap_; + + // Updated in the mouse event handlers and used to decide whether the user is + // interacting with the view and whether to run the |needs_redraw_callback_|. + // These do not need to be protected by |lock_| since they are only accessed + // on the UI BrowserThread. + MouseMoveBehavior mouse_move_behavior_; + gfx::Point mouse_move_start_location_; + base::OneShotTimer mouse_activity_ended_timer_; + + // Run whenever the mouse cursor would be rendered differently than when it + // was rendered in the last video frame. + base::RepeatingClosure needs_redraw_callback_; + + // Everything except the constructor and RenderOnVideoFrame() must be called + // on the UI BrowserThread. + SEQUENCE_CHECKER(ui_sequence_checker_); + + // RenderOnVideoFrame() must be called on the same thread each time. + SEQUENCE_CHECKER(render_sequence_checker_); base::WeakPtrFactory<CursorRenderer> weak_factory_;
diff --git a/content/browser/media/capture/cursor_renderer_aura.cc b/content/browser/media/capture/cursor_renderer_aura.cc index cccd3ad3..63741500 100644 --- a/content/browser/media/capture/cursor_renderer_aura.cc +++ b/content/browser/media/capture/cursor_renderer_aura.cc
@@ -17,26 +17,28 @@ // static std::unique_ptr<CursorRenderer> CursorRenderer::Create( - gfx::NativeWindow window) { - return std::make_unique<CursorRendererAura>(window, - kCursorEnabledOnMouseMovement); + CursorRenderer::CursorDisplaySetting display) { + return std::make_unique<CursorRendererAura>(display); } -CursorRendererAura::CursorRendererAura( - aura::Window* window, - CursorDisplaySetting cursor_display_setting) - : CursorRenderer(window, cursor_display_setting), window_(window) { - if (window_) { - window_->AddObserver(this); - window_->AddPreTargetHandler(this); - } -} +CursorRendererAura::CursorRendererAura(CursorDisplaySetting display) + : CursorRenderer(display) {} CursorRendererAura::~CursorRendererAura() { + SetTargetView(nullptr); +} + +void CursorRendererAura::SetTargetView(aura::Window* window) { if (window_) { window_->RemoveObserver(this); window_->RemovePreTargetHandler(this); } + window_ = window; + OnMouseHasGoneIdle(); + if (window_) { + window_->AddObserver(this); + window_->AddPreTargetHandler(this); + } } bool CursorRendererAura::IsCapturedViewActive() { @@ -120,12 +122,12 @@ gfx::Point mouse_location(event->x(), event->y()); switch (event->type()) { case ui::ET_MOUSE_MOVED: - OnMouseMoved(mouse_location, event->time_stamp()); + OnMouseMoved(mouse_location); break; case ui::ET_MOUSE_PRESSED: case ui::ET_MOUSE_RELEASED: case ui::ET_MOUSEWHEEL: - OnMouseClicked(mouse_location, event->time_stamp()); + OnMouseClicked(mouse_location); break; default: return;
diff --git a/content/browser/media/capture/cursor_renderer_aura.h b/content/browser/media/capture/cursor_renderer_aura.h index 21e1996a..8d825fa8 100644 --- a/content/browser/media/capture/cursor_renderer_aura.h +++ b/content/browser/media/capture/cursor_renderer_aura.h
@@ -15,11 +15,11 @@ public ui::EventHandler, public aura::WindowObserver { public: - explicit CursorRendererAura(aura::Window* window, - CursorDisplaySetting cursor_display); + explicit CursorRendererAura(CursorDisplaySetting cursor_display); ~CursorRendererAura() final; - // CursorRender implementation. + // CursorRenderer implementation. + void SetTargetView(gfx::NativeView window) final; bool IsCapturedViewActive() final; gfx::Size GetCapturedViewSize() final; gfx::Point GetCursorPositionInView() final; @@ -33,7 +33,7 @@ void OnWindowDestroying(aura::Window* window) final; private: - aura::Window* window_; + aura::Window* window_ = nullptr; DISALLOW_COPY_AND_ASSIGN(CursorRendererAura); };
diff --git a/content/browser/media/capture/cursor_renderer_aura_unittest.cc b/content/browser/media/capture/cursor_renderer_aura_unittest.cc index 7203567..149dda6 100644 --- a/content/browser/media/capture/cursor_renderer_aura_unittest.cc +++ b/content/browser/media/capture/cursor_renderer_aura_unittest.cc
@@ -10,7 +10,6 @@ #include "base/files/file_path.h" #include "base/path_service.h" -#include "base/test/simple_test_tick_clock.h" #include "base/time/time.h" #include "media/base/video_frame.h" #include "testing/gtest/include/gtest/gtest.h" @@ -50,11 +49,13 @@ window_.reset(aura::test::CreateTestWindowWithBounds( gfx::Rect(0, 0, 800, 600), root_window())); - cursor_renderer_.reset( - new CursorRendererAura(window_.get(), kCursorEnabledOnMouseMovement)); + cursor_renderer_.reset(new CursorRendererAura( + CursorRenderer::CURSOR_DISPLAYED_ON_MOUSE_MOVEMENT)); + cursor_renderer_->SetTargetView(window_.get()); new wm::DefaultActivationClient(root_window()); aura::client::SetScreenPositionClient(root_window(), &screen_position_client_); + wm::ActivateWindow(window_.get()); } void TearDown() override { @@ -64,43 +65,48 @@ AuraTestBase::TearDown(); } - void SetTickClock(base::SimpleTestTickClock* clock) { - cursor_renderer_->tick_clock_ = clock; + base::TimeTicks Now() { return base::TimeTicks::Now(); } + + bool CursorDisplayed() { + // Request rendering into a dummy video frame. If RenderCursorOnVideoFrame() + // returns true, then the cursor is being displayed. + if (!dummy_frame_) { + constexpr gfx::Size dummy_frame_size = gfx::Size(320, 200); + dummy_frame_ = media::VideoFrame::CreateZeroInitializedFrame( + media::PIXEL_FORMAT_YV12, dummy_frame_size, + gfx::Rect(dummy_frame_size), dummy_frame_size, base::TimeDelta()); + } + return cursor_renderer_ && + cursor_renderer_->RenderOnVideoFrame(dummy_frame_.get(), + dummy_frame_->visible_rect()); } - base::TimeTicks Now() { return cursor_renderer_->tick_clock_->NowTicks(); } - - bool CursorDisplayed() { return cursor_renderer_->cursor_displayed_; } - - void RenderCursorOnVideoFrame(media::VideoFrame* target) { - cursor_renderer_->RenderOnVideoFrame(target); - } - - void SnapshotCursorState(gfx::Rect region_in_frame) { - cursor_renderer_->SnapshotCursorState(region_in_frame); + bool RenderCursorOnVideoFrame(media::VideoFrame* frame) { + return cursor_renderer_->RenderOnVideoFrame(frame, frame->visible_rect()); } void MoveMouseCursorWithinWindow() { gfx::Point point1(20, 20); ui::MouseEvent event1(ui::ET_MOUSE_MOVED, point1, point1, Now(), 0, 0); + aura::Env::GetInstance()->set_last_mouse_location(point1); cursor_renderer_->OnMouseEvent(&event1); gfx::Point point2(60, 60); ui::MouseEvent event2(ui::ET_MOUSE_MOVED, point2, point2, Now(), 0, 0); - cursor_renderer_->OnMouseEvent(&event2); aura::Env::GetInstance()->set_last_mouse_location(point2); - } - - void MoveMouseCursorWithinWindow(gfx::Point point) { - ui::MouseEvent event(ui::ET_MOUSE_MOVED, point, point, Now(), 0, 0); - cursor_renderer_->OnMouseEvent(&event); - aura::Env::GetInstance()->set_last_mouse_location(point); + cursor_renderer_->OnMouseEvent(&event2); } void MoveMouseCursorOutsideWindow() { gfx::Point point(1000, 1000); ui::MouseEvent event1(ui::ET_MOUSE_MOVED, point, point, Now(), 0, 0); - cursor_renderer_->OnMouseEvent(&event1); aura::Env::GetInstance()->set_last_mouse_location(point); + cursor_renderer_->OnMouseEvent(&event1); + } + + void SimulateMouseWentIdle() { + EXPECT_TRUE(cursor_renderer_->mouse_activity_ended_timer_.IsRunning()); + cursor_renderer_->mouse_activity_ended_timer_.Stop(); + cursor_renderer_->OnMouseHasGoneIdle(); } // A very simple test of whether there are any non-zero pixels @@ -131,64 +137,55 @@ wm::DefaultScreenPositionClient screen_position_client_; std::unique_ptr<aura::Window> window_; std::unique_ptr<CursorRendererAura> cursor_renderer_; + + scoped_refptr<media::VideoFrame> dummy_frame_; }; TEST_F(CursorRendererAuraTest, CursorAlwaysDisplayed) { // Set up cursor renderer to always display cursor. cursor_renderer_.reset( - new CursorRendererAura(window_.get(), kCursorAlwaysEnabled)); + new CursorRendererAura(CursorRenderer::CURSOR_DISPLAYED_ALWAYS)); + cursor_renderer_->SetTargetView(window_.get()); // Cursor displayed at start. EXPECT_TRUE(CursorDisplayed()); - base::SimpleTestTickClock clock; - SetTickClock(&clock); - // Cursor displayed after mouse movement. MoveMouseCursorWithinWindow(); EXPECT_TRUE(CursorDisplayed()); // Cursor displayed after idle period. - clock.Advance(base::TimeDelta::FromSeconds(5)); - SnapshotCursorState(gfx::Rect(10, 10, 200, 200)); + SimulateMouseWentIdle(); EXPECT_TRUE(CursorDisplayed()); - // Cursor displayed with mouse outside the window. + // Cursor not displayed with mouse outside the window. MoveMouseCursorOutsideWindow(); - SnapshotCursorState(gfx::Rect(10, 10, 200, 200)); - EXPECT_TRUE(CursorDisplayed()); + EXPECT_FALSE(CursorDisplayed()); } TEST_F(CursorRendererAuraTest, CursorDuringMouseMovement) { - // Keep window activated. - wm::ActivateWindow(window_.get()); - + // Cursor not displayed at start. EXPECT_FALSE(CursorDisplayed()); - base::SimpleTestTickClock clock; - SetTickClock(&clock); - // Cursor displayed after mouse movement. MoveMouseCursorWithinWindow(); EXPECT_TRUE(CursorDisplayed()); - // Cursor not be displayed after idle period. - clock.Advance(base::TimeDelta::FromSeconds(5)); - SnapshotCursorState(gfx::Rect(10, 10, 200, 200)); + // Cursor not displayed after idle period. + SimulateMouseWentIdle(); EXPECT_FALSE(CursorDisplayed()); // Cursor displayed with mouse movement following idle period. MoveMouseCursorWithinWindow(); - SnapshotCursorState(gfx::Rect(10, 10, 200, 200)); EXPECT_TRUE(CursorDisplayed()); // Cursor not displayed if mouse outside the window MoveMouseCursorOutsideWindow(); - SnapshotCursorState(gfx::Rect(10, 10, 200, 200)); EXPECT_FALSE(CursorDisplayed()); } TEST_F(CursorRendererAuraTest, CursorOnActiveWindow) { + // Cursor not displayed at start. EXPECT_FALSE(CursorDisplayed()); // Cursor displayed after mouse movement. @@ -199,20 +196,17 @@ std::unique_ptr<aura::Window> window2(aura::test::CreateTestWindowWithBounds( gfx::Rect(0, 0, 800, 600), root_window())); wm::ActivateWindow(window2.get()); - SnapshotCursorState(gfx::Rect(10, 10, 200, 200)); + MoveMouseCursorWithinWindow(); EXPECT_FALSE(CursorDisplayed()); // Cursor displayed if window activated again. - MoveMouseCursorWithinWindow(); wm::ActivateWindow(window_.get()); - SnapshotCursorState(gfx::Rect(10, 10, 200, 200)); + MoveMouseCursorWithinWindow(); EXPECT_TRUE(CursorDisplayed()); } TEST_F(CursorRendererAuraTest, CursorRenderedOnFrame) { - // Keep window activated. - wm::ActivateWindow(window_.get()); - + // Cursor not displayed at start. EXPECT_FALSE(CursorDisplayed()); gfx::Size size(800, 600); @@ -221,18 +215,18 @@ size, gfx::Rect(size), size, base::TimeDelta()); - MoveMouseCursorWithinWindow(gfx::Point(60, 60)); - SnapshotCursorState(gfx::Rect(size)); + MoveMouseCursorWithinWindow(); EXPECT_TRUE(CursorDisplayed()); EXPECT_FALSE(NonZeroPixelsInRegion(frame, gfx::Rect(50, 50, 70, 70))); - RenderCursorOnVideoFrame(frame.get()); + EXPECT_TRUE(RenderCursorOnVideoFrame(frame.get())); EXPECT_TRUE(NonZeroPixelsInRegion(frame, gfx::Rect(50, 50, 70, 70))); } TEST_F(CursorRendererAuraTest, CursorRenderedOnRootWindow) { - cursor_renderer_.reset(new CursorRendererAura(root_window(), - kCursorEnabledOnMouseMovement)); + cursor_renderer_->SetTargetView(root_window()); + + // Cursor not displayed at start. EXPECT_FALSE(CursorDisplayed()); // Cursor displayed after mouse movement. @@ -243,7 +237,6 @@ std::unique_ptr<aura::Window> window2(aura::test::CreateTestWindowWithBounds( gfx::Rect(0, 0, 800, 600), root_window())); wm::ActivateWindow(window2.get()); - SnapshotCursorState(gfx::Rect(0, 0, 800, 600)); EXPECT_TRUE(CursorDisplayed()); }
diff --git a/content/browser/media/capture/cursor_renderer_mac.h b/content/browser/media/capture/cursor_renderer_mac.h index 2da16c07..cdf77a0 100644 --- a/content/browser/media/capture/cursor_renderer_mac.h +++ b/content/browser/media/capture/cursor_renderer_mac.h
@@ -19,13 +19,14 @@ base::scoped_nsobject<NSView> capturedView_; // Runs on any mouse interaction from user. - base::Closure mouseInteractionObserver_; + base::RepeatingClosure mouseInteractionObserver_; } - (instancetype)initWithView:(NSView*)nsView; // Register an observer for mouse interaction. -- (void)registerMouseInteractionObserver:(const base::Closure&)observer; +- (void)registerMouseInteractionObserver: + (const base::RepeatingClosure&)observer; @end @@ -33,10 +34,11 @@ class CONTENT_EXPORT CursorRendererMac : public CursorRenderer { public: - explicit CursorRendererMac(gfx::NativeView view); + explicit CursorRendererMac(CursorDisplaySetting cursor_display); ~CursorRendererMac() final; - // CursorRender implementation. + // CursorRenderer implementation. + void SetTargetView(gfx::NativeView window) final; bool IsCapturedViewActive() final; gfx::Size GetCapturedViewSize() final; gfx::Point GetCursorPositionInView() final; @@ -49,7 +51,7 @@ // Called for mouse activity events. void OnMouseEvent(); - NSView* const view_; + NSView* view_ = nil; base::scoped_nsobject<CursorRendererMouseTracker> mouse_tracker_;
diff --git a/content/browser/media/capture/cursor_renderer_mac.mm b/content/browser/media/capture/cursor_renderer_mac.mm index 66f8871..7d6054d 100644 --- a/content/browser/media/capture/cursor_renderer_mac.mm +++ b/content/browser/media/capture/cursor_renderer_mac.mm
@@ -39,7 +39,8 @@ } } -- (void)registerMouseInteractionObserver:(const base::Closure&)observer { +- (void)registerMouseInteractionObserver: + (const base::RepeatingClosure&)observer { mouseInteractionObserver_ = observer; } @@ -59,19 +60,33 @@ namespace content { // static -std::unique_ptr<CursorRenderer> CursorRenderer::Create(gfx::NativeView view) { - return std::make_unique<CursorRendererMac>(view); +std::unique_ptr<CursorRenderer> CursorRenderer::Create( + CursorRenderer::CursorDisplaySetting display) { + return std::make_unique<CursorRendererMac>(display); } -CursorRendererMac::CursorRendererMac(gfx::NativeView view) - : CursorRenderer(view, kCursorEnabledOnMouseMovement), view_(view) { - mouse_tracker_.reset([[CursorRendererMouseTracker alloc] initWithView:view]); - [mouse_tracker_ registerMouseInteractionObserver: - base::Bind(&CursorRendererMac::OnMouseEvent, base::Unretained(this))]; -} +CursorRendererMac::CursorRendererMac(CursorDisplaySetting display) + : CursorRenderer(display) {} CursorRendererMac::~CursorRendererMac() { - [mouse_tracker_ stopTracking]; + SetTargetView(nil); +} + +void CursorRendererMac::SetTargetView(NSView* view) { + if (view_) { + [mouse_tracker_ stopTracking]; + mouse_tracker_.reset(); + } + view_ = view; + OnMouseHasGoneIdle(); + if (view_) { + mouse_tracker_.reset( + [[CursorRendererMouseTracker alloc] initWithView:view_]); + [mouse_tracker_ + registerMouseInteractionObserver:base::BindRepeating( + &CursorRendererMac::OnMouseEvent, + base::Unretained(this))]; + } } bool CursorRendererMac::IsCapturedViewActive() { @@ -120,7 +135,7 @@ void CursorRendererMac::OnMouseEvent() { // Update cursor movement info to CursorRenderer. - OnMouseMoved(GetCursorPositionInView(), base::TimeTicks::Now()); + OnMouseMoved(GetCursorPositionInView()); } } // namespace content
diff --git a/content/browser/media/capture/cursor_renderer_mac_unittest.mm b/content/browser/media/capture/cursor_renderer_mac_unittest.mm index 96fbd8d..4e24060 100644 --- a/content/browser/media/capture/cursor_renderer_mac_unittest.mm +++ b/content/browser/media/capture/cursor_renderer_mac_unittest.mm
@@ -8,7 +8,8 @@ #include "base/mac/scoped_nsobject.h" #include "base/memory/ptr_util.h" -#include "base/test/simple_test_tick_clock.h" +#include "base/test/scoped_task_environment.h" +#include "base/time/time.h" #include "media/base/video_frame.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/gfx/mac/coordinate_conversion.h" @@ -41,9 +42,12 @@ initWithFrame:NSMakeRect(0, 0, kTestViewWidth, kTestViewHeight)]); view_ = view.get(); [[test_window() contentView] addSubview:view_]; - cursor_renderer_.reset(new CursorRendererMac(view_)); + cursor_renderer_.reset(new CursorRendererMac( + CursorRenderer::CURSOR_DISPLAYED_ON_MOUSE_MOVEMENT)); + cursor_renderer_->SetTargetView(view_); // Dis-associate mouse and cursor. StartEventTap(); + [test_window() setPretendIsKeyWindow:YES]; } void TearDown() override { @@ -52,18 +56,22 @@ ui::CocoaTest::TearDown(); } - void SetTickClock(base::SimpleTestTickClock* clock) { - cursor_renderer_->tick_clock_ = clock; + bool CursorDisplayed() { + // Request rendering into a dummy video frame. If RenderCursorOnVideoFrame() + // returns true, then the cursor is being displayed. + if (!dummy_frame_) { + constexpr gfx::Size dummy_frame_size = gfx::Size(320, 200); + dummy_frame_ = media::VideoFrame::CreateZeroInitializedFrame( + media::PIXEL_FORMAT_YV12, dummy_frame_size, + gfx::Rect(dummy_frame_size), dummy_frame_size, base::TimeDelta()); + } + return cursor_renderer_ && + cursor_renderer_->RenderOnVideoFrame(dummy_frame_.get(), + dummy_frame_->visible_rect()); } - bool CursorDisplayed() { return cursor_renderer_->cursor_displayed_; } - - void RenderCursorOnVideoFrame(media::VideoFrame* target) { - cursor_renderer_->RenderOnVideoFrame(target); - } - - void SnapshotCursorState(gfx::Rect region_in_frame) { - cursor_renderer_->SnapshotCursorState(region_in_frame); + bool RenderCursorOnVideoFrame(media::VideoFrame* frame) { + return cursor_renderer_->RenderOnVideoFrame(frame, frame->visible_rect()); } // Here the |point| is in Aura coordinates (the origin (0, 0) is at top-left @@ -71,12 +79,6 @@ // it needs to be converted into Cocoa coordinates (the origin is at // bottom-left of the main screen) first, and then info Quartz coordinates // (the origin is at top-left of the main display). - void MoveMouseCursorWithinWindow(gfx::Point point) { - point.set_y(kTestViewHeight - point.y()); - CGWarpMouseCursorPosition(gfx::ScreenPointToNSPoint(point)); - cursor_renderer_->OnMouseEvent(); - } - void MoveMouseCursorWithinWindow() { CGWarpMouseCursorPosition( gfx::ScreenPointToNSPoint(gfx::Point(50, kTestViewHeight - 50))); @@ -92,6 +94,12 @@ cursor_renderer_->OnMouseEvent(); } + void SimulateMouseWentIdle() { + EXPECT_TRUE(cursor_renderer_->mouse_activity_ended_timer_.IsRunning()); + cursor_renderer_->mouse_activity_ended_timer_.Stop(); + cursor_renderer_->OnMouseHasGoneIdle(); + } + // A very simple test of whether there are any non-zero pixels // in the region |rect| within |frame|. bool NonZeroPixelsInRegion(scoped_refptr<media::VideoFrame> frame, @@ -135,67 +143,57 @@ void StopEventTap() { CGEventTapEnable(event_tap_, false); } protected: + base::test::ScopedTaskEnvironment scoped_task_environment_; NSView* view_; std::unique_ptr<CursorRendererMac> cursor_renderer_; CFMachPortRef event_tap_; + + scoped_refptr<media::VideoFrame> dummy_frame_; }; TEST_F(CursorRendererMacTest, CursorDuringMouseMovement) { - // Keep window activated. - [test_window() setPretendIsKeyWindow:YES]; - + // Cursor not displayed at start. EXPECT_FALSE(CursorDisplayed()); - base::SimpleTestTickClock clock; - SetTickClock(&clock); - // Cursor displayed after mouse movement. MoveMouseCursorWithinWindow(); EXPECT_TRUE(CursorDisplayed()); - // Cursor not be displayed after idle period. - clock.SetNowTicks(base::TimeTicks::Now()); - clock.Advance(base::TimeDelta::FromSeconds(5)); - SnapshotCursorState(gfx::Rect(10, 10, 200, 200)); + // Cursor not displayed after idle period. + SimulateMouseWentIdle(); EXPECT_FALSE(CursorDisplayed()); - clock.SetNowTicks(base::TimeTicks::Now()); // Cursor displayed with mouse movement following idle period. MoveMouseCursorWithinWindow(); - SnapshotCursorState(gfx::Rect(10, 10, 200, 200)); EXPECT_TRUE(CursorDisplayed()); // Cursor not displayed if mouse outside the window MoveMouseCursorOutsideWindow(); - SnapshotCursorState(gfx::Rect(10, 10, 200, 200)); EXPECT_FALSE(CursorDisplayed()); } TEST_F(CursorRendererMacTest, CursorOnActiveWindow) { + // Cursor not displayed at start. EXPECT_FALSE(CursorDisplayed()); // Cursor displayed after mouse movement. - [test_window() setPretendIsKeyWindow:YES]; MoveMouseCursorWithinWindow(); EXPECT_TRUE(CursorDisplayed()); - // Cursor not be displayed if window is not activated. + // Cursor not displayed if window is not activated. [test_window() setPretendIsKeyWindow:NO]; - SnapshotCursorState(gfx::Rect(10, 10, 200, 200)); + MoveMouseCursorWithinWindow(); EXPECT_FALSE(CursorDisplayed()); // Cursor is displayed again if window is activated again. [test_window() setPretendIsKeyWindow:YES]; MoveMouseCursorWithinWindow(); - SnapshotCursorState(gfx::Rect(10, 10, 200, 200)); EXPECT_TRUE(CursorDisplayed()); } TEST_F(CursorRendererMacTest, CursorRenderedOnFrame) { - // Keep window activated. - [test_window() setPretendIsKeyWindow:YES]; - + // Cursor not displayed at start. EXPECT_FALSE(CursorDisplayed()); gfx::Size size(kTestViewWidth, kTestViewHeight); @@ -204,12 +202,11 @@ size, gfx::Rect(size), size, base::TimeDelta()); - MoveMouseCursorWithinWindow(gfx::Point(60, 60)); - SnapshotCursorState(gfx::Rect(size)); + MoveMouseCursorWithinWindow(); EXPECT_TRUE(CursorDisplayed()); EXPECT_FALSE(NonZeroPixelsInRegion(frame, gfx::Rect(50, 50, 70, 70))); - RenderCursorOnVideoFrame(frame.get()); + EXPECT_TRUE(RenderCursorOnVideoFrame(frame.get())); EXPECT_TRUE(NonZeroPixelsInRegion(frame, gfx::Rect(50, 50, 70, 70))); }
diff --git a/content/browser/media/capture/web_contents_video_capture_device.cc b/content/browser/media/capture/web_contents_video_capture_device.cc index 83ae9bee..91e7b0b 100644 --- a/content/browser/media/capture/web_contents_video_capture_device.cc +++ b/content/browser/media/capture/web_contents_video_capture_device.cc
@@ -21,7 +21,6 @@ #include "content/browser/media/capture/cursor_renderer.h" #include "content/browser/media/capture/fake_webcontent_capture_machine.h" #include "content/browser/media/capture/web_contents_tracker.h" -#include "content/browser/media/capture/window_activity_tracker.h" #include "content/browser/renderer_host/render_widget_host_impl.h" #include "content/browser/renderer_host/render_widget_host_view_base.h" #include "content/browser/renderer_host/render_widget_host_view_frame_subscriber.h" @@ -56,12 +55,10 @@ public: FrameSubscriber(media::VideoCaptureOracle::Event event_type, scoped_refptr<media::ThreadSafeCaptureOracle> oracle, - base::WeakPtr<content::CursorRenderer> cursor_renderer, - base::WeakPtr<content::WindowActivityTracker> tracker) + base::WeakPtr<content::CursorRenderer> cursor_renderer) : event_type_(event_type), oracle_proxy_(std::move(oracle)), cursor_renderer_(cursor_renderer), - window_activity_tracker_(tracker), source_id_for_copy_request_(base::UnguessableToken::Create()), weak_ptr_factory_(this) {} @@ -74,8 +71,6 @@ const gfx::Rect& region_in_frame, bool success); - bool IsUserInteractingWithContent(); - // RenderWidgetHostViewFrameSubscriber implementation: bool ShouldCaptureFrame( const gfx::Rect& damage_rect, @@ -91,9 +86,6 @@ // We need a weak pointer since FrameSubscriber is owned externally and // may outlive the cursor renderer. const base::WeakPtr<CursorRenderer> cursor_renderer_; - // We need a weak pointer since FrameSubscriber is owned externally and - // may outlive the ui activity tracker. - const base::WeakPtr<WindowActivityTracker> window_activity_tracker_; base::UnguessableToken source_id_for_copy_request_; base::WeakPtrFactory<FrameSubscriber> weak_ptr_factory_; }; @@ -144,13 +136,10 @@ // Responsible for tracking the cursor state and input events to make // decisions and then render the mouse cursor on the video frame after - // capture is completed. + // capture is completed. Also reports whether the user is actively interacting + // with content. std::unique_ptr<content::CursorRenderer> cursor_renderer_; - // Responsible for tracking the UI events and making a decision on whether - // user is actively interacting with content. - std::unique_ptr<content::WindowActivityTracker> window_activity_tracker_; - DISALLOW_COPY_AND_ASSIGN(ContentCaptureSubscription); }; @@ -266,34 +255,24 @@ if (frame_subscriber_ && frame_subscriber_->cursor_renderer_) { CursorRenderer* cursor_renderer = frame_subscriber_->cursor_renderer_.get(); - if (cursor_renderer->SnapshotCursorState(region_in_frame)) - cursor_renderer->RenderOnVideoFrame(frame.get()); + cursor_renderer->RenderOnVideoFrame(frame.get(), region_in_frame); + // Signal downstream consumers of this frame that encoding/transmission + // should be optimized for image quality over smoothness if: a) The user + // appears to be interacting with the source; and b) A significant amount + // of time has passed since the oracle detected animation from the source. + const base::TimeTicks last_animated = + frame_subscriber_->oracle_proxy_->last_time_animation_was_detected(); + const bool animated_recently = + (base::TimeTicks::Now() - last_animated) <= + base::TimeDelta::FromMilliseconds(kMinPeriodNoAnimationMillis); frame->metadata()->SetBoolean( media::VideoFrameMetadata::INTERACTIVE_CONTENT, - frame_subscriber_->IsUserInteractingWithContent()); + cursor_renderer->IsUserInteractingWithView() && !animated_recently); } } capture_frame_cb.Run(std::move(frame), timestamp, success); } -bool FrameSubscriber::IsUserInteractingWithContent() { - bool ui_activity = window_activity_tracker_ && - window_activity_tracker_->IsUiInteractionActive(); - bool interactive_mode = false; - if (cursor_renderer_) { - bool animation_active = - (base::TimeTicks::Now() - - oracle_proxy_->last_time_animation_was_detected()) < - base::TimeDelta::FromMilliseconds(kMinPeriodNoAnimationMillis); - if (ui_activity && !animation_active) { - interactive_mode = true; - } else if (animation_active && window_activity_tracker_) { - window_activity_tracker_->Reset(); - } - } - return interactive_mode; -} - bool FrameSubscriber::ShouldCaptureFrame( const gfx::Rect& damage_rect, base::TimeTicks present_time, @@ -329,9 +308,9 @@ DCHECK(source_view_); #if defined(USE_AURA) || defined(OS_MACOSX) - cursor_renderer_ = CursorRenderer::Create(source_view_->GetNativeView()); - window_activity_tracker_ = - WindowActivityTracker::Create(source_view_->GetNativeView()); + cursor_renderer_ = CursorRenderer::Create( + CursorRenderer::CURSOR_DISPLAYED_ON_MOUSE_MOVEMENT); + cursor_renderer_->SetTargetView(source_view_->GetNativeView()); #endif // Subscriptions for refresh frames and mouse cursor updates. When events // outside of the normal content change/compositing workflow occur, these @@ -340,15 +319,11 @@ refresh_subscriber_.reset(new FrameSubscriber( media::VideoCaptureOracle::kActiveRefreshRequest, oracle_proxy, cursor_renderer_ ? cursor_renderer_->GetWeakPtr() - : base::WeakPtr<CursorRenderer>(), - window_activity_tracker_ ? window_activity_tracker_->GetWeakPtr() - : base::WeakPtr<WindowActivityTracker>())); + : base::WeakPtr<CursorRenderer>())); mouse_activity_subscriber_.reset(new FrameSubscriber( media::VideoCaptureOracle::kMouseCursorUpdate, oracle_proxy, cursor_renderer_ ? cursor_renderer_->GetWeakPtr() - : base::WeakPtr<CursorRenderer>(), - window_activity_tracker_ ? window_activity_tracker_->GetWeakPtr() - : base::WeakPtr<WindowActivityTracker>())); + : base::WeakPtr<CursorRenderer>())); // Main capture path: Subscribing to compositor updates. This means that any // time the tab content has changed and compositing has taken place, the @@ -357,20 +332,18 @@ // RenderWidgetHostView will initiate the frame capture and NOT the // |capture_callback_|. std::unique_ptr<RenderWidgetHostViewFrameSubscriber> subscriber( - new FrameSubscriber( - media::VideoCaptureOracle::kCompositorUpdate, oracle_proxy, - cursor_renderer_ ? cursor_renderer_->GetWeakPtr() - : base::WeakPtr<CursorRenderer>(), - window_activity_tracker_ ? window_activity_tracker_->GetWeakPtr() - : base::WeakPtr<WindowActivityTracker>())); + new FrameSubscriber(media::VideoCaptureOracle::kCompositorUpdate, + oracle_proxy, + cursor_renderer_ ? cursor_renderer_->GetWeakPtr() + : base::WeakPtr<CursorRenderer>())); source_view_->BeginFrameSubscription(std::move(subscriber)); - // Begin monitoring for user activity that is used to signal "interactive - // content." - if (window_activity_tracker_) { - window_activity_tracker_->RegisterMouseInteractionObserver( - base::Bind(&ContentCaptureSubscription::OnEvent, base::Unretained(this), - mouse_activity_subscriber_.get())); + // Begin monitoring for user activity that is used to signal the need for + // refresh frames with a re-rendered mouse cursor. + if (cursor_renderer_) { + cursor_renderer_->SetNeedsRedrawCallback(base::BindRepeating( + &ContentCaptureSubscription::OnEvent, base::Unretained(this), + mouse_activity_subscriber_.get())); } }
diff --git a/content/browser/media/capture/window_activity_tracker.cc b/content/browser/media/capture/window_activity_tracker.cc deleted file mode 100644 index 394792d..0000000 --- a/content/browser/media/capture/window_activity_tracker.cc +++ /dev/null
@@ -1,54 +0,0 @@ -// 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 "content/browser/media/capture/window_activity_tracker.h" - -#include "base/time/time.h" - -namespace content { - -namespace { - -// The time period within which a triggered UI event is considered -// currently active. -const int kTimePeriodUiEventMicros = 100000; // 100 ms - -// Minimum number of user interactions before we consider the user to be in -// interactive mode. The goal is to prevent user interactions to launch -// animated content from causing target playout time flip-flop. -const int kMinUserInteractions = 5; - -} // namespace - -WindowActivityTracker::WindowActivityTracker() { - Reset(); -} - -WindowActivityTracker::~WindowActivityTracker() {} - -bool WindowActivityTracker::IsUiInteractionActive() const { - return ui_events_count_ > kMinUserInteractions; -} - -void WindowActivityTracker::RegisterMouseInteractionObserver( - const base::Closure& observer) { - mouse_interaction_observer_ = observer; -} - -void WindowActivityTracker::Reset() { - ui_events_count_ = 0; - last_time_ui_event_detected_ = base::TimeTicks(); -} - -void WindowActivityTracker::OnMouseActivity() { - if (!mouse_interaction_observer_.is_null()) - mouse_interaction_observer_.Run(); - if (base::TimeTicks::Now() - last_time_ui_event_detected_ > - base::TimeDelta::FromMicroseconds(kTimePeriodUiEventMicros)) { - ui_events_count_++; - } - last_time_ui_event_detected_ = base::TimeTicks::Now(); -} - -} // namespace content
diff --git a/content/browser/media/capture/window_activity_tracker_aura.h b/content/browser/media/capture/window_activity_tracker_aura.h deleted file mode 100644 index be5f29c..0000000 --- a/content/browser/media/capture/window_activity_tracker_aura.h +++ /dev/null
@@ -1,45 +0,0 @@ -// Copyright (c) 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_BROWSER_MEDIA_CAPTURE_WINDOW_ACTIVITY_TRACKER_AURA_H_ -#define CONTENT_BROWSER_MEDIA_CAPTURE_WINDOW_ACTIVITY_TRACKER_AURA_H_ - -#include "base/macros.h" -#include "base/memory/ref_counted.h" -#include "base/memory/weak_ptr.h" -#include "content/browser/media/capture/window_activity_tracker.h" -#include "content/common/content_export.h" -#include "ui/aura/window.h" -#include "ui/events/event_handler.h" - -namespace content { - -// Tracks UI events and makes a decision on whether the user has been -// actively interacting with a specified window. -class CONTENT_EXPORT WindowActivityTrackerAura : public WindowActivityTracker, - public ui::EventHandler, - public aura::WindowObserver { - public: - explicit WindowActivityTrackerAura(aura::Window* window); - ~WindowActivityTrackerAura() final; - - base::WeakPtr<WindowActivityTracker> GetWeakPtr() final; - - private: - // ui::EventHandler overrides. - void OnEvent(ui::Event* event) final; - - // aura::WindowObserver overrides. - void OnWindowDestroying(aura::Window* window) final; - - aura::Window* window_; - - base::WeakPtrFactory<WindowActivityTrackerAura> weak_factory_; - - DISALLOW_COPY_AND_ASSIGN(WindowActivityTrackerAura); -}; - -} // namespace content - -#endif // CONTENT_BROWSER_MEDIA_CAPTURE_WINDOW_ACTIVITY_TRACKER_AURA_H_
diff --git a/content/browser/media/capture/window_activity_tracker_mac.h b/content/browser/media/capture/window_activity_tracker_mac.h deleted file mode 100644 index 9fa880a..0000000 --- a/content/browser/media/capture/window_activity_tracker_mac.h +++ /dev/null
@@ -1,61 +0,0 @@ -// 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 CONTENT_BROWSER_MEDIA_CAPTURE_WINDOW_ACTIVITY_TRACKER_MAC_H_ -#define CONTENT_BROWSER_MEDIA_CAPTURE_WINDOW_ACTIVITY_TRACKER_MAC_H_ - -#import <AppKit/AppKit.h> -#import <CoreFoundation/CoreFoundation.h> - -#include "base/callback.h" -#include "base/mac/scoped_nsobject.h" -#include "base/macros.h" -#include "base/memory/weak_ptr.h" -#include "content/browser/media/capture/window_activity_tracker.h" -#include "content/common/content_export.h" -#include "ui/base/cocoa/tracking_area.h" -#include "ui/gfx/native_widget_types.h" - -@interface MouseTracker : NSObject { - @private - ui::ScopedCrTrackingArea trackingArea_; - - // The view on which mouse movement is detected. - NSView* nsView_; - - // Runs on any mouse interaction from user. - base::Closure mouseInteractionObserver_; -} - -- (instancetype)initWithView:(NSView*)nsView; - -// Register an observer for mouse interaction. -- (void)registerMouseInteractionObserver:(const base::Closure&)observer; - -@end - -namespace content { - -// Tracks UI events and makes a decision on whether the user has been -// actively interacting with a specified window. -class CONTENT_EXPORT WindowActivityTrackerMac : public WindowActivityTracker { - public: - explicit WindowActivityTrackerMac(NSView* view); - ~WindowActivityTrackerMac() final; - - base::WeakPtr<WindowActivityTracker> GetWeakPtr() final; - - private: - void OnMouseActivity(); - - base::scoped_nsobject<MouseTracker> mouse_tracker_; - - base::WeakPtrFactory<WindowActivityTrackerMac> weak_factory_; - - DISALLOW_COPY_AND_ASSIGN(WindowActivityTrackerMac); -}; - -} // namespace content - -#endif // CONTENT_BROWSER_MEDIA_CAPTURE_WINDOW_ACTIVITY_TRACKER_MAC_H_
diff --git a/content/browser/quota_dispatcher_host.cc b/content/browser/quota_dispatcher_host.cc index ab3061f..a936cdbe 100644 --- a/content/browser/quota_dispatcher_host.cc +++ b/content/browser/quota_dispatcher_host.cc
@@ -14,11 +14,11 @@ #include "mojo/public/cpp/bindings/strong_binding.h" #include "net/base/url_util.h" #include "storage/browser/quota/quota_manager.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" #include "url/origin.h" using storage::QuotaClient; using storage::QuotaManager; -using storage::QuotaStatusCode; using storage::StorageType; namespace content { @@ -67,7 +67,7 @@ if (storage_type != storage::kStorageTypeTemporary && storage_type != storage::kStorageTypePersistent) { // Unsupported storage types. - std::move(callback).Run(storage::kQuotaErrorNotSupported, 0, 0); + std::move(callback).Run(blink::QuotaStatusCode::kErrorNotSupported, 0, 0); return; } @@ -91,7 +91,7 @@ void QuotaDispatcherHost::DidQueryStorageUsageAndQuota( RequestStorageQuotaCallback callback, - QuotaStatusCode status, + blink::QuotaStatusCode status, int64_t usage, int64_t quota) { std::move(callback).Run(status, usage, quota); @@ -103,10 +103,10 @@ storage::StorageType storage_type, uint64_t requested_quota, RequestStorageQuotaCallback callback, - QuotaStatusCode status, + blink::QuotaStatusCode status, int64_t current_usage, int64_t current_quota) { - if (status != storage::kQuotaStatusOk) { + if (status != blink::QuotaStatusCode::kOk) { std::move(callback).Run(status, 0, 0); return; } @@ -119,7 +119,7 @@ base::saturated_cast<int64_t>(requested_quota); if (quota_manager_->IsStorageUnlimited(origin.GetURL(), storage_type) || requested_quota_signed <= current_quota) { - std::move(callback).Run(storage::kQuotaStatusOk, current_usage, + std::move(callback).Run(blink::QuotaStatusCode::kOk, current_usage, requested_quota); return; } @@ -150,7 +150,7 @@ QuotaPermissionContext::QuotaPermissionResponse response) { // If user didn't allow the new quota, just return the current quota. if (response != QuotaPermissionContext::QUOTA_PERMISSION_RESPONSE_ALLOW) { - std::move(callback).Run(storage::kQuotaStatusOk, current_usage, + std::move(callback).Run(blink::QuotaStatusCode::kOk, current_usage, current_quota); return; } @@ -168,7 +168,7 @@ void QuotaDispatcherHost::DidSetHostQuota(int64_t current_usage, RequestStorageQuotaCallback callback, - QuotaStatusCode status, + blink::QuotaStatusCode status, int64_t new_quota) { std::move(callback).Run(status, current_usage, new_quota); } @@ -176,7 +176,7 @@ void QuotaDispatcherHost::DidGetTemporaryUsageAndQuota( int64_t requested_quota, RequestStorageQuotaCallback callback, - QuotaStatusCode status, + blink::QuotaStatusCode status, int64_t usage, int64_t quota) { std::move(callback).Run(status, usage, std::min(requested_quota, quota));
diff --git a/content/browser/quota_dispatcher_host.h b/content/browser/quota_dispatcher_host.h index 01e6999..215325c 100644 --- a/content/browser/quota_dispatcher_host.h +++ b/content/browser/quota_dispatcher_host.h
@@ -8,7 +8,7 @@ #include "base/macros.h" #include "content/common/quota_dispatcher_host.mojom.h" #include "content/public/browser/quota_permission_context.h" -#include "storage/common/quota/quota_status_code.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" namespace storage { class QuotaManager; @@ -47,7 +47,7 @@ private: void DidQueryStorageUsageAndQuota(RequestStorageQuotaCallback callback, - storage::QuotaStatusCode status, + blink::QuotaStatusCode status, int64_t usage, int64_t quota); void DidGetPersistentUsageAndQuota(int64_t render_frame_id, @@ -55,7 +55,7 @@ storage::StorageType storage_type, uint64_t requested_quota, RequestStorageQuotaCallback callback, - storage::QuotaStatusCode status, + blink::QuotaStatusCode status, int64_t usage, int64_t quota); void DidGetPermissionResponse( @@ -67,11 +67,11 @@ QuotaPermissionContext::QuotaPermissionResponse response); void DidSetHostQuota(int64_t current_usage, RequestStorageQuotaCallback callback, - storage::QuotaStatusCode status, + blink::QuotaStatusCode status, int64_t new_quota); void DidGetTemporaryUsageAndQuota(int64_t requested_quota, RequestStorageQuotaCallback callback, - storage::QuotaStatusCode status, + blink::QuotaStatusCode status, int64_t usage, int64_t quota);
diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc index e0386ec..1409411 100644 --- a/content/browser/renderer_host/compositor_impl_android.cc +++ b/content/browser/renderer_host/compositor_impl_android.cc
@@ -832,10 +832,11 @@ vulkan_context_provider ? std::make_unique<viz::DirectLayerTreeFrameSink>( frame_sink_id_, GetHostFrameSinkManager(), manager, - display_.get(), vulkan_context_provider) + display_.get(), nullptr /* display_client */, + vulkan_context_provider) : std::make_unique<viz::DirectLayerTreeFrameSink>( frame_sink_id_, GetHostFrameSinkManager(), manager, - display_.get(), context_provider, + display_.get(), nullptr /* display_client */, context_provider, nullptr /* worker_context_provider */, task_runner, gpu_memory_buffer_manager, viz::ServerSharedBitmapManager::current());
diff --git a/content/browser/renderer_host/input/render_widget_host_latency_tracker.cc b/content/browser/renderer_host/input/render_widget_host_latency_tracker.cc index c007c99..1a70d69f 100644 --- a/content/browser/renderer_host/input/render_widget_host_latency_tracker.cc +++ b/content/browser/renderer_host/input/render_widget_host_latency_tracker.cc
@@ -33,21 +33,6 @@ return ukm_recorder ? ukm_recorder->GetNewSourceID() : ukm::kInvalidSourceId; } -std::string WebInputEventTypeToInputModalityString(WebInputEvent::Type type) { - if (type == blink::WebInputEvent::kMouseWheel) { - return "Wheel"; - } else if (WebInputEvent::IsKeyboardEventType(type)) { - // We should only be reporting latency for key presses. - DCHECK(type == WebInputEvent::kRawKeyDown || type == WebInputEvent::kChar); - return "KeyPress"; - } else if (WebInputEvent::IsMouseEventType(type)) { - return "Mouse"; - } else if (WebInputEvent::IsTouchEventType(type)) { - return "Touch"; - } - return ""; -} - // LatencyComponents generated in the renderer must have component IDs // provided to them by the browser process. This function adds the correct // component ID where necessary. @@ -190,35 +175,6 @@ bool multi_finger_touch_gesture = WebInputEvent::IsTouchEventType(type) && active_multi_finger_gesture_; - LatencyInfo::LatencyComponent ui_component; - if (latency.FindLatency(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, - &ui_component)) { - DCHECK_EQ(ui_component.event_count, 1u); - CONFIRM_EVENT_TIMES_EXIST(ui_component, rwh_component); - base::TimeDelta ui_delta = - rwh_component.last_event_time - ui_component.first_event_time; - - if (latency.source_event_type() == ui::SourceEventType::WHEEL) { - UMA_HISTOGRAM_CUSTOM_COUNTS( - "Event.Latency.Browser.WheelUI", - std::max(static_cast<int64_t>(0), ui_delta.InMicroseconds()), 1, - 20000, 100); - } else if (latency.source_event_type() == ui::SourceEventType::TOUCH) { - UMA_HISTOGRAM_CUSTOM_COUNTS( - "Event.Latency.Browser.TouchUI", - std::max(static_cast<int64_t>(0), ui_delta.InMicroseconds()), 1, - 20000, 100); - } else if (latency.source_event_type() == ui::SourceEventType::KEY_PRESS) { - UMA_HISTOGRAM_CUSTOM_COUNTS( - "Event.Latency.Browser.KeyPressUI", - std::max(static_cast<int64_t>(0), ui_delta.InMicroseconds()), 1, - 20000, 50); - } else { - // We should only report these histograms for wheel, touch and keyboard. - NOTREACHED(); - } - } - bool action_prevented = ack_result == INPUT_EVENT_ACK_STATE_CONSUMED; // Touchscreen tap and scroll gestures depend on the disposition of the touch // start and the current touch. For touch start, @@ -260,13 +216,6 @@ "Event.Latency.BlockingTime." + event_name + default_action_status, main_component, acked_component); } - - std::string input_modality = WebInputEventTypeToInputModalityString(type); - if (input_modality != "") { - UMA_HISTOGRAM_INPUT_LATENCY_HIGH_RESOLUTION_MICROSECONDS( - "Event.Latency.Browser." + input_modality + "Acked", rwh_component, - acked_component); - } } }
diff --git a/content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc b/content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc index 5bf751e4..2d7d1d2 100644 --- a/content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc +++ b/content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc
@@ -312,9 +312,6 @@ test_browser_client_.getTestRapporService()->GetReportsCount()); // UMA histograms. - EXPECT_TRUE(HistogramSizeEq("Event.Latency.Browser.WheelUI", 1)); - EXPECT_TRUE(HistogramSizeEq("Event.Latency.Browser.WheelAcked", 1)); - EXPECT_TRUE( HistogramSizeEq("Event.Latency.ScrollBegin.Wheel." "TimeToScrollUpdateSwapBegin2", @@ -428,9 +425,6 @@ test_browser_client_.getTestRapporService()->GetReportsCount()); // UMA histograms. - EXPECT_TRUE(HistogramSizeEq("Event.Latency.Browser.WheelUI", 1)); - EXPECT_TRUE(HistogramSizeEq("Event.Latency.Browser.WheelAcked", 1)); - EXPECT_TRUE( HistogramSizeEq("Event.Latency.ScrollBegin.Wheel." "TimeToScrollUpdateSwapBegin2", @@ -567,8 +561,6 @@ test_browser_client_.getTestRapporService()->GetReportsCount()); // UMA histograms. - EXPECT_TRUE(HistogramSizeEq("Event.Latency.Browser.TouchUI", 1)); - EXPECT_TRUE(HistogramSizeEq("Event.Latency.Browser.TouchAcked", 1)); EXPECT_TRUE(HistogramSizeEq( "Event.Latency.ScrollBegin.Touch.TimeToScrollUpdateSwapBegin2", 1)); @@ -807,10 +799,6 @@ EXPECT_TRUE(key_latency.terminated()); } - EXPECT_TRUE(HistogramSizeEq("Event.Latency.Browser.WheelUI", 1)); - EXPECT_TRUE(HistogramSizeEq("Event.Latency.Browser.TouchUI", 1)); - EXPECT_TRUE(HistogramSizeEq("Event.Latency.Browser.WheelAcked", 1)); - EXPECT_TRUE(HistogramSizeEq("Event.Latency.Browser.TouchAcked", 1)); EXPECT_TRUE( HistogramSizeEq("Event.Latency.ScrollUpdate.TouchToHandled_Main", 0)); EXPECT_TRUE( @@ -1138,81 +1126,6 @@ ElementsAre(Bucket(event_timestamps_ms[2] - event_timestamps_ms[1], 1))); } -TEST_F(RenderWidgetHostLatencyTrackerTest, KeyUILatency) { - // These numbers are sensitive to where the histogram buckets are. - int event_timestamps_microseconds[] = {100, 185}; - - NativeWebKeyboardEvent event(blink::WebKeyboardEvent::kChar, - blink::WebInputEvent::kNoModifiers, - base::TimeTicks::Now()); - ui::LatencyInfo latency_info; - latency_info.set_trace_id(kTraceEventId); - latency_info.set_source_event_type(ui::SourceEventType::KEY_PRESS); - latency_info.AddLatencyNumberWithTimestamp( - ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0, - base::TimeTicks() + - base::TimeDelta::FromMicroseconds(event_timestamps_microseconds[0]), - 1); - - // Add the BEGIN_RWH component explicitly here with a timestamp, instead of - // calling tracker()->OnInputEvent(). - latency_info.AddLatencyNumberWithTimestamp( - ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, - tracker()->latency_component_id(), 0, - base::TimeTicks() + - base::TimeDelta::FromMicroseconds(event_timestamps_microseconds[1]), - 1); - - tracker()->OnInputEventAck(event, &latency_info, - InputEventAckState::INPUT_EVENT_ACK_STATE_UNKNOWN); - EXPECT_THAT( - histogram_tester().GetAllSamples("Event.Latency.Browser.KeyPressUI"), - ElementsAre(Bucket( - event_timestamps_microseconds[1] - event_timestamps_microseconds[0], - 1))); -} - -TEST_F(RenderWidgetHostLatencyTrackerTest, KeyAckedLatency) { - // These numbers are sensitive to where the histogram buckets are. - int event_timestamps_microseconds[] = {11, 24}; - - NativeWebKeyboardEvent event(blink::WebKeyboardEvent::kRawKeyDown, - blink::WebInputEvent::kNoModifiers, - base::TimeTicks::Now()); - ui::LatencyInfo latency_info; - latency_info.set_trace_id(kTraceEventId); - latency_info.set_source_event_type(ui::SourceEventType::KEY_PRESS); - - // Add the BEGIN_RWH component explicitly here with a timestamp, instead of - // calling tracker()->OnInputEvent(). - latency_info.AddLatencyNumberWithTimestamp( - ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, - tracker()->latency_component_id(), 0, - base::TimeTicks() + - base::TimeDelta::FromMicroseconds(event_timestamps_microseconds[0]), - 1); - - // Add the ACK_RWH component explicitly here with a timestamp, instead of - // calling tracker()->OnInputEventAck(). - latency_info.AddLatencyNumberWithTimestamp( - ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, 0, - base::TimeTicks() + - base::TimeDelta::FromMicroseconds(event_timestamps_microseconds[1]), - 1); - - // Call ComputeInputLatencyHistograms directly to avoid OnInputEventAck - // overwriting components. - tracker()->ComputeInputLatencyHistograms( - event.GetType(), tracker()->latency_component_id(), latency_info, - InputEventAckState::INPUT_EVENT_ACK_STATE_UNKNOWN); - - EXPECT_THAT( - histogram_tester().GetAllSamples("Event.Latency.Browser.KeyPressAcked"), - ElementsAre(Bucket( - event_timestamps_microseconds[1] - event_timestamps_microseconds[0], - 1))); -} - TEST_F(RenderWidgetHostLatencyTrackerTest, KeyEndToEndLatency) { // These numbers are sensitive to where the histogram buckets are. int event_timestamps_microseconds[] = {11, 24};
diff --git a/content/browser/renderer_host/media/audio_input_device_manager.cc b/content/browser/renderer_host/media/audio_input_device_manager.cc index 1259826..0dd00880 100644 --- a/content/browser/renderer_host/media/audio_input_device_manager.cc +++ b/content/browser/renderer_host/media/audio_input_device_manager.cc
@@ -91,7 +91,6 @@ device.id, base::BindOnce(&AudioInputDeviceManager::OpenedOnIOThread, base::Unretained(this), session_id, device, base::TimeTicks::Now(), - base::Optional<media::AudioParameters>(), base::Optional<media::AudioParameters>())); } else { // TODO(tommi): As is, we hit this code path when device.type is @@ -190,14 +189,10 @@ const MediaStreamDevice& device, base::TimeTicks start_time, const base::Optional<media::AudioParameters>& input_params, - const base::Optional<media::AudioParameters>& matched_output_params, const std::string& matched_output_device_id) { DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK(GetDevice(session_id) == devices_.end()); DCHECK(!input_params || input_params->IsValid()); - DCHECK(!matched_output_params || matched_output_params->IsValid()); - DCHECK(!matched_output_device_id.empty() || - (matched_output_device_id.empty() && !matched_output_params)); UMA_HISTOGRAM_TIMES("Media.AudioInputDeviceManager.OpenOnDeviceThreadTime", base::TimeTicks::Now() - start_time); @@ -207,11 +202,8 @@ media_stream_device.input = input_params.value_or(media::AudioParameters::UnavailableDeviceParams()); media_stream_device.matched_output_device_id = matched_output_device_id; - media_stream_device.matched_output = matched_output_params.value_or( - media::AudioParameters::UnavailableDeviceParams()); DCHECK(media_stream_device.input.IsValid()); - DCHECK(media_stream_device.matched_output.IsValid()); devices_.push_back(media_stream_device);
diff --git a/content/browser/renderer_host/media/audio_input_device_manager.h b/content/browser/renderer_host/media/audio_input_device_manager.h index d8db44f8..503a261 100644 --- a/content/browser/renderer_host/media/audio_input_device_manager.h +++ b/content/browser/renderer_host/media/audio_input_device_manager.h
@@ -100,7 +100,6 @@ const MediaStreamDevice& device, base::TimeTicks start_time, const base::Optional<media::AudioParameters>& input_params, - const base::Optional<media::AudioParameters>& matched_output_params, const std::string& matched_output_device_id); // Callback called on IO thread with the session_id referencing the closed
diff --git a/content/browser/renderer_host/media/audio_input_device_manager_unittest.cc b/content/browser/renderer_host/media/audio_input_device_manager_unittest.cc index 6d9c461..e056ef8 100644 --- a/content/browser/renderer_host/media/audio_input_device_manager_unittest.cc +++ b/content/browser/renderer_host/media/audio_input_device_manager_unittest.cc
@@ -338,7 +338,6 @@ // Expects that device parameters stored by the manager are valid. const MediaStreamDevice* device = manager_->GetOpenedDeviceById(session_id); EXPECT_TRUE(device->input.IsValid()); - EXPECT_TRUE(device->matched_output.IsValid()); manager_->Close(session_id); EXPECT_CALL(*audio_input_listener_, Closed(device_request.type, session_id))
diff --git a/content/browser/renderer_host/media/audio_output_authorization_handler.cc b/content/browser/renderer_host/media/audio_output_authorization_handler.cc index f8ed5a8..d13a2c1 100644 --- a/content/browser/renderer_host/media/audio_output_authorization_handler.cc +++ b/content/browser/renderer_host/media/audio_output_authorization_handler.cc
@@ -97,13 +97,6 @@ media_stream_manager_->audio_input_device_manager() ->GetOpenedDeviceById(session_id); if (device && !device->matched_output_device_id.empty()) { - media::AudioParameters params( - media::AudioParameters::AUDIO_PCM_LOW_LATENCY, - device->matched_output.channel_layout(), - device->matched_output.sample_rate(), 16, - device->matched_output.frames_per_buffer()); - params.set_effects(device->matched_output.effects()); - // We don't need the origin for authorization in this case, but it's used // for hashing the device id before sending it back to the renderer. BrowserThread::PostTaskAndReplyWithResult( @@ -112,7 +105,7 @@ render_frame_id), base::BindOnce(&AudioOutputAuthorizationHandler::HashDeviceId, weak_factory_.GetWeakPtr(), std::move(cb), - device->matched_output_device_id, params)); + device->matched_output_device_id)); return; } // Otherwise, the default device is used. @@ -154,12 +147,16 @@ void AudioOutputAuthorizationHandler::HashDeviceId( AuthorizationCompletedCallback cb, const std::string& raw_device_id, - const media::AudioParameters& params, const std::pair<std::string, url::Origin>& salt_and_origin) const { + DCHECK_CURRENTLY_ON(BrowserThread::IO); + DCHECK(!raw_device_id.empty()); std::string hashed_device_id = GetHMACForMediaDeviceID( salt_and_origin.first, salt_and_origin.second, raw_device_id); - DeviceParametersReceived(std::move(cb), hashed_device_id, raw_device_id, - params); + audio_system_->GetOutputStreamParameters( + raw_device_id, + base::BindOnce(&AudioOutputAuthorizationHandler::DeviceParametersReceived, + weak_factory_.GetWeakPtr(), std::move(cb), + hashed_device_id, raw_device_id)); } void AudioOutputAuthorizationHandler::AccessChecked(
diff --git a/content/browser/renderer_host/media/audio_output_authorization_handler.h b/content/browser/renderer_host/media/audio_output_authorization_handler.h index a5dcf258..3126308 100644 --- a/content/browser/renderer_host/media/audio_output_authorization_handler.h +++ b/content/browser/renderer_host/media/audio_output_authorization_handler.h
@@ -69,7 +69,6 @@ void HashDeviceId( AuthorizationCompletedCallback cb, const std::string& raw_device_id, - const media::AudioParameters& params, const std::pair<std::string, url::Origin>& salt_and_origin) const; void AccessChecked(AuthorizationCompletedCallback cb,
diff --git a/content/browser/renderer_host/media/media_stream_manager.cc b/content/browser/renderer_host/media/media_stream_manager.cc index d086c41..caa17e6e 100644 --- a/content/browser/renderer_host/media/media_stream_manager.cc +++ b/content/browser/renderer_host/media/media_stream_manager.cc
@@ -1377,8 +1377,6 @@ FilterAudioEffects(request->controls, &effects); EnableHotwordEffect(request->controls, &effects); device.input.set_effects(effects); - - device.matched_output = opened_device->matched_output; } } if (RequestDone(*request))
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index e52cad4c..0962f46 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -132,6 +132,7 @@ #include "content/browser/service_worker/service_worker_context_wrapper.h" #include "content/browser/service_worker/service_worker_dispatcher_host.h" #include "content/browser/site_instance_impl.h" +#include "content/browser/site_isolation_policy.h" #include "content/browser/speech/speech_recognition_dispatcher_host.h" #include "content/browser/storage_partition_impl.h" #include "content/browser/streams/stream_context.h" @@ -146,7 +147,6 @@ #include "content/common/resource_messages.h" #include "content/common/service_manager/child_connection.h" #include "content/common/service_manager/service_manager_connection_impl.h" -#include "content/common/site_isolation_policy.h" #include "content/common/view_messages.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h"
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc index bf19ad4..4908f01 100644 --- a/content/browser/renderer_host/render_view_host_impl.cc +++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -50,7 +50,6 @@ #include "content/common/inter_process_time_ticks_converter.h" #include "content/common/render_message_filter.mojom.h" #include "content/common/renderer.mojom.h" -#include "content/common/site_isolation_policy.h" #include "content/common/speech_recognition_messages.h" #include "content/common/swapped_out_messages.h" #include "content/common/view_messages.h" @@ -423,6 +422,9 @@ prefs.save_previous_document_resources = GetSavePreviousDocumentResources(); + prefs.accelerated_video_decode_enabled = + !command_line.HasSwitch(switches::kDisableAcceleratedVideoDecode); + std::string autoplay_policy = media::GetEffectiveAutoplayPolicy(command_line); if (autoplay_policy == switches::autoplay::kNoUserGestureRequiredPolicy) { prefs.autoplay_policy = AutoplayPolicy::kNoUserGestureRequired; @@ -484,9 +486,6 @@ (!command_line.HasSwitch(switches::kDisableSmoothScrolling) && gfx::Animation::ScrollAnimationsEnabledBySystem()); - // Certain GPU features might have been blacklisted. - GpuDataManagerImpl::GetInstance()->UpdateRendererWebPrefs(&prefs); - if (ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings( GetProcess()->GetID())) { prefs.loads_images_automatically = true;
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc index 26eae43d..ff72e2b 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -2667,6 +2667,11 @@ if (local_surface_id == last_local_surface_id_ && new_surface_properties != last_surface_properties_) { + static auto* crash_key = base::debug::AllocateCrashKeyString( + "surface-invariants-violation", base::debug::CrashKeySize::Size256); + base::debug::ScopedCrashKeyString key_value( + crash_key, + new_surface_properties.ToDiffString(last_surface_properties_)); bad_message::ReceivedBadMessage( GetProcess(), bad_message::RWH_SURFACE_INVARIANTS_VIOLATION); return;
diff --git a/content/browser/renderer_host/render_widget_host_unittest.cc b/content/browser/renderer_host/render_widget_host_unittest.cc index 0f867aa..5f0a127 100644 --- a/content/browser/renderer_host/render_widget_host_unittest.cc +++ b/content/browser/renderer_host/render_widget_host_unittest.cc
@@ -2937,4 +2937,24 @@ EXPECT_EQ(0u, host_->in_flight_event_count()); } +TEST_F(RenderWidgetHostTest, RenderWidgetSurfaceProperties) { + RenderWidgetSurfaceProperties prop1; + prop1.size = gfx::Size(200, 200); + prop1.device_scale_factor = 1.f; + RenderWidgetSurfaceProperties prop2; + prop2.size = gfx::Size(300, 300); + prop2.device_scale_factor = 2.f; + + EXPECT_EQ( + "RenderWidgetSurfaceProperties(size(this: 200x200, other: 300x300), " + "device_scale_factor(this: 1, other: 2))", + prop1.ToDiffString(prop2)); + EXPECT_EQ( + "RenderWidgetSurfaceProperties(size(this: 300x300, other: 200x200), " + "device_scale_factor(this: 2, other: 1))", + prop2.ToDiffString(prop1)); + EXPECT_EQ("", prop1.ToDiffString(prop1)); + EXPECT_EQ("", prop2.ToDiffString(prop2)); +} + } // namespace content
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc index 7cff0b83..8da9bd7 100644 --- a/content/browser/renderer_host/render_widget_host_view_android.cc +++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -67,7 +67,6 @@ #include "content/common/content_switches_internal.h" #include "content/common/gpu_stream_constants.h" #include "content/common/input_messages.h" -#include "content/common/site_isolation_policy.h" #include "content/common/view_messages.h" #include "content/public/browser/android/compositor.h" #include "content/public/browser/android/synchronous_compositor_client.h"
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index ea8706ff..093c2961 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -52,7 +52,6 @@ #include "content/common/content_switches_internal.h" #include "content/common/input_messages.h" #include "content/common/render_widget_window_tree_client_factory.mojom.h" -#include "content/common/site_isolation_policy.h" #include "content/common/text_input_state.h" #include "content/common/view_messages.h" #include "content/public/browser/content_browser_client.h"
diff --git a/content/browser/renderer_host/render_widget_host_view_event_handler.cc b/content/browser/renderer_host/render_widget_host_view_event_handler.cc index cded212b3..a6a091c 100644 --- a/content/browser/renderer_host/render_widget_host_view_event_handler.cc +++ b/content/browser/renderer_host/render_widget_host_view_event_handler.cc
@@ -15,7 +15,6 @@ #include "content/browser/renderer_host/render_widget_host_view_base.h" #include "content/browser/renderer_host/text_input_manager.h" #include "content/common/content_switches_internal.h" -#include "content/common/site_isolation_policy.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/render_widget_host.h" #include "content/public/common/content_features.h"
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm index 56a534d..b7e7a00 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -56,7 +56,6 @@ #include "content/common/accessibility_messages.h" #include "content/common/edit_command.h" #include "content/common/input_messages.h" -#include "content/common/site_isolation_policy.h" #include "content/common/text_input_state.h" #include "content/common/view_messages.h" #include "content/public/browser/browser_context.h"
diff --git a/content/browser/renderer_host/web_database_host_impl.cc b/content/browser/renderer_host/web_database_host_impl.cc index 2ab649e4..0731b83 100644 --- a/content/browser/renderer_host/web_database_host_impl.cc +++ b/content/browser/renderer_host/web_database_host_impl.cc
@@ -18,13 +18,12 @@ #include "storage/browser/quota/quota_manager.h" #include "storage/browser/quota/quota_manager_proxy.h" #include "storage/common/database/database_identifier.h" -#include "storage/common/quota/quota_status_code.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" #include "third_party/sqlite/sqlite3.h" using storage::DatabaseUtil; using storage::VfsBackend; using storage::QuotaManager; -using storage::QuotaStatusCode; namespace content { namespace { @@ -188,10 +187,10 @@ db_tracker_->task_runner(), origin.GetURL(), storage::kStorageTypeTemporary, base::Bind( - [](GetSpaceAvailableCallback callback, - storage::QuotaStatusCode status, int64_t usage, int64_t quota) { + [](GetSpaceAvailableCallback callback, blink::QuotaStatusCode status, + int64_t usage, int64_t quota) { int64_t available = 0; - if ((status == storage::kQuotaStatusOk) && (usage < quota)) { + if ((status == blink::QuotaStatusCode::kOk) && (usage < quota)) { available = quota - usage; } std::move(callback).Run(available);
diff --git a/content/browser/sandbox_parameters_mac.h b/content/browser/sandbox_parameters_mac.h index 1c8a492..e87b08e 100644 --- a/content/browser/sandbox_parameters_mac.h +++ b/content/browser/sandbox_parameters_mac.h
@@ -5,17 +5,24 @@ #ifndef CONTENT_BROWSER_SANDBOX_PARAMETERS_MAC_H_ #define CONTENT_BROWSER_SANDBOX_PARAMETERS_MAC_H_ +namespace base { +class CommandLine; +} + namespace sandbox { class SeatbeltExecClient; } namespace content { -// Populates the |client| with the parameters that the sandbox needs to -// resolve information that cannot be known at build time, such as -// the user's home directory. +// All of the below functions populate the |client| with the parameters that the +// sandbox needs to resolve information that cannot be known at build time, such +// as the user's home directory. void SetupRendererSandboxParameters(sandbox::SeatbeltExecClient* client); +void SetupUtilitySandboxParameters(sandbox::SeatbeltExecClient* client, + const base::CommandLine& command_line); + } // namespace content #endif // CONTENT_BROWSER_SANDBOX_PARAMETERS_MAC_H_
diff --git a/content/browser/sandbox_parameters_mac.mm b/content/browser/sandbox_parameters_mac.mm index 007aee3..736940c 100644 --- a/content/browser/sandbox_parameters_mac.mm +++ b/content/browser/sandbox_parameters_mac.mm
@@ -39,9 +39,7 @@ return std::to_string(final_os_version); } -} // namespace - -void SetupRendererSandboxParameters(sandbox::SeatbeltExecClient* client) { +void SetupCommonSandboxParameters(sandbox::SeatbeltExecClient* client) { const base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); bool enable_logging = @@ -53,14 +51,6 @@ service_manager::SandboxMac::kSandboxDisableDenialLogging, !enable_logging)); - std::string homedir = - service_manager::SandboxMac::GetCanonicalPath(base::GetHomeDir()).value(); - CHECK(client->SetParameter( - service_manager::SandboxMac::kSandboxHomedirAsLiteral, homedir)); - - CHECK(client->SetParameter(service_manager::SandboxMac::kSandboxOSVersion, - GetOSVersion())); - std::string bundle_path = service_manager::SandboxMac::GetCanonicalPath(base::mac::MainBundlePath()) .value(); @@ -89,6 +79,36 @@ CHECK(client->SetParameter(service_manager::SandboxMac::kSandboxComponentPath, component_path_canonical)); #endif + + CHECK(client->SetParameter(service_manager::SandboxMac::kSandboxOSVersion, + GetOSVersion())); + + std::string homedir = + service_manager::SandboxMac::GetCanonicalPath(base::GetHomeDir()).value(); + CHECK(client->SetParameter( + service_manager::SandboxMac::kSandboxHomedirAsLiteral, homedir)); +} + +} // namespace + +void SetupRendererSandboxParameters(sandbox::SeatbeltExecClient* client) { + SetupCommonSandboxParameters(client); +} + +void SetupUtilitySandboxParameters(sandbox::SeatbeltExecClient* client, + const base::CommandLine& command_line) { + SetupCommonSandboxParameters(client); + + base::FilePath permitted_dir = + command_line.GetSwitchValuePath(switches::kUtilityProcessAllowedDir); + + if (!permitted_dir.empty()) { + std::string permitted_dir_canonical = + service_manager::SandboxMac::GetCanonicalPath(permitted_dir).value(); + CHECK( + client->SetParameter(service_manager::SandboxMac::kSandboxPermittedDir, + permitted_dir_canonical)); + } } } // namespace content
diff --git a/content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc b/content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc index f7ed95b..84eccb8 100644 --- a/content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc +++ b/content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc
@@ -38,13 +38,10 @@ #include "third_party/WebKit/common/service_worker/service_worker_registration.mojom.h" namespace content { - -namespace { +namespace service_worker_controllee_request_handler_unittest { int kMockProviderId = 1; -} - class ServiceWorkerControlleeRequestHandlerTest : public testing::Test { public: class ServiceWorkerRequestTestResources { @@ -436,4 +433,5 @@ } #endif // BUILDFLAG(ENABLE_OFFLINE_PAGE +} // namespace service_worker_controllee_request_handler_unittest } // namespace content
diff --git a/content/browser/service_worker/service_worker_dispatcher_host.h b/content/browser/service_worker/service_worker_dispatcher_host.h index f0630943..6de6aa8 100644 --- a/content/browser/service_worker/service_worker_dispatcher_host.h +++ b/content/browser/service_worker/service_worker_dispatcher_host.h
@@ -40,6 +40,16 @@ class ServiceWorkerProviderHost; class ServiceWorkerVersion; +namespace service_worker_dispatcher_host_unittest { +class ServiceWorkerDispatcherHostTest; +class TestingServiceWorkerDispatcherHost; +FORWARD_DECLARE_TEST(ServiceWorkerDispatcherHostTest, + ProviderCreatedAndDestroyed); +FORWARD_DECLARE_TEST(ServiceWorkerDispatcherHostTest, CleanupOnRendererCrash); +FORWARD_DECLARE_TEST(BackgroundSyncManagerTest, + RegisterWithoutLiveSWRegistration); +} // namespace service_worker_dispatcher_host_unittest + // ServiceWorkerDispatcherHost is the browser-side endpoint for several IPC // messages for service workers. There is a 1:1 correspondence between // renderer processes and ServiceWorkerDispatcherHosts. Currently @@ -104,14 +114,19 @@ private: friend class BrowserThread; friend class base::DeleteHelper<ServiceWorkerDispatcherHost>; - friend class ServiceWorkerDispatcherHostTest; - friend class TestingServiceWorkerDispatcherHost; - FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDispatcherHostTest, - ProviderCreatedAndDestroyed); - FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDispatcherHostTest, - CleanupOnRendererCrash); - FRIEND_TEST_ALL_PREFIXES(BackgroundSyncManagerTest, - RegisterWithoutLiveSWRegistration); + friend class service_worker_dispatcher_host_unittest:: + ServiceWorkerDispatcherHostTest; + friend class service_worker_dispatcher_host_unittest:: + TestingServiceWorkerDispatcherHost; + FRIEND_TEST_ALL_PREFIXES( + service_worker_dispatcher_host_unittest::ServiceWorkerDispatcherHostTest, + ProviderCreatedAndDestroyed); + FRIEND_TEST_ALL_PREFIXES( + service_worker_dispatcher_host_unittest::ServiceWorkerDispatcherHostTest, + CleanupOnRendererCrash); + FRIEND_TEST_ALL_PREFIXES( + service_worker_dispatcher_host_unittest::BackgroundSyncManagerTest, + RegisterWithoutLiveSWRegistration); using StatusCallback = base::Callback<void(ServiceWorkerStatusCode status)>; enum class ProviderStatus { OK, NO_CONTEXT, DEAD_HOST, NO_HOST, NO_URL };
diff --git a/content/browser/service_worker/service_worker_dispatcher_host_unittest.cc b/content/browser/service_worker/service_worker_dispatcher_host_unittest.cc index 2143ef1..7d9911b 100644 --- a/content/browser/service_worker/service_worker_dispatcher_host_unittest.cc +++ b/content/browser/service_worker/service_worker_dispatcher_host_unittest.cc
@@ -39,8 +39,7 @@ using blink::MessagePortChannel; namespace content { - -namespace { +namespace service_worker_dispatcher_host_unittest { static void SaveStatusCallback(bool* called, ServiceWorkerStatusCode* out, @@ -97,8 +96,6 @@ return navigation_handle_core; } -} // namespace - static const int kRenderFrameId = 1; class TestingServiceWorkerDispatcherHost : public ServiceWorkerDispatcherHost { @@ -480,4 +477,5 @@ EXPECT_EQ(SERVICE_WORKER_ERROR_START_WORKER_FAILED, status); } +} // namespace service_worker_dispatcher_host_unittest } // namespace content
diff --git a/content/browser/service_worker/service_worker_handle_unittest.cc b/content/browser/service_worker/service_worker_handle_unittest.cc index bfcfd10d..c5f6b27 100644 --- a/content/browser/service_worker/service_worker_handle_unittest.cc +++ b/content/browser/service_worker/service_worker_handle_unittest.cc
@@ -27,8 +27,7 @@ #include "third_party/WebKit/common/service_worker/service_worker_state.mojom.h" namespace content { - -namespace { +namespace service_worker_handle_unittest { const int kRenderFrameId = 44; // A dummy ID for testing. @@ -43,8 +42,6 @@ EXPECT_EQ(expected_state, std::get<2>(param)); } -} // namespace - class TestingServiceWorkerDispatcherHost : public ServiceWorkerDispatcherHost { public: TestingServiceWorkerDispatcherHost(int process_id, @@ -170,4 +167,5 @@ message); } +} // namespace service_worker_handle_unittest } // namespace content
diff --git a/content/browser/service_worker/service_worker_provider_host.h b/content/browser/service_worker/service_worker_provider_host.h index 6e54fe3..0f559736 100644 --- a/content/browser/service_worker/service_worker_provider_host.h +++ b/content/browser/service_worker/service_worker_provider_host.h
@@ -53,6 +53,14 @@ class ServiceWorkerVersion; class WebContents; +namespace service_worker_dispatcher_host_unittest { +class ServiceWorkerDispatcherHostTest; +FORWARD_DECLARE_TEST(ServiceWorkerDispatcherHostTest, + DispatchExtendableMessageEvent); +FORWARD_DECLARE_TEST(ServiceWorkerDispatcherHostTest, + DispatchExtendableMessageEvent_Fail); +} // namespace service_worker_dispatcher_host_unittest + // This class is the browser-process representation of a service worker // provider. There are two general types of providers: 1) those for a client // (windows or shared workers), and 2) those for hosting a running service @@ -345,10 +353,12 @@ Update_ElongatedScript); FRIEND_TEST_ALL_PREFIXES(ServiceWorkerWriteToCacheJobTest, Update_EmptyScript); - FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDispatcherHostTest, - DispatchExtendableMessageEvent); - FRIEND_TEST_ALL_PREFIXES(ServiceWorkerDispatcherHostTest, - DispatchExtendableMessageEvent_Fail); + FRIEND_TEST_ALL_PREFIXES( + service_worker_dispatcher_host_unittest::ServiceWorkerDispatcherHostTest, + DispatchExtendableMessageEvent); + FRIEND_TEST_ALL_PREFIXES( + service_worker_dispatcher_host_unittest::ServiceWorkerDispatcherHostTest, + DispatchExtendableMessageEvent_Fail); FRIEND_TEST_ALL_PREFIXES(ServiceWorkerProviderHostTest, ContextSecurity); FRIEND_TEST_ALL_PREFIXES(ServiceWorkerJobTest, Unregister); FRIEND_TEST_ALL_PREFIXES(ServiceWorkerJobTest, RegisterDuplicateScript);
diff --git a/content/browser/service_worker/service_worker_quota_client.cc b/content/browser/service_worker/service_worker_quota_client.cc index 2a7842f..4819a05 100644 --- a/content/browser/service_worker/service_worker_quota_client.cc +++ b/content/browser/service_worker/service_worker_quota_client.cc
@@ -27,8 +27,8 @@ void ReportToQuotaStatus(const QuotaClient::DeletionCallback& callback, bool status) { - callback.Run(status ? storage::QuotaStatusCode::kQuotaStatusOk - : storage::QuotaStatusCode::kQuotaStatusUnknown); + callback.Run(status ? blink::QuotaStatusCode::kOk + : blink::QuotaStatusCode::kUnknown); } void FindUsageForOrigin(const QuotaClient::GetUsageCallback& callback, @@ -98,7 +98,7 @@ storage::StorageType type, const DeletionCallback& callback) { if (type != storage::StorageType::kStorageTypeTemporary) { - callback.Run(storage::QuotaStatusCode::kQuotaStatusOk); + callback.Run(blink::QuotaStatusCode::kOk); return; } context_->DeleteForOrigin(origin, base::Bind(&ReportToQuotaStatus, callback));
diff --git a/content/browser/service_worker/service_worker_registration.h b/content/browser/service_worker/service_worker_registration.h index 97a77551..277cac0 100644 --- a/content/browser/service_worker/service_worker_registration.h +++ b/content/browser/service_worker/service_worker_registration.h
@@ -26,6 +26,10 @@ class ServiceWorkerVersion; struct ServiceWorkerRegistrationInfo; +namespace service_worker_registration_unittest { +class ServiceWorkerActivationTest; +} // namespace service_worker_registration_unittest + // Represents the core of a service worker registration object. Other // registration derivatives (WebServiceWorkerRegistration etc) ultimately refer // to this class. This is refcounted via ServiceWorkerRegistrationObjectHost to @@ -165,7 +169,8 @@ private: friend class base::RefCounted<ServiceWorkerRegistration>; - friend class ServiceWorkerActivationTest; + friend class service_worker_registration_unittest:: + ServiceWorkerActivationTest; void UnsetVersionInternal( ServiceWorkerVersion* version,
diff --git a/content/browser/service_worker/service_worker_registration_unittest.cc b/content/browser/service_worker/service_worker_registration_unittest.cc index 81b238f7..d975d14 100644 --- a/content/browser/service_worker/service_worker_registration_unittest.cc +++ b/content/browser/service_worker/service_worker_registration_unittest.cc
@@ -33,8 +33,7 @@ #include "url/gurl.h" namespace content { - -namespace { +namespace service_worker_registration_unittest { // From service_worker_registration.cc. constexpr base::TimeDelta kMaxLameDuckTime = base::TimeDelta::FromMinutes(5); @@ -117,8 +116,6 @@ binding_; }; -} // namespace - class ServiceWorkerRegistrationTest : public testing::Test { public: ServiceWorkerRegistrationTest() @@ -1059,4 +1056,5 @@ EXPECT_EQ(1, mock_registration_object->update_found_called_count()); } +} // namespace service_worker_registration_unittest } // namespace content
diff --git a/content/browser/service_worker/service_worker_request_handler_unittest.cc b/content/browser/service_worker/service_worker_request_handler_unittest.cc index dfebadda..8b91e066 100644 --- a/content/browser/service_worker/service_worker_request_handler_unittest.cc +++ b/content/browser/service_worker/service_worker_request_handler_unittest.cc
@@ -26,13 +26,10 @@ #include "testing/gtest/include/gtest/gtest.h" namespace content { - -namespace { +namespace service_worker_request_handler_unittest { int kMockProviderId = 1; -} - class ServiceWorkerRequestHandlerTest : public testing::Test { public: ServiceWorkerRequestHandlerTest() @@ -168,4 +165,5 @@ EXPECT_EQ(GURL("https://host/scope/doc"), provider_host_->document_url()); } +} // namespace service_worker_request_handler_unittest } // namespace content
diff --git a/content/browser/service_worker/service_worker_storage.h b/content/browser/service_worker/service_worker_storage.h index 56fe9d2..3daafe9 100644 --- a/content/browser/service_worker/service_worker_storage.h +++ b/content/browser/service_worker/service_worker_storage.h
@@ -47,6 +47,22 @@ class ServiceWorkerResponseWriter; struct ServiceWorkerRegistrationInfo; +namespace service_worker_write_to_cache_job_unittest { +class ServiceWorkerWriteToCacheJobTest; +} // namespace service_worker_write_to_cache_job_unittest + +namespace service_worker_storage_unittest { +class ServiceWorkerStorageTest; +class ServiceWorkerResourceStorageTest; +class ServiceWorkerResourceStorageDiskTest; +FORWARD_DECLARE_TEST(ServiceWorkerResourceStorageDiskTest, CleanupOnRestart); +FORWARD_DECLARE_TEST(ServiceWorkerResourceStorageDiskTest, DeleteAndStartOver); +FORWARD_DECLARE_TEST(ServiceWorkerResourceStorageDiskTest, + DeleteAndStartOver_UnrelatedFileExists); +FORWARD_DECLARE_TEST(ServiceWorkerResourceStorageDiskTest, + DeleteAndStartOver_OpenedFileExists); +} // namespace service_worker_storage_unittest + // This class provides an interface to store and retrieve ServiceWorker // registration data. The lifetime is equal to ServiceWorkerContextCore that is // an owner of this class. When a storage operation fails, this is marked as @@ -259,17 +275,23 @@ bool LazyInitializeForTest(base::OnceClosure callback); private: - friend class ServiceWorkerStorageTest; - friend class ServiceWorkerResourceStorageTest; - friend class ServiceWorkerWriteToCacheJobTest; - FRIEND_TEST_ALL_PREFIXES(ServiceWorkerResourceStorageDiskTest, - CleanupOnRestart); - FRIEND_TEST_ALL_PREFIXES(ServiceWorkerResourceStorageDiskTest, - DeleteAndStartOver); - FRIEND_TEST_ALL_PREFIXES(ServiceWorkerResourceStorageDiskTest, - DeleteAndStartOver_UnrelatedFileExists); - FRIEND_TEST_ALL_PREFIXES(ServiceWorkerResourceStorageDiskTest, - DeleteAndStartOver_OpenedFileExists); + friend class service_worker_storage_unittest::ServiceWorkerStorageTest; + friend class service_worker_storage_unittest:: + ServiceWorkerResourceStorageTest; + friend class service_worker_write_to_cache_job_unittest:: + ServiceWorkerWriteToCacheJobTest; + FRIEND_TEST_ALL_PREFIXES( + service_worker_storage_unittest::ServiceWorkerResourceStorageDiskTest, + CleanupOnRestart); + FRIEND_TEST_ALL_PREFIXES( + service_worker_storage_unittest::ServiceWorkerResourceStorageDiskTest, + DeleteAndStartOver); + FRIEND_TEST_ALL_PREFIXES( + service_worker_storage_unittest::ServiceWorkerResourceStorageDiskTest, + DeleteAndStartOver_UnrelatedFileExists); + FRIEND_TEST_ALL_PREFIXES( + service_worker_storage_unittest::ServiceWorkerResourceStorageDiskTest, + DeleteAndStartOver_OpenedFileExists); struct InitialData { int64_t next_registration_id;
diff --git a/content/browser/service_worker/service_worker_storage_unittest.cc b/content/browser/service_worker/service_worker_storage_unittest.cc index 4aaa66f..2a41e9d 100644 --- a/content/browser/service_worker/service_worker_storage_unittest.cc +++ b/content/browser/service_worker/service_worker_storage_unittest.cc
@@ -48,8 +48,7 @@ using net::WrappedIOBuffer; namespace content { - -namespace { +namespace service_worker_storage_unittest { using RegistrationData = ServiceWorkerDatabase::RegistrationData; using ResourceRecord = ServiceWorkerDatabase::ResourceRecord; @@ -305,8 +304,6 @@ return true; } -} // namespace - class ServiceWorkerStorageTest : public testing::Test { public: ServiceWorkerStorageTest() @@ -2085,4 +2082,5 @@ EXPECT_EQ(kHeaderValue, state.header); } +} // namespace service_worker_storage_unittest } // namespace content
diff --git a/content/browser/service_worker/service_worker_url_loader_job_unittest.cc b/content/browser/service_worker/service_worker_url_loader_job_unittest.cc index fc3403c..619ceec 100644 --- a/content/browser/service_worker/service_worker_url_loader_job_unittest.cc +++ b/content/browser/service_worker/service_worker_url_loader_job_unittest.cc
@@ -34,8 +34,7 @@ #include "third_party/WebKit/common/service_worker/service_worker_registration.mojom.h" namespace content { - -namespace { +namespace service_worker_url_loader_job_unittest { void ReceiveStartLoaderCallback(StartLoaderCallback* out_callback, StartLoaderCallback callback) { @@ -465,8 +464,6 @@ return head; } -} // namespace - // ServiceWorkerURLLoaderJobTest is for testing the handling of requests // by a service worker via ServiceWorkerURLLoaderJob. // @@ -959,4 +956,5 @@ EXPECT_EQ(new_url, redirect_info.new_url); } +} // namespace service_worker_url_loader_job_unittest } // namespace content
diff --git a/content/browser/service_worker/service_worker_url_request_job.h b/content/browser/service_worker/service_worker_url_request_job.h index 935e154f..9c1abb38 100644 --- a/content/browser/service_worker/service_worker_url_request_job.h +++ b/content/browser/service_worker/service_worker_url_request_job.h
@@ -56,6 +56,16 @@ class ServiceWorkerDataPipeReader; class ServiceWorkerVersion; +namespace service_worker_controllee_request_handler_unittest { +class ServiceWorkerControlleeRequestHandlerTest; +FORWARD_DECLARE_TEST(ServiceWorkerControlleeRequestHandlerTest, + LostActiveVersion); +} // namespace service_worker_controllee_request_handler_unittest + +namespace service_worker_url_request_job_unittest { +class DelayHelper; +} // namespace service_worker_url_request_job_unittest + class CONTENT_EXPORT ServiceWorkerURLRequestJob : public net::URLRequestJob { public: using Delegate = ServiceWorkerURLJobWrapper::Delegate; @@ -139,9 +149,10 @@ private: class FileSizeResolver; class NavigationPreloadMetrics; - friend class DelayHelper; + friend class service_worker_url_request_job_unittest::DelayHelper; friend class ServiceWorkerURLRequestJobTest; - FRIEND_TEST_ALL_PREFIXES(ServiceWorkerControlleeRequestHandlerTest, + FRIEND_TEST_ALL_PREFIXES(service_worker_controllee_request_handler_unittest:: + ServiceWorkerControlleeRequestHandlerTest, LostActiveVersion); enum ResponseBodyType {
diff --git a/content/browser/service_worker/service_worker_url_request_job_unittest.cc b/content/browser/service_worker/service_worker_url_request_job_unittest.cc index 8efb44b..44c9ecf 100644 --- a/content/browser/service_worker/service_worker_url_request_job_unittest.cc +++ b/content/browser/service_worker/service_worker_url_request_job_unittest.cc
@@ -69,8 +69,7 @@ #include "third_party/WebKit/common/service_worker/service_worker_registration.mojom.h" namespace content { - -namespace { +namespace service_worker_url_request_job_unittest { const int kProviderID = 100; const char kTestData[] = "Here is sample text for the blob."; @@ -168,8 +167,6 @@ *out_status = status; } -} // namespace - // ServiceWorkerURLRequestJobTest is for testing the handling of URL requests by // a service worker. // @@ -1491,4 +1488,5 @@ // TODO(kinuko): Add more tests with different response data and also for // FallbackToNetwork case. +} // namespace service_worker_url_request_job_unittest } // namespace content
diff --git a/content/browser/service_worker/service_worker_version.h b/content/browser/service_worker/service_worker_version.h index 23d5f461..4cb00e8 100644 --- a/content/browser/service_worker/service_worker_version.h +++ b/content/browser/service_worker/service_worker_version.h
@@ -65,6 +65,43 @@ struct ServiceWorkerClientInfo; struct ServiceWorkerVersionInfo; +namespace service_worker_controllee_request_handler_unittest { +class ServiceWorkerControlleeRequestHandlerTest; +FORWARD_DECLARE_TEST(ServiceWorkerControlleeRequestHandlerTest, + ActivateWaitingVersion); +FORWARD_DECLARE_TEST(ServiceWorkerControlleeRequestHandlerTest, + FallbackWithNoFetchHandler); +} // namespace service_worker_controllee_request_handler_unittest + +namespace service_worker_version_unittest { +class ServiceWorkerVersionTest; +class ServiceWorkerRequestTimeoutTest; +class ServiceWorkerFailToStartTest; +FORWARD_DECLARE_TEST(ServiceWorkerFailToStartTest, Timeout); +FORWARD_DECLARE_TEST(ServiceWorkerRequestTimeoutTest, RequestTimeout); +FORWARD_DECLARE_TEST(ServiceWorkerStallInStoppingTest, DetachThenRestart); +FORWARD_DECLARE_TEST(ServiceWorkerStallInStoppingTest, + DetachThenRestartNoCrash); +FORWARD_DECLARE_TEST(ServiceWorkerStallInStoppingTest, DetachThenStart); +FORWARD_DECLARE_TEST(ServiceWorkerVersionTest, IdleTimeout); +FORWARD_DECLARE_TEST(ServiceWorkerVersionTest, MixedRequestTimeouts); +FORWARD_DECLARE_TEST(ServiceWorkerVersionTest, RegisterForeignFetchScopes); +FORWARD_DECLARE_TEST(ServiceWorkerVersionTest, RequestCustomizedTimeout); +FORWARD_DECLARE_TEST(ServiceWorkerVersionTest, RequestNowTimeout); +FORWARD_DECLARE_TEST(ServiceWorkerVersionTest, RestartWorker); +FORWARD_DECLARE_TEST(ServiceWorkerVersionTest, RequestNowTimeoutKill); +FORWARD_DECLARE_TEST(ServiceWorkerVersionTest, SetDevToolsAttached); +FORWARD_DECLARE_TEST(ServiceWorkerVersionTest, StaleUpdate_DoNotDeferTimer); +FORWARD_DECLARE_TEST(ServiceWorkerVersionTest, StaleUpdate_FreshWorker); +FORWARD_DECLARE_TEST(ServiceWorkerVersionTest, StaleUpdate_NonActiveWorker); +FORWARD_DECLARE_TEST(ServiceWorkerVersionTest, StaleUpdate_RunningWorker); +FORWARD_DECLARE_TEST(ServiceWorkerVersionTest, StaleUpdate_StartWorker); +} // namespace service_worker_version_unittest + +namespace service_worker_registration_unittest { +class ServiceWorkerActivationTest; +} // namespace service_worker_registration_unittest + // This class corresponds to a specific version of a ServiceWorker // script for a given pattern. When a script is upgraded, there may be // more than one ServiceWorkerVersion "running" at a time, but only @@ -421,37 +458,71 @@ friend class base::RefCounted<ServiceWorkerVersion>; friend class ServiceWorkerReadFromCacheJobTest; friend class ServiceWorkerVersionBrowserTest; - friend class ServiceWorkerActivationTest; + friend class service_worker_registration_unittest:: + ServiceWorkerActivationTest; - FRIEND_TEST_ALL_PREFIXES(ServiceWorkerControlleeRequestHandlerTest, + FRIEND_TEST_ALL_PREFIXES(service_worker_controllee_request_handler_unittest:: + ServiceWorkerControlleeRequestHandlerTest, ActivateWaitingVersion); - FRIEND_TEST_ALL_PREFIXES(ServiceWorkerControlleeRequestHandlerTest, + FRIEND_TEST_ALL_PREFIXES(service_worker_controllee_request_handler_unittest:: + ServiceWorkerControlleeRequestHandlerTest, FallbackWithNoFetchHandler); FRIEND_TEST_ALL_PREFIXES(ServiceWorkerJobTest, Register); - FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, IdleTimeout); - FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, SetDevToolsAttached); - FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, StaleUpdate_FreshWorker); - FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, - StaleUpdate_NonActiveWorker); - FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, StaleUpdate_StartWorker); - FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, StaleUpdate_RunningWorker); - FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, - StaleUpdate_DoNotDeferTimer); - FRIEND_TEST_ALL_PREFIXES(ServiceWorkerRequestTimeoutTest, RequestTimeout); - FRIEND_TEST_ALL_PREFIXES(ServiceWorkerFailToStartTest, Timeout); + FRIEND_TEST_ALL_PREFIXES( + service_worker_version_unittest::ServiceWorkerVersionTest, + IdleTimeout); + FRIEND_TEST_ALL_PREFIXES( + service_worker_version_unittest::ServiceWorkerVersionTest, + SetDevToolsAttached); + FRIEND_TEST_ALL_PREFIXES( + service_worker_version_unittest::ServiceWorkerVersionTest, + StaleUpdate_FreshWorker); + FRIEND_TEST_ALL_PREFIXES( + service_worker_version_unittest::ServiceWorkerVersionTest, + StaleUpdate_NonActiveWorker); + FRIEND_TEST_ALL_PREFIXES( + service_worker_version_unittest::ServiceWorkerVersionTest, + StaleUpdate_StartWorker); + FRIEND_TEST_ALL_PREFIXES( + service_worker_version_unittest::ServiceWorkerVersionTest, + StaleUpdate_RunningWorker); + FRIEND_TEST_ALL_PREFIXES( + service_worker_version_unittest::ServiceWorkerVersionTest, + StaleUpdate_DoNotDeferTimer); + FRIEND_TEST_ALL_PREFIXES( + service_worker_version_unittest::ServiceWorkerRequestTimeoutTest, + RequestTimeout); + FRIEND_TEST_ALL_PREFIXES( + service_worker_version_unittest::ServiceWorkerFailToStartTest, + Timeout); FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionBrowserTest, TimeoutStartingWorker); FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionBrowserTest, TimeoutWorkerInEvent); - FRIEND_TEST_ALL_PREFIXES(ServiceWorkerStallInStoppingTest, DetachThenStart); - FRIEND_TEST_ALL_PREFIXES(ServiceWorkerStallInStoppingTest, DetachThenRestart); - FRIEND_TEST_ALL_PREFIXES(ServiceWorkerStallInStoppingTest, - DetachThenRestartNoCrash); - FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, RequestNowTimeout); - FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, RequestNowTimeoutKill); - FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, RequestCustomizedTimeout); - FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, RestartWorker); - FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, MixedRequestTimeouts); + FRIEND_TEST_ALL_PREFIXES( + service_worker_version_unittest::ServiceWorkerStallInStoppingTest, + DetachThenStart); + FRIEND_TEST_ALL_PREFIXES( + service_worker_version_unittest::ServiceWorkerStallInStoppingTest, + DetachThenRestart); + FRIEND_TEST_ALL_PREFIXES( + service_worker_version_unittest::ServiceWorkerStallInStoppingTest, + DetachThenRestartNoCrash); + FRIEND_TEST_ALL_PREFIXES( + service_worker_version_unittest::ServiceWorkerVersionTest, + RequestNowTimeout); + FRIEND_TEST_ALL_PREFIXES( + service_worker_version_unittest::ServiceWorkerVersionTest, + RestartWorker); + FRIEND_TEST_ALL_PREFIXES( + service_worker_version_unittest::ServiceWorkerVersionTest, + RequestNowTimeoutKill); + FRIEND_TEST_ALL_PREFIXES( + service_worker_version_unittest::ServiceWorkerVersionTest, + RequestCustomizedTimeout); + FRIEND_TEST_ALL_PREFIXES( + service_worker_version_unittest::ServiceWorkerVersionTest, + MixedRequestTimeouts); FRIEND_TEST_ALL_PREFIXES(ServiceWorkerURLRequestJobTest, EarlyResponse); FRIEND_TEST_ALL_PREFIXES(ServiceWorkerURLRequestJobTest, CancelRequest);
diff --git a/content/browser/service_worker/service_worker_version_unittest.cc b/content/browser/service_worker/service_worker_version_unittest.cc index 5d9fd50..c163d7a 100644 --- a/content/browser/service_worker/service_worker_version_unittest.cc +++ b/content/browser/service_worker/service_worker_version_unittest.cc
@@ -52,8 +52,7 @@ // --------------------------------------------------------------------------- namespace content { - -namespace { +namespace service_worker_version_unittest { class MessageReceiver : public EmbeddedWorkerTestHelper { public: @@ -205,8 +204,6 @@ EXPECT_EQ(EmbeddedWorkerStatus::RUNNING, version->running_status()); } -} // namespace - class ServiceWorkerVersionTest : public testing::Test { protected: struct RunningStateListener : public ServiceWorkerVersion::Listener { @@ -1544,4 +1541,5 @@ histogram_tester_.ExpectTotalCount(kStartHintPrecision, 2); } +} // namespace service_worker_version_unittest } // namespace content
diff --git a/content/browser/service_worker/service_worker_write_to_cache_job_unittest.cc b/content/browser/service_worker/service_worker_write_to_cache_job_unittest.cc index 0403817..0328139 100644 --- a/content/browser/service_worker/service_worker_write_to_cache_job_unittest.cc +++ b/content/browser/service_worker/service_worker_write_to_cache_job_unittest.cc
@@ -41,8 +41,7 @@ #include "third_party/WebKit/common/service_worker/service_worker_registration.mojom.h" namespace content { - -namespace { +namespace service_worker_write_to_cache_job_unittest { const char kHeaders[] = "HTTP/1.1 200 OK\n" @@ -271,8 +270,6 @@ size_t bytes_read_; }; -} // namespace - class ServiceWorkerWriteToCacheJobTest : public testing::Test { public: ServiceWorkerWriteToCacheJobTest() @@ -688,4 +685,5 @@ EXPECT_EQ(net::ERR_FAILED, request_->status().error()); } +} // namespace service_worker_write_to_cache_job_unittest } // namespace content
diff --git a/content/browser/site_instance_impl.cc b/content/browser/site_instance_impl.cc index 959325f..5abcf9a 100644 --- a/content/browser/site_instance_impl.cc +++ b/content/browser/site_instance_impl.cc
@@ -4,6 +4,8 @@ #include "content/browser/site_instance_impl.h" +#include <string> + #include "base/command_line.h" #include "base/debug/crash_logging.h" #include "base/macros.h" @@ -13,8 +15,8 @@ #include "content/browser/frame_host/debug_urls.h" #include "content/browser/frame_host/frame_tree_node.h" #include "content/browser/renderer_host/render_process_host_impl.h" +#include "content/browser/site_isolation_policy.h" #include "content/browser/storage_partition_impl.h" -#include "content/common/site_isolation_policy.h" #include "content/public/browser/content_browser_client.h" #include "content/public/browser/render_process_host_factory.h" #include "content/public/browser/web_ui_controller_factory.h" @@ -409,8 +411,10 @@ return isolated_origin.GetURL(); } - // If the url has a host, then determine the site. - if (!origin.host().empty()) { + // If the url has a host, then determine the site. Skip file URLs to avoid a + // situation where site URL of file://localhost/ would mismatch Blink's origin + // (which ignores the hostname in this case - see https://crbug.com/776160). + if (!origin.host().empty() && origin.scheme() != url::kFileScheme) { // Only keep the scheme and registered domain of |origin|. std::string domain = net::registry_controlled_domains::GetDomainAndRegistry( origin.host(),
diff --git a/content/browser/site_instance_impl_unittest.cc b/content/browser/site_instance_impl_unittest.cc index efcc82f..774bf72 100644 --- a/content/browser/site_instance_impl_unittest.cc +++ b/content/browser/site_instance_impl_unittest.cc
@@ -331,11 +331,14 @@ EXPECT_EQ("file", site_url.scheme()); EXPECT_FALSE(site_url.has_host()); - // Some file URLs have hosts in the path. + // Some file URLs have hosts in the path. For consistency with Blink (which + // maps *all* file://... URLs into "file://" origin) such file URLs still need + // to map into "file:" site URL. See also https://crbug.com/776160. test_url = GURL("file://server/path"); site_url = SiteInstanceImpl::GetSiteForURL(nullptr, test_url); - EXPECT_EQ(GURL("file://server"), site_url); - EXPECT_EQ("server", site_url.host()); + EXPECT_EQ(GURL("file:"), site_url); + EXPECT_EQ("file", site_url.scheme()); + EXPECT_FALSE(site_url.has_host()); // Data URLs should include the scheme. test_url = GURL("data:text/html,foo");
diff --git a/content/common/site_isolation_policy.cc b/content/browser/site_isolation_policy.cc similarity index 83% rename from content/common/site_isolation_policy.cc rename to content/browser/site_isolation_policy.cc index 16035a81..2401e866 100644 --- a/content/common/site_isolation_policy.cc +++ b/content/browser/site_isolation_policy.cc
@@ -2,15 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/common/site_isolation_policy.h" +#include "content/browser/site_isolation_policy.h" +#include <algorithm> +#include <iterator> #include <string> +#include <utility> #include "base/command_line.h" #include "base/feature_list.h" #include "base/metrics/field_trial_params.h" #include "base/metrics/histogram_macros.h" #include "base/strings/string_split.h" +#include "content/public/browser/content_browser_client.h" +#include "content/public/common/content_client.h" #include "content/public/common/content_features.h" #include "content/public/common/content_switches.h" #include "url/gurl.h" @@ -56,7 +61,8 @@ } // static -std::vector<url::Origin> SiteIsolationPolicy::GetIsolatedOrigins() { +std::vector<url::Origin> +SiteIsolationPolicy::GetIsolatedOriginsFromEnvironment() { std::string cmdline_arg = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( switches::kIsolateOrigins); @@ -79,6 +85,20 @@ } // static +std::vector<url::Origin> SiteIsolationPolicy::GetIsolatedOrigins() { + std::vector<url::Origin> from_environment = + GetIsolatedOriginsFromEnvironment(); + std::vector<url::Origin> from_embedder = + GetContentClient()->browser()->GetOriginsRequiringDedicatedProcess(); + + std::vector<url::Origin> result = std::move(from_environment); + result.reserve(result.size() + from_embedder.size()); + std::move(from_embedder.begin(), from_embedder.end(), + std::back_inserter(result)); + return result; +} + +// static std::vector<url::Origin> SiteIsolationPolicy::ParseIsolatedOrigins( base::StringPiece arg) { std::vector<base::StringPiece> origin_strings = base::SplitStringPiece(
diff --git a/content/common/site_isolation_policy.h b/content/browser/site_isolation_policy.h similarity index 85% rename from content/common/site_isolation_policy.h rename to content/browser/site_isolation_policy.h index eb4b799..8ece8d8 100644 --- a/content/common/site_isolation_policy.h +++ b/content/browser/site_isolation_policy.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 CONTENT_COMMON_SITE_ISOLATION_POLICY_H_ -#define CONTENT_COMMON_SITE_ISOLATION_POLICY_H_ +#ifndef CONTENT_BROWSER_SITE_ISOLATION_POLICY_H_ +#define CONTENT_BROWSER_SITE_ISOLATION_POLICY_H_ #include <vector> @@ -45,8 +45,6 @@ // Returns the origins to isolate. See also AreIsolatedOriginsEnabled. // This list applies globally to the whole browser in all profiles. - // TODO(lukasza): Make sure this list also includes the origins returned by - // ContentBrowserClient::GetOriginsRequiringDedicatedProcess. static std::vector<url::Origin> GetIsolatedOrigins(); // Records metrics about which site isolation command-line flags are present. @@ -56,12 +54,16 @@ private: SiteIsolationPolicy(); // Not instantiable. - FRIEND_TEST_ALL_PREFIXES(SiteIsolationPolicyTest, ParseIsolatedOrigins); + // Parses |arg| into a list of origins. static std::vector<url::Origin> ParseIsolatedOrigins(base::StringPiece arg); + FRIEND_TEST_ALL_PREFIXES(SiteIsolationPolicyTest, ParseIsolatedOrigins); + + // Gets isolated origins from cmdline and/or from field trial param. + static std::vector<url::Origin> GetIsolatedOriginsFromEnvironment(); DISALLOW_COPY_AND_ASSIGN(SiteIsolationPolicy); }; } // namespace content -#endif // CONTENT_COMMON_SITE_ISOLATION_POLICY_H_ +#endif // CONTENT_BROWSER_SITE_ISOLATION_POLICY_H_
diff --git a/content/common/site_isolation_policy_unittest.cc b/content/browser/site_isolation_policy_unittest.cc similarity index 97% rename from content/common/site_isolation_policy_unittest.cc rename to content/browser/site_isolation_policy_unittest.cc index b3935e6..a60ec5d 100644 --- a/content/common/site_isolation_policy_unittest.cc +++ b/content/browser/site_isolation_policy_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/common/site_isolation_policy.h" +#include "content/browser/site_isolation_policy.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/content/browser/storage_partition_impl.cc b/content/browser/storage_partition_impl.cc index ed100ce..53ae35d 100644 --- a/content/browser/storage_partition_impl.cc +++ b/content/browser/storage_partition_impl.cc
@@ -49,6 +49,7 @@ #include "storage/browser/blob/blob_storage_context.h" #include "storage/browser/database/database_tracker.h" #include "storage/browser/quota/quota_manager.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" #if !defined(OS_ANDROID) #include "content/browser/host_zoom_map_impl.h" @@ -124,12 +125,12 @@ storage::StorageType type, size_t* deletion_task_count, const base::Closure& callback, - storage::QuotaStatusCode status) { + blink::QuotaStatusCode status) { DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_GT(*deletion_task_count, 0u); - if (status != storage::kQuotaStatusOk) { + if (status != blink::QuotaStatusCode::kOk) { DLOG(ERROR) << "Couldn't remove data of type " << type << " for origin " - << origin << ". Status: " << status; + << origin << ". Status: " << static_cast<int>(status); } (*deletion_task_count)--;
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index e4522af9..40f215e 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc
@@ -86,7 +86,6 @@ #include "content/common/page_messages.h" #include "content/common/page_state_serialization.h" #include "content/common/render_message_filter.mojom.h" -#include "content/common/site_isolation_policy.h" #include "content/common/view_messages.h" #include "content/public/browser/ax_event_notification_details.h" #include "content/public/browser/browser_context.h"
diff --git a/content/browser/web_contents/web_contents_impl_browsertest.cc b/content/browser/web_contents/web_contents_impl_browsertest.cc index fb02ae9..3463fdb 100644 --- a/content/browser/web_contents/web_contents_impl_browsertest.cc +++ b/content/browser/web_contents/web_contents_impl_browsertest.cc
@@ -16,7 +16,6 @@ #include "content/browser/web_contents/web_contents_impl.h" #include "content/browser/web_contents/web_contents_view.h" #include "content/common/frame_messages.h" -#include "content/common/site_isolation_policy.h" #include "content/public/browser/javascript_dialog_manager.h" #include "content/public/browser/load_notification_details.h" #include "content/public/browser/navigation_controller.h"
diff --git a/content/browser/web_contents/web_contents_impl_unittest.cc b/content/browser/web_contents/web_contents_impl_unittest.cc index 28dc21a4..73d3095 100644 --- a/content/browser/web_contents/web_contents_impl_unittest.cc +++ b/content/browser/web_contents/web_contents_impl_unittest.cc
@@ -24,7 +24,6 @@ #include "content/common/frame_messages.h" #include "content/common/input/synthetic_web_input_event_builders.h" #include "content/common/media/media_player_delegate_messages.h" -#include "content/common/site_isolation_policy.h" #include "content/common/view_messages.h" #include "content/public/browser/content_browser_client.h" #include "content/public/browser/download_url_parameters.h"
diff --git a/content/browser/webauth/attestation_object.cc b/content/browser/webauth/attestation_object.cc index 12234091..db38b4f 100644 --- a/content/browser/webauth/attestation_object.cc +++ b/content/browser/webauth/attestation_object.cc
@@ -25,9 +25,12 @@ std::vector<uint8_t> AttestationObject::SerializeToCBOREncodedBytes() { CBORValue::MapValue map; - map[kFormatKey] = CBORValue(attestation_statement_->format_name().c_str()); - map[kAuthDataKey] = CBORValue(authenticator_data_->SerializeToByteArray()); - map[kAttestationKey] = CBORValue(attestation_statement_->GetAsCBORMap()); + map[CBORValue(kFormatKey)] = + CBORValue(attestation_statement_->format_name().c_str()); + map[CBORValue(kAuthDataKey)] = + CBORValue(authenticator_data_->SerializeToByteArray()); + map[CBORValue(kAttestationKey)] = + CBORValue(attestation_statement_->GetAsCBORMap()); auto cbor = CBORWriter::Write(CBORValue(map)); if (cbor.has_value()) { return cbor.value();
diff --git a/content/browser/webauth/cbor/cbor_reader.cc b/content/browser/webauth/cbor/cbor_reader.cc index e61565c..fa4e0576 100644 --- a/content/browser/webauth/cbor/cbor_reader.cc +++ b/content/browser/webauth/cbor/cbor_reader.cc
@@ -182,18 +182,19 @@ base::Optional<CBORValue> value = DecodeCBOR(max_nesting_level - 1); if (!key.has_value() || !value.has_value()) return base::nullopt; - if (key.value().type() != CBORValue::Type::STRING) { + + // Only CBOR maps with integer or string type keys are allowed. + if (key.value().type() != CBORValue::Type::STRING && + key.value().type() != CBORValue::Type::UNSIGNED) { error_code_ = DecoderError::INCORRECT_MAP_KEY_TYPE; return base::nullopt; } - - if (!CheckDuplicateKey(key.value().GetString(), &cbor_map) || - !CheckOutOfOrderKey(key.value().GetString(), &cbor_map)) { + if (!CheckDuplicateKey(key.value(), &cbor_map) || + !CheckOutOfOrderKey(key.value(), &cbor_map)) { return base::nullopt; } - cbor_map.insert_or_assign(key.value().GetString(), - std::move(value.value())); + cbor_map.insert_or_assign(std::move(key.value()), std::move(value.value())); } return CBORValue(std::move(cbor_map)); } @@ -221,7 +222,7 @@ error_code_ = DecoderError::EXTRANEOUS_DATA; } -bool CBORReader::CheckDuplicateKey(const std::string& new_key, +bool CBORReader::CheckDuplicateKey(const CBORValue& new_key, CBORValue::MapValue* map) { if (base::ContainsKey(*map, new_key)) { error_code_ = DecoderError::DUPLICATE_KEY; @@ -238,7 +239,7 @@ return true; } -bool CBORReader::CheckOutOfOrderKey(const std::string& new_key, +bool CBORReader::CheckOutOfOrderKey(const CBORValue& new_key, CBORValue::MapValue* map) { auto comparator = map->key_comp(); if (!map->empty() && comparator(new_key, map->rbegin()->first)) {
diff --git a/content/browser/webauth/cbor/cbor_reader.h b/content/browser/webauth/cbor/cbor_reader.h index 707f617b..d7b827b 100644 --- a/content/browser/webauth/cbor/cbor_reader.h +++ b/content/browser/webauth/cbor/cbor_reader.h
@@ -39,6 +39,8 @@ // - Callers can decode CBOR values with at most 16 nested depth layer. More // strict restrictions on nesting layer size of CBOR values can be enforced // by setting |max_nesting_level|. +// - Only CBOR maps with integer or string type keys are supported due to the +// cost of serialization when sorting map keys. namespace content { @@ -88,9 +90,9 @@ base::Optional<CBORValue> ReadCBORMap(uint64_t length, int max_nesting_level); bool CanConsume(uint64_t bytes); void CheckExtraneousData(); - bool CheckDuplicateKey(const std::string& new_key, CBORValue::MapValue* map); + bool CheckDuplicateKey(const CBORValue& new_key, CBORValue::MapValue* map); bool HasValidUTF8Format(const std::string& string_data); - bool CheckOutOfOrderKey(const std::string& new_key, CBORValue::MapValue* map); + bool CheckOutOfOrderKey(const CBORValue& new_key, CBORValue::MapValue* map); bool CheckUintEncodedByteLength(uint8_t additional_bytes, uint64_t uint_data); DecoderError GetErrorCode();
diff --git a/content/browser/webauth/cbor/cbor_reader_unittest.cc b/content/browser/webauth/cbor/cbor_reader_unittest.cc index fe3a99f..38663681 100644 --- a/content/browser/webauth/cbor/cbor_reader_unittest.cc +++ b/content/browser/webauth/cbor/cbor_reader_unittest.cc
@@ -43,7 +43,7 @@ } TEST(CBORReaderTest, TestUintEncodedWithNonMinimumByteLength) { - static const std::vector<std::vector<uint8_t>> non_minimal_uint_encodings = { + static const std::vector<uint8_t> non_minimal_uint_encodings[] = { // Uint 23 encoded with 1 byte. {0x18, 0x17}, // Uint 255 encoded with 2 bytes. @@ -51,11 +51,37 @@ // Uint 65535 encoded with 4 byte. {0x1a, 0x00, 0x00, 0xff, 0xff}, // Uint 4294967295 encoded with 8 byte. - {0x1b, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff}}; + {0x1b, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff}, + + // When decoding byte has more than one syntax error, the first syntax + // error encountered during deserialization is returned as the error code. + { + 0xa2, // map with non-minimally encoded key + 0x17, // key 24 + 0x61, 0x42, // value :"B" + + 0x18, 0x17, // key 23 encoded with extra byte + 0x61, 0x45 // value "E" + }, + { + 0xa2, // map with out of order and non-minimally encoded key + 0x18, 0x17, // key 23 encoded with extra byte + 0x61, 0x45, // value "E" + 0x17, // key 23 + 0x61, 0x42 // value :"B" + }, + { + 0xa2, // map with duplicate non-minimally encoded key + 0x18, 0x17, // key 23 encoded with extra byte + 0x61, 0x45, // value "E" + 0x18, 0x17, // key 23 encoded with extra byte + 0x61, 0x42 // value :"B" + }, + }; int test_case_index = 0; CBORReader::DecoderError error_code; - for (const auto non_minimal_uint : non_minimal_uint_encodings) { + for (const auto& non_minimal_uint : non_minimal_uint_encodings) { testing::Message scope_message; scope_message << "testing element at index " << test_case_index++; SCOPED_TRACE(scope_message); @@ -177,7 +203,7 @@ base::Optional<CBORValue> cbor = CBORReader::Read(kArrayTestCaseCbor); ASSERT_TRUE(cbor.has_value()); - CBORValue cbor_array = std::move(cbor.value()); + const CBORValue cbor_array = std::move(cbor.value()); ASSERT_EQ(cbor_array.type(), CBORValue::Type::ARRAY); ASSERT_THAT(cbor_array.GetArray(), testing::SizeIs(25)); @@ -196,7 +222,10 @@ TEST(CBORReaderTest, TestReadMapWithMapValue) { static const std::vector<uint8_t> kMapTestCaseCbor = { // clang-format off - 0xa3, // map of 3 pairs: + 0xa4, // map with 4 key value pairs: + 0x18, 0x18, // 24 + 0x63, 0x61, 0x62, 0x63, // "abc" + 0x60, // "" 0x61, 0x2e, // "." @@ -210,23 +239,82 @@ base::Optional<CBORValue> cbor = CBORReader::Read(kMapTestCaseCbor); ASSERT_TRUE(cbor.has_value()); - CBORValue cbor_val = std::move(cbor.value()); + const CBORValue cbor_val = std::move(cbor.value()); ASSERT_EQ(cbor_val.type(), CBORValue::Type::MAP); - ASSERT_EQ(cbor_val.GetMap().size(), 3u); + ASSERT_EQ(cbor_val.GetMap().size(), 4u); - ASSERT_EQ(cbor_val.GetMap().count(""), 1u); - ASSERT_EQ(cbor_val.GetMap().find("")->second.type(), CBORValue::Type::STRING); - EXPECT_EQ(cbor_val.GetMap().find("")->second.GetString(), "."); - - ASSERT_EQ(cbor_val.GetMap().count("b"), 1u); - ASSERT_EQ(cbor_val.GetMap().find("b")->second.type(), + const CBORValue key_uint(24); + ASSERT_EQ(cbor_val.GetMap().count(key_uint), 1u); + ASSERT_EQ(cbor_val.GetMap().find(key_uint)->second.type(), CBORValue::Type::STRING); - EXPECT_EQ(cbor_val.GetMap().find("b")->second.GetString(), "B"); + EXPECT_EQ(cbor_val.GetMap().find(key_uint)->second.GetString(), "abc"); - ASSERT_EQ(cbor_val.GetMap().count("aa"), 1u); - ASSERT_EQ(cbor_val.GetMap().find("aa")->second.type(), + const CBORValue key_empty_string(""); + ASSERT_EQ(cbor_val.GetMap().count(key_empty_string), 1u); + ASSERT_EQ(cbor_val.GetMap().find(key_empty_string)->second.type(), CBORValue::Type::STRING); - EXPECT_EQ(cbor_val.GetMap().find("aa")->second.GetString(), "AA"); + EXPECT_EQ(cbor_val.GetMap().find(key_empty_string)->second.GetString(), "."); + + const CBORValue key_b("b"); + ASSERT_EQ(cbor_val.GetMap().count(key_b), 1u); + ASSERT_EQ(cbor_val.GetMap().find(key_b)->second.type(), + CBORValue::Type::STRING); + EXPECT_EQ(cbor_val.GetMap().find(key_b)->second.GetString(), "B"); + + const CBORValue key_aa("aa"); + ASSERT_EQ(cbor_val.GetMap().count(key_aa), 1u); + ASSERT_EQ(cbor_val.GetMap().find(key_aa)->second.type(), + CBORValue::Type::STRING); + EXPECT_EQ(cbor_val.GetMap().find(key_aa)->second.GetString(), "AA"); +} + +TEST(CBORReaderTest, TestReadMapWithIntegerKeys) { + static const std::vector<uint8_t> kMapWithIntegerKeyCbor = { + // clang-format off + 0xA4, // map with 4 key value pairs + 0x01, // key : 1 + 0x61, 0x61, // value : "a" + + 0x09, // key : 9 + 0x61, 0x62, // value : "b" + + 0x19, 0x03, 0xE7, // key : 999 + 0x61, 0x63, // value "c" + + 0x19, 0x04, 0x57, // key : 1111 + 0x61, 0x64, // value : "d" + // clang-format on + }; + + base::Optional<CBORValue> cbor = CBORReader::Read(kMapWithIntegerKeyCbor); + ASSERT_TRUE(cbor.has_value()); + const CBORValue cbor_val = std::move(cbor.value()); + ASSERT_EQ(cbor_val.type(), CBORValue::Type::MAP); + ASSERT_EQ(cbor_val.GetMap().size(), 4u); + + const CBORValue key_1(1); + ASSERT_EQ(cbor_val.GetMap().count(key_1), 1u); + ASSERT_EQ(cbor_val.GetMap().find(key_1)->second.type(), + CBORValue::Type::STRING); + EXPECT_EQ(cbor_val.GetMap().find(key_1)->second.GetString(), "a"); + + const CBORValue key_9(9); + ASSERT_EQ(cbor_val.GetMap().count(key_9), 1u); + ASSERT_EQ(cbor_val.GetMap().find(key_9)->second.type(), + CBORValue::Type::STRING); + EXPECT_EQ(cbor_val.GetMap().find(key_9)->second.GetString(), "b"); + + const CBORValue key_999(999); + ASSERT_EQ(cbor_val.GetMap().count(key_999), 1u); + ASSERT_EQ(cbor_val.GetMap().find(key_999)->second.type(), + CBORValue::Type::STRING); + EXPECT_EQ(cbor_val.GetMap().find(key_999)->second.GetString(), "c"); + + const CBORValue key_1111(1111); + ASSERT_EQ(cbor_val.GetMap().count(key_1111), 1u); + ASSERT_EQ(cbor_val.GetMap().find(key_1111)->second.type(), + CBORValue::Type::STRING); + EXPECT_EQ(cbor_val.GetMap().find(key_1111)->second.GetString(), "d"); } TEST(CBORReaderTest, TestReadMapWithArray) { @@ -245,19 +333,22 @@ base::Optional<CBORValue> cbor = CBORReader::Read(kMapArrayTestCaseCbor); ASSERT_TRUE(cbor.has_value()); - CBORValue cbor_val = std::move(cbor.value()); + const CBORValue cbor_val = std::move(cbor.value()); ASSERT_EQ(cbor_val.type(), CBORValue::Type::MAP); ASSERT_EQ(cbor_val.GetMap().size(), 2u); - ASSERT_EQ(cbor_val.GetMap().count("a"), 1u); - ASSERT_EQ(cbor_val.GetMap().find("a")->second.type(), + const CBORValue key_a("a"); + ASSERT_EQ(cbor_val.GetMap().count(key_a), 1u); + ASSERT_EQ(cbor_val.GetMap().find(key_a)->second.type(), CBORValue::Type::UNSIGNED); - EXPECT_EQ(cbor_val.GetMap().find("a")->second.GetUnsigned(), 1u); + EXPECT_EQ(cbor_val.GetMap().find(key_a)->second.GetUnsigned(), 1u); - ASSERT_EQ(cbor_val.GetMap().count("b"), 1u); - ASSERT_EQ(cbor_val.GetMap().find("b")->second.type(), CBORValue::Type::ARRAY); + const CBORValue key_b("b"); + ASSERT_EQ(cbor_val.GetMap().count(key_b), 1u); + ASSERT_EQ(cbor_val.GetMap().find(key_b)->second.type(), + CBORValue::Type::ARRAY); - CBORValue nested_array = cbor_val.GetMap().find("b")->second.Clone(); + const CBORValue nested_array = cbor_val.GetMap().find(key_b)->second.Clone(); ASSERT_EQ(nested_array.GetArray().size(), 2u); for (int i = 0; i < 2; i++) { ASSERT_THAT(nested_array.GetArray()[i].type(), CBORValue::Type::UNSIGNED); @@ -285,32 +376,37 @@ base::Optional<CBORValue> cbor = CBORReader::Read(kNestedMapTestCase); ASSERT_TRUE(cbor.has_value()); - CBORValue cbor_val = std::move(cbor.value()); + const CBORValue cbor_val = std::move(cbor.value()); ASSERT_EQ(cbor_val.type(), CBORValue::Type::MAP); ASSERT_EQ(cbor_val.GetMap().size(), 2u); - ASSERT_EQ(cbor_val.GetMap().count("a"), 1u); - ASSERT_EQ(cbor_val.GetMap().find("a")->second.type(), - CBORValue::Type::UNSIGNED); - EXPECT_EQ(cbor_val.GetMap().find("a")->second.GetUnsigned(), 1u); - ASSERT_EQ(cbor_val.GetMap().count("b"), 1u); - CBORValue nested_map = cbor_val.GetMap().find("b")->second.Clone(); + const CBORValue key_a("a"); + ASSERT_EQ(cbor_val.GetMap().count(key_a), 1u); + ASSERT_EQ(cbor_val.GetMap().find(key_a)->second.type(), + CBORValue::Type::UNSIGNED); + EXPECT_EQ(cbor_val.GetMap().find(key_a)->second.GetUnsigned(), 1u); + + const CBORValue key_b("b"); + ASSERT_EQ(cbor_val.GetMap().count(key_b), 1u); + const CBORValue nested_map = cbor_val.GetMap().find(key_b)->second.Clone(); ASSERT_EQ(nested_map.type(), CBORValue::Type::MAP); ASSERT_EQ(nested_map.GetMap().size(), 2u); - ASSERT_EQ(nested_map.GetMap().count("c"), 1u); - ASSERT_EQ(nested_map.GetMap().find("c")->second.type(), + const CBORValue key_c("c"); + ASSERT_EQ(nested_map.GetMap().count(key_c), 1u); + ASSERT_EQ(nested_map.GetMap().find(key_c)->second.type(), CBORValue::Type::UNSIGNED); - EXPECT_EQ(nested_map.GetMap().find("c")->second.GetUnsigned(), 2u); + EXPECT_EQ(nested_map.GetMap().find(key_c)->second.GetUnsigned(), 2u); - ASSERT_EQ(nested_map.GetMap().count("d"), 1u); - ASSERT_EQ(nested_map.GetMap().find("d")->second.type(), + const CBORValue key_d("d"); + ASSERT_EQ(nested_map.GetMap().count(key_d), 1u); + ASSERT_EQ(nested_map.GetMap().find(key_d)->second.type(), CBORValue::Type::UNSIGNED); - EXPECT_EQ(nested_map.GetMap().find("d")->second.GetUnsigned(), 3u); + EXPECT_EQ(nested_map.GetMap().find(key_d)->second.GetUnsigned(), 3u); } TEST(CBORReaderTest, TestIncompleteCBORDataError) { - static const std::vector<std::vector<uint8_t>> incomplete_cbor_list = { + static const std::vector<uint8_t> incomplete_cbor_list[] = { // Additional info byte corresponds to unsigned int that corresponds // to 2 additional bytes. But actual data encoded in one byte. {0x19, 0x03}, @@ -327,7 +423,7 @@ }; int test_element_index = 0; - for (auto incomplete_data : incomplete_cbor_list) { + for (const auto& incomplete_data : incomplete_cbor_list) { testing::Message scope_message; scope_message << "testing incomplete data at index : " << test_element_index++; @@ -342,14 +438,14 @@ } // While RFC 7049 allows CBOR map keys with all types, current decoder only -// supports string type for CBOR map keys. Checks for error when decoding CBOR -// map with key other than UTF-8 string. +// supports unsigned integer and string keys. TEST(CBORReaderTest, TestUnsupportedMapKeyFormatError) { static const std::vector<uint8_t> kMapWithUintKey = { // clang-format off 0xa2, // map of 2 pairs - 0x01, // key : 1 - 0x02, // value : 2 + + 0x82, 0x01, 0x02, // invalid key : [1, 2] + 0x02, // value : 2 0x61, 0x64, // key : "d" 0x03, // value : 3 @@ -364,7 +460,7 @@ } TEST(CBORReaderTest, TestUnknownAdditionalInfoError) { - static const std::vector<std::vector<uint8_t>> kUnknownAdditionalInfoList = { + static const std::vector<uint8_t> kUnknownAdditionalInfoList[] = { // "IETF" encoded with major type 3 and additional info of 28. {0x7C, 0x49, 0x45, 0x54, 0x46}, // "\"\\" encoded with major type 3 and additional info of 29. @@ -375,7 +471,7 @@ {0x7F, 0xe6, 0xb0, 0xb4}}; int test_element_index = 0; - for (auto incorrect_cbor : kUnknownAdditionalInfoList) { + for (const auto& incorrect_cbor : kUnknownAdditionalInfoList) { testing::Message scope_message; scope_message << "testing data : " << test_element_index++; SCOPED_TRACE(scope_message); @@ -389,7 +485,7 @@ } TEST(CBORReaderTest, TestTooMuchNestingError) { - static const std::vector<std::vector<uint8_t>> kZeroDepthCBORList = { + static const std::vector<uint8_t> kZeroDepthCBORList[] = { // Unsigned int with value 100. {0x18, 0x64}, // CBOR bytestring of length 4. @@ -403,7 +499,7 @@ }; int test_element_index = 0; - for (auto zero_depth_data : kZeroDepthCBORList) { + for (const auto& zero_depth_data : kZeroDepthCBORList) { testing::Message scope_message; scope_message << "testing zero nested data : " << test_element_index++; SCOPED_TRACE(scope_message); @@ -444,35 +540,44 @@ } TEST(CBORReaderTest, TestOutOfOrderKeyError) { - static const std::vector<uint8_t> kMapWithUnsortedKey = { + static const std::vector<uint8_t> kMapsWithUnsortedKeys[] = { // clang-format off - 0xa6, // map of 6 pairs: - 0x60, // "" - 0x61, 0x2e, // "." + {0xa2, // map with 2 keys with same major type and length + 0x61, 0x62, // key "b" + 0x61, 0x42, // value :"B" - 0x61, 0x62, // "b" - 0x61, 0x42, // "B" + 0x61, 0x61, // key "a" (out of order byte-wise lexically) + 0x61, 0x45 // value "E" + }, + {0xa2, // map with 2 keys with different major type + 0x61, 0x62, // key "b" + 0x02, // value 2 - 0x61, 0x63, // "c" - 0x61, 0x43, // "C" + // key 1000 (out of order since lower major type sorts first) + 0x19, 0x03, 0xe8, + 0x61, 0x61, // value a + }, + {0xa2, // map with 2 keys with same major type + 0x19, 0x03, 0xe8, // key 1000 (out of order due to longer length) + 0x61, 0x61, //value "a" - 0x61, 0x64, // "d" - 0x61, 0x44, // "D" - - 0x61, 0x61, // "a" (Out of order key) - 0x61, 0x45, // "E" - - 0x62, 0x61, 0x61, // "aa" - 0x62, 0x41, 0x41, // "AA" - // clang-format on + 0x0a, // key 10 + 0x61, 0x62}, // value "b" + //clang-format on }; + int test_element_index = 0; CBORReader::DecoderError error_code; + for (const auto& unsorted_map : kMapsWithUnsortedKeys) { + testing::Message scope_message; + scope_message << "testing unsorted map : " << test_element_index++; + SCOPED_TRACE(scope_message); - base::Optional<CBORValue> cbor = - CBORReader::Read(kMapWithUnsortedKey, &error_code); - EXPECT_FALSE(cbor.has_value()); - EXPECT_EQ(error_code, CBORReader::DecoderError::OUT_OF_ORDER_KEY); + base::Optional<CBORValue> cbor = + CBORReader::Read(unsorted_map, &error_code); + EXPECT_FALSE(cbor.has_value()); + EXPECT_EQ(error_code, CBORReader::DecoderError::OUT_OF_ORDER_KEY); + } } TEST(CBORReaderTest, TestDuplicateKeyError) { @@ -510,7 +615,7 @@ // Leveraging Markus Kuhn’s UTF-8 decoder stress test. See // http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt for details. TEST(CBORReaderTest, TestIncorrectStringEncodingError) { - static const std::vector<std::vector<uint8_t>> utf8_character_encodings = { + static const std::vector<uint8_t> utf8_character_encodings[] = { // Corresponds to utf8 encoding of "" (section 2.3.1 of stress test). {0x63, 0xED, 0x9F, 0xBF}, // Corresponds to utf8 encoding of "" (section 2.3.2 of stress test). @@ -521,7 +626,7 @@ int test_element_index = 0; CBORReader::DecoderError error_code; - for (auto cbor_byte : utf8_character_encodings) { + for (const auto& cbor_byte : utf8_character_encodings) { testing::Message scope_message; scope_message << "testing cbor data utf8 encoding : " << test_element_index++; @@ -542,7 +647,7 @@ } TEST(CBORReaderTest, TestExtraneousCBORDataError) { - static const std::vector<std::vector<uint8_t>> zero_padded_cbor_list = { + static const std::vector<uint8_t> zero_padded_cbor_list[] = { // 1 extra byte after a 2-byte unsigned int. {0x19, 0x03, 0x05, 0x00}, // 1 extra byte after a 4-byte cbor byte array. @@ -556,7 +661,7 @@ }; int test_element_index = 0; - for (auto extraneous_cbor_data : zero_padded_cbor_list) { + for (const auto& extraneous_cbor_data : zero_padded_cbor_list) { testing::Message scope_message; scope_message << "testing cbor extraneous data : " << test_element_index++; SCOPED_TRACE(scope_message);
diff --git a/content/browser/webauth/cbor/cbor_values.cc b/content/browser/webauth/cbor/cbor_values.cc index 790a23f..2e64ac0 100644 --- a/content/browser/webauth/cbor/cbor_values.cc +++ b/content/browser/webauth/cbor/cbor_values.cc
@@ -74,7 +74,8 @@ CBORValue::CBORValue(const MapValue& in_map) : type_(Type::MAP), map_value_() { map_value_.reserve(in_map.size()); for (const auto& it : in_map) - map_value_.emplace_hint(map_value_.end(), it.first, it.second.Clone()); + map_value_.emplace_hint(map_value_.end(), it.first.Clone(), + it.second.Clone()); } CBORValue::CBORValue(MapValue&& in_map) noexcept @@ -111,7 +112,7 @@ return CBORValue(); } -uint64_t CBORValue::GetUnsigned() const { +const uint64_t& CBORValue::GetUnsigned() const { CHECK(is_unsigned()); return unsigned_value_; }
diff --git a/content/browser/webauth/cbor/cbor_values.h b/content/browser/webauth/cbor/cbor_values.h index 83bbd49..bea7b38c 100644 --- a/content/browser/webauth/cbor/cbor_values.h +++ b/content/browser/webauth/cbor/cbor_values.h
@@ -29,8 +29,7 @@ // // The sort order defined in CTAP is: // • If the major types are different, the one with the lower value in - // numerical order sorts earlier. (Moot in this code because all keys - // are strings.) + // numerical order sorts earlier. // • If two keys have different lengths, the shorter one sorts earlier. // • If two keys have the same length, the one with the lower value in // (byte-wise) lexical order sorts earlier. @@ -38,17 +37,32 @@ // See section 6 of https://fidoalliance.org/specs/fido-v2.0-rd-20170927/ // fido-client-to-authenticator-protocol-v2.0-rd-20170927.html. // - // The sort order defined in - // https://tools.ietf.org/html/rfc7049#section-3.9 is similar to the CTAP - // order implemented here, but it sorts purely by serialised key and - // doesn't specify that major types are compared first. Thus the shortest - // key sorts first by the RFC rules (irrespective of the major type), but - // may not by CTAP rules. - bool operator()(const base::StringPiece& a, - const base::StringPiece& b) const { - const size_t a_size = a.size(); - const size_t b_size = b.size(); - return std::tie(a_size, a) < std::tie(b_size, b); + // THE CTAP SORT ORDER IMPLEMENTED HERE DIFFERS FROM THE CANONICAL CBOR + // ORDER defined in https://tools.ietf.org/html/rfc7049#section-3.9, in that + // the latter sorts purely by serialised key and doesn't specify that major + // types are compared first. Thus the shortest key sorts first by the RFC + // rules (irrespective of the major type), but may not by CTAP rules. + bool operator()(const CBORValue& a, const CBORValue& b) const { + DCHECK((a.is_unsigned() || a.is_string()) && + (b.is_unsigned() || b.is_string())); + if (a.type() != b.type()) + return a.type() < b.type(); + switch (a.type()) { + case Type::UNSIGNED: + return a.GetUnsigned() < b.GetUnsigned(); + case Type::STRING: { + const auto& a_str = a.GetString(); + const size_t a_length = a_str.size(); + const auto& b_str = b.GetString(); + const size_t b_length = b_str.size(); + return std::tie(a_length, a_str) < std::tie(b_length, b_str); + } + default: + break; + } + + NOTREACHED(); + return false; } using is_transparent = void; @@ -56,7 +70,7 @@ using BinaryValue = std::vector<uint8_t>; using ArrayValue = std::vector<CBORValue>; - using MapValue = base::flat_map<std::string, CBORValue, CTAPLess>; + using MapValue = base::flat_map<CBORValue, CBORValue, CTAPLess>; enum class Type { UNSIGNED = 0, @@ -107,7 +121,7 @@ bool is_map() const { return type() == Type::MAP; } // These will all fatally assert if the type doesn't match. - uint64_t GetUnsigned() const; + const uint64_t& GetUnsigned() const; const BinaryValue& GetBytestring() const; // Returned string may contain NUL characters. const std::string& GetString() const;
diff --git a/content/browser/webauth/cbor/cbor_values_unittest.cc b/content/browser/webauth/cbor/cbor_values_unittest.cc index 7500850..6894896 100644 --- a/content/browser/webauth/cbor/cbor_values_unittest.cc +++ b/content/browser/webauth/cbor/cbor_values_unittest.cc
@@ -32,34 +32,34 @@ // Test constructors TEST(CBORValuesTest, ConstructUnsigned) { CBORValue value(37); - EXPECT_EQ(CBORValue::Type::UNSIGNED, value.type()); + ASSERT_EQ(CBORValue::Type::UNSIGNED, value.type()); EXPECT_EQ(37u, value.GetUnsigned()); } TEST(CBORValuesTest, ConstructStringFromConstCharPtr) { const char* str = "foobar"; CBORValue value(str); - EXPECT_EQ(CBORValue::Type::STRING, value.type()); + ASSERT_EQ(CBORValue::Type::STRING, value.type()); EXPECT_EQ("foobar", value.GetString()); } TEST(CBORValuesTest, ConstructStringFromStdStringConstRef) { std::string str = "foobar"; CBORValue value(str); - EXPECT_EQ(CBORValue::Type::STRING, value.type()); + ASSERT_EQ(CBORValue::Type::STRING, value.type()); EXPECT_EQ("foobar", value.GetString()); } TEST(CBORValuesTest, ConstructStringFromStdStringRefRef) { std::string str = "foobar"; CBORValue value(std::move(str)); - EXPECT_EQ(CBORValue::Type::STRING, value.type()); + ASSERT_EQ(CBORValue::Type::STRING, value.type()); EXPECT_EQ("foobar", value.GetString()); } TEST(CBORValuesTest, ConstructBytestring) { CBORValue value(CBORValue::BinaryValue({0xF, 0x0, 0x0, 0xB, 0xA, 0x2})); - EXPECT_EQ(CBORValue::Type::BYTE_STRING, value.type()); + ASSERT_EQ(CBORValue::Type::BYTE_STRING, value.type()); EXPECT_EQ(CBORValue::BinaryValue({0xF, 0x0, 0x0, 0xB, 0xA, 0x2}), value.GetBytestring()); } @@ -69,42 +69,43 @@ array.emplace_back(CBORValue("foo")); { CBORValue value(array); - EXPECT_EQ(CBORValue::Type::ARRAY, value.type()); - EXPECT_EQ(1u, value.GetArray().size()); - EXPECT_EQ(CBORValue::Type::STRING, value.GetArray()[0].type()); + ASSERT_EQ(CBORValue::Type::ARRAY, value.type()); + ASSERT_EQ(1u, value.GetArray().size()); + ASSERT_EQ(CBORValue::Type::STRING, value.GetArray()[0].type()); EXPECT_EQ("foo", value.GetArray()[0].GetString()); } array.back() = CBORValue("bar"); { CBORValue value(std::move(array)); - EXPECT_EQ(CBORValue::Type::ARRAY, value.type()); - EXPECT_EQ(1u, value.GetArray().size()); - EXPECT_EQ(CBORValue::Type::STRING, value.GetArray()[0].type()); + ASSERT_EQ(CBORValue::Type::ARRAY, value.type()); + ASSERT_EQ(1u, value.GetArray().size()); + ASSERT_EQ(CBORValue::Type::STRING, value.GetArray()[0].type()); EXPECT_EQ("bar", value.GetArray()[0].GetString()); } } TEST(CBORValuesTest, ConstructMap) { CBORValue::MapValue map; - map.emplace("foo", CBORValue("bar")); + const CBORValue key_foo("foo"); + map[CBORValue("foo")] = CBORValue("bar"); { CBORValue value(map); - EXPECT_EQ(CBORValue::Type::MAP, value.type()); - ASSERT_EQ(value.GetMap().count("foo"), 1u); - EXPECT_EQ(CBORValue::Type::STRING, - value.GetMap().find("foo")->second.type()); - EXPECT_EQ("bar", value.GetMap().find("foo")->second.GetString()); + ASSERT_EQ(CBORValue::Type::MAP, value.type()); + ASSERT_EQ(value.GetMap().count(key_foo), 1u); + ASSERT_EQ(CBORValue::Type::STRING, + value.GetMap().find(key_foo)->second.type()); + EXPECT_EQ("bar", value.GetMap().find(key_foo)->second.GetString()); } - map["foo"] = CBORValue("baz"); + map[CBORValue("foo")] = CBORValue("baz"); { CBORValue value(std::move(map)); - EXPECT_EQ(CBORValue::Type::MAP, value.type()); - ASSERT_EQ(value.GetMap().count("foo"), 1u); - EXPECT_EQ(CBORValue::Type::STRING, - value.GetMap().find("foo")->second.type()); - EXPECT_EQ("baz", value.GetMap().find("foo")->second.GetString()); + ASSERT_EQ(CBORValue::Type::MAP, value.type()); + ASSERT_EQ(value.GetMap().count(key_foo), 1u); + ASSERT_EQ(CBORValue::Type::STRING, + value.GetMap().find(key_foo)->second.type()); + EXPECT_EQ("baz", value.GetMap().find(key_foo)->second.GetString()); } } @@ -112,39 +113,39 @@ TEST(CBORValuesTest, CopyUnsigned) { CBORValue value(74); CBORValue copied_value(value.Clone()); - EXPECT_EQ(value.type(), copied_value.type()); + ASSERT_EQ(value.type(), copied_value.type()); EXPECT_EQ(value.GetUnsigned(), copied_value.GetUnsigned()); CBORValue blank; blank = value.Clone(); - EXPECT_EQ(value.type(), blank.type()); + ASSERT_EQ(value.type(), blank.type()); EXPECT_EQ(value.GetUnsigned(), blank.GetUnsigned()); } TEST(CBORValuesTest, CopyString) { CBORValue value("foobar"); CBORValue copied_value(value.Clone()); - EXPECT_EQ(value.type(), copied_value.type()); + ASSERT_EQ(value.type(), copied_value.type()); EXPECT_EQ(value.GetString(), copied_value.GetString()); CBORValue blank; blank = value.Clone(); - EXPECT_EQ(value.type(), blank.type()); + ASSERT_EQ(value.type(), blank.type()); EXPECT_EQ(value.GetString(), blank.GetString()); } TEST(CBORValuesTest, CopyBytestring) { CBORValue value(CBORValue::BinaryValue({0xF, 0x0, 0x0, 0xB, 0xA, 0x2})); CBORValue copied_value(value.Clone()); - EXPECT_EQ(value.type(), copied_value.type()); + ASSERT_EQ(value.type(), copied_value.type()); EXPECT_EQ(value.GetBytestring(), copied_value.GetBytestring()); CBORValue blank; blank = value.Clone(); - EXPECT_EQ(value.type(), blank.type()); + ASSERT_EQ(value.type(), blank.type()); EXPECT_EQ(value.GetBytestring(), blank.GetBytestring()); } @@ -154,7 +155,7 @@ CBORValue value(std::move(array)); CBORValue copied_value(value.Clone()); - EXPECT_EQ(1u, copied_value.GetArray().size()); + ASSERT_EQ(1u, copied_value.GetArray().size()); EXPECT_EQ(value.GetArray()[0].GetUnsigned(), copied_value.GetArray()[0].GetUnsigned()); @@ -165,23 +166,25 @@ TEST(CBORValuesTest, CopyMap) { CBORValue::MapValue map; - map.emplace("unsigned", CBORValue(123)); + CBORValue key_a("a"); + map[CBORValue("a")] = CBORValue(123); CBORValue value(std::move(map)); CBORValue copied_value(value.Clone()); EXPECT_EQ(1u, copied_value.GetMap().size()); - ASSERT_EQ(value.GetMap().count("unsigned"), 1u); - ASSERT_EQ(copied_value.GetMap().count("unsigned"), 1u); - EXPECT_EQ(value.GetMap().find("unsigned")->second.GetUnsigned(), - copied_value.GetMap().find("unsigned")->second.GetUnsigned()); + ASSERT_EQ(value.GetMap().count(key_a), 1u); + ASSERT_EQ(copied_value.GetMap().count(key_a), 1u); + ASSERT_TRUE(copied_value.GetMap().find(key_a)->second.is_unsigned()); + EXPECT_EQ(value.GetMap().find(key_a)->second.GetUnsigned(), + copied_value.GetMap().find(key_a)->second.GetUnsigned()); CBORValue blank; blank = value.Clone(); EXPECT_EQ(1u, blank.GetMap().size()); - ASSERT_EQ(value.GetMap().count("unsigned"), 1u); - ASSERT_EQ(copied_value.GetMap().count("unsigned"), 1u); - EXPECT_EQ(value.GetMap().find("unsigned")->second.GetUnsigned(), - copied_value.GetMap().find("unsigned")->second.GetUnsigned()); + ASSERT_EQ(blank.GetMap().count(key_a), 1u); + ASSERT_TRUE(blank.GetMap().find(key_a)->second.is_unsigned()); + EXPECT_EQ(value.GetMap().find(key_a)->second.GetUnsigned(), + blank.GetMap().find(key_a)->second.GetUnsigned()); } // Test move constructors and move-assignment @@ -227,24 +230,28 @@ TEST(CBORValuesTest, MoveConstructMap) { CBORValue::MapValue map; - map.emplace("unsigned", CBORValue(123)); + const CBORValue key_a("a"); + map[CBORValue("a")] = CBORValue(123); CBORValue value(std::move(map)); CBORValue moved_value(std::move(value)); - EXPECT_EQ(CBORValue::Type::MAP, moved_value.type()); - ASSERT_EQ(moved_value.GetMap().count("unsigned"), 1u); - EXPECT_EQ(123u, moved_value.GetMap().find("unsigned")->second.GetUnsigned()); + ASSERT_EQ(CBORValue::Type::MAP, moved_value.type()); + ASSERT_EQ(moved_value.GetMap().count(key_a), 1u); + ASSERT_TRUE(moved_value.GetMap().find(key_a)->second.is_unsigned()); + EXPECT_EQ(123u, moved_value.GetMap().find(key_a)->second.GetUnsigned()); } TEST(CBORValuesTest, MoveAssignMap) { CBORValue::MapValue map; - map.emplace("unsigned", CBORValue(123)); + const CBORValue key_a("a"); + map[CBORValue("a")] = CBORValue(123); CBORValue blank; blank = CBORValue(std::move(map)); - EXPECT_EQ(CBORValue::Type::MAP, blank.type()); - ASSERT_EQ(blank.GetMap().count("unsigned"), 1u); - EXPECT_EQ(123u, blank.GetMap().find("unsigned")->second.GetUnsigned()); + ASSERT_TRUE(blank.is_map()); + ASSERT_EQ(blank.GetMap().count(key_a), 1u); + ASSERT_TRUE(blank.GetMap().find(key_a)->second.is_unsigned()); + EXPECT_EQ(123u, blank.GetMap().find(key_a)->second.GetUnsigned()); } TEST(CBORValuesTest, MoveArray) {
diff --git a/content/browser/webauth/cbor/cbor_writer.cc b/content/browser/webauth/cbor/cbor_writer.cc index 514c38c..88faaf89 100644 --- a/content/browser/webauth/cbor/cbor_writer.cc +++ b/content/browser/webauth/cbor/cbor_writer.cc
@@ -81,7 +81,7 @@ StartItem(CBORValue::Type::MAP, map.size()); for (const auto& value : map) { - if (!EncodeCBOR(CBORValue(value.first), max_nesting_level - 1)) + if (!EncodeCBOR(value.first, max_nesting_level - 1)) return false; if (!EncodeCBOR(value.second, max_nesting_level - 1)) return false;
diff --git a/content/browser/webauth/cbor/cbor_writer_unittest.cc b/content/browser/webauth/cbor/cbor_writer_unittest.cc index a53d062..54595b1 100644 --- a/content/browser/webauth/cbor/cbor_writer_unittest.cc +++ b/content/browser/webauth/cbor/cbor_writer_unittest.cc
@@ -105,37 +105,78 @@ TEST(CBORWriterTest, TestWriteMapWithMapValue) { static const uint8_t kMapTestCaseCbor[] = { // clang-format off - 0xa6, // map of 6 pairs: - 0x60, // "" - 0x61, 0x2e, // "." + 0xAF, // map of 7 pairs: + 0x00, // key 0 + 0x61, 0x61, // value "a" - 0x61, 0x62, // "b" - 0x61, 0x42, // "B" + 0x17, // key 23 + 0x61, 0x62, // value "b" - 0x61, 0x63, // "c" - 0x61, 0x43, // "C" + 0x18, 0x18, // key 24 + 0x61, 0x63, // value "c" - 0x61, 0x64, // "d" - 0x61, 0x44, // "D" + 0x18, 0xFF, // key 255 + 0x61, 0x64, // value "d" - 0x61, 0x65, // "e" - 0x61, 0x45, // "E" + 0x19, 0x01, 0x00, // key 256 + 0x61, 0x65, // value "e" - 0x62, 0x61, 0x61, // "aa" - 0x62, 0x41, 0x41, // "AA" + 0x19, 0xFF, 0xFF, // key 65535 + 0x61, 0x66, // value "f" + + 0x1A, 0x00, 0x01, 0x00, 0x00, // key 65536 + 0x61, 0x67, // value "g" + + 0x1A, 0xFF, 0xFF, 0xFF, 0xFF, // key 4294967295 + 0x61, 0x68, // value "h" + + // key 4294967296 + 0x1B, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x61, 0x69, // value "i" + + 0x60, // key "" + 0x61, 0x2e, // value "." + + 0x61, 0x62, // key "b" + 0x61, 0x42, // value "B" + + 0x61, 0x63, // key "c" + 0x61, 0x43, // value "C" + + 0x61, 0x64, // key "d" + 0x61, 0x44, // value "D" + + 0x61, 0x65, // key "e" + 0x61, 0x45, // value "E" + + 0x62, 0x61, 0x61, // key "aa" + 0x62, 0x41, 0x41, // value "AA" // clang-format on }; CBORValue::MapValue map; // Shorter strings sort first in CTAP, thus the “aa” value should be // serialised last in the map. - map["aa"] = CBORValue("AA"); - map["d"] = CBORValue("D"); - map["b"] = CBORValue("B"); - map["e"] = CBORValue("E"); - map["c"] = CBORValue("C"); - // The empty string is shorter than all others, so should appear first in the - // serialisation. - map[""] = CBORValue("."); + map[CBORValue("aa")] = CBORValue("AA"); + map[CBORValue("d")] = CBORValue("D"); + map[CBORValue("b")] = CBORValue("B"); + map[CBORValue("e")] = CBORValue("E"); + map[CBORValue("c")] = CBORValue("C"); + // The empty string is shorter than all others, so should appear first among + // the strings. + map[CBORValue("")] = CBORValue("."); + // Map keys are sorted by major type, by byte length, and then by + // byte-wise lexical order. So all integer type keys should appear before + // key "". + map[CBORValue(uint64_t(0))] = CBORValue("a"); + map[CBORValue(23)] = CBORValue("b"); + map[CBORValue(24)] = CBORValue("c"); + map[CBORValue(255)] = CBORValue("d"); + map[CBORValue(256)] = CBORValue("e"); + map[CBORValue(65535)] = CBORValue("f"); + map[CBORValue(65536)] = CBORValue("g"); + map[CBORValue(4294967295)] = CBORValue("h"); + map[CBORValue(4294967296)] = CBORValue("i"); + auto cbor = CBORWriter::Write(CBORValue(map)); ASSERT_TRUE(cbor.has_value()); EXPECT_THAT(cbor.value(), testing::ElementsAreArray( @@ -156,11 +197,11 @@ // clang-format on }; CBORValue::MapValue map; - map["a"] = CBORValue(1); + map[CBORValue("a")] = CBORValue(1); CBORValue::ArrayValue array; array.push_back(CBORValue(2)); array.push_back(CBORValue(3)); - map["b"] = CBORValue(array); + map[CBORValue("b")] = CBORValue(array); auto cbor = CBORWriter::Write(CBORValue(map)); ASSERT_TRUE(cbor.has_value()); EXPECT_THAT(cbor.value(), @@ -185,11 +226,11 @@ // clang-format on }; CBORValue::MapValue map; - map["a"] = CBORValue(1); + map[CBORValue("a")] = CBORValue(1); CBORValue::MapValue nested_map; - nested_map["c"] = CBORValue(2); - nested_map["d"] = CBORValue(3); - map["b"] = CBORValue(nested_map); + nested_map[CBORValue("c")] = CBORValue(2); + nested_map[CBORValue("d")] = CBORValue(3); + map[CBORValue("b")] = CBORValue(nested_map); auto cbor = CBORWriter::Write(CBORValue(map)); ASSERT_TRUE(cbor.has_value()); EXPECT_THAT(cbor.value(), @@ -212,7 +253,7 @@ CBORValue::ArrayValue simple_array; simple_array.push_back(CBORValue(2)); CBORValue::MapValue simple_map; - simple_map["b"] = CBORValue(3); + simple_map[CBORValue("b")] = CBORValue(3); const CBORValue single_layer_cbor_map = CBORValue(simple_map); const CBORValue single_layer_cbor_array = CBORValue(simple_array); @@ -236,11 +277,11 @@ // "d": 3}} TEST(CBORWriterTest, NestedMaps) { CBORValue::MapValue cbor_map; - cbor_map["a"] = CBORValue(1); + cbor_map[CBORValue("a")] = CBORValue(1); CBORValue::MapValue nested_map; - nested_map["c"] = CBORValue(2); - nested_map["d"] = CBORValue(3); - cbor_map["b"] = CBORValue(nested_map); + nested_map[CBORValue("c")] = CBORValue(2); + nested_map[CBORValue("d")] = CBORValue(3); + cbor_map[CBORValue("b")] = CBORValue(nested_map); EXPECT_TRUE(CBORWriter::Write(CBORValue(cbor_map), 2).has_value()); EXPECT_FALSE(CBORWriter::Write(CBORValue(cbor_map), 1).has_value()); } @@ -257,10 +298,10 @@ CBORValue::MapValue cbor_map; CBORValue::MapValue nested_map; - cbor_map["a"] = CBORValue(1); - nested_map["c"] = CBORValue(2); - nested_map["d"] = CBORValue(3); - cbor_map["b"] = CBORValue(nested_map); + cbor_map[CBORValue("a")] = CBORValue(1); + nested_map[CBORValue("c")] = CBORValue(2); + nested_map[CBORValue("d")] = CBORValue(3); + cbor_map[CBORValue("b")] = CBORValue(nested_map); cbor_array.push_back(CBORValue(1)); cbor_array.push_back(CBORValue(2)); cbor_array.push_back(CBORValue(3)); @@ -286,18 +327,18 @@ CBORValue::ArrayValue inner_array; CBORValue::ArrayValue array; - map["a"] = CBORValue(1); - nested_map["c"] = CBORValue(2); - nested_map["d"] = CBORValue(3); - inner_nested_map["e"] = CBORValue(4); - inner_nested_map["f"] = CBORValue(5); + map[CBORValue("a")] = CBORValue(1); + nested_map[CBORValue("c")] = CBORValue(2); + nested_map[CBORValue("d")] = CBORValue(3); + inner_nested_map[CBORValue("e")] = CBORValue(4); + inner_nested_map[CBORValue("f")] = CBORValue(5); inner_array.push_back(CBORValue(6)); array.push_back(CBORValue(6)); array.push_back(CBORValue(7)); array.push_back(CBORValue(inner_array)); - inner_nested_map["g"] = CBORValue(array); - nested_map["h"] = CBORValue(inner_nested_map); - map["b"] = CBORValue(nested_map); + inner_nested_map[CBORValue("g")] = CBORValue(array); + nested_map[CBORValue("h")] = CBORValue(inner_nested_map); + map[CBORValue("b")] = CBORValue(nested_map); EXPECT_TRUE(CBORWriter::Write(CBORValue(map), 5).has_value()); EXPECT_FALSE(CBORWriter::Write(CBORValue(map), 4).has_value());
diff --git a/content/browser/webauth/ec_public_key.cc b/content/browser/webauth/ec_public_key.cc index 65c910ed..9082198 100644 --- a/content/browser/webauth/ec_public_key.cc +++ b/content/browser/webauth/ec_public_key.cc
@@ -41,9 +41,9 @@ std::vector<uint8_t> ECPublicKey::EncodeAsCBOR() { CBORValue::MapValue map; - map["alg"] = CBORValue(algorithm_.c_str()); - map["x"] = CBORValue(x_coordinate_); - map["y"] = CBORValue(y_coordinate_); + map[CBORValue("alg")] = CBORValue(algorithm_.c_str()); + map[CBORValue("x")] = CBORValue(x_coordinate_); + map[CBORValue("y")] = CBORValue(y_coordinate_); auto cbor = CBORWriter::Write(CBORValue(map)); DCHECK(cbor.has_value()); return cbor.value();
diff --git a/content/browser/webauth/fido_attestation_statement.cc b/content/browser/webauth/fido_attestation_statement.cc index f4f00d44..13e88f98 100644 --- a/content/browser/webauth/fido_attestation_statement.cc +++ b/content/browser/webauth/fido_attestation_statement.cc
@@ -87,13 +87,13 @@ CBORValue::MapValue FidoAttestationStatement::GetAsCBORMap() { CBORValue::MapValue attstmt_map; - attstmt_map[kSignatureKey] = CBORValue(signature_); + attstmt_map[CBORValue(kSignatureKey)] = CBORValue(signature_); std::vector<CBORValue> array; for (auto cert : x509_certificates_) { array.push_back(CBORValue(cert)); } - attstmt_map[kX509CertKey] = CBORValue(array); + attstmt_map[CBORValue(kX509CertKey)] = CBORValue(array); return attstmt_map; }
diff --git a/content/browser/webrtc/webrtc_event_log_manager_unittest.cc b/content/browser/webrtc/webrtc_event_log_manager_unittest.cc index 0ade2bc7..9acc88a8 100644 --- a/content/browser/webrtc/webrtc_event_log_manager_unittest.cc +++ b/content/browser/webrtc/webrtc_event_log_manager_unittest.cc
@@ -730,9 +730,9 @@ EXPECT_TRUE(base::IsDirectoryEmpty(base_dir_)); } -#if defined(OS_POSIX) +#if defined(OS_POSIX) && !defined(OS_FUCHSIA) TEST_F(WebRtcEventLogManagerTest, LocalLogLegalPathWithoutPermissionsSanity) { - // Remove writing permissions from the entire directory. + // Remove write permissions from the entire directory. int permissions; ASSERT_TRUE(base::GetPosixFilePermissions(base_dir_, &permissions)); constexpr int write_permissions = base::FILE_PERMISSION_WRITE_BY_USER | @@ -766,7 +766,7 @@ EXPECT_TRUE(DisableLocalLogging()); EXPECT_TRUE(base::IsDirectoryEmpty(base_dir_)); } -#endif +#endif // defined(OS_POSIX) && !defined(OS_FUCHSIA) TEST_F(WebRtcEventLogManagerTest, LocalLogEmptyStringHandledGracefully) { NiceMock<MockLocalLogsObserver> observer;
diff --git a/content/child/blink_platform_impl.cc b/content/child/blink_platform_impl.cc index c9cbd793..676eb6a 100644 --- a/content/child/blink_platform_impl.cc +++ b/content/child/blink_platform_impl.cc
@@ -17,6 +17,8 @@ #include "base/memory/singleton.h" #include "base/metrics/user_metrics_action.h" #include "base/rand_util.h" +#include "base/run_loop.h" +#include "base/sequence_checker.h" #include "base/single_thread_task_runner.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" @@ -519,6 +521,36 @@ {"placeholderIcon", IDR_PLACEHOLDER_ICON, ui::SCALE_FACTOR_100P, false}, }; +class NestedMessageLoopRunnerImpl + : public blink::Platform::NestedMessageLoopRunner { + public: + NestedMessageLoopRunnerImpl() = default; + + ~NestedMessageLoopRunnerImpl() override { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + } + + void Run() override { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + base::RunLoop* const previous_run_loop = run_loop_; + base::RunLoop run_loop(base::RunLoop::Type::kNestableTasksAllowed); + run_loop_ = &run_loop; + run_loop.Run(); + run_loop_ = previous_run_loop; + } + + void QuitNow() override { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + DCHECK(run_loop_); + run_loop_->Quit(); + } + + private: + base::RunLoop* run_loop_ = nullptr; + + SEQUENCE_CHECKER(sequence_checker_); +}; + } // namespace WebData BlinkPlatformImpl::GetDataResource(const char* name) { @@ -741,4 +773,9 @@ return io_thread_task_runner_; } +std::unique_ptr<blink::Platform::NestedMessageLoopRunner> +BlinkPlatformImpl::CreateNestedMessageLoopRunner() const { + return std::make_unique<NestedMessageLoopRunnerImpl>(); +} + } // namespace content
diff --git a/content/child/blink_platform_impl.h b/content/child/blink_platform_impl.h index a70bae6..6515ffd 100644 --- a/content/child/blink_platform_impl.h +++ b/content/child/blink_platform_impl.h
@@ -116,6 +116,8 @@ void WaitUntilWebThreadTLSUpdate(blink::scheduler::WebThreadBase* thread); scoped_refptr<base::SingleThreadTaskRunner> GetIOTaskRunner() const override; + std::unique_ptr<NestedMessageLoopRunner> CreateNestedMessageLoopRunner() + const override; private: void UpdateWebThreadTLS(blink::WebThread* thread, base::WaitableEvent* event);
diff --git a/content/common/BUILD.gn b/content/common/BUILD.gn index bd8ad82..7cb9abbf 100644 --- a/content/common/BUILD.gn +++ b/content/common/BUILD.gn
@@ -289,8 +289,6 @@ "service_worker/service_worker_types.h", "service_worker/service_worker_utils.cc", "service_worker/service_worker_utils.h", - "site_isolation_policy.cc", - "site_isolation_policy.h", "speech_recognition_messages.h", "swapped_out_messages.cc", "swapped_out_messages.h",
diff --git a/content/common/content_switches_internal.cc b/content/common/content_switches_internal.cc index 5e8ebae..93bcf97e 100644 --- a/content/common/content_switches_internal.cc +++ b/content/common/content_switches_internal.cc
@@ -7,7 +7,6 @@ #include <string> #include "base/command_line.h" -#include "base/feature_list.h" #include "base/metrics/field_trial.h" #include "base/metrics/field_trial_params.h" #include "base/strings/string_number_conversions.h" @@ -17,9 +16,11 @@ #include "base/strings/utf_string_conversions.h" #include "build/build_config.h" #include "content/public/common/content_switches.h" +#include "content/public/common/use_zoom_for_dsf_policy.h" #if defined(OS_ANDROID) #include "base/debug/debugger.h" +#include "base/feature_list.h" #endif #if defined(OS_POSIX) && !defined(OS_ANDROID) @@ -35,22 +36,6 @@ namespace { -#if defined(OS_WIN) -const base::Feature kUseZoomForDsfEnabledByDefault { - "use-zoom-for-dsf enabled by default", base::FEATURE_ENABLED_BY_DEFAULT -}; -#endif - -bool IsUseZoomForDSFEnabledByDefault() { -#if defined(OS_LINUX) - return true; -#elif defined(OS_WIN) - return base::FeatureList::IsEnabled(kUseZoomForDsfEnabledByDefault); -#else - return false; -#endif -} - #if defined(ANDROID) const base::Feature kProgressBarCompletionResourcesBeforeDOMContentLoaded { "progress-bar-completion-resources-before-domContentLoaded", @@ -111,16 +96,10 @@ } bool IsUseZoomForDSFEnabled() { - static bool use_zoom_for_dsf_enabled_by_default = - IsUseZoomForDSFEnabledByDefault(); - base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - bool enabled = - (command_line->HasSwitch(switches::kEnableUseZoomForDSF) || - use_zoom_for_dsf_enabled_by_default) && - command_line->GetSwitchValueASCII( - switches::kEnableUseZoomForDSF) != "false"; - - return enabled; + // TODO(jaebaek): Remove this IsUseZoomForDSFEnabled() and use + // UseZoomForDSFEnabled() in content/public/common/use_zoom_for_dsf_policy.h + // instead. + return content::UseZoomForDSFEnabled(); } ProgressBarCompletion GetProgressBarCompletionPolicy() {
diff --git a/content/common/media/media_stream_param_traits.h b/content/common/media/media_stream_param_traits.h index dcc50242..146f5cec 100644 --- a/content/common/media/media_stream_param_traits.h +++ b/content/common/media/media_stream_param_traits.h
@@ -27,7 +27,6 @@ IPC_STRUCT_TRAITS_MEMBER(matched_output_device_id) IPC_STRUCT_TRAITS_MEMBER(name) IPC_STRUCT_TRAITS_MEMBER(input) - IPC_STRUCT_TRAITS_MEMBER(matched_output) IPC_STRUCT_TRAITS_MEMBER(session_id) IPC_STRUCT_TRAITS_MEMBER(camera_calibration) IPC_STRUCT_TRAITS_END()
diff --git a/content/common/render_widget_surface_properties.cc b/content/common/render_widget_surface_properties.cc index 3650911..2848b01 100644 --- a/content/common/render_widget_surface_properties.cc +++ b/content/common/render_widget_surface_properties.cc
@@ -55,4 +55,83 @@ return !(*this == other); } +std::string RenderWidgetSurfaceProperties::ToDiffString( + const RenderWidgetSurfaceProperties& other) const { + if (*this == other) + return std::string(); + + std::ostringstream stream; + stream << "RenderWidgetSurfaceProperties("; + uint32_t changed_properties = 0; + if (size != other.size) { + stream << "size(this: " << size.ToString() + << ", other: " << other.size.ToString() << ")"; + ++changed_properties; + } + + if (device_scale_factor != other.device_scale_factor) { + if (changed_properties > 0) + stream << ", "; + stream << "device_scale_factor(this: " << device_scale_factor + << ", other: " << other.device_scale_factor << ")"; + ++changed_properties; + } + +#ifdef OS_ANDROID + if (top_controls_height != other.top_controls_height) { + if (changed_properties > 0) + stream << ", "; + stream << "top_controls_height(this: " << top_controls_height + << ", other: " << other.top_controls_height << ")"; + ++changed_properties; + } + + if (top_controls_shown_ratio != other.top_controls_shown_ratio) { + if (changed_properties > 0) + stream << ", "; + stream << "top_controls_shown_ratio(this: " << top_controls_shown_ratio + << ", other: " << other.top_controls_shown_ratio << ")"; + ++changed_properties; + } + + if (bottom_controls_height != other.bottom_controls_height) { + if (changed_properties > 0) + stream << ", "; + stream << "bottom_controls_height(this: " << bottom_controls_height + << ", other: " << other.bottom_controls_height << ")"; + ++changed_properties; + } + + if (bottom_controls_shown_ratio != other.bottom_controls_shown_ratio) { + if (changed_properties > 0) + stream << ", "; + stream << "bottom_controls_shown_ratio(this: " + << bottom_controls_shown_ratio + << ", other: " << other.bottom_controls_shown_ratio << ")"; + ++changed_properties; + } + + if (selection != other.selection) { + if (changed_properties > 0) + stream << ", "; + stream << "selection(this: " << selection.ToString() + << ", other: " << other.selection.ToString() << ")"; + ++changed_properties; + } + + if (has_transparent_background != other.has_transparent_background) { + if (changed_properties > 0) + stream << ", "; + stream << "has_transparent_background(this: " << has_transparent_background + << ", other: " << other.has_transparent_background << ")"; + ++changed_properties; + } + +#endif + + stream << ")"; + + return stream.str(); +} + } // namespace content
diff --git a/content/common/render_widget_surface_properties.h b/content/common/render_widget_surface_properties.h index f35294d..da357db 100644 --- a/content/common/render_widget_surface_properties.h +++ b/content/common/render_widget_surface_properties.h
@@ -26,6 +26,8 @@ bool operator==(const RenderWidgetSurfaceProperties& other) const; bool operator!=(const RenderWidgetSurfaceProperties& other) const; + std::string ToDiffString(const RenderWidgetSurfaceProperties& other) const; + gfx::Size size; float device_scale_factor = 0; #ifdef OS_ANDROID
diff --git a/content/common/service_worker/service_worker_fetch_response_callback.mojom b/content/common/service_worker/service_worker_fetch_response_callback.mojom index dce8a79..f592e8e 100644 --- a/content/common/service_worker/service_worker_fetch_response_callback.mojom +++ b/content/common/service_worker/service_worker_fetch_response_callback.mojom
@@ -35,7 +35,7 @@ OnResponseStream(ServiceWorkerResponse response, blink.mojom.ServiceWorkerStreamHandle body_as_stream, mojo.common.mojom.Time dispatch_event_time); - // Provides no response to the request. The browser will fall back to the + // Provides no response to the request. The callee should fall back to the // network. OnFallback(mojo.common.mojom.Time dispatch_event_time); };
diff --git a/content/gpu/BUILD.gn b/content/gpu/BUILD.gn index 63838ae..926d8057 100644 --- a/content/gpu/BUILD.gn +++ b/content/gpu/BUILD.gn
@@ -102,15 +102,14 @@ "//third_party/wtl:wtl_includes", ] libs = [ "setupapi.lib" ] - deps += [ - "//sandbox", - "//third_party/angle:libEGL", - "//third_party/angle:libGLESv2", - ] + deps += [ "//sandbox" ] } if (use_x11) { - deps += [ "//ui/events/platform/x11" ] + deps += [ + "//ui/events/platform/x11", + "//ui/gfx/x", + ] } if (use_ozone) {
diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc index 96dc1274..fbb5378 100644 --- a/content/gpu/gpu_main.cc +++ b/content/gpu/gpu_main.cc
@@ -72,8 +72,9 @@ #endif #if defined(USE_X11) -#include "ui/base/x/x11_util.h" // nogncheck -#include "ui/gfx/x/x11_switches.h" // nogncheck +#include "ui/base/x/x11_util.h" // nogncheck +#include "ui/gfx/x/x11_connection.h" // nogncheck +#include "ui/gfx/x/x11_switches.h" // nogncheck #endif #if defined(OS_LINUX) @@ -240,6 +241,11 @@ main_message_loop.reset( new base::MessageLoop(base::MessageLoop::TYPE_DEFAULT)); #elif defined(USE_X11) + // Depending on how Chrome is running there are multiple threads that can + // make Xlib function calls. Call XInitThreads() here to be safe, even if + // some configurations don't strictly need it. + gfx::InitializeThreadedX11(); + // We need a UI loop so that we can grab the Expose events. See GLSurfaceGLX // and https://crbug.com/326995. ui::SetDefaultX11ErrorHandlers();
diff --git a/content/network/url_loader_unittest.cc b/content/network/url_loader_unittest.cc index 8233d4d7c..53d8bc5 100644 --- a/content/network/url_loader_unittest.cc +++ b/content/network/url_loader_unittest.cc
@@ -166,7 +166,9 @@ public: SimpleDataPipeGetter(const std::string& str, network::mojom::DataPipeGetterRequest request) - : str_(str), binding_(this, std::move(request)) {} + : str_(str) { + bindings_.AddBinding(this, std::move(request)); + } ~SimpleDataPipeGetter() override = default; // network::mojom::DataPipeGetter implementation: @@ -177,9 +179,13 @@ std::move(callback).Run(net::OK, str_.length()); } + void Clone(network::mojom::DataPipeGetterRequest request) override { + bindings_.AddBinding(this, std::move(request)); + } + private: std::string str_; - mojo::Binding<network::mojom::DataPipeGetter> binding_; + mojo::BindingSet<network::mojom::DataPipeGetter> bindings_; DISALLOW_COPY_AND_ASSIGN(SimpleDataPipeGetter); };
diff --git a/content/public/android/java/src/org/chromium/content/common/ContentSwitches.java b/content/public/android/java/src/org/chromium/content/common/ContentSwitches.java index cec7615..6b4dced 100644 --- a/content/public/android/java/src/org/chromium/content/common/ContentSwitches.java +++ b/content/public/android/java/src/org/chromium/content/common/ContentSwitches.java
@@ -61,9 +61,6 @@ // Native switch kGPUProcess public static final String SWITCH_GPU_PROCESS = "gpu-process"; - // Native switch kEnableUseZoomForDSF - public static final String ENABLE_USE_ZOOM_FOR_DSF = "enable-use-zoom-for-dsf"; - // Use fake device for Media Stream to replace actual camera and microphone. public static final String USE_FAKE_DEVICE_FOR_MEDIA_STREAM = "use-fake-device-for-media-stream";
diff --git a/content/public/browser/security_style_explanation.cc b/content/public/browser/security_style_explanation.cc index 9d497471..0309bb6 100644 --- a/content/public/browser/security_style_explanation.cc +++ b/content/public/browser/security_style_explanation.cc
@@ -11,16 +11,25 @@ SecurityStyleExplanation::SecurityStyleExplanation( const std::string& summary, const std::string& description) - : summary(summary), + : SecurityStyleExplanation(std::string(), summary, description) {} + +SecurityStyleExplanation::SecurityStyleExplanation( + const std::string& title, + const std::string& summary, + const std::string& description) + : title(title), + summary(summary), description(description), mixed_content_type(blink::WebMixedContentContextType::kNotMixedContent) {} SecurityStyleExplanation::SecurityStyleExplanation( + const std::string& title, const std::string& summary, const std::string& description, scoped_refptr<net::X509Certificate> certificate, blink::WebMixedContentContextType mixed_content_type) - : summary(summary), + : title(title), + summary(summary), description(description), certificate(certificate), mixed_content_type(mixed_content_type) {}
diff --git a/content/public/browser/security_style_explanation.h b/content/public/browser/security_style_explanation.h index 9f0b12b..bdf826ff 100644 --- a/content/public/browser/security_style_explanation.h +++ b/content/public/browser/security_style_explanation.h
@@ -22,7 +22,11 @@ SecurityStyleExplanation(); SecurityStyleExplanation(const std::string& summary, const std::string& description); + SecurityStyleExplanation(const std::string& title, + const std::string& summary, + const std::string& description); SecurityStyleExplanation( + const std::string& title, const std::string& summary, const std::string& description, scoped_refptr<net::X509Certificate> certificate, @@ -31,6 +35,7 @@ SecurityStyleExplanation& operator=(const SecurityStyleExplanation& other); ~SecurityStyleExplanation(); + std::string title; std::string summary; std::string description; // |certificate| indicates that this explanation has an associated
diff --git a/content/public/common/BUILD.gn b/content/public/common/BUILD.gn index 20299d4d..8e241fe 100644 --- a/content/public/common/BUILD.gn +++ b/content/public/common/BUILD.gn
@@ -243,6 +243,8 @@ "url_loader_throttle.h", "url_utils.cc", "url_utils.h", + "use_zoom_for_dsf_policy.cc", + "use_zoom_for_dsf_policy.h", "user_agent.h", "web_preferences.cc", "web_preferences.h",
diff --git a/content/public/common/common_param_traits_macros.h b/content/public/common/common_param_traits_macros.h index e41614f..22db79ee 100644 --- a/content/public/common/common_param_traits_macros.h +++ b/content/public/common/common_param_traits_macros.h
@@ -196,7 +196,7 @@ IPC_STRUCT_TRAITS_MEMBER(navigate_on_drag_drop) IPC_STRUCT_TRAITS_MEMBER(spatial_navigation_enabled) IPC_STRUCT_TRAITS_MEMBER(v8_cache_options) - IPC_STRUCT_TRAITS_MEMBER(pepper_accelerated_video_decode_enabled) + IPC_STRUCT_TRAITS_MEMBER(accelerated_video_decode_enabled) IPC_STRUCT_TRAITS_MEMBER(animation_policy) IPC_STRUCT_TRAITS_MEMBER(user_gesture_required_for_presentation) IPC_STRUCT_TRAITS_MEMBER(text_track_margin_percentage)
diff --git a/content/public/common/media_stream_request.h b/content/public/common/media_stream_request.h index 10e575d4..71ce9fc 100644 --- a/content/public/common/media_stream_request.h +++ b/content/public/common/media_stream_request.h
@@ -119,25 +119,17 @@ // The device id of a matched output device if any (otherwise empty). // Only applicable to audio devices. + // TODO(c.padhi): Change this to base::Optional. http://crbug.com/793255. std::string matched_output_device_id; // The device's "friendly" name. Not guaranteed to be unique. std::string name; - // These below two member variables are valid only when the type of device is - // audio (i.e. IsAudioInputMediaType returns true). - - // Contains the device properties of the capture device. + // Contains the device properties of the capture device. It's valid only when + // the type of device is audio (i.e. IsAudioInputMediaType returns true). media::AudioParameters input = media::AudioParameters::UnavailableDeviceParams(); - // If the capture device has an associated output device (e.g. headphones), - // this will contain the properties for the output device. If no such device - // exists (e.g. webcam w/mic), then the value of this member will be all - // zeros. - media::AudioParameters matched_output = - media::AudioParameters::UnavailableDeviceParams(); - // Id for this capture session. Unique for all sessions of the same type. int session_id = kNoId;
diff --git a/content/public/common/use_zoom_for_dsf_policy.cc b/content/public/common/use_zoom_for_dsf_policy.cc new file mode 100644 index 0000000..92f8d53 --- /dev/null +++ b/content/public/common/use_zoom_for_dsf_policy.cc
@@ -0,0 +1,48 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/public/common/use_zoom_for_dsf_policy.h" + +#include "base/command_line.h" +#include "build/build_config.h" +#include "content/public/common/content_switches.h" + +#if defined(OS_WIN) +#include "base/feature_list.h" +#endif + +namespace { + +#if defined(OS_WIN) +const base::Feature kUseZoomForDsfEnabledByDefault{ + "use-zoom-for-dsf enabled by default", base::FEATURE_ENABLED_BY_DEFAULT}; +#endif + +bool IsUseZoomForDSFEnabledByDefault() { +#if defined(OS_LINUX) + return true; +#elif defined(OS_WIN) + return base::FeatureList::IsEnabled(kUseZoomForDsfEnabledByDefault); +#else + return false; +#endif +} + +} // namespace + +namespace content { + +bool UseZoomForDSFEnabled() { + static bool use_zoom_for_dsf_enabled_by_default = + IsUseZoomForDSFEnabledByDefault(); + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); + bool enabled = (command_line->HasSwitch(switches::kEnableUseZoomForDSF) || + use_zoom_for_dsf_enabled_by_default) && + command_line->GetSwitchValueASCII( + switches::kEnableUseZoomForDSF) != "false"; + + return enabled; +} + +} // namespace content
diff --git a/content/public/common/use_zoom_for_dsf_policy.h b/content/public/common/use_zoom_for_dsf_policy.h new file mode 100644 index 0000000..cc28433 --- /dev/null +++ b/content/public/common/use_zoom_for_dsf_policy.h
@@ -0,0 +1,19 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_PUBLIC_COMMON_USE_ZOOM_FOR_DSF_POLICY_H_ +#define CONTENT_PUBLIC_COMMON_USE_ZOOM_FOR_DSF_POLICY_H_ + +#include "content/common/content_export.h" + +// A centralized file for base helper methods and policy decisions about use +// zoom for DSF (i.e., Device Scale Factor). + +namespace content { + +CONTENT_EXPORT bool UseZoomForDSFEnabled(); + +} // namespace content + +#endif // CONTENT_PUBLIC_COMMON_USE_ZOOM_FOR_DSF_POLICY_H_
diff --git a/content/public/common/web_preferences.cc b/content/public/common/web_preferences.cc index cc20936..09569f88 100644 --- a/content/public/common/web_preferences.cc +++ b/content/public/common/web_preferences.cc
@@ -182,7 +182,7 @@ record_whole_document(false), save_previous_document_resources(SavePreviousDocumentResources::NEVER), cookie_enabled(true), - pepper_accelerated_video_decode_enabled(false), + accelerated_video_decode_enabled(false), animation_policy(IMAGE_ANIMATION_POLICY_ALLOWED), user_gesture_required_for_presentation(true), text_track_margin_percentage(0.0f),
diff --git a/content/public/common/web_preferences.h b/content/public/common/web_preferences.h index 361505b..6a1edac 100644 --- a/content/public/common/web_preferences.h +++ b/content/public/common/web_preferences.h
@@ -208,9 +208,9 @@ // without raising a DOM security exception. bool cookie_enabled; - // This flag indicates whether H/W accelerated video decode is enabled for - // pepper plugins. Defaults to false. - bool pepper_accelerated_video_decode_enabled; + // This flag indicates whether H/W accelerated video decode is enabled. + // Defaults to false. + bool accelerated_video_decode_enabled; ImageAnimationPolicy animation_policy;
diff --git a/content/public/test/test_utils.cc b/content/public/test/test_utils.cc index 2784313..6efe48c 100644 --- a/content/public/test/test_utils.cc +++ b/content/public/test/test_utils.cc
@@ -21,7 +21,6 @@ #include "base/values.h" #include "build/build_config.h" #include "components/variations/variations_params_manager.h" -#include "content/common/site_isolation_policy.h" #include "content/common/url_schemes.h" #include "content/public/browser/browser_child_process_host_iterator.h" #include "content/public/browser/notification_service.h"
diff --git a/content/renderer/BUILD.gn b/content/renderer/BUILD.gn index 1c67f37a..962d6a0 100644 --- a/content/renderer/BUILD.gn +++ b/content/renderer/BUILD.gn
@@ -4,6 +4,7 @@ import("//build/config/chromecast_build.gni") import("//build/config/features.gni") +import("//build/config/jumbo.gni") import("//build/config/ui.gni") import("//build/split_static_library.gni") import("//content/common/features.gni") @@ -14,9 +15,9 @@ import("//tools/ipc_fuzzer/ipc_fuzzer.gni") if (is_component_build) { - link_target_type = "source_set" + link_target_type = "jumbo_source_set" } else { - link_target_type = "split_static_library" + link_target_type = "jumbo_split_static_library" } target(link_target_type, "renderer") { @@ -199,6 +200,7 @@ "input/frame_input_handler_impl.h", "input/input_event_filter.cc", "input/input_event_filter.h", + "input/input_event_filter_ipc_names.cc", "input/input_handler_manager.cc", "input/input_handler_manager.h", "input/input_handler_manager_client.h", @@ -523,6 +525,16 @@ "worker_thread_registry.h", ] + jumbo_excluded_sources = [ + # IPC code is built with macros that redefine the default meaning + # of the IPC macros. When that happens in a translation unit there + # is no way to get the default meaning of the macros + # back. Therefore any code that redefines the default IPC macros + # need to be excluded from jumbo + # compilations. https://crbug.com/794176 + "input/input_event_filter_ipc_names.cc", + ] + if (!is_component_build) { if (is_win && is_official_build) { split_count = 2 # In certain configurations a full renderer.lib can @@ -928,6 +940,7 @@ "//third_party/webrtc/api/audio_codecs/opus:audio_encoder_opus", "//third_party/webrtc/api/video_codecs:video_codecs_api", "//third_party/webrtc/common_video:common_video", + "//third_party/webrtc/media:rtc_audio_video", "//third_party/webrtc/media:rtc_media", "//third_party/webrtc/media:rtc_media_base", "//third_party/webrtc/modules/audio_device",
diff --git a/content/renderer/accessibility/render_accessibility_impl_browsertest.cc b/content/renderer/accessibility/render_accessibility_impl_browsertest.cc index a9bdd34..4da5dec 100644 --- a/content/renderer/accessibility/render_accessibility_impl_browsertest.cc +++ b/content/renderer/accessibility/render_accessibility_impl_browsertest.cc
@@ -10,7 +10,6 @@ #include "build/build_config.h" #include "content/common/accessibility_messages.h" #include "content/common/frame_messages.h" -#include "content/common/site_isolation_policy.h" #include "content/common/view_message_enums.h" #include "content/public/common/content_switches.h" #include "content/public/test/render_view_test.h"
diff --git a/content/renderer/android/DEPS b/content/renderer/android/DEPS index c6c21da5..14b5427 100644 --- a/content/renderer/android/DEPS +++ b/content/renderer/android/DEPS
@@ -1,6 +1,7 @@ include_rules = [ "+components/viz/common/gpu", "+components/viz/service/display", + "+components/viz/service/display_embedder", "+components/viz/service/frame_sinks", "+third_party/libphonenumber", # For phone number detection. ]
diff --git a/content/renderer/android/synchronous_layer_tree_frame_sink.cc b/content/renderer/android/synchronous_layer_tree_frame_sink.cc index 2964a504..db0e046 100644 --- a/content/renderer/android/synchronous_layer_tree_frame_sink.cc +++ b/content/renderer/android/synchronous_layer_tree_frame_sink.cc
@@ -114,7 +114,6 @@ scoped_refptr<viz::ContextProvider> worker_context_provider, scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner, gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, - viz::SharedBitmapManager* shared_bitmap_manager, int routing_id, uint32_t layer_tree_frame_sink_id, std::unique_ptr<viz::BeginFrameSource> begin_frame_source, @@ -128,7 +127,6 @@ routing_id_(routing_id), layer_tree_frame_sink_id_(layer_tree_frame_sink_id), registry_(registry), - shared_bitmap_manager_(shared_bitmap_manager), sender_(RenderThreadImpl::current()->sync_compositor_message_filter()), memory_policy_(0u), frame_swap_message_queue_(frame_swap_message_queue), @@ -184,10 +182,10 @@ constexpr bool root_support_is_root = true; constexpr bool child_support_is_root = false; constexpr bool needs_sync_points = true; - root_support_ = viz::CompositorFrameSinkSupport::Create( + root_support_ = std::make_unique<viz::CompositorFrameSinkSupport>( this, frame_sink_manager_.get(), kRootFrameSinkId, root_support_is_root, needs_sync_points); - child_support_ = viz::CompositorFrameSinkSupport::Create( + child_support_ = std::make_unique<viz::CompositorFrameSinkSupport>( this, frame_sink_manager_.get(), kChildFrameSinkId, child_support_is_root, needs_sync_points); @@ -205,7 +203,7 @@ // TODO(crbug.com/692814): The Display never sends its resources out of // process so there is no reason for it to use a SharedBitmapManager. display_ = std::make_unique<viz::Display>( - shared_bitmap_manager_, nullptr /* gpu_memory_buffer_manager */, + &shared_bitmap_manager_, nullptr /* gpu_memory_buffer_manager */, software_renderer_settings, kRootFrameSinkId, std::move(output_surface), nullptr /* scheduler */, nullptr /* current_task_runner */); display_->Initialize(&display_client_,
diff --git a/content/renderer/android/synchronous_layer_tree_frame_sink.h b/content/renderer/android/synchronous_layer_tree_frame_sink.h index 57785bff..7e614ab8 100644 --- a/content/renderer/android/synchronous_layer_tree_frame_sink.h +++ b/content/renderer/android/synchronous_layer_tree_frame_sink.h
@@ -19,6 +19,7 @@ #include "cc/trees/managed_memory_policy.h" #include "components/viz/common/quads/compositor_frame.h" #include "components/viz/service/display/display_client.h" +#include "components/viz/service/display_embedder/server_shared_bitmap_manager.h" #include "ipc/ipc_message.h" #include "services/viz/public/interfaces/compositing/compositor_frame_sink.mojom.h" #include "ui/gfx/transform.h" @@ -72,7 +73,6 @@ scoped_refptr<viz::ContextProvider> worker_context_provider, scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner, gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, - viz::SharedBitmapManager* shared_bitmap_manager, int routing_id, uint32_t layer_tree_frame_sink_id, std::unique_ptr<viz::BeginFrameSource> begin_frame_source, @@ -130,12 +130,16 @@ const int routing_id_; const uint32_t layer_tree_frame_sink_id_; SynchronousCompositorRegistry* const registry_; // Not owned. - viz::SharedBitmapManager* const shared_bitmap_manager_; // Not owned. IPC::Sender* const sender_; // Not owned. // Not owned. SynchronousLayerTreeFrameSinkClient* sync_client_ = nullptr; + // Used to allocate bitmaps in the software Display. + // TODO(crbug.com/692814): The Display never sends its resources out of + // process so there is no reason for it to use a SharedBitmapManager. + viz::ServerSharedBitmapManager shared_bitmap_manager_; + // Only valid (non-NULL) during a DemandDrawSw() call. SkCanvas* current_sw_canvas_ = nullptr;
diff --git a/content/renderer/devtools/devtools_agent.cc b/content/renderer/devtools/devtools_agent.cc index 21a4b9b..6342ce5 100644 --- a/content/renderer/devtools/devtools_agent.cc +++ b/content/renderer/devtools/devtools_agent.cc
@@ -11,9 +11,6 @@ #include "base/json/json_writer.h" #include "base/lazy_instance.h" -#include "base/message_loop/message_loop.h" -#include "base/run_loop.h" -#include "base/sequence_checker.h" #include "base/strings/string_number_conversions.h" #include "base/threading/thread_task_runner_handle.h" #include "base/trace_event/trace_event.h" @@ -48,37 +45,6 @@ const size_t kMaxDevToolsMessageChunkSize = 128 * 1024 * 1024 / 4; const char kPageGetAppManifest[] = "Page.getAppManifest"; -class WebKitClientMessageLoopImpl - : public WebDevToolsAgentClient::WebKitClientMessageLoop { - public: - WebKitClientMessageLoopImpl() = default; - ~WebKitClientMessageLoopImpl() override { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - } - void Run() override { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - - base::RunLoop* const previous_run_loop = run_loop_; - base::RunLoop run_loop(base::RunLoop::Type::kNestableTasksAllowed); - run_loop_ = &run_loop; - - run_loop.Run(); - - run_loop_ = previous_run_loop; - } - void QuitNow() override { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - DCHECK(run_loop_); - - run_loop_->Quit(); - } - - private: - base::RunLoop* run_loop_ = nullptr; - - SEQUENCE_CHECKER(sequence_checker_); -}; - } // namespace class DevToolsAgent::MessageImpl : public WebDevToolsAgent::MessageDescriptor { @@ -252,17 +218,6 @@ state_cookie.Utf8()); } -// static -blink::WebDevToolsAgentClient::WebKitClientMessageLoop* -DevToolsAgent::createMessageLoopWrapper() { - return new WebKitClientMessageLoopImpl(); -} - -blink::WebDevToolsAgentClient::WebKitClientMessageLoop* -DevToolsAgent::CreateClientMessageLoop() { - return createMessageLoopWrapper(); -} - void DevToolsAgent::WillEnterDebugLoop() { paused_ = true; }
diff --git a/content/renderer/devtools/devtools_agent.h b/content/renderer/devtools/devtools_agent.h index 3062631..d699c8ba 100644 --- a/content/renderer/devtools/devtools_agent.h +++ b/content/renderer/devtools/devtools_agent.h
@@ -38,9 +38,6 @@ explicit DevToolsAgent(RenderFrameImpl* frame); ~DevToolsAgent() override; - static blink::WebDevToolsAgentClient::WebKitClientMessageLoop* - createMessageLoopWrapper(); - void BindRequest(mojom::DevToolsAgentAssociatedRequest request); base::WeakPtr<DevToolsAgent> GetWeakPtr(); bool IsAttached(); @@ -69,8 +66,6 @@ int call_id, const blink::WebString& message, const blink::WebString& state_cookie) override; - blink::WebDevToolsAgentClient::WebKitClientMessageLoop* - CreateClientMessageLoop() override; void WillEnterDebugLoop() override; void DidExitDebugLoop() override; bool RequestDevToolsForFrame(int session_id,
diff --git a/content/renderer/history_serialization.cc b/content/renderer/history_serialization.cc index 0c29a57..81793d3e 100644 --- a/content/renderer/history_serialization.cc +++ b/content/renderer/history_serialization.cc
@@ -111,7 +111,7 @@ WebString::FromUTF16(state.http_body.http_content_type)); if (state.http_body.request_body != nullptr) { item.SetHTTPBody( - GetWebHTTPBodyForRequestBody(state.http_body.request_body)); + GetWebHTTPBodyForRequestBody(*state.http_body.request_body)); } item.SetScrollAnchorData({WebString::FromUTF16(state.scroll_anchor_selector),
diff --git a/content/renderer/input/input_event_filter.cc b/content/renderer/input/input_event_filter.cc index 3d6c6fb3..e8865d7 100644 --- a/content/renderer/input/input_event_filter.cc +++ b/content/renderer/input/input_event_filter.cc
@@ -31,26 +31,7 @@ using blink::WebInputEvent; using ui::DidOverscrollParams; -#include "ipc/ipc_message_null_macros.h" -#undef IPC_MESSAGE_DECL -#define IPC_MESSAGE_DECL(name, ...) \ - case name::ID: \ - return #name; - -const char* GetInputMessageTypeName(const IPC::Message& message) { - switch (message.type()) { -// Someone else might have included input_messages.h so undef the guard. -#undef CONTENT_COMMON_INPUT_MESSAGES_H_ -#include "content/common/input_messages.h" -#ifndef CONTENT_COMMON_INPUT_MESSAGES_H_ -#error "Failed to include content/common/input_messages.h" -#endif - default: - NOTREACHED() << "Invalid message type: " << message.type(); - break; - }; - return "NonInputMsgType"; -} +const char* GetInputMessageTypeName(const IPC::Message& message); namespace content {
diff --git a/content/renderer/input/input_event_filter_ipc_names.cc b/content/renderer/input/input_event_filter_ipc_names.cc new file mode 100644 index 0000000..3d438ce --- /dev/null +++ b/content/renderer/input/input_event_filter_ipc_names.cc
@@ -0,0 +1,25 @@ +// Copyright (c) 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/common/input_messages.h" + +#include "ipc/ipc_message_null_macros.h" +#undef IPC_MESSAGE_DECL +#define IPC_MESSAGE_DECL(name, ...) \ + case name::ID: \ + return #name; + +const char* GetInputMessageTypeName(const IPC::Message& message) { + switch (message.type()) { +#undef CONTENT_COMMON_INPUT_MESSAGES_H_ +#include "content/common/input_messages.h" +#ifndef CONTENT_COMMON_INPUT_MESSAGES_H_ +#error "Failed to include content/common/input_messages.h" +#endif + default: + NOTREACHED() << "Invalid message type: " << message.type(); + break; + }; + return "NonInputMsgType"; +}
diff --git a/content/renderer/loader/web_url_request_util.cc b/content/renderer/loader/web_url_request_util.cc index 3255aa9..c3e97f1 100644 --- a/content/renderer/loader/web_url_request_util.cc +++ b/content/renderer/loader/web_url_request_util.cc
@@ -106,8 +106,8 @@ std::string buffer_; }; -// Vends data pipes to read a Blob. It stays alive by StrongBinding to the Mojo -// request. +// Vends data pipes to read a Blob. It stays alive until all Mojo connections +// close. class DataPipeGetter : public network::mojom::DataPipeGetter { public: DataPipeGetter(blink::mojom::BlobPtr blob, @@ -162,10 +162,17 @@ void BindInternal(blink::mojom::BlobPtrInfo blob, network::mojom::DataPipeGetterRequest request) { - mojo::MakeStrongBinding(base::WrapUnique(this), std::move(request)); + bindings_.set_connection_error_handler(base::BindRepeating( + &DataPipeGetter::OnConnectionError, base::Unretained(this))); + bindings_.AddBinding(this, std::move(request)); blob_.Bind(std::move(blob)); } + void OnConnectionError() { + if (bindings_.empty()) + delete this; + } + // network::mojom::DataPipeGetter implementation: void Read(mojo::ScopedDataPipeProducerHandle handle, ReadCallback callback) override { @@ -176,8 +183,13 @@ blob_->ReadAll(std::move(handle), std::move(blob_reader_client_ptr)); } + void Clone(network::mojom::DataPipeGetterRequest request) override { + bindings_.AddBinding(this, std::move(request)); + } + private: blink::mojom::BlobPtr blob_; + mojo::BindingSet<network::mojom::DataPipeGetter> bindings_; DISALLOW_COPY_AND_ASSIGN(DataPipeGetter); }; @@ -367,13 +379,12 @@ return load_flags; } -WebHTTPBody GetWebHTTPBodyForRequestBody( - const scoped_refptr<ResourceRequestBody>& input) { +WebHTTPBody GetWebHTTPBodyForRequestBody(const ResourceRequestBody& input) { WebHTTPBody http_body; http_body.Initialize(); - http_body.SetIdentifier(input->identifier()); - http_body.SetContainsPasswordData(input->contains_sensitive_info()); - for (const auto& element : *input->elements()) { + http_body.SetIdentifier(input.identifier()); + http_body.SetContainsPasswordData(input.contains_sensitive_info()); + for (auto& element : *input.elements()) { switch (element.type()) { case ResourceRequestBody::Element::TYPE_BYTES: http_body.AppendData(WebData(element.bytes(), element.length())); @@ -389,13 +400,22 @@ case ResourceRequestBody::Element::TYPE_BLOB: http_body.AppendBlob(WebString::FromASCII(element.blob_uuid())); break; - case ResourceRequestBody::Element::TYPE_DATA_PIPE: - // TODO(falken): Implement this. - NOTIMPLEMENTED() << "data pipe"; + case ResourceRequestBody::Element::TYPE_DATA_PIPE: { + // Append the cloned data pipe to the |http_body|. This might not be + // needed for all callsites today but it respects the constness of + // |input|, as opposed to moving the data pipe out of |input|. + network::mojom::DataPipeGetterPtr cloned_data_pipe_getter; + const_cast<network::mojom::DataPipeGetterPtr&>(element.data_pipe()) + ->Clone(mojo::MakeRequest(&cloned_data_pipe_getter)); + http_body.AppendDataPipe( + cloned_data_pipe_getter.PassInterface().PassHandle()); break; + } + case ResourceRequestBody::Element::TYPE_UNKNOWN: case ResourceRequestBody::Element::TYPE_BYTES_DESCRIPTION: case ResourceRequestBody::Element::TYPE_DISK_CACHE_ENTRY: - default: + case ResourceRequestBody::Element::TYPE_FILE_FILESYSTEM: + case ResourceRequestBody::Element::TYPE_RAW_FILE: NOTREACHED(); break; } @@ -494,8 +514,23 @@ } break; } - default: - NOTREACHED(); + case WebHTTPBody::Element::kTypeDataPipe: { + // Convert the raw message pipe to network::mojom::DataPipeGetterPtr. + network::mojom::DataPipeGetterPtr data_pipe_getter; + data_pipe_getter.Bind(network::mojom::DataPipeGetterPtrInfo( + std::move(element.data_pipe_getter), 0u)); + + // Set the cloned DataPipeGetter to the output |request_body|, while + // keeping the original message pipe back in the input |httpBody|. This + // way the consumer of the |httpBody| can retrieve the data pipe + // multiple times (e.g. during redirects) until the request is finished. + network::mojom::DataPipeGetterPtr cloned_getter; + data_pipe_getter->Clone(mojo::MakeRequest(&cloned_getter)); + request_body->AppendDataPipe(std::move(cloned_getter)); + element.data_pipe_getter = + data_pipe_getter.PassInterface().PassHandle(); + break; + } } } request_body->set_identifier(httpBody.Identifier());
diff --git a/content/renderer/loader/web_url_request_util.h b/content/renderer/loader/web_url_request_util.h index 9b56734..313f0b4 100644 --- a/content/renderer/loader/web_url_request_util.h +++ b/content/renderer/loader/web_url_request_util.h
@@ -39,7 +39,7 @@ // Takes a ResourceRequestBody and converts into WebHTTPBody. blink::WebHTTPBody GetWebHTTPBodyForRequestBody( - const scoped_refptr<ResourceRequestBody>& input); + const ResourceRequestBody& input); // Takes a WebHTTPBody and converts into a ResourceRequestBody. scoped_refptr<ResourceRequestBody> GetRequestBodyForWebHTTPBody(
diff --git a/content/renderer/media/media_factory.cc b/content/renderer/media/media_factory.cc index fbb2af1d..f4c99c70 100644 --- a/content/renderer/media/media_factory.cc +++ b/content/renderer/media/media_factory.cc
@@ -276,10 +276,8 @@ DCHECK_EQ(static_cast<FrameFetchContext*>(fetch_context_.get())->frame(), web_frame); - if (!watch_time_recorder_provider_) { - remote_interfaces_->GetInterface( - mojo::MakeRequest(&watch_time_recorder_provider_)); - } + media::mojom::MediaMetricsProviderPtr metrics_provider; + remote_interfaces_->GetInterface(mojo::MakeRequest(&metrics_provider)); scoped_refptr<base::SingleThreadTaskRunner> video_frame_compositor_task_runner; @@ -319,9 +317,7 @@ media_observer, max_keyframe_distance_to_disable_background_video, max_keyframe_distance_to_disable_background_video_mse, enable_instant_source_buffer_gc, embedded_media_experience_enabled, - watch_time_recorder_provider_.get(), - base::Bind(&MediaFactory::CreateVideoDecodeStatsRecorder, - base::Unretained(this)), + std::move(metrics_provider), base::Bind(&blink::WebSurfaceLayerBridge::Create, layer_tree_view), RenderThreadImpl::current()->SharedMainThreadContextProvider())); @@ -562,14 +558,6 @@ return cdm_factory_.get(); } -media::mojom::VideoDecodeStatsRecorderPtr -MediaFactory::CreateVideoDecodeStatsRecorder() { - DCHECK(remote_interfaces_); - media::mojom::VideoDecodeStatsRecorderPtr recorder_ptr; - remote_interfaces_->GetInterface(&recorder_ptr); - return recorder_ptr; -} - #if BUILDFLAG(ENABLE_MOJO_MEDIA) media::mojom::InterfaceFactory* MediaFactory::GetMediaInterfaceFactory() { if (!media_interface_factory_) {
diff --git a/content/renderer/media/media_factory.h b/content/renderer/media/media_factory.h index 98cfb2e..f63ba99 100644 --- a/content/renderer/media/media_factory.h +++ b/content/renderer/media/media_factory.h
@@ -15,8 +15,6 @@ #include "media/media_features.h" #include "media/mojo/features.h" #include "media/mojo/interfaces/remoting.mojom.h" -#include "media/mojo/interfaces/video_decode_stats_recorder.mojom.h" -#include "media/mojo/interfaces/watch_time_recorder.mojom.h" #include "third_party/WebKit/public/platform/WebMediaPlayerSource.h" #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" #include "third_party/WebKit/public/platform/WebSetSinkIdCallbacks.h" @@ -146,8 +144,6 @@ media::CdmFactory* GetCdmFactory(); - media::mojom::VideoDecodeStatsRecorderPtr CreateVideoDecodeStatsRecorder(); - #if BUILDFLAG(ENABLE_MOJO_MEDIA) media::mojom::InterfaceFactory* GetMediaInterfaceFactory(); @@ -197,8 +193,6 @@ std::unique_ptr<media::WebEncryptedMediaClientImpl> web_encrypted_media_client_; - media::mojom::WatchTimeRecorderProviderPtr watch_time_recorder_provider_; - #if BUILDFLAG(ENABLE_MEDIA_REMOTING) // Lazy-bound pointer to the RemoterFactory service in the browser // process. Always use the GetRemoterFactory() accessor instead of this.
diff --git a/content/renderer/media/media_stream_renderer_factory_impl.cc b/content/renderer/media/media_stream_renderer_factory_impl.cc index 27210034..eaf706d 100644 --- a/content/renderer/media/media_stream_renderer_factory_impl.cc +++ b/content/renderer/media/media_stream_renderer_factory_impl.cc
@@ -34,17 +34,9 @@ int GetSessionIdForWebRtcAudioRenderer() { WebRtcAudioDeviceImpl* audio_device = GetPeerConnectionDependencyFactory()->GetWebRtcAudioDevice(); - if (!audio_device) - return 0; - - int session_id = 0; - int sample_rate; // ignored, read from output device - int frames_per_buffer; // ignored, read from output device - if (!audio_device->GetAuthorizedDeviceInfoForAudioRenderer( - &session_id, &sample_rate, &frames_per_buffer)) { - session_id = 0; - } - return session_id; + return audio_device + ? audio_device->GetAuthorizedDeviceSessionIdForAudioRenderer() + : 0; } } // namespace
diff --git a/content/renderer/media/mock_mojo_media_stream_dispatcher_host.cc b/content/renderer/media/mock_mojo_media_stream_dispatcher_host.cc index 627d658..4349a47 100644 --- a/content/renderer/media/mock_mojo_media_stream_dispatcher_host.cc +++ b/content/renderer/media/mock_mojo_media_stream_dispatcher_host.cc
@@ -37,6 +37,8 @@ audio_device.name = "microphone"; audio_device.type = MEDIA_DEVICE_AUDIO_CAPTURE; audio_device.session_id = session_id_; + audio_device.matched_output_device_id = + "associated_output_device_id" + base::IntToString(request_id_); audio_devices_.push_back(audio_device); }
diff --git a/content/renderer/media/mojo_audio_input_ipc.cc b/content/renderer/media/mojo_audio_input_ipc.cc index ae28c9a4..414fa35 100644 --- a/content/renderer/media/mojo_audio_input_ipc.cc +++ b/content/renderer/media/mojo_audio_input_ipc.cc
@@ -14,8 +14,12 @@ MojoAudioInputIPC::MojoAudioInputIPC(StreamCreatorCB stream_creator) : stream_creator_(std::move(stream_creator)), - client_binding_(this), - weak_factory_(this) {} + stream_client_binding_(this), + factory_client_binding_(this), + weak_factory_(this) { + DETACH_FROM_SEQUENCE(sequence_checker_); + DCHECK(stream_creator_); +} MojoAudioInputIPC::~MojoAudioInputIPC() = default; @@ -24,55 +28,57 @@ const media::AudioParameters& params, bool automatic_gain_control, uint32_t total_segments) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(delegate); DCHECK(!delegate_); delegate_ = delegate; - media::mojom::AudioInputStreamClientPtr client; - client_binding_.Bind(mojo::MakeRequest(&client)); - client_binding_.set_connection_error_handler(base::BindOnce( + mojom::RendererAudioInputStreamFactoryClientPtr client; + factory_client_binding_.Bind(mojo::MakeRequest(&client)); + factory_client_binding_.set_connection_error_handler(base::BindOnce( &media::AudioInputIPCDelegate::OnError, base::Unretained(delegate_))); - stream_creator_.Run(mojo::MakeRequest(&stream_), session_id, params, - automatic_gain_control, total_segments, std::move(client), - base::BindOnce(&MojoAudioInputIPC::StreamCreated, - weak_factory_.GetWeakPtr())); - - // Unretained is safe since |delegate_| is required to remain valid until - // CloseStream is called, which closes the binding. - stream_.set_connection_error_handler(base::BindOnce( - &media::AudioInputIPCDelegate::OnError, base::Unretained(delegate_))); + stream_creator_.Run(std::move(client), session_id, params, + automatic_gain_control, total_segments); } void MojoAudioInputIPC::RecordStream() { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - if (stream_.is_bound()) - stream_->Record(); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + DCHECK(stream_.is_bound()); + stream_->Record(); } void MojoAudioInputIPC::SetVolume(double volume) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - if (stream_.is_bound()) - stream_->SetVolume(volume); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + DCHECK(stream_.is_bound()); + stream_->SetVolume(volume); } void MojoAudioInputIPC::CloseStream() { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - client_binding_.Close(); - stream_.reset(); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); delegate_ = nullptr; + if (factory_client_binding_.is_bound()) + factory_client_binding_.Unbind(); + if (stream_client_binding_.is_bound()) + stream_client_binding_.Unbind(); + stream_.reset(); } void MojoAudioInputIPC::StreamCreated( + media::mojom::AudioInputStreamPtr stream, + media::mojom::AudioInputStreamClientRequest stream_client_request, mojo::ScopedSharedBufferHandle shared_memory, mojo::ScopedHandle socket, bool initially_muted) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(delegate_); DCHECK(socket.is_valid()); DCHECK(shared_memory.is_valid()); + DCHECK(!stream_); + DCHECK(!stream_client_binding_.is_bound()); + stream_ = std::move(stream); + stream_client_binding_.Bind(std::move(stream_client_request)); base::PlatformFile socket_handle; auto result = mojo::UnwrapPlatformFile(std::move(socket), &socket_handle); @@ -89,13 +95,13 @@ } void MojoAudioInputIPC::OnError() { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(delegate_); delegate_->OnError(); } void MojoAudioInputIPC::OnMutedStateChanged(bool is_muted) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(delegate_); delegate_->OnMuted(is_muted); }
diff --git a/content/renderer/media/mojo_audio_input_ipc.h b/content/renderer/media/mojo_audio_input_ipc.h index 66ff892..90853e2 100644 --- a/content/renderer/media/mojo_audio_input_ipc.h +++ b/content/renderer/media/mojo_audio_input_ipc.h
@@ -10,8 +10,9 @@ #include "base/callback_helpers.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" -#include "base/threading/thread_checker.h" +#include "base/sequence_checker.h" #include "content/common/content_export.h" +#include "content/common/media/renderer_audio_input_stream_factory.mojom.h" #include "media/audio/audio_input_ipc.h" #include "media/mojo/interfaces/audio_input_stream.mojom.h" #include "mojo/public/cpp/bindings/binding.h" @@ -23,24 +24,19 @@ // thread. class CONTENT_EXPORT MojoAudioInputIPC : public media::AudioInputIPC, + public mojom::RendererAudioInputStreamFactoryClient, public media::mojom::AudioInputStreamClient { public: - using StreamCreatedCB = - base::OnceCallback<void(mojo::ScopedSharedBufferHandle shared_memory, - mojo::ScopedHandle socket, - bool initially_muted)>; - + // This callback is used by MojoAudioInputIPC to create streams. + // It is expected that after calling, either client->StreamCreated() is + // called or |client| is destructed. using StreamCreatorCB = base::RepeatingCallback<void( - media::mojom::AudioInputStreamRequest, - int64_t session_id, - media::AudioParameters params, + mojom::RendererAudioInputStreamFactoryClientPtr client, + int32_t session_id, + const media::AudioParameters& params, bool automatic_gain_control, - uint32_t total_segments, - media::mojom::AudioInputStreamClientPtr client, - StreamCreatedCB on_stream_created)>; + uint32_t total_segments)>; - // |stream_creator| is required to create a stream and call on_stream_created. - // It will get posted on the |main_task_runner| during CreateStream. explicit MojoAudioInputIPC(StreamCreatorCB stream_creator); ~MojoAudioInputIPC() override; @@ -55,19 +51,22 @@ void CloseStream() override; private: - void StreamCreated(mojo::ScopedSharedBufferHandle shared_memory, - mojo::ScopedHandle socket, - bool initially_muted); - + void StreamCreated( + media::mojom::AudioInputStreamPtr stream, + media::mojom::AudioInputStreamClientRequest stream_client_request, + mojo::ScopedSharedBufferHandle shared_memory, + mojo::ScopedHandle socket, + bool initially_muted) override; void OnError() override; void OnMutedStateChanged(bool is_muted) override; StreamCreatorCB stream_creator_; - THREAD_CHECKER(thread_checker_); + SEQUENCE_CHECKER(sequence_checker_); media::mojom::AudioInputStreamPtr stream_; - mojo::Binding<AudioInputStreamClient> client_binding_; + mojo::Binding<AudioInputStreamClient> stream_client_binding_; + mojo::Binding<RendererAudioInputStreamFactoryClient> factory_client_binding_; media::AudioInputIPCDelegate* delegate_ = nullptr; base::WeakPtrFactory<MojoAudioInputIPC> weak_factory_;
diff --git a/content/renderer/media/mojo_audio_input_ipc_unittest.cc b/content/renderer/media/mojo_audio_input_ipc_unittest.cc index 1915654..9191ba52 100644 --- a/content/renderer/media/mojo_audio_input_ipc_unittest.cc +++ b/content/renderer/media/mojo_audio_input_ipc_unittest.cc
@@ -71,27 +71,26 @@ public: FakeStreamCreator(media::mojom::AudioInputStream* stream, bool initially_muted) - : stream_(stream), initially_muted_(initially_muted) {} + : stream_(stream), binding_(stream_), initially_muted_(initially_muted) {} - void Create(media::mojom::AudioInputStreamRequest stream_request, - int64_t session_id, - media::AudioParameters params, + void Create(mojom::RendererAudioInputStreamFactoryClientPtr factory_client, + int32_t session_id, + const media::AudioParameters& params, bool automatic_gain_control, - uint32_t total_segments, - media::mojom::AudioInputStreamClientPtr client, - MojoAudioInputIPC::StreamCreatedCB on_stream_created) { - EXPECT_EQ(binding_, base::nullopt); + uint32_t total_segments) { + EXPECT_FALSE(binding_.is_bound()); EXPECT_NE(stream_, nullptr); - std::swap(client_, client); - binding_.emplace(stream_, std::move(stream_request)); + std::swap(factory_client_, factory_client); + media::mojom::AudioInputStreamPtr stream_ptr; + binding_.Bind(mojo::MakeRequest(&stream_ptr)); base::CancelableSyncSocket foreign_socket; EXPECT_TRUE( base::CancelableSyncSocket::CreatePair(&socket_, &foreign_socket)); - std::move(on_stream_created) - .Run(mojo::SharedBufferHandle::Create(kMemoryLength) - ->Clone(mojo::SharedBufferHandle::AccessMode::READ_ONLY), - mojo::WrapPlatformFile(foreign_socket.Release()), - initially_muted_); + factory_client_->StreamCreated( + std::move(stream_ptr), mojo::MakeRequest(&stream_client_), + mojo::SharedBufferHandle::Create(kMemoryLength) + ->Clone(mojo::SharedBufferHandle::AccessMode::READ_ONLY), + mojo::WrapPlatformFile(foreign_socket.Release()), initially_muted_); } MojoAudioInputIPC::StreamCreatorCB GetCallback() { @@ -100,19 +99,21 @@ } void Rearm() { - binding_.reset(); + if (binding_.is_bound()) + binding_.Unbind(); socket_.Close(); } void SignalError() { - ASSERT_TRUE(client_); - client_->OnError(); + ASSERT_TRUE(stream_client_); + stream_client_->OnError(); } private: media::mojom::AudioInputStream* stream_; - media::mojom::AudioInputStreamClientPtr client_; - base::Optional<mojo::Binding<media::mojom::AudioInputStream>> binding_; + media::mojom::AudioInputStreamClientPtr stream_client_; + mojom::RendererAudioInputStreamFactoryClientPtr factory_client_; + mojo::Binding<media::mojom::AudioInputStream> binding_; bool initially_muted_; base::CancelableSyncSocket socket_; }; @@ -137,6 +138,25 @@ base::RunLoop().RunUntilIdle(); } +TEST(MojoAudioInputIPC, FactoryDisconnected_SendsError) { + base::MessageLoopForIO message_loop; + StrictMock<MockDelegate> delegate; + + const std::unique_ptr<media::AudioInputIPC> ipc = + std::make_unique<MojoAudioInputIPC>(base::BindRepeating( + [](mojom::RendererAudioInputStreamFactoryClientPtr factory_client, + int32_t session_id, const media::AudioParameters& params, + bool automatic_gain_control, uint32_t total_segments) {})); + + EXPECT_CALL(delegate, OnError()); + + ipc->CreateStream(&delegate, kSessionId, Params(), false, kTotalSegments); + base::RunLoop().RunUntilIdle(); + + ipc->CloseStream(); + base::RunLoop().RunUntilIdle(); +} + TEST(MojoAudioInputIPC, OnStreamCreated_PropagatesInitiallyMuted) { base::MessageLoopForIO message_loop; StrictMock<MockStream> stream; @@ -219,6 +239,7 @@ EXPECT_CALL(stream, Record()); ipc->CreateStream(&delegate, kSessionId, Params(), false, kTotalSegments); + base::RunLoop().RunUntilIdle(); ipc->RecordStream(); base::RunLoop().RunUntilIdle(); @@ -239,6 +260,7 @@ EXPECT_CALL(stream, SetVolume(kNewVolume)); ipc->CreateStream(&delegate, kSessionId, Params(), false, kTotalSegments); + base::RunLoop().RunUntilIdle(); ipc->SetVolume(kNewVolume); base::RunLoop().RunUntilIdle();
diff --git a/content/renderer/media/mojo_audio_output_ipc.cc b/content/renderer/media/mojo_audio_output_ipc.cc index 13eb0d09..f884197 100644 --- a/content/renderer/media/mojo_audio_output_ipc.cc +++ b/content/renderer/media/mojo_audio_output_ipc.cc
@@ -96,14 +96,14 @@ void MojoAudioOutputIPC::PlayStream() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - if (stream_.is_bound()) - stream_->Play(); + DCHECK(stream_.is_bound()); + stream_->Play(); } void MojoAudioOutputIPC::PauseStream() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - if (stream_.is_bound()) - stream_->Pause(); + DCHECK(stream_.is_bound()); + stream_->Pause(); } void MojoAudioOutputIPC::CloseStream() { @@ -119,8 +119,8 @@ void MojoAudioOutputIPC::SetVolume(double volume) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - if (stream_.is_bound()) - stream_->SetVolume(volume); + DCHECK(stream_.is_bound()); + stream_->SetVolume(volume); } void MojoAudioOutputIPC::OnError() {
diff --git a/content/renderer/media/user_media_client_impl_unittest.cc b/content/renderer/media/user_media_client_impl_unittest.cc index 3057fd4..dfb657f6 100644 --- a/content/renderer/media/user_media_client_impl_unittest.cc +++ b/content/renderer/media/user_media_client_impl_unittest.cc
@@ -1386,24 +1386,26 @@ } } -// These tests check that audio parameters for the associated output device are +// These tests check that the associated output device id is // set according to the renderToAssociatedSink constrainable property. -TEST_F(UserMediaClientImplTest, RenderToAssociatedSinkTrueAudioParams) { +TEST_F(UserMediaClientImplTest, + RenderToAssociatedSinkTrueAssociatedOutputDeviceId) { EXPECT_CALL(mock_dispatcher_host_, OnStreamStarted(_)); blink::WebMediaStreamTrack web_track = RequestLocalAudioTrackWithAssociatedSink(true); MediaStreamAudioSource* source = MediaStreamAudioSource::From(web_track.Source()); - EXPECT_TRUE(source->device().matched_output.IsValid()); + EXPECT_FALSE(source->device().matched_output_device_id.empty()); } -TEST_F(UserMediaClientImplTest, RenderToAssociatedSinkFalseAudioParams) { +TEST_F(UserMediaClientImplTest, + RenderToAssociatedSinkFalseAssociatedOutputDeviceId) { EXPECT_CALL(mock_dispatcher_host_, OnStreamStarted(_)); blink::WebMediaStreamTrack web_track = RequestLocalAudioTrackWithAssociatedSink(false); MediaStreamAudioSource* source = MediaStreamAudioSource::From(web_track.Source()); - EXPECT_FALSE(source->device().matched_output.IsValid()); + EXPECT_TRUE(source->device().matched_output_device_id.empty()); } } // namespace content
diff --git a/content/renderer/media/user_media_processor.cc b/content/renderer/media/user_media_processor.cc index 15d95f7..17babe2 100644 --- a/content/renderer/media/user_media_processor.cc +++ b/content/renderer/media/user_media_processor.cc
@@ -782,12 +782,11 @@ // The audio device is not associated with screen capture and also requires // processing. - ProcessedLocalAudioSource* source = new ProcessedLocalAudioSource( - render_frame_id_, device, audio_processing_properties, source_ready, - dependency_factory_); *has_sw_echo_cancellation = audio_processing_properties.enable_sw_echo_cancellation; - return source; + return new ProcessedLocalAudioSource(render_frame_id_, device, + audio_processing_properties, + source_ready, dependency_factory_); } MediaStreamVideoSource* UserMediaProcessor::CreateVideoSource( @@ -832,14 +831,10 @@ .render_to_associated_sink(); if (!render_to_associated_sink) { // If the GetUserMedia request did not explicitly set the constraint - // kMediaStreamRenderToAssociatedSink, the output device parameters must + // kMediaStreamRenderToAssociatedSink, the output device id must // be removed. - for (auto& device : overridden_audio_devices) { - device.matched_output_device_id = ""; - // Audio parameters must be invalid in order to ensure that the matched - // output device will not be used. - device.matched_output = media::AudioParameters(); - } + for (auto& device : overridden_audio_devices) + device.matched_output_device_id.clear(); } for (size_t i = 0; i < overridden_audio_devices.size(); ++i) {
diff --git a/content/renderer/media/webrtc/processed_local_audio_source.cc b/content/renderer/media/webrtc/processed_local_audio_source.cc index d3cff34..f51fc59 100644 --- a/content/renderer/media/webrtc/processed_local_audio_source.cc +++ b/content/renderer/media/webrtc/processed_local_audio_source.cc
@@ -87,12 +87,10 @@ WebRtcLogMessage(base::StringPrintf( "ProcessedLocalAudioSource::EnsureSourceIsStarted. render_frame_id=%d" ", channel_layout=%d, sample_rate=%d, buffer_size=%d" - ", session_id=%d, paired_output_sample_rate=%d" - ", paired_output_frames_per_buffer=%d, effects=%d. ", + ", session_id=%d, effects=%d. ", consumer_render_frame_id_, device().input.channel_layout(), device().input.sample_rate(), device().input.frames_per_buffer(), - device().session_id, device().matched_output.sample_rate(), - device().matched_output.frames_per_buffer(), device().input.effects())); + device().session_id, device().input.effects())); MediaStreamDevice modified_device(device()); bool device_is_modified = false;
diff --git a/content/renderer/media/webrtc_audio_device_impl.cc b/content/renderer/media/webrtc_audio_device_impl.cc index 3d94e97..634dd31 100644 --- a/content/renderer/media/webrtc_audio_device_impl.cc +++ b/content/renderer/media/webrtc_audio_device_impl.cc
@@ -416,29 +416,19 @@ playout_sinks_.remove(sink); } -bool WebRtcAudioDeviceImpl::GetAuthorizedDeviceInfoForAudioRenderer( - int* session_id, - int* output_sample_rate, - int* output_frames_per_buffer) { +int WebRtcAudioDeviceImpl::GetAuthorizedDeviceSessionIdForAudioRenderer() { DCHECK(main_thread_checker_.CalledOnValidThread()); base::AutoLock lock(lock_); // If there is no capturer or there are more than one open capture devices, // return false. if (capturers_.size() != 1) - return false; + return 0; - // Don't set output parameters unless all of them are valid. const MediaStreamDevice& device = capturers_.back()->device(); - if (device.session_id <= 0 || !device.matched_output.sample_rate() || - !device.matched_output.frames_per_buffer()) { - return false; - } + if (device.session_id <= 0 || device.matched_output_device_id.empty()) + return 0; - *session_id = device.session_id; - *output_sample_rate = device.matched_output.sample_rate(); - *output_frames_per_buffer = device.matched_output.frames_per_buffer(); - - return true; + return device.session_id; } } // namespace content
diff --git a/content/renderer/media/webrtc_audio_device_impl.h b/content/renderer/media/webrtc_audio_device_impl.h index 15606bf..13d360c6 100644 --- a/content/renderer/media/webrtc_audio_device_impl.h +++ b/content/renderer/media/webrtc_audio_device_impl.h
@@ -313,15 +313,12 @@ void AddAudioCapturer(ProcessedLocalAudioSource* capturer); void RemoveAudioCapturer(ProcessedLocalAudioSource* capturer); - // Gets paired device information of the capture device for the audio - // renderer. This is used to pass on a session id, sample rate and buffer - // size to a webrtc audio renderer (either local or remote), so that audio - // will be rendered to a matching output device. - // Returns true if the capture device has a paired output device, otherwise - // false. Note that if there are more than one open capture device the - // function will not be able to pick an appropriate device and return false. - bool GetAuthorizedDeviceInfoForAudioRenderer( - int* session_id, int* output_sample_rate, int* output_buffer_size); + // Returns the session id of the capture device if it has a paired output + // device, otherwise 0. The session id is passed on to a webrtc audio renderer + // (either local or remote), so that audio will be rendered to a matching + // output device. Note that if there are more than one open capture device the + // function will not be able to pick an appropriate device and return 0. + int GetAuthorizedDeviceSessionIdForAudioRenderer(); const scoped_refptr<WebRtcAudioRenderer>& renderer() const { return renderer_;
diff --git a/content/renderer/media/webrtc_audio_renderer_unittest.cc b/content/renderer/media/webrtc_audio_renderer_unittest.cc index 89785b3e..aaf6a56 100644 --- a/content/renderer/media/webrtc_audio_renderer_unittest.cc +++ b/content/renderer/media/webrtc_audio_renderer_unittest.cc
@@ -192,13 +192,14 @@ TEST_F(WebRtcAudioRendererTest, VerifySinkParameters) { SetupRenderer(kDefaultOutputDeviceId); renderer_proxy_->Start(); -#if defined(OS_LINUX) || defined(OS_MACOSX) +#if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_FUCHSIA) static const int kExpectedBufferSize = kHardwareSampleRate / 100; #elif defined(OS_ANDROID) static const int kExpectedBufferSize = 2 * kHardwareSampleRate / 100; -#else - // Windows. +#elif defined(OS_WIN) static const int kExpectedBufferSize = kHardwareBufferSize; +#else +#error Unknown platform. #endif EXPECT_EQ(kExpectedBufferSize, renderer_->frames_per_buffer()); EXPECT_EQ(kHardwareSampleRate, renderer_->sample_rate());
diff --git a/content/renderer/pepper/ppapi_preferences_builder.cc b/content/renderer/pepper/ppapi_preferences_builder.cc index b95dae2..4d09826 100644 --- a/content/renderer/pepper/ppapi_preferences_builder.cc +++ b/content/renderer/pepper/ppapi_preferences_builder.cc
@@ -35,7 +35,10 @@ .status_values[gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D_BASELINE] == gpu::kGpuFeatureStatusEnabled)); ppapi_prefs.is_accelerated_video_decode_enabled = - prefs.pepper_accelerated_video_decode_enabled; + (prefs.accelerated_video_decode_enabled && + (gpu_feature_info + .status_values[gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE] == + gpu::kGpuFeatureStatusEnabled)); return ppapi_prefs; }
diff --git a/content/renderer/quota_dispatcher.cc b/content/renderer/quota_dispatcher.cc index 399ce386..c13df85 100644 --- a/content/renderer/quota_dispatcher.cc +++ b/content/renderer/quota_dispatcher.cc
@@ -21,7 +21,7 @@ using blink::WebStorageQuotaCallbacks; using blink::WebStorageQuotaError; using blink::WebStorageQuotaType; -using storage::QuotaStatusCode; +using blink::QuotaStatusCode; using storage::StorageType; namespace content { @@ -45,7 +45,7 @@ void DidGrantStorageQuota(int64_t usage, int64_t granted_quota) override { callbacks_.DidGrantStorageQuota(usage, granted_quota); } - void DidFail(storage::QuotaStatusCode error) override { + void DidFail(QuotaStatusCode error) override { callbacks_.DidFail(static_cast<WebStorageQuotaError>(error)); } @@ -86,7 +86,7 @@ base::IDMap<std::unique_ptr<Callback>>::iterator iter( &pending_quota_callbacks_); while (!iter.IsAtEnd()) { - iter.GetCurrentValue()->DidFail(storage::kQuotaErrorAbort); + iter.GetCurrentValue()->DidFail(blink::QuotaStatusCode::kErrorAbort); iter.Advance(); } @@ -143,10 +143,10 @@ } void QuotaDispatcher::DidGrantStorageQuota(int64_t request_id, - storage::QuotaStatusCode status, + QuotaStatusCode status, int64_t current_usage, int64_t granted_quota) { - if (status != storage::kQuotaStatusOk) { + if (status != blink::QuotaStatusCode::kOk) { DidFail(request_id, status); return; } @@ -157,12 +157,11 @@ pending_quota_callbacks_.Remove(request_id); } -void QuotaDispatcher::DidQueryStorageUsageAndQuota( - int64_t request_id, - storage::QuotaStatusCode status, - int64_t current_usage, - int64_t current_quota) { - if (status != storage::kQuotaStatusOk) { +void QuotaDispatcher::DidQueryStorageUsageAndQuota(int64_t request_id, + QuotaStatusCode status, + int64_t current_usage, + int64_t current_quota) { + if (status != blink::QuotaStatusCode::kOk) { DidFail(request_id, status); return; } @@ -190,10 +189,10 @@ "mismatching enums: kStorageTypePersistent"); static_assert(int(blink::kWebStorageQuotaErrorNotSupported) == - int(storage::kQuotaErrorNotSupported), + int(blink::QuotaStatusCode::kErrorNotSupported), "mismatching enums: kQuotaErrorNotSupported"); static_assert(int(blink::kWebStorageQuotaErrorAbort) == - int(storage::kQuotaErrorAbort), + int(blink::QuotaStatusCode::kErrorAbort), "mismatching enums: kQuotaErrorAbort"); } // namespace content
diff --git a/content/renderer/quota_dispatcher.h b/content/renderer/quota_dispatcher.h index 308d280..1a56a8f 100644 --- a/content/renderer/quota_dispatcher.h +++ b/content/renderer/quota_dispatcher.h
@@ -15,6 +15,7 @@ #include "base/macros.h" #include "content/common/quota_dispatcher_host.mojom.h" #include "content/public/renderer/worker_thread.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" namespace blink { class WebStorageQuotaCallbacks; @@ -40,7 +41,7 @@ virtual ~Callback() {} virtual void DidQueryStorageUsageAndQuota(int64_t usage, int64_t quota) = 0; virtual void DidGrantStorageQuota(int64_t usage, int64_t granted_quota) = 0; - virtual void DidFail(storage::QuotaStatusCode status) = 0; + virtual void DidFail(blink::QuotaStatusCode status) = 0; }; explicit QuotaDispatcher( @@ -69,14 +70,14 @@ private: // Message handlers. void DidQueryStorageUsageAndQuota(int64_t request_id, - storage::QuotaStatusCode status, + blink::QuotaStatusCode status, int64_t current_usage, int64_t current_quota); void DidGrantStorageQuota(int64_t request_id, - storage::QuotaStatusCode status, + blink::QuotaStatusCode status, int64_t current_usage, int64_t granted_quota); - void DidFail(int request_id, storage::QuotaStatusCode error); + void DidFail(int request_id, blink::QuotaStatusCode error); content::mojom::QuotaDispatcherHostPtr quota_host_; scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index 7e5d0a19..0001e8b 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc
@@ -60,7 +60,6 @@ #include "content/common/savable_subframe.h" #include "content/common/service_worker/service_worker_types.h" #include "content/common/service_worker/service_worker_utils.h" -#include "content/common/site_isolation_policy.h" #include "content/common/swapped_out_messages.h" #include "content/common/view_messages.h" #include "content/public/common/appcache_info.h" @@ -6380,7 +6379,7 @@ : network::mojom::RequestContextFrameType::kNested); if (IsBrowserSideNavigationEnabled() && common_params.post_data) { - request.SetHTTPBody(GetWebHTTPBodyForRequestBody(common_params.post_data)); + request.SetHTTPBody(GetWebHTTPBodyForRequestBody(*common_params.post_data)); if (!request_params.post_content_type.empty()) { request.AddHTTPHeaderField( WebString::FromASCII(net::HttpRequestHeaders::kContentType), @@ -6516,7 +6515,7 @@ if (common_params.method == "POST" && !browser_side_navigation && common_params.post_data) { request.SetHTTPBody( - GetWebHTTPBodyForRequestBody(common_params.post_data)); + GetWebHTTPBodyForRequestBody(*common_params.post_data)); } should_load_request = true;
diff --git a/content/renderer/render_frame_proxy.cc b/content/renderer/render_frame_proxy.cc index a48d795..86c1d0c 100644 --- a/content/renderer/render_frame_proxy.cc +++ b/content/renderer/render_frame_proxy.cc
@@ -17,7 +17,6 @@ #include "content/common/frame_replication_state.h" #include "content/common/input_messages.h" #include "content/common/page_messages.h" -#include "content/common/site_isolation_policy.h" #include "content/common/swapped_out_messages.h" #include "content/common/view_messages.h" #include "content/public/common/content_switches.h" @@ -725,4 +724,4 @@ } #endif -} // namespace +} // namespace content
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index 395f293..748d24d 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc
@@ -69,7 +69,6 @@ #include "content/common/frame_owner_properties.h" #include "content/common/gpu_stream_constants.h" #include "content/common/resource_messages.h" -#include "content/common/site_isolation_policy.h" #include "content/common/view_messages.h" #include "content/public/common/content_constants.h" #include "content/public/common/content_features.h" @@ -450,7 +449,8 @@ // thread. class UkmRecorderFactoryImpl : public cc::UkmRecorderFactory { public: - UkmRecorderFactoryImpl(std::unique_ptr<service_manager::Connector> connector) + explicit UkmRecorderFactoryImpl( + std::unique_ptr<service_manager::Connector> connector) : connector_(std::move(connector)) { DCHECK(connector_); } @@ -2155,9 +2155,9 @@ : CreateExternalBeginFrameSource(routing_id); callback.Run(std::make_unique<SynchronousLayerTreeFrameSink>( std::move(context_provider), std::move(worker_context_provider), - compositor_task_runner_, GetGpuMemoryBufferManager(), - shared_bitmap_manager(), routing_id, g_next_layer_tree_frame_sink_id++, - std::move(begin_frame_source), sync_compositor_message_filter_.get(), + compositor_task_runner_, GetGpuMemoryBufferManager(), routing_id, + g_next_layer_tree_frame_sink_id++, std::move(begin_frame_source), + sync_compositor_message_filter_.get(), std::move(frame_swap_message_queue))); return; }
diff --git a/content/renderer/render_view_browsertest.cc b/content/renderer/render_view_browsertest.cc index 389aa4d..6e8927f 100644 --- a/content/renderer/render_view_browsertest.cc +++ b/content/renderer/render_view_browsertest.cc
@@ -27,7 +27,6 @@ #include "content/common/frame_owner_properties.h" #include "content/common/frame_replication_state.h" #include "content/common/renderer.mojom.h" -#include "content/common/site_isolation_policy.h" #include "content/common/view_messages.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/native_web_keyboard_event.h"
diff --git a/content/renderer/sandbox_mac_v2_unittest.mm b/content/renderer/sandbox_mac_v2_unittest.mm index 2d025d5..e85b47b 100644 --- a/content/renderer/sandbox_mac_v2_unittest.mm +++ b/content/renderer/sandbox_mac_v2_unittest.mm
@@ -24,6 +24,7 @@ #include "content/test/test_content_client.h" #include "sandbox/mac/sandbox_compiler.h" #include "sandbox/mac/seatbelt_exec.h" +#include "services/service_manager/sandbox/mac/common_v2.sb.h" #include "services/service_manager/sandbox/mac/renderer_v2.sb.h" #include "services/service_manager/sandbox/mac/sandbox_mac.h" #include "testing/gtest/include/gtest/gtest.h" @@ -91,8 +92,10 @@ MULTIPROCESS_TEST_MAIN(SandboxProfileProcess) { TestContentClient content_client; - sandbox::SandboxCompiler compiler( - service_manager::kSeatbeltPolicyString_renderer_v2); + const std::string profile = + std::string(service_manager::kSeatbeltPolicyString_common_v2) + + service_manager::kSeatbeltPolicyString_renderer_v2; + sandbox::SandboxCompiler compiler(profile); // Create the logging file and pass /bin/ls as the executable path. base::ScopedTempDir temp_dir;
diff --git a/content/renderer/service_worker/service_worker_context_client.cc b/content/renderer/service_worker/service_worker_context_client.cc index c4fd661..9e8a7cae 100644 --- a/content/renderer/service_worker/service_worker_context_client.cc +++ b/content/renderer/service_worker/service_worker_context_client.cc
@@ -31,7 +31,6 @@ #include "content/public/renderer/child_url_loader_factory_getter.h" #include "content/public/renderer/content_renderer_client.h" #include "content/public/renderer/document_state.h" -#include "content/renderer/devtools/devtools_agent.h" #include "content/renderer/loader/request_extra_data.h" #include "content/renderer/loader/web_data_consumer_handle_impl.h" #include "content/renderer/loader/web_url_loader_impl.h" @@ -199,7 +198,7 @@ } if (request.request_body) { blink::WebHTTPBody body = - GetWebHTTPBodyForRequestBody(request.request_body); + GetWebHTTPBodyForRequestBody(*request.request_body); body.SetUniqueBoundary(); web_request->SetBody(body); } @@ -922,11 +921,6 @@ sender_.get(), session_id, call_id, message.Utf8(), state_cookie.Utf8()); } -blink::WebDevToolsAgentClient::WebKitClientMessageLoop* -ServiceWorkerContextClient::CreateDevToolsMessageLoop() { - return DevToolsAgent::createMessageLoopWrapper(); -} - void ServiceWorkerContextClient::DidHandleActivateEvent( int request_id, blink::mojom::ServiceWorkerEventStatus status,
diff --git a/content/renderer/service_worker/service_worker_context_client.h b/content/renderer/service_worker/service_worker_context_client.h index 3c66408..d8b31ac 100644 --- a/content/renderer/service_worker/service_worker_context_client.h +++ b/content/renderer/service_worker/service_worker_context_client.h
@@ -156,8 +156,6 @@ int call_id, const blink::WebString& message, const blink::WebString& state) override; - blink::WebDevToolsAgentClient::WebKitClientMessageLoop* - CreateDevToolsMessageLoop() override; void DidHandleActivateEvent(int request_id, blink::mojom::ServiceWorkerEventStatus status, double dispatch_event_time) override;
diff --git a/content/renderer/service_worker/service_worker_provider_context.h b/content/renderer/service_worker/service_worker_provider_context.h index 75dd066..074cb65f 100644 --- a/content/renderer/service_worker/service_worker_provider_context.h +++ b/content/renderer/service_worker/service_worker_provider_context.h
@@ -24,13 +24,17 @@ namespace base { class SingleThreadTaskRunner; -} +} // namespace base namespace content { namespace mojom { class URLLoaderFactory; -} +} // namespace mojom + +namespace service_worker_provider_context_unittest { +class ServiceWorkerProviderContextTest; +} // namespace service_worker_provider_context_unittest class ServiceWorkerHandleReference; class WebServiceWorkerRegistrationImpl; @@ -173,7 +177,8 @@ friend class base::DeleteHelper<ServiceWorkerProviderContext>; friend class base::RefCountedThreadSafe<ServiceWorkerProviderContext, ServiceWorkerProviderContextDeleter>; - friend class ServiceWorkerProviderContextTest; + friend class service_worker_provider_context_unittest:: + ServiceWorkerProviderContextTest; friend class WebServiceWorkerRegistrationImpl; friend struct ServiceWorkerProviderContextDeleter; struct ProviderStateForClient;
diff --git a/content/renderer/service_worker/service_worker_provider_context_unittest.cc b/content/renderer/service_worker/service_worker_provider_context_unittest.cc index 3b1dd68..0c580b9 100644 --- a/content/renderer/service_worker/service_worker_provider_context_unittest.cc +++ b/content/renderer/service_worker/service_worker_provider_context_unittest.cc
@@ -31,8 +31,7 @@ #include "third_party/WebKit/public/platform/web_feature.mojom.h" namespace content { - -namespace { +namespace service_worker_provider_context_unittest { class MockServiceWorkerRegistrationObjectHost : public blink::mojom::ServiceWorkerRegistrationObjectHost { @@ -156,8 +155,6 @@ DISALLOW_COPY_AND_ASSIGN(ServiceWorkerTestSender); }; -} // namespace - class ServiceWorkerProviderContextTest : public testing::Test { public: ServiceWorkerProviderContextTest() = default; @@ -569,4 +566,5 @@ EXPECT_EQ(0, remote_registration_object_host().GetBindingCount()); } +} // namespace service_worker_provider_context_unittest } // namespace content
diff --git a/content/renderer/service_worker/service_worker_subresource_loader.cc b/content/renderer/service_worker/service_worker_subresource_loader.cc index d0adb67..be6d242 100644 --- a/content/renderer/service_worker/service_worker_subresource_loader.cc +++ b/content/renderer/service_worker/service_worker_subresource_loader.cc
@@ -398,8 +398,8 @@ return; } - // Handle a blob response body. Ideally we'd just get a data pipe from - // SWFetchDispatcher, and this could be treated the same as a stream response. + // Handle a blob response body. Ideally we'd just get a data pipe and this + // could be treated the same as a stream response. // See: // https://docs.google.com/a/google.com/document/d/1_ROmusFvd8ATwIZa29-P6Ls5yyLjfld0KvKchVfA84Y/edit?usp=drive_web // TODO(kinuko): This code is hacked up on top of the legacy API, migrate
diff --git a/content/renderer/shared_worker/embedded_shared_worker_stub.cc b/content/renderer/shared_worker/embedded_shared_worker_stub.cc index e18abff..45658002 100644 --- a/content/renderer/shared_worker/embedded_shared_worker_stub.cc +++ b/content/renderer/shared_worker/embedded_shared_worker_stub.cc
@@ -17,7 +17,6 @@ #include "content/public/renderer/child_url_loader_factory_getter.h" #include "content/renderer/appcache/appcache_dispatcher.h" #include "content/renderer/appcache/web_application_cache_host_impl.h" -#include "content/renderer/devtools/devtools_agent.h" #include "content/renderer/loader/request_extra_data.h" #include "content/renderer/render_thread_impl.h" #include "content/renderer/renderer_blink_platform_impl.h" @@ -255,11 +254,6 @@ session_id, call_id, message, state); } -blink::WebDevToolsAgentClient::WebKitClientMessageLoop* -EmbeddedSharedWorkerStub::CreateDevToolsMessageLoop() { - return DevToolsAgent::createMessageLoopWrapper(); -} - std::unique_ptr<blink::WebWorkerFetchContext> EmbeddedSharedWorkerStub::CreateWorkerFetchContext( blink::WebServiceWorkerNetworkProvider* web_network_provider) {
diff --git a/content/renderer/shared_worker/embedded_shared_worker_stub.h b/content/renderer/shared_worker/embedded_shared_worker_stub.h index 8a212de5..d07e2601 100644 --- a/content/renderer/shared_worker/embedded_shared_worker_stub.h +++ b/content/renderer/shared_worker/embedded_shared_worker_stub.h
@@ -87,8 +87,6 @@ int call_id, const blink::WebString& message, const blink::WebString& state) override; - blink::WebDevToolsAgentClient::WebKitClientMessageLoop* - CreateDevToolsMessageLoop() override; std::unique_ptr<blink::WebWorkerFetchContext> CreateWorkerFetchContext( blink::WebServiceWorkerNetworkProvider*) override;
diff --git a/content/renderer/skia_benchmarking_extension.cc b/content/renderer/skia_benchmarking_extension.cc index eeb18e53..9d7c00d 100644 --- a/content/renderer/skia_benchmarking_extension.cc +++ b/content/renderer/skia_benchmarking_extension.cc
@@ -26,7 +26,6 @@ #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkColorPriv.h" #include "third_party/skia/include/core/SkGraphics.h" -#include "third_party/skia/include/core/SkImageDeserializer.h" #include "third_party/skia/include/core/SkPicture.h" #include "third_party/skia/include/core/SkStream.h" #include "ui/gfx/codec/jpeg_codec.h" @@ -45,35 +44,6 @@ sk_sp<SkPicture> picture; }; -class GfxImageDeserializer final : public SkImageDeserializer { - public: - sk_sp<SkImage> makeFromData(SkData* data, const SkIRect* subset) override { - return makeFromMemory(data->data(), data->size(), subset); - } - sk_sp<SkImage> makeFromMemory(const void* data, - size_t size, - const SkIRect* subset) override { - sk_sp<SkImage> img; - // Try PNG first. - SkBitmap bitmap; - if (gfx::PNGCodec::Decode((const uint8_t*)data, size, &bitmap)) { - bitmap.setImmutable(); - img = SkImage::MakeFromBitmap(bitmap); - } else { - // Try JPEG. - std::unique_ptr<SkBitmap> decoded_jpeg( - gfx::JPEGCodec::Decode((const uint8_t*)data, size)); - if (decoded_jpeg) { - decoded_jpeg->setImmutable(); - img = SkImage::MakeFromBitmap(*decoded_jpeg); - } - } - if (img && subset) - img = img->makeSubset(*subset); - return img; - } -}; - std::unique_ptr<base::Value> ParsePictureArg(v8::Isolate* isolate, v8::Local<v8::Value> arg) { return content::V8ValueConverter::Create()->FromV8Value( @@ -84,10 +54,8 @@ const std::string& encoded) { std::string decoded; base::Base64Decode(encoded, &decoded); - SkMemoryStream stream(decoded.data(), decoded.size()); - GfxImageDeserializer deserializer; sk_sp<SkPicture> skpicture = - SkPicture::MakeFromStream(&stream, &deserializer); + SkPicture::MakeFromData(decoded.data(), decoded.size()); if (!skpicture) return nullptr;
diff --git a/content/shell/BUILD.gn b/content/shell/BUILD.gn index 0d5e28b..feb7cda 100644 --- a/content/shell/BUILD.gn +++ b/content/shell/BUILD.gn
@@ -251,7 +251,7 @@ "//device/bluetooth", "//device/bluetooth:fake_bluetooth", "//device/bluetooth:mocks", - "//device/geolocation", + "//device/geolocation/public/cpp:test_support", "//device/geolocation/public/interfaces", "//device/sensors/public/cpp:full", "//gin",
diff --git a/content/shell/browser/DEPS b/content/shell/browser/DEPS index 6a36ea6..f118c584 100644 --- a/content/shell/browser/DEPS +++ b/content/shell/browser/DEPS
@@ -2,7 +2,7 @@ "-content/shell/browser/layout_test", "+components/keyed_service/content", "+components/network_session_configurator/common", - "+device/geolocation", + "+device/geolocation/public", "+services/service_manager/public/cpp", "+services/service_manager/sandbox", ]
diff --git a/content/shell/browser/layout_test/layout_test_browser_context.cc b/content/shell/browser/layout_test/layout_test_browser_context.cc index 41fdb9b..ca6f4568 100644 --- a/content/shell/browser/layout_test/layout_test_browser_context.cc +++ b/content/shell/browser/layout_test/layout_test_browser_context.cc
@@ -21,8 +21,7 @@ #include "content/shell/browser/layout_test/layout_test_url_request_context_getter.h" #include "content/shell/browser/shell_url_request_context_getter.h" #include "content/test/mock_background_sync_controller.h" -#include "device/geolocation/geolocation_provider.h" -#include "device/geolocation/public/interfaces/geoposition.mojom.h" +#include "device/geolocation/public/cpp/scoped_geolocation_overrider.h" #if defined(OS_WIN) #include "base/base_paths_win.h" @@ -38,23 +37,12 @@ LayoutTestBrowserContext::LayoutTestBrowserContext(bool off_the_record, net::NetLog* net_log) : ShellBrowserContext(off_the_record, net_log) { - Init(); + // Overrides geolocation coordinates for testing. + geolocation_overrider_ = + std::make_unique<device::ScopedGeolocationOverrider>(0, 0); } -LayoutTestBrowserContext::~LayoutTestBrowserContext() { -} - -void LayoutTestBrowserContext::Init() { - // Fake geolocation coordinates for testing. - device::mojom::Geoposition position; - position.latitude = 0; - position.longitude = 0; - position.altitude = 0; - position.accuracy = 0; - position.timestamp = base::Time::Now(); - device::GeolocationProvider::GetInstance()->OverrideLocationForTesting( - position); -} +LayoutTestBrowserContext::~LayoutTestBrowserContext() {} ShellURLRequestContextGetter* LayoutTestBrowserContext::CreateURLRequestContextGetter(
diff --git a/content/shell/browser/layout_test/layout_test_browser_context.h b/content/shell/browser/layout_test/layout_test_browser_context.h index 58cb6996..693ca7c 100644 --- a/content/shell/browser/layout_test/layout_test_browser_context.h +++ b/content/shell/browser/layout_test/layout_test_browser_context.h
@@ -9,6 +9,10 @@ #include "base/macros.h" #include "content/shell/browser/shell_browser_context.h" +namespace device { +class ScopedGeolocationOverrider; +} + namespace net { class NetLog; } @@ -27,8 +31,6 @@ LayoutTestBrowserContext(bool off_the_record, net::NetLog* net_log); ~LayoutTestBrowserContext() override; - void Init(); - // BrowserContext implementation. DownloadManagerDelegate* GetDownloadManagerDelegate() override; PushMessagingService* GetPushMessagingService() override; @@ -46,6 +48,7 @@ std::unique_ptr<LayoutTestPushMessagingService> push_messaging_service_; std::unique_ptr<PermissionManager> permission_manager_; std::unique_ptr<BackgroundSyncController> background_sync_controller_; + std::unique_ptr<device::ScopedGeolocationOverrider> geolocation_overrider_; DISALLOW_COPY_AND_ASSIGN(LayoutTestBrowserContext); };
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn index a3991b0..2dfc83d 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn
@@ -313,6 +313,8 @@ "//content/utility:for_content_tests", "//device/base/synchronization", "//device/geolocation", + "//device/geolocation/public/cpp:test_support", + "//device/geolocation/public/interfaces", "//ipc:test_support", "//media", "//media/capture", @@ -1436,6 +1438,7 @@ "../browser/shared_worker/shared_worker_instance_unittest.cc", "../browser/shared_worker/shared_worker_service_impl_unittest.cc", "../browser/site_instance_impl_unittest.cc", + "../browser/site_isolation_policy_unittest.cc", "../browser/startup_task_runner_unittest.cc", "../browser/storage_partition_impl_map_unittest.cc", "../browser/storage_partition_impl_unittest.cc", @@ -1502,7 +1505,6 @@ "../common/service_manager/service_manager_connection_impl_unittest.cc", "../common/service_worker/service_worker_types_unittest.cc", "../common/service_worker/service_worker_utils_unittest.cc", - "../common/site_isolation_policy_unittest.cc", "../common/throttling_url_loader_unittest.cc", "../common/unique_name_helper_unittest.cc", "../common/webplugininfo_unittest.cc",
diff --git a/content/test/data/accessibility/aria/aria-readonly-expected-android.txt b/content/test/data/accessibility/aria/aria-readonly-expected-android.txt index 4b490db..cb5f202 100644 --- a/content/test/data/accessibility/aria/aria-readonly-expected-android.txt +++ b/content/test/data/accessibility/aria/aria-readonly-expected-android.txt
@@ -16,7 +16,7 @@ ++android.widget.ListView role_description='list box' clickable collection name='Readonly listbox' ++android.view.View role_description='radio group' name='Readonly radiogroup' ++android.widget.SeekBar role_description='slider' range name='Readonly slider' item_index=50 item_count=100 range_max=100 range_current_value=50 -++android.widget.EditText role_description='spin button' clickable name='Readonly spinbutton' +++android.widget.EditText role_description='spin button' name='Readonly spinbutton' ++android.view.MenuItem role_description='checkbox' checkable clickable name='Readonly menuitemcheckbox' ++android.view.MenuItem role_description='radio button' checkable clickable name='Readonly menuitemradio' ++android.widget.EditText role_description='search text field' clickable editable_text name='Readonly searchbox'
diff --git a/content/test/data/accessibility/aria/aria-spinbutton-expected-android.txt b/content/test/data/accessibility/aria/aria-spinbutton-expected-android.txt index aded1063..b2cdc66a 100644 --- a/content/test/data/accessibility/aria/aria-spinbutton-expected-android.txt +++ b/content/test/data/accessibility/aria/aria-spinbutton-expected-android.txt
@@ -1,2 +1,2 @@ android.webkit.WebView focusable focused scrollable -++android.widget.EditText clickable focusable range_current_value=5 \ No newline at end of file +++android.widget.EditText role_description='spin button' clickable focusable name='Inner text' range_current_value=5
diff --git a/content/test/data/accessibility/aria/aria-spinbutton-expected-mac.txt b/content/test/data/accessibility/aria/aria-spinbutton-expected-mac.txt index b62c46df..41e3b9a4 100644 --- a/content/test/data/accessibility/aria/aria-spinbutton-expected-mac.txt +++ b/content/test/data/accessibility/aria/aria-spinbutton-expected-mac.txt
@@ -1,2 +1,3 @@ AXWebArea AXRoleDescription='HTML content' ++AXIncrementor AXRoleDescription='stepper' AXValue='5' +++++AXStaticText AXRoleDescription='text' AXValue='Inner text'
diff --git a/content/test/data/accessibility/aria/aria-spinbutton-expected-win.txt b/content/test/data/accessibility/aria/aria-spinbutton-expected-win.txt index fa348cb..8241a5f 100644 --- a/content/test/data/accessibility/aria/aria-spinbutton-expected-win.txt +++ b/content/test/data/accessibility/aria/aria-spinbutton-expected-win.txt
@@ -1,2 +1,3 @@ -ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE -++ROLE_SYSTEM_SPINBUTTON FOCUSABLE +ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>' +++ROLE_SYSTEM_SPINBUTTON value='5' FOCUSABLE valuetext:5 ia2_hypertext='Inner text' +++++ROLE_SYSTEM_STATICTEXT name='Inner text' ia2_hypertext='Inner text'
diff --git a/content/test/data/accessibility/aria/aria-spinbutton.html b/content/test/data/accessibility/aria/aria-spinbutton.html index bd99ced..ae5d52c2 100644 --- a/content/test/data/accessibility/aria/aria-spinbutton.html +++ b/content/test/data/accessibility/aria/aria-spinbutton.html
@@ -1,6 +1,8 @@ <!-- @MAC-ALLOW:AXRole* @WIN-ALLOW:ia2_hypertext=* +@WIN-ALLOW:value* +@WIN-DENY:value='http://*' --> <html> <body>
diff --git a/content/test/data/accessibility/html/input-number-expected-android.txt b/content/test/data/accessibility/html/input-number-expected-android.txt new file mode 100644 index 0000000..8ee77f0 --- /dev/null +++ b/content/test/data/accessibility/html/input-number-expected-android.txt
@@ -0,0 +1,3 @@ +android.webkit.WebView focusable focused scrollable +++android.view.View +++++android.widget.EditText role_description='spin button' clickable editable_text focusable has_non_empty_value name='1' input_type=2 text_change_added_count=1
diff --git a/content/test/data/accessibility/html/input-number-expected-blink.txt b/content/test/data/accessibility/html/input-number-expected-blink.txt new file mode 100644 index 0000000..d46e2cb --- /dev/null +++ b/content/test/data/accessibility/html/input-number-expected-blink.txt
@@ -0,0 +1,9 @@ +rootWebArea +++genericContainer +++++spinButton value='1' +++++++genericContainer +++++++++staticText name='1' +++++++++++inlineTextBox name='1' +++++++spinButton +++++++++button +++++++++button
diff --git a/content/test/data/accessibility/html/input-number-expected-mac.txt b/content/test/data/accessibility/html/input-number-expected-mac.txt new file mode 100644 index 0000000..2a7f16a0 --- /dev/null +++ b/content/test/data/accessibility/html/input-number-expected-mac.txt
@@ -0,0 +1,3 @@ +AXWebArea AXRoleDescription='HTML content' +++AXGroup AXRoleDescription='group' +++++AXIncrementor AXRoleDescription='stepper' AXValue='1'
diff --git a/content/test/data/accessibility/html/input-number-expected-win.txt b/content/test/data/accessibility/html/input-number-expected-win.txt new file mode 100644 index 0000000..d3c5ac1c --- /dev/null +++ b/content/test/data/accessibility/html/input-number-expected-win.txt
@@ -0,0 +1,3 @@ +ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0>' +++IA2_ROLE_SECTION ia2_hypertext='<obj0>' +++++ROLE_SYSTEM_SPINBUTTON value='1' FOCUSABLE valuetext:1 text-input-type:number ia2_hypertext='1'
diff --git a/content/test/data/accessibility/html/input-number.html b/content/test/data/accessibility/html/input-number.html new file mode 100644 index 0000000..7137262 --- /dev/null +++ b/content/test/data/accessibility/html/input-number.html
@@ -0,0 +1,15 @@ +<!DOCTYPE html> +<!-- +@MAC-ALLOW:AXRole* +@WIN-ALLOW:ia2_hypertext=* +@WIN-ALLOW:text-input-type* +@WIN-ALLOW:value* +@WIN-DENY:value='http://*' +@BLINK-ALLOW:value* +@BLINK-DENY:value='http://* +--> +<html> + <body> + <input type="number" value="1"> + </body> +</html>
diff --git a/content/test/gpu/generate_buildbot_json.py b/content/test/gpu/generate_buildbot_json.py index 35ffc55..9a5dcdbd 100755 --- a/content/test/gpu/generate_buildbot_json.py +++ b/content/test/gpu/generate_buildbot_json.py
@@ -1677,6 +1677,42 @@ ], 'test': 'video_decode_accelerator_unittest', }, + 'vr_browser_tests': { + 'tester_configs': [ + { + 'predicate': Predicates.FYI_ONLY, + 'os_types': ['win'] + }, + ], + # We currently only want to run this on Win10 Release (NVIDIA) + 'disabled_tester_configs': [ + { + 'names': [ + 'Win7 Release (NVIDIA)', + 'Win7 Debug (NVIDIA)', + 'Win7 dEQP Release (NVIDIA)', + 'Win7 Experimental Release (NVIDIA)', + 'Win10 Debug (NVIDIA)', + 'Win7 Release (AMD)', + 'Win7 Debug (AMD)', + 'Win7 dEQP Release (AMD)', + 'Win10 Release (Intel HD 630)', + 'Win10 Release (NVIDIA Quadro P400)', + 'Win7 x64 Release (NVIDIA)', + 'Win7 x64 Debug (NVIDIA)', + 'Win7 x64 dEQP Release (NVIDIA)', + ], + } + ], + 'args': [ + '--enable-gpu', + '--test-launcher-bot-mode', + '--test-launcher-jobs=1', + '--gtest_filter=VrBrowserTest.*', + '--gtest_also_run_disabled_tests', + ], + 'test': 'browser_tests', + } } # This requires a hack because the isolate's name is different than
diff --git a/content/test/gpu/gpu_tests/trace_integration_test.py b/content/test/gpu/gpu_tests/trace_integration_test.py index c1ec95b..cab3395 100644 --- a/content/test/gpu/gpu_tests/trace_integration_test.py +++ b/content/test/gpu/gpu_tests/trace_integration_test.py
@@ -93,14 +93,7 @@ 'domAutomationController._finished', timeout=30) # Stop tracing. - timeline_data = tab.browser.platform.tracing_controller.StopTracing() - - # TODO(charliea): This is part of a three-sided Chromium/Telemetry patch - # where we're changing the return type of StopTracing from a TraceValue to a - # (TraceValue, nonfatal_exception_list) tuple. Once the tuple return value - # lands in Chromium, the non-tuple logic should be deleted. - if isinstance(timeline_data, tuple): - timeline_data = timeline_data[0] + timeline_data = tab.browser.platform.tracing_controller.StopTracing()[0] # Evaluate success. timeline_model = model_module.TimelineModel(timeline_data)
diff --git a/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py b/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py index 4bd0c28..037797b2 100644 --- a/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py +++ b/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py
@@ -343,6 +343,8 @@ ['linux', 'passthrough', 'opengl', 'nvidia'], bug=766918) self.Fail('deqp/functional/gles3/shaderoperator/common_functions.html', ['linux', 'passthrough', 'opengl', 'nvidia'], bug=793055) + self.Fail('deqp/functional/gles3/shadercommonfunction.html', + ['linux', 'passthrough', 'opengl', 'nvidia'], bug=793055) self.Fail('deqp/functional/gles3/shaderpackingfunction.html', ['linux', 'passthrough', 'opengl', 'nvidia'], bug=794341) @@ -544,6 +546,9 @@ self.Fail('deqp/functional/gles3/framebufferblit/conversion_33.html', ['mac', ('nvidia', 0xfe9)], bug=654187) + self.Fail('conformance2/uniforms/draw-with-uniform-blocks.html', + ['mac', ('nvidia', 0xfe9)], bug=795052) + # When this fails on this configuration, it fails multiple times in a row. self.Fail('deqp/functional/gles3/shaderoperator/common_functions.html', ['mac', 'nvidia'], bug=756537)
diff --git a/content/test/gpu/gpu_tests/webgl_conformance_expectations.py b/content/test/gpu/gpu_tests/webgl_conformance_expectations.py index b594bd7..88c2779 100644 --- a/content/test/gpu/gpu_tests/webgl_conformance_expectations.py +++ b/content/test/gpu/gpu_tests/webgl_conformance_expectations.py
@@ -225,6 +225,11 @@ 'depth-renderbuffer-initialization.html', ['win', 'passthrough', 'opengl', 'nvidia'], bug=794339) + # Passthrough command decoder / Win / OpenGL / Intel + self.Fail('conformance/renderbuffers/' + + 'depth-renderbuffer-initialization.html', + ['win', 'passthrough', 'opengl', 'intel'], bug=794339) + # Win failures # TODO(kbr): re-enable suppression for same test below once fixed. self.Skip('conformance/glsl/bugs/sampler-struct-function-arg.html', @@ -525,6 +530,13 @@ self.Fail('conformance/textures/misc/texture-size-limit.html', ['linux', ('intel', 0x5912)], bug=745888) + # Linux passthrough Intel + self.Fail('conformance/renderbuffers/' + + 'depth-renderbuffer-initialization.html', + ['linux', 'passthrough', 'intel'], bug=794339) + self.Fail('conformance/renderbuffers/' + + 'stencil-renderbuffer-initialization.html', + ['linux', 'passthrough', 'intel'], bug=794339) #################### # Android failures # ####################
diff --git a/content/test/test_blink_web_unit_test_support.cc b/content/test/test_blink_web_unit_test_support.cc index e1d70eb5..ae5e694 100644 --- a/content/test/test_blink_web_unit_test_support.cc +++ b/content/test/test_blink_web_unit_test_support.cc
@@ -21,6 +21,7 @@ #include "cc/test/test_shared_bitmap_manager.h" #include "cc/trees/layer_tree_settings.h" #include "content/app/mojo/mojo_init.h" +#include "content/renderer/loader/web_data_consumer_handle_impl.h" #include "content/renderer/loader/web_url_loader_impl.h" #include "content/test/mock_webclipboard_impl.h" #include "content/test/web_gesture_curve_mock.h" @@ -227,6 +228,12 @@ weak_factory_.GetWeakPtr()); } +std::unique_ptr<blink::WebDataConsumerHandle> +TestBlinkWebUnitTestSupport::CreateDataConsumerHandle( + mojo::ScopedDataPipeConsumerHandle handle) { + return std::make_unique<WebDataConsumerHandleImpl>(std::move(handle)); +} + blink::WebString TestBlinkWebUnitTestSupport::UserAgent() { return blink::WebString::FromUTF8("test_runner/0.0.0.0"); }
diff --git a/content/test/test_blink_web_unit_test_support.h b/content/test/test_blink_web_unit_test_support.h index 200f40e..9b5c0a94 100644 --- a/content/test/test_blink_web_unit_test_support.h +++ b/content/test/test_blink_web_unit_test_support.h
@@ -44,6 +44,8 @@ std::unique_ptr<blink::WebURLLoaderFactory> CreateDefaultURLLoaderFactory() override; + std::unique_ptr<blink::WebDataConsumerHandle> CreateDataConsumerHandle( + mojo::ScopedDataPipeConsumerHandle handle) override; blink::WebString UserAgent() override; blink::WebString QueryLocalizedString( blink::WebLocalizedString::Name name) override;
diff --git a/device/geolocation/public/cpp/BUILD.gn b/device/geolocation/public/cpp/BUILD.gn index 2300847..99ab306 100644 --- a/device/geolocation/public/cpp/BUILD.gn +++ b/device/geolocation/public/cpp/BUILD.gn
@@ -9,7 +9,22 @@ "location_provider.h", ] - deps = [ + public_deps = [ "//device/geolocation/public/interfaces", ] } + +source_set("test_support") { + testonly = true + + sources = [ + "scoped_geolocation_overrider.cc", + "scoped_geolocation_overrider.h", + ] + + deps = [ + ":cpp", + "//services/device/public/interfaces", + "//services/service_manager/public/cpp", + ] +}
diff --git a/device/geolocation/public/cpp/scoped_geolocation_overrider.cc b/device/geolocation/public/cpp/scoped_geolocation_overrider.cc new file mode 100644 index 0000000..6e274f4 --- /dev/null +++ b/device/geolocation/public/cpp/scoped_geolocation_overrider.cc
@@ -0,0 +1,205 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <vector> + +#include "device/geolocation/public/cpp/geoposition.h" +#include "device/geolocation/public/cpp/scoped_geolocation_overrider.h" +#include "services/device/public/interfaces/constants.mojom.h" +#include "services/service_manager/public/cpp/service_context.h" + +namespace device { + +// This class is a fake implementation of GeolocationContext and Geolocation +// mojo interfaces for those tests which want to set an override geoposition +// value and verify their code where there are geolocation mojo calls. +class ScopedGeolocationOverrider::FakeGeolocationContext + : public mojom::GeolocationContext { + public: + explicit FakeGeolocationContext(const mojom::Geoposition& position); + ~FakeGeolocationContext() override; + + void UpdateLocation(const mojom::Geoposition& position); + const mojom::Geoposition& GetGeoposition() const; + + void BindForOverrideService( + const std::string& interface_name, + mojo::ScopedMessagePipeHandle handle, + const service_manager::BindSourceInfo& source_info); + + // mojom::GeolocationContext implementation: + void BindGeolocation(mojom::GeolocationRequest request) override; + void SetOverride(mojom::GeopositionPtr geoposition) override; + void ClearOverride() override; + + private: + mojom::Geoposition position_; + mojom::GeopositionPtr override_position_; + std::vector<std::unique_ptr<FakeGeolocation>> impls_; + mojo::BindingSet<mojom::GeolocationContext> context_bindings_; +}; + +class ScopedGeolocationOverrider::FakeGeolocation : public mojom::Geolocation { + public: + FakeGeolocation(mojom::GeolocationRequest request, + const FakeGeolocationContext* context); + ~FakeGeolocation() override; + + void UpdateLocation(const mojom::Geoposition& position); + + // mojom::Geolocation implementation: + void QueryNextPosition(QueryNextPositionCallback callback) override; + void SetHighAccuracy(bool high_accuracy) override; + + private: + const FakeGeolocationContext* context_; + bool has_new_position_; + QueryNextPositionCallback position_callback_; + mojo::Binding<mojom::Geolocation> binding_; +}; + +ScopedGeolocationOverrider::ScopedGeolocationOverrider( + const mojom::Geoposition& position) { + OverrideGeolocation(position); +} + +ScopedGeolocationOverrider::ScopedGeolocationOverrider(double latitude, + double longitude) { + mojom::Geoposition position; + position.latitude = latitude; + position.longitude = longitude; + position.altitude = 0.; + position.accuracy = 0.; + position.timestamp = base::Time::Now(); + + OverrideGeolocation(position); +} + +ScopedGeolocationOverrider::~ScopedGeolocationOverrider() { + service_manager::ServiceContext::ClearGlobalBindersForTesting( + mojom::kServiceName); +} + +void ScopedGeolocationOverrider::OverrideGeolocation( + const mojom::Geoposition& position) { + geolocation_context_ = std::make_unique<FakeGeolocationContext>(position); + service_manager::ServiceContext::SetGlobalBinderForTesting( + mojom::kServiceName, mojom::GeolocationContext::Name_, + base::BindRepeating(&FakeGeolocationContext::BindForOverrideService, + base::Unretained(geolocation_context_.get()))); +} + +void ScopedGeolocationOverrider::UpdateLocation( + const mojom::Geoposition& position) { + geolocation_context_->UpdateLocation(position); +} + +void ScopedGeolocationOverrider::UpdateLocation(double latitude, + double longitude) { + mojom::Geoposition position; + position.latitude = latitude; + position.longitude = longitude; + position.altitude = 0.; + position.accuracy = 0.; + position.timestamp = base::Time::Now(); + + UpdateLocation(position); +} + +ScopedGeolocationOverrider::FakeGeolocationContext::FakeGeolocationContext( + const mojom::Geoposition& position) + : position_(position) { + position_.valid = false; + if (ValidateGeoposition(position_)) + position_.valid = true; +} + +ScopedGeolocationOverrider::FakeGeolocationContext::~FakeGeolocationContext() {} + +void ScopedGeolocationOverrider::FakeGeolocationContext::UpdateLocation( + const mojom::Geoposition& position) { + position_ = position; + + position_.valid = false; + if (ValidateGeoposition(position_)) + position_.valid = true; + + for (auto& impl : impls_) { + impl->UpdateLocation(position_); + } +} + +const mojom::Geoposition& +ScopedGeolocationOverrider::FakeGeolocationContext::GetGeoposition() const { + if (!override_position_.is_null()) + return *override_position_; + + return position_; +} + +void ScopedGeolocationOverrider::FakeGeolocationContext::BindForOverrideService( + const std::string& interface_name, + mojo::ScopedMessagePipeHandle handle, + const service_manager::BindSourceInfo& source_info) { + context_bindings_.AddBinding( + this, mojom::GeolocationContextRequest(std::move(handle))); +} + +void ScopedGeolocationOverrider::FakeGeolocationContext::BindGeolocation( + mojom::GeolocationRequest request) { + impls_.push_back(std::make_unique<FakeGeolocation>(std::move(request), this)); +} + +void ScopedGeolocationOverrider::FakeGeolocationContext::SetOverride( + mojom::GeopositionPtr geoposition) { + override_position_ = std::move(geoposition); + if (override_position_.is_null()) + return; + + override_position_->valid = false; + if (ValidateGeoposition(*override_position_)) + override_position_->valid = true; + + for (auto& impl : impls_) { + impl->UpdateLocation(*override_position_); + } +} + +void ScopedGeolocationOverrider::FakeGeolocationContext::ClearOverride() { + override_position_.reset(); +} + +ScopedGeolocationOverrider::FakeGeolocation::FakeGeolocation( + mojom::GeolocationRequest request, + const FakeGeolocationContext* context) + : context_(context), has_new_position_(true), binding_(this) { + binding_.Bind(std::move(request)); +} + +ScopedGeolocationOverrider::FakeGeolocation::~FakeGeolocation() {} + +void ScopedGeolocationOverrider::FakeGeolocation::UpdateLocation( + const mojom::Geoposition& position) { + has_new_position_ = true; + if (!position_callback_.is_null()) { + std::move(position_callback_).Run(position.Clone()); + has_new_position_ = false; + } +} + +void ScopedGeolocationOverrider::FakeGeolocation::QueryNextPosition( + QueryNextPositionCallback callback) { + // Pending callbacks might be overrided. + position_callback_ = std::move(callback); + + if (has_new_position_) { + std::move(position_callback_).Run(context_->GetGeoposition().Clone()); + has_new_position_ = false; + } +} + +void ScopedGeolocationOverrider::FakeGeolocation::SetHighAccuracy( + bool high_accuracy) {} + +} // namespace device
diff --git a/device/geolocation/public/cpp/scoped_geolocation_overrider.h b/device/geolocation/public/cpp/scoped_geolocation_overrider.h new file mode 100644 index 0000000..4d16015 --- /dev/null +++ b/device/geolocation/public/cpp/scoped_geolocation_overrider.h
@@ -0,0 +1,41 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef DEVICE_GEOLOCATION_PUBLIC_CPP_SCOPED_GEOLOCATION_OVERRIDER_H_ +#define DEVICE_GEOLOCATION_PUBLIC_CPP_SCOPED_GEOLOCATION_OVERRIDER_H_ + +#include "base/bind.h" +#include "device/geolocation/public/interfaces/geolocation.mojom.h" +#include "device/geolocation/public/interfaces/geolocation_context.mojom.h" +#include "device/geolocation/public/interfaces/geoposition.mojom.h" +#include "mojo/public/cpp/bindings/binding.h" +#include "mojo/public/cpp/bindings/binding_set.h" +#include "services/service_manager/public/cpp/bind_source_info.h" + +namespace device { + +// A helper class which owns a FakeGeolocationContext by which the geolocation +// is overriden to a given position or latitude and longitude values. +// The FakeGeolocationContext overrides the binder of Device Service by +// service_manager::ServiceContext::SetGlobalBinderForTesting(). +// The override of the geolocation implementation will be in effect for the +// duration of this object's lifetime. +class ScopedGeolocationOverrider { + public: + explicit ScopedGeolocationOverrider(const mojom::Geoposition& position); + ScopedGeolocationOverrider(double latitude, double longitude); + ~ScopedGeolocationOverrider(); + void OverrideGeolocation(const mojom::Geoposition& position); + void UpdateLocation(const mojom::Geoposition& position); + void UpdateLocation(double latitude, double longitude); + + private: + class FakeGeolocation; + class FakeGeolocationContext; + std::unique_ptr<FakeGeolocationContext> geolocation_context_; +}; + +} // namespace device + +#endif // DEVICE_GEOLOCATION_PUBLIC_CPP_SCOPED_GEOLOCATION_OVERRIDER_H_
diff --git a/device/media_transfer_protocol/BUILD.gn b/device/media_transfer_protocol/BUILD.gn index 4175651..11308abb 100644 --- a/device/media_transfer_protocol/BUILD.gn +++ b/device/media_transfer_protocol/BUILD.gn
@@ -34,6 +34,7 @@ ":mtp_file_entry_proto", ":mtp_storage_info_proto", "//base", + "//device/media_transfer_protocol/public/interfaces", ] deps = [ "//chromeos",
diff --git a/device/media_transfer_protocol/media_transfer_protocol_daemon_client.cc b/device/media_transfer_protocol/media_transfer_protocol_daemon_client.cc index 963c615..831d417 100644 --- a/device/media_transfer_protocol/media_transfer_protocol_daemon_client.cc +++ b/device/media_transfer_protocol/media_transfer_protocol_daemon_client.cc
@@ -13,8 +13,8 @@ #include "dbus/message.h" #include "dbus/object_path.h" #include "dbus/object_proxy.h" -#include "device/media_transfer_protocol/mtp_file_entry.pb.h" #include "device/media_transfer_protocol/mtp_storage_info.pb.h" +#include "device/media_transfer_protocol/mtp_file_entry.pb.h" #include "third_party/cros_system_api/dbus/service_constants.h" namespace device { @@ -24,6 +24,17 @@ const char kInvalidResponseMsg[] = "Invalid Response: "; uint32_t kMaxChunkSize = 1024 * 1024; // D-Bus has message size limits. +mojom::MtpFileEntry GetMojoMtpFileEntryFromProtobuf( + const MtpFileEntry& entry) { + return mojom::MtpFileEntry( + entry.item_id(), + entry.parent_id(), + entry.file_name(), + entry.file_size(), + entry.modification_time(), + static_cast<mojom::MtpFileEntry::FileType>(entry.file_type())); +} + // The MediaTransferProtocolDaemonClient implementation. class MediaTransferProtocolDaemonClientImpl : public MediaTransferProtocolDaemonClient { @@ -406,10 +417,13 @@ return; } - std::vector<MtpFileEntry> file_entries; + std::vector<mojom::MtpFileEntry> file_entries; file_entries.reserve(entries_protobuf.file_entries_size()); - for (int i = 0; i < entries_protobuf.file_entries_size(); ++i) - file_entries.push_back(entries_protobuf.file_entries(i)); + for (int i = 0; i < entries_protobuf.file_entries_size(); ++i) { + const auto& entry = entries_protobuf.file_entries(i); + file_entries.push_back( + GetMojoMtpFileEntryFromProtobuf(entry)); + } callback.Run(file_entries); }
diff --git a/device/media_transfer_protocol/media_transfer_protocol_daemon_client.h b/device/media_transfer_protocol/media_transfer_protocol_daemon_client.h index 7e1fa576..8a6b7717 100644 --- a/device/media_transfer_protocol/media_transfer_protocol_daemon_client.h +++ b/device/media_transfer_protocol/media_transfer_protocol_daemon_client.h
@@ -19,12 +19,12 @@ #include "base/callback.h" #include "base/macros.h" #include "build/build_config.h" +#include "device/media_transfer_protocol/public/interfaces/mtp_file_entry.mojom.h" #if !defined(OS_CHROMEOS) #error "Only used on ChromeOS" #endif -class MtpFileEntry; class MtpStorageInfo; namespace dbus { @@ -69,7 +69,7 @@ // A callback to handle the result of GetFileInfo. // The argument is a vector of file entries. using GetFileInfoCallback = - base::Callback<void(const std::vector<MtpFileEntry>& file_entries)>; + base::Callback<void(const std::vector<mojom::MtpFileEntry>& file_entries)>; // A callback to handle the result of ReadFileChunkById. // The argument is a string containing the file data.
diff --git a/device/media_transfer_protocol/media_transfer_protocol_manager.cc b/device/media_transfer_protocol/media_transfer_protocol_manager.cc index 480ebbb..148f188 100644 --- a/device/media_transfer_protocol/media_transfer_protocol_manager.cc +++ b/device/media_transfer_protocol/media_transfer_protocol_manager.cc
@@ -24,7 +24,6 @@ #include "chromeos/dbus/dbus_thread_manager.h" #include "dbus/bus.h" #include "device/media_transfer_protocol/media_transfer_protocol_daemon_client.h" -#include "device/media_transfer_protocol/mtp_file_entry.pb.h" #include "device/media_transfer_protocol/mtp_storage_info.pb.h" #include "third_party/cros_system_api/dbus/service_constants.h" @@ -190,7 +189,7 @@ const ReadDirectoryCallback& callback) override { DCHECK(thread_checker_.CalledOnValidThread()); if (!base::ContainsKey(handles_, storage_handle) || !mtp_client_) { - callback.Run(std::vector<MtpFileEntry>(), + callback.Run(std::vector<mojom::MtpFileEntry>(), false /* no more entries */, true /* error */); return; @@ -230,7 +229,7 @@ const GetFileInfoCallback& callback) override { DCHECK(thread_checker_.CalledOnValidThread()); if (!base::ContainsKey(handles_, storage_handle) || !mtp_client_) { - callback.Run(MtpFileEntry(), true); + callback.Run(mojom::MtpFileEntry(), true); return; } std::vector<uint32_t> file_ids; @@ -450,7 +449,7 @@ if (file_ids.empty()) { OnGotDirectoryEntries(storage_handle, file_ids, kInitialOffset, max_size, - file_ids, std::vector<MtpFileEntry>()); + file_ids, std::vector<mojom::MtpFileEntry>()); return; } @@ -470,12 +469,13 @@ weak_ptr_factory_.GetWeakPtr())); } - void OnGotDirectoryEntries(const std::string& storage_handle, - const std::vector<uint32_t>& file_ids, - const size_t offset, - const size_t max_size, - const std::vector<uint32_t>& sorted_file_ids, - const std::vector<MtpFileEntry>& file_entries) { + void OnGotDirectoryEntries( + const std::string& storage_handle, + const std::vector<uint32_t>& file_ids, + const size_t offset, + const size_t max_size, + const std::vector<uint32_t>& sorted_file_ids, + const std::vector<mojom::MtpFileEntry>& file_entries) { DCHECK(thread_checker_.CalledOnValidThread()); DCHECK_EQ(file_ids.size(), sorted_file_ids.size()); @@ -483,7 +483,7 @@ // subset of the requested file ids. for (const auto& entry : file_entries) { std::vector<uint32_t>::const_iterator it = std::lower_bound( - sorted_file_ids.begin(), sorted_file_ids.end(), entry.item_id()); + sorted_file_ids.begin(), sorted_file_ids.end(), entry.item_id); if (it == sorted_file_ids.end()) { OnReadDirectoryError(); return; @@ -518,7 +518,7 @@ void OnReadDirectoryError() { DCHECK(thread_checker_.CalledOnValidThread()); - read_directory_callbacks_.front().Run(std::vector<MtpFileEntry>(), + read_directory_callbacks_.front().Run(std::vector<mojom::MtpFileEntry>(), false /* no more entries */, true /* error */); read_directory_callbacks_.pop(); @@ -536,7 +536,7 @@ read_file_callbacks_.pop(); } - void OnGetFileInfo(const std::vector<MtpFileEntry>& entries) { + void OnGetFileInfo(const std::vector<mojom::MtpFileEntry>& entries) { DCHECK(thread_checker_.CalledOnValidThread()); if (entries.size() == 1) { get_file_info_callbacks_.front().Run(entries[0], false /* no error */); @@ -548,7 +548,7 @@ void OnGetFileInfoError() { DCHECK(thread_checker_.CalledOnValidThread()); - get_file_info_callbacks_.front().Run(MtpFileEntry(), true); + get_file_info_callbacks_.front().Run(mojom::MtpFileEntry(), true); get_file_info_callbacks_.pop(); }
diff --git a/device/media_transfer_protocol/media_transfer_protocol_manager.h b/device/media_transfer_protocol/media_transfer_protocol_manager.h index 4fb48c9..aae23da 100644 --- a/device/media_transfer_protocol/media_transfer_protocol_manager.h +++ b/device/media_transfer_protocol/media_transfer_protocol_manager.h
@@ -15,12 +15,12 @@ #include "base/callback.h" #include "base/memory/ref_counted.h" #include "build/build_config.h" +#include "device/media_transfer_protocol/public/interfaces/mtp_file_entry.mojom.h" #if !defined(OS_CHROMEOS) #error "Only used on ChromeOS" #endif -class MtpFileEntry; class MtpStorageInfo; namespace device { @@ -55,7 +55,7 @@ // The second argument is true if there are more file entries. // The third argument is true if there was an error. using ReadDirectoryCallback = - base::Callback<void(const std::vector<MtpFileEntry>& file_entries, + base::Callback<void(const std::vector<mojom::MtpFileEntry>& file_entries, bool has_more, bool error)>; @@ -69,7 +69,7 @@ // The first argument is a file entry. // The second argument is true if there was an error. using GetFileInfoCallback = - base::Callback<void(const MtpFileEntry& file_entry, bool error)>; + base::Callback<void(const mojom::MtpFileEntry& file_entry, bool error)>; // A callback to handle the result of RenameObject. // The first argument is true if there was an error.
diff --git a/device/media_transfer_protocol/public/interfaces/BUILD.gn b/device/media_transfer_protocol/public/interfaces/BUILD.gn new file mode 100644 index 0000000..736660f --- /dev/null +++ b/device/media_transfer_protocol/public/interfaces/BUILD.gn
@@ -0,0 +1,11 @@ +# Copyright 2017 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//mojo/public/tools/bindings/mojom.gni") + +mojom("interfaces") { + sources = [ + "mtp_file_entry.mojom", + ] +}
diff --git a/device/media_transfer_protocol/public/interfaces/OWNERS b/device/media_transfer_protocol/public/interfaces/OWNERS new file mode 100644 index 0000000..08850f4 --- /dev/null +++ b/device/media_transfer_protocol/public/interfaces/OWNERS
@@ -0,0 +1,2 @@ +per-file *.mojom=set noparent +per-file *.mojom=file://ipc/SECURITY_OWNERS
diff --git a/device/media_transfer_protocol/public/interfaces/mtp_file_entry.mojom b/device/media_transfer_protocol/public/interfaces/mtp_file_entry.mojom new file mode 100644 index 0000000..3d65bb8 --- /dev/null +++ b/device/media_transfer_protocol/public/interfaces/mtp_file_entry.mojom
@@ -0,0 +1,33 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module device.mojom; + +// This is a mojo counterpart of the MtpFileEntry protobuf message from +// //src/third_party/cros_system_api/dbus/mtp_file_entry.proto +// See discussion on https://crbug.com/769630. +struct MtpFileEntry { + enum FileType { + FILE_TYPE_FOLDER = 0, + FILE_TYPE_JPEG = 14, + FILE_TYPE_JFIF = 15, + FILE_TYPE_TIFF = 16, + FILE_TYPE_BMP = 17, + FILE_TYPE_GIF = 18, + FILE_TYPE_PICT = 19, + FILE_TYPE_PNG = 20, + FILE_TYPE_WINDOWSIMAGEFORMAT = 25, + FILE_TYPE_JP2 = 40, + FILE_TYPE_JPX = 41, + FILE_TYPE_UNKNOWN = 44, + FILE_TYPE_OTHER = 9999 + }; + + uint32 item_id = 0xFFFFFFFF; + uint32 parent_id = 0XFFFFFFFF; + string file_name; + uint64 file_size = 0; + int64 modification_time = 0; + FileType file_type = FileType.FILE_TYPE_UNKNOWN; +};
diff --git a/device/usb/BUILD.gn b/device/usb/BUILD.gn index 22f6f26..8f580cfa 100644 --- a/device/usb/BUILD.gn +++ b/device/usb/BUILD.gn
@@ -53,7 +53,6 @@ "//components/device_event_log", "//device/base", "//device/usb/public/interfaces", - "//net", ] public_deps = [ @@ -133,7 +132,6 @@ deps = [ ":usb", "//base", - "//net", "//testing/gtest", ]
diff --git a/device/usb/DEPS b/device/usb/DEPS index b1c259f..ea3225e 100644 --- a/device/usb/DEPS +++ b/device/usb/DEPS
@@ -3,8 +3,5 @@ "+dbus", "+jni", - "-net", - "+net/base", - "+third_party/libusb", ]
diff --git a/device/usb/fake_usb_device_handle.cc b/device/usb/fake_usb_device_handle.cc index 5643aad..cb419fc 100644 --- a/device/usb/fake_usb_device_handle.cc +++ b/device/usb/fake_usb_device_handle.cc
@@ -6,8 +6,8 @@ #include "base/callback.h" #include "base/logging.h" +#include "base/memory/ref_counted_memory.h" #include "device/usb/usb_device.h" -#include "net/base/io_buffer.h" namespace device { @@ -60,7 +60,7 @@ uint8_t request, uint16_t value, uint16_t index, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length, unsigned int timeout, UsbDeviceHandle::TransferCallback callback) { @@ -79,7 +79,7 @@ } if (direction == UsbTransferDirection::INBOUND) { - memcpy(buffer->data(), &data_[position_], bytes_transferred); + memcpy(buffer->front(), &data_[position_], bytes_transferred); position_ += bytes_transferred; } @@ -100,19 +100,20 @@ void FakeUsbDeviceHandle::IsochronousTransferOut( uint8_t endpoint_number, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, const std::vector<uint32_t>& packet_lengths, unsigned int timeout, IsochronousTransferCallback callback) { NOTIMPLEMENTED(); } -void FakeUsbDeviceHandle::GenericTransfer(UsbTransferDirection direction, - uint8_t endpoint_number, - scoped_refptr<net::IOBuffer> buffer, - size_t length, - unsigned int timeout, - TransferCallback callback) { +void FakeUsbDeviceHandle::GenericTransfer( + UsbTransferDirection direction, + uint8_t endpoint_number, + scoped_refptr<base::RefCountedBytes> buffer, + size_t length, + unsigned int timeout, + TransferCallback callback) { NOTIMPLEMENTED(); }
diff --git a/device/usb/fake_usb_device_handle.h b/device/usb/fake_usb_device_handle.h index d61dc4b..97a4a00 100644 --- a/device/usb/fake_usb_device_handle.h +++ b/device/usb/fake_usb_device_handle.h
@@ -44,7 +44,7 @@ uint8_t request, uint16_t value, uint16_t index, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length, unsigned int timeout, TransferCallback callback) override; @@ -55,14 +55,14 @@ IsochronousTransferCallback callback) override; void IsochronousTransferOut(uint8_t endpoint, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, const std::vector<uint32_t>& packet_lengths, unsigned int timeout, IsochronousTransferCallback callback) override; void GenericTransfer(UsbTransferDirection direction, uint8_t endpoint_number, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length, unsigned int timeout, TransferCallback callback) override;
diff --git a/device/usb/mock_usb_device_handle.h b/device/usb/mock_usb_device_handle.h index 215160f1..56e6719 100644 --- a/device/usb/mock_usb_device_handle.h +++ b/device/usb/mock_usb_device_handle.h
@@ -10,8 +10,8 @@ #include <vector> +#include "base/memory/ref_counted_memory.h" #include "device/usb/usb_device_handle.h" -#include "net/base/io_buffer.h" #include "testing/gmock/include/gmock/gmock.h" namespace device { @@ -73,7 +73,7 @@ uint8_t request, uint16_t value, uint16_t index, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length, unsigned int timeout, TransferCallback callback) override { @@ -87,7 +87,7 @@ uint8_t request, uint16_t value, uint16_t index, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length, unsigned int timeout, TransferCallback& callback)); @@ -105,7 +105,7 @@ IsochronousTransferCallback& callback)); void IsochronousTransferOut(uint8_t endpoint, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, const std::vector<uint32_t>& packet_lengths, unsigned int timeout, IsochronousTransferCallback callback) override { @@ -114,14 +114,14 @@ } MOCK_METHOD5(IsochronousTransferOutInternal, void(uint8_t endpoint, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, const std::vector<uint32_t>& packet_lengths, unsigned int timeout, IsochronousTransferCallback& callback)); void GenericTransfer(UsbTransferDirection direction, uint8_t endpoint, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length, unsigned int timeout, TransferCallback callback) override { @@ -131,7 +131,7 @@ MOCK_METHOD6(GenericTransferInternal, void(UsbTransferDirection direction, uint8_t endpoint, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length, unsigned int timeout, TransferCallback& callback));
diff --git a/device/usb/mojo/device_impl.cc b/device/usb/mojo/device_impl.cc index 76a0154..d73c52e 100644 --- a/device/usb/mojo/device_impl.cc +++ b/device/usb/mojo/device_impl.cc
@@ -15,11 +15,11 @@ #include "base/bind.h" #include "base/callback.h" #include "base/memory/ptr_util.h" +#include "base/memory/ref_counted_memory.h" #include "base/stl_util.h" #include "device/usb/mojo/type_converters.h" #include "device/usb/usb_descriptors.h" #include "device/usb/usb_device.h" -#include "net/base/io_buffer.h" namespace device { @@ -30,22 +30,17 @@ namespace { -scoped_refptr<net::IOBuffer> CreateTransferBuffer(size_t size) { - return new net::IOBuffer( - std::max(static_cast<size_t>(1u), static_cast<size_t>(size))); -} - void OnTransferIn(mojom::UsbDevice::GenericTransferInCallback callback, UsbTransferStatus status, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t buffer_size) { std::vector<uint8_t> data; if (buffer) { - // TODO(rockot/reillyg): We should change UsbDeviceHandle to use a - // std::vector<uint8_t> instead of net::IOBuffer. Then we could move - // instead of copy. + // TODO(rockot/reillyg): Take advantage of the ability to access the + // std::vector<uint8_t> within a base::RefCountedBytes to move instead of + // copy. data.resize(buffer_size); - std::copy(buffer->data(), buffer->data() + buffer_size, data.begin()); + std::copy(buffer->front(), buffer->front() + buffer_size, data.begin()); } std::move(callback).Run(mojo::ConvertTo<mojom::UsbTransferStatus>(status), @@ -54,7 +49,7 @@ void OnTransferOut(mojom::UsbDevice::GenericTransferOutCallback callback, UsbTransferStatus status, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t buffer_size) { std::move(callback).Run(mojo::ConvertTo<mojom::UsbTransferStatus>(status)); } @@ -75,13 +70,13 @@ void OnIsochronousTransferIn( mojom::UsbDevice::IsochronousTransferInCallback callback, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, const std::vector<UsbDeviceHandle::IsochronousPacket>& packets) { std::vector<uint8_t> data; if (buffer) { - // TODO(rockot/reillyg): We should change UsbDeviceHandle to use a - // std::vector<uint8_t> instead of net::IOBuffer. Then we could move - // instead of copy. + // TODO(rockot/reillyg): Take advantage of the ability to access the + // std::vector<uint8_t> within a base::RefCountedBytes to move instead of + // copy. uint32_t buffer_size = std::accumulate(packets.begin(), packets.end(), 0u, [](const uint32_t& a, @@ -89,7 +84,7 @@ return a + packet.length; }); data.resize(buffer_size); - std::copy(buffer->data(), buffer->data() + buffer_size, data.begin()); + std::copy(buffer->front(), buffer->front() + buffer_size, data.begin()); } std::move(callback).Run( data, @@ -98,7 +93,7 @@ void OnIsochronousTransferOut( mojom::UsbDevice::IsochronousTransferOutCallback callback, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, const std::vector<UsbDeviceHandle::IsochronousPacket>& packets) { std::move(callback).Run( mojo::ConvertTo<std::vector<mojom::UsbIsochronousPacketPtr>>(packets)); @@ -305,7 +300,7 @@ } if (HasControlTransferPermission(params->recipient, params->index)) { - scoped_refptr<net::IOBuffer> buffer = CreateTransferBuffer(length); + auto buffer = base::MakeRefCounted<base::RefCountedBytes>(length); device_handle_->ControlTransfer( UsbTransferDirection::INBOUND, params->type, params->recipient, params->request, params->value, params->index, buffer, length, timeout, @@ -325,8 +320,7 @@ } if (HasControlTransferPermission(params->recipient, params->index)) { - scoped_refptr<net::IOBuffer> buffer = CreateTransferBuffer(data.size()); - std::copy(data.begin(), data.end(), buffer->data()); + auto buffer = base::MakeRefCounted<base::RefCountedBytes>(data); device_handle_->ControlTransfer( UsbTransferDirection::OUTBOUND, params->type, params->recipient, params->request, params->value, params->index, buffer, data.size(), @@ -346,7 +340,7 @@ } uint8_t endpoint_address = endpoint_number | 0x80; - scoped_refptr<net::IOBuffer> buffer = CreateTransferBuffer(length); + auto buffer = base::MakeRefCounted<base::RefCountedBytes>(length); device_handle_->GenericTransfer( UsbTransferDirection::INBOUND, endpoint_address, buffer, length, timeout, base::BindOnce(&OnTransferIn, std::move(callback))); @@ -362,8 +356,7 @@ } uint8_t endpoint_address = endpoint_number; - scoped_refptr<net::IOBuffer> buffer = CreateTransferBuffer(data.size()); - std::copy(data.begin(), data.end(), buffer->data()); + auto buffer = base::MakeRefCounted<base::RefCountedBytes>(data); device_handle_->GenericTransfer( UsbTransferDirection::OUTBOUND, endpoint_address, buffer, data.size(), timeout, base::BindOnce(&OnTransferOut, std::move(callback))); @@ -400,8 +393,7 @@ } uint8_t endpoint_address = endpoint_number; - scoped_refptr<net::IOBuffer> buffer = CreateTransferBuffer(data.size()); - std::copy(data.begin(), data.end(), buffer->data()); + auto buffer = base::MakeRefCounted<base::RefCountedBytes>(data); device_handle_->IsochronousTransferOut( endpoint_address, buffer, packet_lengths, timeout, base::BindOnce(&OnIsochronousTransferOut, std::move(callback)));
diff --git a/device/usb/mojo/device_impl_unittest.cc b/device/usb/mojo/device_impl_unittest.cc index 252da7f7..f106ad2 100644 --- a/device/usb/mojo/device_impl_unittest.cc +++ b/device/usb/mojo/device_impl_unittest.cc
@@ -18,6 +18,7 @@ #include "base/bind.h" #include "base/containers/queue.h" #include "base/macros.h" +#include "base/memory/ref_counted_memory.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/stl_util.h" @@ -27,7 +28,6 @@ #include "device/usb/mojo/type_converters.h" #include "mojo/public/cpp/bindings/interface_request.h" #include "mojo/public/cpp/bindings/strong_binding.h" -#include "net/base/io_buffer.h" #include "testing/gtest/include/gtest/gtest.h" using ::testing::Invoke; @@ -301,21 +301,20 @@ ASSERT_GE(mock_inbound_data_.size(), 1u); const std::vector<uint8_t>& bytes = mock_inbound_data_.front(); size_t length = bytes.size(); - scoped_refptr<net::IOBuffer> buffer = new net::IOBuffer(length); - std::copy(bytes.begin(), bytes.end(), buffer->data()); + auto buffer = base::MakeRefCounted<base::RefCountedBytes>(bytes); mock_inbound_data_.pop(); std::move(callback).Run(UsbTransferStatus::COMPLETED, buffer, length); } - void OutboundTransfer(scoped_refptr<net::IOBuffer> buffer, + void OutboundTransfer(scoped_refptr<base::RefCountedBytes> buffer, size_t length, UsbDeviceHandle::TransferCallback callback) { ASSERT_GE(mock_outbound_data_.size(), 1u); const std::vector<uint8_t>& bytes = mock_outbound_data_.front(); ASSERT_EQ(bytes.size(), length); for (size_t i = 0; i < length; ++i) { - EXPECT_EQ(bytes[i], buffer->data()[i]) << "Contents differ at index: " - << i; + EXPECT_EQ(bytes[i], buffer->front()[i]) + << "Contents differ at index: " << i; } mock_outbound_data_.pop(); std::move(callback).Run(UsbTransferStatus::COMPLETED, buffer, length); @@ -327,7 +326,7 @@ uint8_t request, uint16_t value, uint16_t index, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length, unsigned int timeout, UsbDeviceHandle::TransferCallback& callback) { @@ -339,7 +338,7 @@ void GenericTransfer(UsbTransferDirection direction, uint8_t endpoint, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length, unsigned int timeout, UsbDeviceHandle::TransferCallback& callback) { @@ -356,9 +355,7 @@ UsbDeviceHandle::IsochronousTransferCallback& callback) { ASSERT_FALSE(mock_inbound_data_.empty()); const std::vector<uint8_t>& bytes = mock_inbound_data_.front(); - size_t length = bytes.size(); - scoped_refptr<net::IOBuffer> buffer = new net::IOBuffer(length); - std::copy(bytes.begin(), bytes.end(), buffer->data()); + auto buffer = base::MakeRefCounted<base::RefCountedBytes>(bytes); mock_inbound_data_.pop(); ASSERT_FALSE(mock_inbound_packets_.empty()); @@ -376,7 +373,7 @@ void IsochronousTransferOut( uint8_t endpoint_number, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, const std::vector<uint32_t>& packet_lengths, unsigned int timeout, UsbDeviceHandle::IsochronousTransferCallback& callback) { @@ -386,8 +383,8 @@ std::accumulate(packet_lengths.begin(), packet_lengths.end(), 0u); ASSERT_EQ(bytes.size(), length); for (size_t i = 0; i < length; ++i) { - EXPECT_EQ(bytes[i], buffer->data()[i]) << "Contents differ at index: " - << i; + EXPECT_EQ(bytes[i], buffer->front()[i]) + << "Contents differ at index: " << i; } mock_outbound_data_.pop();
diff --git a/device/usb/usb_descriptors.cc b/device/usb/usb_descriptors.cc index b776ab6..09c2971 100644 --- a/device/usb/usb_descriptors.cc +++ b/device/usb/usb_descriptors.cc
@@ -12,11 +12,8 @@ #include "base/barrier_closure.h" #include "base/bind.h" +#include "base/memory/ref_counted_memory.h" #include "device/usb/usb_device_handle.h" -#include "net/base/io_buffer.h" - -using net::IOBuffer; -using net::IOBufferWithSize; namespace device { @@ -94,11 +91,11 @@ void OnReadConfigDescriptor(UsbDeviceDescriptor* desc, base::Closure closure, UsbTransferStatus status, - scoped_refptr<IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length) { if (status == UsbTransferStatus::COMPLETED) { if (!desc->Parse( - std::vector<uint8_t>(buffer->data(), buffer->data() + length))) { + std::vector<uint8_t>(buffer->front(), buffer->front() + length))) { LOG(ERROR) << "Failed to parse configuration descriptor."; } } else { @@ -112,12 +109,12 @@ uint8_t index, base::Closure closure, UsbTransferStatus status, - scoped_refptr<IOBuffer> header, + scoped_refptr<base::RefCountedBytes> header, size_t length) { if (status == UsbTransferStatus::COMPLETED && length == 4) { - const uint8_t* data = reinterpret_cast<const uint8_t*>(header->data()); + const uint8_t* data = header->front(); uint16_t total_length = data[2] | data[3] << 8; - scoped_refptr<IOBuffer> buffer = new IOBuffer(total_length); + auto buffer = base::MakeRefCounted<base::RefCountedBytes>(total_length); device_handle->ControlTransfer( UsbTransferDirection::INBOUND, UsbControlTransferType::STANDARD, UsbControlTransferRecipient::DEVICE, kGetDescriptorRequest, @@ -135,7 +132,7 @@ scoped_refptr<UsbDeviceHandle> device_handle, base::OnceCallback<void(std::unique_ptr<UsbDeviceDescriptor>)> callback, UsbTransferStatus status, - scoped_refptr<IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length) { if (status != UsbTransferStatus::COMPLETED) { LOG(ERROR) << "Failed to read device descriptor."; @@ -145,7 +142,7 @@ std::unique_ptr<UsbDeviceDescriptor> desc(new UsbDeviceDescriptor()); if (!desc->Parse( - std::vector<uint8_t>(buffer->data(), buffer->data() + length))) { + std::vector<uint8_t>(buffer->front(), buffer->front() + length))) { LOG(ERROR) << "Device descriptor parsing error."; std::move(callback).Run(nullptr); return; @@ -163,7 +160,7 @@ base::BindOnce(OnDoneReadingConfigDescriptors, device_handle, std::move(desc), std::move(callback))); for (uint8_t i = 0; i < num_configurations; ++i) { - scoped_refptr<IOBufferWithSize> header = new IOBufferWithSize(4); + auto header = base::MakeRefCounted<base::RefCountedBytes>(4); device_handle->ControlTransfer( UsbTransferDirection::INBOUND, UsbControlTransferType::STANDARD, UsbControlTransferRecipient::DEVICE, kGetDescriptorRequest, @@ -184,12 +181,12 @@ void OnReadStringDescriptor( base::OnceCallback<void(const base::string16&)> callback, UsbTransferStatus status, - scoped_refptr<IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length) { base::string16 string; if (status == UsbTransferStatus::COMPLETED && ParseUsbStringDescriptor( - std::vector<uint8_t>(buffer->data(), buffer->data() + length), + std::vector<uint8_t>(buffer->front(), buffer->front() + length), &string)) { std::move(callback).Run(string); } else { @@ -202,7 +199,7 @@ uint8_t index, uint16_t language_id, base::OnceCallback<void(const base::string16&)> callback) { - scoped_refptr<IOBufferWithSize> buffer = new IOBufferWithSize(255); + auto buffer = base::MakeRefCounted<base::RefCountedBytes>(255); device_handle->ControlTransfer( UsbTransferDirection::INBOUND, UsbControlTransferType::STANDARD, UsbControlTransferRecipient::DEVICE, kGetDescriptorRequest, @@ -497,8 +494,8 @@ void ReadUsbDescriptors( scoped_refptr<UsbDeviceHandle> device_handle, base::OnceCallback<void(std::unique_ptr<UsbDeviceDescriptor>)> callback) { - scoped_refptr<IOBufferWithSize> buffer = - new IOBufferWithSize(kDeviceDescriptorLength); + auto buffer = + base::MakeRefCounted<base::RefCountedBytes>(kDeviceDescriptorLength); device_handle->ControlTransfer( UsbTransferDirection::INBOUND, UsbControlTransferType::STANDARD, UsbControlTransferRecipient::DEVICE, kGetDescriptorRequest,
diff --git a/device/usb/usb_descriptors_unittest.cc b/device/usb/usb_descriptors_unittest.cc index 71576ac7..295fbc7 100644 --- a/device/usb/usb_descriptors_unittest.cc +++ b/device/usb/usb_descriptors_unittest.cc
@@ -21,7 +21,7 @@ ACTION_P2(InvokeCallback, data, length) { size_t transferred_length = std::min(length, arg7); - memcpy(arg6->data(), data, transferred_length); + memcpy(arg6->front(), data, transferred_length); std::move(arg9).Run(UsbTransferStatus::COMPLETED, arg6, transferred_length); }
diff --git a/device/usb/usb_device_handle.h b/device/usb/usb_device_handle.h index c9be37a3..2ea8059 100644 --- a/device/usb/usb_device_handle.h +++ b/device/usb/usb_device_handle.h
@@ -19,8 +19,8 @@ #include "device/usb/public/interfaces/device.mojom.h" #include "device/usb/usb_descriptors.h" -namespace net { -class IOBuffer; +namespace base { +class RefCountedBytes; } namespace device { @@ -42,9 +42,9 @@ using ResultCallback = base::OnceCallback<void(bool)>; using TransferCallback = base::OnceCallback< - void(UsbTransferStatus, scoped_refptr<net::IOBuffer>, size_t)>; + void(UsbTransferStatus, scoped_refptr<base::RefCountedBytes>, size_t)>; using IsochronousTransferCallback = - base::OnceCallback<void(scoped_refptr<net::IOBuffer>, + base::OnceCallback<void(scoped_refptr<base::RefCountedBytes>, const std::vector<IsochronousPacket>& packets)>; virtual scoped_refptr<UsbDevice> GetDevice() const = 0; @@ -77,7 +77,7 @@ uint8_t request, uint16_t value, uint16_t index, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length, unsigned int timeout, TransferCallback callback) = 0; @@ -90,14 +90,14 @@ virtual void IsochronousTransferOut( uint8_t endpoint_number, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, const std::vector<uint32_t>& packet_lengths, unsigned int timeout, IsochronousTransferCallback callback) = 0; virtual void GenericTransfer(UsbTransferDirection direction, uint8_t endpoint_number, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length, unsigned int timeout, TransferCallback callback) = 0;
diff --git a/device/usb/usb_device_handle_impl.cc b/device/usb/usb_device_handle_impl.cc index 4599fd6..e2acd94 100644 --- a/device/usb/usb_device_handle_impl.cc +++ b/device/usb/usb_device_handle_impl.cc
@@ -13,6 +13,7 @@ #include "base/bind.h" #include "base/location.h" #include "base/macros.h" +#include "base/memory/ref_counted_memory.h" #include "base/sequence_checker.h" #include "base/single_thread_task_runner.h" #include "base/stl_util.h" @@ -24,7 +25,6 @@ #include "device/usb/usb_device_impl.h" #include "device/usb/usb_error.h" #include "device/usb/usb_service.h" -#include "net/base/io_buffer.h" #include "third_party/libusb/src/libusb/libusb.h" namespace device { @@ -110,7 +110,7 @@ scoped_refptr<base::TaskRunner> callback_task_runner, UsbDeviceHandle::TransferCallback callback, UsbTransferStatus status, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t result) { if (callback_task_runner->RunsTasksInCurrentSequence()) { std::move(callback).Run(status, buffer, result); @@ -209,14 +209,14 @@ uint16_t value, uint16_t index, uint16_t length, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, unsigned int timeout, scoped_refptr<base::TaskRunner> callback_task_runner, TransferCallback* callback); static std::unique_ptr<Transfer> CreateBulkTransfer( scoped_refptr<UsbDeviceHandleImpl> device_handle, uint8_t endpoint, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, int length, unsigned int timeout, scoped_refptr<base::TaskRunner> callback_task_runner, @@ -224,7 +224,7 @@ static std::unique_ptr<Transfer> CreateInterruptTransfer( scoped_refptr<UsbDeviceHandleImpl> device_handle, uint8_t endpoint, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, int length, unsigned int timeout, scoped_refptr<base::TaskRunner> callback_task_runner, @@ -232,7 +232,7 @@ static std::unique_ptr<Transfer> CreateIsochronousTransfer( scoped_refptr<UsbDeviceHandleImpl> device_handle, uint8_t endpoint, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length, const std::vector<uint32_t>& packet_lengths, unsigned int timeout, @@ -258,13 +258,13 @@ Transfer(scoped_refptr<UsbDeviceHandleImpl> device_handle, scoped_refptr<InterfaceClaimer> claimed_interface, UsbTransferType transfer_type, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length, scoped_refptr<base::TaskRunner> callback_task_runner, TransferCallback callback); Transfer(scoped_refptr<UsbDeviceHandleImpl> device_handle, scoped_refptr<InterfaceClaimer> claimed_interface, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, scoped_refptr<base::TaskRunner> callback_task_runner, IsochronousTransferCallback callback); @@ -275,7 +275,7 @@ UsbTransferType transfer_type_; scoped_refptr<UsbDeviceHandleImpl> device_handle_; PlatformUsbTransferHandle platform_transfer_ = nullptr; - scoped_refptr<net::IOBuffer> buffer_; + scoped_refptr<base::RefCountedBytes> buffer_; scoped_refptr<UsbDeviceHandleImpl::InterfaceClaimer> claimed_interface_; size_t length_; bool cancelled_ = false; @@ -294,7 +294,7 @@ uint16_t value, uint16_t index, uint16_t length, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, unsigned int timeout, scoped_refptr<base::TaskRunner> callback_task_runner, TransferCallback* callback) { @@ -310,11 +310,10 @@ return nullptr; } - libusb_fill_control_setup(reinterpret_cast<uint8_t*>(buffer->data()), type, - request, value, index, length); + libusb_fill_control_setup(buffer->front(), type, request, value, index, + length); libusb_fill_control_transfer(transfer->platform_transfer_, - device_handle->handle_, - reinterpret_cast<uint8_t*>(buffer->data()), + device_handle->handle_, buffer->front(), &UsbDeviceHandleImpl::Transfer::PlatformCallback, transfer.get(), timeout); @@ -326,7 +325,7 @@ UsbDeviceHandleImpl::Transfer::CreateBulkTransfer( scoped_refptr<UsbDeviceHandleImpl> device_handle, uint8_t endpoint, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, int length, unsigned int timeout, scoped_refptr<base::TaskRunner> callback_task_runner, @@ -343,11 +342,10 @@ return nullptr; } - libusb_fill_bulk_transfer(transfer->platform_transfer_, - device_handle->handle_, endpoint, - reinterpret_cast<uint8_t*>(buffer->data()), length, - &UsbDeviceHandleImpl::Transfer::PlatformCallback, - transfer.get(), timeout); + libusb_fill_bulk_transfer( + transfer->platform_transfer_, device_handle->handle_, endpoint, + buffer->front(), length, &UsbDeviceHandleImpl::Transfer::PlatformCallback, + transfer.get(), timeout); return transfer; } @@ -357,7 +355,7 @@ UsbDeviceHandleImpl::Transfer::CreateInterruptTransfer( scoped_refptr<UsbDeviceHandleImpl> device_handle, uint8_t endpoint, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, int length, unsigned int timeout, scoped_refptr<base::TaskRunner> callback_task_runner, @@ -376,9 +374,8 @@ libusb_fill_interrupt_transfer( transfer->platform_transfer_, device_handle->handle_, endpoint, - reinterpret_cast<uint8_t*>(buffer->data()), length, - &UsbDeviceHandleImpl::Transfer::PlatformCallback, transfer.get(), - timeout); + buffer->front(), length, &UsbDeviceHandleImpl::Transfer::PlatformCallback, + transfer.get(), timeout); return transfer; } @@ -388,7 +385,7 @@ UsbDeviceHandleImpl::Transfer::CreateIsochronousTransfer( scoped_refptr<UsbDeviceHandleImpl> device_handle, uint8_t endpoint, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length, const std::vector<uint32_t>& packet_lengths, unsigned int timeout, @@ -406,10 +403,10 @@ return nullptr; } - libusb_fill_iso_transfer( - transfer->platform_transfer_, device_handle->handle_, endpoint, - reinterpret_cast<uint8_t*>(buffer->data()), static_cast<int>(length), - num_packets, &Transfer::PlatformCallback, transfer.get(), timeout); + libusb_fill_iso_transfer(transfer->platform_transfer_, device_handle->handle_, + endpoint, buffer->front(), static_cast<int>(length), + num_packets, &Transfer::PlatformCallback, + transfer.get(), timeout); for (size_t i = 0; i < packet_lengths.size(); ++i) transfer->platform_transfer_->iso_packet_desc[i].length = packet_lengths[i]; @@ -421,7 +418,7 @@ scoped_refptr<UsbDeviceHandleImpl> device_handle, scoped_refptr<InterfaceClaimer> claimed_interface, UsbTransferType transfer_type, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length, scoped_refptr<base::TaskRunner> callback_task_runner, TransferCallback callback) @@ -438,7 +435,7 @@ UsbDeviceHandleImpl::Transfer::Transfer( scoped_refptr<UsbDeviceHandleImpl> device_handle, scoped_refptr<InterfaceClaimer> claimed_interface, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, scoped_refptr<base::TaskRunner> callback_task_runner, IsochronousTransferCallback callback) : transfer_type_(UsbTransferType::ISOCHRONOUS), @@ -492,12 +489,10 @@ << "buffer was not correctly set: too small for the control header"; if (length_ >= (LIBUSB_CONTROL_SETUP_SIZE + actual_length)) { - // If the payload is zero bytes long, pad out the allocated buffer - // size to one byte so that an IOBuffer of that size can be allocated. - scoped_refptr<net::IOBuffer> resized_buffer = new net::IOBuffer( - std::max(actual_length, static_cast<size_t>(1))); - memcpy(resized_buffer->data(), - buffer_->data() + LIBUSB_CONTROL_SETUP_SIZE, actual_length); + auto resized_buffer = + base::MakeRefCounted<base::RefCountedBytes>(actual_length); + memcpy(resized_buffer->front(), + buffer_->front() + LIBUSB_CONTROL_SETUP_SIZE, actual_length); buffer_ = resized_buffer; } } @@ -709,16 +704,17 @@ this, endpoint, std::move(callback))); } -void UsbDeviceHandleImpl::ControlTransfer(UsbTransferDirection direction, - UsbControlTransferType request_type, - UsbControlTransferRecipient recipient, - uint8_t request, - uint16_t value, - uint16_t index, - scoped_refptr<net::IOBuffer> buffer, - size_t length, - unsigned int timeout, - TransferCallback callback) { +void UsbDeviceHandleImpl::ControlTransfer( + UsbTransferDirection direction, + UsbControlTransferType request_type, + UsbControlTransferRecipient recipient, + uint8_t request, + uint16_t value, + uint16_t index, + scoped_refptr<base::RefCountedBytes> buffer, + size_t length, + unsigned int timeout, + TransferCallback callback) { if (task_runner_->BelongsToCurrentThread()) { ControlTransferInternal(direction, request_type, recipient, request, value, index, buffer, length, timeout, task_runner_, @@ -755,7 +751,7 @@ void UsbDeviceHandleImpl::IsochronousTransferOut( uint8_t endpoint_number, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, const std::vector<uint32_t>& packet_lengths, unsigned int timeout, IsochronousTransferCallback callback) { @@ -775,12 +771,13 @@ } } -void UsbDeviceHandleImpl::GenericTransfer(UsbTransferDirection direction, - uint8_t endpoint_number, - scoped_refptr<net::IOBuffer> buffer, - size_t length, - unsigned int timeout, - TransferCallback callback) { +void UsbDeviceHandleImpl::GenericTransfer( + UsbTransferDirection direction, + uint8_t endpoint_number, + scoped_refptr<base::RefCountedBytes> buffer, + size_t length, + unsigned int timeout, + TransferCallback callback) { uint8_t endpoint_address = ConvertTransferDirection(direction) | endpoint_number; if (task_runner_->BelongsToCurrentThread()) { @@ -995,7 +992,7 @@ uint8_t request, uint16_t value, uint16_t index, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length, unsigned int timeout, scoped_refptr<base::TaskRunner> callback_task_runner, @@ -1016,14 +1013,9 @@ } const size_t resized_length = LIBUSB_CONTROL_SETUP_SIZE + length; - scoped_refptr<net::IOBuffer> resized_buffer = - new net::IOBufferWithSize(resized_length); - if (!resized_buffer.get()) { - RunTransferCallback(callback_task_runner, std::move(callback), - UsbTransferStatus::TRANSFER_ERROR, buffer, 0); - return; - } - memcpy(resized_buffer->data() + LIBUSB_CONTROL_SETUP_SIZE, buffer->data(), + auto resized_buffer = + base::MakeRefCounted<base::RefCountedBytes>(resized_length); + memcpy(resized_buffer->front() + LIBUSB_CONTROL_SETUP_SIZE, buffer->front(), length); std::unique_ptr<Transfer> transfer = Transfer::CreateControlTransfer( @@ -1057,7 +1049,7 @@ size_t length = std::accumulate(packet_lengths.begin(), packet_lengths.end(), 0u); - scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(length)); + auto buffer = base::MakeRefCounted<base::RefCountedBytes>(length); std::unique_ptr<Transfer> transfer = Transfer::CreateIsochronousTransfer( this, endpoint_address, buffer, length, packet_lengths, timeout, callback_task_runner, &callback); @@ -1067,7 +1059,7 @@ void UsbDeviceHandleImpl::IsochronousTransferOutInternal( uint8_t endpoint_address, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, const std::vector<uint32_t>& packet_lengths, unsigned int timeout, scoped_refptr<base::TaskRunner> callback_task_runner, @@ -1092,7 +1084,7 @@ void UsbDeviceHandleImpl::GenericTransferInternal( uint8_t endpoint_address, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length, unsigned int timeout, scoped_refptr<base::TaskRunner> callback_task_runner,
diff --git a/device/usb/usb_device_handle_impl.h b/device/usb/usb_device_handle_impl.h index c5e7847..50b5159 100644 --- a/device/usb/usb_device_handle_impl.h +++ b/device/usb/usb_device_handle_impl.h
@@ -21,15 +21,12 @@ #include "third_party/libusb/src/libusb/libusb.h" namespace base { +class RefCountedBytes; class SequencedTaskRunner; class SingleThreadTaskRunner; class TaskRunner; } -namespace net { -class IOBuffer; -} - namespace device { struct EndpointMapValue { @@ -65,7 +62,7 @@ uint8_t request, uint16_t value, uint16_t index, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length, unsigned int timeout, TransferCallback callback) override; @@ -76,14 +73,14 @@ IsochronousTransferCallback callback) override; void IsochronousTransferOut(uint8_t endpoint, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, const std::vector<uint32_t>& packet_lengths, unsigned int timeout, IsochronousTransferCallback callback) override; void GenericTransfer(UsbTransferDirection direction, uint8_t endpoint_number, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length, unsigned int timeout, TransferCallback callback) override; @@ -141,7 +138,7 @@ uint8_t request, uint16_t value, uint16_t index, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length, unsigned int timeout, scoped_refptr<base::TaskRunner> callback_task_runner, @@ -156,7 +153,7 @@ void IsochronousTransferOutInternal( uint8_t endpoint_address, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, const std::vector<uint32_t>& packet_lengths, unsigned int timeout, scoped_refptr<base::TaskRunner> callback_task_runner, @@ -164,7 +161,7 @@ void GenericTransferInternal( uint8_t endpoint_address, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length, unsigned int timeout, scoped_refptr<base::TaskRunner> callback_task_runner,
diff --git a/device/usb/usb_device_handle_unittest.cc b/device/usb/usb_device_handle_unittest.cc index 27a60a7..301e47d 100644 --- a/device/usb/usb_device_handle_unittest.cc +++ b/device/usb/usb_device_handle_unittest.cc
@@ -9,6 +9,7 @@ #include <memory> #include "base/bind.h" +#include "base/memory/ref_counted_memory.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/strings/utf_string_conversions.h" @@ -17,7 +18,6 @@ #include "device/test/test_device_client.h" #include "device/test/usb_test_gadget.h" #include "device/usb/usb_device.h" -#include "net/base/io_buffer.h" #include "testing/gtest/include/gtest/gtest.h" namespace device { @@ -100,7 +100,7 @@ private: void SetResult(UsbTransferStatus status, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t transferred) { status_ = status; transferred_ = transferred; @@ -115,7 +115,7 @@ void ExpectTimeoutAndClose(scoped_refptr<UsbDeviceHandle> handle, const base::Closure& quit_closure, UsbTransferStatus status, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t transferred) { EXPECT_EQ(UsbTransferStatus::TIMEOUT, status); handle->Close(); @@ -151,17 +151,17 @@ EXPECT_FALSE(handle->FindInterfaceByEndpoint(0x82)); EXPECT_FALSE(handle->FindInterfaceByEndpoint(0x02)); - scoped_refptr<net::IOBufferWithSize> in_buffer(new net::IOBufferWithSize(64)); + auto in_buffer = base::MakeRefCounted<base::RefCountedBytes>(64); TestCompletionCallback in_completion; handle->GenericTransfer(UsbTransferDirection::INBOUND, 0x81, in_buffer.get(), in_buffer->size(), 5000, // 5 second timeout in_completion.GetCallback()); - scoped_refptr<net::IOBufferWithSize> out_buffer( - new net::IOBufferWithSize(in_buffer->size())); + auto out_buffer = + base::MakeRefCounted<base::RefCountedBytes>(in_buffer->size()); TestCompletionCallback out_completion; - for (int i = 0; i < out_buffer->size(); ++i) { + for (size_t i = 0; i < out_buffer->size(); ++i) { out_buffer->data()[i] = i; } @@ -179,7 +179,7 @@ EXPECT_EQ(static_cast<size_t>(in_buffer->size()), in_completion.transferred()); for (size_t i = 0; i < in_completion.transferred(); ++i) { - EXPECT_EQ(out_buffer->data()[i], in_buffer->data()[i]) + EXPECT_EQ(out_buffer->front()[i], in_buffer->front()[i]) << "Mismatch at index " << i << "."; } @@ -219,18 +219,17 @@ EXPECT_TRUE(interface); EXPECT_EQ(1, interface->interface_number); - scoped_refptr<net::IOBufferWithSize> in_buffer( - new net::IOBufferWithSize(512)); + auto in_buffer = base::MakeRefCounted<base::RefCountedBytes>(512); TestCompletionCallback in_completion; handle->GenericTransfer(UsbTransferDirection::INBOUND, 0x82, in_buffer.get(), in_buffer->size(), 5000, // 5 second timeout in_completion.GetCallback()); - scoped_refptr<net::IOBufferWithSize> out_buffer( - new net::IOBufferWithSize(in_buffer->size())); + auto out_buffer = + base::MakeRefCounted<base::RefCountedBytes>(in_buffer->size()); TestCompletionCallback out_completion; - for (int i = 0; i < out_buffer->size(); ++i) { + for (size_t i = 0; i < out_buffer->size(); ++i) { out_buffer->data()[i] = i; } @@ -248,7 +247,7 @@ EXPECT_EQ(static_cast<size_t>(in_buffer->size()), in_completion.transferred()); for (size_t i = 0; i < in_completion.transferred(); ++i) { - EXPECT_EQ(out_buffer->data()[i], in_buffer->data()[i]) + EXPECT_EQ(out_buffer->front()[i], in_buffer->front()[i]) << "Mismatch at index " << i << "."; } @@ -272,7 +271,7 @@ scoped_refptr<UsbDeviceHandle> handle = open_device.WaitForResult(); ASSERT_TRUE(handle.get()); - scoped_refptr<net::IOBufferWithSize> buffer(new net::IOBufferWithSize(255)); + auto buffer = base::MakeRefCounted<base::RefCountedBytes>(255); TestCompletionCallback completion; handle->ControlTransfer( UsbTransferDirection::INBOUND, UsbControlTransferType::STANDARD, @@ -283,8 +282,8 @@ const char expected_str[] = "\x18\x03G\0o\0o\0g\0l\0e\0 \0I\0n\0c\0.\0"; EXPECT_EQ(sizeof(expected_str) - 1, completion.transferred()); for (size_t i = 0; i < completion.transferred(); ++i) { - EXPECT_EQ(expected_str[i], buffer->data()[i]) << "Mismatch at index " << i - << "."; + EXPECT_EQ(expected_str[i], buffer->front()[i]) + << "Mismatch at index " << i << "."; } handle->Close(); @@ -339,7 +338,7 @@ handle->ClaimInterface(1, claim_interface.GetCallback()); ASSERT_TRUE(claim_interface.WaitForResult()); - scoped_refptr<net::IOBufferWithSize> buffer(new net::IOBufferWithSize(512)); + auto buffer = base::MakeRefCounted<base::RefCountedBytes>(512); TestCompletionCallback completion; handle->GenericTransfer(UsbTransferDirection::INBOUND, 0x82, buffer.get(), buffer->size(), @@ -370,7 +369,7 @@ handle->ClaimInterface(1, claim_interface.GetCallback()); ASSERT_TRUE(claim_interface.WaitForResult()); - scoped_refptr<net::IOBufferWithSize> buffer(new net::IOBufferWithSize(512)); + auto buffer = base::MakeRefCounted<base::RefCountedBytes>(512); TestCompletionCallback completion; handle->GenericTransfer(UsbTransferDirection::INBOUND, 0x82, buffer.get(), buffer->size(), @@ -408,7 +407,7 @@ handle->ClaimInterface(1, claim_interface.GetCallback()); ASSERT_TRUE(claim_interface.WaitForResult()); - scoped_refptr<net::IOBufferWithSize> buffer(new net::IOBufferWithSize(512)); + auto buffer = base::MakeRefCounted<base::RefCountedBytes>(512); TestCompletionCallback completion; handle->GenericTransfer(UsbTransferDirection::INBOUND, 0x82, buffer.get(), buffer->size(), @@ -440,7 +439,7 @@ ASSERT_TRUE(claim_interface.WaitForResult()); base::RunLoop run_loop; - auto buffer = base::MakeRefCounted<net::IOBufferWithSize>(512); + auto buffer = base::MakeRefCounted<base::RefCountedBytes>(512); handle->GenericTransfer( UsbTransferDirection::INBOUND, 0x82, buffer.get(), buffer->size(), 10, // 10 millisecond timeout
diff --git a/device/usb/usb_device_handle_usbfs.cc b/device/usb/usb_device_handle_usbfs.cc index 6e658f1..440c0dbb 100644 --- a/device/usb/usb_device_handle_usbfs.cc +++ b/device/usb/usb_device_handle_usbfs.cc
@@ -19,6 +19,7 @@ #include "base/cancelable_callback.h" #include "base/files/file_descriptor_watcher_posix.h" #include "base/logging.h" +#include "base/memory/ref_counted_memory.h" #include "base/posix/eintr_wrapper.h" #include "base/sequence_checker.h" #include "base/stl_util.h" @@ -26,7 +27,6 @@ #include "base/threading/thread_task_runner_handle.h" #include "components/device_event_log/device_event_log.h" #include "device/usb/usb_device_linux.h" -#include "net/base/io_buffer.h" namespace device { @@ -73,19 +73,18 @@ return 0; } -scoped_refptr<net::IOBuffer> BuildControlTransferBuffer( +scoped_refptr<base::RefCountedBytes> BuildControlTransferBuffer( UsbTransferDirection direction, UsbControlTransferType request_type, UsbControlTransferRecipient recipient, uint8_t request, uint16_t value, uint16_t index, - scoped_refptr<net::IOBuffer> original_buffer, + scoped_refptr<base::RefCountedBytes> original_buffer, size_t length) { - scoped_refptr<net::IOBuffer> new_buffer( - new net::IOBuffer(length + sizeof(usb_ctrlrequest))); - usb_ctrlrequest* setup = - reinterpret_cast<usb_ctrlrequest*>(new_buffer->data()); + auto new_buffer = base::MakeRefCounted<base::RefCountedBytes>( + length + sizeof(usb_ctrlrequest)); + usb_ctrlrequest* setup = new_buffer->front_as<usb_ctrlrequest>(); setup->bRequestType = ConvertEndpointDirection(direction) | ConvertRequestType(request_type) | ConvertRecipient(recipient); @@ -93,8 +92,8 @@ setup->wValue = value; setup->wIndex = index; setup->wLength = length; - memcpy(new_buffer->data() + sizeof(usb_ctrlrequest), original_buffer->data(), - length); + memcpy(new_buffer->front() + sizeof(usb_ctrlrequest), + original_buffer->front(), length); return new_buffer; } @@ -165,10 +164,10 @@ struct UsbDeviceHandleUsbfs::Transfer { Transfer() = delete; - Transfer(scoped_refptr<net::IOBuffer> buffer, + Transfer(scoped_refptr<base::RefCountedBytes> buffer, TransferCallback callback, scoped_refptr<base::SingleThreadTaskRunner> callback_runner); - Transfer(scoped_refptr<net::IOBuffer> buffer, + Transfer(scoped_refptr<base::RefCountedBytes> buffer, IsochronousTransferCallback callback); ~Transfer(); @@ -176,8 +175,8 @@ void RunCallback(UsbTransferStatus status, size_t bytes_transferred); void RunIsochronousCallback(const std::vector<IsochronousPacket>& packets); - scoped_refptr<net::IOBuffer> control_transfer_buffer; - scoped_refptr<net::IOBuffer> buffer; + scoped_refptr<base::RefCountedBytes> control_transfer_buffer; + scoped_refptr<base::RefCountedBytes> buffer; base::CancelableClosure timeout_closure; bool cancelled = false; @@ -354,7 +353,7 @@ } UsbDeviceHandleUsbfs::Transfer::Transfer( - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, TransferCallback callback, scoped_refptr<base::SingleThreadTaskRunner> callback_runner) : buffer(buffer), @@ -362,16 +361,17 @@ callback_runner(callback_runner) { memset(&urb, 0, sizeof(urb)); urb.usercontext = this; - urb.buffer = buffer->data(); + urb.buffer = buffer->front(); } -UsbDeviceHandleUsbfs::Transfer::Transfer(scoped_refptr<net::IOBuffer> buffer, - IsochronousTransferCallback callback) +UsbDeviceHandleUsbfs::Transfer::Transfer( + scoped_refptr<base::RefCountedBytes> buffer, + IsochronousTransferCallback callback) : buffer(buffer), isoc_callback(std::move(callback)) { memset(&urb, 0, sizeof(urb) + sizeof(usbdevfs_iso_packet_desc) * urb.number_of_packets); urb.usercontext = this; - urb.buffer = buffer->data(); + urb.buffer = buffer->front(); } UsbDeviceHandleUsbfs::Transfer::~Transfer() = default; @@ -582,7 +582,7 @@ uint8_t request, uint16_t value, uint16_t index, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length, unsigned int timeout, TransferCallback callback) { @@ -601,7 +601,7 @@ value, index, buffer, length); transfer->urb.type = USBDEVFS_URB_TYPE_CONTROL; transfer->urb.endpoint = 0; - transfer->urb.buffer = transfer->control_transfer_buffer->data(); + transfer->urb.buffer = transfer->control_transfer_buffer->front(); transfer->urb.buffer_length = 8 + length; // USBDEVFS_SUBMITURB appears to be non-blocking as completion is reported @@ -628,14 +628,14 @@ uint8_t endpoint_address = USB_DIR_IN | endpoint_number; size_t total_length = std::accumulate(packet_lengths.begin(), packet_lengths.end(), 0u); - scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(total_length)); + auto buffer = base::MakeRefCounted<base::RefCountedBytes>(total_length); IsochronousTransferInternal(endpoint_address, buffer, total_length, packet_lengths, timeout, std::move(callback)); } void UsbDeviceHandleUsbfs::IsochronousTransferOut( uint8_t endpoint_number, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, const std::vector<uint32_t>& packet_lengths, unsigned int timeout, IsochronousTransferCallback callback) { @@ -647,12 +647,13 @@ packet_lengths, timeout, std::move(callback)); } -void UsbDeviceHandleUsbfs::GenericTransfer(UsbTransferDirection direction, - uint8_t endpoint_number, - scoped_refptr<net::IOBuffer> buffer, - size_t length, - unsigned int timeout, - TransferCallback callback) { +void UsbDeviceHandleUsbfs::GenericTransfer( + UsbTransferDirection direction, + uint8_t endpoint_number, + scoped_refptr<base::RefCountedBytes> buffer, + size_t length, + unsigned int timeout, + TransferCallback callback) { if (task_runner_->BelongsToCurrentThread()) { GenericTransferInternal(direction, endpoint_number, buffer, length, timeout, std::move(callback), task_runner_); @@ -715,7 +716,7 @@ void UsbDeviceHandleUsbfs::IsochronousTransferInternal( uint8_t endpoint_address, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t total_length, const std::vector<uint32_t>& packet_lengths, unsigned int timeout, @@ -764,7 +765,7 @@ void UsbDeviceHandleUsbfs::GenericTransferInternal( UsbTransferDirection direction, uint8_t endpoint_number, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length, unsigned int timeout, TransferCallback callback, @@ -855,8 +856,8 @@ if (transfer->urb.status == 0 && transfer->urb.type == USBDEVFS_URB_TYPE_CONTROL) { // Copy the result of the control transfer back into the original buffer. - memcpy(transfer->buffer->data(), - transfer->control_transfer_buffer->data() + 8, + memcpy(transfer->buffer->front(), + transfer->control_transfer_buffer->front() + 8, transfer->urb.actual_length); }
diff --git a/device/usb/usb_device_handle_usbfs.h b/device/usb/usb_device_handle_usbfs.h index 57446f5..5061df7a 100644 --- a/device/usb/usb_device_handle_usbfs.h +++ b/device/usb/usb_device_handle_usbfs.h
@@ -54,7 +54,7 @@ uint8_t request, uint16_t value, uint16_t index, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length, unsigned int timeout, TransferCallback callback) override; @@ -63,7 +63,7 @@ unsigned int timeout, IsochronousTransferCallback callback) override; void IsochronousTransferOut(uint8_t endpoint_number, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, const std::vector<uint32_t>& packet_lengths, unsigned int timeout, IsochronousTransferCallback callback) override; @@ -71,7 +71,7 @@ // completion |callback| will be run on that thread. void GenericTransfer(UsbTransferDirection direction, uint8_t endpoint_number, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length, unsigned int timeout, TransferCallback callback) override; @@ -108,7 +108,7 @@ ResultCallback callback); void ReleaseInterfaceComplete(int interface_number, ResultCallback callback); void IsochronousTransferInternal(uint8_t endpoint_address, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t total_length, const std::vector<uint32_t>& packet_lengths, unsigned int timeout, @@ -116,7 +116,7 @@ void GenericTransferInternal( UsbTransferDirection direction, uint8_t endpoint_number, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length, unsigned int timeout, TransferCallback callback,
diff --git a/device/usb/usb_device_handle_win.cc b/device/usb/usb_device_handle_win.cc index 6ed5484e..660a741c 100644 --- a/device/usb/usb_device_handle_win.cc +++ b/device/usb/usb_device_handle_win.cc
@@ -13,6 +13,7 @@ #include "base/location.h" #include "base/macros.h" #include "base/memory/ptr_util.h" +#include "base/memory/ref_counted_memory.h" #include "base/single_thread_task_runner.h" #include "base/stl_util.h" #include "base/strings/string16.h" @@ -24,7 +25,6 @@ #include "device/usb/usb_descriptors.h" #include "device/usb/usb_device_win.h" #include "device/usb/usb_service.h" -#include "net/base/io_buffer.h" namespace device { @@ -157,16 +157,17 @@ } } -void UsbDeviceHandleWin::ControlTransfer(UsbTransferDirection direction, - UsbControlTransferType request_type, - UsbControlTransferRecipient recipient, - uint8_t request, - uint16_t value, - uint16_t index, - scoped_refptr<net::IOBuffer> buffer, - size_t length, - unsigned int timeout, - TransferCallback callback) { +void UsbDeviceHandleWin::ControlTransfer( + UsbTransferDirection direction, + UsbControlTransferType request_type, + UsbControlTransferRecipient recipient, + uint8_t request, + uint16_t value, + uint16_t index, + scoped_refptr<base::RefCountedBytes> buffer, + size_t length, + unsigned int timeout, + TransferCallback callback) { DCHECK(thread_checker_.CalledOnValidThread()); if (!device_) { @@ -199,9 +200,9 @@ } else if (((value >> 8) == USB_CONFIGURATION_DESCRIPTOR_TYPE) || ((value >> 8) == USB_STRING_DESCRIPTOR_TYPE)) { size_t size = sizeof(USB_DESCRIPTOR_REQUEST) + length; - scoped_refptr<net::IOBuffer> request_buffer(new net::IOBuffer(size)); + auto request_buffer = base::MakeRefCounted<base::RefCountedBytes>(size); USB_DESCRIPTOR_REQUEST* descriptor_request = - reinterpret_cast<USB_DESCRIPTOR_REQUEST*>(request_buffer->data()); + request_buffer->front_as<USB_DESCRIPTOR_REQUEST>(); descriptor_request->ConnectionIndex = device_->port_number(); descriptor_request->SetupPacket.bmRequest = BMREQUEST_DEVICE_TO_HOST; descriptor_request->SetupPacket.bRequest = USB_REQUEST_GET_DESCRIPTOR; @@ -213,8 +214,8 @@ request->MaybeStartWatching( DeviceIoControl(hub_handle_.Get(), IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, - request_buffer->data(), size, - request_buffer->data(), size, nullptr, + request_buffer->front(), size, + request_buffer->front(), size, nullptr, request->overlapped()), base::BindOnce(&UsbDeviceHandleWin::GotDescriptorFromNodeConnection, weak_factory_.GetWeakPtr(), std::move(callback), @@ -247,19 +248,20 @@ void UsbDeviceHandleWin::IsochronousTransferOut( uint8_t endpoint_number, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, const std::vector<uint32_t>& packet_lengths, unsigned int timeout, IsochronousTransferCallback callback) { DCHECK(thread_checker_.CalledOnValidThread()); } -void UsbDeviceHandleWin::GenericTransfer(UsbTransferDirection direction, - uint8_t endpoint_number, - scoped_refptr<net::IOBuffer> buffer, - size_t length, - unsigned int timeout, - TransferCallback callback) { +void UsbDeviceHandleWin::GenericTransfer( + UsbTransferDirection direction, + uint8_t endpoint_number, + scoped_refptr<base::RefCountedBytes> buffer, + size_t length, + unsigned int timeout, + TransferCallback callback) { // This one must be callable from any thread. } @@ -300,7 +302,7 @@ void UsbDeviceHandleWin::GotNodeConnectionInformation( TransferCallback callback, void* node_connection_info_ptr, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t buffer_length, Request* request_ptr, DWORD win32_result, @@ -319,7 +321,7 @@ DCHECK_EQ(bytes_transferred, sizeof(USB_NODE_CONNECTION_INFORMATION_EX)); bytes_transferred = std::min(sizeof(USB_DEVICE_DESCRIPTOR), buffer_length); - memcpy(buffer->data(), &node_connection_info->DeviceDescriptor, + memcpy(buffer->front(), &node_connection_info->DeviceDescriptor, bytes_transferred); std::move(callback).Run(UsbTransferStatus::COMPLETED, buffer, bytes_transferred); @@ -327,8 +329,8 @@ void UsbDeviceHandleWin::GotDescriptorFromNodeConnection( TransferCallback callback, - scoped_refptr<net::IOBuffer> request_buffer, - scoped_refptr<net::IOBuffer> original_buffer, + scoped_refptr<base::RefCountedBytes> request_buffer, + scoped_refptr<base::RefCountedBytes> original_buffer, size_t original_buffer_length, Request* request_ptr, DWORD win32_result, @@ -344,8 +346,8 @@ DCHECK_GE(bytes_transferred, sizeof(USB_DESCRIPTOR_REQUEST)); bytes_transferred -= sizeof(USB_DESCRIPTOR_REQUEST); - memcpy(original_buffer->data(), - request_buffer->data() + sizeof(USB_DESCRIPTOR_REQUEST), + memcpy(original_buffer->front(), + request_buffer->front() + sizeof(USB_DESCRIPTOR_REQUEST), bytes_transferred); std::move(callback).Run(UsbTransferStatus::COMPLETED, original_buffer, bytes_transferred);
diff --git a/device/usb/usb_device_handle_win.h b/device/usb/usb_device_handle_win.h index d7102e3..ce702b8 100644 --- a/device/usb/usb_device_handle_win.h +++ b/device/usb/usb_device_handle_win.h
@@ -17,14 +17,11 @@ #include "device/usb/usb_device_handle.h" namespace base { +class RefCountedBytes; class SequencedTaskRunner; class SingleThreadTaskRunner; } -namespace net { -class IOBuffer; -} - namespace device { class UsbDeviceWin; @@ -50,7 +47,7 @@ uint8_t request, uint16_t value, uint16_t index, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length, unsigned int timeout, TransferCallback callback) override; @@ -61,14 +58,14 @@ IsochronousTransferCallback callback) override; void IsochronousTransferOut(uint8_t endpoint, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, const std::vector<uint32_t>& packet_lengths, unsigned int timeout, IsochronousTransferCallback callback) override; void GenericTransfer(UsbTransferDirection direction, uint8_t endpoint_number, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length, unsigned int timeout, TransferCallback callback) override; @@ -93,15 +90,15 @@ std::unique_ptr<Request> UnlinkRequest(Request* request); void GotNodeConnectionInformation(TransferCallback callback, void* node_connection_info, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t buffer_length, Request* request_ptr, DWORD win32_result, size_t bytes_transferred); void GotDescriptorFromNodeConnection( TransferCallback callback, - scoped_refptr<net::IOBuffer> request_buffer, - scoped_refptr<net::IOBuffer> original_buffer, + scoped_refptr<base::RefCountedBytes> request_buffer, + scoped_refptr<base::RefCountedBytes> original_buffer, size_t original_buffer_length, Request* request_ptr, DWORD win32_result,
diff --git a/device/usb/usb_service_impl.cc b/device/usb/usb_service_impl.cc index b355b92..c6114b1c 100644 --- a/device/usb/usb_service_impl.cc +++ b/device/usb/usb_service_impl.cc
@@ -14,6 +14,7 @@ #include "base/barrier_closure.h" #include "base/bind.h" #include "base/location.h" +#include "base/memory/ref_counted_memory.h" #include "base/memory/weak_ptr.h" #include "base/sequenced_task_runner.h" #include "base/single_thread_task_runner.h" @@ -26,7 +27,6 @@ #include "device/usb/usb_device_handle.h" #include "device/usb/usb_error.h" #include "device/usb/webusb_descriptors.h" -#include "net/base/io_buffer.h" #include "third_party/libusb/src/libusb/libusb.h" #if defined(OS_WIN) @@ -39,8 +39,6 @@ #include "device/base/device_info_query_win.h" #endif // OS_WIN -using net::IOBufferWithSize; - namespace device { namespace {
diff --git a/device/usb/webusb_descriptors.cc b/device/usb/webusb_descriptors.cc index 9809b341..6846b88 100644 --- a/device/usb/webusb_descriptors.cc +++ b/device/usb/webusb_descriptors.cc
@@ -7,12 +7,10 @@ #include "base/bind.h" #include "base/callback.h" #include "base/logging.h" +#include "base/memory/ref_counted_memory.h" #include "base/stl_util.h" #include "components/device_event_log/device_event_log.h" #include "device/usb/usb_device_handle.h" -#include "net/base/io_buffer.h" - -using net::IOBufferWithSize; namespace device { @@ -44,7 +42,7 @@ void OnReadLandingPage(uint8_t landing_page_id, const ReadWebUsbDescriptorsCallback& callback, UsbTransferStatus status, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length) { if (status != UsbTransferStatus::COMPLETED) { USB_LOG(EVENT) << "Failed to read WebUSB URL descriptor: " @@ -55,7 +53,7 @@ GURL url; ParseWebUsbUrlDescriptor( - std::vector<uint8_t>(buffer->data(), buffer->data() + length), &url); + std::vector<uint8_t>(buffer->front(), buffer->front() + length), &url); callback.Run(url); } @@ -63,7 +61,7 @@ uint8_t landing_page_id, scoped_refptr<UsbDeviceHandle> device_handle, const ReadWebUsbDescriptorsCallback& callback) { - auto buffer = base::MakeRefCounted<IOBufferWithSize>(255); + auto buffer = base::MakeRefCounted<base::RefCountedBytes>(255); device_handle->ControlTransfer( UsbTransferDirection::INBOUND, UsbControlTransferType::VENDOR, UsbControlTransferRecipient::DEVICE, vendor_code, landing_page_id, @@ -74,7 +72,7 @@ void OnReadBosDescriptor(scoped_refptr<UsbDeviceHandle> device_handle, const ReadWebUsbDescriptorsCallback& callback, UsbTransferStatus status, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length) { if (status != UsbTransferStatus::COMPLETED) { USB_LOG(EVENT) << "Failed to read BOS descriptor."; @@ -84,7 +82,7 @@ WebUsbPlatformCapabilityDescriptor descriptor; if (!descriptor.ParseFromBosDescriptor( - std::vector<uint8_t>(buffer->data(), buffer->data() + length))) { + std::vector<uint8_t>(buffer->front(), buffer->front() + length))) { callback.Run(GURL()); return; } @@ -100,7 +98,7 @@ void OnReadBosDescriptorHeader(scoped_refptr<UsbDeviceHandle> device_handle, const ReadWebUsbDescriptorsCallback& callback, UsbTransferStatus status, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t length) { if (status != UsbTransferStatus::COMPLETED || length != 5) { USB_LOG(EVENT) << "Failed to read BOS descriptor header."; @@ -108,9 +106,9 @@ return; } - const uint8_t* data = reinterpret_cast<uint8_t*>(buffer->data()); + const uint8_t* data = buffer->front(); uint16_t new_length = data[2] | (data[3] << 8); - scoped_refptr<IOBufferWithSize> new_buffer = new IOBufferWithSize(new_length); + auto new_buffer = base::MakeRefCounted<base::RefCountedBytes>(new_length); device_handle->ControlTransfer( UsbTransferDirection::INBOUND, UsbControlTransferType::STANDARD, UsbControlTransferRecipient::DEVICE, kGetDescriptorRequest, @@ -251,7 +249,7 @@ void ReadWebUsbDescriptors(scoped_refptr<UsbDeviceHandle> device_handle, const ReadWebUsbDescriptorsCallback& callback) { - auto buffer = base::MakeRefCounted<IOBufferWithSize>(5); + auto buffer = base::MakeRefCounted<base::RefCountedBytes>(5); device_handle->ControlTransfer( UsbTransferDirection::INBOUND, UsbControlTransferType::STANDARD, UsbControlTransferRecipient::DEVICE, kGetDescriptorRequest,
diff --git a/device/usb/webusb_descriptors_unittest.cc b/device/usb/webusb_descriptors_unittest.cc index 6f6b81a..fc13c2c 100644 --- a/device/usb/webusb_descriptors_unittest.cc +++ b/device/usb/webusb_descriptors_unittest.cc
@@ -43,7 +43,7 @@ ACTION_P2(InvokeCallback, data, length) { size_t transferred_length = std::min(length, arg7); - memcpy(arg6->data(), data, transferred_length); + memcpy(arg6->front(), data, transferred_length); std::move(arg9).Run(UsbTransferStatus::COMPLETED, arg6, transferred_length); }
diff --git a/device/vr/BUILD.gn b/device/vr/BUILD.gn index f9064fd..d9421119 100644 --- a/device/vr/BUILD.gn +++ b/device/vr/BUILD.gn
@@ -70,7 +70,9 @@ "//third_party/WebKit/public:blink_headers", ] ldflags = [ "-landroid" ] - libs = [ "//third_party/gvr-android-sdk/libgvr_shim_static_${current_cpu}.a" ] + libs = [ + "//third_party/gvr-android-sdk/libgvr_shim_static_${current_cpu}.a", + ] configs += [ "//third_party/gvr-android-sdk:libgvr_config" ] }
diff --git a/docs/win_cross.md b/docs/win_cross.md index 6d78cef7..926a552 100644 --- a/docs/win_cross.md +++ b/docs/win_cross.md
@@ -1,15 +1,15 @@ # Cross-compiling Chrome/win -It's possible to build most parts of the codebase on a Linux (and soon, Mac) -host while targeting Windows. This document describes how to set that up, and -current restrictions. +It's possible to build most parts of the codebase on a Linux or Mac host while +targeting Windows. This document describes how to set that up, and current +restrictions. What does *not* work: * goma. Sorry. ([internal bug](http://b/64390790)) You can use the [jumbo build](jumbo.md) for faster build times. * mini_installer ([bug](https://crbug.com/762073)) -* linking on Mac ([bug](https://crbug.com/774209)), should change soon +* on Mac hosts, building a 32-bit chrome ([bug](https://crbug.com/794838)) All other targets build fine (including `chrome`, `browser_tests`, ...).
diff --git a/extensions/browser/api/app_window/app_window_apitest.cc b/extensions/browser/api/app_window/app_window_apitest.cc index f3685fb..b64801d 100644 --- a/extensions/browser/api/app_window/app_window_apitest.cc +++ b/extensions/browser/api/app_window/app_window_apitest.cc
@@ -54,23 +54,40 @@ app_window->app_icon_url().spec().find("icon.png")); } -// TODO(asargent) - Figure out what to do about the fact that minimize events -// don't work under ubuntu unity. -// (crbug.com/162794 and https://bugs.launchpad.net/unity/+bug/998073). -// TODO(linux_aura) http://crbug.com/163931 -// Flaky on Mac, http://crbug.com/232330 -#if defined(TOOLKIT_VIEWS) && !(defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA)) +// TODO(crbug.com/794771): These fail on Linux with HEADLESS env var set. +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) +#define MAYBE_OnMinimizedEvent DISABLED_OnMinimizedEvent +#define MAYBE_OnMaximizedEvent DISABLED_OnMaximizedEvent +#define MAYBE_OnRestoredEvent DISABLED_OnRestoredEvent +#else +#define MAYBE_OnMinimizedEvent OnMinimizedEvent +#define MAYBE_OnMaximizedEvent OnMaximizedEvent +#define MAYBE_OnRestoredEvent OnRestoredEvent +#endif // defined(OS_LINUX) -IN_PROC_BROWSER_TEST_F(AppWindowApiTest, Properties) { -#if defined(OS_MACOSX) - if (base::mac::IsOS10_10()) - return; // Fails when swarmed. http://crbug.com/660582 -#endif - EXPECT_TRUE( - RunExtensionTest("platform_apps/windows_api_properties")) << message_; +IN_PROC_BROWSER_TEST_F(AppWindowApiTest, MAYBE_OnMinimizedEvent) { + EXPECT_TRUE(RunExtensionTestWithArg("platform_apps/windows_api_properties", + "minimized")) + << message_; } -#endif // defined(TOOLKIT_VIEWS) +IN_PROC_BROWSER_TEST_F(AppWindowApiTest, MAYBE_OnMaximizedEvent) { + EXPECT_TRUE(RunExtensionTestWithArg("platform_apps/windows_api_properties", + "maximized")) + << message_; +} + +IN_PROC_BROWSER_TEST_F(AppWindowApiTest, MAYBE_OnRestoredEvent) { + EXPECT_TRUE(RunExtensionTestWithArg("platform_apps/windows_api_properties", + "restored")) + << message_; +} + +IN_PROC_BROWSER_TEST_F(AppWindowApiTest, OnBoundsChangedEvent) { + EXPECT_TRUE(RunExtensionTestWithArg("platform_apps/windows_api_properties", + "boundsChanged")) + << message_; +} IN_PROC_BROWSER_TEST_F(AppWindowApiTest, AlwaysOnTopWithPermissions) { EXPECT_TRUE(RunPlatformAppTest(
diff --git a/extensions/browser/api/usb/usb_api.cc b/extensions/browser/api/usb/usb_api.cc index 2789b6d..f9a2f31 100644 --- a/extensions/browser/api/usb/usb_api.cc +++ b/extensions/browser/api/usb/usb_api.cc
@@ -14,6 +14,7 @@ #include "base/barrier_closure.h" #include "base/memory/ptr_util.h" +#include "base/memory/ref_counted_memory.h" #include "base/values.h" #include "device/base/device_client.h" #include "device/usb/public/cpp/filter_utils.h" @@ -206,29 +207,25 @@ } template <class T> -scoped_refptr<net::IOBuffer> CreateBufferForTransfer( +scoped_refptr<base::RefCountedBytes> CreateBufferForTransfer( const T& input, UsbTransferDirection direction, size_t size) { if (size >= kMaxTransferLength) - return NULL; - - // Allocate a |size|-bytes buffer, or a one-byte buffer if |size| is 0. This - // is due to an impedance mismatch between IOBuffer and URBs. An IOBuffer - // cannot represent a zero-length buffer, while an URB can. - scoped_refptr<net::IOBuffer> buffer = - new net::IOBuffer(std::max(static_cast<size_t>(1), size)); + return nullptr; if (direction == UsbTransferDirection::INBOUND) { - return buffer; - } else if (direction == UsbTransferDirection::OUTBOUND) { - if (input.data.get() && size <= input.data->size()) { - memcpy(buffer->data(), input.data->data(), size); - return buffer; - } + return base::MakeRefCounted<base::RefCountedBytes>(size); } + + if (direction == UsbTransferDirection::OUTBOUND && input.data && + size <= input.data->size()) { + return base::MakeRefCounted<base::RefCountedBytes>( + reinterpret_cast<const uint8_t*>(input.data->data()), size); + } + NOTREACHED(); - return NULL; + return nullptr; } const char* ConvertTransferStatusToApi(const UsbTransferStatus status) { @@ -475,15 +472,15 @@ } void UsbTransferFunction::OnCompleted(UsbTransferStatus status, - scoped_refptr<net::IOBuffer> data, + scoped_refptr<base::RefCountedBytes> data, size_t length) { std::unique_ptr<base::DictionaryValue> transfer_info( new base::DictionaryValue()); transfer_info->SetInteger(kResultCodeKey, static_cast<int>(status)); if (data) { - transfer_info->Set( - kDataKey, base::Value::CreateWithCopiedBuffer(data->data(), length)); + transfer_info->Set(kDataKey, base::Value::CreateWithCopiedBuffer( + data->front_as<char>(), length)); } else { transfer_info->Set( kDataKey, std::make_unique<base::Value>(base::Value::Type::BINARY)); @@ -1056,11 +1053,10 @@ return RespondNow(Error(kErrorInvalidTransferLength)); } - scoped_refptr<net::IOBuffer> buffer = + scoped_refptr<base::RefCountedBytes> buffer = CreateBufferForTransfer(transfer, direction, size); - if (!buffer.get()) { + if (!buffer) return RespondNow(Error(kErrorMalformedParameters)); - } int timeout = transfer.timeout ? *transfer.timeout : 0; if (timeout < 0) { @@ -1103,11 +1099,10 @@ return RespondNow(Error(kErrorInvalidTransferLength)); } - scoped_refptr<net::IOBuffer> buffer = + scoped_refptr<base::RefCountedBytes> buffer = CreateBufferForTransfer(transfer, direction, size); - if (!buffer.get()) { + if (!buffer) return RespondNow(Error(kErrorMalformedParameters)); - } int timeout = transfer.timeout ? *transfer.timeout : 0; if (timeout < 0) { @@ -1149,11 +1144,10 @@ return RespondNow(Error(kErrorInvalidTransferLength)); } - scoped_refptr<net::IOBuffer> buffer = + scoped_refptr<base::RefCountedBytes> buffer = CreateBufferForTransfer(transfer, direction, size); - if (!buffer.get()) { + if (!buffer) return RespondNow(Error(kErrorMalformedParameters)); - } int timeout = transfer.timeout ? *transfer.timeout : 0; if (timeout < 0) { @@ -1217,9 +1211,9 @@ generic_transfer.endpoint, packet_lengths, timeout, base::Bind(&UsbIsochronousTransferFunction::OnCompleted, this)); } else { - scoped_refptr<net::IOBuffer> buffer = CreateBufferForTransfer( + scoped_refptr<base::RefCountedBytes> buffer = CreateBufferForTransfer( generic_transfer, direction, transfer.packets * transfer.packet_length); - if (!buffer.get()) + if (!buffer) return RespondNow(Error(kErrorMalformedParameters)); device_handle->IsochronousTransferOut( @@ -1230,7 +1224,7 @@ } void UsbIsochronousTransferFunction::OnCompleted( - scoped_refptr<net::IOBuffer> data, + scoped_refptr<base::RefCountedBytes> data, const std::vector<UsbDeviceHandle::IsochronousPacket>& packets) { size_t length = std::accumulate( packets.begin(), packets.end(), 0, @@ -1241,7 +1235,7 @@ buffer.reserve(length); UsbTransferStatus status = UsbTransferStatus::COMPLETED; - const char* data_ptr = data ? data->data() : nullptr; + const char* data_ptr = data ? data->front_as<char>() : nullptr; for (const auto& packet : packets) { // Capture the error status of the first unsuccessful packet. if (status == UsbTransferStatus::COMPLETED &&
diff --git a/extensions/browser/api/usb/usb_api.h b/extensions/browser/api/usb/usb_api.h index 17ad3538..cc88fdc 100644 --- a/extensions/browser/api/usb/usb_api.h +++ b/extensions/browser/api/usb/usb_api.h
@@ -20,7 +20,10 @@ #include "extensions/browser/api/api_resource_manager.h" #include "extensions/browser/extension_function.h" #include "extensions/common/api/usb.h" -#include "net/base/io_buffer.h" + +namespace base { +class RefCountedBytes; +} namespace extensions { @@ -58,7 +61,7 @@ ~UsbTransferFunction() override; void OnCompleted(device::UsbTransferStatus status, - scoped_refptr<net::IOBuffer> data, + scoped_refptr<base::RefCountedBytes> data, size_t length); }; @@ -347,7 +350,7 @@ ResponseAction Run() override; void OnCompleted( - scoped_refptr<net::IOBuffer> data, + scoped_refptr<base::RefCountedBytes> data, const std::vector<device::UsbDeviceHandle::IsochronousPacket>& packets); DISALLOW_COPY_AND_ASSIGN(UsbIsochronousTransferFunction);
diff --git a/extensions/browser/api/usb/usb_apitest.cc b/extensions/browser/api/usb/usb_apitest.cc index d232f89..f25e417 100644 --- a/extensions/browser/api/usb/usb_apitest.cc +++ b/extensions/browser/api/usb/usb_apitest.cc
@@ -7,6 +7,7 @@ #include <numeric> #include "base/memory/ptr_util.h" +#include "base/memory/ref_counted_memory.h" #include "content/public/browser/browser_thread.h" #include "content/public/test/test_utils.h" #include "device/base/mock_device_client.h" @@ -18,7 +19,6 @@ #include "extensions/shell/browser/shell_extensions_api_client.h" #include "extensions/shell/test/shell_apitest.h" #include "extensions/test/extension_test_message_listener.h" -#include "net/base/io_buffer.h" using testing::_; using testing::AnyNumber; @@ -48,14 +48,13 @@ ACTION_TEMPLATE(InvokeUsbTransferCallback, HAS_1_TEMPLATE_PARAMS(int, k), AND_1_VALUE_PARAMS(p1)) { - net::IOBuffer* io_buffer = nullptr; + scoped_refptr<base::RefCountedBytes> buffer; size_t length = 0; if (p1 != UsbTransferStatus::TRANSFER_ERROR) { length = 1; - io_buffer = new net::IOBuffer(length); - memset(io_buffer->data(), 0, length); // Avoid uninitialized reads. + buffer = base::MakeRefCounted<base::RefCountedBytes>(length); } - std::move(std::get<k>(args)).Run(p1, io_buffer, 1); + std::move(std::get<k>(args)).Run(p1, buffer, 1); } ACTION_P2(InvokeUsbIsochronousTransferOutCallback, @@ -79,8 +78,7 @@ transferred_length, success_packets) { size_t total_length = std::accumulate(arg1.begin(), arg1.end(), 0u); - net::IOBuffer* io_buffer = new net::IOBuffer(total_length); - memset(io_buffer->data(), 0, total_length); // Avoid uninitialized reads. + auto buffer = base::MakeRefCounted<base::RefCountedBytes>(total_length); std::vector<UsbDeviceHandle::IsochronousPacket> packets(arg1.size()); for (size_t i = 0; i < packets.size(); ++i) { packets[i].length = arg1[i]; @@ -93,7 +91,7 @@ packets[i].status = UsbTransferStatus::TRANSFER_ERROR; } } - std::move(arg3).Run(io_buffer, packets); + std::move(arg3).Run(buffer, packets); } ACTION_P(SetConfiguration, mock_device) {
diff --git a/extensions/browser/extension_function_histogram_value.h b/extensions/browser/extension_function_histogram_value.h index feb9819..a3e8e32 100644 --- a/extensions/browser/extension_function_histogram_value.h +++ b/extensions/browser/extension_function_histogram_value.h
@@ -1266,6 +1266,7 @@ VIRTUALKEYBOARDPRIVATE_SETDRAGGABLEAREA, METRICSPRIVATE_RECORDBOOLEAN, METRICSPRIVATE_RECORDENUMERATIONVALUE, + DEVELOPERPRIVATE_NOTIFYDRAGINSTALLINPROGRESS, // Last entry: Add new entries above, then run: // python tools/metrics/histograms/update_extension_histograms.py ENUM_BOUNDARY
diff --git a/extensions/common/extension.h b/extensions/common/extension.h index 13620768..45dbf6af 100644 --- a/extensions/common/extension.h +++ b/extensions/common/extension.h
@@ -44,17 +44,22 @@ // RuntimeData is protected by a lock. class Extension : public base::RefCountedThreadSafe<Extension> { public: + // Do not renumber or reorder these values, as they are stored on-disk in the + // user's preferences. enum State { DISABLED = 0, - ENABLED, + ENABLED = 1, + // An external extension that the user uninstalled. We should not reinstall // such extensions on startup. - EXTERNAL_EXTENSION_UNINSTALLED, + EXTERNAL_EXTENSION_UNINSTALLED = 2, + // DEPRECATED: Special state for component extensions. - // Maintained as a placeholder since states may be stored to disk. - ENABLED_COMPONENT_DEPRECATED, - // Add new states here as this enum is stored in prefs. - NUM_STATES + // ENABLED_COMPONENT_DEPRECATED = 3, + + // Do not add more values. State is being removed. + // https://crbug.com/794205. + NUM_STATES = 4, }; // A base class for parsed manifest data that APIs want to store on
diff --git a/extensions/common/manifest_url_handlers.cc b/extensions/common/manifest_url_handlers.cc index f58f1fb..ac932cc2 100644 --- a/extensions/common/manifest_url_handlers.cc +++ b/extensions/common/manifest_url_handlers.cc
@@ -5,6 +5,7 @@ #include "extensions/common/manifest_url_handlers.h" #include <memory> +#include <utility> #include "base/files/file_util.h" #include "base/strings/string_util.h" @@ -38,6 +39,22 @@ const GURL& homepage_url = Get(extension, keys::kHomepageURL); if (homepage_url.is_valid()) return homepage_url; + return GetWebStoreURL(extension); +} + +// static +bool ManifestURL::SpecifiedHomepageURL(const Extension* extension) { + return Get(extension, keys::kHomepageURL).is_valid(); +} + +// static +const GURL ManifestURL::GetManifestHomePageURL(const Extension* extension) { + const GURL& homepage_url = Get(extension, keys::kHomepageURL); + return homepage_url.is_valid() ? homepage_url : GURL::EmptyGURL(); +} + +// static +const GURL ManifestURL::GetWebStoreURL(const Extension* extension) { bool use_webstore_url = UpdatesFromGallery(extension) && !SharedModuleInfo::IsSharedModule(extension); return use_webstore_url @@ -47,11 +64,6 @@ } // static -bool ManifestURL::SpecifiedHomepageURL(const Extension* extension) { - return Get(extension, keys::kHomepageURL).is_valid(); -} - -// static const GURL& ManifestURL::GetUpdateURL(const Extension* extension) { return Get(extension, keys::kUpdateURL); }
diff --git a/extensions/common/manifest_url_handlers.h b/extensions/common/manifest_url_handlers.h index fb1b6c75..49e8fcb9 100644 --- a/extensions/common/manifest_url_handlers.h +++ b/extensions/common/manifest_url_handlers.h
@@ -6,6 +6,7 @@ #define EXTENSIONS_COMMON_MANIFEST_URL_HANDLERS_H_ #include <string> +#include <vector> #include "base/macros.h" #include "extensions/common/extension.h" @@ -29,12 +30,23 @@ // If homepage_url was not specified in the manifest, // this returns the Google Gallery URL. For third-party extensions, // this returns a blank GURL. + // See also: GetManifestHomePageURL(), SpecifiedHomepageURL() static const GURL GetHomepageURL(const Extension* extension); // Returns true if the extension specified a valid home page url in the // manifest. static bool SpecifiedHomepageURL(const Extension* extension); + // Returns the homepage specified by the extension in its manifest, if it + // specifies a homepage. Otherwise, returns an empty url. + // See also: GetHomepageURL() + static const GURL GetManifestHomePageURL(const Extension* extension); + + // Returns the Chrome Web Store URL for this extension if it is hosted in the + // webstore; otherwise returns an empty url. + // See also: GetHomepageURL() + static const GURL GetWebStoreURL(const Extension* extension); + // Returns the Update URL for this extension. static const GURL& GetUpdateURL(const Extension* extension);
diff --git a/gin/BUILD.gn b/gin/BUILD.gn index 98a581b..82edcb4 100644 --- a/gin/BUILD.gn +++ b/gin/BUILD.gn
@@ -4,7 +4,6 @@ import("//testing/test.gni") import("//v8/gni/v8.gni") -import("//tools/v8_context_snapshot/v8_context_snapshot.gni") component("gin") { sources = [ @@ -74,9 +73,6 @@ "$root_out_dir/natives_blob.bin", "$root_out_dir/snapshot_blob.bin", ] - if (use_v8_context_snapshot) { - data += [ "$root_out_dir/v8_context_snapshot.bin" ] - } } defines = [ "GIN_IMPLEMENTATION" ] @@ -93,10 +89,7 @@ libs = [ "CoreFoundation.framework" ] } - configs += [ - "//tools/v8_context_snapshot:use_v8_context_snapshot", - "//v8:external_startup_data", - ] + configs += [ "//v8:external_startup_data" ] } executable("gin_shell") { @@ -113,10 +106,7 @@ "//v8", ] - configs += [ - "//tools/v8_context_snapshot:use_v8_context_snapshot", - "//v8:external_startup_data", - ] + configs += [ "//v8:external_startup_data" ] } source_set("gin_test") { @@ -132,14 +122,10 @@ ] deps = [ "//base/test:test_support", - "//tools/v8_context_snapshot", "//v8", ] - configs += [ - "//tools/v8_context_snapshot:use_v8_context_snapshot", - "//v8:external_startup_data", - ] + configs += [ "//v8:external_startup_data" ] } test("gin_unittests") {
diff --git a/gin/isolate_holder.cc b/gin/isolate_holder.cc index 003d838..66cfb07 100644 --- a/gin/isolate_holder.cc +++ b/gin/isolate_holder.cc
@@ -38,12 +38,16 @@ IsolateHolder::IsolateHolder( scoped_refptr<base::SingleThreadTaskRunner> task_runner, AccessMode access_mode) - : IsolateHolder(std::move(task_runner), access_mode, kAllowAtomicsWait) {} + : IsolateHolder(std::move(task_runner), + access_mode, + kAllowAtomicsWait, + nullptr) {} IsolateHolder::IsolateHolder( scoped_refptr<base::SingleThreadTaskRunner> task_runner, AccessMode access_mode, - AllowAtomicsWaitMode atomics_wait_mode) + AllowAtomicsWaitMode atomics_wait_mode, + v8::StartupData* startup_data) : access_mode_(access_mode) { v8::ArrayBuffer::Allocator* allocator = g_array_buffer_allocator; CHECK(allocator) << "You need to invoke gin::IsolateHolder::Initialize first"; @@ -56,6 +60,14 @@ params.array_buffer_allocator = allocator; params.allow_atomics_wait = atomics_wait_mode == kAllowAtomicsWait; params.external_references = g_reference_table; + + if (startup_data) { + CHECK(g_reference_table); + V8Initializer::GetV8ContextSnapshotData(startup_data); + if (startup_data->data) { + params.snapshot_blob = startup_data; + } + } isolate_ = v8::Isolate::New(params); // TODO(ssid): Make sure the task runner is never null here, crbug.com/762723.
diff --git a/gin/public/isolate_holder.h b/gin/public/isolate_holder.h index 11403c3..f29b2de 100644 --- a/gin/public/isolate_holder.h +++ b/gin/public/isolate_holder.h
@@ -59,7 +59,8 @@ AccessMode access_mode); IsolateHolder(scoped_refptr<base::SingleThreadTaskRunner> task_runner, AccessMode access_mode, - AllowAtomicsWaitMode atomics_wait_mode); + AllowAtomicsWaitMode atomics_wait_mode, + v8::StartupData* startup_data); // This constructor is to create V8 snapshot for Blink. // Note this constructor calls isolate->Enter() internally.
diff --git a/gin/shell/gin_main.cc b/gin/shell/gin_main.cc index 12c74b8..2340951 100644 --- a/gin/shell/gin_main.cc +++ b/gin/shell/gin_main.cc
@@ -72,10 +72,7 @@ #ifdef V8_USE_EXTERNAL_STARTUP_DATA gin::V8Initializer::LoadV8Snapshot(); gin::V8Initializer::LoadV8Natives(); -#ifdef USE_V8_CONTEXT_SNAPSHOT - gin::V8Initializer::LoadV8ContextSnapshot(); -#endif // USE_V8_CONTEXT_SNAPSHOT -#endif // V8_USE_EXTERNAL_STARTUP_DATA +#endif base::MessageLoop message_loop; base::TaskScheduler::CreateAndStartWithDefaultParams("gin");
diff --git a/gin/shell_runner_unittest.cc b/gin/shell_runner_unittest.cc index a2dc656f..02e6835 100644 --- a/gin/shell_runner_unittest.cc +++ b/gin/shell_runner_unittest.cc
@@ -32,9 +32,6 @@ gin::V8Initializer::LoadV8Snapshot(); gin::V8Initializer::LoadV8Natives(); #endif -#ifdef USE_V8_CONTEXT_SNAPSHOT - gin::V8Initializer::LoadV8ContextSnapshot(); -#endif gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, gin::IsolateHolder::kStableV8Extras,
diff --git a/gin/test/v8_test.cc b/gin/test/v8_test.cc index 79db655..88009dd 100644 --- a/gin/test/v8_test.cc +++ b/gin/test/v8_test.cc
@@ -24,10 +24,6 @@ gin::V8Initializer::LoadV8Snapshot(); gin::V8Initializer::LoadV8Natives(); #endif -#ifdef USE_V8_CONTEXT_SNAPSHOT - gin::V8Initializer::LoadV8ContextSnapshot(); -#endif - gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, gin::IsolateHolder::kStableV8Extras, gin::ArrayBufferAllocator::SharedInstance());
diff --git a/gin/v8_initializer.cc b/gin/v8_initializer.cc index b45e6db..03353be 100644 --- a/gin/v8_initializer.cc +++ b/gin/v8_initializer.cc
@@ -242,22 +242,16 @@ #if defined(V8_USE_EXTERNAL_STARTUP_DATA) v8::StartupData natives; - GetMappedFileData(g_mapped_natives, &natives); + natives.data = reinterpret_cast<const char*>(g_mapped_natives->data()); + natives.raw_size = static_cast<int>(g_mapped_natives->length()); v8::V8::SetNativesDataBlob(&natives); -#if defined(USE_V8_CONTEXT_SNAPSHOT) - if (g_mapped_v8_context_snapshot) { - v8::StartupData snapshot{}; - GetMappedFileData(g_mapped_v8_context_snapshot, &snapshot); - v8::V8::SetSnapshotDataBlob(&snapshot); - } -#else if (g_mapped_snapshot) { - v8::StartupData snapshot{}; - GetMappedFileData(g_mapped_snapshot, &snapshot); + v8::StartupData snapshot; + snapshot.data = reinterpret_cast<const char*>(g_mapped_snapshot->data()); + snapshot.raw_size = static_cast<int>(g_mapped_snapshot->length()); v8::V8::SetSnapshotDataBlob(&snapshot); } -#endif // USE_V8_CONTEXT_SNAPSHOT #endif // V8_USE_EXTERNAL_STARTUP_DATA v8::V8::SetEntropySource(&GenerateEntropy);
diff --git a/gpu/BUILD.gn b/gpu/BUILD.gn index 9cb00be..12a7d43 100644 --- a/gpu/BUILD.gn +++ b/gpu/BUILD.gn
@@ -5,6 +5,7 @@ import("//testing/libfuzzer/fuzzer_test.gni") import("//testing/test.gni") import("//build/config/ui.gni") +import("//ui/gl/features.gni") config("gpu_implementation") { defines = [ "GPU_IMPLEMENTATION" ] @@ -34,83 +35,85 @@ ] } -shared_library("command_buffer_gles2") { - sources = [ - # TODO(hendrikw): Move egl out of gles2_conform_support. - "gles2_conform_support/egl/config.cc", - "gles2_conform_support/egl/config.h", - "gles2_conform_support/egl/context.cc", - "gles2_conform_support/egl/context.h", - "gles2_conform_support/egl/display.cc", - "gles2_conform_support/egl/display.h", - "gles2_conform_support/egl/egl.cc", - "gles2_conform_support/egl/surface.cc", - "gles2_conform_support/egl/surface.h", - "gles2_conform_support/egl/test_support.cc", - "gles2_conform_support/egl/test_support.h", - "gles2_conform_support/egl/thread_state.cc", - "gles2_conform_support/egl/thread_state.h", - ] +if (!use_static_angle) { + shared_library("command_buffer_gles2") { + sources = [ + # TODO(hendrikw): Move egl out of gles2_conform_support. + "gles2_conform_support/egl/config.cc", + "gles2_conform_support/egl/config.h", + "gles2_conform_support/egl/context.cc", + "gles2_conform_support/egl/context.h", + "gles2_conform_support/egl/display.cc", + "gles2_conform_support/egl/display.h", + "gles2_conform_support/egl/egl.cc", + "gles2_conform_support/egl/surface.cc", + "gles2_conform_support/egl/surface.h", + "gles2_conform_support/egl/test_support.cc", + "gles2_conform_support/egl/test_support.h", + "gles2_conform_support/egl/thread_state.cc", + "gles2_conform_support/egl/thread_state.h", + ] - deps = [ - ":gpu", - "//base", - "//build/config:exe_and_shlib_deps", - "//gpu/command_buffer/client:gles2_c_lib", - "//gpu/command_buffer/client:gles2_implementation", - "//gpu/command_buffer/common:gles2_utils", - "//ui/gl:gl", - ] + deps = [ + ":gpu", + "//base", + "//build/config:exe_and_shlib_deps", + "//gpu/command_buffer/client:gles2_c_lib", + "//gpu/command_buffer/client:gles2_implementation", + "//gpu/command_buffer/common:gles2_utils", + "//ui/gl:gl", + ] - defines = [ - "COMMAND_BUFFER_GLES_LIB_SUPPORT_ONLY", - "EGLAPIENTRY=", - ] - if (is_android) { - configs -= [ "//build/config/android:hide_all_but_jni_onload" ] - } - if (current_os == "win") { - defines += [ "EGLAPI=__declspec(dllexport)" ] - } else { - defines += [ "EGLAPI=__attribute__((visibility(\"default\")))" ] - } -} - -test("command_buffer_gles2_tests") { - sources = [ - "command_buffer/tests/command_buffer_gles2_tests_main.cc", - "command_buffer/tests/egl_test.cc", - ] - - deps = [ - ":command_buffer_gles2", - "//base", - "//base/test:test_support", - "//base/third_party/dynamic_annotations", - "//testing/gmock", - "//testing/gtest", - ] - - defines = [ - "COMMAND_BUFFER_GLES_LIB_SUPPORT_ONLY", - "EGLAPIENTRY=", - ] - if (current_os == "win") { - defines += [ "EGLAPI=__declspec(dllimport)" ] - } else { - defines += [ "EGLAPI=" ] + defines = [ + "COMMAND_BUFFER_GLES_LIB_SUPPORT_ONLY", + "EGLAPIENTRY=", + ] + if (is_android) { + configs -= [ "//build/config/android:hide_all_but_jni_onload" ] + } + if (current_os == "win") { + defines += [ "EGLAPI=__declspec(dllexport)" ] + } else { + defines += [ "EGLAPI=__attribute__((visibility(\"default\")))" ] + } } - libs = [] + test("command_buffer_gles2_tests") { + sources = [ + "command_buffer/tests/command_buffer_gles2_tests_main.cc", + "command_buffer/tests/egl_test.cc", + ] - if (is_android) { - libs += [ "android" ] - deps += [ "//ui/android:ui_java" ] + deps = [ + ":command_buffer_gles2", + "//base", + "//base/test:test_support", + "//base/third_party/dynamic_annotations", + "//testing/gmock", + "//testing/gtest", + ] + + defines = [ + "COMMAND_BUFFER_GLES_LIB_SUPPORT_ONLY", + "EGLAPIENTRY=", + ] + if (current_os == "win") { + defines += [ "EGLAPI=__declspec(dllimport)" ] + } else { + defines += [ "EGLAPI=" ] + } + + libs = [] + + if (is_android) { + libs += [ "android" ] + deps += [ "//ui/android:ui_java" ] + } + if (is_linux && !is_component_build) { + configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ] + } } - if (is_linux && !is_component_build) { - configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ] - } -} +} # if (!use_static_angle) static_library("test_support") { testonly = true
diff --git a/gpu/command_buffer/client/client_discardable_manager.cc b/gpu/command_buffer/client/client_discardable_manager.cc index be06ca7..ed56dfb4 100644 --- a/gpu/command_buffer/client/client_discardable_manager.cc +++ b/gpu/command_buffer/client/client_discardable_manager.cc
@@ -182,6 +182,14 @@ return found->second; } +bool ClientDiscardableManager::HandleIsDeletedForTracing( + ClientDiscardableHandle::Id handle_id) const { + auto found = handles_.find(handle_id); + if (found == handles_.end()) + return true; + return found->second.IsDeletedForTracing(); +} + bool ClientDiscardableManager::FindAllocation(CommandBuffer* command_buffer, scoped_refptr<Buffer>* buffer, int32_t* shm_id,
diff --git a/gpu/command_buffer/client/client_discardable_manager.h b/gpu/command_buffer/client/client_discardable_manager.h index 8ba87d5d..d5f3ece 100644 --- a/gpu/command_buffer/client/client_discardable_manager.h +++ b/gpu/command_buffer/client/client_discardable_manager.h
@@ -28,6 +28,9 @@ bool HandleIsValid(ClientDiscardableHandle::Id handle_id) const; ClientDiscardableHandle GetHandle(ClientDiscardableHandle::Id handle_id); + // For diagnostic tracing only. + bool HandleIsDeletedForTracing(ClientDiscardableHandle::Id handle_id) const; + // Test only functions. void CheckPendingForTesting(CommandBuffer* command_buffer) { CheckPending(command_buffer);
diff --git a/gpu/command_buffer/client/client_discardable_texture_manager.cc b/gpu/command_buffer/client/client_discardable_texture_manager.cc index 1081be18..3446b3cf 100644 --- a/gpu/command_buffer/client/client_discardable_texture_manager.cc +++ b/gpu/command_buffer/client/client_discardable_texture_manager.cc
@@ -48,6 +48,15 @@ texture_id_to_handle_id_.end(); } +bool ClientDiscardableTextureManager::TextureIsDeletedForTracing( + uint32_t texture_id) const { + base::AutoLock hold(lock_); + auto found = texture_id_to_handle_id_.find(texture_id); + if (found == texture_id_to_handle_id_.end()) + return true; + return discardable_manager_.HandleIsDeletedForTracing(found->second); +} + ClientDiscardableHandle ClientDiscardableTextureManager::GetHandleForTesting( uint32_t texture_id) { base::AutoLock hold(lock_);
diff --git a/gpu/command_buffer/client/client_discardable_texture_manager.h b/gpu/command_buffer/client/client_discardable_texture_manager.h index 552d162..b9ba5133 100644 --- a/gpu/command_buffer/client/client_discardable_texture_manager.h +++ b/gpu/command_buffer/client/client_discardable_texture_manager.h
@@ -17,9 +17,9 @@ // ClientDiscardableManager. Used by the GLES2 Implementation. // // NOTE: The presence of locking on this class does not make it threadsafe. -// The underlying locking *only* allows calling TextureIsValid and -// LockTexture without holding the GL context lock. All other calls still -// require that the context lock be held. +// The underlying locking *only* allows calling TextureIsValid, +// LockTexture, and TextureIsDeletedForTracing without holding the GL context +// lock. All other calls still require that the context lock be held. class GPU_EXPORT ClientDiscardableTextureManager { public: ClientDiscardableTextureManager(); @@ -32,6 +32,9 @@ void FreeTexture(uint32_t texture_id); bool TextureIsValid(uint32_t texture_id) const; + // Tracing only functions. + bool TextureIsDeletedForTracing(uint32_t texture_id) const; + // Test only functions. ClientDiscardableManager* DiscardableManagerForTesting() { return &discardable_manager_;
diff --git a/gpu/command_buffer/client/client_transfer_cache.cc b/gpu/command_buffer/client/client_transfer_cache.cc index b5d435cf..701add8 100644 --- a/gpu/command_buffer/client/client_transfer_cache.cc +++ b/gpu/command_buffer/client/client_transfer_cache.cc
@@ -53,13 +53,17 @@ return false; } -void ClientTransferCache::UnlockTransferCacheEntry( +void ClientTransferCache::UnlockTransferCacheEntries( gles2::GLES2CmdHelper* helper, - cc::TransferCacheEntryType type, - uint32_t id) { + const std::vector<std::pair<cc::TransferCacheEntryType, uint32_t>>& + entries) { base::AutoLock hold(lock_); - DCHECK(!FindDiscardableHandleId(type, id).is_null()); - helper->UnlockTransferCacheEntryINTERNAL(static_cast<uint32_t>(type), id); + for (const auto& entry : entries) { + auto type = entry.first; + auto id = entry.second; + DCHECK(!FindDiscardableHandleId(type, id).is_null()); + helper->UnlockTransferCacheEntryINTERNAL(static_cast<uint32_t>(type), id); + } } void ClientTransferCache::DeleteTransferCacheEntry(
diff --git a/gpu/command_buffer/client/client_transfer_cache.h b/gpu/command_buffer/client/client_transfer_cache.h index 329863d9..ee5444e 100644 --- a/gpu/command_buffer/client/client_transfer_cache.h +++ b/gpu/command_buffer/client/client_transfer_cache.h
@@ -24,7 +24,7 @@ // them available for consumption in the GPU process. Typical usage is: // 1) Insert a new entry via CreateCacheEntry. It starts locked. // 2) Use the new entry's ID in one or more commands. -// 3) Unlock the entry via UnlockTransferCacheEntry after dependent commands +// 3) Unlock the entry via UnlockTransferCacheEntries after dependent commands // have been issued. // // If an entry is needed again: @@ -48,9 +48,10 @@ MappedMemoryManager* mapped_memory, const cc::ClientTransferCacheEntry& entry); bool LockTransferCacheEntry(cc::TransferCacheEntryType type, uint32_t id); - void UnlockTransferCacheEntry(gles2::GLES2CmdHelper* helper, - cc::TransferCacheEntryType type, - uint32_t id); + void UnlockTransferCacheEntries( + gles2::GLES2CmdHelper* helper, + const std::vector<std::pair<cc::TransferCacheEntryType, uint32_t>>& + entries); void DeleteTransferCacheEntry(gles2::GLES2CmdHelper* helper, cc::TransferCacheEntryType type, uint32_t id);
diff --git a/gpu/command_buffer/client/context_support.h b/gpu/command_buffer/client/context_support.h index a707091..0836eb7 100644 --- a/gpu/command_buffer/client/context_support.h +++ b/gpu/command_buffer/client/context_support.h
@@ -91,6 +91,10 @@ virtual void CompleteLockDiscardableTexureOnContextThread( uint32_t texture_id) = 0; + // Checks if a discardable handle is deleted. For use in tracing code. + virtual bool ThreadsafeDiscardableTextureIsDeletedForTracing( + uint32_t texture_id) = 0; + // Access to transfer cache functionality for OOP raster. Only // ThreadsafeLockTransferCacheEntry can be accessed without holding the // context lock. @@ -98,8 +102,9 @@ const cc::ClientTransferCacheEntry& entry) = 0; virtual bool ThreadsafeLockTransferCacheEntry(cc::TransferCacheEntryType type, uint32_t id) = 0; - virtual void UnlockTransferCacheEntry(cc::TransferCacheEntryType type, - uint32_t id) = 0; + virtual void UnlockTransferCacheEntries( + const std::vector<std::pair<cc::TransferCacheEntryType, uint32_t>>& + entries) = 0; virtual void DeleteTransferCacheEntry(cc::TransferCacheEntryType type, uint32_t id) = 0;
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc index 2491eb8..618c0d1 100644 --- a/gpu/command_buffer/client/gles2_implementation.cc +++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -119,11 +119,9 @@ } void FlushEntriesInternal( - const std::set<std::pair<cc::TransferCacheEntryType, uint32_t>>& entries) - final { - // TODO(vmpstr): Add a bulk unlock API instead. - for (auto& entry : entries) - gl_->UnlockTransferCacheEntry(entry.first, entry.second); + const std::vector<std::pair<cc::TransferCacheEntryType, uint32_t>>& + entries) final { + gl_->UnlockTransferCacheEntries(entries); } GLES2Implementation* gl_; @@ -3860,8 +3858,6 @@ "GL_EXT_unpack_subimage " "GL_CHROMIUM_map_sub " "GL_CHROMIUM_image"; - if (capabilities_.future_sync_points) - str += " GL_CHROMIUM_future_sync_point"; } // Because of WebGL the extensions can change. We have to cache each unique @@ -6178,6 +6174,13 @@ helper_->LockDiscardableTextureCHROMIUM(texture_id); } +bool GLES2Implementation::ThreadsafeDiscardableTextureIsDeletedForTracing( + uint32_t texture_id) { + ClientDiscardableTextureManager* manager = + share_group()->discardable_texture_manager(); + return manager->TextureIsDeletedForTracing(texture_id); +} + void GLES2Implementation::CreateTransferCacheEntry( const cc::ClientTransferCacheEntry& entry) { share_group()->transfer_cache()->CreateCacheEntry( @@ -6190,10 +6193,10 @@ return share_group()->transfer_cache()->LockTransferCacheEntry(type, id); } -void GLES2Implementation::UnlockTransferCacheEntry( - cc::TransferCacheEntryType type, - uint32_t id) { - share_group()->transfer_cache()->UnlockTransferCacheEntry(helper_, type, id); +void GLES2Implementation::UnlockTransferCacheEntries( + const std::vector<std::pair<cc::TransferCacheEntryType, uint32_t>>& + entries) { + share_group()->transfer_cache()->UnlockTransferCacheEntries(helper_, entries); } void GLES2Implementation::DeleteTransferCacheEntry(
diff --git a/gpu/command_buffer/client/gles2_implementation.h b/gpu/command_buffer/client/gles2_implementation.h index d0c41a8..7f8d26abc 100644 --- a/gpu/command_buffer/client/gles2_implementation.h +++ b/gpu/command_buffer/client/gles2_implementation.h
@@ -215,12 +215,15 @@ bool ThreadSafeShallowLockDiscardableTexture(uint32_t texture_id) override; void CompleteLockDiscardableTexureOnContextThread( uint32_t texture_id) override; + bool ThreadsafeDiscardableTextureIsDeletedForTracing( + uint32_t texture_id) override; void CreateTransferCacheEntry( const cc::ClientTransferCacheEntry& entry) override; bool ThreadsafeLockTransferCacheEntry(cc::TransferCacheEntryType type, uint32_t id) override; - void UnlockTransferCacheEntry(cc::TransferCacheEntryType type, - uint32_t id) override; + void UnlockTransferCacheEntries( + const std::vector<std::pair<cc::TransferCacheEntryType, uint32_t>>& + entries) override; void DeleteTransferCacheEntry(cc::TransferCacheEntryType type, uint32_t id) override;
diff --git a/gpu/command_buffer/common/capabilities.h b/gpu/command_buffer/common/capabilities.h index 8529e59..1fc272e 100644 --- a/gpu/command_buffer/common/capabilities.h +++ b/gpu/command_buffer/common/capabilities.h
@@ -135,7 +135,6 @@ bool texture_storage = false; bool discard_framebuffer = false; bool sync_query = false; - bool future_sync_points = false; bool blend_equation_advanced = false; bool blend_equation_advanced_coherent = false; bool texture_rg = false;
diff --git a/gpu/command_buffer/common/discardable_handle.cc b/gpu/command_buffer/common/discardable_handle.cc index 9f8c94b..52c2b1e 100644 --- a/gpu/command_buffer/common/discardable_handle.cc +++ b/gpu/command_buffer/common/discardable_handle.cc
@@ -42,12 +42,16 @@ return true; } +bool DiscardableHandleBase::IsDeletedForTracing() const { + return kHandleDeleted == base::subtle::NoBarrier_Load(AsAtomic()); +} + bool DiscardableHandleBase::IsLockedForTesting() const { return kHandleLockedStart <= base::subtle::NoBarrier_Load(AsAtomic()); } bool DiscardableHandleBase::IsDeletedForTesting() const { - return kHandleDeleted == base::subtle::NoBarrier_Load(AsAtomic()); + return IsDeletedForTracing(); } scoped_refptr<Buffer> DiscardableHandleBase::BufferForTesting() const {
diff --git a/gpu/command_buffer/common/discardable_handle.h b/gpu/command_buffer/common/discardable_handle.h index 36747c5..6fa9f7b8 100644 --- a/gpu/command_buffer/common/discardable_handle.h +++ b/gpu/command_buffer/common/discardable_handle.h
@@ -40,6 +40,9 @@ // Ensures this is a valid allocation for use with a DiscardableHandleBase. static bool ValidateParameters(const Buffer* buffer, uint32_t byte_offset); + // Functions for tracing only. + bool IsDeletedForTracing() const; + // Test only functions. bool IsLockedForTesting() const; bool IsDeletedForTesting() const;
diff --git a/gpu/command_buffer/service/passthrough_program_cache.cc b/gpu/command_buffer/service/passthrough_program_cache.cc index ea257fa7..207c679 100644 --- a/gpu/command_buffer/service/passthrough_program_cache.cc +++ b/gpu/command_buffer/service/passthrough_program_cache.cc
@@ -31,7 +31,7 @@ bool ProgramCacheControlExtensionAvailable() { #if defined(USE_EGL) // The display should be initialized if the extension is available. - return gl::g_driver_egl.ext.b_EGL_ANGLE_program_cache_control; + return gl::g_driver_egl->ext.b_EGL_ANGLE_program_cache_control; #else return false; #endif // defined(USE_EGL)
diff --git a/gpu/command_buffer/service/texture_definition.cc b/gpu/command_buffer/service/texture_definition.cc index 4105482a..f1d424af 100644 --- a/gpu/command_buffer/service/texture_definition.cc +++ b/gpu/command_buffer/service/texture_definition.cc
@@ -155,8 +155,8 @@ DCHECK_NE(EGL_NO_DISPLAY, egl_display); DCHECK(glIsTexture(texture_id)); - DCHECK(gl::g_driver_egl.ext.b_EGL_KHR_image_base && - gl::g_driver_egl.ext.b_EGL_KHR_gl_texture_2D_image && + DCHECK(gl::g_driver_egl->ext.b_EGL_KHR_image_base && + gl::g_driver_egl->ext.b_EGL_KHR_gl_texture_2D_image && gl::g_current_gl_driver->ext.b_GL_OES_EGL_image); const EGLint egl_attrib_list[] = {
diff --git a/gpu/config/BUILD.gn b/gpu/config/BUILD.gn index 19a2bcd..0996f14 100644 --- a/gpu/config/BUILD.gn +++ b/gpu/config/BUILD.gn
@@ -130,6 +130,7 @@ "//base", "//third_party/re2", "//ui/gl", + "//ui/gl:gl_features", "//ui/gl/init", ]
diff --git a/gpu/config/gpu_info_collector_android.cc b/gpu/config/gpu_info_collector_android.cc index d57fc35..150e717 100644 --- a/gpu/config/gpu_info_collector_android.cc +++ b/gpu/config/gpu_info_collector_android.cc
@@ -22,8 +22,13 @@ #include "ui/gl/egl_util.h" #include "ui/gl/gl_bindings.h" #include "ui/gl/gl_context.h" +#include "ui/gl/gl_features.h" #include "ui/gl/gl_surface.h" +#if BUILDFLAG(USE_STATIC_ANGLE) +#include <EGL/egl.h> +#endif // BUILDFLAG(USE_STATIC_ANGLE) + namespace { std::pair<std::string, size_t> GetVersionFromString( @@ -68,6 +73,12 @@ } gpu::CollectInfoResult CollectDriverInfo(gpu::GPUInfo* gpu_info) { +#if BUILDFLAG(USE_STATIC_ANGLE) +#pragma push_macro("eglGetProcAddress") +#undef eglGetProcAddress +#define LOOKUP_FUNC(x) \ + auto x##Fn = reinterpret_cast<gl::x##Proc>(eglGetProcAddress(#x)) +#else // BUILDFLAG(USE_STATIC_ANGLE) // Go through the process of loading GL libs and initializing an EGL // context so that we can get GL vendor/version/renderer strings. base::NativeLibrary gles_library, egl_library; @@ -112,6 +123,7 @@ }; #define LOOKUP_FUNC(x) auto x##Fn = reinterpret_cast<gl::x##Proc>(get_func(#x)) +#endif // BUILDFLAG(USE_STATIC_ANGLE) LOOKUP_FUNC(eglGetError); LOOKUP_FUNC(eglQueryString); @@ -131,6 +143,9 @@ LOOKUP_FUNC(glGetIntegerv); #undef LOOKUP_FUNC +#if BUILDFLAG(USE_STATIC_ANGLE) +#pragma pop_macro("eglGetProcAddress") +#endif // BUILDFLAG(USE_STATIC_ANGLE) EGLDisplay curr_display = eglGetCurrentDisplayFn(); EGLContext curr_context = eglGetCurrentContextFn();
diff --git a/gpu/config/gpu_util.cc b/gpu/config/gpu_util.cc index c082e46..710230e 100644 --- a/gpu/config/gpu_util.cc +++ b/gpu/config/gpu_util.cc
@@ -353,12 +353,6 @@ } #endif - if (gpu_feature_info.status_values[GPU_FEATURE_TYPE_GPU_COMPOSITING] != - kGpuFeatureStatusEnabled) { - gpu_feature_info.status_values[GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS] = - kGpuFeatureStatusSoftware; - } - gl::ExtensionSet all_disabled_extensions; std::string disabled_gl_extensions_value = command_line->GetSwitchValueASCII(switches::kDisableGLExtensions);
diff --git a/gpu/ipc/client/command_buffer_proxy_impl.cc b/gpu/ipc/client/command_buffer_proxy_impl.cc index d8c1740..311adfe 100644 --- a/gpu/ipc/client/command_buffer_proxy_impl.cc +++ b/gpu/ipc/client/command_buffer_proxy_impl.cc
@@ -33,7 +33,7 @@ #include "ui/gfx/geometry/size.h" #include "ui/gfx/gpu_fence.h" #include "ui/gl/gl_bindings.h" -#include "ui/gl/gl_switches.h" +#include "ui/gl/gl_switches_util.h" namespace gpu { @@ -846,8 +846,7 @@ void CommandBufferProxyImpl::OnUpdateVSyncParameters(base::TimeTicks timebase, base::TimeDelta interval) { - DCHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnablePresentationCallback)); + DCHECK(!gl::IsPresentationCallbackEnabled()); if (!update_vsync_parameters_completion_callback_.is_null()) update_vsync_parameters_completion_callback_.Run(timebase, interval); } @@ -855,8 +854,7 @@ void CommandBufferProxyImpl::OnBufferPresented( uint64_t swap_id, const gfx::PresentationFeedback& feedback) { - DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnablePresentationCallback)); + DCHECK(gl::IsPresentationCallbackEnabled()); if (presentation_callback_) presentation_callback_.Run(swap_id, feedback);
diff --git a/gpu/ipc/common/gpu_command_buffer_traits_multi.h b/gpu/ipc/common/gpu_command_buffer_traits_multi.h index 992dad1..c6e49c8 100644 --- a/gpu/ipc/common/gpu_command_buffer_traits_multi.h +++ b/gpu/ipc/common/gpu_command_buffer_traits_multi.h
@@ -110,7 +110,6 @@ IPC_STRUCT_TRAITS_MEMBER(texture_storage) IPC_STRUCT_TRAITS_MEMBER(discard_framebuffer) IPC_STRUCT_TRAITS_MEMBER(sync_query) - IPC_STRUCT_TRAITS_MEMBER(future_sync_points) IPC_STRUCT_TRAITS_MEMBER(blend_equation_advanced) IPC_STRUCT_TRAITS_MEMBER(blend_equation_advanced_coherent) IPC_STRUCT_TRAITS_MEMBER(texture_rg)
diff --git a/gpu/ipc/in_process_command_buffer.cc b/gpu/ipc/in_process_command_buffer.cc index 5738fba..46f1078 100644 --- a/gpu/ipc/in_process_command_buffer.cc +++ b/gpu/ipc/in_process_command_buffer.cc
@@ -56,6 +56,7 @@ #include "ui/gl/gl_image.h" #include "ui/gl/gl_image_shared_memory.h" #include "ui/gl/gl_share_group.h" +#include "ui/gl/gl_switches_util.h" #include "ui/gl/init/gl_factory.h" #if defined(OS_WIN) @@ -1198,8 +1199,7 @@ void InProcessCommandBuffer::UpdateVSyncParametersOnOriginThread( base::TimeTicks timebase, base::TimeDelta interval) { - DCHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnablePresentationCallback)); + DCHECK(!gl::IsPresentationCallbackEnabled()); if (!update_vsync_parameters_completion_callback_.is_null()) update_vsync_parameters_completion_callback_.Run(timebase, interval); } @@ -1207,8 +1207,7 @@ void InProcessCommandBuffer::BufferPresentedOnOriginThread( uint64_t swap_id, const gfx::PresentationFeedback& feedback) { - DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnablePresentationCallback)); + DCHECK(gl::IsPresentationCallbackEnabled()); if (presentation_callback_) presentation_callback_.Run(swap_id, feedback); if (update_vsync_parameters_completion_callback_ &&
diff --git a/gpu/ipc/service/pass_through_image_transport_surface.cc b/gpu/ipc/service/pass_through_image_transport_surface.cc index 0f6bac5..00ae8ea 100644 --- a/gpu/ipc/service/pass_through_image_transport_surface.cc +++ b/gpu/ipc/service/pass_through_image_transport_surface.cc
@@ -12,6 +12,7 @@ #include "ui/gfx/vsync_provider.h" #include "ui/gl/gl_context.h" #include "ui/gl/gl_switches.h" +#include "ui/gl/gl_switches_util.h" namespace gpu { @@ -36,8 +37,7 @@ MultiWindowSwapInterval multi_window_swap_interval) : GLSurfaceAdapter(surface), is_gpu_vsync_disabled_(HasSwitch(switches::kDisableGpuVsync)), - is_presentation_callback_enabled_( - HasSwitch(switches::kEnablePresentationCallback)), + is_presentation_callback_enabled_(gl::IsPresentationCallbackEnabled()), delegate_(delegate), multi_window_swap_interval_(multi_window_swap_interval), weak_ptr_factory_(this) {}
diff --git a/headless/app/headless_shell_switches.cc b/headless/app/headless_shell_switches.cc index e2cabfa..be4da2be 100644 --- a/headless/app/headless_shell_switches.cc +++ b/headless/app/headless_shell_switches.cc
@@ -109,5 +109,8 @@ // Sets the initial window size. Provided as string in the format "800,600". const char kWindowSize[] = "window-size"; +// Whitelist for Negotitate Auth servers. +const char kAuthServerWhitelist[] = "auth-server-whitelist"; + } // namespace switches } // namespace headless
diff --git a/headless/app/headless_shell_switches.h b/headless/app/headless_shell_switches.h index 6011f3c..cef8353 100644 --- a/headless/app/headless_shell_switches.h +++ b/headless/app/headless_shell_switches.h
@@ -32,6 +32,7 @@ extern const char kUserDataDir[]; extern const char kVirtualTimeBudget[]; extern const char kWindowSize[]; +extern const char kAuthServerWhitelist[]; // Switches which are replicated from content. using ::switches::kHostResolverRules;
diff --git a/headless/lib/browser/headless_url_request_context_getter.cc b/headless/lib/browser/headless_url_request_context_getter.cc index 78bd02c..4a07b46 100644 --- a/headless/lib/browser/headless_url_request_context_getter.cc +++ b/headless/lib/browser/headless_url_request_context_getter.cc
@@ -20,6 +20,9 @@ #include "headless/lib/browser/headless_network_delegate.h" #include "net/cookies/cookie_store.h" #include "net/dns/mapped_host_resolver.h" +#include "net/http/http_auth_handler_factory.h" +#include "net/http/http_auth_preferences.h" +#include "net/http/http_auth_scheme.h" #include "net/http/http_transaction_factory.h" #include "net/http/http_util.h" #include "net/proxy/proxy_service.h" @@ -149,15 +152,27 @@ std::make_unique<HeadlessNetworkDelegate>(headless_browser_context_)); } + std::unique_ptr<net::HostResolver> host_resolver( + net::HostResolver::CreateDefaultResolver(net_log_)); + if (!host_resolver_rules_.empty()) { - std::unique_ptr<net::HostResolver> host_resolver( - net::HostResolver::CreateDefaultResolver(net_log_)); std::unique_ptr<net::MappedHostResolver> mapped_host_resolver( new net::MappedHostResolver(std::move(host_resolver))); mapped_host_resolver->SetRulesFromString(host_resolver_rules_); - builder.set_host_resolver(std::move(mapped_host_resolver)); + host_resolver = std::move(mapped_host_resolver); } + net::HttpAuthPreferences* prefs(new net::HttpAuthPreferences()); + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); + prefs->SetServerWhitelist( + command_line->GetSwitchValueASCII(switches::kAuthServerWhitelist)); + std::unique_ptr<net::HttpAuthHandlerRegistryFactory> factory = + net::HttpAuthHandlerRegistryFactory::CreateDefault(host_resolver.get()); + factory->SetHttpAuthPreferences(net::kNegotiateAuthScheme, + std::move(prefs)); + builder.SetHttpAuthHandlerFactory(std::move(factory)); + builder.set_host_resolver(std::move(host_resolver)); + // Extra headers are required for network emulation and are removed in // DevToolsNetworkTransaction. If a protocol handler is set for http or // https, then it is likely that the HttpTransactionFactoryCallback will
diff --git a/ios/chrome/browser/autofill/form_suggestion_controller.mm b/ios/chrome/browser/autofill/form_suggestion_controller.mm index 3e1b7a21..20867b7 100644 --- a/ios/chrome/browser/autofill/form_suggestion_controller.mm +++ b/ios/chrome/browser/autofill/form_suggestion_controller.mm
@@ -188,6 +188,7 @@ NSString* strongType = base::SysUTF8ToNSString(params.type); NSString* strongValue = base::SysUTF8ToNSString(_suggestionState.get()->typed_value); + BOOL is_main_frame = params.is_main_frame; // Build a block for each provider that will invoke its completion with YES // if the provider can provide suggestions for the specified form/field/type @@ -210,6 +211,7 @@ fieldType:strongFieldType type:strongType typedValue:strongValue + isMainFrame:is_main_frame webState:webState completionHandler:completion]; };
diff --git a/ios/chrome/browser/autofill/form_suggestion_controller_unittest.mm b/ios/chrome/browser/autofill/form_suggestion_controller_unittest.mm index d7a27767..93f9146 100644 --- a/ios/chrome/browser/autofill/form_suggestion_controller_unittest.mm +++ b/ios/chrome/browser/autofill/form_suggestion_controller_unittest.mm
@@ -84,6 +84,7 @@ fieldType:(NSString*)fieldType type:(NSString*)type typedValue:(NSString*)typedValue + isMainFrame:(BOOL)isMainFrame webState:(web::WebState*)webState completionHandler: (SuggestionsAvailableCompletion)completion {
diff --git a/ios/chrome/browser/notification_promo.cc b/ios/chrome/browser/notification_promo.cc index 841ea4d6..ed54160 100644 --- a/ios/chrome/browser/notification_promo.cc +++ b/ios/chrome/browser/notification_promo.cc
@@ -28,7 +28,6 @@ const char kPrefPromoObject[] = "ios.ntppromo"; // Keys in the kPrefPromoObject dictionary; used only here. -const char kPrefPromoID[] = "id"; const char kPrefPromoFirstViewTime[] = "first_view_time"; const char kPrefPromoViews[] = "views"; const char kPrefPromoClosed[] = "closed"; @@ -155,10 +154,6 @@ } void NotificationPromo::InitFromPrefs() { - // Check if data is stored in the old prefs structure, and migrate it before - // reading from prefs. - MigrateOldPrefs(); - // If |promo_id_| is not set, do nothing. if (promo_id_ == -1) return; @@ -178,48 +173,6 @@ ntp_promo->GetBoolean(kPrefPromoClosed, &closed_); } -void NotificationPromo::MigrateOldPrefs() { - const base::DictionaryValue* promo_dict = - local_state_->GetDictionary(kPrefPromoObject); - if (!promo_dict) - return; - - const base::ListValue* promo_list = NULL; - promo_dict->GetList("mobile_ntp_whats_new_promo", &promo_list); - if (!promo_list) - return; - - const base::DictionaryValue* ntp_promo = NULL; - promo_list->GetDictionary(0, &ntp_promo); - if (!ntp_promo) { - // If the list is saved but there is no promo dictionary, clear prefs to - // delete the empty list. - NotificationPromo::MigrateUserPrefs(local_state_); - return; - } - - int promo_id = -1; - ntp_promo->GetInteger(kPrefPromoID, &promo_id); - if (promo_id == -1) { - // If there is no promo id saved in prefs, then data is corrupt and the - // prefs can be discarded. - NotificationPromo::MigrateUserPrefs(local_state_); - return; - } - - double first_view_time = 0; - ntp_promo->GetDouble(kPrefPromoFirstViewTime, &first_view_time); - int views = 0; - ntp_promo->GetInteger(kPrefPromoViews, &views); - bool closed = false; - ntp_promo->GetBoolean(kPrefPromoClosed, &closed); - - // Clear prefs to discard the old structure before saving the data in the new - // structure. - NotificationPromo::MigrateUserPrefs(local_state_); - WritePrefs(promo_id, first_view_time, views, closed); -} - bool NotificationPromo::CanShow() const { return !closed_ && !promo_text_.empty() && !ExceedsMaxViews() && !ExceedsMaxSeconds() &&
diff --git a/ios/chrome/browser/notification_promo.h b/ios/chrome/browser/notification_promo.h index dda497c..fef0bb6 100644 --- a/ios/chrome/browser/notification_promo.h +++ b/ios/chrome/browser/notification_promo.h
@@ -82,12 +82,6 @@ // payload. bool IsPayloadParam(const std::string& param_name) const; - // Transition data saved in old prefs structure to new structure that supports - // storing multiple promos. - // TODO(crbug.com/623726) Remove this method when migration is no longer - // needed as most users have been upgraded to the new pref structure. - void MigrateOldPrefs(); - PrefService* local_state_; std::string promo_text_;
diff --git a/ios/chrome/browser/notification_promo_unittest.cc b/ios/chrome/browser/notification_promo_unittest.cc index bbadaeb..bb1c076 100644 --- a/ios/chrome/browser/notification_promo_unittest.cc +++ b/ios/chrome/browser/notification_promo_unittest.cc
@@ -285,54 +285,6 @@ notification_promo_.WritePrefs(); } - // Tests that if data is saved in the old pref structure, it is successfully - // migrated to the new structure that supports saving multiple promos. - // TODO(crbug.com/623726) Remove this method when migration is no longer - // needed as most users have been upgraded to the new pref structure. - void TestMigrationOfOldPrefs() { - NotificationPromo promo(&local_state_); - promo.InitFromVariations(); - - // Pick values for each variable that is saved into old prefs structure. - double first_view_time = 2.0; - int views = max_views_ + 1; - bool closed = true; - - // Save data into old prefs structure. - auto ntp_promo = base::MakeUnique<base::DictionaryValue>(); - ntp_promo->SetInteger("id", promo.promo_id_); - ntp_promo->SetDouble("first_view_time", first_view_time); - ntp_promo->SetInteger("views", views); - ntp_promo->SetBoolean("closed", true); - - auto promo_list = base::MakeUnique<base::ListValue>(); - promo_list->Append(std::move(ntp_promo)); - - std::string promo_list_key = "mobile_ntp_whats_new_promo"; - std::string promo_dict_key = "ios.ntppromo"; - - base::DictionaryValue promo_dict; - promo_dict.Set(promo_list_key, std::move(promo_list)); - local_state_.Set(promo_dict_key, promo_dict); - - // Initialize promo and verify that its instance variables match the data - // saved in the old structure. - promo.InitFromPrefs(); - EXPECT_DOUBLE_EQ(first_view_time, promo.first_view_time_); - EXPECT_EQ(views, promo.views_); - EXPECT_EQ(closed, promo.closed_); - EXPECT_FALSE(promo.CanShow()); - - // Verify that old pref structure was cleared. - const base::DictionaryValue* current_promo_dict = - local_state_.GetDictionary(promo_dict_key); - // Do not continue further if no dictionary was found at the key in prefs. - ASSERT_TRUE(current_promo_dict); - const base::ListValue* current_promo_list = NULL; - current_promo_dict->GetList(promo_list_key, ¤t_promo_list); - EXPECT_FALSE(current_promo_list); - } - const NotificationPromo& promo() const { return notification_promo_; } protected: @@ -419,28 +371,4 @@ TestFirstViewTimeRecorded(); } -// TODO(crbug.com/623726) Remove this test case when migration is no longer -// needed as most users have been upgraded to the new pref structure. -TEST_F(NotificationPromoTest, NotificationPromoPrefMigrationTest) { - Init( - "{" - " \"start\":\"3 Aug 1999 9:26:06 GMT\"," - " \"end\":\"$1\"," - " \"promo_text\":\"What do you think of Chrome?\"," - " \"payload\":" - " {" - " \"days_active\":7," - " \"install_age_days\":21" - " }," - " \"max_views\":30," - " \"max_seconds\":30," - " \"promo_id\":0" - "}", - "What do you think of Chrome?", - 933672366, // unix epoch for 3 Aug 1999 9:26:06 GMT. - 0, 30, 30); - InitPromoFromVariations(); - TestMigrationOfOldPrefs(); -} - } // namespace ios
diff --git a/ios/chrome/browser/passwords/password_controller.mm b/ios/chrome/browser/passwords/password_controller.mm index b9e7c5a..a7b72223 100644 --- a/ios/chrome/browser/passwords/password_controller.mm +++ b/ios/chrome/browser/passwords/password_controller.mm
@@ -469,7 +469,12 @@ - (void)webState:(web::WebState*)webState didSubmitDocumentWithFormNamed:(const std::string&)formName - userInitiated:(BOOL)userInitiated { + userInitiated:(BOOL)userInitiated + isMainFrame:(BOOL)isMainFrame { + if (!isMainFrame) { + // Saving from iframes is not implemented. + return; + } DCHECK_EQ(webState_, webState); __weak PasswordController* weakSelf = self; // This code is racing against the new page loading and will not get the @@ -668,6 +673,7 @@ fieldType:(NSString*)fieldType type:(NSString*)type typedValue:(NSString*)typedValue + isMainFrame:(BOOL)isMainFrame webState:(web::WebState*)webState completionHandler: (SuggestionsAvailableCompletion)completion {
diff --git a/ios/chrome/browser/passwords/resources/password_controller.js b/ios/chrome/browser/passwords/resources/password_controller.js index 6cb7cdd..32fb84e4 100644 --- a/ios/chrome/browser/passwords/resources/password_controller.js +++ b/ios/chrome/browser/passwords/resources/password_controller.js
@@ -51,14 +51,7 @@ return true; } - var frames = getSameOriginFrames_(win); - for (var i = 0; i < frames.length; i++) { - if (hasPasswordField_(frames[i])) { - return true; - } - } - - return false; + return getSameOriginFrames_(win).some(hasPasswordField_); }; /** @@ -228,7 +221,6 @@ if (usernameInput.readOnly) { if (usernameInput.value == username) { passwordInput.value = password; - __gCrWeb.setAutofilled(passwordInput, true); filled = true; } } else { @@ -241,8 +233,6 @@ usernameInput.value = username; passwordInput.focus(); passwordInput.value = password; - __gCrWeb.setAutofilled(passwordInput, true); - __gCrWeb.setAutofilled(usernameInput, true); filled = true; } } @@ -260,27 +250,6 @@ }; /** - * Returns true if the supplied field |inputElement| was autofilled. - * @param {Element} inputElement The form field for which we need to - * acquire the autofilled indicator. - * @return {boolean} Whether inputElement was autofilled. - */ - __gCrWeb.isAutofilled = function(inputElement) { - return inputElement['__gCrWebAutofilled']; - }; - - /** - * Marks the supplied field as autofilled or not depending on the - * |value|. - * @param {Element} inputElement The form field for which the indicator - * needs to be set. - * @param {boolean} value The new value of the indicator. - */ - __gCrWeb.setAutofilled = function(inputElement, value) { - inputElement['__gCrWebAutofilled'] = value; - }; - - /** * Finds all forms with passwords in the supplied window or frame and appends * JS objects containing the form data to |formDataList|. * @param {!Array.<Object>} formDataList A list that this function populates @@ -289,18 +258,7 @@ * look for password forms. */ __gCrWeb.getPasswordFormDataList = function(formDataList, win) { - var doc = null; - - try { - // Security violations may generate an exception or null to be returned. - doc = win.document; - } catch(e) { - } - - if (!doc) { - return; - } - + var doc = win.document; var forms = doc.forms; for (var i = 0; i < forms.length; i++) { var formData = __gCrWeb.getPasswordFormData(forms[i]);
diff --git a/ios/chrome/browser/ui/bookmarks/bookmarks_new_generation_egtest.mm b/ios/chrome/browser/ui/bookmarks/bookmarks_new_generation_egtest.mm index e44fb4e..4a9f0e6 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmarks_new_generation_egtest.mm +++ b/ios/chrome/browser/ui/bookmarks/bookmarks_new_generation_egtest.mm
@@ -2213,6 +2213,39 @@ [BookmarksNewGenTestCase verifyFolderCreatedWithTitle:newFolderTitle]; } +// Tests the new folder name is committed when "hide keyboard" button is +// pressed. (iPad specific) +- (void)testNewFolderNameCommittedWhenKeyboardDismissedOnIpad { + // Tablet only (handset keyboard does not have "hide keyboard" button). + if (!IsIPadIdiom()) { + EARL_GREY_TEST_SKIPPED(@"Test not supported on iPhone"); + } + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitAndEnableFeature(kBookmarkNewGeneration); + + [BookmarksNewGenTestCase setupStandardBookmarks]; + [BookmarksNewGenTestCase openBookmarks]; + [BookmarksNewGenTestCase openMobileBookmarks]; + + // Create a new folder and type "New Folder 1" without pressing return. + NSString* newFolderTitle = @"New Folder 1"; + [BookmarksNewGenTestCase createNewBookmarkFolderWithFolderTitle:newFolderTitle + pressReturn:NO]; + + // Tap on the "hide keyboard" button. + id<GREYMatcher> hideKeyboard = grey_accessibilityLabel(@"Hide keyboard"); + [[EarlGrey selectElementWithMatcher:hideKeyboard] performAction:grey_tap()]; + + // Tap on "New Folder 1". + [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"New Folder 1")] + performAction:grey_tap()]; + + // Verify the empty background appears. (If "New Folder 1" is commited, + // tapping on it will enter it and see a empty background. Instead of + // re-editing it (crbug.com/794155)). + [self verifyEmptyBackgroundAppears]; +} + - (void)testEmptyBackgroundAndSelectButton { base::test::ScopedFeatureList scoped_feature_list; scoped_feature_list.InitAndEnableFeature(kBookmarkNewGeneration);
diff --git a/ios/chrome/browser/ui/bookmarks/cells/bookmark_table_cell.mm b/ios/chrome/browser/ui/bookmarks/cells/bookmark_table_cell.mm index b1969e210..c593c0a 100644 --- a/ios/chrome/browser/ui/bookmarks/cells/bookmark_table_cell.mm +++ b/ios/chrome/browser/ui/bookmarks/cells/bookmark_table_cell.mm
@@ -39,6 +39,9 @@ // Lists the accessibility elements that are to be seen by UIAccessibility. @property(nonatomic, readonly) NSMutableArray* accessibilityElements; +// True when title text has ended editing and committed. +@property(nonatomic, assign) BOOL isTextCommitted; + @end @implementation BookmarkTableCell @@ -48,6 +51,7 @@ @synthesize textDelegate = _textDelegate; @synthesize separatorView = _separatorView; @synthesize accessibilityElements = _accessibilityElements; +@synthesize isTextCommitted = _isTextCommitted; #pragma mark - Initializer @@ -147,6 +151,7 @@ } - (void)startEdit { + self.isTextCommitted = NO; self.titleText.userInteractionEnabled = YES; self.titleText.enablesReturnKeyAutomatically = YES; self.titleText.keyboardType = UIKeyboardTypeDefault; @@ -168,6 +173,10 @@ } - (void)stopEdit { + if (self.isTextCommitted) { + return; + } + self.isTextCommitted = YES; [self.textDelegate textDidChangeTo:self.titleText.text]; self.titleText.userInteractionEnabled = NO; [self.titleText endEditing:YES]; @@ -259,10 +268,15 @@ // This method hides the keyboard when the return key is pressed. - (BOOL)textFieldShouldReturn:(UITextField*)textField { - [self.textDelegate textDidChangeTo:self.titleText.text]; - self.titleText.userInteractionEnabled = NO; - [textField endEditing:YES]; + [self stopEdit]; return YES; } +// This method is called when titleText resigns its first responder status. +// (when return/dimiss key is pressed, or when navigating away.) +- (void)textFieldDidEndEditing:(UITextField*)textField + reason:(UITextFieldDidEndEditingReason)reason { + [self stopEdit]; +} + @end
diff --git a/ios/chrome/browser/ui/browser_view_controller.mm b/ios/chrome/browser/ui/browser_view_controller.mm index ee8f223..8023ab5 100644 --- a/ios/chrome/browser/ui/browser_view_controller.mm +++ b/ios/chrome/browser/ui/browser_view_controller.mm
@@ -2234,7 +2234,8 @@ [self.dispatcher dismissToolsMenu]; [self.dispatcher hidePageInfo]; [_tabHistoryCoordinator dismissHistoryPopup]; - [self.tabTipBubblePresenter dismissAnimated:YES]; + [self.tabTipBubblePresenter dismissAnimated:NO]; + [self.incognitoTabTipBubblePresenter dismissAnimated:NO]; } - (BubbleViewControllerPresenter*) @@ -2318,14 +2319,20 @@ tabSwitcherAnchor = [_toolbarCoordinator anchorPointForTabSwitcherButton:BubbleArrowDirectionUp]; } + // If the feature engagement tracker does not consider it valid to display - // the new tab tip, then |bubblePresenterForFeature| returns |nil| and the - // call to |presentInViewController| is a no-op. - self.tabTipBubblePresenter = + // the new tab tip, then end early to prevent the potential reassignment + // of the existing |tabTipBubblePresenter| to nil. + BubbleViewControllerPresenter* presenter = [self bubblePresenterForFeature:feature_engagement::kIPHNewTabTipFeature direction:BubbleArrowDirectionUp alignment:BubbleAlignmentTrailing text:text]; + if (!presenter) + return; + + self.tabTipBubblePresenter = presenter; + [self.tabTipBubblePresenter presentInViewController:self view:self.view anchorPoint:tabSwitcherAnchor]; @@ -2361,20 +2368,26 @@ IDS_IOS_NEW_INCOGNITO_TAB_IPH_PROMOTION_TEXT); CGPoint toolsButtonAnchor = [_toolbarCoordinator anchorPointForToolsMenuButton:BubbleArrowDirectionUp]; - self.incognitoTabTipBubblePresenter = + + // If the feature engagement tracker does not consider it valid to display + // the incognito tab tip, then end early to prevent the potential reassignment + // of the existing |incognitoTabTipBubblePresenter| to nil. + BubbleViewControllerPresenter* presenter = [self bubblePresenterForFeature:feature_engagement:: kIPHNewIncognitoTabTipFeature direction:BubbleArrowDirectionUp alignment:BubbleAlignmentTrailing text:text]; + if (!presenter) + return; + + self.incognitoTabTipBubblePresenter = presenter; + [self.incognitoTabTipBubblePresenter presentInViewController:self view:self.view anchorPoint:toolsButtonAnchor]; - // Only trigger the tools menu button animation if the bubble is shown. - if (self.incognitoTabTipBubblePresenter) { - [_toolbarCoordinator triggerToolsMenuButtonAnimation]; - } + [_toolbarCoordinator triggerToolsMenuButtonAnimation]; } #pragma mark - Tap handling @@ -4814,6 +4827,7 @@ [_dialogPresenter cancelAllDialogs]; [self.dispatcher hidePageInfo]; [self.tabTipBubblePresenter dismissAnimated:NO]; + [self.incognitoTabTipBubblePresenter dismissAnimated:NO]; if (_voiceSearchController) _voiceSearchController->DismissMicPermissionsHelp();
diff --git a/ios/chrome/browser/ui/omnibox/BUILD.gn b/ios/chrome/browser/ui/omnibox/BUILD.gn index 4e77cd7..dae779b5 100644 --- a/ios/chrome/browser/ui/omnibox/BUILD.gn +++ b/ios/chrome/browser/ui/omnibox/BUILD.gn
@@ -94,6 +94,7 @@ "//ios/chrome/browser/sessions", "//ios/chrome/browser/ui", "//ios/chrome/browser/ui/commands", + "//ios/chrome/browser/ui/omnibox/popup", "//ios/chrome/browser/ui/toolbar/clean:toolbar_components_ui", "//ios/chrome/browser/ui/toolbar/public", "//ios/chrome/browser/ui/toolbar/public:toolbar_base_feature", @@ -110,6 +111,7 @@ "//ui/gfx/geometry", "//url", ] + allow_circular_includes_from = [ "//ios/chrome/browser/ui/omnibox/popup" ] public_deps = [ "//components/omnibox/browser", ]
diff --git a/ios/chrome/browser/ui/omnibox/omnibox_popup_view_ios.h b/ios/chrome/browser/ui/omnibox/omnibox_popup_view_ios.h index a692124..bf0ea5f 100644 --- a/ios/chrome/browser/ui/omnibox/omnibox_popup_view_ios.h +++ b/ios/chrome/browser/ui/omnibox/omnibox_popup_view_ios.h
@@ -17,12 +17,11 @@ #import "ios/chrome/browser/ui/omnibox/omnibox_popup_view_controller.h" class OmniboxEditModel; -@class OmniboxPopupViewController; +@class OmniboxPopupCoordinator; class OmniboxPopupModel; class OmniboxPopupViewSuggestionsDelegate; @protocol OmniboxPopupPositioner; struct AutocompleteMatch; -@class OmniboxPopupPresenter; namespace ios { class ChromeBrowserState; @@ -68,10 +67,7 @@ private: std::unique_ptr<OmniboxPopupModel> model_; OmniboxPopupViewSuggestionsDelegate* delegate_; // weak - base::scoped_nsobject<OmniboxPopupMediator> mediator_; - base::scoped_nsobject<OmniboxPopupPresenter> presenter_; - base::scoped_nsobject<OmniboxPopupViewController> popup_controller_; - bool is_open_; + base::scoped_nsobject<OmniboxPopupCoordinator> coordinator_; }; #endif // IOS_CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_POPUP_VIEW_IOS_H_
diff --git a/ios/chrome/browser/ui/omnibox/omnibox_popup_view_ios.mm b/ios/chrome/browser/ui/omnibox/omnibox_popup_view_ios.mm index 4783d76..3975947 100644 --- a/ios/chrome/browser/ui/omnibox/omnibox_popup_view_ios.mm +++ b/ios/chrome/browser/ui/omnibox/omnibox_popup_view_ios.mm
@@ -24,6 +24,7 @@ #import "ios/chrome/browser/ui/omnibox/omnibox_popup_view_controller.h" #include "ios/chrome/browser/ui/omnibox/omnibox_popup_view_suggestions_delegate.h" #include "ios/chrome/browser/ui/omnibox/omnibox_util.h" +#import "ios/chrome/browser/ui/omnibox/popup/omnibox_popup_coordinator.h" #include "ios/chrome/browser/ui/ui_util.h" #import "ios/chrome/browser/ui/uikit_ui_util.h" #include "ios/chrome/grit/ios_theme_resources.h" @@ -42,31 +43,19 @@ OmniboxEditModel* edit_model, OmniboxPopupViewSuggestionsDelegate* delegate, id<OmniboxPopupPositioner> positioner) - : model_(new OmniboxPopupModel(this, edit_model)), - delegate_(delegate), - is_open_(false) { + : model_(new OmniboxPopupModel(this, edit_model)), delegate_(delegate) { DCHECK(delegate); DCHECK(browser_state); DCHECK(edit_model); - std::unique_ptr<image_fetcher::IOSImageDataFetcherWrapper> imageFetcher = - base::MakeUnique<image_fetcher::IOSImageDataFetcherWrapper>( - browser_state->GetRequestContext()); + // TODO(crbug.com/788640): The coordinator should own the OmniboxPopupViewIOS, + // not the other way around. + coordinator_.reset([[OmniboxPopupCoordinator alloc] init]); + [coordinator_ setBrowserState:browser_state]; + [coordinator_ setMediatorDelegate:this]; + [coordinator_ setPositioner:positioner]; - mediator_.reset([[OmniboxPopupMediator alloc] - initWithFetcher:std::move(imageFetcher) - delegate:this]); - popup_controller_.reset([[OmniboxPopupViewController alloc] init]); - [popup_controller_ setIncognito:browser_state->IsOffTheRecord()]; - - [mediator_ setIncognito:browser_state->IsOffTheRecord()]; - [mediator_ setConsumer:popup_controller_]; - [popup_controller_ setImageRetriever:mediator_]; - [popup_controller_ setDelegate:mediator_]; - - presenter_.reset([[OmniboxPopupPresenter alloc] - initWithPopupPositioner:positioner - popupViewController:popup_controller_]); + [coordinator_ start]; } OmniboxPopupViewIOS::~OmniboxPopupViewIOS() { @@ -87,23 +76,9 @@ void OmniboxPopupViewIOS::UpdatePopupAppearance() { const AutocompleteResult& result = model_->result(); - // TODO(crbug.com/762597): this logic should move to PopupCoordinator. - if (!is_open_ && !result.empty()) { - // The popup is not currently open and there are results to display. Update - // and animate the cells - [mediator_ updateMatches:result withAnimation:YES]; - } else { - // The popup is already displayed or there are no results to display. Update - // the cells without animating. - [mediator_ updateMatches:result withAnimation:NO]; - } - is_open_ = !result.empty(); - - if (is_open_) { - [presenter_ updateHeightAndAnimateAppearanceIfNecessary]; + [coordinator_ updateWithResults:result]; + if ([coordinator_ isOpen]) { UpdateEditViewIcon(); - } else { - [presenter_ animateCollapse]; } delegate_->OnResultsChanged(result); @@ -114,7 +89,7 @@ } bool OmniboxPopupViewIOS::IsOpen() const { - return is_open_; + return [coordinator_ isOpen]; } OmniboxPopupModel* OmniboxPopupViewIOS::model() const { @@ -124,11 +99,11 @@ #pragma mark - OmniboxPopupProvider bool OmniboxPopupViewIOS::IsPopupOpen() { - return is_open_; + return [coordinator_ isOpen]; } void OmniboxPopupViewIOS::SetTextAlignment(NSTextAlignment alignment) { - [popup_controller_ setTextAlignment:alignment]; + [coordinator_ setTextAlignment:alignment]; } #pragma mark - OmniboxPopupViewControllerDelegate
diff --git a/ios/chrome/browser/ui/omnibox/popup/BUILD.gn b/ios/chrome/browser/ui/omnibox/popup/BUILD.gn new file mode 100644 index 0000000..b2972c4 --- /dev/null +++ b/ios/chrome/browser/ui/omnibox/popup/BUILD.gn
@@ -0,0 +1,18 @@ +# Copyright 2017 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +source_set("popup") { + sources = [ + "omnibox_popup_coordinator.h", + "omnibox_popup_coordinator.mm", + ] + deps = [ + "//base", + "//components/image_fetcher/ios", + "//components/omnibox/browser", + "//ios/chrome/browser/browser_state", + "//net", + ] + configs += [ "//build/config/compiler:enable_arc" ] +}
diff --git a/ios/chrome/browser/ui/omnibox/popup/OWNERS b/ios/chrome/browser/ui/omnibox/popup/OWNERS new file mode 100644 index 0000000..96e7948a --- /dev/null +++ b/ios/chrome/browser/ui/omnibox/popup/OWNERS
@@ -0,0 +1 @@ +stkhapugin@chromium.org
diff --git a/ios/chrome/browser/ui/omnibox/popup/omnibox_popup_coordinator.h b/ios/chrome/browser/ui/omnibox/popup/omnibox_popup_coordinator.h new file mode 100644 index 0000000..818460bd --- /dev/null +++ b/ios/chrome/browser/ui/omnibox/popup/omnibox_popup_coordinator.h
@@ -0,0 +1,36 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_CHROME_BROWSER_UI_OMNIBOX_POPUP_OMNIBOX_POPUP_COORDINATOR_H_ +#define IOS_CHROME_BROWSER_UI_OMNIBOX_POPUP_OMNIBOX_POPUP_COORDINATOR_H_ + +#import <UIKit/UIKit.h> + +class AutocompleteResult; +class OmniboxPopupMediatorDelegate; +@protocol OmniboxPopupPositioner; + +namespace ios { +class ChromeBrowserState; +} + +// Coordinator for the Omnibox Popup. +@interface OmniboxPopupCoordinator : NSObject +// BrowserState. +@property(nonatomic, assign) ios::ChromeBrowserState* browserState; +// Positioner for the popup. +@property(nonatomic, weak) id<OmniboxPopupPositioner> positioner; +// Delegate for the popup mediator. +@property(nonatomic, assign) OmniboxPopupMediatorDelegate* mediatorDelegate; +// Whether the popup is open. +@property(nonatomic, assign, getter=isOpen) BOOL open; + +- (void)start; +// Updates the popup with the |results|. +- (void)updateWithResults:(const AutocompleteResult&)results; +// Sets the text alignment of the popup content. +- (void)setTextAlignment:(NSTextAlignment)alignment; +@end + +#endif // IOS_CHROME_BROWSER_UI_OMNIBOX_POPUP_OMNIBOX_POPUP_COORDINATOR_H_
diff --git a/ios/chrome/browser/ui/omnibox/popup/omnibox_popup_coordinator.mm b/ios/chrome/browser/ui/omnibox/popup/omnibox_popup_coordinator.mm new file mode 100644 index 0000000..205c10b --- /dev/null +++ b/ios/chrome/browser/ui/omnibox/popup/omnibox_popup_coordinator.mm
@@ -0,0 +1,83 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ios/chrome/browser/ui/omnibox/popup/omnibox_popup_coordinator.h" + +#import "components/image_fetcher/ios/ios_image_data_fetcher_wrapper.h" +#include "components/omnibox/browser/autocomplete_result.h" +#include "ios/chrome/browser/browser_state/chrome_browser_state.h" +#import "ios/chrome/browser/ui/omnibox/omnibox_popup_mediator.h" +#import "ios/chrome/browser/ui/omnibox/omnibox_popup_presenter.h" +#import "ios/chrome/browser/ui/omnibox/omnibox_popup_view_controller.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +@interface OmniboxPopupCoordinator () + +@property(nonatomic, strong) OmniboxPopupViewController* popupViewController; +@property(nonatomic, strong) OmniboxPopupMediator* mediator; +@property(nonatomic, strong) OmniboxPopupPresenter* presenter; + +@end + +@implementation OmniboxPopupCoordinator + +@synthesize browserState = _browserState; +@synthesize mediator = _mediator; +@synthesize mediatorDelegate = _mediatorDelegate; +@synthesize open = _open; +@synthesize popupViewController = _popupViewController; +@synthesize positioner = _positioner; +@synthesize presenter = _presenter; + +#pragma mark - Public + +- (void)start { + self.open = NO; + std::unique_ptr<image_fetcher::IOSImageDataFetcherWrapper> imageFetcher = + std::make_unique<image_fetcher::IOSImageDataFetcherWrapper>( + self.browserState->GetRequestContext()); + + self.mediator = + [[OmniboxPopupMediator alloc] initWithFetcher:std::move(imageFetcher) + delegate:self.mediatorDelegate]; + self.popupViewController = [[OmniboxPopupViewController alloc] init]; + self.popupViewController.incognito = self.browserState->IsOffTheRecord(); + + self.mediator.incognito = self.browserState->IsOffTheRecord(); + self.mediator.consumer = self.popupViewController; + self.popupViewController.imageRetriever = self.mediator; + self.popupViewController.delegate = self.mediator; + + self.presenter = [[OmniboxPopupPresenter alloc] + initWithPopupPositioner:self.positioner + popupViewController:self.popupViewController]; +} + +- (void)updateWithResults:(const AutocompleteResult&)result { + if (!self.open && !result.empty()) { + // The popup is not currently open and there are results to display. Update + // and animate the cells + [self.mediator updateMatches:result withAnimation:YES]; + } else { + // The popup is already displayed or there are no results to display. Update + // the cells without animating. + [self.mediator updateMatches:result withAnimation:NO]; + } + self.open = !result.empty(); + + if (self.open) { + [self.presenter updateHeightAndAnimateAppearanceIfNecessary]; + } else { + [self.presenter animateCollapse]; + } +} + +- (void)setTextAlignment:(NSTextAlignment)alignment { + [self.popupViewController setTextAlignment:alignment]; +} + +@end
diff --git a/ios/third_party/material_internationalization_ios/BUILD.gn b/ios/third_party/material_internationalization_ios/BUILD.gn index 9e52ad5..30058798 100644 --- a/ios/third_party/material_internationalization_ios/BUILD.gn +++ b/ios/third_party/material_internationalization_ios/BUILD.gn
@@ -45,3 +45,14 @@ "//build/config/gcc:symbol_visibility_default", ] } + +# TODO(crbug.com/785248): remove those targets when downstream has been fixed +# to no longer use it but instead depend on :material_internationalization_ios. +group("material_internationalization_ios+link") { + public_deps = [ + ":material_internationalization_ios", + ] +} + +group("material_internationalization_ios:bundle") { +}
diff --git a/ios/web/public/test/fakes/crw_test_web_state_observer.mm b/ios/web/public/test/fakes/crw_test_web_state_observer.mm index f47ac27f..9c51cf34 100644 --- a/ios/web/public/test/fakes/crw_test_web_state_observer.mm +++ b/ios/web/public/test/fakes/crw_test_web_state_observer.mm
@@ -230,11 +230,13 @@ - (void)webState:(web::WebState*)webState didSubmitDocumentWithFormNamed:(const std::string&)formName - userInitiated:(BOOL)userInitiated { + userInitiated:(BOOL)userInitiated + isMainFrame:(BOOL)isMainFrame { _submitDocumentInfo = base::MakeUnique<web::TestSubmitDocumentInfo>(); _submitDocumentInfo->web_state = webState; _submitDocumentInfo->form_name = formName; _submitDocumentInfo->user_initiated = userInitiated; + _submitDocumentInfo->is_main_frame = isMainFrame; } - (void)webState:(web::WebState*)webState
diff --git a/ios/web/public/test/fakes/test_web_state.h b/ios/web/public/test/fakes/test_web_state.h index b78be1b..ff54ce2 100644 --- a/ios/web/public/test/fakes/test_web_state.h +++ b/ios/web/public/test/fakes/test_web_state.h
@@ -110,7 +110,9 @@ void OnNavigationFinished(NavigationContext* navigation_context); void OnRenderProcessGone(); void OnFormActivity(const FormActivityParams& params); - void OnDocumentSubmitted(const std::string& form_name, bool user_initiated); + void OnDocumentSubmitted(const std::string& form_name, + bool user_initiated, + bool is_main_frame); void OnVisibleSecurityStateChanged(); private:
diff --git a/ios/web/public/test/fakes/test_web_state.mm b/ios/web/public/test/fakes/test_web_state.mm index 437ae12..260cd46f 100644 --- a/ios/web/public/test/fakes/test_web_state.mm +++ b/ios/web/public/test/fakes/test_web_state.mm
@@ -257,9 +257,10 @@ } void TestWebState::OnDocumentSubmitted(const std::string& form_name, - bool user_initiated) { + bool user_initiated, + bool is_main_frame) { for (auto& observer : observers_) { - observer.DocumentSubmitted(this, form_name, user_initiated); + observer.DocumentSubmitted(this, form_name, user_initiated, is_main_frame); } }
diff --git a/ios/web/public/test/fakes/test_web_state_observer.h b/ios/web/public/test/fakes/test_web_state_observer.h index 58822e3..2eb1767 100644 --- a/ios/web/public/test/fakes/test_web_state_observer.h +++ b/ios/web/public/test/fakes/test_web_state_observer.h
@@ -116,7 +116,8 @@ void DidSuppressDialog(WebState* web_state) override; void DocumentSubmitted(WebState* web_state, const std::string& form_name, - bool user_initiated) override; + bool user_initiated, + bool is_main_frame) override; void FormActivityRegistered(WebState* web_state, const FormActivityParams& params) override; void FaviconUrlUpdated(WebState* web_state,
diff --git a/ios/web/public/test/fakes/test_web_state_observer.mm b/ios/web/public/test/fakes/test_web_state_observer.mm index 9c04d20..3033ed0 100644 --- a/ios/web/public/test/fakes/test_web_state_observer.mm +++ b/ios/web/public/test/fakes/test_web_state_observer.mm
@@ -140,12 +140,14 @@ void TestWebStateObserver::DocumentSubmitted(WebState* web_state, const std::string& form_name, - bool user_initiated) { + bool user_initiated, + bool is_main_frame) { ASSERT_EQ(web_state_, web_state); submit_document_info_ = base::MakeUnique<web::TestSubmitDocumentInfo>(); submit_document_info_->web_state = web_state; submit_document_info_->form_name = form_name; submit_document_info_->user_initiated = user_initiated; + submit_document_info_->is_main_frame = is_main_frame; } void TestWebStateObserver::FormActivityRegistered(
diff --git a/ios/web/public/test/fakes/test_web_state_observer_util.h b/ios/web/public/test/fakes/test_web_state_observer_util.h index 52e4d05..7bdc738 100644 --- a/ios/web/public/test/fakes/test_web_state_observer_util.h +++ b/ios/web/public/test/fakes/test_web_state_observer_util.h
@@ -92,6 +92,7 @@ WebState* web_state; std::string form_name; bool user_initiated; + bool is_main_frame; }; // Arguments passed to |FormActivityRegistered|.
diff --git a/ios/web/public/web_state/form_activity_params.h b/ios/web/public/web_state/form_activity_params.h index 53f1221..b7df7cf6 100644 --- a/ios/web/public/web_state/form_activity_params.h +++ b/ios/web/public/web_state/form_activity_params.h
@@ -37,6 +37,9 @@ // |input_missing| is set to true if at least one of the members above isn't // set. bool input_missing = false; + + // |is_main_frame| is true when the activity was registered in the main frame. + bool is_main_frame = false; }; } // namespace web
diff --git a/ios/web/public/web_state/web_state_observer.h b/ios/web/public/web_state/web_state_observer.h index 766ffad..a0f9c67 100644 --- a/ios/web/public/web_state/web_state_observer.h +++ b/ios/web/public/web_state/web_state_observer.h
@@ -132,14 +132,17 @@ // false. virtual void DidSuppressDialog(WebState* web_state) {} - // Called on form submission. |user_initiated| is true if the user - // interacted with the page. + // Called on form submission in the main frame or in a same-origin iframe. + // |user_initiated| is true if the user interacted with the page. + // |is_main_frame| is true if the submitted form is in the main frame. virtual void DocumentSubmitted(WebState* web_state, const std::string& form_name, - bool user_initiated) {} + bool user_initiated, + bool is_main_frame) {} - // Called when the user is typing on a form field, with |params.input_missing| - // indicating if there is any error when parsing the form field information. + // Called when the user is typing on a form field in the main frame or in a + // same-origin iframe. |params.input_missing| is indicating if there is any + // error when parsing the form field information. virtual void FormActivityRegistered(WebState* web_state, const FormActivityParams& params) {}
diff --git a/ios/web/public/web_state/web_state_observer_bridge.h b/ios/web/public/web_state/web_state_observer_bridge.h index 1521a34..e3c053e 100644 --- a/ios/web/public/web_state/web_state_observer_bridge.h +++ b/ios/web/public/web_state/web_state_observer_bridge.h
@@ -59,7 +59,8 @@ // Invoked by WebStateObserverBridge::DocumentSubmitted. - (void)webState:(web::WebState*)webState didSubmitDocumentWithFormNamed:(const std::string&)formName - userInitiated:(BOOL)userInitiated; + userInitiated:(BOOL)userInitiated + isMainFrame:(BOOL)isMainFrame; // Invoked by WebStateObserverBridge::FormActivityRegistered. - (void)webState:(web::WebState*)webState @@ -116,7 +117,8 @@ void DidSuppressDialog(web::WebState* web_state) override; void DocumentSubmitted(web::WebState* web_state, const std::string& form_name, - bool user_initiated) override; + bool user_initiated, + bool is_main_frame) override; void FormActivityRegistered(web::WebState* web_state, const FormActivityParams& params) override; void FaviconUrlUpdated(web::WebState* web_state,
diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm index 0ac5056..b9f7566e 100644 --- a/ios/web/web_state/ui/crw_web_controller.mm +++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -2467,7 +2467,8 @@ // is visible. BOOL submittedByUser = [context[kUserIsInteractingKey] boolValue] || [_webViewProxy keyboardAccessory]; - _webStateImpl->OnDocumentSubmitted(formName, submittedByUser); + _webStateImpl->OnDocumentSubmitted(formName, submittedByUser, + [context[kIsMainFrame] boolValue]); return YES; } @@ -2482,6 +2483,8 @@ params.input_missing = true; } + params.is_main_frame = [context[kIsMainFrame] boolValue]; + _webStateImpl->OnFormActivityRegistered(params); return YES; }
diff --git a/ios/web/web_state/web_state_impl.h b/ios/web/web_state/web_state_impl.h index b654261a..db916fa8 100644 --- a/ios/web/web_state/web_state_impl.h +++ b/ios/web/web_state/web_state_impl.h
@@ -106,7 +106,9 @@ void OnPageLoaded(const GURL& url, bool load_success); // Called on form submission. - void OnDocumentSubmitted(const std::string& form_name, bool user_initiated); + void OnDocumentSubmitted(const std::string& form_name, + bool user_initiated, + bool is_main_frame); // Called when form activity is registered. void OnFormActivityRegistered(const FormActivityParams& params);
diff --git a/ios/web/web_state/web_state_impl.mm b/ios/web/web_state/web_state_impl.mm index a5eb6069..2e142de0 100644 --- a/ios/web/web_state/web_state_impl.mm +++ b/ios/web/web_state/web_state_impl.mm
@@ -267,9 +267,10 @@ } void WebStateImpl::OnDocumentSubmitted(const std::string& form_name, - bool user_initiated) { + bool user_initiated, + bool is_main_frame) { for (auto& observer : observers_) - observer.DocumentSubmitted(this, form_name, user_initiated); + observer.DocumentSubmitted(this, form_name, user_initiated, is_main_frame); } NavigationManagerImpl& WebStateImpl::GetNavigationManagerImpl() {
diff --git a/ios/web/web_state/web_state_impl_unittest.mm b/ios/web/web_state/web_state_impl_unittest.mm index 61324ab0..fef4bc4 100644 --- a/ios/web/web_state/web_state_impl_unittest.mm +++ b/ios/web/web_state/web_state_impl_unittest.mm
@@ -316,12 +316,14 @@ // Test that DocumentSubmitted() is called. ASSERT_FALSE(observer->submit_document_info()); const std::string kTestFormName("form-name"); - BOOL user_initiated = true; - web_state_->OnDocumentSubmitted(kTestFormName, user_initiated); + bool user_initiated = true; + bool is_main_frame = false; + web_state_->OnDocumentSubmitted(kTestFormName, user_initiated, is_main_frame); ASSERT_TRUE(observer->submit_document_info()); EXPECT_EQ(web_state_.get(), observer->submit_document_info()->web_state); EXPECT_EQ(kTestFormName, observer->submit_document_info()->form_name); EXPECT_EQ(user_initiated, observer->submit_document_info()->user_initiated); + EXPECT_EQ(is_main_frame, observer->submit_document_info()->is_main_frame); // Test that FormActivityRegistered() is called. ASSERT_FALSE(observer->form_activity_info()); @@ -332,6 +334,7 @@ params.type = "type"; params.value = "value"; params.input_missing = true; + params.is_main_frame = false; web_state_->OnFormActivityRegistered(params); ASSERT_TRUE(observer->form_activity_info()); EXPECT_EQ(web_state_.get(), observer->form_activity_info()->web_state); @@ -344,6 +347,7 @@ EXPECT_EQ(params.type, observer->form_activity_info()->form_activity.type); EXPECT_EQ(params.value, observer->form_activity_info()->form_activity.value); EXPECT_TRUE(observer->form_activity_info()->form_activity.input_missing); + EXPECT_FALSE(observer->form_activity_info()->form_activity.is_main_frame); // Test that FaviconUrlUpdated() is called. ASSERT_FALSE(observer->update_favicon_url_candidates_info());
diff --git a/ios/web/web_state/web_state_observer_bridge.mm b/ios/web/web_state/web_state_observer_bridge.mm index f1e61d8..61ef498 100644 --- a/ios/web/web_state/web_state_observer_bridge.mm +++ b/ios/web/web_state/web_state_observer_bridge.mm
@@ -126,13 +126,15 @@ void WebStateObserverBridge::DocumentSubmitted(web::WebState* web_state, const std::string& form_name, - bool user_initiated) { - SEL selector = - @selector(webState:didSubmitDocumentWithFormNamed:userInitiated:); + bool user_initiated, + bool is_main_frame) { + SEL selector = @selector + (webState:didSubmitDocumentWithFormNamed:userInitiated:isMainFrame:); if ([observer_ respondsToSelector:selector]) { [observer_ webState:web_state didSubmitDocumentWithFormNamed:form_name - userInitiated:user_initiated]; + userInitiated:user_initiated + isMainFrame:is_main_frame]; } }
diff --git a/ios/web/web_state/web_state_observer_bridge_unittest.mm b/ios/web/web_state/web_state_observer_bridge_unittest.mm index 61b9e49..8c98381c 100644 --- a/ios/web/web_state/web_state_observer_bridge_unittest.mm +++ b/ios/web/web_state/web_state_observer_bridge_unittest.mm
@@ -216,13 +216,15 @@ ASSERT_FALSE([observer_ submitDocumentInfo]); std::string kTestFormName("form-name"); - BOOL user_initiated = YES; + bool user_initiated = true; + bool is_main_frame = true; observer_bridge_.DocumentSubmitted(&test_web_state_, kTestFormName, - user_initiated); + user_initiated, is_main_frame); ASSERT_TRUE([observer_ submitDocumentInfo]); EXPECT_EQ(&test_web_state_, [observer_ submitDocumentInfo]->web_state); EXPECT_EQ(kTestFormName, [observer_ submitDocumentInfo]->form_name); EXPECT_EQ(user_initiated, [observer_ submitDocumentInfo]->user_initiated); + EXPECT_EQ(is_main_frame, [observer_ submitDocumentInfo]->is_main_frame); } // Tests |webState:didRegisterFormActivity:...| forwarding.
diff --git a/ios/web_view/internal/autofill/cwv_autofill_controller.mm b/ios/web_view/internal/autofill/cwv_autofill_controller.mm index 3f0a422..fd8094a 100644 --- a/ios/web_view/internal/autofill/cwv_autofill_controller.mm +++ b/ios/web_view/internal/autofill/cwv_autofill_controller.mm
@@ -163,6 +163,7 @@ fieldType:@"" type:nil typedValue:@" " + isMainFrame:YES webState:_webState completionHandler:availableHandler]; } @@ -290,12 +291,15 @@ - (void)webState:(web::WebState*)webState didSubmitDocumentWithFormNamed:(const std::string&)formName - userInitiated:(BOOL)userInitiated { + userInitiated:(BOOL)userInitiated + isMainFrame:(BOOL)isMainFrame { if ([_delegate respondsToSelector:@selector - (autofillController:didSubmitFormWithName:userInitiated:)]) { + (autofillController:didSubmitFormWithName:userInitiated + :isMainFrame:)]) { [_delegate autofillController:self didSubmitFormWithName:base::SysUTF8ToNSString(formName) - userInitiated:userInitiated]; + userInitiated:userInitiated + isMainFrame:isMainFrame]; } }
diff --git a/ios/web_view/internal/autofill/cwv_autofill_controller_unittest.mm b/ios/web_view/internal/autofill/cwv_autofill_controller_unittest.mm index 35dbaab6..cbbb468 100644 --- a/ios/web_view/internal/autofill/cwv_autofill_controller_unittest.mm +++ b/ios/web_view/internal/autofill/cwv_autofill_controller_unittest.mm
@@ -228,17 +228,21 @@ @autoreleasepool { [[delegate expect] autofillController:autofill_controller_ didSubmitFormWithName:kTestFormName - userInitiated:YES]; + userInitiated:YES + isMainFrame:YES]; web_state_.OnDocumentSubmitted(base::SysNSStringToUTF8(kTestFormName), - /*user_initiated=*/true); + /*user_initiated=*/true, + /*is_main_frame=*/true); [[delegate expect] autofillController:autofill_controller_ didSubmitFormWithName:kTestFormName - userInitiated:NO]; + userInitiated:NO + isMainFrame:YES]; web_state_.OnDocumentSubmitted(base::SysNSStringToUTF8(kTestFormName), - /*user_initiated=*/false); + /*user_initiated=*/false, + /*is_main_frame=*/true); [delegate verify]; }
diff --git a/ios/web_view/internal/cwv_web_view_configuration.mm b/ios/web_view/internal/cwv_web_view_configuration.mm index ec66f98..c788837c 100644 --- a/ios/web_view/internal/cwv_web_view_configuration.mm +++ b/ios/web_view/internal/cwv_web_view_configuration.mm
@@ -39,12 +39,14 @@ @synthesize preferences = _preferences; @synthesize userContentController = _userContentController; -static CWVWebViewConfiguration* defaultConfiguration; -static CWVWebViewConfiguration* incognitoConfiguration; +namespace { +CWVWebViewConfiguration* gDefaultConfiguration = nil; +CWVWebViewConfiguration* gIncognitoConfiguration = nil; +} // namespace + (void)shutDown { - [defaultConfiguration shutDown]; - [incognitoConfiguration shutDown]; + [gDefaultConfiguration shutDown]; + [gIncognitoConfiguration shutDown]; } + (instancetype)defaultConfiguration { @@ -52,10 +54,10 @@ dispatch_once(&onceToken, ^{ auto browserState = base::MakeUnique<ios_web_view::WebViewBrowserState>(false); - defaultConfiguration = [[CWVWebViewConfiguration alloc] + gDefaultConfiguration = [[CWVWebViewConfiguration alloc] initWithBrowserState:std::move(browserState)]; }); - return defaultConfiguration; + return gDefaultConfiguration; } + (instancetype)incognitoConfiguration { @@ -63,10 +65,10 @@ dispatch_once(&onceToken, ^{ auto browserState = base::MakeUnique<ios_web_view::WebViewBrowserState>(true); - incognitoConfiguration = [[CWVWebViewConfiguration alloc] + gIncognitoConfiguration = [[CWVWebViewConfiguration alloc] initWithBrowserState:std::move(browserState)]; }); - return incognitoConfiguration; + return gIncognitoConfiguration; } + (void)initialize {
diff --git a/ios/web_view/public/cwv_autofill_controller_delegate.h b/ios/web_view/public/cwv_autofill_controller_delegate.h index ebaa006..ac8a316 100644 --- a/ios/web_view/public/cwv_autofill_controller_delegate.h +++ b/ios/web_view/public/cwv_autofill_controller_delegate.h
@@ -49,7 +49,8 @@ // as a result of user interaction. - (void)autofillController:(CWVAutofillController*)autofillController didSubmitFormWithName:(NSString*)formName - userInitiated:(BOOL)userInitiated; + userInitiated:(BOOL)userInitiated + isMainFrame:(BOOL)isMainFrame; @end
diff --git a/media/audio/audio_system.h b/media/audio/audio_system.h index 406b23c7..aa44af4 100644 --- a/media/audio/audio_system.h +++ b/media/audio/audio_system.h
@@ -33,7 +33,6 @@ base::OnceCallback<void(const base::Optional<AudioParameters>&)>; using OnInputDeviceInfoCallback = base::OnceCallback<void(const base::Optional<AudioParameters>&, - const base::Optional<AudioParameters>&, const std::string&)>; using OnBoolCallback = base::OnceCallback<void(bool)>;
diff --git a/media/audio/audio_system_helper.cc b/media/audio/audio_system_helper.cc index 771fc36..de297b6 100644 --- a/media/audio/audio_system_helper.cc +++ b/media/audio/audio_system_helper.cc
@@ -93,9 +93,6 @@ std::move(on_input_device_info_cb) .Run(ComputeInputParameters(input_device_id), - associated_output_device_id.empty() - ? base::Optional<AudioParameters>() - : ComputeOutputParameters(associated_output_device_id), associated_output_device_id); }
diff --git a/media/audio/audio_system_test_util.cc b/media/audio/audio_system_test_util.cc index 89a3625..4f57c50 100644 --- a/media/audio/audio_system_test_util.cc +++ b/media/audio/audio_system_test_util.cc
@@ -49,12 +49,10 @@ const base::Location& location, base::OnceClosure on_cb_received, const base::Optional<AudioParameters>& expected_input, - const base::Optional<AudioParameters>& expected_associated_output, const std::string& expected_associated_device_id) { return base::BindOnce(&AudioSystemCallbackExpectations::OnInputDeviceInfo, base::Unretained(this), location.ToString(), std::move(on_cb_received), expected_input, - expected_associated_output, expected_associated_device_id); } @@ -108,10 +106,8 @@ const std::string& from_here, base::OnceClosure on_cb_received, const base::Optional<AudioParameters>& expected_input, - const base::Optional<AudioParameters>& expected_associated_output, const std::string& expected_associated_device_id, const base::Optional<AudioParameters>& input, - const base::Optional<AudioParameters>& associated_output, const std::string& associated_device_id) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_) << from_here; if (expected_input) { @@ -122,14 +118,6 @@ } else { EXPECT_FALSE(input) << from_here; } - if (expected_associated_output) { - EXPECT_TRUE(associated_output) << from_here; - EXPECT_EQ(expected_associated_output->AsHumanReadableString(), - associated_output->AsHumanReadableString()) - << from_here; - } else { - EXPECT_FALSE(associated_output) << from_here; - } EXPECT_EQ(expected_associated_device_id, associated_device_id) << from_here; std::move(on_cb_received).Run(); }
diff --git a/media/audio/audio_system_test_util.h b/media/audio/audio_system_test_util.h index 1f20388..6966f1f1 100644 --- a/media/audio/audio_system_test_util.h +++ b/media/audio/audio_system_test_util.h
@@ -47,7 +47,6 @@ const base::Location& location, base::OnceClosure on_cb_received, const base::Optional<AudioParameters>& expected_input, - const base::Optional<AudioParameters>& expected_associated_output, const std::string& expected_associated_device_id); AudioSystem::OnDeviceIdCallback GetDeviceIdCallback( @@ -77,10 +76,8 @@ const std::string& from_here, base::OnceClosure on_cb_received, const base::Optional<AudioParameters>& expected_input, - const base::Optional<AudioParameters>& expected_associated_output, const std::string& expected_associated_device_id, const base::Optional<AudioParameters>& input, - const base::Optional<AudioParameters>& associated_output, const std::string& associated_device_id); void OnDeviceId(const std::string& from_here, @@ -322,10 +319,9 @@ TYPED_TEST_P(AudioSystemTestTemplate, GetInputDeviceInfoNoAssociation) { base::RunLoop wait_loop; this->audio_system()->GetInputDeviceInfo( - "non-default-device-id", - this->expectations_.GetInputDeviceInfoCallback( - FROM_HERE, wait_loop.QuitClosure(), this->input_params_, - base::Optional<AudioParameters>(), std::string())); + "non-default-device-id", this->expectations_.GetInputDeviceInfoCallback( + FROM_HERE, wait_loop.QuitClosure(), + this->input_params_, std::string())); wait_loop.Run(); } @@ -338,10 +334,9 @@ base::RunLoop wait_loop; this->audio_system()->GetInputDeviceInfo( - "non-default-device-id", - this->expectations_.GetInputDeviceInfoCallback( - FROM_HERE, wait_loop.QuitClosure(), this->input_params_, - this->output_params_, associated_id)); + "non-default-device-id", this->expectations_.GetInputDeviceInfoCallback( + FROM_HERE, wait_loop.QuitClosure(), + this->input_params_, associated_id)); wait_loop.Run(); }
diff --git a/media/base/android/java/src/org/chromium/media/CodecProfileLevelList.java b/media/base/android/java/src/org/chromium/media/CodecProfileLevelList.java index dfa8ab2..a287435 100644 --- a/media/base/android/java/src/org/chromium/media/CodecProfileLevelList.java +++ b/media/base/android/java/src/org/chromium/media/CodecProfileLevelList.java
@@ -10,7 +10,7 @@ import org.chromium.base.annotations.JNINamespace; import org.chromium.base.annotations.MainDex; -import java.util.LinkedList; +import java.util.ArrayList; import java.util.List; @JNINamespace("media") @@ -21,7 +21,7 @@ private final List<CodecProfileLevelAdapter> mList; public CodecProfileLevelList() { - mList = new LinkedList<CodecProfileLevelAdapter>(); + mList = new ArrayList<CodecProfileLevelAdapter>(); } public boolean addCodecProfileLevel(String mime, CodecProfileLevel codecProfileLevel) {
diff --git a/media/blink/video_decode_stats_reporter.cc b/media/blink/video_decode_stats_reporter.cc index 8c8f2f8..9d445a7 100644 --- a/media/blink/video_decode_stats_reporter.cc +++ b/media/blink/video_decode_stats_reporter.cc
@@ -17,6 +17,7 @@ mojom::VideoDecodeStatsRecorderPtr recorder_ptr, GetPipelineStatsCB get_pipeline_stats_cb, const VideoDecoderConfig& video_config, + scoped_refptr<base::SingleThreadTaskRunner> task_runner, base::TickClock* tick_clock) : kRecordingInterval( base::TimeDelta::FromMilliseconds(kRecordingIntervalMs)), @@ -34,6 +35,7 @@ recorder_ptr_.set_connection_error_handler(base::BindRepeating( &VideoDecodeStatsReporter::OnIpcConnectionError, base::Unretained(this))); + stats_cb_timer_.SetTaskRunner(task_runner); } VideoDecodeStatsReporter::~VideoDecodeStatsReporter() = default;
diff --git a/media/blink/video_decode_stats_reporter.h b/media/blink/video_decode_stats_reporter.h index 6f100fcb..ac3d126 100644 --- a/media/blink/video_decode_stats_reporter.h +++ b/media/blink/video_decode_stats_reporter.h
@@ -32,6 +32,7 @@ mojom::VideoDecodeStatsRecorderPtr recorder_ptr, GetPipelineStatsCB get_pipeline_stats_cb, const VideoDecoderConfig& video_config, + scoped_refptr<base::SingleThreadTaskRunner> task_runner, base::TickClock* tick_clock = base::DefaultTickClock::GetInstance()); ~VideoDecodeStatsReporter();
diff --git a/media/blink/video_decode_stats_reporter_unittest.cc b/media/blink/video_decode_stats_reporter_unittest.cc index 321f7e7..abb71a7 100644 --- a/media/blink/video_decode_stats_reporter_unittest.cc +++ b/media/blink/video_decode_stats_reporter_unittest.cc
@@ -67,9 +67,6 @@ RecordInterceptor() = default; ~RecordInterceptor() override = default; - MOCK_METHOD2(SetPageInfo, - void(const url::Origin& top_frame_origin, bool is_top_frame)); - MOCK_METHOD3(StartNewRecord, void(VideoCodecProfile profile, const gfx::Size& natural_size, @@ -173,7 +170,8 @@ std::move(recorder_ptr), base::Bind(&VideoDecodeStatsReporterTest::GetPipelineStatsCB, base::Unretained(this)), - MakeDefaultVideoConfig(), clock_.get()); + MakeDefaultVideoConfig(), base::ThreadTaskRunnerHandle::Get(), + clock_.get()); } // Fast forward the task runner (and associated tick clock) by |milliseconds|.
diff --git a/media/blink/watch_time_reporter.cc b/media/blink/watch_time_reporter.cc index 97b782f..070034d 100644 --- a/media/blink/watch_time_reporter.cc +++ b/media/blink/watch_time_reporter.cc
@@ -20,7 +20,7 @@ WatchTimeReporter::WatchTimeReporter(mojom::PlaybackPropertiesPtr properties, GetMediaTimeCB get_media_time_cb, - mojom::WatchTimeRecorderProvider* provider) + mojom::MediaMetricsProvider* provider) : WatchTimeReporter(std::move(properties), false /* is_background */, std::move(get_media_time_cb), @@ -29,7 +29,7 @@ WatchTimeReporter::WatchTimeReporter(mojom::PlaybackPropertiesPtr properties, bool is_background, GetMediaTimeCB get_media_time_cb, - mojom::WatchTimeRecorderProvider* provider) + mojom::MediaMetricsProvider* provider) : properties_(std::move(properties)), is_background_(is_background), get_media_time_cb_(std::move(get_media_time_cb)) {
diff --git a/media/blink/watch_time_reporter.h b/media/blink/watch_time_reporter.h index 08edf85..1a37ceb 100644 --- a/media/blink/watch_time_reporter.h +++ b/media/blink/watch_time_reporter.h
@@ -16,6 +16,7 @@ #include "media/base/timestamp_constants.h" #include "media/base/video_codecs.h" #include "media/blink/media_blink_export.h" +#include "media/mojo/interfaces/media_metrics_provider.mojom.h" #include "media/mojo/interfaces/watch_time_recorder.mojom.h" #include "third_party/WebKit/public/platform/WebMediaPlayer.h" #include "ui/gfx/geometry/size.h" @@ -73,7 +74,7 @@ // the elapsed media time instead? WatchTimeReporter(mojom::PlaybackPropertiesPtr properties, GetMediaTimeCB get_media_time_cb, - mojom::WatchTimeRecorderProvider* provider); + mojom::MediaMetricsProvider* provider); ~WatchTimeReporter() override; // These methods are used to ensure that watch time is only reported for media @@ -143,7 +144,7 @@ WatchTimeReporter(mojom::PlaybackPropertiesPtr properties, bool is_background, GetMediaTimeCB get_media_time_cb, - mojom::WatchTimeRecorderProvider* provider); + mojom::MediaMetricsProvider* provider); // base::PowerObserver implementation. //
diff --git a/media/blink/watch_time_reporter_unittest.cc b/media/blink/watch_time_reporter_unittest.cc index bd9d279..f241221 100644 --- a/media/blink/watch_time_reporter_unittest.cc +++ b/media/blink/watch_time_reporter_unittest.cc
@@ -12,6 +12,7 @@ #include "media/base/mock_media_log.h" #include "media/base/watch_time_keys.h" #include "media/blink/watch_time_reporter.h" +#include "media/mojo/interfaces/media_metrics_provider.mojom.h" #include "media/mojo/interfaces/watch_time_recorder.mojom.h" #include "mojo/public/cpp/bindings/strong_binding.h" #include "testing/gmock/include/gmock/gmock.h" @@ -79,19 +80,11 @@ using WatchTimeReporterTestData = std::tuple<bool, bool>; class WatchTimeReporterTest - : public testing::TestWithParam<WatchTimeReporterTestData>, - public mojom::WatchTimeRecorderProvider { + : public testing::TestWithParam<WatchTimeReporterTestData> { public: - WatchTimeReporterTest() - : has_video_(std::get<0>(GetParam())), - has_audio_(std::get<1>(GetParam())) {} - ~WatchTimeReporterTest() override = default; - - protected: class WatchTimeInterceptor : public mojom::WatchTimeRecorder { public: WatchTimeInterceptor(WatchTimeReporterTest* parent) : parent_(parent) {} - ~WatchTimeInterceptor() override = default; // mojom::WatchTimeRecorder implementation: @@ -189,14 +182,39 @@ DISALLOW_COPY_AND_ASSIGN(WatchTimeInterceptor); }; - // mojom::WatchTimeRecorderProvider implementation: - void AcquireWatchTimeRecorder( - mojom::PlaybackPropertiesPtr properties, - mojom::WatchTimeRecorderRequest request) override { - mojo::MakeStrongBinding(base::MakeUnique<WatchTimeInterceptor>(this), - std::move(request)); - } + class FakeMediaMetricsProvider : public mojom::MediaMetricsProvider { + public: + explicit FakeMediaMetricsProvider(WatchTimeReporterTest* parent) + : parent_(parent) {} + ~FakeMediaMetricsProvider() override {} + // mojom::WatchTimeRecorderProvider implementation: + void AcquireWatchTimeRecorder( + mojom::PlaybackPropertiesPtr properties, + mojom::WatchTimeRecorderRequest request) override { + mojo::MakeStrongBinding(base::MakeUnique<WatchTimeInterceptor>(parent_), + std::move(request)); + } + void AcquireVideoDecodeStatsRecorder( + mojom::VideoDecodeStatsRecorderRequest request) override { + FAIL(); + } + void Initialize(bool is_mse, + bool is_top_frame, + const url::Origin& untrusted_top_origin) override {} + void OnError(PipelineStatus status) override {} + + private: + WatchTimeReporterTest* parent_; + }; + + WatchTimeReporterTest() + : has_video_(std::get<0>(GetParam())), + has_audio_(std::get<1>(GetParam())), + fake_metrics_provider_(this) {} + ~WatchTimeReporterTest() override = default; + + protected: void Initialize(bool is_mse, bool is_encrypted, const gfx::Size& initial_video_size) { @@ -206,11 +224,10 @@ wtr_.reset(new WatchTimeReporter( mojom::PlaybackProperties::New(kUnknownAudioCodec, kUnknownVideoCodec, has_audio_, has_video_, false, is_mse, - is_encrypted, false, initial_video_size, - url::Origin(), true /* is_top_frame */), + is_encrypted, false, initial_video_size), base::Bind(&WatchTimeReporterTest::GetCurrentMediaTime, base::Unretained(this)), - this)); + &fake_metrics_provider_)); // Setup the reporting interval to be immediate to avoid spinning real time // within the unit test. @@ -506,6 +523,7 @@ const bool has_video_; const bool has_audio_; + FakeMediaMetricsProvider fake_metrics_provider_; base::TestMessageLoop message_loop_; std::unique_ptr<WatchTimeReporter> wtr_;
diff --git a/media/blink/webmediaplayer_impl.cc b/media/blink/webmediaplayer_impl.cc index 374ea4d..ba96ebc 100644 --- a/media/blink/webmediaplayer_impl.cc +++ b/media/blink/webmediaplayer_impl.cc
@@ -242,9 +242,7 @@ base::FeatureList::IsEnabled(media::kUseSurfaceLayerForVideo)), request_routing_token_cb_(params->request_routing_token_cb()), overlay_routing_token_(OverlayInfo::RoutingToken()), - watch_time_recorder_provider_(params->watch_time_recorder_provider()), - create_decode_stats_recorder_cb_( - params->create_capabilities_recorder_cb()) { + media_metrics_provider_(params->take_metrics_provider()) { DVLOG(1) << __func__; DCHECK(!adjust_allocated_memory_cb_.is_null()); DCHECK(renderer_factory_selector_); @@ -529,6 +527,13 @@ SetReadyState(WebMediaPlayer::kReadyStateHaveNothing); media_log_->AddEvent(media_log_->CreateLoadEvent(url.GetString().Utf8())); + // URL is used for UKM reporting. Privacy requires we only report origin of + // the top frame. |is_top_frame| signals how to interpret the origin. + // TODO(crbug.com/787209): Stop getting origin from the renderer. + media_metrics_provider_->Initialize(load_type == kLoadTypeMediaSource, + frame_ == frame_->Top(), + frame_->Top()->GetSecurityOrigin()); + // Media source pipelines can start immediately. if (load_type == kLoadTypeMediaSource) { StartPipeline(); @@ -1410,6 +1415,7 @@ ReportPipelineError(load_type_, status, media_log_.get()); media_log_->AddEvent(media_log_->CreatePipelineErrorEvent(status)); + media_metrics_provider_->OnError(status); if (watch_time_reporter_) watch_time_reporter_->OnError(status); @@ -1509,24 +1515,17 @@ if (is_encrypted_) return; - // Setup the recorder Mojo service. - mojom::VideoDecodeStatsRecorderPtr recorder = - create_decode_stats_recorder_cb_.Run(); - - // Origin is used for UKM reporting (not saved to VideoDecodeStatsDB). Privacy - // requires we only report origin of the top frame. |is_top_frame| signals how - // to interpret the origin. - // TODO(crbug.com/787209): Stop getting origin from the renderer. - bool is_top_frame = frame_ == frame_->Top(); - url::Origin top_origin(frame_->Top()->GetSecurityOrigin()); - recorder->SetPageInfo(top_origin, is_top_frame); + mojom::VideoDecodeStatsRecorderPtr recorder; + media_metrics_provider_->AcquireVideoDecodeStatsRecorder( + mojo::MakeRequest(&recorder)); // Create capabilities reporter and synchronize its initial state. video_decode_stats_reporter_.reset(new VideoDecodeStatsReporter( std::move(recorder), base::Bind(&WebMediaPlayerImpl::GetPipelineStatistics, base::Unretained(this)), - pipeline_metadata_.video_decoder_config)); + pipeline_metadata_.video_decoder_config, + frame_->GetTaskRunner(blink::TaskType::kUnthrottled))); if (delegate_->IsFrameHidden()) video_decode_stats_reporter_->OnHidden(); @@ -1979,6 +1978,7 @@ if (!success) { SetNetworkState(WebMediaPlayer::kNetworkStateFormatError); + media_metrics_provider_->OnError(PIPELINE_ERROR_NETWORK); // Not really necessary, since the pipeline was never started, but it at // least this makes sure that the error handling code is in sync. @@ -2557,12 +2557,6 @@ if (!HasVideo() && !HasAudio()) return; - // URL is used for UKM reporting. Privacy requires we only report origin of - // the top frame. |is_top_frame| signals how to interpret the origin. - // TODO(crbug.com/787209): Stop getting origin from the renderer. - bool is_top_frame = frame_ == frame_->Top(); - url::Origin top_origin(frame_->Top()->GetSecurityOrigin()); - // Create the watch time reporter and synchronize its initial state. watch_time_reporter_.reset(new WatchTimeReporter( mojom::PlaybackProperties::New( @@ -2570,10 +2564,10 @@ pipeline_metadata_.video_decoder_config.codec(), pipeline_metadata_.has_audio, pipeline_metadata_.has_video, false, !!chunk_demuxer_, is_encrypted_, embedded_media_experience_enabled_, - pipeline_metadata_.natural_size, top_origin, is_top_frame), + pipeline_metadata_.natural_size), base::BindRepeating(&WebMediaPlayerImpl::GetCurrentTimeInternal, base::Unretained(this)), - watch_time_recorder_provider_)); + media_metrics_provider_.get())); watch_time_reporter_->OnVolumeChange(volume_); if (delegate_->IsFrameHidden())
diff --git a/media/blink/webmediaplayer_impl.h b/media/blink/webmediaplayer_impl.h index b8eda0d..607d5876 100644 --- a/media/blink/webmediaplayer_impl.h +++ b/media/blink/webmediaplayer_impl.h
@@ -40,7 +40,6 @@ #include "media/blink/webmediaplayer_params.h" #include "media/blink/webmediaplayer_util.h" #include "media/filters/pipeline_controller.h" -#include "media/mojo/interfaces/video_decode_stats_recorder.mojom.h" #include "media/renderers/paint_canvas_video_renderer.h" #include "third_party/WebKit/public/platform/WebAudioSourceProvider.h" #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" @@ -837,7 +836,7 @@ base::CancelableClosure update_background_status_cb_; - mojom::WatchTimeRecorderProvider* watch_time_recorder_provider_; + mojom::MediaMetricsProviderPtr media_metrics_provider_; base::Callback<mojom::VideoDecodeStatsRecorderPtr()> create_decode_stats_recorder_cb_;
diff --git a/media/blink/webmediaplayer_impl_unittest.cc b/media/blink/webmediaplayer_impl_unittest.cc index 13ee081..55ba120 100644 --- a/media/blink/webmediaplayer_impl_unittest.cc +++ b/media/blink/webmediaplayer_impl_unittest.cc
@@ -29,6 +29,7 @@ #include "media/base/test_helpers.h" #include "media/blink/webmediaplayer_delegate.h" #include "media/blink/webmediaplayer_params.h" +#include "media/mojo/services/media_metrics_provider.h" #include "media/mojo/services/video_decode_stats_recorder.h" #include "media/mojo/services/watch_time_recorder.h" #include "media/renderers/default_renderer_factory.h" @@ -76,25 +77,6 @@ std::string(new_rate_string)); } -class FakeVideoDecodeStatsRecorder : public mojom::VideoDecodeStatsRecorder { - public: - void SetPageInfo(const url::Origin& top_frame_origin, - bool is_top_frame) override {} - void StartNewRecord(VideoCodecProfile profile, - const gfx::Size& natural_size, - int frames_per_sec) override {} - void UpdateRecord(uint32_t frames_decoded, - uint32_t frames_dropped, - uint32_t frames_decoded_power_efficient) override {} -}; - -mojom::VideoDecodeStatsRecorderPtr CreateCapabilitiesRecorder() { - mojom::VideoDecodeStatsRecorderPtr recorder; - mojo::MakeStrongBinding(std::make_unique<FakeVideoDecodeStatsRecorder>(), - mojo::MakeRequest(&recorder)); - return recorder; -} - class DummyWebMediaPlayerClient : public blink::WebMediaPlayerClient { public: DummyWebMediaPlayerClient() = default; @@ -307,8 +289,13 @@ factory_selector->SetBaseFactoryType( RendererFactorySelector::FactoryType::DEFAULT); - WatchTimeRecorder::CreateWatchTimeRecorderProvider( - mojo::MakeRequest(&provider_)); + mojom::MediaMetricsProviderPtr provider; + MediaMetricsProvider::Create(nullptr, mojo::MakeRequest(&provider)); + + // Initialize provider since none of the tests below actually go through the + // full loading/pipeline initialize phase. If this ever changes the provider + // will start DCHECK failing. + provider->Initialize(false, false, url::Origin()); auto params = base::MakeUnique<WebMediaPlayerParams>( std::move(media_log), WebMediaPlayerParams::DeferLoadCB(), @@ -319,7 +306,7 @@ RequestRoutingTokenCallback(), nullptr, kMaxKeyframeDistanceToDisableBackgroundVideo, kMaxKeyframeDistanceToDisableBackgroundVideoMSE, false, false, - provider_.get(), base::Bind(&CreateCapabilitiesRecorder), + std::move(provider), base::Bind(&WebMediaPlayerImplTest::CreateMockSurfaceLayerBridge, base::Unretained(this)), cc::TestContextProvider::Create()); @@ -524,8 +511,6 @@ NiceMock<MockWebMediaPlayerDelegate> delegate_; - mojom::WatchTimeRecorderProviderPtr provider_; - std::unique_ptr<StrictMock<MockSurfaceLayerBridge>> surface_layer_bridge_; StrictMock<MockSurfaceLayerBridge>* surface_layer_bridge_ptr_ = nullptr;
diff --git a/media/blink/webmediaplayer_params.cc b/media/blink/webmediaplayer_params.cc index 427b3b2..ea8f342d 100644 --- a/media/blink/webmediaplayer_params.cc +++ b/media/blink/webmediaplayer_params.cc
@@ -28,8 +28,7 @@ base::TimeDelta max_keyframe_distance_to_disable_background_video_mse, bool enable_instant_source_buffer_gc, bool embedded_media_experience_enabled, - mojom::WatchTimeRecorderProvider* provider, - CreateCapabilitiesRecorderCB create_capabilities_recorder_cb, + mojom::MediaMetricsProviderPtr metrics_provider, base::Callback<std::unique_ptr<blink::WebSurfaceLayerBridge>( blink::WebSurfaceLayerBridgeObserver*)> create_bridge_callback, scoped_refptr<viz::ContextProvider> context_provider) @@ -51,9 +50,7 @@ max_keyframe_distance_to_disable_background_video_mse), enable_instant_source_buffer_gc_(enable_instant_source_buffer_gc), embedded_media_experience_enabled_(embedded_media_experience_enabled), - watch_time_recorder_provider_(provider), - create_capabilities_recorder_cb_( - std::move(create_capabilities_recorder_cb)), + metrics_provider_(std::move(metrics_provider)), create_bridge_callback_(create_bridge_callback), context_provider_(std::move(context_provider)) {}
diff --git a/media/blink/webmediaplayer_params.h b/media/blink/webmediaplayer_params.h index 0231707..1256f638 100644 --- a/media/blink/webmediaplayer_params.h +++ b/media/blink/webmediaplayer_params.h
@@ -20,7 +20,7 @@ #include "media/base/routing_token_callback.h" #include "media/blink/media_blink_export.h" #include "media/filters/context_3d.h" -#include "media/mojo/interfaces/video_decode_stats_recorder.mojom.h" +#include "media/mojo/interfaces/media_metrics_provider.mojom.h" #include "third_party/WebKit/public/platform/WebVideoFrameSubmitter.h" namespace base { @@ -39,18 +39,12 @@ class SwitchableAudioRendererSink; class SurfaceManager; -namespace mojom { -class WatchTimeRecorderProvider; -} - // Holds parameters for constructing WebMediaPlayerImpl without having // to plumb arguments through various abstraction layers. class MEDIA_BLINK_EXPORT WebMediaPlayerParams { public: typedef base::Callback<void(const base::Closure&)> DeferLoadCB; typedef base::Callback<Context3D()> Context3DCB; - typedef base::Callback<mojom::VideoDecodeStatsRecorderPtr()> - CreateCapabilitiesRecorderCB; // Callback to obtain the media ContextProvider. // Requires being called on the media thread. @@ -85,8 +79,7 @@ base::TimeDelta max_keyframe_distance_to_disable_background_video_mse, bool enable_instant_source_buffer_gc, bool embedded_media_experience_enabled, - mojom::WatchTimeRecorderProvider* provider, - CreateCapabilitiesRecorderCB create_capabilities_recorder_cb, + mojom::MediaMetricsProviderPtr metrics_provider, base::Callback<std::unique_ptr<blink::WebSurfaceLayerBridge>( blink::WebSurfaceLayerBridgeObserver*)> bridge_callback, scoped_refptr<viz::ContextProvider> context_provider); @@ -102,6 +95,10 @@ std::unique_ptr<MediaLog> take_media_log() { return std::move(media_log_); } + mojom::MediaMetricsProviderPtr take_metrics_provider() { + return std::move(metrics_provider_); + } + const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner() const { return media_task_runner_; } @@ -155,19 +152,11 @@ return request_routing_token_cb_; } - mojom::WatchTimeRecorderProvider* watch_time_recorder_provider() const { - return watch_time_recorder_provider_; - } - const base::Callback<std::unique_ptr<blink::WebSurfaceLayerBridge>( blink::WebSurfaceLayerBridgeObserver*)>& create_bridge_callback() const { return create_bridge_callback_; } - CreateCapabilitiesRecorderCB create_capabilities_recorder_cb() const { - return create_capabilities_recorder_cb_; - } - scoped_refptr<viz::ContextProvider> context_provider() { return context_provider_; } @@ -191,8 +180,7 @@ base::TimeDelta max_keyframe_distance_to_disable_background_video_mse_; bool enable_instant_source_buffer_gc_; const bool embedded_media_experience_enabled_; - mojom::WatchTimeRecorderProvider* watch_time_recorder_provider_; - CreateCapabilitiesRecorderCB create_capabilities_recorder_cb_; + mojom::MediaMetricsProviderPtr metrics_provider_; base::Callback<std::unique_ptr<blink::WebSurfaceLayerBridge>( blink::WebSurfaceLayerBridgeObserver*)> create_bridge_callback_;
diff --git a/media/filters/video_renderer_algorithm_unittest.cc b/media/filters/video_renderer_algorithm_unittest.cc index ea84d52..0209d74 100644 --- a/media/filters/video_renderer_algorithm_unittest.cc +++ b/media/filters/video_renderer_algorithm_unittest.cc
@@ -1362,38 +1362,39 @@ EXPECT_EQ(0u, EffectiveFramesQueued()); } -// Test runs too slowly on debug builds. -// TODO(fuchsia): Also runs too slowly on Fuchsia, this should be investigated, -// see https://crbug.com/767166. -#if defined(NDEBUG) && !defined(OS_FUCHSIA) -TEST_F(VideoRendererAlgorithmTest, CadenceBasedTest) { - // Common display rates. - const double kDisplayRates[] = { - NTSC(24), 24, NTSC(25), 25, NTSC(30), 30, 48, - NTSC(50), 50, NTSC(60), 60, 75, 120, 144, - }; +class VideoRendererAlgorithmCadenceTest + : public VideoRendererAlgorithmTest, + public ::testing::WithParamInterface<::testing::tuple<double, double>> {}; - // List of common frame rate values. Values pulled from local test media, - // videostack test matrix, and Wikipedia. - const double kTestRates[] = { - 1, 10, 12.5, 15, NTSC(24), 24, NTSC(25), 25, - NTSC(30), 30, 30.12, 48, NTSC(50), 50, 58.74, NTSC(60), - 60, 72, 90, 100, 120, 144, 240, 300, - }; +TEST_P(VideoRendererAlgorithmCadenceTest, CadenceTest) { + double display_rate = std::tr1::get<0>(GetParam()); + double frame_rate = std::tr1::get<1>(GetParam()); - for (double display_rate : kDisplayRates) { - for (double frame_rate : kTestRates) { - TickGenerator frame_tg(base::TimeTicks(), frame_rate); - TickGenerator display_tg(tick_clock_->NowTicks(), display_rate); - RunFramePumpTest( - true, &frame_tg, &display_tg, - [](const scoped_refptr<VideoFrame>& frame, size_t frames_dropped) {}); - if (HasFatalFailure()) - return; - } - } + TickGenerator frame_tg(base::TimeTicks(), frame_rate); + TickGenerator display_tg(tick_clock_->NowTicks(), display_rate); + RunFramePumpTest( + true, &frame_tg, &display_tg, + [](const scoped_refptr<VideoFrame>& frame, size_t frames_dropped) {}); } -#endif // defined(NDEBUG) && !defined(OS_FUCHSIA) + +// Common display rates. +const double kDisplayRates[] = { + NTSC(24), 24, NTSC(25), 25, NTSC(30), 30, 48, + NTSC(50), 50, NTSC(60), 60, 75, 120, 144, +}; + +// List of common frame rate values. Values pulled from local test media, +// videostack test matrix, and Wikipedia. +const double kTestRates[] = { + 1, 10, 12.5, 15, NTSC(24), 24, NTSC(25), 25, + NTSC(30), 30, 30.12, 48, NTSC(50), 50, 58.74, NTSC(60), + 60, 72, 90, 100, 120, 144, 240, 300, +}; + +INSTANTIATE_TEST_CASE_P(, + VideoRendererAlgorithmCadenceTest, + ::testing::Combine(::testing::ValuesIn(kDisplayRates), + ::testing::ValuesIn(kTestRates))); // Rotate through various playback rates and ensure algorithm adapts correctly. TEST_F(VideoRendererAlgorithmTest, VariablePlaybackRateCadence) {
diff --git a/media/gpu/dxva_video_decode_accelerator_win.cc b/media/gpu/dxva_video_decode_accelerator_win.cc index 10a7388d..bbc143f 100644 --- a/media/gpu/dxva_video_decode_accelerator_win.cc +++ b/media/gpu/dxva_video_decode_accelerator_win.cc
@@ -690,7 +690,7 @@ } RETURN_AND_NOTIFY_ON_FAILURE( - gl::g_driver_egl.ext.b_EGL_ANGLE_surface_d3d_texture_2d_share_handle, + gl::g_driver_egl->ext.b_EGL_ANGLE_surface_d3d_texture_2d_share_handle, "EGL_ANGLE_surface_d3d_texture_2d_share_handle unavailable", PLATFORM_FAILURE, false); @@ -1741,10 +1741,10 @@ use_dx11_ && gl::GLSurfaceEGL::HasEGLExtension("EGL_ANGLE_keyed_mutex"); if (!use_dx11_ || - !gl::g_driver_egl.ext.b_EGL_ANGLE_stream_producer_d3d_texture || - !gl::g_driver_egl.ext.b_EGL_KHR_stream || - !gl::g_driver_egl.ext.b_EGL_KHR_stream_consumer_gltexture || - !gl::g_driver_egl.ext.b_EGL_NV_stream_consumer_gltexture_yuv) { + !gl::g_driver_egl->ext.b_EGL_ANGLE_stream_producer_d3d_texture || + !gl::g_driver_egl->ext.b_EGL_KHR_stream || + !gl::g_driver_egl->ext.b_EGL_KHR_stream_consumer_gltexture || + !gl::g_driver_egl->ext.b_EGL_NV_stream_consumer_gltexture_yuv) { support_share_nv12_textures_ = false; support_copy_nv12_textures_ = false; }
diff --git a/media/gpu/v4l2/v4l2_slice_video_decode_accelerator.cc b/media/gpu/v4l2/v4l2_slice_video_decode_accelerator.cc index ca08a99..f6cd336c 100644 --- a/media/gpu/v4l2/v4l2_slice_video_decode_accelerator.cc +++ b/media/gpu/v4l2/v4l2_slice_video_decode_accelerator.cc
@@ -561,7 +561,7 @@ return false; } - if (!gl::g_driver_egl.ext.b_EGL_KHR_fence_sync) { + if (!gl::g_driver_egl->ext.b_EGL_KHR_fence_sync) { VLOGF(1) << "context does not have EGL_KHR_fence_sync"; return false; }
diff --git a/media/gpu/v4l2/v4l2_video_decode_accelerator.cc b/media/gpu/v4l2/v4l2_video_decode_accelerator.cc index 63a3d54..a561028 100644 --- a/media/gpu/v4l2/v4l2_video_decode_accelerator.cc +++ b/media/gpu/v4l2/v4l2_video_decode_accelerator.cc
@@ -237,7 +237,7 @@ // TODO(posciak): https://crbug.com/450898. #if defined(ARCH_CPU_ARMEL) - if (!gl::g_driver_egl.ext.b_EGL_KHR_fence_sync) { + if (!gl::g_driver_egl->ext.b_EGL_KHR_fence_sync) { LOGF(ERROR) << "context does not have EGL_KHR_fence_sync"; return false; }
diff --git a/media/media_options.gni b/media/media_options.gni index f1d54b01..e5ffcdda 100644 --- a/media/media_options.gni +++ b/media/media_options.gni
@@ -78,7 +78,7 @@ # which are encoded using HEVC require |enable_hevc_demuxing| to be enabled. enable_dolby_vision_demuxing = proprietary_codecs && is_chromecast - enable_webrtc = !is_cast_audio_only && !is_fuchsia + enable_webrtc = !is_cast_audio_only # Enable HLS with SAMPLE-AES decryption. enable_hls_sample_aes = proprietary_codecs && is_chromecast
diff --git a/media/mojo/interfaces/BUILD.gn b/media/mojo/interfaces/BUILD.gn index caf3906..6671d93 100644 --- a/media/mojo/interfaces/BUILD.gn +++ b/media/mojo/interfaces/BUILD.gn
@@ -18,6 +18,7 @@ "interface_factory.mojom", "jpeg_decode_accelerator.mojom", "media_log.mojom", + "media_metrics_provider.mojom", "media_types.mojom", "output_protection.mojom", "platform_verification.mojom",
diff --git a/media/mojo/interfaces/media_metrics_provider.mojom b/media/mojo/interfaces/media_metrics_provider.mojom new file mode 100644 index 0000000..c8d581e --- /dev/null +++ b/media/mojo/interfaces/media_metrics_provider.mojom
@@ -0,0 +1,40 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module media.mojom; + +import "media/mojo/interfaces/media_types.mojom"; +import "media/mojo/interfaces/video_decode_stats_recorder.mojom"; +import "media/mojo/interfaces/watch_time_recorder.mojom"; +import "mojo/common/time.mojom"; +import "ui/gfx/geometry/mojo/geometry.mojom"; +import "url/mojo/origin.mojom"; + +// Provider interface used to avoid having one time setters on each interface. +// Each recorder will be stamped with an ID which can be used for linking UKM. +interface MediaMetricsProvider { + // Assigns a playback ID and sets up this provider instance with information + // needed to make UKM reports. No other methods may be called until after + // Initialize() has been called. + // + // TODO(crbug.com/787209): Stop getting origin from the renderer. + Initialize(bool is_mse, bool is_top_frame, + url.mojom.Origin untrusted_top_origin); + + // Called when a playback ends in error. The status is reported to UKM when + // the provider is destructed. + OnError(PipelineStatus status); + + // Creates a WatchTimeRecorder instance using |properties|. If any of those + // properties changes, a new recorder should be requested. + AcquireWatchTimeRecorder(PlaybackProperties properties, + WatchTimeRecorder& recorder); + + // Creates a VideoDecodeStatsRecorder instance. Provide the origin of the top + // frame of the page hosting the video. Privacy team requires we use only the + // top-frame origin. |is_top_frame| signals whether the video is hosted in the + // top frame vs some inner frame to help interpret the origin. + // TODO(crbug.com/787209): Stop getting origin from the renderer. + AcquireVideoDecodeStatsRecorder(VideoDecodeStatsRecorder& recorder); +};
diff --git a/media/mojo/interfaces/video_decode_stats_recorder.mojom b/media/mojo/interfaces/video_decode_stats_recorder.mojom index 0dd7b29..0d7237f 100644 --- a/media/mojo/interfaces/video_decode_stats_recorder.mojom +++ b/media/mojo/interfaces/video_decode_stats_recorder.mojom
@@ -11,13 +11,6 @@ // Interface for media players in the renderer to send decode stats to the // browser process. Each player will have its own recorder instance. interface VideoDecodeStatsRecorder { - // Provide the origin of the top frame of the page hosting the video. Privacy - // team requires we use only the top-frame origin. |is_top_frame| signals - // whether the video is hosted in the top frame vs some inner frame to help - // interpret the origin. - // TODO(crbug.com/787209): Stop getting origin from the renderer. - SetPageInfo(url.mojom.Origin untrusted_top_frame_origin, bool is_top_frame); - // Will finalize any ongoing record and begin a new record with the given // properties. StartNewRecord(VideoCodecProfile profile, gfx.mojom.Size video_size,
diff --git a/media/mojo/interfaces/watch_time_recorder.mojom b/media/mojo/interfaces/watch_time_recorder.mojom index b69cbe85..53aadb1 100644 --- a/media/mojo/interfaces/watch_time_recorder.mojom +++ b/media/mojo/interfaces/watch_time_recorder.mojom
@@ -21,12 +21,6 @@ bool is_eme; bool is_embedded_media_experience; // Playback from 'Downloads' on Android. gfx.mojom.Size natural_size; // Size of video frame; (0, 0) if audio only. - - // For privacy, only record the top origin. "Untrusted" signals that this - // value comes from the renderer and should not be used for security checks. - // TODO(crbug.com/787209): Stop getting origin from the renderer. - url.mojom.Origin untrusted_top_origin; - bool is_top_frame; // False for any inner/iframe playbacks. }; // Interface by which the WatchTimeReporter reports watch time. This is used to @@ -43,6 +37,8 @@ // Note: There are some UMA values that the WatchTimeRecorder will generate // based on the recorded keys and values. Such metrics will only be generated // when finalizing everything via FinalizeWatchTime({}) or destruction. +// +// Note: UKM metrics are only reported upon destruction of the recorder. interface WatchTimeRecorder { // Reports |watch_time| for |key|. Note this should be an absolute value and // not a delta since the last call. Any necessary relative processing should @@ -63,12 +59,3 @@ // this is an absolute count and not relative since the last call. UpdateUnderflowCount(int32 count); }; - -// Provider interface used to avoid having a SetPlaybackProperties() type method -// on the WatchTimeRecorder interface. -interface WatchTimeRecorderProvider { - // Creates a WatchTimeRecorder instance using |properties|. If any of those - // properties changes, a new recorder should be requested. - AcquireWatchTimeRecorder(PlaybackProperties properties, - WatchTimeRecorder& recorder); -};
diff --git a/media/mojo/services/BUILD.gn b/media/mojo/services/BUILD.gn index 3566a90..47560c1 100644 --- a/media/mojo/services/BUILD.gn +++ b/media/mojo/services/BUILD.gn
@@ -18,6 +18,8 @@ "interface_factory_impl.h", "media_interface_provider.cc", "media_interface_provider.h", + "media_metrics_provider.cc", + "media_metrics_provider.h", "media_mojo_export.h", "media_resource_shim.cc", "media_resource_shim.h", @@ -223,6 +225,7 @@ testonly = true sources = [ + "media_metrics_provider_unittest.cc", "mojo_audio_input_stream_unittest.cc", "mojo_audio_output_stream_provider_unittest.cc", "mojo_audio_output_stream_unittest.cc",
diff --git a/media/mojo/services/media_metrics_provider.cc b/media/mojo/services/media_metrics_provider.cc new file mode 100644 index 0000000..65de890 --- /dev/null +++ b/media/mojo/services/media_metrics_provider.cc
@@ -0,0 +1,95 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "media/mojo/services/media_metrics_provider.h" + +#include "media/mojo/services/video_decode_stats_recorder.h" +#include "media/mojo/services/watch_time_recorder.h" +#include "mojo/public/cpp/bindings/strong_binding.h" +#include "services/metrics/public/cpp/ukm_builders.h" +#include "services/metrics/public/cpp/ukm_recorder.h" + +namespace media { + +constexpr char kInvalidInitialize[] = "Initialize() was not called correctly."; + +static uint64_t g_player_id = 0; + +MediaMetricsProvider::MediaMetricsProvider(VideoDecodePerfHistory* perf_history) + : player_id_(g_player_id++), perf_history_(perf_history) {} + +MediaMetricsProvider::~MediaMetricsProvider() { + // UKM may be unavailable in content_shell or other non-chrome/ builds; it + // may also be unavailable if browser shutdown has started; so this may be a + // nullptr. If it's unavailable, UKM reporting will be skipped. + ukm::UkmRecorder* ukm_recorder = ukm::UkmRecorder::Get(); + if (!ukm_recorder || !initialized_) + return; + + const int32_t source_id = ukm_recorder->GetNewSourceID(); + + // TODO(crbug.com/787209): Stop getting origin from the renderer. + ukm_recorder->UpdateSourceURL(source_id, untrusted_top_origin_.GetURL()); + ukm::builders::Media_WebMediaPlayerState builder(source_id); + builder.SetPlayerID(player_id_); + builder.SetIsTopFrame(is_top_frame_); + builder.SetIsMSE(is_mse_); + builder.SetFinalPipelineStatus(pipeline_status_); + builder.Record(ukm_recorder); +} + +// static +void MediaMetricsProvider::Create(VideoDecodePerfHistory* perf_history, + mojom::MediaMetricsProviderRequest request) { + mojo::MakeStrongBinding(base::MakeUnique<MediaMetricsProvider>(perf_history), + std::move(request)); +} + +void MediaMetricsProvider::Initialize(bool is_mse, + bool is_top_frame, + const url::Origin& untrusted_top_origin) { + if (initialized_) { + mojo::ReportBadMessage(kInvalidInitialize); + return; + } + + is_mse_ = is_mse; + is_top_frame_ = is_top_frame; + untrusted_top_origin_ = untrusted_top_origin; + initialized_ = true; +} + +void MediaMetricsProvider::OnError(PipelineStatus status) { + DCHECK(initialized_); + pipeline_status_ = status; +} + +void MediaMetricsProvider::AcquireWatchTimeRecorder( + mojom::PlaybackPropertiesPtr properties, + mojom::WatchTimeRecorderRequest request) { + if (!initialized_) { + mojo::ReportBadMessage(kInvalidInitialize); + return; + } + + mojo::MakeStrongBinding(base::MakeUnique<WatchTimeRecorder>( + std::move(properties), untrusted_top_origin_, + is_top_frame_, player_id_), + std::move(request)); +} + +void MediaMetricsProvider::AcquireVideoDecodeStatsRecorder( + mojom::VideoDecodeStatsRecorderRequest request) { + if (!initialized_) { + mojo::ReportBadMessage(kInvalidInitialize); + return; + } + + mojo::MakeStrongBinding( + base::MakeUnique<VideoDecodeStatsRecorder>( + untrusted_top_origin_, is_top_frame_, player_id_, perf_history_), + std::move(request)); +} + +} // namespace media
diff --git a/media/mojo/services/media_metrics_provider.h b/media/mojo/services/media_metrics_provider.h new file mode 100644 index 0000000..780fcdf --- /dev/null +++ b/media/mojo/services/media_metrics_provider.h
@@ -0,0 +1,61 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MEDIA_MOJO_SERVICES_MEDIA_METRICS_PROVIDER_H_ +#define MEDIA_MOJO_SERVICES_MEDIA_METRICS_PROVIDER_H_ + +#include <stdint.h> + +#include "media/base/pipeline_status.h" +#include "media/mojo/interfaces/media_metrics_provider.mojom.h" +#include "media/mojo/services/media_mojo_export.h" +#include "url/origin.h" + +namespace media { +class VideoDecodePerfHistory; + +// See mojom::MediaMetricsProvider for documentation. +class MEDIA_MOJO_EXPORT MediaMetricsProvider + : public mojom::MediaMetricsProvider { + public: + explicit MediaMetricsProvider(VideoDecodePerfHistory* perf_history); + ~MediaMetricsProvider() override; + + // Creates a MediaMetricsProvider, |perf_history| may be nullptr if perf + // history database recording is disabled. + static void Create(VideoDecodePerfHistory* perf_history, + mojom::MediaMetricsProviderRequest request); + + private: + // mojom::MediaMetricsProvider implementation: + void Initialize(bool is_mse, + bool is_top_frame, + const url::Origin& untrusted_top_origin) override; + void OnError(PipelineStatus status) override; + void AcquireWatchTimeRecorder( + mojom::PlaybackPropertiesPtr properties, + mojom::WatchTimeRecorderRequest request) override; + void AcquireVideoDecodeStatsRecorder( + mojom::VideoDecodeStatsRecorderRequest request) override; + + // Session unique ID which maps to a given WebMediaPlayerImpl instances. Used + // to coordinate multiply logged events with a singly logged metric. + const uint64_t player_id_; + + PipelineStatus pipeline_status_ = PIPELINE_OK; + + // The values below are only set if |initialized_| is true. + bool initialized_ = false; + bool is_mse_; + bool is_top_frame_; + url::Origin untrusted_top_origin_; + + VideoDecodePerfHistory* const perf_history_; + + DISALLOW_COPY_AND_ASSIGN(MediaMetricsProvider); +}; + +} // namespace media + +#endif // MEDIA_MOJO_SERVICES_MEDIA_METRICS_PROVIDER_H_
diff --git a/media/mojo/services/media_metrics_provider_unittest.cc b/media/mojo/services/media_metrics_provider_unittest.cc new file mode 100644 index 0000000..fb088e5 --- /dev/null +++ b/media/mojo/services/media_metrics_provider_unittest.cc
@@ -0,0 +1,106 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "media/mojo/services/watch_time_recorder.h" + +#include <stddef.h> + +#include "base/bind.h" +#include "base/bind_helpers.h" +#include "base/run_loop.h" +#include "base/test/test_message_loop.h" +#include "components/ukm/test_ukm_recorder.h" +#include "media/mojo/services/media_metrics_provider.h" +#include "services/metrics/public/cpp/ukm_builders.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "url/gurl.h" + +using UkmEntry = ukm::builders::Media_WebMediaPlayerState; + +namespace media { + +constexpr char kTestOrigin[] = "https://test.google.com/"; + +class MediaMetricsProviderTest : public testing::Test { + public: + MediaMetricsProviderTest() { ResetMetricRecorders(); } + + ~MediaMetricsProviderTest() override { base::RunLoop().RunUntilIdle(); } + + void Initialize(bool is_mse, bool is_top_frame, const std::string& origin) { + MediaMetricsProvider::Create(nullptr, mojo::MakeRequest(&provider_)); + provider_->Initialize(is_mse, is_top_frame, + url::Origin::Create(GURL(origin))); + } + + void ResetMetricRecorders() { + // Ensure cleared global before attempting to create a new TestUkmReporter. + test_recorder_.reset(); + test_recorder_.reset(new ukm::TestAutoSetUkmRecorder()); + } + + protected: + base::TestMessageLoop message_loop_; + std::unique_ptr<ukm::TestAutoSetUkmRecorder> test_recorder_; + mojom::MediaMetricsProviderPtr provider_; + + DISALLOW_COPY_AND_ASSIGN(MediaMetricsProviderTest); +}; + +#define EXPECT_UKM(name, value) \ + test_recorder_->ExpectEntryMetric(entry, name, value) +#define EXPECT_NO_UKM(name) \ + EXPECT_FALSE(test_recorder_->EntryHasMetric(entry, name)) +#define EXPECT_HAS_UKM(name) \ + EXPECT_TRUE(test_recorder_->EntryHasMetric(entry, name)); + +TEST_F(MediaMetricsProviderTest, TestUkm) { + Initialize(true, true, kTestOrigin); + provider_.reset(); + base::RunLoop().RunUntilIdle(); + + { + const auto& entries = + test_recorder_->GetEntriesByName(UkmEntry::kEntryName); + EXPECT_EQ(1u, entries.size()); + for (const auto* entry : entries) { + test_recorder_->ExpectEntrySourceHasUrl(entry, GURL(kTestOrigin)); + EXPECT_HAS_UKM(UkmEntry::kPlayerIDName); + EXPECT_UKM(UkmEntry::kIsTopFrameName, true); + EXPECT_UKM(UkmEntry::kIsMSEName, true); + EXPECT_UKM(UkmEntry::kFinalPipelineStatusName, PIPELINE_OK); + } + } + + // Now try one with different values. + const std::string kTestOrigin2 = "https://test2.google.com/"; + ResetMetricRecorders(); + Initialize(false, false, kTestOrigin2); + provider_->OnError(PIPELINE_ERROR_DECODE); + provider_.reset(); + base::RunLoop().RunUntilIdle(); + + { + const auto& entries = + test_recorder_->GetEntriesByName(UkmEntry::kEntryName); + EXPECT_EQ(1u, entries.size()); + for (const auto* entry : entries) { + test_recorder_->ExpectEntrySourceHasUrl(entry, GURL(kTestOrigin2)); + EXPECT_HAS_UKM(UkmEntry::kPlayerIDName); + EXPECT_UKM(UkmEntry::kIsTopFrameName, false); + EXPECT_UKM(UkmEntry::kIsMSEName, false); + EXPECT_UKM(UkmEntry::kFinalPipelineStatusName, PIPELINE_ERROR_DECODE); + } + } +} + +// Note: Tests for various Acquire* methods are contained with the unittests for +// their respective classes. + +#undef EXPECT_UKM +#undef EXPECT_NO_UKM +#undef EXPECT_HAS_UKM + +} // namespace media
diff --git a/media/mojo/services/video_decode_perf_history.cc b/media/mojo/services/video_decode_perf_history.cc index 48ffb5b..390b572 100644 --- a/media/mojo/services/video_decode_perf_history.cc +++ b/media/mojo/services/video_decode_perf_history.cc
@@ -180,6 +180,7 @@ uint32_t frames_decoded, uint32_t frames_dropped, uint32_t frames_decoded_power_efficient, + uint64_t player_id, base::OnceClosure save_done_cb) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DVLOG(3) << __func__ @@ -200,7 +201,7 @@ &VideoDecodePerfHistory::SavePerfRecord, weak_ptr_factory_.GetWeakPtr(), untrusted_top_frame_origin, is_top_frame, profile, natural_size, frame_rate, frames_decoded, frames_dropped, - frames_decoded_power_efficient, std::move(save_done_cb))); + frames_decoded_power_efficient, player_id, std::move(save_done_cb))); InitDatabase(); return; } @@ -213,15 +214,17 @@ // Get past perf info and report UKM metrics before saving this record. db_->GetDecodeStats( - video_key, base::BindOnce(&VideoDecodePerfHistory::OnGotStatsForSave, - weak_ptr_factory_.GetWeakPtr(), - untrusted_top_frame_origin, is_top_frame, - video_key, new_stats, std::move(save_done_cb))); + video_key, + base::BindOnce(&VideoDecodePerfHistory::OnGotStatsForSave, + weak_ptr_factory_.GetWeakPtr(), untrusted_top_frame_origin, + is_top_frame, player_id, video_key, new_stats, + std::move(save_done_cb))); } void VideoDecodePerfHistory::OnGotStatsForSave( const url::Origin& untrusted_top_frame_origin, bool is_top_frame, + uint64_t player_id, const VideoDecodeStatsDB::VideoDescKey& video_key, const VideoDecodeStatsDB::DecodeStatsEntry& new_stats, base::OnceClosure save_done_cb, @@ -236,8 +239,10 @@ return; } - ReportUkmMetrics(untrusted_top_frame_origin, is_top_frame, video_key, - new_stats, past_stats.get()); + ReportUkmMetrics(untrusted_top_frame_origin, is_top_frame, player_id, + video_key, new_stats, past_stats.get()); + + // TODO(dalecurtis): Abort stats recording if db_ is in read-only mode. db_->AppendDecodeStats( video_key, new_stats, @@ -263,6 +268,7 @@ void VideoDecodePerfHistory::ReportUkmMetrics( const url::Origin& untrusted_top_frame_origin, bool is_top_frame, + uint64_t player_id, const VideoDecodeStatsDB::VideoDescKey& video_key, const VideoDecodeStatsDB::DecodeStatsEntry& new_stats, VideoDecodeStatsDB::DecodeStatsEntry* past_stats) { @@ -281,6 +287,7 @@ // TODO(crbug.com/787209): Stop getting origin from the renderer. ukm_recorder->UpdateSourceURL(source_id, untrusted_top_frame_origin.GetURL()); builder.SetVideo_InTopFrame(is_top_frame); + builder.SetVideo_PlayerID(player_id); builder.SetVideo_CodecProfile(video_key.codec_profile); builder.SetVideo_FramesPerSecond(video_key.frame_rate);
diff --git a/media/mojo/services/video_decode_perf_history.h b/media/mojo/services/video_decode_perf_history.h index 7e1b345..f9ec32df 100644 --- a/media/mojo/services/video_decode_perf_history.h +++ b/media/mojo/services/video_decode_perf_history.h
@@ -72,6 +72,7 @@ uint32_t frames_decoded, uint32_t frames_dropped, uint32_t frames_decoded_power_efficient, + uint64_t player_id, base::OnceClosure save_done_cb = base::OnceClosure()); // Clear all history from the underlying database. Run |clear_done_cb| when @@ -122,6 +123,7 @@ void OnGotStatsForSave( const url::Origin& top_frame_origin, bool is_top_frame, + uint64_t player_id, const VideoDecodeStatsDB::VideoDescKey& video_key, const VideoDecodeStatsDB::DecodeStatsEntry& new_stats, base::OnceClosure save_done_cb, @@ -136,6 +138,7 @@ // |past_stats| predicts |new_stats|. void ReportUkmMetrics(const url::Origin& top_frame_origin, bool is_top_frame, + uint64_t player_id, const VideoDecodeStatsDB::VideoDescKey& video_key, const VideoDecodeStatsDB::DecodeStatsEntry& new_stats, VideoDecodeStatsDB::DecodeStatsEntry* past_stats);
diff --git a/media/mojo/services/video_decode_perf_history_unittest.cc b/media/mojo/services/video_decode_perf_history_unittest.cc index c979e44..ffa6eb0e 100644 --- a/media/mojo/services/video_decode_perf_history_unittest.cc +++ b/media/mojo/services/video_decode_perf_history_unittest.cc
@@ -10,13 +10,17 @@ #include "base/strings/stringprintf.h" #include "base/task_scheduler/post_task.h" #include "base/test/scoped_task_environment.h" +#include "components/ukm/test_ukm_recorder.h" #include "media/capabilities/video_decode_stats_db.h" #include "media/mojo/services/video_decode_perf_history.h" +#include "services/metrics/public/cpp/ukm_builders.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" #include "url/origin.h" +using UkmEntry = ukm::builders::Media_VideoDecodePerfRecord; + namespace { // Aliases for readability. @@ -26,6 +30,7 @@ const bool kIsNotPowerEfficient = false; const url::Origin kOrigin = url::Origin::Create(GURL("http://example.com")); const bool kIsTopFrame = true; +const uint64_t kPlayerId = 1234u; } // namespace @@ -74,7 +79,7 @@ std::move(get_stats_cb).Run(true, nullptr); } else { std::move(get_stats_cb) - .Run(true, base::MakeUnique<DecodeStatsEntry>(entry_it->second)); + .Run(true, std::make_unique<DecodeStatsEntry>(entry_it->second)); } } @@ -109,6 +114,7 @@ class VideoDecodePerfHistoryTest : public testing::Test { public: void SetUp() override { + test_recorder_ = std::make_unique<ukm::TestAutoSetUkmRecorder>(); perf_history_ = std::make_unique<VideoDecodePerfHistory>( std::make_unique<FakeVideoDecodeStatsDBFactory>()); } @@ -163,6 +169,8 @@ base::test::ScopedTaskEnvironment scoped_task_environment_; + std::unique_ptr<ukm::TestAutoSetUkmRecorder> test_recorder_; + // The VideoDecodeStatsReporter being tested. std::unique_ptr<VideoDecodePerfHistory> perf_history_; }; @@ -201,12 +209,14 @@ kFramesDecoded * kMaxSmoothDroppedFramesPercent + 1; // Add the entries. - perf_history_->SavePerfRecord( - kOrigin, kIsTopFrame, kKnownProfile, kKownSize, kSmoothFrameRate, - kFramesDecoded, kSmoothFramesDropped, kNotPowerEfficientFramesDecoded); - perf_history_->SavePerfRecord( - kOrigin, kIsTopFrame, kKnownProfile, kKownSize, kNotSmoothFrameRate, - kFramesDecoded, kNotSmoothFramesDropped, kNotPowerEfficientFramesDecoded); + perf_history_->SavePerfRecord(kOrigin, kIsTopFrame, kKnownProfile, kKownSize, + kSmoothFrameRate, kFramesDecoded, + kSmoothFramesDropped, + kNotPowerEfficientFramesDecoded, kPlayerId); + perf_history_->SavePerfRecord(kOrigin, kIsTopFrame, kKnownProfile, kKownSize, + kNotSmoothFrameRate, kFramesDecoded, + kNotSmoothFramesDropped, + kNotPowerEfficientFramesDecoded, kPlayerId); // Verify perf history returns is_smooth = true for the smooth entry. EXPECT_CALL(*this, MockGetPerfInfoCB(kIsSmooth, kIsNotPowerEfficient)); @@ -275,17 +285,18 @@ kFramesDecoded * kMaxSmoothDroppedFramesPercent + 1; // Add the entries. - perf_history_->SavePerfRecord( - kOrigin, kIsTopFrame, kPowerEfficientProfile, kKownSize, kSmoothFrameRate, - kFramesDecoded, kSmoothFramesDropped, kPowerEfficientFramesDecoded); + perf_history_->SavePerfRecord(kOrigin, kIsTopFrame, kPowerEfficientProfile, + kKownSize, kSmoothFrameRate, kFramesDecoded, + kSmoothFramesDropped, + kPowerEfficientFramesDecoded, kPlayerId); perf_history_->SavePerfRecord(kOrigin, kIsTopFrame, kNotPowerEfficientProfile, kKownSize, kSmoothFrameRate, kFramesDecoded, kSmoothFramesDropped, - kNotPowerEfficientFramesDecoded); + kNotPowerEfficientFramesDecoded, kPlayerId); perf_history_->SavePerfRecord(kOrigin, kIsTopFrame, kPowerEfficientProfile, kKownSize, kNotSmoothFrameRate, kFramesDecoded, kNotSmoothFramesDropped, - kPowerEfficientFramesDecoded); + kPowerEfficientFramesDecoded, kPlayerId); // Verify perf history returns is_smooth = true, is_power_efficient = true. EXPECT_CALL(*this, MockGetPerfInfoCB(kIsSmooth, kIsPowerEfficient)); @@ -378,7 +389,7 @@ const int kFramesPowerEfficient = kFramesDecoded; perf_history_->SavePerfRecord(kOrigin, kIsTopFrame, kProfile, kSize, kFrameRate, kFramesDecoded, kManyFramesDropped, - kFramesPowerEfficient); + kFramesPowerEfficient, kPlayerId); // Verify its there before we ClearHistory(). Note that perf is NOT smooth. EXPECT_CALL(*this, MockGetPerfInfoCB(kIsNotSmooth, kIsPowerEfficient)); @@ -412,6 +423,23 @@ base::PostTask(FROM_HERE, base::BindOnce(run_loop.QuitWhenIdleClosure())); run_loop.Run(); } + + const auto& entries = test_recorder_->GetEntriesByName(UkmEntry::kEntryName); + EXPECT_EQ(1u, entries.size()); + for (const auto* entry : entries) { + test_recorder_->ExpectEntrySourceHasUrl(entry, kOrigin.GetURL()); + +#define EXPECT_UKM(name, value) \ + test_recorder_->ExpectEntryMetric(entry, name, value) + + EXPECT_UKM(UkmEntry::kVideo_InTopFrameName, kIsTopFrame); + EXPECT_UKM(UkmEntry::kVideo_PlayerIDName, kPlayerId); + EXPECT_UKM(UkmEntry::kVideo_CodecProfileName, kProfile); + EXPECT_UKM(UkmEntry::kVideo_FramesPerSecondName, kFrameRate); +#undef EXPECT_UKM + + // TODO(chcunningham): Expand UKM tests to include absence tests. + } } INSTANTIATE_TEST_CASE_P(VaryDBInitTiming, @@ -443,7 +471,7 @@ // NOT smooth performance. perf_history_->SavePerfRecord(kOrigin, kIsTopFrame, kProfile, kSize, kFrameRate, kFramesDecoded, kManyFramesDropped, - kFramesPowerEfficient); + kFramesPowerEfficient, kPlayerId); // Expect that NOT smooth is eventually reported (after DB reinitialization // completes) when we query this stream description.
diff --git a/media/mojo/services/video_decode_stats_recorder.cc b/media/mojo/services/video_decode_stats_recorder.cc index e8a69042..a62b990 100644 --- a/media/mojo/services/video_decode_stats_recorder.cc +++ b/media/mojo/services/video_decode_stats_recorder.cc
@@ -3,6 +3,7 @@ // found in the LICENSE file. #include "media/mojo/services/video_decode_stats_recorder.h" + #include "base/memory/ptr_util.h" #include "media/mojo/services/video_decode_perf_history.h" #include "mojo/public/cpp/bindings/strong_binding.h" @@ -12,9 +13,17 @@ namespace media { VideoDecodeStatsRecorder::VideoDecodeStatsRecorder( + const url::Origin& untrusted_top_frame_origin, + bool is_top_frame, + uint64_t player_id, VideoDecodePerfHistory* perf_history) - : perf_history_(perf_history) { - DCHECK(perf_history_); + : untrusted_top_frame_origin_(untrusted_top_frame_origin), + is_top_frame_(is_top_frame), + perf_history_(perf_history), + player_id_(player_id) { + DVLOG(2) << __func__ + << " untrusted_top_frame_origin:" << untrusted_top_frame_origin + << " is_top_frame:" << is_top_frame; } VideoDecodeStatsRecorder::~VideoDecodeStatsRecorder() { @@ -22,26 +31,6 @@ FinalizeRecord(); } -// static -void VideoDecodeStatsRecorder::Create( - VideoDecodePerfHistory* perf_history, - mojom::VideoDecodeStatsRecorderRequest request) { - mojo::MakeStrongBinding( - base::MakeUnique<VideoDecodeStatsRecorder>(perf_history), - std::move(request)); -} - -void VideoDecodeStatsRecorder::SetPageInfo( - const url::Origin& untrusted_top_frame_origin, - bool is_top_frame) { - DVLOG(2) << __func__ - << " untrusted_top_frame_origin:" << untrusted_top_frame_origin - << " is_top_frame:" << is_top_frame; - - untrusted_top_frame_origin_ = untrusted_top_frame_origin; - is_top_frame_ = is_top_frame; -} - void VideoDecodeStatsRecorder::StartNewRecord(VideoCodecProfile profile, const gfx::Size& natural_size, int frames_per_sec) { @@ -84,8 +73,10 @@ } void VideoDecodeStatsRecorder::FinalizeRecord() { - if (profile_ == VIDEO_CODEC_PROFILE_UNKNOWN || frames_decoded_ == 0) + if (profile_ == VIDEO_CODEC_PROFILE_UNKNOWN || frames_decoded_ == 0 || + !perf_history_) { return; + } DVLOG(2) << __func__ << " profile: " << profile_ << " size:" << natural_size_.ToString() << " fps:" << frames_per_sec_ @@ -95,7 +86,7 @@ perf_history_->SavePerfRecord(untrusted_top_frame_origin_, is_top_frame_, profile_, natural_size_, frames_per_sec_, frames_decoded_, frames_dropped_, - frames_decoded_power_efficient_); + frames_decoded_power_efficient_, player_id_); } } // namespace media
diff --git a/media/mojo/services/video_decode_stats_recorder.h b/media/mojo/services/video_decode_stats_recorder.h index 765697d..bb45c00 100644 --- a/media/mojo/services/video_decode_stats_recorder.h +++ b/media/mojo/services/video_decode_stats_recorder.h
@@ -23,19 +23,16 @@ class MEDIA_MOJO_EXPORT VideoDecodeStatsRecorder : public mojom::VideoDecodeStatsRecorder { public: - // See Create(). - explicit VideoDecodeStatsRecorder(VideoDecodePerfHistory* perf_history); - + // |perf_history| required to save decode stats to local database and report + // metrics. Callers must ensure that |perf_history| outlives this object; may + // be nullptr if database recording is currently disabled. + VideoDecodeStatsRecorder(const url::Origin& untrusted_top_frame_origin, + bool is_top_frame, + uint64_t player_id, + VideoDecodePerfHistory* perf_history); ~VideoDecodeStatsRecorder() override; - // |perf_history| required to save decode stats to local database and report - // metrics. Callers must ensure that |perf_history| outlives this object. - static void Create(VideoDecodePerfHistory* perf_history, - mojom::VideoDecodeStatsRecorderRequest request); - // mojom::VideoDecodeStatsRecorder implementation: - void SetPageInfo(const url::Origin& untrusted_top_frame_origin, - bool is_top_frame) override; void StartNewRecord(VideoCodecProfile profile, const gfx::Size& natural_size, int frames_per_sec) override; @@ -48,9 +45,11 @@ // starting a new record. void FinalizeRecord(); - url::Origin untrusted_top_frame_origin_; - bool is_top_frame_; - VideoDecodePerfHistory* perf_history_; + const url::Origin untrusted_top_frame_origin_; + const bool is_top_frame_; + VideoDecodePerfHistory* const perf_history_; + const uint64_t player_id_; + VideoCodecProfile profile_ = VIDEO_CODEC_PROFILE_UNKNOWN; gfx::Size natural_size_; int frames_per_sec_ = 0;
diff --git a/media/mojo/services/watch_time_recorder.cc b/media/mojo/services/watch_time_recorder.cc index 17aee39..43932f04 100644 --- a/media/mojo/services/watch_time_recorder.cc +++ b/media/mojo/services/watch_time_recorder.cc
@@ -119,26 +119,14 @@ base::UmaHistogramCounts100(key.as_string(), underflow_count); } -class WatchTimeRecorderProvider : public mojom::WatchTimeRecorderProvider { - public: - WatchTimeRecorderProvider() = default; - ~WatchTimeRecorderProvider() override = default; - - private: - // mojom::WatchTimeRecorderProvider implementation: - void AcquireWatchTimeRecorder( - mojom::PlaybackPropertiesPtr properties, - mojom::WatchTimeRecorderRequest request) override { - mojo::MakeStrongBinding( - base::MakeUnique<WatchTimeRecorder>(std::move(properties)), - std::move(request)); - } - - DISALLOW_COPY_AND_ASSIGN(WatchTimeRecorderProvider); -}; - -WatchTimeRecorder::WatchTimeRecorder(mojom::PlaybackPropertiesPtr properties) +WatchTimeRecorder::WatchTimeRecorder(mojom::PlaybackPropertiesPtr properties, + const url::Origin& untrusted_top_origin, + bool is_top_frame, + uint64_t player_id) : properties_(std::move(properties)), + untrusted_top_origin_(untrusted_top_origin), + is_top_frame_(is_top_frame), + player_id_(player_id), extended_metrics_keys_( {{WatchTimeKey::kAudioSrc, kMeanTimeBetweenRebuffersAudioSrc, kRebuffersCountAudioSrc, kDiscardedWatchTimeAudioSrc}, @@ -158,13 +146,7 @@ WatchTimeRecorder::~WatchTimeRecorder() { FinalizeWatchTime({}); -} - -// static -void WatchTimeRecorder::CreateWatchTimeRecorderProvider( - mojom::WatchTimeRecorderProviderRequest request) { - mojo::MakeStrongBinding(base::MakeUnique<WatchTimeRecorderProvider>(), - std::move(request)); + RecordUkmPlaybackData(); } void WatchTimeRecorder::RecordWatchTime(WatchTimeKey key, @@ -215,10 +197,6 @@ return; } - // This must be done before |underflow_count_| is cleared. Will only be - // recorded if a Media.WatchTime.*.All entry exists. - RecordUkmPlaybackData(); - // Check for watch times entries that have corresponding MTBR entries and // report the MTBR value using watch_time / |underflow_count|. Do this only // for foreground reporters since we only have UMA keys for foreground. @@ -238,14 +216,13 @@ } // Ensure values are cleared in case the reporter is reused. - pipeline_status_ = PIPELINE_OK; + total_underflow_count_ += underflow_count_; underflow_count_ = 0; watch_time_info_.clear(); } void WatchTimeRecorder::OnError(PipelineStatus status) { pipeline_status_ = status; - needs_ukm_report_ = true; } void WatchTimeRecorder::UpdateUnderflowCount(int32_t count) { @@ -265,32 +242,15 @@ if (!ukm_recorder) return; - // Ensure we have an "All" watch time entry or we haven't issued an up to date - // UKM report; otherwise skip reporting. - if (!needs_ukm_report_ && - !std::any_of( - aggregate_watch_time_info_.begin(), aggregate_watch_time_info_.end(), - [](const std::pair<WatchTimeKey, base::TimeDelta>& kv) { - return kv.first == WatchTimeKey::kAudioAll || - kv.first == WatchTimeKey::kAudioBackgroundAll || - kv.first == WatchTimeKey::kAudioVideoAll || - kv.first == WatchTimeKey::kAudioVideoBackgroundAll || - kv.first == WatchTimeKey::kVideoAll || - kv.first == WatchTimeKey::kVideoBackgroundAll; - })) { - return; - } - - needs_ukm_report_ = false; const int32_t source_id = ukm_recorder->GetNewSourceID(); // TODO(crbug.com/787209): Stop getting origin from the renderer. - ukm_recorder->UpdateSourceURL(source_id, - properties_->untrusted_top_origin.GetURL()); + ukm_recorder->UpdateSourceURL(source_id, untrusted_top_origin_.GetURL()); ukm::builders::Media_BasicPlayback builder(source_id); - builder.SetIsTopFrame(properties_->is_top_frame); + builder.SetIsTopFrame(is_top_frame_); builder.SetIsBackground(properties_->is_background); + builder.SetPlayerID(player_id_); bool recorded_all_metric = false; for (auto& kv : aggregate_watch_time_info_) { @@ -300,14 +260,14 @@ kv.first == WatchTimeKey::kAudioVideoBackgroundAll || kv.first == WatchTimeKey::kVideoAll || kv.first == WatchTimeKey::kVideoBackgroundAll) { - // Only one of these keys should be present in a given finalize. + // Only one of these keys should be present. DCHECK(!recorded_all_metric); recorded_all_metric = true; builder.SetWatchTime(kv.second.InMilliseconds()); - if (underflow_count_) { + if (total_underflow_count_) { builder.SetMeanTimeBetweenRebuffers( - (kv.second / underflow_count_).InMilliseconds()); + (kv.second / total_underflow_count_).InMilliseconds()); } } else if (kv.first == WatchTimeKey::kAudioAc || kv.first == WatchTimeKey::kAudioBackgroundAc || @@ -352,7 +312,7 @@ builder.SetIsEME(properties_->is_eme); builder.SetIsMSE(properties_->is_mse); builder.SetLastPipelineStatus(pipeline_status_); - builder.SetRebuffersCount(underflow_count_); + builder.SetRebuffersCount(total_underflow_count_); builder.SetVideoNaturalWidth(properties_->natural_size.width()); builder.SetVideoNaturalHeight(properties_->natural_size.height()); builder.Record(ukm_recorder);
diff --git a/media/mojo/services/watch_time_recorder.h b/media/mojo/services/watch_time_recorder.h index 7d247a5d..e649888e 100644 --- a/media/mojo/services/watch_time_recorder.h +++ b/media/mojo/services/watch_time_recorder.h
@@ -23,12 +23,12 @@ // See mojom::WatchTimeRecorder for documentation. class MEDIA_MOJO_EXPORT WatchTimeRecorder : public mojom::WatchTimeRecorder { public: - explicit WatchTimeRecorder(mojom::PlaybackPropertiesPtr properties); + WatchTimeRecorder(mojom::PlaybackPropertiesPtr properties, + const url::Origin& untrusted_top_origin, + bool is_top_frame, + uint64_t player_id); ~WatchTimeRecorder() override; - static void CreateWatchTimeRecorderProvider( - mojom::WatchTimeRecorderProviderRequest request); - // mojom::WatchTimeRecorder implementation: void RecordWatchTime(WatchTimeKey key, base::TimeDelta watch_time) override; void FinalizeWatchTime( @@ -47,6 +47,17 @@ const mojom::PlaybackPropertiesPtr properties_; + // For privacy, only record the top origin. "Untrusted" signals that this + // value comes from the renderer and should not be used for security checks. + // TODO(crbug.com/787209): Stop getting origin from the renderer. + const url::Origin untrusted_top_origin_; + const bool is_top_frame_; + + // The provider ID which constructed this recorder. Used to record a UKM entry + // at destruction that can be correlated with the final status for the + // associated WebMediaPlayerImpl instance. + const uint64_t player_id_; + // Mapping of WatchTime metric keys to MeanTimeBetweenRebuffers (MTBR), smooth // rate (had zero rebuffers), and discard (<7s watch time) keys. struct ExtendedMetricsKeyMap { @@ -69,12 +80,9 @@ WatchTimeInfo aggregate_watch_time_info_; int underflow_count_ = 0; + int total_underflow_count_ = 0; PipelineStatus pipeline_status_ = PIPELINE_OK; - // False if all data has been reported to UKM. Set to false by important - // property updates; e.g., OnError(). - bool needs_ukm_report_ = true; - DISALLOW_COPY_AND_ASSIGN(WatchTimeRecorder); };
diff --git a/media/mojo/services/watch_time_recorder_unittest.cc b/media/mojo/services/watch_time_recorder_unittest.cc index af7498aa..c6c7f448 100644 --- a/media/mojo/services/watch_time_recorder_unittest.cc +++ b/media/mojo/services/watch_time_recorder_unittest.cc
@@ -15,6 +15,7 @@ #include "base/threading/thread_task_runner_handle.h" #include "components/ukm/test_ukm_recorder.h" #include "media/base/watch_time_keys.h" +#include "media/mojo/services/media_metrics_provider.h" #include "services/metrics/public/cpp/ukm_builders.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -49,22 +50,25 @@ kDiscardedWatchTimeAudioVideoMse, kDiscardedWatchTimeAudioVideoEme}) { ResetMetricRecorders(); - WatchTimeRecorder::CreateWatchTimeRecorderProvider( - mojo::MakeRequest(&provider_)); + MediaMetricsProvider::Create(nullptr, mojo::MakeRequest(&provider_)); } ~WatchTimeRecorderTest() override { base::RunLoop().RunUntilIdle(); } + void Initialize(mojom::PlaybackPropertiesPtr properties) { + provider_->Initialize(properties->is_mse, true /* is_top_frame */, + url::Origin::Create(GURL(kTestOrigin))); + provider_->AcquireWatchTimeRecorder(std::move(properties), + mojo::MakeRequest(&wtr_)); + } + void Initialize(bool has_audio, bool has_video, bool is_mse, bool is_encrypted) { - provider_->AcquireWatchTimeRecorder( - mojom::PlaybackProperties::New( - kUnknownAudioCodec, kUnknownVideoCodec, has_audio, has_video, false, - is_mse, is_encrypted, false, gfx::Size(800, 600), - url::Origin::Create(GURL(kTestOrigin)), true /* is_top_frame */), - mojo::MakeRequest(&wtr_)); + Initialize(mojom::PlaybackProperties::New( + kUnknownAudioCodec, kUnknownVideoCodec, has_audio, has_video, false, + is_mse, is_encrypted, false, gfx::Size(800, 600))); } void ExpectWatchTime(const std::vector<base::StringPiece>& keys, @@ -138,7 +142,7 @@ protected: base::MessageLoop message_loop_; - mojom::WatchTimeRecorderProviderPtr provider_; + mojom::MediaMetricsProviderPtr provider_; std::unique_ptr<base::HistogramTester> histogram_tester_; std::unique_ptr<ukm::TestAutoSetUkmRecorder> test_recorder_; mojom::WatchTimeRecorderPtr wtr_; @@ -356,20 +360,39 @@ test_recorder_->ExpectEntryMetric(entry, name, value) #define EXPECT_NO_UKM(name) \ EXPECT_FALSE(test_recorder_->EntryHasMetric(entry, name)) +#define EXPECT_HAS_UKM(name) \ + EXPECT_TRUE(test_recorder_->EntryHasMetric(entry, name)); TEST_F(WatchTimeRecorderTest, TestFinalizeNoDuplication) { - mojom::PlaybackPropertiesPtr properties = mojom::PlaybackProperties::New( - kCodecAAC, kCodecH264, true, true, false, false, false, false, - gfx::Size(800, 600), url::Origin::Create(GURL(kTestOrigin)), true); - provider_->AcquireWatchTimeRecorder(properties.Clone(), - mojo::MakeRequest(&wtr_)); + mojom::PlaybackPropertiesPtr properties = + mojom::PlaybackProperties::New(kCodecAAC, kCodecH264, true, true, false, + false, false, false, gfx::Size(800, 600)); + Initialize(properties.Clone()); // Verify that UKM is reported along with the watch time. constexpr base::TimeDelta kWatchTime = base::TimeDelta::FromSeconds(4); wtr_->RecordWatchTime(WatchTimeKey::kAudioVideoAll, kWatchTime); + + // Finalize everything. UKM is only recorded at destruction, so this should do + // nothing. wtr_->FinalizeWatchTime({}); base::RunLoop().RunUntilIdle(); + // No watch time should have been recorded since this is below the UMA report + // threshold. + ExpectWatchTime({}, base::TimeDelta()); + ExpectMtbrTime({}, base::TimeDelta()); + ExpectZeroRebuffers({}); + ExpectNoUkmWatchTime(); + + const auto& empty_entries = + test_recorder_->GetEntriesByName(UkmEntry::kEntryName); + EXPECT_EQ(0u, empty_entries.size()); + + // Verify UKM is logged at destruction time. + ResetMetricRecorders(); + wtr_.reset(); + base::RunLoop().RunUntilIdle(); const auto& entries = test_recorder_->GetEntriesByName(UkmEntry::kEntryName); EXPECT_EQ(1u, entries.size()); for (const auto* entry : entries) { @@ -389,6 +412,7 @@ EXPECT_UKM(UkmEntry::kVideoNaturalHeightName, properties->natural_size.height()); EXPECT_UKM(UkmEntry::kWatchTimeName, kWatchTime.InMilliseconds()); + EXPECT_HAS_UKM(UkmEntry::kPlayerIDName); EXPECT_NO_UKM(UkmEntry::kMeanTimeBetweenRebuffersName); EXPECT_NO_UKM(UkmEntry::kWatchTime_ACName); @@ -399,26 +423,16 @@ EXPECT_NO_UKM(UkmEntry::kWatchTime_DisplayInlineName); EXPECT_NO_UKM(UkmEntry::kWatchTime_DisplayPictureInPictureName); } - - // Ensure no second UKM report is generated now that we've already reported - // along with the WatchTime above. - ResetMetricRecorders(); - wtr_.reset(); - base::RunLoop().RunUntilIdle(); - const auto& empty_entries = - test_recorder_->GetEntriesByName(UkmEntry::kEntryName); - EXPECT_EQ(0u, empty_entries.size()); } TEST_F(WatchTimeRecorderTest, FinalizeWithoutWatchTime) { - mojom::PlaybackPropertiesPtr properties = mojom::PlaybackProperties::New( - kCodecAAC, kCodecH264, true, true, false, false, false, false, - gfx::Size(800, 600), url::Origin::Create(GURL(kTestOrigin)), true); - provider_->AcquireWatchTimeRecorder(properties.Clone(), - mojo::MakeRequest(&wtr_)); + mojom::PlaybackPropertiesPtr properties = + mojom::PlaybackProperties::New(kCodecAAC, kCodecH264, true, true, false, + false, false, false, gfx::Size(800, 600)); + Initialize(properties.Clone()); - // Finalize everything. Since no metrics have been recorded yet, this will - // generate a UKM entry. + // Finalize everything. UKM is only recorded at destruction, so this should do + // nothing. wtr_->FinalizeWatchTime({}); base::RunLoop().RunUntilIdle(); @@ -428,8 +442,16 @@ ExpectWatchTime({}, base::TimeDelta()); ExpectMtbrTime({}, base::TimeDelta()); ExpectZeroRebuffers({}); - ExpectUkmWatchTime({}, base::TimeDelta()); + ExpectNoUkmWatchTime(); + const auto& empty_entries = + test_recorder_->GetEntriesByName(UkmEntry::kEntryName); + EXPECT_EQ(0u, empty_entries.size()); + + // Destructing the recorder should generate a UKM report though. + ResetMetricRecorders(); + wtr_.reset(); + base::RunLoop().RunUntilIdle(); const auto& entries = test_recorder_->GetEntriesByName(UkmEntry::kEntryName); EXPECT_EQ(1u, entries.size()); for (const auto* entry : entries) { @@ -448,6 +470,7 @@ properties->natural_size.width()); EXPECT_UKM(UkmEntry::kVideoNaturalHeightName, properties->natural_size.height()); + EXPECT_HAS_UKM(UkmEntry::kPlayerIDName); EXPECT_NO_UKM(UkmEntry::kMeanTimeBetweenRebuffersName); EXPECT_NO_UKM(UkmEntry::kWatchTimeName); @@ -459,66 +482,13 @@ EXPECT_NO_UKM(UkmEntry::kWatchTime_DisplayInlineName); EXPECT_NO_UKM(UkmEntry::kWatchTime_DisplayPictureInPictureName); } - - // Finalize a second time should do nothing. - ResetMetricRecorders(); - wtr_->FinalizeWatchTime({}); - base::RunLoop().RunUntilIdle(); - const auto& empty_entries = - test_recorder_->GetEntriesByName(UkmEntry::kEntryName); - EXPECT_EQ(0u, empty_entries.size()); - - // OnError() plus another finalize should generate a new UKM report. - ResetMetricRecorders(); - wtr_->OnError(PIPELINE_ERROR_DECODE); - wtr_->FinalizeWatchTime({}); - base::RunLoop().RunUntilIdle(); - const auto& entries2 = test_recorder_->GetEntriesByName(UkmEntry::kEntryName); - EXPECT_EQ(1u, entries2.size()); - for (const auto* entry : entries2) { - test_recorder_->ExpectEntrySourceHasUrl(entry, GURL(kTestOrigin)); - - EXPECT_UKM(UkmEntry::kIsBackgroundName, properties->is_background); - EXPECT_UKM(UkmEntry::kAudioCodecName, properties->audio_codec); - EXPECT_UKM(UkmEntry::kVideoCodecName, properties->video_codec); - EXPECT_UKM(UkmEntry::kHasAudioName, properties->has_audio); - EXPECT_UKM(UkmEntry::kHasVideoName, properties->has_video); - EXPECT_UKM(UkmEntry::kIsEMEName, properties->is_eme); - EXPECT_UKM(UkmEntry::kIsMSEName, properties->is_mse); - EXPECT_UKM(UkmEntry::kLastPipelineStatusName, PIPELINE_ERROR_DECODE); - EXPECT_UKM(UkmEntry::kRebuffersCountName, 0); - EXPECT_UKM(UkmEntry::kVideoNaturalWidthName, - properties->natural_size.width()); - EXPECT_UKM(UkmEntry::kVideoNaturalHeightName, - properties->natural_size.height()); - - EXPECT_NO_UKM(UkmEntry::kMeanTimeBetweenRebuffersName); - EXPECT_NO_UKM(UkmEntry::kWatchTimeName); - EXPECT_NO_UKM(UkmEntry::kWatchTime_ACName); - EXPECT_NO_UKM(UkmEntry::kWatchTime_BatteryName); - EXPECT_NO_UKM(UkmEntry::kWatchTime_NativeControlsOnName); - EXPECT_NO_UKM(UkmEntry::kWatchTime_NativeControlsOffName); - EXPECT_NO_UKM(UkmEntry::kWatchTime_DisplayFullscreenName); - EXPECT_NO_UKM(UkmEntry::kWatchTime_DisplayInlineName); - EXPECT_NO_UKM(UkmEntry::kWatchTime_DisplayPictureInPictureName); - } - - // Ensure no second UKM report is generated now that we've already reported - // along with the WatchTime above. - ResetMetricRecorders(); - wtr_.reset(); - base::RunLoop().RunUntilIdle(); - const auto& empty_entries2 = - test_recorder_->GetEntriesByName(UkmEntry::kEntryName); - EXPECT_EQ(0u, empty_entries2.size()); } TEST_F(WatchTimeRecorderTest, BasicUkmAudioVideo) { - mojom::PlaybackPropertiesPtr properties = mojom::PlaybackProperties::New( - kCodecAAC, kCodecH264, true, true, false, false, false, false, - gfx::Size(800, 600), url::Origin::Create(GURL(kTestOrigin)), true); - provider_->AcquireWatchTimeRecorder(properties.Clone(), - mojo::MakeRequest(&wtr_)); + mojom::PlaybackPropertiesPtr properties = + mojom::PlaybackProperties::New(kCodecAAC, kCodecH264, true, true, false, + false, false, false, gfx::Size(800, 600)); + Initialize(properties.Clone()); constexpr base::TimeDelta kWatchTime = base::TimeDelta::FromSeconds(4); wtr_->RecordWatchTime(WatchTimeKey::kAudioVideoAll, kWatchTime); @@ -544,6 +514,7 @@ properties->natural_size.width()); EXPECT_UKM(UkmEntry::kVideoNaturalHeightName, properties->natural_size.height()); + EXPECT_HAS_UKM(UkmEntry::kPlayerIDName); EXPECT_NO_UKM(UkmEntry::kMeanTimeBetweenRebuffersName); EXPECT_NO_UKM(UkmEntry::kWatchTime_ACName); @@ -557,11 +528,10 @@ } TEST_F(WatchTimeRecorderTest, BasicUkmAudioVideoWithExtras) { - mojom::PlaybackPropertiesPtr properties = mojom::PlaybackProperties::New( - kCodecOpus, kCodecVP9, true, true, false, true, true, false, - gfx::Size(800, 600), url::Origin::Create(GURL(kTestOrigin)), true); - provider_->AcquireWatchTimeRecorder(properties.Clone(), - mojo::MakeRequest(&wtr_)); + mojom::PlaybackPropertiesPtr properties = + mojom::PlaybackProperties::New(kCodecOpus, kCodecVP9, true, true, false, + true, true, false, gfx::Size(800, 600)); + Initialize(properties.Clone()); constexpr base::TimeDelta kWatchTime = base::TimeDelta::FromSeconds(54); const base::TimeDelta kWatchTime2 = kWatchTime * 2; @@ -607,6 +577,7 @@ kWatchTime3.InMilliseconds()); EXPECT_UKM(UkmEntry::kMeanTimeBetweenRebuffersName, kWatchTime2.InMilliseconds() / 3); + EXPECT_HAS_UKM(UkmEntry::kPlayerIDName); EXPECT_UKM(UkmEntry::kIsBackgroundName, properties->is_background); EXPECT_UKM(UkmEntry::kAudioCodecName, properties->audio_codec); @@ -625,11 +596,10 @@ } TEST_F(WatchTimeRecorderTest, BasicUkmAudioVideoBackground) { - mojom::PlaybackPropertiesPtr properties = mojom::PlaybackProperties::New( - kCodecAAC, kCodecH264, true, true, true, false, false, false, - gfx::Size(800, 600), url::Origin::Create(GURL(kTestOrigin)), true); - provider_->AcquireWatchTimeRecorder(properties.Clone(), - mojo::MakeRequest(&wtr_)); + mojom::PlaybackPropertiesPtr properties = + mojom::PlaybackProperties::New(kCodecAAC, kCodecH264, true, true, true, + false, false, false, gfx::Size(800, 600)); + Initialize(properties.Clone()); constexpr base::TimeDelta kWatchTime = base::TimeDelta::FromSeconds(54); wtr_->RecordWatchTime(WatchTimeKey::kAudioVideoBackgroundAll, kWatchTime); @@ -655,6 +625,7 @@ properties->natural_size.width()); EXPECT_UKM(UkmEntry::kVideoNaturalHeightName, properties->natural_size.height()); + EXPECT_HAS_UKM(UkmEntry::kPlayerIDName); EXPECT_NO_UKM(UkmEntry::kMeanTimeBetweenRebuffersName); EXPECT_NO_UKM(UkmEntry::kWatchTime_ACName); @@ -668,5 +639,6 @@ } #undef EXPECT_UKM #undef EXPECT_NO_UKM +#undef EXPECT_HAS_UKM } // namespace media
diff --git a/media/renderers/paint_canvas_video_renderer.cc b/media/renderers/paint_canvas_video_renderer.cc index c28f2a1..85865edc 100644 --- a/media/renderers/paint_canvas_video_renderer.cc +++ b/media/renderers/paint_canvas_video_renderer.cc
@@ -137,11 +137,18 @@ source_textures[i].fTarget = GL_TEXTURE_2D; } } + GrPixelConfig config = video_frame->format() == PIXEL_FORMAT_NV12 + ? kRGBA_8888_GrPixelConfig + : kAlpha_8_GrPixelConfig; context_3d.gr_context->resetContext(kTextureBinding_GrGLBackendState); - GrBackendObject handles[3] = { - skia::GrGLTextureInfoToGrBackendObject(source_textures[0]), - skia::GrGLTextureInfoToGrBackendObject(source_textures[1]), - skia::GrGLTextureInfoToGrBackendObject(source_textures[2])}; + GrBackendTexture textures[3] = { + GrBackendTexture(ya_tex_size.width(), ya_tex_size.height(), config, + source_textures[0]), + GrBackendTexture(uv_tex_size.width(), uv_tex_size.height(), config, + source_textures[1]), + GrBackendTexture(uv_tex_size.width(), uv_tex_size.height(), config, + source_textures[2]), + }; SkISize yuvSizes[] = { {ya_tex_size.width(), ya_tex_size.height()}, @@ -158,11 +165,11 @@ sk_sp<SkImage> img; if (video_frame->format() == PIXEL_FORMAT_NV12) { img = SkImage::MakeFromNV12TexturesCopy(context_3d.gr_context, color_space, - handles, yuvSizes, + textures, yuvSizes, kTopLeft_GrSurfaceOrigin); } else { img = SkImage::MakeFromYUVTexturesCopy(context_3d.gr_context, color_space, - handles, yuvSizes, + textures, yuvSizes, kTopLeft_GrSurfaceOrigin); } for (size_t i = 0; i < video_frame->NumTextures(); ++i) {
diff --git a/mojo/public/cpp/bindings/lib/binding_state.cc b/mojo/public/cpp/bindings/lib/binding_state.cc index 4e9a0f46..44c0810 100644 --- a/mojo/public/cpp/bindings/lib/binding_state.cc +++ b/mojo/public/cpp/bindings/lib/binding_state.cc
@@ -87,7 +87,7 @@ bool has_sync_methods, MessageReceiverWithResponderStatus* stub, uint32_t interface_version) { - DCHECK(!router_); + DCHECK(!is_bound()) << "Attempting to bind interface that is already bound."; auto sequenced_runner = GetTaskRunnerToUseFromUserProvidedTaskRunner(std::move(runner));
diff --git a/net/BUILD.gn b/net/BUILD.gn index e5b35082..c4c75611 100644 --- a/net/BUILD.gn +++ b/net/BUILD.gn
@@ -1428,6 +1428,7 @@ "quic/http/quic_http_structures.cc", "quic/http/quic_http_structures.h", "quic/platform/api/quic_aligned.h", + "quic/platform/api/quic_arraysize.h", "quic/platform/api/quic_bug_tracker.h", "quic/platform/api/quic_clock.cc", "quic/platform/api/quic_clock.h", @@ -1467,6 +1468,7 @@ "quic/platform/api/quic_url_utils.cc", "quic/platform/api/quic_url_utils.h", "quic/platform/impl/quic_aligned_impl.h", + "quic/platform/impl/quic_arraysize_impl.h", "quic/platform/impl/quic_bug_tracker_impl.h", "quic/platform/impl/quic_chromium_clock.cc", "quic/platform/impl/quic_chromium_clock.h",
diff --git a/net/dns/dns_transaction.cc b/net/dns/dns_transaction.cc index 47906fd..4c7707b8 100644 --- a/net/dns/dns_transaction.cc +++ b/net/dns/dns_transaction.cc
@@ -71,6 +71,26 @@ return std::move(dict); } +// Values are used in UMA histograms. Do not change existing values. +enum MalformedResponseResult { + MALFORMED_OK = 0, + MALFORMED_MALFORMED = 1, + MALFORMED_FAILED = 2, + MALFORMED_MAX +}; + +void RecordMalformedResponseHistogram(int net_error) { + MalformedResponseResult error_type; + if (net_error == OK) + error_type = MALFORMED_OK; + else if (net_error == ERR_DNS_MALFORMED_RESPONSE) + error_type = MALFORMED_MALFORMED; + else + error_type = MALFORMED_FAILED; + UMA_HISTOGRAM_ENUMERATION("Net.DNS.ResultAfterMalformedResponse", error_type, + MALFORMED_MAX); +} + // ---------------------------------------------------------------------------- // A single asynchronous DNS exchange, which consists of sending out a @@ -205,10 +225,15 @@ } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE); set_result(rv); - // If we received a malformed response, and are now waiting for another one, - // indicate to the transaction that the server might be misbehaving. - if (rv == ERR_IO_PENDING && received_malformed_response_) - return ERR_DNS_MALFORMED_RESPONSE; + if (received_malformed_response_) { + // If we received a malformed response, and are now waiting for another + // one, indicate to the transaction that the server might be misbehaving. + if (rv == ERR_IO_PENDING) + return ERR_DNS_MALFORMED_RESPONSE; + + // This is a new response after the original malformed one. + RecordMalformedResponseHistogram(rv); + } if (rv == OK) { DCHECK_EQ(STATE_NONE, next_state_); UMA_HISTOGRAM_LONG_TIMES_100("AsyncDNS.UDPAttemptSuccess", @@ -263,6 +288,7 @@ // Our solution is to make another attempt, in case the query truly // failed, but keep this attempt alive, in case it was a false alarm. received_malformed_response_ = true; + RecordMalformedResponseHistogram(ERR_DNS_MALFORMED_RESPONSE); next_state_ = STATE_READ_RESPONSE; return OK; }
diff --git a/net/dns/mojo_host_struct_traits.cc b/net/dns/mojo_host_struct_traits.cc index 44b7efc..4ba742d 100644 --- a/net/dns/mojo_host_struct_traits.cc +++ b/net/dns/mojo_host_struct_traits.cc
@@ -8,47 +8,12 @@ #include "base/memory/ptr_util.h" #include "net/base/address_list.h" +#include "net/interfaces/address_family_traits.h" #include "net/interfaces/ip_endpoint_struct_traits.h" namespace mojo { // static -bool EnumTraits<net::interfaces::AddressFamily, net::AddressFamily>::FromMojom( - net::interfaces::AddressFamily address_family, - net::AddressFamily* out) { - using net::interfaces::AddressFamily; - switch (address_family) { - case AddressFamily::UNSPECIFIED: - *out = net::ADDRESS_FAMILY_UNSPECIFIED; - return true; - case AddressFamily::IPV4: - *out = net::ADDRESS_FAMILY_IPV4; - return true; - case AddressFamily::IPV6: - *out = net::ADDRESS_FAMILY_IPV6; - return true; - } - return false; -} - -// static -net::interfaces::AddressFamily -EnumTraits<net::interfaces::AddressFamily, net::AddressFamily>::ToMojom( - net::AddressFamily address_family) { - using net::interfaces::AddressFamily; - switch (address_family) { - case net::ADDRESS_FAMILY_UNSPECIFIED: - return AddressFamily::UNSPECIFIED; - case net::ADDRESS_FAMILY_IPV4: - return AddressFamily::IPV4; - case net::ADDRESS_FAMILY_IPV6: - return AddressFamily::IPV6; - } - NOTREACHED(); - return AddressFamily::UNSPECIFIED; -} - -// static bool StructTraits<net::interfaces::HostResolverRequestInfoDataView, std::unique_ptr<net::HostResolver::RequestInfo>>:: Read(net::interfaces::HostResolverRequestInfoDataView data,
diff --git a/net/dns/mojo_host_struct_traits.h b/net/dns/mojo_host_struct_traits.h index 29a5f6c7..f39b844c 100644 --- a/net/dns/mojo_host_struct_traits.h +++ b/net/dns/mojo_host_struct_traits.h
@@ -9,19 +9,12 @@ #include "mojo/public/cpp/bindings/enum_traits.h" #include "mojo/public/cpp/bindings/struct_traits.h" #include "net/dns/host_resolver.h" +#include "net/interfaces/address_family.mojom.h" #include "net/interfaces/host_resolver_service.mojom.h" namespace mojo { template <> -struct EnumTraits<net::interfaces::AddressFamily, net::AddressFamily> { - static net::interfaces::AddressFamily ToMojom( - net::AddressFamily address_family); - static bool FromMojom(net::interfaces::AddressFamily address_family, - net::AddressFamily* out); -}; - -template <> struct StructTraits<net::interfaces::HostResolverRequestInfoDataView, std::unique_ptr<net::HostResolver::RequestInfo>> { static base::StringPiece host(
diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc index 35d52a2..f731201 100644 --- a/net/http/http_cache.cc +++ b/net/http/http_cache.cc
@@ -839,7 +839,8 @@ // through done_headers_queue for performance benefit. (Also, in case of // writer transaction, the consumer sometimes depend on synchronous behaviour // e.g. while computing raw headers size. (crbug.com/711766)) - if ((transaction->mode() & Transaction::WRITE) && !entry->writers) { + if ((transaction->mode() & Transaction::WRITE) && !entry->writers && + entry->readers.empty()) { AddTransactionToWriters(entry, transaction, CanTransactionJoinExistingWriters(transaction)); ProcessQueuedTransactions(entry); @@ -1095,7 +1096,10 @@ } else { // no writing in progress if (transaction->mode() & Transaction::WRITE) { if (transaction->partial()) { - AddTransactionToWriters(entry, transaction, parallel_writing_pattern); + if (entry->readers.empty()) + AddTransactionToWriters(entry, transaction, parallel_writing_pattern); + else + return; } else { // Add the transaction to readers since the response body should have // already been written. (If it was the first writer about to start
diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc index fb2773f..f834fa62 100644 --- a/net/http/http_cache_unittest.cc +++ b/net/http/http_cache_unittest.cc
@@ -1841,6 +1841,50 @@ histogram_name, static_cast<int>(HttpCache::PARALLEL_WRITING_CREATE), 2); } +// Tests that a request does not create Writers when readers is not empty. +TEST(HttpCache, RangeGET_DoNotCreateWritersWhenReaderExists) { + MockHttpCache cache; + + // Save a request in the cache so that the next request can become a + // reader. + MockTransaction transaction(kRangeGET_Transaction); + transaction.request_headers = EXTRA_HEADER; + AddMockTransaction(&transaction); + RunTransactionTest(cache.http_cache(), transaction); + + // Let this request be a reader since it doesn't need validation as per its + // load flag. + transaction.load_flags |= LOAD_SKIP_CACHE_VALIDATION; + MockHttpRequest request(transaction); + Context context; + context.result = cache.CreateTransaction(&context.trans); + ASSERT_THAT(context.result, IsOk()); + context.result = context.trans->Start(&request, context.callback.callback(), + NetLogWithSource()); + base::RunLoop().RunUntilIdle(); + EXPECT_EQ(1, cache.GetCountReaders(transaction.url)); + RemoveMockTransaction(&transaction); + + // A range request should now "not" create Writers while readers is still + // non-empty. + MockTransaction range_transaction(kRangeGET_Transaction); + range_transaction.request_headers = "Range: bytes = 0-9\r\n" EXTRA_HEADER; + AddMockTransaction(&range_transaction); + MockHttpRequest range_request(range_transaction); + Context range_context; + range_context.result = cache.CreateTransaction(&range_context.trans); + ASSERT_THAT(range_context.result, IsOk()); + range_context.result = range_context.trans->Start( + &range_request, range_context.callback.callback(), NetLogWithSource()); + base::RunLoop().RunUntilIdle(); + + EXPECT_EQ(1, cache.GetCountReaders(transaction.url)); + EXPECT_FALSE(cache.IsWriterPresent(transaction.url)); + EXPECT_EQ(1, cache.GetCountDoneHeadersQueue(transaction.url)); + + RemoveMockTransaction(&range_transaction); +} + // Tests parallel validation on range requests can be successfully restarted // when there is a cache lock timeout. TEST(HttpCache, RangeGET_ParallelValidationCacheLockTimeout) {
diff --git a/net/http/http_stream_factory_impl_job.cc b/net/http/http_stream_factory_impl_job.cc index 9dfc650..91f5487 100644 --- a/net/http/http_stream_factory_impl_job.cc +++ b/net/http/http_stream_factory_impl_job.cc
@@ -1106,7 +1106,7 @@ // Quic session is closed before stream can be created. return ERR_CONNECTION_CLOSED; } - stream_.reset(new QuicHttpStream(std::move(session))); + stream_ = std::make_unique<QuicHttpStream>(std::move(session)); } next_state_ = STATE_NONE; return OK;
diff --git a/net/interfaces/BUILD.gn b/net/interfaces/BUILD.gn index 07782465..e4b2dccd 100644 --- a/net/interfaces/BUILD.gn +++ b/net/interfaces/BUILD.gn
@@ -6,6 +6,7 @@ mojom("interfaces") { sources = [ + "address_family.mojom", "host_resolver_service.mojom", "ip_address.mojom", "ip_endpoint.mojom",
diff --git a/net/interfaces/address_family.mojom b/net/interfaces/address_family.mojom new file mode 100644 index 0000000..ec011f187 --- /dev/null +++ b/net/interfaces/address_family.mojom
@@ -0,0 +1,12 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module net.interfaces; + +// Mirror of net::AddressFamily. +enum AddressFamily { + UNSPECIFIED, + IPV4, + IPV6, +};
diff --git a/net/interfaces/address_family.typemap b/net/interfaces/address_family.typemap new file mode 100644 index 0000000..89e9459 --- /dev/null +++ b/net/interfaces/address_family.typemap
@@ -0,0 +1,14 @@ +# Copyright 2017 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +mojom = "//net/interfaces/address_family.mojom" +public_headers = [ "//net/base/address_family.h" ] +traits_headers = [ "//net/interfaces/address_family_traits.h" ] +sources = [ + "//net/interfaces/address_family_traits.cc", +] +type_mappings = [ "net.interfaces.AddressFamily=net::AddressFamily" ] +public_deps = [ + "//net", +]
diff --git a/net/interfaces/address_family_traits.cc b/net/interfaces/address_family_traits.cc new file mode 100644 index 0000000..efb947d --- /dev/null +++ b/net/interfaces/address_family_traits.cc
@@ -0,0 +1,45 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "net/interfaces/address_family_traits.h" + +namespace mojo { + +// static +bool EnumTraits<net::interfaces::AddressFamily, net::AddressFamily>::FromMojom( + net::interfaces::AddressFamily address_family, + net::AddressFamily* out) { + using net::interfaces::AddressFamily; + switch (address_family) { + case AddressFamily::UNSPECIFIED: + *out = net::ADDRESS_FAMILY_UNSPECIFIED; + return true; + case AddressFamily::IPV4: + *out = net::ADDRESS_FAMILY_IPV4; + return true; + case AddressFamily::IPV6: + *out = net::ADDRESS_FAMILY_IPV6; + return true; + } + return false; +} + +// static +net::interfaces::AddressFamily +EnumTraits<net::interfaces::AddressFamily, net::AddressFamily>::ToMojom( + net::AddressFamily address_family) { + using net::interfaces::AddressFamily; + switch (address_family) { + case net::ADDRESS_FAMILY_UNSPECIFIED: + return AddressFamily::UNSPECIFIED; + case net::ADDRESS_FAMILY_IPV4: + return AddressFamily::IPV4; + case net::ADDRESS_FAMILY_IPV6: + return AddressFamily::IPV6; + } + NOTREACHED(); + return AddressFamily::UNSPECIFIED; +} + +} // namespace mojo
diff --git a/net/interfaces/address_family_traits.h b/net/interfaces/address_family_traits.h new file mode 100644 index 0000000..875b779 --- /dev/null +++ b/net/interfaces/address_family_traits.h
@@ -0,0 +1,23 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef NET_INTERFACES_ADDRESS_FAMILY_TRAITS_H_ +#define NET_INTERFACES_ADDRESS_FAMILY_TRAITS_H_ + +#include "mojo/public/cpp/bindings/enum_traits.h" +#include "net/interfaces/address_family.mojom.h" + +namespace mojo { + +template <> +struct EnumTraits<net::interfaces::AddressFamily, net::AddressFamily> { + static net::interfaces::AddressFamily ToMojom( + net::AddressFamily address_family); + static bool FromMojom(net::interfaces::AddressFamily address_family, + net::AddressFamily* out); +}; + +} // namespace mojo + +#endif // NET_INTERFACES_ADDRESS_FAMILY_TRAITS_H_
diff --git a/net/interfaces/host_resolver.typemap b/net/interfaces/host_resolver.typemap index 25d0121..c0f559c 100644 --- a/net/interfaces/host_resolver.typemap +++ b/net/interfaces/host_resolver.typemap
@@ -11,7 +11,6 @@ type_mappings = [ "net.interfaces.HostResolverRequestInfo=std::unique_ptr<net::HostResolver::RequestInfo>[move_only]", "net.interfaces.AddressList=net::AddressList", - "net.interfaces.AddressFamily=net::AddressFamily", ] public_deps = [ "//net",
diff --git a/net/interfaces/host_resolver_service.mojom b/net/interfaces/host_resolver_service.mojom index 1c36489a..4a5e030 100644 --- a/net/interfaces/host_resolver_service.mojom +++ b/net/interfaces/host_resolver_service.mojom
@@ -13,13 +13,7 @@ module net.interfaces; import "net/interfaces/ip_endpoint.mojom"; - -// Mirror of net::AddressFamily. -enum AddressFamily { - UNSPECIFIED, - IPV4, - IPV6, -}; +import "net/interfaces/address_family.mojom"; // Mirror of net::HostResolver::RequestInfo. struct HostResolverRequestInfo {
diff --git a/net/interfaces/typemaps.gni b/net/interfaces/typemaps.gni index 4932e71..b36db710 100644 --- a/net/interfaces/typemaps.gni +++ b/net/interfaces/typemaps.gni
@@ -3,6 +3,7 @@ # found in the LICENSE file. typemaps = [ + "//net/interfaces/address_family.typemap", "//net/interfaces/host_resolver.typemap", "//net/interfaces/ip_address.typemap", "//net/interfaces/ip_endpoint.typemap",
diff --git a/net/proxy/proxy_config_service_linux.cc b/net/proxy/proxy_config_service_linux.cc index 55e879a7..bd7bce5 100644 --- a/net/proxy/proxy_config_service_linux.cc +++ b/net/proxy/proxy_config_service_linux.cc
@@ -1155,6 +1155,7 @@ : env_var_getter_(std::move(env_var_getter)) { // Figure out which SettingGetterImpl to use, if any. switch (base::nix::GetDesktopEnvironment(env_var_getter_.get())) { + case base::nix::DESKTOP_ENVIRONMENT_CINNAMON: case base::nix::DESKTOP_ENVIRONMENT_GNOME: case base::nix::DESKTOP_ENVIRONMENT_PANTHEON: case base::nix::DESKTOP_ENVIRONMENT_UNITY:
diff --git a/net/quic/chromium/bidirectional_stream_quic_impl_unittest.cc b/net/quic/chromium/bidirectional_stream_quic_impl_unittest.cc index ea01359..f480055c3 100644 --- a/net/quic/chromium/bidirectional_stream_quic_impl_unittest.cc +++ b/net/quic/chromium/bidirectional_stream_quic_impl_unittest.cc
@@ -411,7 +411,8 @@ &clock_, kDefaultServerHostName, Perspective::IS_SERVER), - random_generator_(0) { + random_generator_(0), + destination_(kDefaultServerHostName, kDefaultServerPort) { IPAddress ip(192, 0, 2, 33); peer_addr_ = IPEndPoint(ip, 443); self_addr_ = IPEndPoint(ip, 8435); @@ -776,6 +777,7 @@ std::unique_ptr<StaticSocketDataProvider> socket_data_; std::vector<PacketToWrite> writes_; QuicClientPushPromiseIndex push_promise_index_; + HostPortPair destination_; }; INSTANTIATE_TEST_CASE_P(Version, @@ -804,7 +806,8 @@ std::unique_ptr<TestDelegateBase> delegate( new TestDelegateBase(read_buffer.get(), kReadBufferSize)); delegate->set_trailers_expected(true); - delegate->Start(&request, net_log().bound(), session()->CreateHandle()); + delegate->Start(&request, net_log().bound(), + session()->CreateHandle(destination_)); delegate->WaitUntilNextCallback(kOnStreamReady); ConfirmHandshake(); @@ -905,13 +908,15 @@ scoped_refptr<IOBuffer> read_buffer(new IOBuffer(kReadBufferSize)); std::unique_ptr<TestDelegateBase> delegate( new TestDelegateBase(read_buffer.get(), kReadBufferSize)); - delegate->Start(&request, net_log().bound(), session()->CreateHandle()); + delegate->Start(&request, net_log().bound(), + session()->CreateHandle(destination_)); // Start second request. scoped_refptr<IOBuffer> read_buffer2(new IOBuffer(kReadBufferSize)); std::unique_ptr<TestDelegateBase> delegate2( new TestDelegateBase(read_buffer2.get(), kReadBufferSize)); - delegate2->Start(&request, net_log().bound(), session()->CreateHandle()); + delegate2->Start(&request, net_log().bound(), + session()->CreateHandle(destination_)); delegate->WaitUntilNextCallback(kOnStreamReady); delegate2->WaitUntilNextCallback(kOnStreamReady); @@ -994,7 +999,8 @@ std::unique_ptr<TestDelegateBase> delegate( new TestDelegateBase(read_buffer.get(), kReadBufferSize)); delegate->DoNotSendRequestHeadersAutomatically(); - delegate->Start(&request, net_log().bound(), session()->CreateHandle()); + delegate->Start(&request, net_log().bound(), + session()->CreateHandle(destination_)); EXPECT_FALSE(delegate->is_ready()); ConfirmHandshake(); delegate->WaitUntilNextCallback(kOnStreamReady); @@ -1101,7 +1107,8 @@ std::unique_ptr<TestDelegateBase> delegate( new TestDelegateBase(read_buffer.get(), kReadBufferSize)); delegate->DoNotSendRequestHeadersAutomatically(); - delegate->Start(&request, net_log().bound(), session()->CreateHandle()); + delegate->Start(&request, net_log().bound(), + session()->CreateHandle(destination_)); ConfirmHandshake(); delegate->WaitUntilNextCallback(kOnStreamReady); @@ -1208,7 +1215,8 @@ std::unique_ptr<TestDelegateBase> delegate( new TestDelegateBase(read_buffer.get(), kReadBufferSize)); delegate->DoNotSendRequestHeadersAutomatically(); - delegate->Start(&request, net_log().bound(), session()->CreateHandle()); + delegate->Start(&request, net_log().bound(), + session()->CreateHandle(destination_)); ConfirmHandshake(); delegate->WaitUntilNextCallback(kOnStreamReady); @@ -1300,7 +1308,8 @@ std::unique_ptr<DeleteStreamDelegate> delegate(new DeleteStreamDelegate( read_buffer.get(), kReadBufferSize, DeleteStreamDelegate::ON_FAILED)); delegate->DoNotSendRequestHeadersAutomatically(); - delegate->Start(&request, net_log().bound(), session()->CreateHandle()); + delegate->Start(&request, net_log().bound(), + session()->CreateHandle(destination_)); ConfirmHandshake(); delegate->WaitUntilNextCallback(kOnStreamReady); @@ -1333,7 +1342,8 @@ std::unique_ptr<DeleteStreamDelegate> delegate(new DeleteStreamDelegate( read_buffer.get(), kReadBufferSize, DeleteStreamDelegate::ON_FAILED)); delegate->DoNotSendRequestHeadersAutomatically(); - delegate->Start(&request, net_log().bound(), session()->CreateHandle()); + delegate->Start(&request, net_log().bound(), + session()->CreateHandle(destination_)); ConfirmHandshake(); delegate->WaitUntilNextCallback(kOnStreamReady); @@ -1371,7 +1381,8 @@ scoped_refptr<IOBuffer> read_buffer(new IOBuffer(kReadBufferSize)); std::unique_ptr<TestDelegateBase> delegate( new TestDelegateBase(read_buffer.get(), kReadBufferSize)); - delegate->Start(&request, net_log().bound(), session()->CreateHandle()); + delegate->Start(&request, net_log().bound(), + session()->CreateHandle(destination_)); ConfirmHandshake(); delegate->WaitUntilNextCallback(kOnStreamReady); @@ -1449,7 +1460,8 @@ scoped_refptr<IOBuffer> read_buffer(new IOBuffer(kReadBufferSize)); std::unique_ptr<TestDelegateBase> delegate( new TestDelegateBase(read_buffer.get(), kReadBufferSize)); - delegate->Start(&request, net_log().bound(), session()->CreateHandle()); + delegate->Start(&request, net_log().bound(), + session()->CreateHandle(destination_)); delegate->WaitUntilNextCallback(kOnStreamReady); // Send a DATA frame. @@ -1530,7 +1542,8 @@ scoped_refptr<IOBuffer> read_buffer(new IOBuffer(kReadBufferSize)); std::unique_ptr<TestDelegateBase> delegate( new TestDelegateBase(read_buffer.get(), kReadBufferSize)); - delegate->Start(&request, net_log().bound(), session()->CreateHandle()); + delegate->Start(&request, net_log().bound(), + session()->CreateHandle(destination_)); ConfirmHandshake(); delegate->WaitUntilNextCallback(kOnStreamReady); @@ -1613,7 +1626,8 @@ scoped_refptr<IOBuffer> read_buffer(new IOBuffer(kReadBufferSize)); std::unique_ptr<TestDelegateBase> delegate( new TestDelegateBase(read_buffer.get(), kReadBufferSize)); - delegate->Start(&request, net_log().bound(), session()->CreateHandle()); + delegate->Start(&request, net_log().bound(), + session()->CreateHandle(destination_)); delegate->WaitUntilNextCallback(kOnStreamReady); ConfirmHandshake(); @@ -1658,7 +1672,8 @@ scoped_refptr<IOBuffer> read_buffer(new IOBuffer(kReadBufferSize)); std::unique_ptr<TestDelegateBase> delegate( new TestDelegateBase(read_buffer.get(), kReadBufferSize)); - delegate->Start(&request, net_log().bound(), session()->CreateHandle()); + delegate->Start(&request, net_log().bound(), + session()->CreateHandle(destination_)); delegate->WaitUntilNextCallback(kOnStreamReady); ConfirmHandshake(); @@ -1716,7 +1731,8 @@ scoped_refptr<IOBuffer> read_buffer(new IOBuffer(kReadBufferSize)); std::unique_ptr<TestDelegateBase> delegate( new TestDelegateBase(read_buffer.get(), kReadBufferSize)); - delegate->Start(&request, net_log().bound(), session()->CreateHandle()); + delegate->Start(&request, net_log().bound(), + session()->CreateHandle(destination_)); ConfirmHandshake(); delegate->WaitUntilNextCallback(kOnStreamReady); @@ -1773,7 +1789,8 @@ scoped_refptr<IOBuffer> read_buffer(new IOBuffer(kReadBufferSize)); std::unique_ptr<TestDelegateBase> delegate( new TestDelegateBase(read_buffer.get(), kReadBufferSize)); - delegate->Start(&request, net_log().bound(), session()->CreateHandle()); + delegate->Start(&request, net_log().bound(), + session()->CreateHandle(destination_)); delegate->WaitUntilNextCallback(kOnFailed); EXPECT_TRUE(delegate->on_failed_called()); EXPECT_THAT(delegate->error(), IsError(ERR_CONNECTION_CLOSED)); @@ -1795,7 +1812,8 @@ scoped_refptr<IOBuffer> read_buffer(new IOBuffer(kReadBufferSize)); std::unique_ptr<TestDelegateBase> delegate( new TestDelegateBase(read_buffer.get(), kReadBufferSize)); - delegate->Start(&request, net_log().bound(), session()->CreateHandle()); + delegate->Start(&request, net_log().bound(), + session()->CreateHandle(destination_)); delegate->WaitUntilNextCallback(kOnFailed); EXPECT_TRUE(delegate->on_failed_called()); EXPECT_THAT(delegate->error(), IsError(ERR_QUIC_HANDSHAKE_FAILED)); @@ -1818,7 +1836,8 @@ scoped_refptr<IOBuffer> read_buffer(new IOBuffer(kReadBufferSize)); std::unique_ptr<DeleteStreamDelegate> delegate(new DeleteStreamDelegate( read_buffer.get(), kReadBufferSize, DeleteStreamDelegate::ON_FAILED)); - delegate->Start(&request, net_log().bound(), session()->CreateHandle()); + delegate->Start(&request, net_log().bound(), + session()->CreateHandle(destination_)); ConfirmHandshake(); delegate->WaitUntilNextCallback(kOnFailed); @@ -1848,7 +1867,8 @@ std::unique_ptr<DeleteStreamDelegate> delegate( new DeleteStreamDelegate(read_buffer.get(), kReadBufferSize, DeleteStreamDelegate::ON_STREAM_READY)); - delegate->Start(&request, net_log().bound(), session()->CreateHandle()); + delegate->Start(&request, net_log().bound(), + session()->CreateHandle(destination_)); ConfirmHandshake(); delegate->WaitUntilNextCallback(kOnStreamReady); @@ -1877,7 +1897,8 @@ scoped_refptr<IOBuffer> read_buffer(new IOBuffer(kReadBufferSize)); std::unique_ptr<TestDelegateBase> delegate( new TestDelegateBase(read_buffer.get(), kReadBufferSize)); - delegate->Start(&request, net_log().bound(), session()->CreateHandle()); + delegate->Start(&request, net_log().bound(), + session()->CreateHandle(destination_)); ConfirmHandshake(); delegate->WaitUntilNextCallback(kOnStreamReady); @@ -1932,7 +1953,8 @@ std::unique_ptr<DeleteStreamDelegate> delegate( new DeleteStreamDelegate(read_buffer.get(), kReadBufferSize, DeleteStreamDelegate::ON_HEADERS_RECEIVED)); - delegate->Start(&request, net_log().bound(), session()->CreateHandle()); + delegate->Start(&request, net_log().bound(), + session()->CreateHandle(destination_)); ConfirmHandshake(); delegate->WaitUntilNextCallback(kOnStreamReady); @@ -1978,7 +2000,8 @@ scoped_refptr<IOBuffer> read_buffer(new IOBuffer(kReadBufferSize)); std::unique_ptr<DeleteStreamDelegate> delegate(new DeleteStreamDelegate( read_buffer.get(), kReadBufferSize, DeleteStreamDelegate::ON_DATA_READ)); - delegate->Start(&request, net_log().bound(), session()->CreateHandle()); + delegate->Start(&request, net_log().bound(), + session()->CreateHandle(destination_)); ConfirmHandshake(); delegate->WaitUntilNextCallback(kOnStreamReady); @@ -2037,7 +2060,8 @@ std::unique_ptr<TestDelegateBase> delegate( new TestDelegateBase(read_buffer.get(), kReadBufferSize)); - delegate->Start(&request, net_log().bound(), session()->CreateHandle()); + delegate->Start(&request, net_log().bound(), + session()->CreateHandle(destination_)); ConfirmHandshake(); delegate->WaitUntilNextCallback(kOnStreamReady); @@ -2099,7 +2123,8 @@ std::unique_ptr<DeleteStreamDelegate> delegate( new DeleteStreamDelegate(read_buffer.get(), kReadBufferSize, DeleteStreamDelegate::ON_TRAILERS_RECEIVED)); - delegate->Start(&request, net_log().bound(), session()->CreateHandle()); + delegate->Start(&request, net_log().bound(), + session()->CreateHandle(destination_)); delegate->WaitUntilNextCallback(kOnStreamReady); // Server acks the request. @@ -2167,7 +2192,8 @@ delegate->set_trailers_expected(true); // QuicChromiumClientSession::Handle::RequestStream() returns OK synchronously // because Initialize() has established a Session. - delegate->Start(&request, net_log().bound(), session()->CreateHandle()); + delegate->Start(&request, net_log().bound(), + session()->CreateHandle(destination_)); // Now closes the underlying session. session_->CloseSessionOnError(ERR_ABORTED, QUIC_INTERNAL_ERROR); delegate->WaitUntilNextCallback(kOnFailed);
diff --git a/net/quic/chromium/quic_chromium_client_session.cc b/net/quic/chromium/quic_chromium_client_session.cc index 9aef26ae..7f72e0c 100644 --- a/net/quic/chromium/quic_chromium_client_session.cc +++ b/net/quic/chromium/quic_chromium_client_session.cc
@@ -245,9 +245,11 @@ } // namespace QuicChromiumClientSession::Handle::Handle( - const base::WeakPtr<QuicChromiumClientSession>& session) + const base::WeakPtr<QuicChromiumClientSession>& session, + const HostPortPair& destination) : MultiplexedSessionHandle(session), session_(session), + destination_(destination), net_log_(session_->net_log()), was_handshake_confirmed_(session->IsCryptoHandshakeConfirmed()), net_error_(OK), @@ -928,11 +930,6 @@ } int QuicChromiumClientSession::TryCreateStream(StreamRequest* request) { - if (stream_factory_ && stream_factory_->IsQuicBroken(this)) { - DVLOG(1) << "QUIC broken."; - return ERR_QUIC_PROTOCOL_ERROR; - } - if (goaway_received()) { DVLOG(1) << "Going away."; return ERR_CONNECTION_CLOSED; @@ -2312,9 +2309,9 @@ } std::unique_ptr<QuicChromiumClientSession::Handle> -QuicChromiumClientSession::CreateHandle() { +QuicChromiumClientSession::CreateHandle(const HostPortPair& destination) { return std::make_unique<QuicChromiumClientSession::Handle>( - weak_factory_.GetWeakPtr()); + weak_factory_.GetWeakPtr(), destination); } void QuicChromiumClientSession::OnReadError(
diff --git a/net/quic/chromium/quic_chromium_client_session.h b/net/quic/chromium/quic_chromium_client_session.h index 0920f4ee..5c9bcb16 100644 --- a/net/quic/chromium/quic_chromium_client_session.h +++ b/net/quic/chromium/quic_chromium_client_session.h
@@ -104,7 +104,10 @@ : public MultiplexedSessionHandle, public QuicClientPushPromiseIndex::Delegate { public: - explicit Handle(const base::WeakPtr<QuicChromiumClientSession>& session); + // Constructs a handle to |session| which was created via the alternative + // server |destination|. + Handle(const base::WeakPtr<QuicChromiumClientSession>& session, + const HostPortPair& destination); Handle(const Handle& other) = delete; ~Handle() override; @@ -178,6 +181,9 @@ // Returns the session's server ID. QuicServerId server_id() const { return server_id_; } + // Returns the alternative server used for this session. + HostPortPair destination() const { return destination_; } + // Returns the session's net log. const NetLogWithSource& net_log() const { return net_log_; } @@ -226,6 +232,8 @@ // Underlying session which may be destroyed before this handle. base::WeakPtr<QuicChromiumClientSession> session_; + HostPortPair destination_; + // Stream request created by |RequestStream()|. std::unique_ptr<StreamRequest> stream_request_; @@ -470,7 +478,8 @@ const NetLogWithSource& net_log() const { return net_log_; } // Returns a Handle to this session. - std::unique_ptr<QuicChromiumClientSession::Handle> CreateHandle(); + std::unique_ptr<QuicChromiumClientSession::Handle> CreateHandle( + const HostPortPair& destination); // Returns the number of client hello messages that have been sent on the // crypto stream. If the handshake has completed then this is one greater
diff --git a/net/quic/chromium/quic_chromium_client_session_test.cc b/net/quic/chromium/quic_chromium_client_session_test.cc index 681c0ea8..a74031f 100644 --- a/net/quic/chromium/quic_chromium_client_session_test.cc +++ b/net/quic/chromium/quic_chromium_client_session_test.cc
@@ -91,6 +91,7 @@ random_(0), helper_(&clock_, &random_), server_id_(kServerHostname, kServerPort, PRIVACY_MODE_DISABLED), + destination_(kServerHostname, kServerPort), client_maker_(GetParam(), 0, &clock_, @@ -198,6 +199,7 @@ MockCryptoClientStreamFactory crypto_client_stream_factory_; QuicClientPushPromiseIndex push_promise_index_; QuicServerId server_id_; + HostPortPair destination_; std::unique_ptr<TestingQuicChromiumClientSession> session_; TestServerPushDelegate test_push_delegate_; QuicConnectionVisitorInterface* visitor_; @@ -284,7 +286,7 @@ EXPECT_EQ(&net_log_, session_net_log.net_log()); std::unique_ptr<QuicChromiumClientSession::Handle> handle = - session_->CreateHandle(); + session_->CreateHandle(destination_); EXPECT_TRUE(handle->IsConnected()); EXPECT_FALSE(handle->IsCryptoHandshakeConfirmed()); EXPECT_EQ(GetParam(), handle->GetQuicVersion()); @@ -326,7 +328,7 @@ { // Verify that CreateHandle() works even after the session is closed. std::unique_ptr<QuicChromiumClientSession::Handle> handle2 = - session_->CreateHandle(); + session_->CreateHandle(destination_); EXPECT_FALSE(handle2->IsConnected()); EXPECT_TRUE(handle2->IsCryptoHandshakeConfirmed()); ASSERT_EQ(ERR_CONNECTION_CLOSED, @@ -364,7 +366,7 @@ // Request a stream and verify that a stream was created. std::unique_ptr<QuicChromiumClientSession::Handle> handle = - session_->CreateHandle(); + session_->CreateHandle(destination_); TestCompletionCallback callback; ASSERT_EQ(OK, handle->RequestStream(/*requires_confirmation=*/false, callback.callback())); @@ -387,7 +389,7 @@ // Request a stream and verify that a stream was created. std::unique_ptr<QuicChromiumClientSession::Handle> handle = - session_->CreateHandle(); + session_->CreateHandle(destination_); TestCompletionCallback callback; ASSERT_EQ(OK, handle->RequestStream(/*requires_confirmation=*/true, callback.callback())); @@ -409,7 +411,7 @@ // Request a stream and verify that a stream was created. std::unique_ptr<QuicChromiumClientSession::Handle> handle = - session_->CreateHandle(); + session_->CreateHandle(destination_); TestCompletionCallback callback; ASSERT_EQ(ERR_IO_PENDING, handle->RequestStream(/*requires_confirmation=*/true, @@ -440,7 +442,7 @@ // Request a stream and cancel it without releasing the stream. std::unique_ptr<QuicChromiumClientSession::Handle> handle = - session_->CreateHandle(); + session_->CreateHandle(destination_); TestCompletionCallback callback; ASSERT_EQ(OK, handle->RequestStream(/*requires_confirmation=*/false, callback.callback())); @@ -473,7 +475,7 @@ // Request a stream and verify that it's pending. std::unique_ptr<QuicChromiumClientSession::Handle> handle = - session_->CreateHandle(); + session_->CreateHandle(destination_); TestCompletionCallback callback; ASSERT_EQ(ERR_IO_PENDING, handle->RequestStream(/*requires_confirmation=*/false, @@ -513,9 +515,9 @@ // Request two streams which will both be pending. std::unique_ptr<QuicChromiumClientSession::Handle> handle = - session_->CreateHandle(); + session_->CreateHandle(destination_); std::unique_ptr<QuicChromiumClientSession::Handle> handle2 = - session_->CreateHandle(); + session_->CreateHandle(destination_); ASSERT_EQ(ERR_IO_PENDING, handle->RequestStream( @@ -562,7 +564,7 @@ // Request a stream and verify that it's pending. std::unique_ptr<QuicChromiumClientSession::Handle> handle = - session_->CreateHandle(); + session_->CreateHandle(destination_); TestCompletionCallback callback; ASSERT_EQ(ERR_IO_PENDING, handle->RequestStream(/*requires_confirmation=*/false, @@ -597,7 +599,7 @@ // Request a stream and verify that it failed. std::unique_ptr<QuicChromiumClientSession::Handle> handle = - session_->CreateHandle(); + session_->CreateHandle(destination_); TestCompletionCallback callback; ASSERT_EQ(ERR_CONNECTION_CLOSED, handle->RequestStream(/*requires_confirmation=*/false, @@ -617,7 +619,7 @@ // Request a stream and verify that it's pending. std::unique_ptr<QuicChromiumClientSession::Handle> handle = - session_->CreateHandle(); + session_->CreateHandle(destination_); TestCompletionCallback callback; ASSERT_EQ(ERR_IO_PENDING, handle->RequestStream(/*requires_confirmation=*/true, @@ -654,7 +656,7 @@ // Request a stream and verify that it's pending. std::unique_ptr<QuicChromiumClientSession::Handle> handle = - session_->CreateHandle(); + session_->CreateHandle(destination_); TestCompletionCallback callback; ASSERT_EQ(ERR_IO_PENDING, handle->RequestStream(/*requires_confirmation=*/false, @@ -992,7 +994,7 @@ } std::unique_ptr<QuicChromiumClientSession::Handle> handle = - session_->CreateHandle(); + session_->CreateHandle(destination_); TestCompletionCallback callback; ASSERT_EQ(ERR_IO_PENDING, handle->RequestStream(/*requires_confirmation=*/false,
diff --git a/net/quic/chromium/quic_http_stream.cc b/net/quic/chromium/quic_http_stream.cc index 30d86aa..826f4e96 100644 --- a/net/quic/chromium/quic_http_stream.cc +++ b/net/quic/chromium/quic_http_stream.cc
@@ -383,8 +383,9 @@ bool QuicHttpStream::GetAlternativeService( AlternativeService* alternative_service) const { alternative_service->protocol = kProtoQUIC; - alternative_service->host = quic_session()->server_id().host(); - alternative_service->port = quic_session()->server_id().port(); + const HostPortPair& destination = quic_session()->destination(); + alternative_service->host = destination.host(); + alternative_service->port = destination.port(); return true; } @@ -515,6 +516,7 @@ int QuicHttpStream::DoRequestStream() { next_state_ = STATE_REQUEST_STREAM_COMPLETE; + return quic_session()->RequestStream( request_info_->method == "POST", base::Bind(&QuicHttpStream::OnIOComplete, weak_factory_.GetWeakPtr())); @@ -553,6 +555,7 @@ // Set priority according to request DCHECK(stream_); DCHECK(response_info_); + SpdyPriority priority = ConvertRequestPriorityToQuicPriority(priority_); stream_->SetPriority(priority); next_state_ = STATE_SEND_HEADERS;
diff --git a/net/quic/chromium/quic_http_stream_test.cc b/net/quic/chromium/quic_http_stream_test.cc index fc4ee2f..2c34fff1 100644 --- a/net/quic/chromium/quic_http_stream_test.cc +++ b/net/quic/chromium/quic_http_stream_test.cc
@@ -318,9 +318,10 @@ TestCompletionCallback callback; session_->CryptoConnect(callback.callback()); - stream_.reset(new QuicHttpStream(session_->CreateHandle())); - promised_stream_.reset(new QuicHttpStream(session_->CreateHandle())); - + stream_ = std::make_unique<QuicHttpStream>( + session_->CreateHandle(HostPortPair("www.example.org", 443))); + promised_stream_ = std::make_unique<QuicHttpStream>( + session_->CreateHandle(HostPortPair("www.example.org", 443))); push_promise_[":path"] = "/bar"; push_promise_[":authority"] = "www.example.org"; push_promise_[":version"] = "HTTP/1.1"; @@ -702,7 +703,8 @@ stream_->SendRequest(headers_, &response_, callback_.callback())); // Start a second request. - QuicHttpStream stream2(session_->CreateHandle()); + QuicHttpStream stream2( + session_->CreateHandle(HostPortPair("www.example.org", 443))); TestCompletionCallback callback2; EXPECT_EQ(OK, stream2.InitializeStream(&request_, DEFAULT_PRIORITY,
diff --git a/net/quic/chromium/quic_network_transaction_unittest.cc b/net/quic/chromium/quic_network_transaction_unittest.cc index 253796b..f66ee474 100644 --- a/net/quic/chromium/quic_network_transaction_unittest.cc +++ b/net/quic/chromium/quic_network_transaction_unittest.cc
@@ -1971,6 +1971,12 @@ quic_data.AddWrite(client_maker_.MakeDataPacket( 10, kHeadersStreamId, true, false, settings_offset, settings_data)); + if (FLAGS_quic_reloadable_flag_quic_explicit_close_after_tlp) { + quic_data.AddWrite(client_maker_.MakeAckAndConnectionClosePacket( + 11, true, QuicTime::Delta::Infinite(), 0, 1, 1, + QUIC_NETWORK_IDLE_TIMEOUT, "No recent network activity.")); + } + quic_data.AddRead(ASYNC, ERR_IO_PENDING); quic_data.AddRead(ASYNC, OK); quic_data.AddSocketDataToFactory(&socket_factory_); @@ -2328,6 +2334,12 @@ quic_data.AddWrite(client_maker_.MakeDataPacket( 10, kHeadersStreamId, true, false, settings_offset, settings_data)); + if (FLAGS_quic_reloadable_flag_quic_explicit_close_after_tlp) { + quic_data.AddWrite(client_maker_.MakeAckAndConnectionClosePacket( + 11, true, QuicTime::Delta::Infinite(), 0, 1, 1, + QUIC_NETWORK_IDLE_TIMEOUT, "No recent network activity.")); + } + quic_data.AddRead(ASYNC, ERR_IO_PENDING); quic_data.AddRead(ASYNC, OK); quic_data.AddSocketDataToFactory(&socket_factory_); @@ -2445,6 +2457,12 @@ quic_data.AddWrite(client_maker_.MakeDataPacket( 10, kHeadersStreamId, true, false, settings_offset, settings_data)); + if (FLAGS_quic_reloadable_flag_quic_explicit_close_after_tlp) { + quic_data.AddWrite(client_maker_.MakeAckAndConnectionClosePacket( + 11, true, QuicTime::Delta::Infinite(), 0, 1, 1, + QUIC_NETWORK_IDLE_TIMEOUT, "No recent network activity.")); + } + quic_data.AddRead(ASYNC, ERR_IO_PENDING); quic_data.AddRead(ASYNC, OK); quic_data.AddSocketDataToFactory(&socket_factory_); @@ -2573,6 +2591,12 @@ quic_data.AddWrite(client_maker_.MakeDataPacket( 11, kHeadersStreamId, false, false, settings_offset, settings_data)); + if (FLAGS_quic_reloadable_flag_quic_explicit_close_after_tlp) { + quic_data.AddWrite(client_maker_.MakeAckAndConnectionClosePacket( + 12, false, QuicTime::Delta::FromMilliseconds(4200), 1, 1, 1, + QUIC_NETWORK_IDLE_TIMEOUT, "No recent network activity.")); + } + quic_data.AddRead(ASYNC, ERR_IO_PENDING); quic_data.AddRead(ASYNC, OK); quic_data.AddSocketDataToFactory(&socket_factory_); @@ -3045,6 +3069,72 @@ ASSERT_TRUE(http_data.AllReadDataConsumed()); } +// Verify that when an origin has two alt-svc advertisements, one local and one +// remote, that when the local is broken the request will go over QUIC via +// the remote Alt-Svc. +// This is a regression test for crbug/825646. +TEST_P(QuicNetworkTransactionTest, RemoteAltSvcWorkingWhileLocalAltSvcBroken) { + session_params_.quic_allow_remote_alt_svc = true; + + GURL origin1 = request_.url; // mail.example.org + GURL origin2("https://www.example.org/"); + ASSERT_NE(origin1.host(), origin2.host()); + + scoped_refptr<X509Certificate> cert( + ImportCertFromFile(GetTestCertsDirectory(), "wildcard.pem")); + ASSERT_TRUE(cert->VerifyNameMatch("www.example.org", false)); + ASSERT_TRUE(cert->VerifyNameMatch("mail.example.org", false)); + + ProofVerifyDetailsChromium verify_details; + verify_details.cert_verify_result.verified_cert = cert; + verify_details.cert_verify_result.is_issued_by_known_root = true; + crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); + + MockQuicData mock_quic_data; + QuicStreamOffset request_header_offset(0); + QuicStreamOffset response_header_offset(0); + mock_quic_data.AddWrite( + ConstructInitialSettingsPacket(1, &request_header_offset)); + mock_quic_data.AddWrite(ConstructClientRequestHeadersPacket( + 2, GetNthClientInitiatedStreamId(0), true, true, + GetRequestHeaders("GET", "https", "/"), &request_header_offset)); + mock_quic_data.AddRead(ConstructServerResponseHeadersPacket( + 1, GetNthClientInitiatedStreamId(0), false, false, + GetResponseHeaders("200 OK"), &response_header_offset)); + mock_quic_data.AddRead(ConstructServerDataPacket( + 2, GetNthClientInitiatedStreamId(0), false, true, 0, "hello!")); + mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1, 1)); + mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING); // No more data to read + mock_quic_data.AddRead(ASYNC, 0); // EOF + + mock_quic_data.AddSocketDataToFactory(&socket_factory_); + MockQuicData mock_quic_data2; + mock_quic_data2.AddSocketDataToFactory(&socket_factory_); + AddHangingNonAlternateProtocolSocketData(); + + CreateSession(); + + // Set up alternative service for |origin1|. + AlternativeService local_alternative(kProtoQUIC, "mail.example.org", 443); + AlternativeService remote_alternative(kProtoQUIC, "www.example.org", 443); + base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); + AlternativeServiceInfoVector alternative_services; + alternative_services.push_back( + AlternativeServiceInfo::CreateQuicAlternativeServiceInfo( + local_alternative, expiration, + session_->params().quic_supported_versions)); + alternative_services.push_back( + AlternativeServiceInfo::CreateQuicAlternativeServiceInfo( + remote_alternative, expiration, + session_->params().quic_supported_versions)); + http_server_properties_.SetAlternativeServices(url::SchemeHostPort(origin1), + alternative_services); + + http_server_properties_.MarkAlternativeServiceBroken(local_alternative); + + SendRequestAndExpectQuicResponse("hello!"); +} + // Verify that with retry_without_alt_svc_on_quic_errors enabled, if a QUIC // request is reset from, then QUIC will be marked as broken and the request // retried over TCP. Then, subsequent requests will go over a new QUIC @@ -3118,52 +3208,23 @@ socket_factory_.AddSocketDataProvider(&http_data); socket_factory_.AddSSLSocketDataProvider(&ssl_data_); - // Then the next request to the second origin will go over a new QUIC - // connection. - MockQuicData mock_quic_data2; - QuicTestPacketMaker client_maker3(version_, 0, &clock_, origin2.host(), - Perspective::IS_CLIENT); - QuicTestPacketMaker server_maker3(version_, 0, &clock_, origin2.host(), - Perspective::IS_SERVER); - QuicStreamOffset request_header_offset2(0); - QuicStreamOffset response_header_offset2(0); - - crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details); - - mock_quic_data2.AddWrite( - client_maker3.MakeInitialSettingsPacket(1, &request_header_offset2)); - mock_quic_data2.AddWrite( - client_maker3.MakeRequestHeadersPacketWithOffsetTracking( - 2, GetNthClientInitiatedStreamId(0), true, true, - ConvertRequestPriorityToQuicPriority(DEFAULT_PRIORITY), - GetRequestHeaders("GET", "https", "/", &client_maker3), - &request_header_offset2)); - mock_quic_data2.AddRead( - server_maker2.MakeResponseHeadersPacketWithOffsetTracking( - 1, GetNthClientInitiatedStreamId(0), false, false, - GetResponseHeaders("200 OK"), &response_header_offset2)); - mock_quic_data2.AddRead(server_maker2.MakeDataPacket( - 2, GetNthClientInitiatedStreamId(0), false, true, 0, "hello!")); - mock_quic_data2.AddWrite(ConstructClientAckPacket(3, 2, 1, 1)); - mock_quic_data2.AddRead(ASYNC, ERR_IO_PENDING); // No more data to read - mock_quic_data2.AddRead(ASYNC, 0); // EOF - - mock_quic_data2.AddSocketDataToFactory(&socket_factory_); + // Then the next request to the second origin will be sent over TCP. + socket_factory_.AddSocketDataProvider(&http_data); + socket_factory_.AddSSLSocketDataProvider(&ssl_data_); CreateSession(); // Set up alternative service for |origin1|. base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); + AlternativeService alternative1(kProtoQUIC, origin1.host(), 443); http_server_properties_.SetQuicAlternativeService( - url::SchemeHostPort(origin1), - AlternativeService(kProtoQUIC, "mail.example.com", 443), expiration, + url::SchemeHostPort(origin1), alternative1, expiration, supported_versions_); // Set up alternative service for |origin2|. - AlternativeServiceInfoVector alternative_services; + AlternativeService alternative2(kProtoQUIC, origin2.host(), 443); http_server_properties_.SetQuicAlternativeService( - url::SchemeHostPort(origin2), - AlternativeService(kProtoQUIC, "www.example.com", 443), expiration, + url::SchemeHostPort(origin2), alternative2, expiration, supported_versions_); // First request opens connection to |destination1| @@ -3175,10 +3236,14 @@ // After it is reset, it will fail back to QUIC and mark QUIC as broken. request_.url = origin2; SendRequestAndExpectHttpResponse("hello world"); + EXPECT_FALSE(http_server_properties_.IsAlternativeServiceBroken(alternative1)) + << alternative1.ToString(); + EXPECT_TRUE(http_server_properties_.IsAlternativeServiceBroken(alternative2)) + << alternative2.ToString(); // The third request should use a new QUIC connection, not the broken // QUIC connection. - SendRequestAndExpectQuicResponse("hello!"); + SendRequestAndExpectHttpResponse("hello world"); } TEST_P(QuicNetworkTransactionTest,
diff --git a/net/quic/chromium/quic_proxy_client_socket_unittest.cc b/net/quic/chromium/quic_proxy_client_socket_unittest.cc index a16e88d..6a45816 100644 --- a/net/quic/chromium/quic_proxy_client_socket_unittest.cc +++ b/net/quic/chromium/quic_proxy_client_socket_unittest.cc
@@ -209,7 +209,8 @@ writer->set_delegate(session_.get()); - session_handle_ = session_->CreateHandle(); + session_handle_ = + session_->CreateHandle(HostPortPair("mail.example.org", 80)); session_->Initialize(); TestCompletionCallback callback;
diff --git a/net/quic/chromium/quic_stream_factory.cc b/net/quic/chromium/quic_stream_factory.cc index 057656ea..957b720 100644 --- a/net/quic/chromium/quic_stream_factory.cc +++ b/net/quic/chromium/quic_stream_factory.cc
@@ -911,7 +911,7 @@ static_cast<QuicChromiumClientSession*>(promised->session()); DCHECK(session); if (session->server_id().privacy_mode() == server_id.privacy_mode()) { - request->SetSession(session->CreateHandle()); + request->SetSession(session->CreateHandle(destination)); ++num_push_streams_created_; return OK; } @@ -927,7 +927,7 @@ SessionMap::iterator it = active_sessions_.find(server_id); if (it != active_sessions_.end()) { QuicChromiumClientSession* session = it->second; - request->SetSession(session->CreateHandle()); + request->SetSession(session->CreateHandle(destination)); return OK; } } @@ -952,7 +952,7 @@ QuicChromiumClientSession* session = key_value.second; if (destination.Equals(all_sessions_[session].destination()) && session->CanPool(server_id.host(), server_id.privacy_mode())) { - request->SetSession(session->CreateHandle()); + request->SetSession(session->CreateHandle(destination)); return OK; } } @@ -986,7 +986,7 @@ if (it == active_sessions_.end()) return ERR_QUIC_PROTOCOL_ERROR; QuicChromiumClientSession* session = it->second; - request->SetSession(session->CreateHandle()); + request->SetSession(session->CreateHandle(destination)); } return rv; } @@ -1045,7 +1045,7 @@ QuicChromiumClientSession* session = session_it->second; for (auto* request : iter->second->stream_requests()) { // Do not notify |request| yet. - request->SetSession(session->CreateHandle()); + request->SetSession(session->CreateHandle(job->key().destination())); } } @@ -1065,19 +1065,6 @@ active_cert_verifier_jobs_.erase(job->server_id()); } -bool QuicStreamFactory::IsQuicBroken(QuicChromiumClientSession* session) { - const AlternativeService alternative_service( - kProtoQUIC, session->server_id().host_port_pair()); - if (!http_server_properties_->IsAlternativeServiceBroken( - alternative_service)) { - return false; - } - // No longer send requests to a server for which QUIC is broken, but - // continue to service existing requests. - OnSessionGoingAway(session); - return true; -} - void QuicStreamFactory::OnIdleSession(QuicChromiumClientSession* session) {} void QuicStreamFactory::OnSessionGoingAway(QuicChromiumClientSession* session) {
diff --git a/net/quic/chromium/quic_stream_factory.h b/net/quic/chromium/quic_stream_factory.h index ab71cb6..4d64ebb1 100644 --- a/net/quic/chromium/quic_stream_factory.h +++ b/net/quic/chromium/quic_stream_factory.h
@@ -253,9 +253,6 @@ // Called by a session when it becomes idle. void OnIdleSession(QuicChromiumClientSession* session); - // Returns true if QUIC is know to be broken for |session|. - bool IsQuicBroken(QuicChromiumClientSession* session); - // Called by a session when it is going away and no more streams should be // created on it. void OnSessionGoingAway(QuicChromiumClientSession* session);
diff --git a/net/quic/core/congestion_control/bbr_sender.cc b/net/quic/core/congestion_control/bbr_sender.cc index 02426f5..b33cb1c 100644 --- a/net/quic/core/congestion_control/bbr_sender.cc +++ b/net/quic/core/congestion_control/bbr_sender.cc
@@ -220,14 +220,10 @@ if (config.HasClientRequestedIndependentOption(kBBR2, perspective)) { max_aggregation_bytes_multiplier_ = 2; } - if (GetQuicReloadableFlag(quic_bbr_slower_startup) && - config.HasClientRequestedIndependentOption(kBBRS, perspective)) { - QUIC_FLAG_COUNT(quic_reloadable_flag_quic_bbr_slower_startup); + if (config.HasClientRequestedIndependentOption(kBBRS, perspective)) { slower_startup_ = true; } - if (GetQuicReloadableFlag(quic_bbr_fully_drain_queue) && - config.HasClientRequestedIndependentOption(kBBR3, perspective)) { - QUIC_FLAG_COUNT(quic_reloadable_flag_quic_bbr_fully_drain_queue); + if (config.HasClientRequestedIndependentOption(kBBR3, perspective)) { fully_drain_queue_ = true; } if (GetQuicReloadableFlag(quic_bbr_conservation_in_startup) &&
diff --git a/net/quic/core/congestion_control/bbr_sender_test.cc b/net/quic/core/congestion_control/bbr_sender_test.cc index bd5f629..a647721 100644 --- a/net/quic/core/congestion_control/bbr_sender_test.cc +++ b/net/quic/core/congestion_control/bbr_sender_test.cc
@@ -1006,7 +1006,6 @@ TEST_F(BbrSenderTest, SimpleTransferSlowerStartup) { // Adding TSO CWND causes packet loss before exiting startup. SetQuicReloadableFlag(quic_bbr_add_tso_cwnd, false); - SetQuicReloadableFlag(quic_bbr_slower_startup, true); CreateSmallBufferSetup(); SetConnectionOption(kBBRS);
diff --git a/net/quic/core/crypto/aead_base_decrypter.cc b/net/quic/core/crypto/aead_base_decrypter.cc index 5dac907..c036441c 100644 --- a/net/quic/core/crypto/aead_base_decrypter.cc +++ b/net/quic/core/crypto/aead_base_decrypter.cc
@@ -7,6 +7,7 @@ #include <cstdint> #include "net/quic/core/quic_utils.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_bug_tracker.h" #include "net/quic/platform/api/quic_logging.h" #include "third_party/boringssl/src/include/openssl/err.h" @@ -32,7 +33,7 @@ #else while (uint32_t error = ERR_get_error()) { char buf[120]; - ERR_error_string_n(error, buf, arraysize(buf)); + ERR_error_string_n(error, buf, QUIC_ARRAYSIZE(buf)); QUIC_DLOG(ERROR) << "OpenSSL error: " << buf; } #endif
diff --git a/net/quic/core/crypto/aead_base_encrypter.cc b/net/quic/core/crypto/aead_base_encrypter.cc index 2c03113..50a66166 100644 --- a/net/quic/core/crypto/aead_base_encrypter.cc +++ b/net/quic/core/crypto/aead_base_encrypter.cc
@@ -8,6 +8,7 @@ #include "net/quic/core/quic_utils.h" #include "net/quic/platform/api/quic_aligned.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_bug_tracker.h" #include "net/quic/platform/api/quic_logging.h" #include "third_party/boringssl/src/include/openssl/err.h" @@ -26,7 +27,7 @@ #else while (unsigned long error = ERR_get_error()) { char buf[120]; - ERR_error_string_n(error, buf, arraysize(buf)); + ERR_error_string_n(error, buf, QUIC_ARRAYSIZE(buf)); QUIC_DLOG(ERROR) << "OpenSSL error: " << buf; } #endif
diff --git a/net/quic/core/crypto/aes_128_gcm_12_decrypter_test.cc b/net/quic/core/crypto/aes_128_gcm_12_decrypter_test.cc index 2626cc5a..44aa748 100644 --- a/net/quic/core/crypto/aes_128_gcm_12_decrypter_test.cc +++ b/net/quic/core/crypto/aes_128_gcm_12_decrypter_test.cc
@@ -7,6 +7,7 @@ #include <memory> #include "net/quic/core/quic_utils.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_test.h" #include "net/quic/platform/api/quic_text_utils.h" #include "net/quic/test_tools/quic_test_utils.h" @@ -223,7 +224,7 @@ class Aes128Gcm12DecrypterTest : public QuicTest {}; TEST_F(Aes128Gcm12DecrypterTest, Decrypt) { - for (size_t i = 0; i < arraysize(test_group_array); i++) { + for (size_t i = 0; i < QUIC_ARRAYSIZE(test_group_array); i++) { SCOPED_TRACE(i); const TestVector* test_vectors = test_group_array[i]; const TestGroupInfo& test_info = test_group_info[i];
diff --git a/net/quic/core/crypto/aes_128_gcm_12_encrypter_test.cc b/net/quic/core/crypto/aes_128_gcm_12_encrypter_test.cc index 029a278..e51e376 100644 --- a/net/quic/core/crypto/aes_128_gcm_12_encrypter_test.cc +++ b/net/quic/core/crypto/aes_128_gcm_12_encrypter_test.cc
@@ -7,6 +7,7 @@ #include <memory> #include "net/quic/core/quic_utils.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_test.h" #include "net/quic/platform/api/quic_text_utils.h" #include "net/quic/test_tools/quic_test_utils.h" @@ -175,7 +176,7 @@ class Aes128Gcm12EncrypterTest : public QuicTest {}; TEST_F(Aes128Gcm12EncrypterTest, Encrypt) { - for (size_t i = 0; i < arraysize(test_group_array); i++) { + for (size_t i = 0; i < QUIC_ARRAYSIZE(test_group_array); i++) { SCOPED_TRACE(i); const TestVector* test_vectors = test_group_array[i]; const TestGroupInfo& test_info = test_group_info[i];
diff --git a/net/quic/core/crypto/aes_128_gcm_decrypter_test.cc b/net/quic/core/crypto/aes_128_gcm_decrypter_test.cc index f2a5efa..86474c9 100644 --- a/net/quic/core/crypto/aes_128_gcm_decrypter_test.cc +++ b/net/quic/core/crypto/aes_128_gcm_decrypter_test.cc
@@ -7,6 +7,7 @@ #include <memory> #include "net/quic/core/quic_utils.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_test.h" #include "net/quic/platform/api/quic_text_utils.h" #include "net/quic/test_tools/quic_test_utils.h" @@ -218,7 +219,7 @@ class Aes128GcmDecrypterTest : public QuicTest {}; TEST_F(Aes128GcmDecrypterTest, Decrypt) { - for (size_t i = 0; i < arraysize(test_group_array); i++) { + for (size_t i = 0; i < QUIC_ARRAYSIZE(test_group_array); i++) { SCOPED_TRACE(i); const TestVector* test_vectors = test_group_array[i]; const TestGroupInfo& test_info = test_group_info[i];
diff --git a/net/quic/core/crypto/aes_128_gcm_encrypter_test.cc b/net/quic/core/crypto/aes_128_gcm_encrypter_test.cc index 7d770fad..fb752f7 100644 --- a/net/quic/core/crypto/aes_128_gcm_encrypter_test.cc +++ b/net/quic/core/crypto/aes_128_gcm_encrypter_test.cc
@@ -7,6 +7,7 @@ #include <memory> #include "net/quic/core/quic_utils.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_test.h" #include "net/quic/platform/api/quic_text_utils.h" #include "net/quic/test_tools/quic_test_utils.h" @@ -175,7 +176,7 @@ class Aes128GcmEncrypterTest : public QuicTest {}; TEST_F(Aes128GcmEncrypterTest, Encrypt) { - for (size_t i = 0; i < arraysize(test_group_array); i++) { + for (size_t i = 0; i < QUIC_ARRAYSIZE(test_group_array); i++) { SCOPED_TRACE(i); const TestVector* test_vectors = test_group_array[i]; const TestGroupInfo& test_info = test_group_info[i];
diff --git a/net/quic/core/crypto/aes_256_gcm_decrypter_test.cc b/net/quic/core/crypto/aes_256_gcm_decrypter_test.cc index c8e09e88..c52767bb 100644 --- a/net/quic/core/crypto/aes_256_gcm_decrypter_test.cc +++ b/net/quic/core/crypto/aes_256_gcm_decrypter_test.cc
@@ -7,6 +7,7 @@ #include <memory> #include "net/quic/core/quic_utils.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_test.h" #include "net/quic/platform/api/quic_text_utils.h" #include "net/quic/test_tools/quic_test_utils.h" @@ -222,7 +223,7 @@ class Aes256GcmDecrypterTest : public QuicTest {}; TEST_F(Aes256GcmDecrypterTest, Decrypt) { - for (size_t i = 0; i < arraysize(test_group_array); i++) { + for (size_t i = 0; i < QUIC_ARRAYSIZE(test_group_array); i++) { SCOPED_TRACE(i); const TestVector* test_vectors = test_group_array[i]; const TestGroupInfo& test_info = test_group_info[i];
diff --git a/net/quic/core/crypto/aes_256_gcm_encrypter_test.cc b/net/quic/core/crypto/aes_256_gcm_encrypter_test.cc index 16683cc..cea40bd 100644 --- a/net/quic/core/crypto/aes_256_gcm_encrypter_test.cc +++ b/net/quic/core/crypto/aes_256_gcm_encrypter_test.cc
@@ -7,6 +7,7 @@ #include <memory> #include "net/quic/core/quic_utils.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_test.h" #include "net/quic/platform/api/quic_text_utils.h" #include "net/quic/test_tools/quic_test_utils.h" @@ -182,7 +183,7 @@ class Aes256GcmEncrypterTest : public QuicTest {}; TEST_F(Aes256GcmEncrypterTest, Encrypt) { - for (size_t i = 0; i < arraysize(test_group_array); i++) { + for (size_t i = 0; i < QUIC_ARRAYSIZE(test_group_array); i++) { SCOPED_TRACE(i); const TestVector* test_vectors = test_group_array[i]; const TestGroupInfo& test_info = test_group_info[i];
diff --git a/net/quic/core/crypto/chacha20_poly1305_encrypter_test.cc b/net/quic/core/crypto/chacha20_poly1305_encrypter_test.cc index 8a1e75f..e92e407 100644 --- a/net/quic/core/crypto/chacha20_poly1305_encrypter_test.cc +++ b/net/quic/core/crypto/chacha20_poly1305_encrypter_test.cc
@@ -8,6 +8,7 @@ #include "net/quic/core/crypto/chacha20_poly1305_decrypter.h" #include "net/quic/core/quic_utils.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_test.h" #include "net/quic/platform/api/quic_text_utils.h" #include "net/quic/test_tools/quic_test_utils.h" @@ -103,12 +104,12 @@ size_t len; ASSERT_TRUE(encrypter.EncryptPacket(QuicTransportVersionMax(), packet_number, associated_data, plaintext, encrypted, - &len, arraysize(encrypted))); + &len, QUIC_ARRAYSIZE(encrypted))); QuicStringPiece ciphertext(encrypted, len); char decrypted[1024]; ASSERT_TRUE(decrypter.DecryptPacket(QuicTransportVersionMax(), packet_number, associated_data, ciphertext, decrypted, - &len, arraysize(decrypted))); + &len, QUIC_ARRAYSIZE(decrypted))); } TEST_F(ChaCha20Poly1305EncrypterTest, Encrypt) {
diff --git a/net/quic/core/crypto/chacha20_poly1305_tls_encrypter_test.cc b/net/quic/core/crypto/chacha20_poly1305_tls_encrypter_test.cc index f22845f..800b400 100644 --- a/net/quic/core/crypto/chacha20_poly1305_tls_encrypter_test.cc +++ b/net/quic/core/crypto/chacha20_poly1305_tls_encrypter_test.cc
@@ -8,6 +8,7 @@ #include "net/quic/core/crypto/chacha20_poly1305_tls_decrypter.h" #include "net/quic/core/quic_utils.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_test.h" #include "net/quic/platform/api/quic_text_utils.h" #include "net/quic/test_tools/quic_test_utils.h" @@ -102,12 +103,12 @@ size_t len; ASSERT_TRUE(encrypter.EncryptPacket(QuicTransportVersionMax(), packet_number, associated_data, plaintext, encrypted, - &len, arraysize(encrypted))); + &len, QUIC_ARRAYSIZE(encrypted))); QuicStringPiece ciphertext(encrypted, len); char decrypted[1024]; ASSERT_TRUE(decrypter.DecryptPacket(QuicTransportVersionMax(), packet_number, associated_data, ciphertext, decrypted, - &len, arraysize(decrypted))); + &len, QUIC_ARRAYSIZE(decrypted))); } TEST_F(ChaCha20Poly1305TlsEncrypterTest, Encrypt) {
diff --git a/net/quic/core/crypto/common_cert_set.cc b/net/quic/core/crypto/common_cert_set.cc index 9ef68d8..83c3e97 100644 --- a/net/quic/core/crypto/common_cert_set.cc +++ b/net/quic/core/crypto/common_cert_set.cc
@@ -9,7 +9,7 @@ #include "base/macros.h" #include "base/memory/singleton.h" #include "net/quic/core/quic_utils.h" - +#include "net/quic/platform/api/quic_arraysize.h" namespace net { @@ -77,11 +77,11 @@ // CommonCertSets interface. QuicStringPiece GetCommonHashes() const override { return QuicStringPiece(reinterpret_cast<const char*>(kSetHashes), - sizeof(uint64_t) * arraysize(kSetHashes)); + sizeof(uint64_t) * QUIC_ARRAYSIZE(kSetHashes)); } QuicStringPiece GetCert(uint64_t hash, uint32_t index) const override { - for (size_t i = 0; i < arraysize(kSets); i++) { + for (size_t i = 0; i < QUIC_ARRAYSIZE(kSets); i++) { if (kSets[i].hash == hash) { if (index < kSets[i].num_certs) { return QuicStringPiece( @@ -108,7 +108,7 @@ memcpy(&hash, common_set_hashes.data() + i * sizeof(uint64_t), sizeof(uint64_t)); - for (size_t j = 0; j < arraysize(kSets); j++) { + for (size_t j = 0; j < QUIC_ARRAYSIZE(kSets); j++) { if (kSets[j].hash != hash) { continue; }
diff --git a/net/quic/core/crypto/crypto_framer_test.cc b/net/quic/core/crypto/crypto_framer_test.cc index 9d61aa4e..74691d0 100644 --- a/net/quic/core/crypto/crypto_framer_test.cc +++ b/net/quic/core/crypto/crypto_framer_test.cc
@@ -11,6 +11,7 @@ #include "net/quic/core/crypto/crypto_handshake.h" #include "net/quic/core/crypto/crypto_protocol.h" #include "net/quic/core/quic_packets.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_logging.h" #include "net/quic/platform/api/quic_test.h" #include "net/quic/test_tools/crypto_test_utils.h" @@ -92,7 +93,7 @@ ASSERT_TRUE(data.get() != nullptr); test::CompareCharArraysWithHexError("constructed packet", data->data(), data->length(), AsChars(packet), - arraysize(packet)); + QUIC_ARRAYSIZE(packet)); } TEST_P(CryptoFramerTest, ConstructHandshakeMessageWithTwoKeys) { @@ -129,7 +130,7 @@ test::CompareCharArraysWithHexError("constructed packet", data->data(), data->length(), AsChars(packet), - arraysize(packet)); + QUIC_ARRAYSIZE(packet)); } TEST_P(CryptoFramerTest, ConstructHandshakeMessageZeroLength) { @@ -157,7 +158,7 @@ test::CompareCharArraysWithHexError("constructed packet", data->data(), data->length(), AsChars(packet), - arraysize(packet)); + QUIC_ARRAYSIZE(packet)); } TEST_P(CryptoFramerTest, ConstructHandshakeMessageTooManyEntries) { @@ -209,7 +210,7 @@ test::CompareCharArraysWithHexError("constructed packet", data->data(), data->length(), AsChars(packet), - arraysize(packet)); + QUIC_ARRAYSIZE(packet)); } TEST_P(CryptoFramerTest, ConstructHandshakeMessageMinimumSizePadLast) { @@ -246,7 +247,7 @@ test::CompareCharArraysWithHexError("constructed packet", data->data(), data->length(), AsChars(packet), - arraysize(packet)); + QUIC_ARRAYSIZE(packet)); } TEST_P(CryptoFramerTest, ProcessInput) { @@ -276,7 +277,7 @@ }; EXPECT_TRUE(framer.ProcessInput( - QuicStringPiece(AsChars(input), arraysize(input)), GetParam())); + QuicStringPiece(AsChars(input), QUIC_ARRAYSIZE(input)), GetParam())); EXPECT_EQ(0u, framer.InputBytesRemaining()); EXPECT_EQ(0, visitor.error_count_); ASSERT_EQ(1u, visitor.messages_.size()); @@ -320,7 +321,7 @@ }; EXPECT_TRUE(framer.ProcessInput( - QuicStringPiece(AsChars(input), arraysize(input)), GetParam())); + QuicStringPiece(AsChars(input), QUIC_ARRAYSIZE(input)), GetParam())); EXPECT_EQ(0u, framer.InputBytesRemaining()); EXPECT_EQ(0, visitor.error_count_); ASSERT_EQ(1u, visitor.messages_.size()); @@ -358,7 +359,7 @@ 'g', 'h', 'i', 'j', 'k', }; - for (size_t i = 0; i < arraysize(input); i++) { + for (size_t i = 0; i < QUIC_ARRAYSIZE(input); i++) { EXPECT_TRUE(framer.ProcessInput(QuicStringPiece(AsChars(input) + i, 1), GetParam())); } @@ -394,7 +395,7 @@ }; EXPECT_FALSE(framer.ProcessInput( - QuicStringPiece(AsChars(input), arraysize(input)), GetParam())); + QuicStringPiece(AsChars(input), QUIC_ARRAYSIZE(input)), GetParam())); EXPECT_EQ(QUIC_CRYPTO_TAGS_OUT_OF_ORDER, framer.error()); EXPECT_EQ(1, visitor.error_count_); } @@ -422,7 +423,7 @@ }; EXPECT_FALSE(framer.ProcessInput( - QuicStringPiece(AsChars(input), arraysize(input)), GetParam())); + QuicStringPiece(AsChars(input), QUIC_ARRAYSIZE(input)), GetParam())); EXPECT_EQ(QUIC_CRYPTO_TAGS_OUT_OF_ORDER, framer.error()); EXPECT_EQ(1, visitor.error_count_); } @@ -442,7 +443,7 @@ }; EXPECT_FALSE(framer.ProcessInput( - QuicStringPiece(AsChars(input), arraysize(input)), GetParam())); + QuicStringPiece(AsChars(input), QUIC_ARRAYSIZE(input)), GetParam())); EXPECT_EQ(QUIC_CRYPTO_TOO_MANY_ENTRIES, framer.error()); EXPECT_EQ(1, visitor.error_count_); } @@ -470,7 +471,7 @@ }; EXPECT_TRUE(framer.ProcessInput( - QuicStringPiece(AsChars(input), arraysize(input)), GetParam())); + QuicStringPiece(AsChars(input), QUIC_ARRAYSIZE(input)), GetParam())); EXPECT_EQ(0, visitor.error_count_); }
diff --git a/net/quic/core/crypto/crypto_server_test.cc b/net/quic/core/crypto/crypto_server_test.cc index 4073b3ee..30a8716c 100644 --- a/net/quic/core/crypto/crypto_server_test.cc +++ b/net/quic/core/crypto/crypto_server_test.cc
@@ -18,6 +18,7 @@ #include "net/quic/core/crypto/quic_random.h" #include "net/quic/core/quic_socket_address_coder.h" #include "net/quic/core/quic_utils.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_endian.h" #include "net/quic/platform/api/quic_flags.h" #include "net/quic/platform/api/quic_string_piece.h" @@ -165,7 +166,7 @@ CheckRejectTag(); const HandshakeFailureReason kRejectReasons[] = { SERVER_CONFIG_INCHOATE_HELLO_FAILURE}; - CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons)); + CheckRejectReasons(kRejectReasons, QUIC_ARRAYSIZE(kRejectReasons)); CheckForServerDesignatedConnectionId(); QuicStringPiece srct; @@ -431,7 +432,7 @@ }; // clang-format on - for (size_t i = 0; i < arraysize(kBadSNIs); i++) { + for (size_t i = 0; i < QUIC_ARRAYSIZE(kBadSNIs); i++) { CryptoHandshakeMessage msg = crypto_test_utils::CreateCHLO({{"PDMD", "X509"}, {"SNI", kBadSNIs[i]}, @@ -440,7 +441,7 @@ ShouldFailMentioning("SNI", msg); const HandshakeFailureReason kRejectReasons[] = { SERVER_CONFIG_INCHOATE_HELLO_FAILURE}; - CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons)); + CheckRejectReasons(kRejectReasons, QUIC_ARRAYSIZE(kRejectReasons)); } } @@ -466,7 +467,7 @@ EXPECT_NE(0u, proof.size()); const HandshakeFailureReason kRejectReasons[] = { SERVER_CONFIG_INCHOATE_HELLO_FAILURE}; - CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons)); + CheckRejectReasons(kRejectReasons, QUIC_ARRAYSIZE(kRejectReasons)); EXPECT_LT(0u, cert_sct.size()); } @@ -493,7 +494,7 @@ EXPECT_FALSE(out_.GetStringPiece(kCertificateSCTTag, &cert_sct)); const HandshakeFailureReason kRejectReasons[] = { SERVER_CONFIG_INCHOATE_HELLO_FAILURE}; - CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons)); + CheckRejectReasons(kRejectReasons, QUIC_ARRAYSIZE(kRejectReasons)); } TEST_P(CryptoServerTest, RejectNotTooLarge) { @@ -520,7 +521,7 @@ EXPECT_TRUE(out_.GetStringPiece(kCertificateSCTTag, &cert_sct)); const HandshakeFailureReason kRejectReasons[] = { SERVER_CONFIG_INCHOATE_HELLO_FAILURE}; - CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons)); + CheckRejectReasons(kRejectReasons, QUIC_ARRAYSIZE(kRejectReasons)); } TEST_P(CryptoServerTest, RejectTooLargeButValidSTK) { @@ -549,7 +550,7 @@ EXPECT_NE(0u, proof.size()); const HandshakeFailureReason kRejectReasons[] = { SERVER_CONFIG_INCHOATE_HELLO_FAILURE}; - CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons)); + CheckRejectReasons(kRejectReasons, QUIC_ARRAYSIZE(kRejectReasons)); } TEST_P(CryptoServerTest, TooSmall) { @@ -560,7 +561,7 @@ const HandshakeFailureReason kRejectReasons[] = { SERVER_CONFIG_INCHOATE_HELLO_FAILURE}; - CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons)); + CheckRejectReasons(kRejectReasons, QUIC_ARRAYSIZE(kRejectReasons)); } TEST_P(CryptoServerTest, BadSourceAddressToken) { @@ -574,7 +575,7 @@ }; // clang-format on - for (size_t i = 0; i < arraysize(kBadSourceAddressTokens); i++) { + for (size_t i = 0; i < QUIC_ARRAYSIZE(kBadSourceAddressTokens); i++) { CryptoHandshakeMessage msg = crypto_test_utils::CreateCHLO({{"PDMD", "X509"}, {"STK", kBadSourceAddressTokens[i]}, @@ -583,7 +584,7 @@ ShouldSucceed(msg); const HandshakeFailureReason kRejectReasons[] = { SERVER_CONFIG_INCHOATE_HELLO_FAILURE}; - CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons)); + CheckRejectReasons(kRejectReasons, QUIC_ARRAYSIZE(kRejectReasons)); } } @@ -596,7 +597,7 @@ }; // clang-format on - for (size_t i = 0; i < arraysize(kBadNonces); i++) { + for (size_t i = 0; i < QUIC_ARRAYSIZE(kBadNonces); i++) { // Invalid nonces should be ignored, in an inchoate CHLO. CryptoHandshakeMessage msg = @@ -608,7 +609,7 @@ ShouldSucceed(msg); const HandshakeFailureReason kRejectReasons[] = { SERVER_CONFIG_INCHOATE_HELLO_FAILURE}; - CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons)); + CheckRejectReasons(kRejectReasons, QUIC_ARRAYSIZE(kRejectReasons)); // Invalid nonces should result in CLIENT_NONCE_INVALID_FAILURE. CryptoHandshakeMessage msg1 = @@ -629,7 +630,7 @@ CheckRejectTag(); const HandshakeFailureReason kRejectReasons1[] = { CLIENT_NONCE_INVALID_FAILURE}; - CheckRejectReasons(kRejectReasons1, arraysize(kRejectReasons1)); + CheckRejectReasons(kRejectReasons1, QUIC_ARRAYSIZE(kRejectReasons1)); } } @@ -643,7 +644,7 @@ ShouldSucceed(msg); const HandshakeFailureReason kRejectReasons[] = { SERVER_CONFIG_INCHOATE_HELLO_FAILURE}; - CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons)); + CheckRejectReasons(kRejectReasons, QUIC_ARRAYSIZE(kRejectReasons)); CryptoHandshakeMessage msg1 = crypto_test_utils::CreateCHLO({{"PDMD", "X509"}, @@ -660,7 +661,7 @@ CheckRejectTag(); const HandshakeFailureReason kRejectReasons1[] = { SERVER_CONFIG_INCHOATE_HELLO_FAILURE}; - CheckRejectReasons(kRejectReasons1, arraysize(kRejectReasons1)); + CheckRejectReasons(kRejectReasons1, QUIC_ARRAYSIZE(kRejectReasons1)); } TEST_P(CryptoServerTest, DowngradeAttack) { @@ -679,7 +680,7 @@ ShouldFailMentioning("Downgrade", msg); const HandshakeFailureReason kRejectReasons[] = { SERVER_CONFIG_INCHOATE_HELLO_FAILURE}; - CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons)); + CheckRejectReasons(kRejectReasons, QUIC_ARRAYSIZE(kRejectReasons)); } TEST_P(CryptoServerTest, CorruptServerConfig) { @@ -699,7 +700,7 @@ CheckRejectTag(); const HandshakeFailureReason kRejectReasons[] = { SERVER_CONFIG_UNKNOWN_CONFIG_FAILURE}; - CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons)); + CheckRejectReasons(kRejectReasons, QUIC_ARRAYSIZE(kRejectReasons)); } TEST_P(CryptoServerTest, CorruptSourceAddressToken) { @@ -720,7 +721,7 @@ CheckRejectTag(); const HandshakeFailureReason kRejectReasons[] = { SOURCE_ADDRESS_TOKEN_DECRYPTION_FAILURE}; - CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons)); + CheckRejectReasons(kRejectReasons, QUIC_ARRAYSIZE(kRejectReasons)); } TEST_P(CryptoServerTest, CorruptClientNonceAndSourceAddressToken) { @@ -741,7 +742,7 @@ CheckRejectTag(); const HandshakeFailureReason kRejectReasons[] = { SOURCE_ADDRESS_TOKEN_DECRYPTION_FAILURE, CLIENT_NONCE_INVALID_FAILURE}; - CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons)); + CheckRejectReasons(kRejectReasons, QUIC_ARRAYSIZE(kRejectReasons)); } TEST_P(CryptoServerTest, CorruptMultipleTags) { @@ -765,7 +766,7 @@ const HandshakeFailureReason kRejectReasons[] = { SOURCE_ADDRESS_TOKEN_DECRYPTION_FAILURE, CLIENT_NONCE_INVALID_FAILURE}; - CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons)); + CheckRejectReasons(kRejectReasons, QUIC_ARRAYSIZE(kRejectReasons)); } TEST_P(CryptoServerTest, NoServerNonce) { @@ -814,7 +815,7 @@ CheckRejectTag(); const HandshakeFailureReason kRejectReasons[] = { SOURCE_ADDRESS_TOKEN_DIFFERENT_IP_ADDRESS_FAILURE}; - CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons)); + CheckRejectReasons(kRejectReasons, QUIC_ARRAYSIZE(kRejectReasons)); QuicStringPiece cert, proof, scfg_str; EXPECT_TRUE(out_.GetStringPiece(kCertificateTag, &cert)); @@ -875,7 +876,7 @@ const HandshakeFailureReason kRejectReasons[] = { INVALID_EXPECTED_LEAF_CERTIFICATE}; - CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons)); + CheckRejectReasons(kRejectReasons, QUIC_ARRAYSIZE(kRejectReasons)); } TEST_P(CryptoServerTest, ValidXlct) { @@ -1086,7 +1087,7 @@ const HandshakeFailureReason kRejectReasons[] = { SERVER_CONFIG_INCHOATE_HELLO_FAILURE}; - CheckRejectReasons(kRejectReasons, arraysize(kRejectReasons)); + CheckRejectReasons(kRejectReasons, QUIC_ARRAYSIZE(kRejectReasons)); } class CryptoServerTestOldVersion : public CryptoServerTest {
diff --git a/net/quic/core/crypto/crypto_utils.cc b/net/quic/core/crypto/crypto_utils.cc index 2bd2486e..62668344 100644 --- a/net/quic/core/crypto/crypto_utils.cc +++ b/net/quic/core/crypto/crypto_utils.cc
@@ -14,6 +14,7 @@ #include "net/quic/core/crypto/quic_random.h" #include "net/quic/core/quic_time.h" #include "net/quic/core/quic_utils.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_bug_tracker.h" #include "net/quic/platform/api/quic_logging.h" #include "third_party/boringssl/src/include/openssl/bytestring.h" @@ -36,7 +37,7 @@ !CBB_add_u8_length_prefixed(&hkdf_label, &inner_label) || !CBB_add_bytes(&inner_label, reinterpret_cast<const uint8_t*>(label_prefix), - arraysize(label_prefix) - 1) || + QUIC_ARRAYSIZE(label_prefix) - 1) || !CBB_add_bytes(&inner_label, reinterpret_cast<const uint8_t*>(label.data()), label.size()) ||
diff --git a/net/quic/core/crypto/crypto_utils_test.cc b/net/quic/core/crypto/crypto_utils_test.cc index 1d73186..ad5ad99 100644 --- a/net/quic/core/crypto/crypto_utils_test.cc +++ b/net/quic/core/crypto/crypto_utils_test.cc
@@ -5,6 +5,7 @@ #include "net/quic/core/crypto/crypto_utils.h" #include "net/quic/core/quic_utils.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_test.h" #include "net/quic/platform/api/quic_text_utils.h" #include "net/quic/test_tools/quic_test_utils.h" @@ -67,7 +68,7 @@ "c9a46ed0757bd1812f1f21b4d41e62125fec8364a21db7"}, }; - for (size_t i = 0; i < arraysize(test_vector); i++) { + for (size_t i = 0; i < QUIC_ARRAYSIZE(test_vector); i++) { // Decode the test vector. string subkey_secret = QuicTextUtils::HexDecode(test_vector[i].subkey_secret);
diff --git a/net/quic/core/crypto/null_decrypter_test.cc b/net/quic/core/crypto/null_decrypter_test.cc index fe6a252..3b83c20c 100644 --- a/net/quic/core/crypto/null_decrypter_test.cc +++ b/net/quic/core/crypto/null_decrypter_test.cc
@@ -3,6 +3,7 @@ // found in the LICENSE file. #include "net/quic/core/crypto/null_decrypter.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_test.h" #include "net/quic/test_tools/quic_test_utils.h" @@ -19,7 +20,7 @@ 'g', 'o', 'o', 'd', 'b', 'y', 'e', '!', }; const char* data = reinterpret_cast<const char*>(expected); - size_t len = arraysize(expected); + size_t len = QUIC_ARRAYSIZE(expected); NullDecrypter decrypter(Perspective::IS_SERVER); char buffer[256]; size_t length = 0; @@ -38,7 +39,7 @@ 'g', 'o', 'o', 'd', 'b', 'y', 'e', '!', }; const char* data = reinterpret_cast<const char*>(expected); - size_t len = arraysize(expected); + size_t len = QUIC_ARRAYSIZE(expected); NullDecrypter decrypter(Perspective::IS_CLIENT); char buffer[256]; size_t length = 0; @@ -57,7 +58,7 @@ 'g', 'o', 'o', 'd', 'b', 'y', 'e', '!', }; const char* data = reinterpret_cast<const char*>(expected); - size_t len = arraysize(expected); + size_t len = QUIC_ARRAYSIZE(expected); NullDecrypter decrypter(Perspective::IS_CLIENT); char buffer[256]; size_t length = 0; @@ -76,7 +77,7 @@ 'g', 'o', 'o', 'd', 'b', 'y', 'e', '!', }; const char* data = reinterpret_cast<const char*>(expected); - size_t len = arraysize(expected); + size_t len = QUIC_ARRAYSIZE(expected); NullDecrypter decrypter(Perspective::IS_SERVER); char buffer[256]; size_t length = 0; @@ -95,7 +96,7 @@ 'g', 'o', 'o', 'd', 'b', 'y', 'e', '!', }; const char* data = reinterpret_cast<const char*>(expected); - size_t len = arraysize(expected); + size_t len = QUIC_ARRAYSIZE(expected); NullDecrypter decrypter(Perspective::IS_CLIENT); char buffer[256]; size_t length = 0; @@ -110,7 +111,7 @@ 0x46, 0x11, 0xea, 0x5f, 0xcf, 0x1d, 0x66, 0x5b, 0xba, 0xf0, 0xbc, }; const char* data = reinterpret_cast<const char*>(expected); - size_t len = arraysize(expected); + size_t len = QUIC_ARRAYSIZE(expected); NullDecrypter decrypter(Perspective::IS_CLIENT); char buffer[256]; size_t length = 0;
diff --git a/net/quic/core/crypto/null_encrypter_test.cc b/net/quic/core/crypto/null_encrypter_test.cc index 00f24cd..21aa85e 100644 --- a/net/quic/core/crypto/null_encrypter_test.cc +++ b/net/quic/core/crypto/null_encrypter_test.cc
@@ -3,6 +3,7 @@ // found in the LICENSE file. #include "net/quic/core/crypto/null_encrypter.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_test.h" #include "net/quic/test_tools/quic_test_utils.h" @@ -26,7 +27,7 @@ 256)); test::CompareCharArraysWithHexError( "encrypted data", encrypted, encrypted_len, - reinterpret_cast<const char*>(expected), arraysize(expected)); + reinterpret_cast<const char*>(expected), QUIC_ARRAYSIZE(expected)); } TEST_F(NullEncrypterTest, EncryptServer) { @@ -44,7 +45,7 @@ 256)); test::CompareCharArraysWithHexError( "encrypted data", encrypted, encrypted_len, - reinterpret_cast<const char*>(expected), arraysize(expected)); + reinterpret_cast<const char*>(expected), QUIC_ARRAYSIZE(expected)); } TEST_F(NullEncrypterTest, EncryptClientPre37) { @@ -62,7 +63,7 @@ 256)); test::CompareCharArraysWithHexError( "encrypted data", encrypted, encrypted_len, - reinterpret_cast<const char*>(expected), arraysize(expected)); + reinterpret_cast<const char*>(expected), QUIC_ARRAYSIZE(expected)); } TEST_F(NullEncrypterTest, EncryptServerPre37) { @@ -80,7 +81,7 @@ 256)); test::CompareCharArraysWithHexError( "encrypted data", encrypted, encrypted_len, - reinterpret_cast<const char*>(expected), arraysize(expected)); + reinterpret_cast<const char*>(expected), QUIC_ARRAYSIZE(expected)); } TEST_F(NullEncrypterTest, GetMaxPlaintextSize) {
diff --git a/net/quic/core/crypto/quic_crypto_client_config.cc b/net/quic/core/crypto/quic_crypto_client_config.cc index 9c77f54f..875b42d 100644 --- a/net/quic/core/crypto/quic_crypto_client_config.cc +++ b/net/quic/core/crypto/quic_crypto_client_config.cc
@@ -21,6 +21,7 @@ #include "net/quic/core/crypto/quic_encrypter.h" #include "net/quic/core/crypto/quic_random.h" #include "net/quic/core/quic_utils.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_bug_tracker.h" #include "net/quic/platform/api/quic_endian.h" #include "net/quic/platform/api/quic_hostname_utils.h" @@ -466,9 +467,9 @@ } char proof_nonce[32]; - rand->RandBytes(proof_nonce, arraysize(proof_nonce)); - out->SetStringPiece(kNONP, - QuicStringPiece(proof_nonce, arraysize(proof_nonce))); + rand->RandBytes(proof_nonce, QUIC_ARRAYSIZE(proof_nonce)); + out->SetStringPiece( + kNONP, QuicStringPiece(proof_nonce, QUIC_ARRAYSIZE(proof_nonce))); out->SetVector(kPDMD, QuicTagVector{kX509});
diff --git a/net/quic/core/crypto/quic_crypto_server_config.cc b/net/quic/core/crypto/quic_crypto_server_config.cc index fd2229ba..4108a83 100644 --- a/net/quic/core/crypto/quic_crypto_server_config.cc +++ b/net/quic/core/crypto/quic_crypto_server_config.cc
@@ -1492,7 +1492,7 @@ if (client_hello.GetStringPiece(kCCRT, &client_cached_cert_hashes)) { params->client_cached_cert_hashes = client_cached_cert_hashes.as_string(); } else { - if (FLAGS_quic_reloadable_flag_quic_2rtt_drop_client_cached_certs) { + if (GetQuicReloadableFlag(quic_2rtt_drop_client_cached_certs)) { params->client_cached_cert_hashes.clear(); QUIC_FLAG_COUNT_N(quic_reloadable_flag_quic_2rtt_drop_client_cached_certs, 1, 2); @@ -1561,7 +1561,7 @@ } string compressed; - if (FLAGS_quic_reloadable_flag_quic_2rtt_drop_client_cached_certs) { + if (GetQuicReloadableFlag(quic_2rtt_drop_client_cached_certs)) { compressed = CertCompressor::CompressChain(chain->certs, client_common_set_hashes, client_cached_cert_hashes, common_sets);
diff --git a/net/quic/core/crypto/quic_tls_adapter_test.cc b/net/quic/core/crypto/quic_tls_adapter_test.cc index 9a7c7cc..614d14e 100644 --- a/net/quic/core/crypto/quic_tls_adapter_test.cc +++ b/net/quic/core/crypto/quic_tls_adapter_test.cc
@@ -6,6 +6,7 @@ #include <vector> +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_test.h" #include "third_party/boringssl/src/include/openssl/bio.h" @@ -56,7 +57,7 @@ char buf[4]; ASSERT_EQ(static_cast<int>(input.length()), - BIO_read(bio_, buf, arraysize(buf))); + BIO_read(bio_, buf, QUIC_ARRAYSIZE(buf))); EXPECT_EQ(input, string(buf, input.length())); } @@ -71,9 +72,9 @@ // Test that a call to BIO_read for less than what is in |adapter_|'s buffer // still leaves more input remaining to read. char buf1[3]; - ASSERT_EQ(static_cast<int>(arraysize(buf1)), - BIO_read(bio_, buf1, arraysize(buf1))); - EXPECT_EQ("abc", string(buf1, arraysize(buf1))); + ASSERT_EQ(static_cast<int>(QUIC_ARRAYSIZE(buf1)), + BIO_read(bio_, buf1, QUIC_ARRAYSIZE(buf1))); + EXPECT_EQ("abc", string(buf1, QUIC_ARRAYSIZE(buf1))); EXPECT_EQ(1u, adapter_.InputBytesRemaining()); // Test that the bytes read by BIO_read can span input read in by @@ -82,9 +83,9 @@ EXPECT_EQ(QUIC_NO_ERROR, adapter_.error()); EXPECT_EQ(2, visitor_.data_available_count()); char buf2[5]; - ASSERT_EQ(static_cast<int>(arraysize(buf2)), - BIO_read(bio_, buf2, arraysize(buf2))); - EXPECT_EQ("defgh", string(buf2, arraysize(buf2))); + ASSERT_EQ(static_cast<int>(QUIC_ARRAYSIZE(buf2)), + BIO_read(bio_, buf2, QUIC_ARRAYSIZE(buf2))); + EXPECT_EQ("defgh", string(buf2, QUIC_ARRAYSIZE(buf2))); EXPECT_EQ(0u, adapter_.InputBytesRemaining()); }
diff --git a/net/quic/core/frames/quic_ack_frame.cc b/net/quic/core/frames/quic_ack_frame.cc index a6cfe55..7ef8cb88 100644 --- a/net/quic/core/frames/quic_ack_frame.cc +++ b/net/quic/core/frames/quic_ack_frame.cc
@@ -19,36 +19,6 @@ const QuicPacketNumber kMaxPrintRange = 128; } // namespace -PacketNumberQueue::const_iterator::const_iterator(const const_iterator& other) = - default; -PacketNumberQueue::const_iterator::const_iterator(const_iterator&& other) = - default; -PacketNumberQueue::const_iterator::~const_iterator() {} - -PacketNumberQueue::const_iterator::const_iterator( - typename QuicIntervalSet<QuicPacketNumber>::const_iterator it) - : vector_it_(it), use_deque_it_(false) {} - -PacketNumberQueue::const_reverse_iterator::const_reverse_iterator( - const const_reverse_iterator& other) = default; -PacketNumberQueue::const_reverse_iterator::const_reverse_iterator( - const_reverse_iterator&& other) = default; -PacketNumberQueue::const_reverse_iterator::~const_reverse_iterator() {} - -PacketNumberQueue::const_iterator::const_iterator( - typename QuicDeque<Interval<QuicPacketNumber>>::const_iterator it) - : deque_it_(it), use_deque_it_(true) {} - -PacketNumberQueue::const_reverse_iterator::const_reverse_iterator( - const typename QuicIntervalSet<QuicPacketNumber>::const_reverse_iterator& - it) - : vector_it_(it), use_deque_it_(false) {} - -PacketNumberQueue::const_reverse_iterator::const_reverse_iterator( - const typename QuicDeque< - Interval<QuicPacketNumber>>::const_reverse_iterator& it) - : deque_it_(it), use_deque_it_(true) {} - bool IsAwaitingPacket(const QuicAckFrame& ack_frame, QuicPacketNumber packet_number, QuicPacketNumber peer_least_packet_awaiting_ack) { @@ -92,13 +62,7 @@ return frame.packets.Empty() ? 0 : frame.packets.Max(); } -PacketNumberQueue::PacketNumberQueue() - : use_deque_(GetQuicReloadableFlag(quic_frames_deque3)) { - if (use_deque_) { - QUIC_FLAG_COUNT(quic_reloadable_flag_quic_frames_deque3); - } -} - +PacketNumberQueue::PacketNumberQueue() {} PacketNumberQueue::PacketNumberQueue(const PacketNumberQueue& other) = default; PacketNumberQueue::PacketNumberQueue(PacketNumberQueue&& other) = default; PacketNumberQueue::~PacketNumberQueue() {} @@ -109,80 +73,76 @@ default; void PacketNumberQueue::Add(QuicPacketNumber packet_number) { - if (use_deque_) { - // Check if the deque is empty - if (packet_number_deque_.empty()) { - packet_number_deque_.push_front( + // Check if the deque is empty + if (packet_number_deque_.empty()) { + packet_number_deque_.push_front( + Interval<QuicPacketNumber>(packet_number, packet_number + 1)); + return; + } + Interval<QuicPacketNumber> back = packet_number_deque_.back(); + + // Check for the typical case, + // when the next packet in order is acked + if (back.max() == packet_number) { + packet_number_deque_.back().SetMax(packet_number + 1); + return; + } + // Check if the next packet in order is skipped + if (back.max() < packet_number) { + packet_number_deque_.push_back( + Interval<QuicPacketNumber>(packet_number, packet_number + 1)); + return; + } + + Interval<QuicPacketNumber> front = packet_number_deque_.front(); + // Check if the packet can be popped on the front + if (front.min() > packet_number + 1) { + packet_number_deque_.push_front( + Interval<QuicPacketNumber>(packet_number, packet_number + 1)); + return; + } + if (front.min() == packet_number + 1) { + packet_number_deque_.front().SetMin(packet_number); + return; + } + + int i = packet_number_deque_.size() - 1; + // Iterating through the queue backwards + // to find a proper place for the packet + while (i >= 0) { + Interval<QuicPacketNumber> packet_interval = packet_number_deque_[i]; + DCHECK(packet_interval.min() < packet_interval.max()); + // Check if the packet is contained in an interval already + if (packet_interval.Contains(packet_number)) { + return; + } + + // Check if the packet can extend an interval. + if (packet_interval.max() == packet_number) { + packet_number_deque_[i].SetMax(packet_number + 1); + return; + } + // Check if the packet can extend an interval + // and merge two intervals if needed. + // There is no need to merge an interval in the previous + // if statement, as all merges will happen here. + if (packet_interval.min() == packet_number + 1) { + packet_number_deque_[i].SetMin(packet_number); + if (i > 0 && packet_number == packet_number_deque_[i - 1].max()) { + packet_number_deque_[i - 1].SetMax(packet_interval.max()); + packet_number_deque_.erase(packet_number_deque_.begin() + i); + } + return; + } + + // Check if we need to make a new interval for the packet + if (packet_interval.max() < packet_number + 1) { + packet_number_deque_.insert( + packet_number_deque_.begin() + i + 1, Interval<QuicPacketNumber>(packet_number, packet_number + 1)); return; } - Interval<QuicPacketNumber> back = packet_number_deque_.back(); - - // Check for the typical case, - // when the next packet in order is acked - if (back.max() == packet_number) { - packet_number_deque_.back().SetMax(packet_number + 1); - return; - } - // Check if the next packet in order is skipped - if (back.max() < packet_number) { - packet_number_deque_.push_back( - Interval<QuicPacketNumber>(packet_number, packet_number + 1)); - return; - } - - Interval<QuicPacketNumber> front = packet_number_deque_.front(); - // Check if the packet can be popped on the front - if (front.min() > packet_number + 1) { - packet_number_deque_.push_front( - Interval<QuicPacketNumber>(packet_number, packet_number + 1)); - return; - } - if (front.min() == packet_number + 1) { - packet_number_deque_.front().SetMin(packet_number); - return; - } - - int i = packet_number_deque_.size() - 1; - // Iterating through the queue backwards - // to find a proper place for the packet - while (i >= 0) { - Interval<QuicPacketNumber> packet_interval = packet_number_deque_[i]; - DCHECK(packet_interval.min() < packet_interval.max()); - // Check if the packet is contained in an interval already - if (packet_interval.Contains(packet_number)) { - return; - } - - // Check if the packet can extend an interval. - if (packet_interval.max() == packet_number) { - packet_number_deque_[i].SetMax(packet_number + 1); - return; - } - // Check if the packet can extend an interval - // and merge two intervals if needed. - // There is no need to merge an interval in the previous - // if statement, as all merges will happen here. - if (packet_interval.min() == packet_number + 1) { - packet_number_deque_[i].SetMin(packet_number); - if (i > 0 && packet_number == packet_number_deque_[i - 1].max()) { - packet_number_deque_[i - 1].SetMax(packet_interval.max()); - packet_number_deque_.erase(packet_number_deque_.begin() + i); - } - return; - } - - // Check if we need to make a new interval for the packet - if (packet_interval.max() < packet_number + 1) { - packet_number_deque_.insert( - packet_number_deque_.begin() + i + 1, - Interval<QuicPacketNumber>(packet_number, packet_number + 1)); - return; - } - i--; - } - } else { - packet_number_intervals_.Add(packet_number, packet_number + 1); + i--; } } @@ -191,40 +151,34 @@ if (lower >= higher) { return; } - if (use_deque_) { - if (packet_number_deque_.empty()) { - packet_number_deque_.push_front( - Interval<QuicPacketNumber>(lower, higher)); - return; - } - Interval<QuicPacketNumber> back = packet_number_deque_.back(); + if (packet_number_deque_.empty()) { + packet_number_deque_.push_front(Interval<QuicPacketNumber>(lower, higher)); + return; + } + Interval<QuicPacketNumber> back = packet_number_deque_.back(); - if (back.max() == lower) { - // Check for the typical case, - // when the next packet in order is acked - packet_number_deque_.back().SetMax(higher); - return; - } - if (back.max() < lower) { - // Check if the next packet in order is skipped - packet_number_deque_.push_back(Interval<QuicPacketNumber>(lower, higher)); - return; - } - Interval<QuicPacketNumber> front = packet_number_deque_.front(); - // Check if the packets are being added in reverse order - if (front.min() == higher) { - packet_number_deque_.front().SetMin(lower); - } else if (front.min() > higher) { - packet_number_deque_.push_front( - Interval<QuicPacketNumber>(lower, higher)); + if (back.max() == lower) { + // Check for the typical case, + // when the next packet in order is acked + packet_number_deque_.back().SetMax(higher); + return; + } + if (back.max() < lower) { + // Check if the next packet in order is skipped + packet_number_deque_.push_back(Interval<QuicPacketNumber>(lower, higher)); + return; + } + Interval<QuicPacketNumber> front = packet_number_deque_.front(); + // Check if the packets are being added in reverse order + if (front.min() == higher) { + packet_number_deque_.front().SetMin(lower); + } else if (front.min() > higher) { + packet_number_deque_.push_front(Interval<QuicPacketNumber>(lower, higher)); - } else { - // Ranges must be above or below all existing ranges. - QUIC_BUG << "AddRange only supports adding packets above or below the " - << "current min:" << Min() << " and max:" << Max(); - } } else { - packet_number_intervals_.Add(lower, higher); + // Ranges must be above or below all existing ranges. + QUIC_BUG << "AddRange only supports adding packets above or below the " + << "current min:" << Min() << " and max:" << Max(); } } @@ -233,151 +187,92 @@ return false; } const QuicPacketNumber old_min = Min(); - if (use_deque_) { - while (!packet_number_deque_.empty()) { - Interval<QuicPacketNumber> front = packet_number_deque_.front(); - if (front.max() < higher) { + while (!packet_number_deque_.empty()) { + Interval<QuicPacketNumber> front = packet_number_deque_.front(); + if (front.max() < higher) { + packet_number_deque_.pop_front(); + } else if (front.min() < higher && front.max() >= higher) { + packet_number_deque_.front().SetMin(higher); + if (front.max() == higher) { packet_number_deque_.pop_front(); - } else if (front.min() < higher && front.max() >= higher) { - packet_number_deque_.front().SetMin(higher); - if (front.max() == higher) { - packet_number_deque_.pop_front(); - } - break; - } else { - break; } + break; + } else { + break; } - } else { - packet_number_intervals_.Difference(0, higher); } return Empty() || old_min != Min(); } void PacketNumberQueue::RemoveSmallestInterval() { - if (use_deque_) { - QUIC_BUG_IF(packet_number_deque_.size() < 2) - << (Empty() ? "No intervals to remove." - : "Can't remove the last interval."); - packet_number_deque_.pop_front(); - } else { - QUIC_BUG_IF(packet_number_intervals_.Size() < 2) - << (Empty() ? "No intervals to remove." - : "Can't remove the last interval."); - packet_number_intervals_.Difference(*packet_number_intervals_.begin()); - } + QUIC_BUG_IF(packet_number_deque_.size() < 2) + << (Empty() ? "No intervals to remove." + : "Can't remove the last interval."); + packet_number_deque_.pop_front(); } bool PacketNumberQueue::Contains(QuicPacketNumber packet_number) const { - if (use_deque_) { - if (packet_number_deque_.empty()) { - return false; - } - if (packet_number_deque_.front().min() > packet_number || - packet_number_deque_.back().max() <= packet_number) { - return false; - } - for (Interval<QuicPacketNumber> interval : packet_number_deque_) { - if (interval.Contains(packet_number)) { - return true; - } - } + if (packet_number_deque_.empty()) { return false; - } else { - return packet_number_intervals_.Contains(packet_number); } + if (packet_number_deque_.front().min() > packet_number || + packet_number_deque_.back().max() <= packet_number) { + return false; + } + for (Interval<QuicPacketNumber> interval : packet_number_deque_) { + if (interval.Contains(packet_number)) { + return true; + } + } + return false; } bool PacketNumberQueue::Empty() const { - if (use_deque_) { - return packet_number_deque_.empty(); - } else { - return packet_number_intervals_.Empty(); - } + return packet_number_deque_.empty(); } QuicPacketNumber PacketNumberQueue::Min() const { DCHECK(!Empty()); - if (use_deque_) { - return packet_number_deque_.front().min(); - } else { - return packet_number_intervals_.begin()->min(); - } + return packet_number_deque_.front().min(); } QuicPacketNumber PacketNumberQueue::Max() const { DCHECK(!Empty()); - if (use_deque_) { - return packet_number_deque_.back().max() - 1; - } else { - return packet_number_intervals_.rbegin()->max() - 1; - } + return packet_number_deque_.back().max() - 1; } size_t PacketNumberQueue::NumPacketsSlow() const { - if (use_deque_) { - int n_packets = 0; - for (Interval<QuicPacketNumber> interval : packet_number_deque_) { - n_packets += interval.Length(); - } - return n_packets; - } else { - size_t num_packets = 0; - for (const auto& interval : packet_number_intervals_) { - num_packets += interval.Length(); - } - return num_packets; + int n_packets = 0; + for (Interval<QuicPacketNumber> interval : packet_number_deque_) { + n_packets += interval.Length(); } + return n_packets; } size_t PacketNumberQueue::NumIntervals() const { - if (use_deque_) { - return packet_number_deque_.size(); - } else { - return packet_number_intervals_.Size(); - } + return packet_number_deque_.size(); } PacketNumberQueue::const_iterator PacketNumberQueue::begin() const { - if (use_deque_) { - return PacketNumberQueue::const_iterator(packet_number_deque_.begin()); - } else { - return PacketNumberQueue::const_iterator(packet_number_intervals_.begin()); - } + return packet_number_deque_.begin(); } PacketNumberQueue::const_iterator PacketNumberQueue::end() const { - if (use_deque_) { - return const_iterator(packet_number_deque_.end()); - } else { - return const_iterator(packet_number_intervals_.end()); - } + return packet_number_deque_.end(); } PacketNumberQueue::const_reverse_iterator PacketNumberQueue::rbegin() const { - if (use_deque_) { - return const_reverse_iterator(packet_number_deque_.rbegin()); - } else { - return const_reverse_iterator(packet_number_intervals_.rbegin()); - } + return packet_number_deque_.rbegin(); } PacketNumberQueue::const_reverse_iterator PacketNumberQueue::rend() const { - if (use_deque_) { - return const_reverse_iterator(packet_number_deque_.rend()); - } else { - return const_reverse_iterator(packet_number_intervals_.rend()); - } + return packet_number_deque_.rend(); } QuicPacketNumber PacketNumberQueue::LastIntervalLength() const { DCHECK(!Empty()); - if (use_deque_) { - return packet_number_deque_.back().Length(); - } else { - return packet_number_intervals_.rbegin()->Length(); - } + return packet_number_deque_.back().Length(); } // Largest min...max range for packet numbers where we print the numbers
diff --git a/net/quic/core/frames/quic_ack_frame.h b/net/quic/core/frames/quic_ack_frame.h index c60610a..c714f285 100644 --- a/net/quic/core/frames/quic_ack_frame.h +++ b/net/quic/core/frames/quic_ack_frame.h
@@ -29,169 +29,9 @@ PacketNumberQueue& operator=(const PacketNumberQueue& other); PacketNumberQueue& operator=(PacketNumberQueue&& other); - class QUIC_EXPORT_PRIVATE const_iterator { - public: - const_iterator(const const_iterator& other); - const_iterator(const_iterator&& other); - ~const_iterator(); - - explicit const_iterator( - typename QuicIntervalSet<QuicPacketNumber>::const_iterator it); - - explicit const_iterator( - typename QuicDeque<Interval<QuicPacketNumber>>::const_iterator it); - - typedef std::input_iterator_tag iterator_category; - typedef Interval<QuicPacketNumber> value_type; - typedef value_type& reference; - typedef value_type* pointer; - typedef typename std::vector<value_type>::iterator::difference_type - difference_type; - - inline const Interval<QuicPacketNumber>& operator*() { - if (use_deque_it_) { - return *deque_it_; - } else { - return *vector_it_; - } - } - - inline const_iterator& operator++() { - if (use_deque_it_) { - deque_it_++; - } else { - vector_it_++; - } - return *this; - } - - inline const_iterator& operator--() { - if (use_deque_it_) { - deque_it_--; - } else { - vector_it_--; - } - return *this; - } - - inline const_iterator& operator++(int) { - if (use_deque_it_) { - ++deque_it_; - } else { - ++vector_it_; - } - return *this; - } - - inline bool operator==(const const_iterator& other) { - if (use_deque_it_ != other.use_deque_it_) { - return false; - } - - if (use_deque_it_) { - return deque_it_ == other.deque_it_; - } else { - return vector_it_ == other.vector_it_; - } - } - - inline bool operator!=(const const_iterator& other) { - return !(*this == other); - } - - private: - typename QuicIntervalSet<QuicPacketNumber>::const_iterator vector_it_; - typename QuicDeque<Interval<QuicPacketNumber>>::const_iterator deque_it_; - const bool use_deque_it_; - }; - - class QUIC_EXPORT_PRIVATE const_reverse_iterator { - public: - const_reverse_iterator(const const_reverse_iterator& other); - const_reverse_iterator(const_reverse_iterator&& other); - ~const_reverse_iterator(); - - explicit const_reverse_iterator( - const typename QuicIntervalSet< - QuicPacketNumber>::const_reverse_iterator& it); - - explicit const_reverse_iterator( - const typename QuicDeque< - Interval<QuicPacketNumber>>::const_reverse_iterator& it); - - typedef std::input_iterator_tag iterator_category; - typedef Interval<QuicPacketNumber> value_type; - typedef value_type& reference; - typedef value_type* pointer; - typedef typename std::vector<value_type>::iterator::difference_type - difference_type; - - inline const Interval<QuicPacketNumber>& operator*() { - if (use_deque_it_) { - return *deque_it_; - } else { - return *vector_it_; - } - } - - inline const Interval<QuicPacketNumber>* operator->() { - if (use_deque_it_) { - return &*deque_it_; - } else { - return &*vector_it_; - } - } - - inline const_reverse_iterator& operator++() { - if (use_deque_it_) { - deque_it_++; - } else { - vector_it_++; - } - return *this; - } - - inline const_reverse_iterator& operator--() { - if (use_deque_it_) { - deque_it_--; - } else { - vector_it_--; - } - return *this; - } - - inline const_reverse_iterator& operator++(int) { - if (use_deque_it_) { - ++deque_it_; - } else { - ++vector_it_; - } - return *this; - } - - inline bool operator==(const const_reverse_iterator& other) { - if (use_deque_it_ != other.use_deque_it_) { - return false; - } - - if (use_deque_it_) { - return deque_it_ == other.deque_it_; - } else { - return vector_it_ == other.vector_it_; - } - } - - inline bool operator!=(const const_reverse_iterator& other) { - return !(*this == other); - } - - private: - typename QuicIntervalSet<QuicPacketNumber>::const_reverse_iterator - vector_it_; - typename QuicDeque<Interval<QuicPacketNumber>>::const_reverse_iterator - deque_it_; - const bool use_deque_it_; - }; + typedef QuicDeque<Interval<QuicPacketNumber>>::const_iterator const_iterator; + typedef QuicDeque<Interval<QuicPacketNumber>>::const_reverse_iterator + const_reverse_iterator; // Adds |packet_number| to the set of packets in the queue. void Add(QuicPacketNumber packet_number); @@ -243,11 +83,7 @@ const PacketNumberQueue& q); private: - // TODO(lilika): Remove QuicIntervalSet<QuicPacketNumber> - // once FLAGS_quic_reloadable_flag_quic_frames_deque2 is removed - QuicIntervalSet<QuicPacketNumber> packet_number_intervals_; QuicDeque<Interval<QuicPacketNumber>> packet_number_deque_; - bool use_deque_; }; struct QUIC_EXPORT_PRIVATE QuicAckFrame {
diff --git a/net/quic/core/frames/quic_frames_test.cc b/net/quic/core/frames/quic_frames_test.cc index 34aa2cfd..4463e89a 100644 --- a/net/quic/core/frames/quic_frames_test.cc +++ b/net/quic/core/frames/quic_frames_test.cc
@@ -266,78 +266,19 @@ EXPECT_EQ(expected_intervals, actual_intervals); - if (GetQuicReloadableFlag(quic_frames_deque3)) { - // Ensure adding a range within the existing ranges fails. - EXPECT_QUIC_BUG(ack_frame1.packets.AddRange(20, 30), ""); - } else { - ack_frame1.packets.AddRange(20, 30); - } + // Ensure adding a range within the existing ranges fails. + EXPECT_QUIC_BUG(ack_frame1.packets.AddRange(20, 30), ""); const std::vector<Interval<QuicPacketNumber>> actual_intervals2( ack_frame1.packets.begin(), ack_frame1.packets.end()); std::vector<Interval<QuicPacketNumber>> expected_intervals2; expected_intervals2.emplace_back(Interval<QuicPacketNumber>(1, 10)); - if (!GetQuicReloadableFlag(quic_frames_deque3)) { - expected_intervals2.emplace_back(Interval<QuicPacketNumber>(20, 30)); - } expected_intervals2.emplace_back(Interval<QuicPacketNumber>(50, 100)); EXPECT_EQ(expected_intervals2.size(), ack_frame1.packets.NumIntervals()); EXPECT_EQ(expected_intervals2, actual_intervals2); - if (!GetQuicReloadableFlag(quic_frames_deque3)) { - ack_frame1.packets.AddRange(15, 20); - ack_frame1.packets.AddRange(30, 35); - - const std::vector<Interval<QuicPacketNumber>> actual_intervals3( - ack_frame1.packets.begin(), ack_frame1.packets.end()); - - std::vector<Interval<QuicPacketNumber>> expected_intervals3; - expected_intervals3.emplace_back(Interval<QuicPacketNumber>(1, 10)); - expected_intervals3.emplace_back(Interval<QuicPacketNumber>(15, 35)); - expected_intervals3.emplace_back(Interval<QuicPacketNumber>(50, 100)); - - EXPECT_EQ(expected_intervals3, actual_intervals3); - - ack_frame1.packets.AddRange(20, 35); - - const std::vector<Interval<QuicPacketNumber>> actual_intervals4( - ack_frame1.packets.begin(), ack_frame1.packets.end()); - - EXPECT_EQ(expected_intervals3, actual_intervals4); - ack_frame1.packets.AddRange(12, 20); - ack_frame1.packets.AddRange(30, 38); - - const std::vector<Interval<QuicPacketNumber>> actual_intervals5( - ack_frame1.packets.begin(), ack_frame1.packets.end()); - - std::vector<Interval<QuicPacketNumber>> expected_intervals5; - expected_intervals5.emplace_back(Interval<QuicPacketNumber>(1, 10)); - expected_intervals5.emplace_back(Interval<QuicPacketNumber>(12, 38)); - expected_intervals5.emplace_back(Interval<QuicPacketNumber>(50, 100)); - - EXPECT_EQ(expected_intervals5, actual_intervals5); - ack_frame1.packets.AddRange(8, 55); - - const std::vector<Interval<QuicPacketNumber>> actual_intervals6( - ack_frame1.packets.begin(), ack_frame1.packets.end()); - - std::vector<Interval<QuicPacketNumber>> expected_intervals6; - expected_intervals6.emplace_back(Interval<QuicPacketNumber>(1, 100)); - - EXPECT_EQ(expected_intervals6, actual_intervals6); - ack_frame1.packets.AddRange(0, 200); - - const std::vector<Interval<QuicPacketNumber>> actual_intervals7( - ack_frame1.packets.begin(), ack_frame1.packets.end()); - - std::vector<Interval<QuicPacketNumber>> expected_intervals7; - expected_intervals7.emplace_back(Interval<QuicPacketNumber>(0, 200)); - - EXPECT_EQ(expected_intervals7, actual_intervals7); - } - // Add ranges at both ends. QuicAckFrame ack_frame2; ack_frame2.packets.AddRange(20, 25); @@ -391,88 +332,6 @@ EXPECT_EQ(expected_intervals, actual_intervals); } -TEST_F(QuicFramesTest, AddMerges) { - SetQuicReloadableFlag(quic_frames_deque3, false); - QuicAckFrame ack_frame1; - ack_frame1.packets.AddRange(110, 112); - ack_frame1.packets.AddRange(106, 108); - ack_frame1.packets.AddRange(102, 104); - ack_frame1.packets.AddRange(1, 2); - ack_frame1.packets.AddRange(4, 7); - ack_frame1.packets.AddRange(10, 20); - ack_frame1.packets.AddRange(21, 30); - ack_frame1.packets.Add(20); - ack_frame1.packets.AddRange(40, 50); - ack_frame1.packets.AddRange(30, 35); - ack_frame1.packets.AddRange(35, 40); - ack_frame1.packets.AddRange(108, 110); - ack_frame1.packets.AddRange(50, 106); - ack_frame1.packets.AddRange(2, 4); - ack_frame1.packets.AddRange(7, 11); - std::vector<Interval<QuicPacketNumber>> expected_intervals; - expected_intervals.emplace_back(Interval<QuicPacketNumber>(1, 112)); - - const std::vector<Interval<QuicPacketNumber>> actual_intervals( - ack_frame1.packets.begin(), ack_frame1.packets.end()); - - EXPECT_EQ(expected_intervals, actual_intervals); -} - -TEST_F(QuicFramesTest, AddIntervalBig) { - SetQuicReloadableFlag(quic_frames_deque3, false); - QuicAckFrame ack_frame1; - ack_frame1.packets.AddRange(20, 30); - ack_frame1.packets.AddRange(70, 100); - ack_frame1.packets.AddRange(56, 58); - ack_frame1.packets.AddRange(65, 69); - ack_frame1.packets.AddRange(59, 64); - ack_frame1.packets.AddRange(50, 55); - - std::vector<Interval<QuicPacketNumber>> expected_intervals; - expected_intervals.emplace_back(Interval<QuicPacketNumber>(20, 30)); - expected_intervals.emplace_back(Interval<QuicPacketNumber>(50, 55)); - expected_intervals.emplace_back(Interval<QuicPacketNumber>(56, 58)); - expected_intervals.emplace_back(Interval<QuicPacketNumber>(59, 64)); - expected_intervals.emplace_back(Interval<QuicPacketNumber>(65, 69)); - expected_intervals.emplace_back(Interval<QuicPacketNumber>(70, 100)); - - const std::vector<Interval<QuicPacketNumber>> actual_intervals( - ack_frame1.packets.begin(), ack_frame1.packets.end()); - - EXPECT_EQ(expected_intervals, actual_intervals); - ack_frame1.packets.AddRange(10, 60); - - std::vector<Interval<QuicPacketNumber>> expected_intervals2; - expected_intervals2.emplace_back(Interval<QuicPacketNumber>(10, 64)); - expected_intervals2.emplace_back(Interval<QuicPacketNumber>(65, 69)); - expected_intervals2.emplace_back(Interval<QuicPacketNumber>(70, 100)); - - const std::vector<Interval<QuicPacketNumber>> actual_intervals2( - ack_frame1.packets.begin(), ack_frame1.packets.end()); - - EXPECT_EQ(expected_intervals2, actual_intervals2); - - ack_frame1.packets.AddRange(68, 1000); - - std::vector<Interval<QuicPacketNumber>> expected_intervals3; - expected_intervals3.emplace_back(Interval<QuicPacketNumber>(10, 64)); - expected_intervals3.emplace_back(Interval<QuicPacketNumber>(65, 1000)); - - const std::vector<Interval<QuicPacketNumber>> actual_intervals3( - ack_frame1.packets.begin(), ack_frame1.packets.end()); - - EXPECT_EQ(expected_intervals3, actual_intervals3); - ack_frame1.packets.AddRange(0, 10000); - - std::vector<Interval<QuicPacketNumber>> expected_intervals4; - expected_intervals4.emplace_back(Interval<QuicPacketNumber>(0, 10000)); - - const std::vector<Interval<QuicPacketNumber>> actual_intervals4( - ack_frame1.packets.begin(), ack_frame1.packets.end()); - - EXPECT_EQ(expected_intervals4, actual_intervals4); -} - TEST_F(QuicFramesTest, RemoveSmallestInterval) { QuicAckFrame ack_frame1; ack_frame1.deprecated_largest_observed = 100u;
diff --git a/net/quic/core/quic_connection.cc b/net/quic/core/quic_connection.cc index 0ba4be1..b8a568a 100644 --- a/net/quic/core/quic_connection.cc +++ b/net/quic/core/quic_connection.cc
@@ -2019,6 +2019,11 @@ } void QuicConnection::SetDefaultEncryptionLevel(EncryptionLevel level) { + if (level != encryption_level_ && packet_generator_.HasQueuedFrames()) { + // Flush all queued frames when encryption level changes. + ScopedPacketFlusher flusher(this, NO_ACK); + packet_generator_.FlushAllQueuedFrames(); + } encryption_level_ = level; packet_generator_.set_encryption_level(level); }
diff --git a/net/quic/core/quic_connection_test.cc b/net/quic/core/quic_connection_test.cc index 4b62fea..f800697 100644 --- a/net/quic/core/quic_connection_test.cc +++ b/net/quic/core/quic_connection_test.cc
@@ -2088,6 +2088,7 @@ // Send two stream frames in 1 packet by queueing them. // If quic_strict_ack_handling is false, the packet // also bundles an empty ack frame and a stop_waiting frame. + connection_.SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE); { QuicConnection::ScopedPacketFlusher flusher(&connection_, QuicConnection::SEND_ACK); @@ -2128,6 +2129,7 @@ TEST_P(QuicConnectionTest, FramePackingNonCryptoThenCrypto) { // Send two stream frames (one non-crypto, then one crypto) in 2 packets by // queueing them. + connection_.SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE); { EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(2); QuicConnection::ScopedPacketFlusher flusher(&connection_,
diff --git a/net/quic/core/quic_crypto_client_stream_test.cc b/net/quic/core/quic_crypto_client_stream_test.cc index 0d81c421..57ea9a1 100644 --- a/net/quic/core/quic_crypto_client_stream_test.cc +++ b/net/quic/core/quic_crypto_client_stream_test.cc
@@ -12,6 +12,7 @@ #include "net/quic/core/quic_packets.h" #include "net/quic/core/quic_server_id.h" #include "net/quic/core/quic_utils.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_flags.h" #include "net/quic/platform/api/quic_test.h" #include "net/quic/test_tools/crypto_test_utils.h" @@ -222,7 +223,7 @@ const string& cached_scfg = state->server_config(); test::CompareCharArraysWithHexError( "scfg", cached_scfg.data(), cached_scfg.length(), - reinterpret_cast<char*>(scfg), arraysize(scfg)); + reinterpret_cast<char*>(scfg), QUIC_ARRAYSIZE(scfg)); QuicStreamSequencer* sequencer = QuicStreamPeer::sequencer(stream()); EXPECT_FALSE(QuicStreamSequencerPeer::IsUnderlyingBufferAllocated(sequencer));
diff --git a/net/quic/core/quic_crypto_server_handshaker.cc b/net/quic/core/quic_crypto_server_handshaker.cc index dfce90a3..9916415 100644 --- a/net/quic/core/quic_crypto_server_handshaker.cc +++ b/net/quic/core/quic_crypto_server_handshaker.cc
@@ -6,6 +6,7 @@ #include <memory> +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_text_utils.h" #include "third_party/boringssl/src/include/openssl/sha.h" @@ -375,7 +376,7 @@ SHA256(reinterpret_cast<const uint8_t*>(channel_id.data()), channel_id.size(), digest); - QuicTextUtils::Base64Encode(digest, arraysize(digest), output); + QuicTextUtils::Base64Encode(digest, QUIC_ARRAYSIZE(digest), output); return true; }
diff --git a/net/quic/core/quic_crypto_stream.cc b/net/quic/core/quic_crypto_stream.cc index a60e30f..9bd4a47 100644 --- a/net/quic/core/quic_crypto_stream.cc +++ b/net/quic/core/quic_crypto_stream.cc
@@ -97,4 +97,65 @@ WriteOrBufferData(data, /* fin */ false, /* ack_listener */ nullptr); } +void QuicCryptoStream::NeuterUnencryptedStreamData() { + for (const auto& interval : bytes_consumed_[ENCRYPTION_NONE]) { + QuicByteCount newly_acked_length = 0; + send_buffer().OnStreamDataAcked( + interval.min(), interval.max() - interval.min(), &newly_acked_length); + } +} + +void QuicCryptoStream::OnStreamDataConsumed(size_t bytes_consumed) { + if (bytes_consumed > 0) { + bytes_consumed_[session()->connection()->encryption_level()].Add( + stream_bytes_written(), stream_bytes_written() + bytes_consumed); + } + QuicStream::OnStreamDataConsumed(bytes_consumed); +} + +void QuicCryptoStream::WritePendingRetransmission() { + while (HasPendingRetransmission()) { + StreamPendingRetransmission pending = + send_buffer().NextPendingRetransmission(); + QuicIntervalSet<QuicStreamOffset> retransmission( + pending.offset, pending.offset + pending.length); + EncryptionLevel retransmission_encryption_level = ENCRYPTION_NONE; + // Determine the encryption level to write the retransmission + // at. The retransmission should be written at the same encryption level + // as the original transmission. + for (size_t i = 0; i < NUM_ENCRYPTION_LEVELS; ++i) { + if (retransmission.Intersects(bytes_consumed_[i])) { + retransmission_encryption_level = static_cast<EncryptionLevel>(i); + retransmission.Intersection(bytes_consumed_[i]); + break; + } + } + pending.offset = retransmission.begin()->min(); + pending.length = + retransmission.begin()->max() - retransmission.begin()->min(); + EncryptionLevel current_encryption_level = + session()->connection()->encryption_level(); + // Set appropriate encryption level. + session()->connection()->SetDefaultEncryptionLevel( + retransmission_encryption_level); + QuicConsumedData consumed = session()->WritevData( + this, id(), pending.length, pending.offset, NO_FIN); + QUIC_DVLOG(1) << ENDPOINT << "stream " << id() + << " tries to retransmit stream data [" << pending.offset + << ", " << pending.offset + pending.length + << ") with encryption level: " + << retransmission_encryption_level + << ", consumed: " << consumed; + OnStreamFrameRetransmitted(pending.offset, consumed.bytes_consumed, + consumed.fin_consumed); + // Restore encryption level. + session()->connection()->SetDefaultEncryptionLevel( + current_encryption_level); + if (consumed.bytes_consumed < pending.length) { + // The connection is write blocked. + break; + } + } +} + } // namespace net
diff --git a/net/quic/core/quic_crypto_stream.h b/net/quic/core/quic_crypto_stream.h index ef68563..695e1e5 100644 --- a/net/quic/core/quic_crypto_stream.h +++ b/net/quic/core/quic_crypto_stream.h
@@ -79,7 +79,22 @@ // Provides the message parser to use when data is received on this stream. virtual CryptoMessageParser* crypto_message_parser() = 0; + // Called to cancel retransmission of unencrypted crypto stream data. + void NeuterUnencryptedStreamData(); + + // Override to record the encryption level of consumed data. + void OnStreamDataConsumed(size_t bytes_consumed) override; + + // Override to retransmit lost crypto data with the appropriate encryption + // level. + void WritePendingRetransmission() override; + private: + // Consumed data according to encryption levels. + // TODO(fayang): This is not needed once switching from QUIC crypto to + // TLS 1.3, which never encrypts crypto data. + QuicIntervalSet<QuicStreamOffset> bytes_consumed_[NUM_ENCRYPTION_LEVELS]; + DISALLOW_COPY_AND_ASSIGN(QuicCryptoStream); };
diff --git a/net/quic/core/quic_crypto_stream_test.cc b/net/quic/core/quic_crypto_stream_test.cc index bf29b6c..3488d8eb4 100644 --- a/net/quic/core/quic_crypto_stream_test.cc +++ b/net/quic/core/quic_crypto_stream_test.cc
@@ -20,6 +20,10 @@ using std::string; +using testing::_; +using testing::InSequence; +using testing::Invoke; + namespace net { namespace test { namespace { @@ -125,6 +129,79 @@ QuicStreamPeer::StreamContributesToConnectionFlowControl(&stream_)); } +TEST_F(QuicCryptoStreamTest, RetransmitCryptoData) { + if (!FLAGS_quic_reloadable_flag_quic_allow_multiple_acks_for_data2) { + return; + } + InSequence s; + // Send [0, 1350) in ENCRYPTION_NONE. + EXPECT_EQ(ENCRYPTION_NONE, connection_->encryption_level()); + string data(1350, 'a'); + EXPECT_CALL(session_, WritevData(_, kCryptoStreamId, 1350, 0, _)) + .WillOnce(Invoke(MockQuicSession::ConsumeAllData)); + stream_.WriteOrBufferData(data, false, nullptr); + // Send [1350, 2700) in ENCRYPTION_INITIAL. + connection_->SetDefaultEncryptionLevel(ENCRYPTION_INITIAL); + EXPECT_EQ(ENCRYPTION_INITIAL, connection_->encryption_level()); + EXPECT_CALL(session_, WritevData(_, kCryptoStreamId, 1350, 1350, _)) + .WillOnce(Invoke(MockQuicSession::ConsumeAllData)); + stream_.WriteOrBufferData(data, false, nullptr); + connection_->SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE); + EXPECT_EQ(ENCRYPTION_FORWARD_SECURE, connection_->encryption_level()); + + // Lost [0, 1000). + stream_.OnStreamFrameLost(0, 1000, false); + EXPECT_TRUE(stream_.HasPendingRetransmission()); + // Lost [1200, 2000). + stream_.OnStreamFrameLost(1200, 800, false); + EXPECT_CALL(session_, WritevData(_, kCryptoStreamId, 1000, 0, _)) + .WillOnce(Invoke(MockQuicSession::ConsumeAllData)); + // Verify [1200, 2000) are sent in [1200, 1350) and [1350, 2000) because of + // they are in different encryption levels. + EXPECT_CALL(session_, WritevData(_, kCryptoStreamId, 150, 1200, _)) + .WillOnce(Invoke(MockQuicSession::ConsumeAllData)); + EXPECT_CALL(session_, WritevData(_, kCryptoStreamId, 650, 1350, _)) + .WillOnce(Invoke(MockQuicSession::ConsumeAllData)); + stream_.OnCanWrite(); + EXPECT_FALSE(stream_.HasPendingRetransmission()); + // Verify connection's encryption level has restored. + EXPECT_EQ(ENCRYPTION_FORWARD_SECURE, connection_->encryption_level()); +} + +TEST_F(QuicCryptoStreamTest, NeuterUnencryptedStreamData) { + if (!FLAGS_quic_reloadable_flag_quic_allow_multiple_acks_for_data2) { + return; + } + // Send [0, 1350) in ENCRYPTION_NONE. + EXPECT_EQ(ENCRYPTION_NONE, connection_->encryption_level()); + string data(1350, 'a'); + EXPECT_CALL(session_, WritevData(_, kCryptoStreamId, 1350, 0, _)) + .WillOnce(Invoke(MockQuicSession::ConsumeAllData)); + stream_.WriteOrBufferData(data, false, nullptr); + // Send [1350, 2700) in ENCRYPTION_INITIAL. + connection_->SetDefaultEncryptionLevel(ENCRYPTION_INITIAL); + EXPECT_EQ(ENCRYPTION_INITIAL, connection_->encryption_level()); + EXPECT_CALL(session_, WritevData(_, kCryptoStreamId, 1350, 1350, _)) + .WillOnce(Invoke(MockQuicSession::ConsumeAllData)); + stream_.WriteOrBufferData(data, false, nullptr); + + // Lost [0, 1350). + stream_.OnStreamFrameLost(0, 1350, false); + EXPECT_TRUE(stream_.HasPendingRetransmission()); + // Neuters [0, 1350). + stream_.NeuterUnencryptedStreamData(); + EXPECT_FALSE(stream_.HasPendingRetransmission()); + // Lost [0, 1350) again. + stream_.OnStreamFrameLost(0, 1350, false); + EXPECT_FALSE(stream_.HasPendingRetransmission()); + + // Lost [1350, 2000). + stream_.OnStreamFrameLost(1350, 650, false); + EXPECT_TRUE(stream_.HasPendingRetransmission()); + stream_.NeuterUnencryptedStreamData(); + EXPECT_TRUE(stream_.HasPendingRetransmission()); +} + } // namespace } // namespace test } // namespace net
diff --git a/net/quic/core/quic_data_writer_test.cc b/net/quic/core/quic_data_writer_test.cc index 2217ed1c..bc59ba40 100644 --- a/net/quic/core/quic_data_writer_test.cc +++ b/net/quic/core/quic_data_writer_test.cc
@@ -8,6 +8,7 @@ #include "net/quic/core/quic_data_reader.h" #include "net/quic/core/quic_utils.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_flags.h" #include "net/quic/platform/api/quic_test.h" #include "net/quic/test_tools/quic_test_utils.h" @@ -558,22 +559,22 @@ TEST_P(QuicDataWriterTest, WriteBytes) { char bytes[] = {0, 1, 2, 3, 4, 5, 6, 7, 8}; - char buf[arraysize(bytes)]; - QuicDataWriter writer(arraysize(buf), buf, GetParam().endianness); - EXPECT_TRUE(writer.WriteBytes(bytes, arraysize(bytes))); - for (unsigned int i = 0; i < arraysize(bytes); ++i) { + char buf[QUIC_ARRAYSIZE(bytes)]; + QuicDataWriter writer(QUIC_ARRAYSIZE(buf), buf, GetParam().endianness); + EXPECT_TRUE(writer.WriteBytes(bytes, QUIC_ARRAYSIZE(bytes))); + for (unsigned int i = 0; i < QUIC_ARRAYSIZE(bytes); ++i) { EXPECT_EQ(bytes[i], buf[i]); } } TEST_P(QuicDataWriterTest, WriteUInt8AtOffset) { char bytes[] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'}; - char buf[arraysize(bytes)]; - for (unsigned int i = 0; i < arraysize(bytes); ++i) { - QuicDataWriter writer(arraysize(buf), buf, GetParam().endianness); - EXPECT_TRUE(writer.WriteBytes(bytes, arraysize(bytes))); + char buf[QUIC_ARRAYSIZE(bytes)]; + for (unsigned int i = 0; i < QUIC_ARRAYSIZE(bytes); ++i) { + QuicDataWriter writer(QUIC_ARRAYSIZE(buf), buf, GetParam().endianness); + EXPECT_TRUE(writer.WriteBytes(bytes, QUIC_ARRAYSIZE(bytes))); EXPECT_TRUE(writer.WriteUInt8AtOffset('I', i)); - for (unsigned int j = 0; j < arraysize(bytes); ++j) { + for (unsigned int j = 0; j < QUIC_ARRAYSIZE(bytes); ++j) { if (j == i) { EXPECT_EQ('I', buf[j]); } else {
diff --git a/net/quic/core/quic_flags_list.h b/net/quic/core/quic_flags_list.h index 51e5fb92..71a5d90 100644 --- a/net/quic/core/quic_flags_list.h +++ b/net/quic/core/quic_flags_list.h
@@ -85,10 +85,6 @@ // option. QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_bbr_rate_recovery, false) -// Adds a QuicPacketNumberQueue that is based on a deque and does not support -// costly AddRange arguments. -QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_frames_deque3, true) - // If true, enable QUIC v42. QUIC_FLAG(bool, FLAGS_quic_enable_version_42, false) @@ -118,19 +114,11 @@ FLAGS_quic_reloadable_flag_quic_allow_address_change_for_udp_proxy, true) -// If true, allow a new BBR connection option to use a slower STARTUP once loss -// occurs -QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_bbr_slower_startup, true) - // Deprecate QuicAckFrame.largest_observed since it is redundant. QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_deprecate_largest_observed, true) -// Fully drain the queue in QUIC BBR at least once per cycle(8 rounds) when -// activated by the BBR3 connection option. -QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_bbr_fully_drain_queue, true) - // When true, allows connection options to be sent to completely disable packet // conservation in QUIC BBR STARTUP or make it more aggressive. QUIC_FLAG(bool, @@ -151,7 +139,7 @@ // Explicitly send a connection close if the TLP count is greater than 0 when // idle timeout occurs. -QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_explicit_close_after_tlp, false) +QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_explicit_close_after_tlp, true) // Enables 3 new connection options to make PROBE_RTT more aggressive QUIC_FLAG(bool, FLAGS_quic_reloadable_flag_quic_bbr_less_probe_rtt, false)
diff --git a/net/quic/core/quic_framer_test.cc b/net/quic/core/quic_framer_test.cc index b711e79..20e71cb 100644 --- a/net/quic/core/quic_framer_test.cc +++ b/net/quic/core/quic_framer_test.cc
@@ -17,6 +17,7 @@ #include "net/quic/core/crypto/quic_encrypter.h" #include "net/quic/core/quic_packets.h" #include "net/quic/core/quic_utils.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_flags.h" #include "net/quic/platform/api/quic_logging.h" #include "net/quic/platform/api/quic_ptr_util.h" @@ -588,7 +589,7 @@ memset(packet + header_size, 0, kMaxPacketSize - header_size); - QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false); + QuicEncryptedPacket encrypted(AsChars(packet), QUIC_ARRAYSIZE(packet), false); EXPECT_QUIC_BUG(framer_.ProcessPacket(encrypted), "Packet too large:1"); ASSERT_TRUE(visitor_.header_.get()); @@ -954,7 +955,7 @@ QuicEncryptedPacket encrypted( AsChars(framer_.transport_version() <= QUIC_VERSION_38 ? packet : packet39), - arraysize(packet), false); + QUIC_ARRAYSIZE(packet), false); QuicFramerPeer::SetPerspective(&framer_, Perspective::IS_CLIENT); EXPECT_TRUE(framer_.ProcessPacket(encrypted)); ASSERT_TRUE(visitor_.header_->nonce != nullptr); @@ -1003,7 +1004,7 @@ QuicEncryptedPacket encrypted( AsChars(framer_.transport_version() <= QUIC_VERSION_38 ? packet : packet39), - arraysize(packet), false); + QUIC_ARRAYSIZE(packet), false); EXPECT_TRUE(framer_.ProcessPacket(encrypted)); EXPECT_EQ(QUIC_NO_ERROR, framer_.error()); ASSERT_TRUE(visitor_.header_.get()); @@ -1047,7 +1048,7 @@ return; } - QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false); + QuicEncryptedPacket encrypted(AsChars(packet), QUIC_ARRAYSIZE(packet), false); EXPECT_TRUE(framer_.ProcessPacket(encrypted)); EXPECT_EQ(QUIC_NO_ERROR, framer_.error()); ASSERT_TRUE(visitor_.header_.get()); @@ -1165,7 +1166,7 @@ p = packet39; } - QuicEncryptedPacket encrypted(AsChars(p), arraysize(packet), false); + QuicEncryptedPacket encrypted(AsChars(p), QUIC_ARRAYSIZE(packet), false); EXPECT_TRUE(framer_.ProcessPacket(encrypted)); EXPECT_EQ(QUIC_NO_ERROR, framer_.error()); ASSERT_TRUE(visitor_.header_.get()); @@ -1388,7 +1389,7 @@ } else if (framer_.transport_version() > QUIC_VERSION_38) { p = packet39; } - QuicEncryptedPacket encrypted(AsChars(p), arraysize(packet), false); + QuicEncryptedPacket encrypted(AsChars(p), QUIC_ARRAYSIZE(packet), false); EXPECT_FALSE(framer_.ProcessPacket(encrypted)); EXPECT_EQ(QUIC_DECRYPTION_FAILURE, framer_.error()); } @@ -1961,7 +1962,7 @@ } else if (framer_.transport_version() > QUIC_VERSION_38) { p = packet39; } - QuicEncryptedPacket encrypted(AsChars(p), arraysize(packet), false); + QuicEncryptedPacket encrypted(AsChars(p), QUIC_ARRAYSIZE(packet), false); EXPECT_TRUE(framer_.ProcessPacket(encrypted)); EXPECT_EQ(QUIC_NO_ERROR, framer_.error()); @@ -1985,7 +1986,7 @@ }; // clang-format on - QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false); + QuicEncryptedPacket encrypted(AsChars(packet), QUIC_ARRAYSIZE(packet), false); EXPECT_TRUE(framer_.ProcessPacket(encrypted)); EXPECT_EQ(QUIC_NO_ERROR, framer_.error()); @@ -2783,7 +2784,7 @@ QuicEncryptedPacket encrypted( AsChars(framer_.transport_version() <= QUIC_VERSION_38 ? packet : packet39), - arraysize(packet), false); + QUIC_ARRAYSIZE(packet), false); EXPECT_FALSE(framer_.ProcessPacket(encrypted)); EXPECT_EQ(QUIC_INVALID_STOP_WAITING_DATA, framer_.error()); EXPECT_EQ("Invalid unacked delta.", framer_.detailed_error()); @@ -3201,7 +3202,7 @@ QuicEncryptedPacket encrypted( AsChars(framer_.transport_version() <= QUIC_VERSION_38 ? packet : packet39), - arraysize(packet), false); + QUIC_ARRAYSIZE(packet), false); EXPECT_TRUE(framer_.ProcessPacket(encrypted)); EXPECT_EQ(QUIC_NO_ERROR, framer_.error()); @@ -3342,7 +3343,7 @@ }; // clang-format on - QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false); + QuicEncryptedPacket encrypted(AsChars(packet), QUIC_ARRAYSIZE(packet), false); EXPECT_FALSE(framer_.ProcessPacket(encrypted)); ASSERT_EQ(QUIC_INVALID_PUBLIC_RST_PACKET, framer_.error()); EXPECT_EQ("Unable to read reset message.", framer_.detailed_error()); @@ -3527,7 +3528,7 @@ "constructed packet", data->data(), data->length(), AsChars(framer_.transport_version() <= QUIC_VERSION_38 ? packet : packet39), - arraysize(packet)); + QUIC_ARRAYSIZE(packet)); } TEST_P(QuicFramerTest, BuildStreamFramePacketWithNewPaddingFrame) { @@ -3641,11 +3642,11 @@ } else if (framer_.transport_version() > QUIC_VERSION_38) { p = packet39; } - QuicEncryptedPacket encrypted(AsChars(p), arraysize(packet), false); + QuicEncryptedPacket encrypted(AsChars(p), QUIC_ARRAYSIZE(packet), false); test::CompareCharArraysWithHexError("constructed packet", data->data(), data->length(), AsChars(p), - arraysize(packet)); + QUIC_ARRAYSIZE(packet)); } TEST_P(QuicFramerTest, Build4ByteSequenceNumberPaddingFramePacket) { @@ -3700,7 +3701,7 @@ "constructed packet", data->data(), data->length(), AsChars(framer_.transport_version() <= QUIC_VERSION_38 ? packet : packet39), - arraysize(packet)); + QUIC_ARRAYSIZE(packet)); } TEST_P(QuicFramerTest, Build2ByteSequenceNumberPaddingFramePacket) { @@ -3755,7 +3756,7 @@ "constructed packet", data->data(), data->length(), AsChars(framer_.transport_version() <= QUIC_VERSION_38 ? packet : packet39), - arraysize(packet)); + QUIC_ARRAYSIZE(packet)); } TEST_P(QuicFramerTest, Build1ByteSequenceNumberPaddingFramePacket) { @@ -3793,7 +3794,7 @@ test::CompareCharArraysWithHexError("constructed packet", data->data(), data->length(), AsChars(packet), - arraysize(packet)); + QUIC_ARRAYSIZE(packet)); } TEST_P(QuicFramerTest, BuildStreamFramePacket) { @@ -3887,7 +3888,7 @@ } test::CompareCharArraysWithHexError("constructed packet", data->data(), data->length(), AsChars(p), - arraysize(packet)); + QUIC_ARRAYSIZE(packet)); } TEST_P(QuicFramerTest, BuildStreamFramePacketWithVersionFlag) { @@ -3975,7 +3976,7 @@ } test::CompareCharArraysWithHexError("constructed packet", data->data(), data->length(), AsChars(p), - arraysize(packet)); + QUIC_ARRAYSIZE(packet)); } TEST_P(QuicFramerTest, BuildVersionNegotiationPacket) { @@ -3996,7 +3997,7 @@ SupportedVersions(GetParam()))); test::CompareCharArraysWithHexError("constructed packet", data->data(), data->length(), AsChars(packet), - arraysize(packet)); + QUIC_ARRAYSIZE(packet)); } TEST_P(QuicFramerTest, BuildAckFramePacketOneAckBlock) { @@ -4087,7 +4088,7 @@ ASSERT_TRUE(data != nullptr); test::CompareCharArraysWithHexError("constructed packet", data->data(), data->length(), AsChars(p), - arraysize(packet)); + QUIC_ARRAYSIZE(packet)); } TEST_P(QuicFramerTest, BuildAckFramePacketOneAckBlockMaxLength) { @@ -4098,7 +4099,6 @@ header.packet_number = kPacketNumber; QuicAckFrame ack_frame = InitAckFrame(kPacketNumber); - SetQuicReloadableFlag(quic_frames_deque3, true); ack_frame.ack_delay_time = QuicTime::Delta::Zero(); QuicFrames frames = {QuicFrame(&ack_frame)}; @@ -4168,13 +4168,13 @@ }; // clang-format on unsigned char* p = packet; - size_t packet_size = arraysize(packet); + size_t packet_size = QUIC_ARRAYSIZE(packet); if (framer_.transport_version() > QUIC_VERSION_39) { p = packet41; - packet_size = arraysize(packet41); + packet_size = QUIC_ARRAYSIZE(packet41); } else if (framer_.transport_version() > QUIC_VERSION_38) { p = packet39; - packet_size = arraysize(packet39); + packet_size = QUIC_ARRAYSIZE(packet39); } std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames)); @@ -4330,7 +4330,7 @@ test::CompareCharArraysWithHexError("constructed packet", data->data(), data->length(), AsChars(p), - arraysize(packet)); + QUIC_ARRAYSIZE(packet)); } TEST_P(QuicFramerTest, BuildAckFramePacketMaxAckBlocks) { @@ -4644,7 +4644,7 @@ test::CompareCharArraysWithHexError("constructed packet", data->data(), data->length(), AsChars(p), - arraysize(packet)); + QUIC_ARRAYSIZE(packet)); } TEST_P(QuicFramerTest, BuildNewStopWaitingPacket) { @@ -4698,7 +4698,7 @@ "constructed packet", data->data(), data->length(), AsChars(framer_.transport_version() <= QUIC_VERSION_38 ? packet : packet39), - arraysize(packet)); + QUIC_ARRAYSIZE(packet)); } TEST_P(QuicFramerTest, BuildRstFramePacketQuic) { @@ -4786,11 +4786,11 @@ } else if (framer_.transport_version() > QUIC_VERSION_38) { p = packet39; } - QuicEncryptedPacket encrypted(AsChars(p), arraysize(packet), false); + QuicEncryptedPacket encrypted(AsChars(p), QUIC_ARRAYSIZE(packet), false); test::CompareCharArraysWithHexError("constructed packet", data->data(), data->length(), AsChars(p), - arraysize(packet)); + QUIC_ARRAYSIZE(packet)); } TEST_P(QuicFramerTest, BuildCloseFramePacket) { @@ -4859,7 +4859,7 @@ "constructed packet", data->data(), data->length(), AsChars(framer_.transport_version() <= QUIC_VERSION_38 ? packet : packet39), - arraysize(packet)); + QUIC_ARRAYSIZE(packet)); } TEST_P(QuicFramerTest, BuildTruncatedCloseFramePacket) { @@ -4978,10 +4978,10 @@ // clang-format on unsigned char* p = packet; - size_t packet_size = arraysize(packet); + size_t packet_size = QUIC_ARRAYSIZE(packet); if (framer_.transport_version() > QUIC_VERSION_38) { p = packet39; - packet_size = arraysize(packet39); + packet_size = QUIC_ARRAYSIZE(packet39); } std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames)); @@ -5062,7 +5062,7 @@ "constructed packet", data->data(), data->length(), AsChars(framer_.transport_version() <= QUIC_VERSION_38 ? packet : packet39), - arraysize(packet)); + QUIC_ARRAYSIZE(packet)); } TEST_P(QuicFramerTest, BuildTruncatedGoAwayPacket) { @@ -5186,10 +5186,10 @@ // clang-format on unsigned char* p = packet; - size_t packet_size = arraysize(packet); + size_t packet_size = QUIC_ARRAYSIZE(packet); if (framer_.transport_version() > QUIC_VERSION_38) { p = packet39; - packet_size = arraysize(packet39); + packet_size = QUIC_ARRAYSIZE(packet39); } std::unique_ptr<QuicPacket> data(BuildDataPacket(header, frames)); @@ -5257,7 +5257,7 @@ "constructed packet", data->data(), data->length(), AsChars(framer_.transport_version() <= QUIC_VERSION_38 ? packet : packet39), - arraysize(packet)); + QUIC_ARRAYSIZE(packet)); } TEST_P(QuicFramerTest, BuildBlockedPacket) { @@ -5311,7 +5311,7 @@ "constructed packet", data->data(), data->length(), AsChars(framer_.transport_version() <= QUIC_VERSION_38 ? packet : packet39), - arraysize(packet)); + QUIC_ARRAYSIZE(packet)); } TEST_P(QuicFramerTest, BuildPingPacket) { @@ -5358,7 +5358,7 @@ "constructed packet", data->data(), data->length(), AsChars(framer_.transport_version() <= QUIC_VERSION_38 ? packet : packet39), - arraysize(packet)); + QUIC_ARRAYSIZE(packet)); } // Test that the connectivity probing packet is serialized correctly as a @@ -5405,10 +5405,10 @@ // clang-format on unsigned char* p = packet; - size_t packet_size = arraysize(packet); + size_t packet_size = QUIC_ARRAYSIZE(packet); if (framer_.transport_version() > QUIC_VERSION_38) { p = packet39; - packet_size = arraysize(packet39); + packet_size = QUIC_ARRAYSIZE(packet39); } std::unique_ptr<char[]> buffer(new char[kMaxPacketSize]); @@ -5425,7 +5425,7 @@ "constructed packet", data.data(), data.length(), AsChars(framer_.transport_version() <= QUIC_VERSION_38 ? packet : packet39), - arraysize(packet)); + QUIC_ARRAYSIZE(packet)); } // Test that the MTU discovery packet is serialized correctly as a PING packet. @@ -5473,7 +5473,7 @@ "constructed packet", data->data(), data->length(), AsChars(framer_.transport_version() <= QUIC_VERSION_38 ? packet : packet39), - arraysize(packet)); + QUIC_ARRAYSIZE(packet)); } TEST_P(QuicFramerTest, BuildPublicResetPacket) { @@ -5506,7 +5506,7 @@ ASSERT_TRUE(data != nullptr); test::CompareCharArraysWithHexError("constructed packet", data->data(), data->length(), AsChars(packet), - arraysize(packet)); + QUIC_ARRAYSIZE(packet)); } TEST_P(QuicFramerTest, BuildPublicResetPacketWithClientAddress) { @@ -5551,7 +5551,7 @@ test::CompareCharArraysWithHexError("constructed packet", data->data(), data->length(), AsChars(packet), - arraysize(packet)); + QUIC_ARRAYSIZE(packet)); } TEST_P(QuicFramerTest, EncryptPacket) { @@ -5593,8 +5593,9 @@ std::unique_ptr<QuicPacket> raw(new QuicPacket( AsChars(framer_.transport_version() <= QUIC_VERSION_38 ? packet : packet39), - arraysize(packet), false, PACKET_8BYTE_CONNECTION_ID, !kIncludeVersion, - !kIncludeDiversificationNonce, PACKET_6BYTE_PACKET_NUMBER)); + QUIC_ARRAYSIZE(packet), false, PACKET_8BYTE_CONNECTION_ID, + !kIncludeVersion, !kIncludeDiversificationNonce, + PACKET_6BYTE_PACKET_NUMBER)); char buffer[kMaxPacketSize]; size_t encrypted_length = framer_.EncryptPayload( ENCRYPTION_NONE, packet_number, *raw, buffer, kMaxPacketSize); @@ -5646,8 +5647,9 @@ std::unique_ptr<QuicPacket> raw(new QuicPacket( AsChars(framer_.transport_version() <= QUIC_VERSION_38 ? packet : packet39), - arraysize(packet), false, PACKET_8BYTE_CONNECTION_ID, kIncludeVersion, - !kIncludeDiversificationNonce, PACKET_6BYTE_PACKET_NUMBER)); + QUIC_ARRAYSIZE(packet), false, PACKET_8BYTE_CONNECTION_ID, + kIncludeVersion, !kIncludeDiversificationNonce, + PACKET_6BYTE_PACKET_NUMBER)); char buffer[kMaxPacketSize]; size_t encrypted_length = framer_.EncryptPayload( ENCRYPTION_NONE, packet_number, *raw, buffer, kMaxPacketSize); @@ -5891,7 +5893,7 @@ } else if (framer_.transport_version() > QUIC_VERSION_38) { p = packet39; } - QuicEncryptedPacket encrypted(AsChars(p), arraysize(packet), false); + QuicEncryptedPacket encrypted(AsChars(p), QUIC_ARRAYSIZE(packet), false); EXPECT_TRUE(framer_.ProcessPacket(encrypted)); EXPECT_EQ(QUIC_NO_ERROR, framer_.error()); } @@ -6093,7 +6095,7 @@ } else if (framer_.transport_version() > QUIC_VERSION_38) { p = packet39; } - QuicFramerFuzzFunc(p, arraysize(packet)); + QuicFramerFuzzFunc(p, QUIC_ARRAYSIZE(packet)); } TEST_P(QuicFramerTest, StartsWithChlo) {
diff --git a/net/quic/core/quic_headers_stream.cc b/net/quic/core/quic_headers_stream.cc index 68e2b5a6..5f7276d4 100644 --- a/net/quic/core/quic_headers_stream.cc +++ b/net/quic/core/quic_headers_stream.cc
@@ -5,6 +5,7 @@ #include "net/quic/core/quic_headers_stream.h" #include "net/quic/core/quic_spdy_session.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_flag_utils.h" #include "net/quic/platform/api/quic_flags.h" @@ -38,7 +39,7 @@ QuicTime timestamp(QuicTime::Zero()); while (true) { iov.iov_base = buffer; - iov.iov_len = arraysize(buffer); + iov.iov_len = QUIC_ARRAYSIZE(buffer); if (!sequencer()->GetReadableRegion(&iov, ×tamp)) { // No more data to read. break; @@ -111,7 +112,8 @@ } void QuicHeadersStream::OnStreamFrameRetransmitted(QuicStreamOffset offset, - QuicByteCount data_length) { + QuicByteCount data_length, + bool /*fin_retransmitted*/) { for (CompressedHeaderInfo& header : unacked_headers_) { if (offset < header.headers_stream_offset) { // This header frame offset belongs to headers with smaller offset, stop
diff --git a/net/quic/core/quic_headers_stream.h b/net/quic/core/quic_headers_stream.h index 9d6df38..4892b0e 100644 --- a/net/quic/core/quic_headers_stream.h +++ b/net/quic/core/quic_headers_stream.h
@@ -44,7 +44,8 @@ QuicTime::Delta ack_delay_time) override; void OnStreamFrameRetransmitted(QuicStreamOffset offset, - QuicByteCount data_length) override; + QuicByteCount data_length, + bool fin_retransmitted) override; private: friend class test::QuicHeadersStreamPeer;
diff --git a/net/quic/core/quic_headers_stream_test.cc b/net/quic/core/quic_headers_stream_test.cc index 2e7285f0..4a50c19 100644 --- a/net/quic/core/quic_headers_stream_test.cc +++ b/net/quic/core/quic_headers_stream_test.cc
@@ -866,8 +866,8 @@ // Packet 2 gets retransmitted. EXPECT_CALL(*ack_listener3, OnPacketRetransmitted(7)).Times(1); EXPECT_CALL(*ack_listener2, OnPacketRetransmitted(7)).Times(1); - headers_stream_->OnStreamFrameRetransmitted(21, 7); - headers_stream_->OnStreamFrameRetransmitted(28, 7); + headers_stream_->OnStreamFrameRetransmitted(21, 7, false); + headers_stream_->OnStreamFrameRetransmitted(28, 7, false); // Packets are acked in order: 2, 3, 1. EXPECT_CALL(*ack_listener3, OnPacketAcked(7, _)); @@ -916,7 +916,7 @@ // Frame 1 is retransmitted. EXPECT_CALL(*ack_listener1, OnPacketRetransmitted(14)); EXPECT_CALL(*ack_listener2, OnPacketRetransmitted(3)); - headers_stream_->OnStreamFrameRetransmitted(0, 17); + headers_stream_->OnStreamFrameRetransmitted(0, 17, false); // Frames are acked in order: 2, 3, 1. EXPECT_CALL(*ack_listener2, OnPacketAcked(4, _));
diff --git a/net/quic/core/quic_packet_creator.cc b/net/quic/core/quic_packet_creator.cc index d8dc3999..03db15e 100644 --- a/net/quic/core/quic_packet_creator.cc +++ b/net/quic/core/quic_packet_creator.cc
@@ -12,6 +12,7 @@ #include "net/quic/core/quic_data_writer.h" #include "net/quic/core/quic_utils.h" #include "net/quic/platform/api/quic_aligned.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_bug_tracker.h" #include "net/quic/platform/api/quic_flag_utils.h" #include "net/quic/platform/api/quic_flags.h" @@ -302,7 +303,7 @@ QuicPacketHeader header; FillPacketHeader(&header); QUIC_CACHELINE_ALIGNED char encrypted_buffer[kMaxPacketSize]; - QuicDataWriter writer(arraysize(encrypted_buffer), encrypted_buffer, + QuicDataWriter writer(QUIC_ARRAYSIZE(encrypted_buffer), encrypted_buffer, framer_->endianness()); if (!framer_->AppendPacketHeader(header, &writer)) { QUIC_BUG << "AppendPacketHeader failed"; @@ -343,7 +344,7 @@ size_t encrypted_length = framer_->EncryptInPlace( packet_.encryption_level, packet_.packet_number, GetStartOfEncryptedData(framer_->transport_version(), header), - writer.length(), arraysize(encrypted_buffer), encrypted_buffer); + writer.length(), QUIC_ARRAYSIZE(encrypted_buffer), encrypted_buffer); if (encrypted_length == 0) { QUIC_BUG << "Failed to encrypt packet number " << header.packet_number; return;
diff --git a/net/quic/core/quic_sent_packet_manager_test.cc b/net/quic/core/quic_sent_packet_manager_test.cc index 25e7a78..9341f38 100644 --- a/net/quic/core/quic_sent_packet_manager_test.cc +++ b/net/quic/core/quic_sent_packet_manager_test.cc
@@ -7,6 +7,7 @@ #include <memory> #include "net/quic/core/quic_pending_retransmission.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_flags.h" #include "net/quic/platform/api/quic_ptr_util.h" #include "net/quic/platform/api/quic_string_piece.h" @@ -255,9 +256,10 @@ SendDataPacket(1); QuicPacketNumber unacked[] = {1}; - VerifyUnackedPackets(unacked, arraysize(unacked)); + VerifyUnackedPackets(unacked, QUIC_ARRAYSIZE(unacked)); QuicPacketNumber retransmittable[] = {1}; - VerifyRetransmittablePackets(retransmittable, arraysize(retransmittable)); + VerifyRetransmittablePackets(retransmittable, + QUIC_ARRAYSIZE(retransmittable)); } TEST_F(QuicSentPacketManagerTest, IsUnAckedRetransmit) { @@ -266,9 +268,10 @@ EXPECT_TRUE(QuicSentPacketManagerPeer::IsRetransmission(&manager_, 2)); QuicPacketNumber unacked[] = {1, 2}; - VerifyUnackedPackets(unacked, arraysize(unacked)); + VerifyUnackedPackets(unacked, QUIC_ARRAYSIZE(unacked)); QuicPacketNumber retransmittable[] = {2}; - VerifyRetransmittablePackets(retransmittable, arraysize(retransmittable)); + VerifyRetransmittablePackets(retransmittable, + QUIC_ARRAYSIZE(retransmittable)); } TEST_F(QuicSentPacketManagerTest, RetransmitThenAck) { @@ -283,7 +286,7 @@ // Packet 1 is unacked, pending, but not retransmittable. QuicPacketNumber unacked[] = {1}; - VerifyUnackedPackets(unacked, arraysize(unacked)); + VerifyUnackedPackets(unacked, QUIC_ARRAYSIZE(unacked)); EXPECT_TRUE(QuicSentPacketManagerPeer::HasPendingPackets(&manager_)); VerifyRetransmittablePackets(nullptr, 0); } @@ -320,7 +323,7 @@ EXPECT_FALSE(manager_.HasPendingRetransmissions()); QuicPacketNumber unacked[] = {1}; - VerifyUnackedPackets(unacked, arraysize(unacked)); + VerifyUnackedPackets(unacked, QUIC_ARRAYSIZE(unacked)); VerifyRetransmittablePackets(nullptr, 0); EXPECT_EQ(0u, stats_.packets_spuriously_retransmitted); } @@ -338,7 +341,7 @@ // 2 remains unacked, but no packets have retransmittable data. QuicPacketNumber unacked[] = {2}; - VerifyUnackedPackets(unacked, arraysize(unacked)); + VerifyUnackedPackets(unacked, QUIC_ARRAYSIZE(unacked)); EXPECT_TRUE(QuicSentPacketManagerPeer::HasPendingPackets(&manager_)); VerifyRetransmittablePackets(nullptr, 0); @@ -406,7 +409,7 @@ // Since 2 was marked for retransmit, when 1 is acked, 2 is kept for RTT. QuicPacketNumber unacked[] = {2}; - VerifyUnackedPackets(unacked, arraysize(unacked)); + VerifyUnackedPackets(unacked, QUIC_ARRAYSIZE(unacked)); EXPECT_FALSE(QuicSentPacketManagerPeer::HasPendingPackets(&manager_)); VerifyRetransmittablePackets(nullptr, 0); @@ -435,7 +438,7 @@ // 2 and 3 remain unacked, but no packets have retransmittable data. QuicPacketNumber unacked[] = {2, 3}; - VerifyUnackedPackets(unacked, arraysize(unacked)); + VerifyUnackedPackets(unacked, QUIC_ARRAYSIZE(unacked)); EXPECT_TRUE(QuicSentPacketManagerPeer::HasPendingPackets(&manager_)); VerifyRetransmittablePackets(nullptr, 0); @@ -443,11 +446,11 @@ SendDataPacket(4); ack_frame = InitAckFrame({{1, 2}, {3, 5}}); QuicPacketNumber acked[] = {3, 4}; - ExpectAcksAndLosses(true, acked, arraysize(acked), nullptr, 0); + ExpectAcksAndLosses(true, acked, QUIC_ARRAYSIZE(acked), nullptr, 0); manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); QuicPacketNumber unacked2[] = {2}; - VerifyUnackedPackets(unacked2, arraysize(unacked2)); + VerifyUnackedPackets(unacked2, QUIC_ARRAYSIZE(unacked2)); EXPECT_TRUE(QuicSentPacketManagerPeer::HasPendingPackets(&manager_)); SendDataPacket(5); @@ -628,7 +631,8 @@ ack_frame = InitAckFrame({{3, 6}}); QuicPacketNumber acked[] = {4, 5}; QuicPacketNumber lost[] = {1, 2}; - ExpectAcksAndLosses(true, acked, arraysize(acked), lost, arraysize(lost)); + ExpectAcksAndLosses(true, acked, QUIC_ARRAYSIZE(acked), lost, + QUIC_ARRAYSIZE(lost)); manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); EXPECT_FALSE(manager_.HasPendingRetransmissions()); @@ -732,7 +736,7 @@ // Now ack the two crypto packets and the speculatively encrypted request, // and ensure the first four crypto packets get abandoned, but not lost. QuicPacketNumber acked[] = {3, 4, 5, 8, 9}; - ExpectAcksAndLosses(true, acked, arraysize(acked), nullptr, 0); + ExpectAcksAndLosses(true, acked, QUIC_ARRAYSIZE(acked), nullptr, 0); QuicAckFrame ack_frame = InitAckFrame({{3, 6}, {8, 10}}); manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); @@ -780,7 +784,7 @@ // Least unacked isn't raised until an ack is received, so ack the // crypto packets. QuicPacketNumber acked[] = {8, 9}; - ExpectAcksAndLosses(true, acked, arraysize(acked), nullptr, 0); + ExpectAcksAndLosses(true, acked, QUIC_ARRAYSIZE(acked), nullptr, 0); QuicAckFrame ack_frame = InitAckFrame({{8, 10}}); manager_.OnIncomingAck(ack_frame, clock_.ApproximateNow()); EXPECT_EQ(10u, manager_.GetLeastUnacked()); @@ -807,7 +811,7 @@ EXPECT_FALSE(QuicSentPacketManagerPeer::HasUnackedCryptoPackets(&manager_)); QuicPacketNumber unacked[] = {3}; - VerifyUnackedPackets(unacked, arraysize(unacked)); + VerifyUnackedPackets(unacked, QUIC_ARRAYSIZE(unacked)); } TEST_F(QuicSentPacketManagerTest, CryptoHandshakeTimeoutUnsentDataPacket) { @@ -841,7 +845,7 @@ // version negotiation. manager_.RetransmitUnackedPackets(ALL_UNACKED_RETRANSMISSION); QuicPacketNumber unacked[] = {1, 2}; - VerifyUnackedPackets(unacked, arraysize(unacked)); + VerifyUnackedPackets(unacked, QUIC_ARRAYSIZE(unacked)); EXPECT_TRUE(manager_.HasPendingRetransmissions()); EXPECT_TRUE(QuicSentPacketManagerPeer::HasUnackedCryptoPackets(&manager_)); EXPECT_FALSE(QuicSentPacketManagerPeer::HasPendingPackets(&manager_)); @@ -868,7 +872,7 @@ manager_.NeuterUnencryptedPackets(); EXPECT_FALSE(QuicSentPacketManagerPeer::HasUnackedCryptoPackets(&manager_)); QuicPacketNumber unacked[] = {1, 2, 3}; - VerifyUnackedPackets(unacked, arraysize(unacked)); + VerifyUnackedPackets(unacked, QUIC_ARRAYSIZE(unacked)); VerifyRetransmittablePackets(nullptr, 0); EXPECT_FALSE(manager_.HasPendingRetransmissions()); EXPECT_FALSE(QuicSentPacketManagerPeer::HasUnackedCryptoPackets(&manager_));
diff --git a/net/quic/core/quic_session.cc b/net/quic/core/quic_session.cc index a95b55e..1b74b67 100644 --- a/net/quic/core/quic_session.cc +++ b/net/quic/core/quic_session.cc
@@ -265,6 +265,11 @@ } void QuicSession::OnCanWrite() { + if (!RetransmitLostStreamData()) { + // Cannot finish retransmitting lost data, connection is write blocked. + return; + } + // We limit the number of writes to the number of pending streams. If more // streams become pending, WillingAndAbleToWrite will be true, which will // cause the connection to request resumption before yielding to other @@ -319,17 +324,21 @@ } bool QuicSession::WillingAndAbleToWrite() const { - // If the crypto or headers streams are blocked, we want to schedule a write - - // they don't get blocked by connection level flow control. Otherwise only - // schedule a write if we are not flow control blocked at the connection - // level. - return write_blocked_streams_.HasWriteBlockedCryptoOrHeadersStream() || + // Schedule a write when: + // 1) any stream has pending retransmissions, or + // 2) If the crypto or headers streams are blocked, or + // 3) connection is not flow control blocked and there are write blocked + // streams. + return !streams_with_pending_retransmission_.empty() || + write_blocked_streams_.HasWriteBlockedCryptoOrHeadersStream() || (!flow_controller_.IsBlocked() && write_blocked_streams_.HasWriteBlockedDataStreams()); } bool QuicSession::HasPendingHandshake() const { - return write_blocked_streams_.crypto_stream_blocked(); + return QuicContainsKey(streams_with_pending_retransmission_, + kCryptoStreamId) || + write_blocked_streams_.crypto_stream_blocked(); } bool QuicSession::HasOpenDynamicStreams() const { @@ -368,7 +377,10 @@ } QuicConsumedData data = connection_->SendStreamData(id, write_length, offset, state); - write_blocked_streams_.UpdateBytesForStream(id, data.bytes_consumed); + if (offset >= stream->stream_bytes_written()) { + // This is new stream data. + write_blocked_streams_.UpdateBytesForStream(id, data.bytes_consumed); + } return data; } @@ -430,6 +442,8 @@ zombie_streams_[stream->id()] = std::move(it->second); } else { closed_streams_.push_back(std::move(it->second)); + // Do not retransmit data of a closed stream. + streams_with_pending_retransmission_.erase(stream_id); } // If we haven't received a FIN or RST for this stream, we need to keep track @@ -760,6 +774,14 @@ return write_blocked_streams()->ShouldYield(stream_id); } +void QuicSession::NeuterUnencryptedStreamData() { + QuicCryptoStream* crypto_stream = GetMutableCryptoStream(); + crypto_stream->NeuterUnencryptedStreamData(); + if (!crypto_stream->HasPendingRetransmission()) { + streams_with_pending_retransmission_.erase(kCryptoStreamId); + } +} + QuicStream* QuicSession::GetOrCreateDynamicStream( const QuicStreamId stream_id) { DCHECK(!QuicContainsKey(static_stream_map_, stream_id)) @@ -938,6 +960,8 @@ closed_streams_.push_back(std::move(it->second)); zombie_streams_.erase(it); + // Do not retransmit data of a closed stream. + streams_with_pending_retransmission_.erase(id); } QuicStream* QuicSession::GetStream(QuicStreamId id) const { @@ -963,6 +987,9 @@ if (stream != nullptr) { stream->OnStreamFrameAcked(frame.offset, frame.data_length, frame.fin, ack_delay_time); + if (!stream->HasPendingRetransmission()) { + streams_with_pending_retransmission_.erase(stream->id()); + } } } @@ -976,7 +1003,8 @@ ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); return; } - stream->OnStreamFrameRetransmitted(frame.offset, frame.data_length); + stream->OnStreamFrameRetransmitted(frame.offset, frame.data_length, + frame.fin); } void QuicSession::OnStreamFrameDiscarded(const QuicStreamFrame& frame) { @@ -990,6 +1018,22 @@ return; } stream->OnStreamFrameDiscarded(frame.offset, frame.data_length, frame.fin); + if (!stream->HasPendingRetransmission()) { + streams_with_pending_retransmission_.erase(stream->id()); + } +} + +void QuicSession::OnStreamFrameLost(const QuicStreamFrame& frame) { + QuicStream* stream = GetStream(frame.stream_id); + if (stream == nullptr) { + return; + } + stream->OnStreamFrameLost(frame.offset, frame.data_length, frame.fin); + if (stream->HasPendingRetransmission() && + !QuicContainsKey(streams_with_pending_retransmission_, frame.stream_id)) { + streams_with_pending_retransmission_.insert( + std::make_pair(frame.stream_id, true)); + } } bool QuicSession::WriteStreamData(QuicStreamId id, @@ -1010,4 +1054,44 @@ return kStatelessResetToken; } +bool QuicSession::RetransmitLostStreamData() { + QuicConnection::ScopedPacketFlusher retransmission_flusher( + connection_, QuicConnection::SEND_ACK_IF_QUEUED); + while (!streams_with_pending_retransmission_.empty()) { + if (!connection_->CanWriteStreamData()) { + break; + } + if (QuicContainsKey(streams_with_pending_retransmission_, + kCryptoStreamId)) { + // Retransmit crypto data first. + QuicStream* crypto_stream = GetStream(kCryptoStreamId); + crypto_stream->OnCanWrite(); + if (crypto_stream->HasPendingRetransmission()) { + // Connection is write blocked. + break; + } else { + streams_with_pending_retransmission_.erase(kCryptoStreamId); + } + continue; + } + // Retransmit lost data on headers and data streams. + QuicStream* stream = + GetStream(streams_with_pending_retransmission_.begin()->first); + if (stream != nullptr) { + stream->OnCanWrite(); + if (stream->HasPendingRetransmission()) { + // Connection is write blocked. + break; + } else { + streams_with_pending_retransmission_.pop_front(); + } + } else { + QUIC_BUG << "Try to retransmit data of a closed stream"; + streams_with_pending_retransmission_.pop_front(); + } + } + + return streams_with_pending_retransmission_.empty(); +} + } // namespace net
diff --git a/net/quic/core/quic_session.h b/net/quic/core/quic_session.h index 6387eadb..456f315b 100644 --- a/net/quic/core/quic_session.h +++ b/net/quic/core/quic_session.h
@@ -128,6 +128,9 @@ void OnStreamFrameRetransmitted(const QuicStreamFrame& frame) override; void OnStreamFrameDiscarded(const QuicStreamFrame& frame) override; + // TODO(fayang): Add this function to StreamNotifierInterface. + void OnStreamFrameLost(const QuicStreamFrame& frame); + // Called on every incoming packet. Passes |packet| through to |connection_|. virtual void ProcessUdpPacket(const QuicSocketAddress& self_address, const QuicSocketAddress& peer_address, @@ -275,6 +278,9 @@ // Returns true if this stream should yield writes to another blocked stream. bool ShouldYield(QuicStreamId stream_id); + // Called to cancel retransmission of unencrypted stream data. + void NeuterUnencryptedStreamData(); + bool can_use_slices() const { return can_use_slices_; } bool allow_multiple_acks_for_data() const { @@ -424,6 +430,10 @@ // closed. QuicStream* GetStream(QuicStreamId id) const; + // Let streams retransmit lost data, returns true if all lost data is + // retransmitted. Returns false otherwise. + bool RetransmitLostStreamData(); + // Keep track of highest received byte offset of locally closed streams, while // waiting for a definitive final highest offset from the peer. std::map<QuicStreamId, QuicStreamOffset> @@ -499,6 +509,11 @@ // Latched value of quic_reloadable_flag_quic_allow_multiple_acks_for_data2. const bool allow_multiple_acks_for_data_; + // TODO(fayang): switch to linked_hash_set when chromium supports it. The bool + // is not used here. + // List of streams with pending retransmissions. + QuicLinkedHashMap<QuicStreamId, bool> streams_with_pending_retransmission_; + DISALLOW_COPY_AND_ASSIGN(QuicSession); };
diff --git a/net/quic/core/quic_session_test.cc b/net/quic/core/quic_session_test.cc index 7e6b09c..adf17276 100644 --- a/net/quic/core/quic_session_test.cc +++ b/net/quic/core/quic_session_test.cc
@@ -92,6 +92,8 @@ MOCK_METHOD0(OnCanWrite, void()); + MOCK_CONST_METHOD0(HasPendingRetransmission, bool()); + private: using QuicCryptoStream::session; @@ -118,6 +120,8 @@ void OnDataAvailable() override {} MOCK_METHOD0(OnCanWrite, void()); + + MOCK_CONST_METHOD0(HasPendingRetransmission, bool()); }; // Poor man's functor for use as callback in a mock. @@ -1423,6 +1427,107 @@ EXPECT_EQ(2u, session_.closed_streams()->front()->id()); } +TEST_P(QuicSessionTestServer, OnStreamFrameLost) { + InSequence s; + + // Drive congestion control manually. + MockSendAlgorithm* send_algorithm = new StrictMock<MockSendAlgorithm>; + QuicConnectionPeer::SetSendAlgorithm(session_.connection(), send_algorithm); + + TestCryptoStream* crypto_stream = session_.GetMutableCryptoStream(); + TestStream* stream2 = session_.CreateOutgoingDynamicStream(); + TestStream* stream4 = session_.CreateOutgoingDynamicStream(); + + QuicStreamFrame frame1(kCryptoStreamId, false, 0, 1300); + QuicStreamFrame frame2(stream2->id(), false, 0, 9); + QuicStreamFrame frame3(stream4->id(), false, 0, 9); + + // Lost data on cryption stream, streams 2 and 4. + EXPECT_CALL(*stream4, HasPendingRetransmission()).WillOnce(Return(true)); + EXPECT_CALL(*crypto_stream, HasPendingRetransmission()) + .WillOnce(Return(true)); + EXPECT_CALL(*stream2, HasPendingRetransmission()).WillOnce(Return(true)); + session_.OnStreamFrameLost(frame3); + session_.OnStreamFrameLost(frame1); + session_.OnStreamFrameLost(frame2); + EXPECT_TRUE(session_.WillingAndAbleToWrite()); + + // Mark streams 2 and 4 write blocked. + session_.MarkConnectionLevelWriteBlocked(stream2->id()); + session_.MarkConnectionLevelWriteBlocked(stream4->id()); + + // Lost data is retransmitted before new data, and retransmissions for crypto + // stream go first. + // Do not check congestion window when crypto stream has lost data. + EXPECT_CALL(*send_algorithm, CanSend(_)).Times(0); + EXPECT_CALL(*crypto_stream, OnCanWrite()); + EXPECT_CALL(*crypto_stream, HasPendingRetransmission()) + .WillOnce(Return(false)); + // Check congestion window for non crypto streams. + EXPECT_CALL(*send_algorithm, CanSend(_)).WillOnce(Return(true)); + EXPECT_CALL(*stream4, OnCanWrite()); + EXPECT_CALL(*stream4, HasPendingRetransmission()).WillOnce(Return(false)); + // Connection is blocked. + EXPECT_CALL(*send_algorithm, CanSend(_)).WillRepeatedly(Return(false)); + + session_.OnCanWrite(); + EXPECT_TRUE(session_.WillingAndAbleToWrite()); + + // Unblock connection. + // Stream 2 retransmits lost data. + EXPECT_CALL(*send_algorithm, CanSend(_)).WillOnce(Return(true)); + EXPECT_CALL(*stream2, OnCanWrite()); + EXPECT_CALL(*stream2, HasPendingRetransmission()).WillOnce(Return(false)); + EXPECT_CALL(*send_algorithm, CanSend(_)).WillOnce(Return(true)); + // Stream 2 sends new data. + EXPECT_CALL(*stream2, OnCanWrite()); + EXPECT_CALL(*send_algorithm, CanSend(_)).WillOnce(Return(true)); + EXPECT_CALL(*stream4, OnCanWrite()); + EXPECT_CALL(*send_algorithm, OnApplicationLimited(_)); + + session_.OnCanWrite(); + EXPECT_FALSE(session_.WillingAndAbleToWrite()); +} + +TEST_P(QuicSessionTestServer, DonotRetransmitDataOfClosedStreams) { + if (!FLAGS_quic_reloadable_flag_quic_remove_on_stream_frame_discarded) { + return; + } + InSequence s; + + TestStream* stream2 = session_.CreateOutgoingDynamicStream(); + TestStream* stream4 = session_.CreateOutgoingDynamicStream(); + TestStream* stream6 = session_.CreateOutgoingDynamicStream(); + + QuicStreamFrame frame1(stream2->id(), false, 0, 9); + QuicStreamFrame frame2(stream4->id(), false, 0, 9); + QuicStreamFrame frame3(stream6->id(), false, 0, 9); + + EXPECT_CALL(*stream6, HasPendingRetransmission()).WillOnce(Return(true)); + EXPECT_CALL(*stream4, HasPendingRetransmission()).WillOnce(Return(true)); + EXPECT_CALL(*stream2, HasPendingRetransmission()).WillOnce(Return(true)); + session_.OnStreamFrameLost(frame3); + session_.OnStreamFrameLost(frame2); + session_.OnStreamFrameLost(frame1); + + session_.MarkConnectionLevelWriteBlocked(stream2->id()); + session_.MarkConnectionLevelWriteBlocked(stream4->id()); + session_.MarkConnectionLevelWriteBlocked(stream6->id()); + + // Reset stream 4 locally. + EXPECT_CALL(*connection_, SendRstStream(stream4->id(), _, _)); + stream4->Reset(QUIC_STREAM_CANCELLED); + + // Verify stream 4 is removed from streams with lost data list. + EXPECT_CALL(*stream6, OnCanWrite()); + EXPECT_CALL(*stream6, HasPendingRetransmission()).WillOnce(Return(false)); + EXPECT_CALL(*stream2, OnCanWrite()); + EXPECT_CALL(*stream2, HasPendingRetransmission()).WillOnce(Return(false)); + EXPECT_CALL(*stream2, OnCanWrite()); + EXPECT_CALL(*stream6, OnCanWrite()); + session_.OnCanWrite(); +} + } // namespace } // namespace test } // namespace net
diff --git a/net/quic/core/quic_socket_address_coder_test.cc b/net/quic/core/quic_socket_address_coder_test.cc index ce2032f..c538a44 100644 --- a/net/quic/core/quic_socket_address_coder_test.cc +++ b/net/quic/core/quic_socket_address_coder_test.cc
@@ -4,6 +4,7 @@ #include "net/quic/core/quic_socket_address_coder.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_test.h" using std::string; @@ -110,7 +111,7 @@ {"::1", 65534}, }; - for (size_t i = 0; i < arraysize(test_case); i++) { + for (size_t i = 0; i < QUIC_ARRAYSIZE(test_case); i++) { QuicIpAddress ip; ASSERT_TRUE(ip.FromString(test_case[i].ip_literal)); QuicSocketAddressCoder encoder(QuicSocketAddress(ip, test_case[i].port));
diff --git a/net/quic/core/quic_spdy_stream_test.cc b/net/quic/core/quic_spdy_stream_test.cc index 0d09f28..5d8ade01 100644 --- a/net/quic/core/quic_spdy_stream_test.cc +++ b/net/quic/core/quic_spdy_stream_test.cc
@@ -11,6 +11,7 @@ #include "net/quic/core/quic_utils.h" #include "net/quic/core/quic_write_blocked_list.h" #include "net/quic/core/spdy_utils.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_map_util.h" #include "net/quic/platform/api/quic_ptr_util.h" #include "net/quic/platform/api/quic_string_piece.h" @@ -50,7 +51,7 @@ char buffer[2048]; struct iovec vec; vec.iov_base = buffer; - vec.iov_len = arraysize(buffer); + vec.iov_len = QUIC_ARRAYSIZE(buffer); size_t bytes_read = Readv(&vec, 1); data_ += string(buffer, bytes_read); } @@ -318,10 +319,10 @@ stream_->ConsumeHeaderList(); char buffer[2048]; - ASSERT_LT(body.length(), arraysize(buffer)); + ASSERT_LT(body.length(), QUIC_ARRAYSIZE(buffer)); struct iovec vec; vec.iov_base = buffer; - vec.iov_len = arraysize(buffer); + vec.iov_len = QUIC_ARRAYSIZE(buffer); size_t bytes_read = stream_->Readv(&vec, 1); EXPECT_EQ(body.length(), bytes_read); @@ -362,7 +363,7 @@ char buffer[1]; struct iovec vec; vec.iov_base = buffer; - vec.iov_len = arraysize(buffer); + vec.iov_len = QUIC_ARRAYSIZE(buffer); for (size_t i = 0; i < body.length(); ++i) { size_t bytes_read = stream_->Readv(&vec, 1); @@ -385,9 +386,9 @@ char buffer2[1]; struct iovec vec[2]; vec[0].iov_base = buffer1; - vec[0].iov_len = arraysize(buffer1); + vec[0].iov_len = QUIC_ARRAYSIZE(buffer1); vec[1].iov_base = buffer2; - vec[1].iov_len = arraysize(buffer2); + vec[1].iov_len = QUIC_ARRAYSIZE(buffer2); for (size_t i = 0; i < body.length(); i += 2) { size_t bytes_read = stream_->Readv(vec, 2);
diff --git a/net/quic/core/quic_stream.cc b/net/quic/core/quic_stream.cc index d3b1de6..086ea5b 100644 --- a/net/quic/core/quic_stream.cc +++ b/net/quic/core/quic_stream.cc
@@ -53,6 +53,7 @@ fin_buffered_(false), fin_sent_(false), fin_outstanding_(false), + fin_lost_(false), fin_received_(false), rst_sent_(false), rst_received_(false), @@ -263,9 +264,17 @@ } void QuicStream::OnCanWrite() { + if (HasPendingRetransmission()) { + // Exit early to allow other streams to write pending retransmissions if + // any. + WritePendingRetransmission(); + return; + } + if (write_side_closed_) { - QUIC_DLOG(ERROR) << ENDPOINT << "Stream " << id() - << "attempting to write when the write side is closed"; + QUIC_DLOG(ERROR) + << ENDPOINT << "Stream " << id() + << " attempting to write new data when the write side is closed"; return; } if (HasBufferedData() || (fin_buffered_ && !fin_sent_)) { @@ -399,6 +408,17 @@ return consumed_data; } +bool QuicStream::HasPendingRetransmission() const { + return send_buffer_.HasPendingRetransmission() || fin_lost_; +} + +bool QuicStream::IsStreamFrameOutstanding(QuicStreamOffset offset, + QuicByteCount data_length, + bool fin) const { + return send_buffer_.IsStreamDataOutstanding(offset, data_length) || + (fin && fin_outstanding_); +} + QuicConsumedData QuicStream::WritevDataInner(size_t write_length, QuicStreamOffset offset, bool fin) { @@ -563,6 +583,7 @@ (fin_acked && fin_outstanding_); if (fin_acked) { fin_outstanding_ = false; + fin_lost_ = false; } if (!IsWaitingForAcks()) { session_->OnStreamDoneWaitingForAcks(id_); @@ -572,8 +593,13 @@ } } -void QuicStream::OnStreamFrameRetransmitted(QuicStreamOffset /*offset*/, - QuicByteCount data_length) { +void QuicStream::OnStreamFrameRetransmitted(QuicStreamOffset offset, + QuicByteCount data_length, + bool fin_retransmitted) { + send_buffer_.OnStreamDataRetransmitted(offset, data_length); + if (fin_retransmitted) { + fin_lost_ = false; + } if (ack_listener_ != nullptr) { ack_listener_->OnPacketRetransmitted(data_length); } @@ -605,12 +631,24 @@ } if (fin_discarded) { fin_outstanding_ = false; + fin_lost_ = false; } if (!IsWaitingForAcks()) { session_->OnStreamDoneWaitingForAcks(id_); } } +void QuicStream::OnStreamFrameLost(QuicStreamOffset offset, + QuicByteCount data_length, + bool fin_lost) { + if (data_length > 0) { + send_buffer_.OnStreamDataLost(offset, data_length); + } + if (fin_lost && fin_outstanding_) { + fin_lost_ = true; + } +} + bool QuicStream::IsWaitingForAcks() const { return (!remove_on_stream_frame_discarded_ || !rst_sent_ || stream_error_ == QUIC_STREAM_NO_ERROR) && @@ -666,7 +704,7 @@ QuicConsumedData consumed_data = WritevDataInner(write_length, stream_bytes_written(), fin); - send_buffer_.OnStreamDataConsumed(consumed_data.bytes_consumed); + OnStreamDataConsumed(consumed_data.bytes_consumed); AddBytesSent(consumed_data.bytes_consumed); QUIC_DVLOG(1) << ENDPOINT << "stream " << id_ << " sends " @@ -720,4 +758,47 @@ return send_buffer_.bytes_acked(); } +void QuicStream::OnStreamDataConsumed(size_t bytes_consumed) { + send_buffer_.OnStreamDataConsumed(bytes_consumed); +} + +void QuicStream::WritePendingRetransmission() { + while (HasPendingRetransmission()) { + QuicConsumedData consumed(0, false); + if (!send_buffer_.HasPendingRetransmission()) { + QUIC_DVLOG(1) << ENDPOINT << "stream " << id_ + << " retransmits fin only frame."; + consumed = + session()->WritevData(this, id_, 0, stream_bytes_written(), FIN); + fin_lost_ = !consumed.fin_consumed; + if (fin_lost_) { + // Connection is write blocked. + return; + } + } else { + StreamPendingRetransmission pending = + send_buffer_.NextPendingRetransmission(); + // Determine whether the lost fin can be bundled with the data. + const bool can_bundle_fin = + fin_lost_ && + (pending.offset + pending.length == stream_bytes_written()); + consumed = + session()->WritevData(this, id_, pending.length, pending.offset, + can_bundle_fin ? FIN : NO_FIN); + QUIC_DVLOG(1) << ENDPOINT << "stream " << id_ + << " tries to retransmit stream data [" << pending.offset + << ", " << pending.offset + pending.length + << ") and fin: " << can_bundle_fin + << ", consumed: " << consumed; + OnStreamFrameRetransmitted(pending.offset, consumed.bytes_consumed, + consumed.fin_consumed); + if (consumed.bytes_consumed < pending.length || + (can_bundle_fin && !consumed.fin_consumed)) { + // Connection is write blocked. + return; + } + } + } +} + } // namespace net
diff --git a/net/quic/core/quic_stream.h b/net/quic/core/quic_stream.h index 31670e6..dc3bfd7 100644 --- a/net/quic/core/quic_stream.h +++ b/net/quic/core/quic_stream.h
@@ -205,9 +205,11 @@ bool fin_acked, QuicTime::Delta ack_delay_time); - // Called when data [offset, offset + data_length) gets retransmitted. + // Called when data [offset, offset + data_length) was retransmitted. + // |fin_retransmitted| indicates whether fin was retransmitted. virtual void OnStreamFrameRetransmitted(QuicStreamOffset offset, - QuicByteCount data_length); + QuicByteCount data_length, + bool fin_retransmitted); // Called when data [offset, offset + data_length) gets discarded because // stream is cancelled. |fin_discarded| indicates whether the fin is @@ -216,10 +218,27 @@ QuicByteCount data_length, bool fin_discarded); + // Called when data [offset, offset + data_length) is considered as lost. + // |fin_lost| inidacates whether the fin is considered as lost. + void OnStreamFrameLost(QuicStreamOffset offset, + QuicByteCount data_length, + bool fin_lost); + // Same as WritevData except data is provided in reference counted memory so // that data copy is avoided. QuicConsumedData WriteMemSlices(QuicMemSliceSpan span, bool fin); + // Returns true if any stream data is lost (including fin) and needs to be + // retransmitted. + virtual bool HasPendingRetransmission() const; + + // Returns true if any portion of data [offset, offset + data_length) is + // outstanding or fin is outstanding (if |fin| is true). Returns false + // otherwise. + bool IsStreamFrameOutstanding(QuicStreamOffset offset, + QuicByteCount data_length, + bool fin) const; + protected: // Sends as many bytes in the first |count| buffers of |iov| to the connection // as the connection will consume. If FIN is consumed, the write side is @@ -262,6 +281,12 @@ // Called when upper layer can write new data. virtual void OnCanWriteNewData() {} + // Called when |bytes_consumed| bytes has been consumed. + virtual void OnStreamDataConsumed(size_t bytes_consumed); + + // Writes pending retransmissions if any. + virtual void WritePendingRetransmission(); + bool fin_buffered() const { return fin_buffered_; } const QuicSession* session() const { return session_; } @@ -281,6 +306,10 @@ const QuicIntervalSet<QuicStreamOffset>& bytes_acked() const; + const QuicStreamSendBuffer& send_buffer() const { return send_buffer_; } + + QuicStreamSendBuffer& send_buffer() { return send_buffer_; } + private: friend class test::QuicStreamPeer; friend class QuicStreamUtils; @@ -326,6 +355,8 @@ bool fin_sent_; // True if a FIN is waiting to be acked. bool fin_outstanding_; + // True if a FIN is lost. + bool fin_lost_; // True if this stream has received (and the sequencer has accepted) a // StreamFrame with the FIN set.
diff --git a/net/quic/core/quic_stream_send_buffer.cc b/net/quic/core/quic_stream_send_buffer.cc index 5b1fbaa..d905b8c 100644 --- a/net/quic/core/quic_stream_send_buffer.cc +++ b/net/quic/core/quic_stream_send_buffer.cc
@@ -26,6 +26,11 @@ BufferedSlice::~BufferedSlice() {} +bool StreamPendingRetransmission::operator==( + const StreamPendingRetransmission& other) const { + return offset == other.offset && length == other.length; +} + QuicStreamSendBuffer::QuicStreamSendBuffer(QuicBufferAllocator* allocator, bool allow_multiple_acks_for_data) : stream_offset_(0), @@ -114,6 +119,7 @@ stream_bytes_outstanding_ -= *newly_acked_length; if (allow_multiple_acks_for_data_) { bytes_acked_.Add(offset, offset + data_length); + pending_retransmissions_.Difference(offset, offset + data_length); while (!buffered_slices_.empty() && bytes_acked_.Contains(buffered_slices_.front().offset, buffered_slices_.front().offset + @@ -150,6 +156,52 @@ return true; } +void QuicStreamSendBuffer::OnStreamDataLost(QuicStreamOffset offset, + QuicByteCount data_length) { + if (data_length == 0) { + return; + } + QuicIntervalSet<QuicStreamOffset> bytes_lost(offset, offset + data_length); + bytes_lost.Difference(bytes_acked_); + if (bytes_lost.Empty()) { + return; + } + for (const auto& lost : bytes_lost) { + pending_retransmissions_.Add(lost.min(), lost.max()); + } +} + +void QuicStreamSendBuffer::OnStreamDataRetransmitted( + QuicStreamOffset offset, + QuicByteCount data_length) { + if (data_length == 0) { + return; + } + pending_retransmissions_.Difference(offset, offset + data_length); +} + +bool QuicStreamSendBuffer::HasPendingRetransmission() const { + return !pending_retransmissions_.Empty(); +} + +StreamPendingRetransmission QuicStreamSendBuffer::NextPendingRetransmission() + const { + if (HasPendingRetransmission()) { + const auto pending = pending_retransmissions_.begin(); + return {pending->min(), pending->max() - pending->min()}; + } + QUIC_BUG << "NextPendingRetransmission is called unexpected with no " + "pending retransmissions."; + return {0, 0}; +} + +bool QuicStreamSendBuffer::IsStreamDataOutstanding( + QuicStreamOffset offset, + QuicByteCount data_length) const { + return data_length > 0 && + !bytes_acked_.Contains(offset, offset + data_length); +} + size_t QuicStreamSendBuffer::size() const { return buffered_slices_.size(); }
diff --git a/net/quic/core/quic_stream_send_buffer.h b/net/quic/core/quic_stream_send_buffer.h index 79eafcc..3e1a69f 100644 --- a/net/quic/core/quic_stream_send_buffer.h +++ b/net/quic/core/quic_stream_send_buffer.h
@@ -42,6 +42,19 @@ QuicByteCount outstanding_data_length; }; +struct StreamPendingRetransmission { + StreamPendingRetransmission(QuicStreamOffset offset, QuicByteCount length) + : offset(offset), length(length) {} + + // Starting offset of this pending retransmission. + QuicStreamOffset offset; + // Length of this pending retransmission. + QuicByteCount length; + + QUIC_EXPORT_PRIVATE bool operator==( + const StreamPendingRetransmission& other) const; +}; + // QuicStreamSendBuffer contains a list of QuicStreamDataSlices. New data slices // are added to the tail of the list. Data slices are removed from the head of // the list when they get fully acked. Stream data can be retrieved and acked @@ -78,6 +91,24 @@ QuicByteCount data_length, QuicByteCount* newly_acked_length); + // Called when data [offset, offset + data_length) is considered as lost. + void OnStreamDataLost(QuicStreamOffset offset, QuicByteCount data_length); + + // Called when data [offset, offset + length) was retransmitted. + void OnStreamDataRetransmitted(QuicStreamOffset offset, + QuicByteCount data_length); + + // Returns true if there is pending retransmissions. + bool HasPendingRetransmission() const; + + // Returns next pending retransmissions. + StreamPendingRetransmission NextPendingRetransmission() const; + + // Returns true if data [offset, offset + data_length) is outstanding and + // waiting to be acked. Returns false otherwise. + bool IsStreamDataOutstanding(QuicStreamOffset offset, + QuicByteCount data_length) const; + // Number of data slices in send buffer. size_t size() const; @@ -115,6 +146,9 @@ // Latch value for quic_reloadable_flag_quic_allow_multiple_acks_for_data2. const bool allow_multiple_acks_for_data_; + + // Data considered as lost and needs to be retransmitted. + QuicIntervalSet<QuicStreamOffset> pending_retransmissions_; }; } // namespace net
diff --git a/net/quic/core/quic_stream_send_buffer_test.cc b/net/quic/core/quic_stream_send_buffer_test.cc index 46950b5b..1e9b22f 100644 --- a/net/quic/core/quic_stream_send_buffer_test.cc +++ b/net/quic/core/quic_stream_send_buffer_test.cc
@@ -162,6 +162,49 @@ EXPECT_FALSE(send_buffer_.OnStreamDataAcked(4000, 100, &newly_acked_length)); } +TEST_F(QuicStreamSendBufferTest, PendingRetransmission) { + if (!FLAGS_quic_reloadable_flag_quic_allow_multiple_acks_for_data2) { + return; + } + EXPECT_TRUE(send_buffer_.IsStreamDataOutstanding(0, 3840)); + EXPECT_FALSE(send_buffer_.HasPendingRetransmission()); + // Lost data [0, 1200). + send_buffer_.OnStreamDataLost(0, 1200); + // Lost data [1500, 2000). + send_buffer_.OnStreamDataLost(1500, 500); + EXPECT_TRUE(send_buffer_.HasPendingRetransmission()); + + EXPECT_EQ(StreamPendingRetransmission(0, 1200), + send_buffer_.NextPendingRetransmission()); + // Retransmit data [0, 500). + send_buffer_.OnStreamDataRetransmitted(0, 500); + EXPECT_TRUE(send_buffer_.IsStreamDataOutstanding(0, 500)); + EXPECT_EQ(StreamPendingRetransmission(500, 700), + send_buffer_.NextPendingRetransmission()); + // Ack data [500, 1200). + QuicByteCount newly_acked_length = 0; + EXPECT_TRUE(send_buffer_.OnStreamDataAcked(500, 700, &newly_acked_length)); + EXPECT_FALSE(send_buffer_.IsStreamDataOutstanding(500, 700)); + EXPECT_TRUE(send_buffer_.HasPendingRetransmission()); + EXPECT_EQ(StreamPendingRetransmission(1500, 500), + send_buffer_.NextPendingRetransmission()); + // Retransmit data [1500, 2000). + send_buffer_.OnStreamDataRetransmitted(1500, 500); + EXPECT_FALSE(send_buffer_.HasPendingRetransmission()); + + // Lost [200, 800). + send_buffer_.OnStreamDataLost(200, 600); + EXPECT_TRUE(send_buffer_.HasPendingRetransmission()); + // Verify [200, 500) is considered as lost, as [500, 800) has been acked. + EXPECT_EQ(StreamPendingRetransmission(200, 300), + send_buffer_.NextPendingRetransmission()); + + // Verify 0 length data is not outstanding. + EXPECT_FALSE(send_buffer_.IsStreamDataOutstanding(100, 0)); + // Verify partially acked data is outstanding. + EXPECT_TRUE(send_buffer_.IsStreamDataOutstanding(400, 800)); +} + } // namespace } // namespace test } // namespace net
diff --git a/net/quic/core/quic_stream_sequencer_test.cc b/net/quic/core/quic_stream_sequencer_test.cc index 8ca75ff1..35fa78f 100644 --- a/net/quic/core/quic_stream_sequencer_test.cc +++ b/net/quic/core/quic_stream_sequencer_test.cc
@@ -12,6 +12,7 @@ #include "net/quic/core/quic_stream.h" #include "net/quic/core/quic_utils.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_logging.h" #include "net/quic/platform/api/quic_string_piece.h" #include "net/quic/platform/api/quic_test.h" @@ -60,7 +61,7 @@ public: void ConsumeData(size_t num_bytes) { char buffer[1024]; - ASSERT_GT(arraysize(buffer), num_bytes); + ASSERT_GT(QUIC_ARRAYSIZE(buffer), num_bytes); struct iovec iov; iov.iov_base = buffer; iov.iov_len = num_bytes; @@ -90,7 +91,7 @@ bool VerifyReadableRegions(const std::vector<string>& expected) { iovec iovecs[5]; size_t num_iovecs = - sequencer_->GetReadableRegions(iovecs, arraysize(iovecs)); + sequencer_->GetReadableRegions(iovecs, QUIC_ARRAYSIZE(iovecs)); return VerifyReadableRegion(expected) && VerifyIovecs(iovecs, num_iovecs, expected); } @@ -384,7 +385,7 @@ typedef std::vector<Frame> FrameList; void CreateFrames() { - int payload_size = arraysize(kPayload) - 1; + int payload_size = QUIC_ARRAYSIZE(kPayload) - 1; int remaining_payload = payload_size; while (remaining_payload != 0) { int size = std::min(OneToN(6), remaining_payload); @@ -406,10 +407,10 @@ void ReadAvailableData() { // Read all available data - char output[arraysize(kPayload) + 1]; + char output[QUIC_ARRAYSIZE(kPayload) + 1]; iovec iov; iov.iov_base = output; - iov.iov_len = arraysize(output); + iov.iov_len = QUIC_ARRAYSIZE(output); int bytes_read = sequencer_->Readv(&iov, 1); EXPECT_NE(0, bytes_read); output_.append(output, bytes_read); @@ -439,7 +440,7 @@ list_.erase(list_.begin() + index); } - ASSERT_EQ(arraysize(kPayload) - 1, output_.size()); + ASSERT_EQ(QUIC_ARRAYSIZE(kPayload) - 1, output_.size()); EXPECT_EQ(kPayload, output_); } @@ -453,7 +454,7 @@ EXPECT_CALL(stream_, OnDataAvailable()).Times(AnyNumber()); - while (output_.size() != arraysize(kPayload) - 1) { + while (output_.size() != QUIC_ARRAYSIZE(kPayload) - 1) { if (!list_.empty() && OneToN(2) == 1) { // Send data int index = OneToN(list_.size()) - 1; OnFrame(list_[index].first, list_[index].second.data()); @@ -470,7 +471,7 @@ ASSERT_EQ(0, iovs_peeked); ASSERT_FALSE(sequencer_->GetReadableRegion(peek_iov, ×tamp)); } - int total_bytes_to_peek = arraysize(buffer); + int total_bytes_to_peek = QUIC_ARRAYSIZE(buffer); for (int i = 0; i < iovs_peeked; ++i) { int bytes_to_peek = std::min<int>(peek_iov[i].iov_len, total_bytes_to_peek);
diff --git a/net/quic/core/quic_stream_test.cc b/net/quic/core/quic_stream_test.cc index 7da2723..f290ad9 100644 --- a/net/quic/core/quic_stream_test.cc +++ b/net/quic/core/quic_stream_test.cc
@@ -10,6 +10,7 @@ #include "net/quic/core/quic_utils.h" #include "net/quic/core/quic_write_blocked_list.h" #include "net/quic/core/spdy_utils.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_flags.h" #include "net/quic/platform/api/quic_logging.h" #include "net/quic/platform/api/quic_ptr_util.h" @@ -672,7 +673,7 @@ // kData2 is retransmitted. EXPECT_CALL(*mock_ack_listener, OnPacketRetransmitted(9)); - stream_->OnStreamFrameRetransmitted(9, 9); + stream_->OnStreamFrameRetransmitted(9, 9, false); // kData2 is acked. EXPECT_CALL(*mock_ack_listener, OnPacketAcked(9, _)); @@ -928,8 +929,8 @@ } char data[1024]; std::vector<std::pair<char*, int>> buffers; - buffers.push_back(std::make_pair(data, arraysize(data))); - buffers.push_back(std::make_pair(data, arraysize(data))); + buffers.push_back(std::make_pair(data, QUIC_ARRAYSIZE(data))); + buffers.push_back(std::make_pair(data, QUIC_ARRAYSIZE(data))); QuicTestMemSliceVector vector1(buffers); QuicTestMemSliceVector vector2(buffers); QuicMemSliceSpan span1 = vector1.span(); @@ -941,7 +942,7 @@ QuicConsumedData consumed = stream_->WriteMemSlices(span1, false); EXPECT_EQ(2048u, consumed.bytes_consumed); EXPECT_FALSE(consumed.fin_consumed); - EXPECT_EQ(2 * arraysize(data) - 100, stream_->BufferedDataBytes()); + EXPECT_EQ(2 * QUIC_ARRAYSIZE(data) - 100, stream_->BufferedDataBytes()); EXPECT_FALSE(stream_->fin_buffered()); EXPECT_CALL(*session_, WritevData(_, _, _, _, _)).Times(0); @@ -949,12 +950,12 @@ consumed = stream_->WriteMemSlices(span2, true); EXPECT_EQ(0u, consumed.bytes_consumed); EXPECT_FALSE(consumed.fin_consumed); - EXPECT_EQ(2 * arraysize(data) - 100, stream_->BufferedDataBytes()); + EXPECT_EQ(2 * QUIC_ARRAYSIZE(data) - 100, stream_->BufferedDataBytes()); EXPECT_FALSE(stream_->fin_buffered()); EXPECT_CALL(*session_, WritevData(_, _, _, _, _)) .WillOnce(Return(QuicConsumedData( - 2 * arraysize(data) - 100 - + 2 * QUIC_ARRAYSIZE(data) - 100 - GetQuicFlag(FLAGS_quic_buffered_data_threshold) + 1, false))); EXPECT_CALL(*stream_, OnCanWriteNewData()).Times(1); @@ -966,9 +967,9 @@ consumed = stream_->WriteMemSlices(span2, true); EXPECT_EQ(2048u, consumed.bytes_consumed); EXPECT_TRUE(consumed.fin_consumed); - EXPECT_EQ( - 2 * arraysize(data) + GetQuicFlag(FLAGS_quic_buffered_data_threshold) - 1, - stream_->BufferedDataBytes()); + EXPECT_EQ(2 * QUIC_ARRAYSIZE(data) + + GetQuicFlag(FLAGS_quic_buffered_data_threshold) - 1, + stream_->BufferedDataBytes()); EXPECT_TRUE(stream_->fin_buffered()); // Flush all buffered data. @@ -989,7 +990,7 @@ QuicStreamPeer::SetStreamBytesWritten(kMaxStreamLength - 5u, stream_); char data[5]; std::vector<std::pair<char*, int>> buffers; - buffers.push_back(std::make_pair(data, arraysize(data))); + buffers.push_back(std::make_pair(data, QUIC_ARRAYSIZE(data))); QuicTestMemSliceVector vector1(buffers); QuicMemSliceSpan span1 = vector1.span(); EXPECT_CALL(*session_, WritevData(_, _, _, _, _)) @@ -1058,6 +1059,90 @@ EXPECT_FALSE(stream_->IsWaitingForAcks()); } +TEST_F(QuicStreamTest, OnStreamFrameLost) { + if (!FLAGS_quic_reloadable_flag_quic_allow_multiple_acks_for_data2) { + return; + } + Initialize(kShouldProcessData); + + // Send [0, 9). + EXPECT_CALL(*session_, WritevData(_, _, _, _, _)) + .WillOnce(Invoke(MockQuicSession::ConsumeAllData)); + stream_->WriteOrBufferData(kData1, false, nullptr); + EXPECT_FALSE(stream_->HasBufferedData()); + + // Try to send [9, 27), but connection is blocked. + EXPECT_CALL(*session_, WritevData(_, _, _, _, _)) + .WillOnce(Return(QuicConsumedData(0, false))); + stream_->WriteOrBufferData(kData2, false, nullptr); + stream_->WriteOrBufferData(kData2, false, nullptr); + EXPECT_TRUE(stream_->HasBufferedData()); + EXPECT_FALSE(stream_->HasPendingRetransmission()); + + // Lost [0, 9). When stream gets a chance to write, only lost data is + // transmitted. + stream_->OnStreamFrameLost(0, 9, false); + EXPECT_TRUE(stream_->HasPendingRetransmission()); + EXPECT_CALL(*session_, WritevData(_, _, _, _, _)) + .WillOnce(Invoke(MockQuicSession::ConsumeAllData)); + stream_->OnCanWrite(); + EXPECT_FALSE(stream_->HasPendingRetransmission()); + EXPECT_TRUE(stream_->HasBufferedData()); + + // This OnCanWrite causes [9, 27) to be sent. + EXPECT_CALL(*session_, WritevData(_, _, _, _, _)) + .WillOnce(Invoke(MockQuicSession::ConsumeAllData)); + stream_->OnCanWrite(); + EXPECT_FALSE(stream_->HasBufferedData()); + + // Send a fin only frame. + EXPECT_CALL(*session_, WritevData(_, _, _, _, _)) + .WillOnce(Invoke(MockQuicSession::ConsumeAllData)); + stream_->WriteOrBufferData("", true, nullptr); + + // Lost [9, 27) and fin. + stream_->OnStreamFrameLost(9, 18, false); + stream_->OnStreamFrameLost(27, 0, true); + EXPECT_TRUE(stream_->HasPendingRetransmission()); + + // Ack [9, 18). + stream_->OnStreamFrameAcked(9, 9, false, QuicTime::Delta::Zero()); + EXPECT_TRUE(stream_->HasPendingRetransmission()); + // This OnCanWrite causes [18, 27) and fin to be retransmitted. Verify fin can + // be bundled with data. + EXPECT_CALL(*session_, WritevData(_, _, _, _, _)) + .WillOnce(Return(QuicConsumedData(9, true))); + stream_->OnCanWrite(); + EXPECT_FALSE(stream_->HasPendingRetransmission()); + // Lost [9, 18) again, but it is not considered as lost because kData2 + // has been acked. + stream_->OnStreamFrameLost(9, 9, false); + EXPECT_FALSE(stream_->HasPendingRetransmission()); +} + +TEST_F(QuicStreamTest, CannotBundleLostFin) { + Initialize(kShouldProcessData); + + // Send [0, 18) and fin. + EXPECT_CALL(*session_, WritevData(_, _, _, _, _)) + .WillRepeatedly(Invoke(MockQuicSession::ConsumeAllData)); + stream_->WriteOrBufferData(kData1, false, nullptr); + stream_->WriteOrBufferData(kData2, true, nullptr); + + // Lost [0, 9) and fin. + stream_->OnStreamFrameLost(0, 9, false); + stream_->OnStreamFrameLost(18, 0, true); + + // Retransmit lost data. Verify [0, 9) and fin are retransmitted in two + // frames. + InSequence s; + EXPECT_CALL(*session_, WritevData(_, _, _, _, _)) + .WillOnce(Return(QuicConsumedData(9, false))); + EXPECT_CALL(*session_, WritevData(_, _, _, _, _)) + .WillOnce(Return(QuicConsumedData(0, true))); + stream_->OnCanWrite(); +} + } // namespace } // namespace test } // namespace net
diff --git a/net/quic/core/quic_tag.cc b/net/quic/core/quic_tag.cc index 2d0f1ec..9a44300 100644 --- a/net/quic/core/quic_tag.cc +++ b/net/quic/core/quic_tag.cc
@@ -6,6 +6,7 @@ #include "base/macros.h" #include "base/stl_util.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_text_utils.h" namespace net { @@ -36,9 +37,10 @@ bool ascii = true; const QuicTag orig_tag = tag; - for (size_t i = 0; i < arraysize(chars); i++) { + for (size_t i = 0; i < QUIC_ARRAYSIZE(chars); i++) { chars[i] = static_cast<char>(tag); - if ((chars[i] == 0 || chars[i] == '\xff') && i == arraysize(chars) - 1) { + if ((chars[i] == 0 || chars[i] == '\xff') && + i == QUIC_ARRAYSIZE(chars) - 1) { chars[i] = ' '; } if (!isprint(static_cast<unsigned char>(chars[i]))) {
diff --git a/net/quic/core/quic_unacked_packet_map_test.cc b/net/quic/core/quic_unacked_packet_map_test.cc index 69e3315..5e2a714 100644 --- a/net/quic/core/quic_unacked_packet_map_test.cc +++ b/net/quic/core/quic_unacked_packet_map_test.cc
@@ -4,6 +4,7 @@ #include "net/quic/core/quic_unacked_packet_map.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_test.h" #include "net/quic/test_tools/quic_test_utils.h" @@ -124,7 +125,7 @@ unacked_packets_.AddSentPacket(&packet, 0, NOT_RETRANSMISSION, now_, false); QuicPacketNumber unacked[] = {1}; - VerifyUnackedPackets(unacked, arraysize(unacked)); + VerifyUnackedPackets(unacked, QUIC_ARRAYSIZE(unacked)); VerifyInFlightPackets(nullptr, 0); VerifyRetransmittablePackets(nullptr, 0); @@ -140,18 +141,18 @@ unacked_packets_.AddSentPacket(&packet, 0, NOT_RETRANSMISSION, now_, true); QuicPacketNumber unacked[] = {1}; - VerifyUnackedPackets(unacked, arraysize(unacked)); - VerifyInFlightPackets(unacked, arraysize(unacked)); - VerifyRetransmittablePackets(unacked, arraysize(unacked)); + VerifyUnackedPackets(unacked, QUIC_ARRAYSIZE(unacked)); + VerifyInFlightPackets(unacked, QUIC_ARRAYSIZE(unacked)); + VerifyRetransmittablePackets(unacked, QUIC_ARRAYSIZE(unacked)); unacked_packets_.RemoveRetransmittability(1); - VerifyUnackedPackets(unacked, arraysize(unacked)); - VerifyInFlightPackets(unacked, arraysize(unacked)); + VerifyUnackedPackets(unacked, QUIC_ARRAYSIZE(unacked)); + VerifyInFlightPackets(unacked, QUIC_ARRAYSIZE(unacked)); VerifyRetransmittablePackets(nullptr, 0); unacked_packets_.IncreaseLargestObserved(1); - VerifyUnackedPackets(unacked, arraysize(unacked)); - VerifyInFlightPackets(unacked, arraysize(unacked)); + VerifyUnackedPackets(unacked, QUIC_ARRAYSIZE(unacked)); + VerifyInFlightPackets(unacked, QUIC_ARRAYSIZE(unacked)); VerifyRetransmittablePackets(nullptr, 0); unacked_packets_.RemoveFromInFlight(1); @@ -166,15 +167,16 @@ unacked_packets_.AddSentPacket(&packet, 0, NOT_RETRANSMISSION, now_, true); QuicPacketNumber unacked[] = {1}; - VerifyUnackedPackets(unacked, arraysize(unacked)); - VerifyInFlightPackets(unacked, arraysize(unacked)); + VerifyUnackedPackets(unacked, QUIC_ARRAYSIZE(unacked)); + VerifyInFlightPackets(unacked, QUIC_ARRAYSIZE(unacked)); QuicPacketNumber retransmittable[] = {1}; - VerifyRetransmittablePackets(retransmittable, arraysize(retransmittable)); + VerifyRetransmittablePackets(retransmittable, + QUIC_ARRAYSIZE(retransmittable)); EXPECT_CALL(notifier_, OnStreamFrameDiscarded(_)).Times(1); unacked_packets_.CancelRetransmissionsForStream(stream_id); - VerifyUnackedPackets(unacked, arraysize(unacked)); - VerifyInFlightPackets(unacked, arraysize(unacked)); + VerifyUnackedPackets(unacked, QUIC_ARRAYSIZE(unacked)); + VerifyInFlightPackets(unacked, QUIC_ARRAYSIZE(unacked)); VerifyRetransmittablePackets(nullptr, 0); } @@ -184,17 +186,19 @@ unacked_packets_.AddSentPacket(&packet, 0, NOT_RETRANSMISSION, now_, true); QuicPacketNumber unacked[] = {1}; - VerifyUnackedPackets(unacked, arraysize(unacked)); - VerifyInFlightPackets(unacked, arraysize(unacked)); + VerifyUnackedPackets(unacked, QUIC_ARRAYSIZE(unacked)); + VerifyInFlightPackets(unacked, QUIC_ARRAYSIZE(unacked)); QuicPacketNumber retransmittable[] = {1}; - VerifyRetransmittablePackets(retransmittable, arraysize(retransmittable)); + VerifyRetransmittablePackets(retransmittable, + QUIC_ARRAYSIZE(retransmittable)); // Stop retransmissions on another stream and verify the packet is unchanged. EXPECT_CALL(notifier_, OnStreamFrameDiscarded(_)).Times(0); unacked_packets_.CancelRetransmissionsForStream(stream_id + 2); - VerifyUnackedPackets(unacked, arraysize(unacked)); - VerifyInFlightPackets(unacked, arraysize(unacked)); - VerifyRetransmittablePackets(retransmittable, arraysize(retransmittable)); + VerifyUnackedPackets(unacked, QUIC_ARRAYSIZE(unacked)); + VerifyInFlightPackets(unacked, QUIC_ARRAYSIZE(unacked)); + VerifyRetransmittablePackets(retransmittable, + QUIC_ARRAYSIZE(retransmittable)); } TEST_F(QuicUnackedPacketMapTest, StopRetransmissionAfterRetransmission) { @@ -205,15 +209,16 @@ unacked_packets_.AddSentPacket(&packet2, 1, LOSS_RETRANSMISSION, now_, true); QuicPacketNumber unacked[] = {1, 2}; - VerifyUnackedPackets(unacked, arraysize(unacked)); - VerifyInFlightPackets(unacked, arraysize(unacked)); + VerifyUnackedPackets(unacked, QUIC_ARRAYSIZE(unacked)); + VerifyInFlightPackets(unacked, QUIC_ARRAYSIZE(unacked)); QuicPacketNumber retransmittable[] = {2}; - VerifyRetransmittablePackets(retransmittable, arraysize(retransmittable)); + VerifyRetransmittablePackets(retransmittable, + QUIC_ARRAYSIZE(retransmittable)); EXPECT_CALL(notifier_, OnStreamFrameDiscarded(_)).Times(1); unacked_packets_.CancelRetransmissionsForStream(stream_id); - VerifyUnackedPackets(unacked, arraysize(unacked)); - VerifyInFlightPackets(unacked, arraysize(unacked)); + VerifyUnackedPackets(unacked, QUIC_ARRAYSIZE(unacked)); + VerifyInFlightPackets(unacked, QUIC_ARRAYSIZE(unacked)); VerifyRetransmittablePackets(nullptr, 0); } @@ -226,25 +231,26 @@ unacked_packets_.AddSentPacket(&packet2, 1, LOSS_RETRANSMISSION, now_, true); QuicPacketNumber unacked[] = {1, 2}; - VerifyUnackedPackets(unacked, arraysize(unacked)); - VerifyInFlightPackets(unacked, arraysize(unacked)); + VerifyUnackedPackets(unacked, QUIC_ARRAYSIZE(unacked)); + VerifyInFlightPackets(unacked, QUIC_ARRAYSIZE(unacked)); QuicPacketNumber retransmittable[] = {2}; - VerifyRetransmittablePackets(retransmittable, arraysize(retransmittable)); + VerifyRetransmittablePackets(retransmittable, + QUIC_ARRAYSIZE(retransmittable)); unacked_packets_.RemoveRetransmittability(1); - VerifyUnackedPackets(unacked, arraysize(unacked)); - VerifyInFlightPackets(unacked, arraysize(unacked)); + VerifyUnackedPackets(unacked, QUIC_ARRAYSIZE(unacked)); + VerifyInFlightPackets(unacked, QUIC_ARRAYSIZE(unacked)); VerifyRetransmittablePackets(nullptr, 0); unacked_packets_.IncreaseLargestObserved(2); - VerifyUnackedPackets(unacked, arraysize(unacked)); - VerifyInFlightPackets(unacked, arraysize(unacked)); + VerifyUnackedPackets(unacked, QUIC_ARRAYSIZE(unacked)); + VerifyInFlightPackets(unacked, QUIC_ARRAYSIZE(unacked)); VerifyRetransmittablePackets(nullptr, 0); unacked_packets_.RemoveFromInFlight(2); QuicPacketNumber unacked2[] = {1}; - VerifyUnackedPackets(unacked2, arraysize(unacked2)); - VerifyInFlightPackets(unacked2, arraysize(unacked2)); + VerifyUnackedPackets(unacked2, QUIC_ARRAYSIZE(unacked2)); + VerifyInFlightPackets(unacked2, QUIC_ARRAYSIZE(unacked2)); VerifyRetransmittablePackets(nullptr, 0); unacked_packets_.RemoveFromInFlight(1); @@ -261,10 +267,11 @@ unacked_packets_.AddSentPacket(&packet2, 0, NOT_RETRANSMISSION, now_, true); QuicPacketNumber unacked[] = {1, 2}; - VerifyUnackedPackets(unacked, arraysize(unacked)); - VerifyInFlightPackets(unacked, arraysize(unacked)); + VerifyUnackedPackets(unacked, QUIC_ARRAYSIZE(unacked)); + VerifyInFlightPackets(unacked, QUIC_ARRAYSIZE(unacked)); QuicPacketNumber retransmittable[] = {1, 2}; - VerifyRetransmittablePackets(retransmittable, arraysize(retransmittable)); + VerifyRetransmittablePackets(retransmittable, + QUIC_ARRAYSIZE(retransmittable)); // Early retransmit 1 as 3 and send new data as 4. unacked_packets_.IncreaseLargestObserved(2); @@ -277,11 +284,12 @@ unacked_packets_.AddSentPacket(&packet4, 0, NOT_RETRANSMISSION, now_, true); QuicPacketNumber unacked2[] = {1, 3, 4}; - VerifyUnackedPackets(unacked2, arraysize(unacked2)); + VerifyUnackedPackets(unacked2, QUIC_ARRAYSIZE(unacked2)); QuicPacketNumber pending2[] = {3, 4}; - VerifyInFlightPackets(pending2, arraysize(pending2)); + VerifyInFlightPackets(pending2, QUIC_ARRAYSIZE(pending2)); QuicPacketNumber retransmittable2[] = {3, 4}; - VerifyRetransmittablePackets(retransmittable2, arraysize(retransmittable2)); + VerifyRetransmittablePackets(retransmittable2, + QUIC_ARRAYSIZE(retransmittable2)); // Early retransmit 3 (formerly 1) as 5, and remove 1 from unacked. unacked_packets_.IncreaseLargestObserved(4); @@ -293,11 +301,12 @@ unacked_packets_.AddSentPacket(&packet6, 0, NOT_RETRANSMISSION, now_, true); QuicPacketNumber unacked3[] = {3, 5, 6}; - VerifyUnackedPackets(unacked3, arraysize(unacked3)); + VerifyUnackedPackets(unacked3, QUIC_ARRAYSIZE(unacked3)); QuicPacketNumber pending3[] = {3, 5, 6}; - VerifyInFlightPackets(pending3, arraysize(pending3)); + VerifyInFlightPackets(pending3, QUIC_ARRAYSIZE(pending3)); QuicPacketNumber retransmittable3[] = {5, 6}; - VerifyRetransmittablePackets(retransmittable3, arraysize(retransmittable3)); + VerifyRetransmittablePackets(retransmittable3, + QUIC_ARRAYSIZE(retransmittable3)); // Early retransmit 5 as 7 and ensure in flight packet 3 is not removed. unacked_packets_.IncreaseLargestObserved(6); @@ -307,17 +316,18 @@ unacked_packets_.AddSentPacket(&packet7, 5, LOSS_RETRANSMISSION, now_, true); QuicPacketNumber unacked4[] = {3, 5, 7}; - VerifyUnackedPackets(unacked4, arraysize(unacked4)); + VerifyUnackedPackets(unacked4, QUIC_ARRAYSIZE(unacked4)); QuicPacketNumber pending4[] = {3, 5, 7}; - VerifyInFlightPackets(pending4, arraysize(pending4)); + VerifyInFlightPackets(pending4, QUIC_ARRAYSIZE(pending4)); QuicPacketNumber retransmittable4[] = {7}; - VerifyRetransmittablePackets(retransmittable4, arraysize(retransmittable4)); + VerifyRetransmittablePackets(retransmittable4, + QUIC_ARRAYSIZE(retransmittable4)); // Remove the older two transmissions from in flight. unacked_packets_.RemoveFromInFlight(3); unacked_packets_.RemoveFromInFlight(5); QuicPacketNumber pending5[] = {7}; - VerifyInFlightPackets(pending5, arraysize(pending5)); + VerifyInFlightPackets(pending5, QUIC_ARRAYSIZE(pending5)); } TEST_F(QuicUnackedPacketMapTest, RetransmitFourTimes) { @@ -328,10 +338,11 @@ unacked_packets_.AddSentPacket(&packet2, 0, NOT_RETRANSMISSION, now_, true); QuicPacketNumber unacked[] = {1, 2}; - VerifyUnackedPackets(unacked, arraysize(unacked)); - VerifyInFlightPackets(unacked, arraysize(unacked)); + VerifyUnackedPackets(unacked, QUIC_ARRAYSIZE(unacked)); + VerifyInFlightPackets(unacked, QUIC_ARRAYSIZE(unacked)); QuicPacketNumber retransmittable[] = {1, 2}; - VerifyRetransmittablePackets(retransmittable, arraysize(retransmittable)); + VerifyRetransmittablePackets(retransmittable, + QUIC_ARRAYSIZE(retransmittable)); // Early retransmit 1 as 3. unacked_packets_.IncreaseLargestObserved(2); @@ -342,11 +353,12 @@ unacked_packets_.AddSentPacket(&packet3, 1, LOSS_RETRANSMISSION, now_, true); QuicPacketNumber unacked2[] = {1, 3}; - VerifyUnackedPackets(unacked2, arraysize(unacked2)); + VerifyUnackedPackets(unacked2, QUIC_ARRAYSIZE(unacked2)); QuicPacketNumber pending2[] = {3}; - VerifyInFlightPackets(pending2, arraysize(pending2)); + VerifyInFlightPackets(pending2, QUIC_ARRAYSIZE(pending2)); QuicPacketNumber retransmittable2[] = {3}; - VerifyRetransmittablePackets(retransmittable2, arraysize(retransmittable2)); + VerifyRetransmittablePackets(retransmittable2, + QUIC_ARRAYSIZE(retransmittable2)); // TLP 3 (formerly 1) as 4, and don't remove 1 from unacked. SerializedPacket packet4(CreateNonRetransmittablePacket(4)); @@ -355,11 +367,12 @@ unacked_packets_.AddSentPacket(&packet5, 0, NOT_RETRANSMISSION, now_, true); QuicPacketNumber unacked3[] = {1, 3, 4, 5}; - VerifyUnackedPackets(unacked3, arraysize(unacked3)); + VerifyUnackedPackets(unacked3, QUIC_ARRAYSIZE(unacked3)); QuicPacketNumber pending3[] = {3, 4, 5}; - VerifyInFlightPackets(pending3, arraysize(pending3)); + VerifyInFlightPackets(pending3, QUIC_ARRAYSIZE(pending3)); QuicPacketNumber retransmittable3[] = {4, 5}; - VerifyRetransmittablePackets(retransmittable3, arraysize(retransmittable3)); + VerifyRetransmittablePackets(retransmittable3, + QUIC_ARRAYSIZE(retransmittable3)); // Early retransmit 4 as 6 and ensure in flight packet 3 is removed. unacked_packets_.IncreaseLargestObserved(5); @@ -371,11 +384,12 @@ unacked_packets_.AddSentPacket(&packet6, 4, LOSS_RETRANSMISSION, now_, true); QuicPacketNumber unacked4[] = {4, 6}; - VerifyUnackedPackets(unacked4, arraysize(unacked4)); + VerifyUnackedPackets(unacked4, QUIC_ARRAYSIZE(unacked4)); QuicPacketNumber pending4[] = {6}; - VerifyInFlightPackets(pending4, arraysize(pending4)); + VerifyInFlightPackets(pending4, QUIC_ARRAYSIZE(pending4)); QuicPacketNumber retransmittable4[] = {6}; - VerifyRetransmittablePackets(retransmittable4, arraysize(retransmittable4)); + VerifyRetransmittablePackets(retransmittable4, + QUIC_ARRAYSIZE(retransmittable4)); } TEST_F(QuicUnackedPacketMapTest, SendWithGap) {
diff --git a/net/quic/core/quic_versions_test.cc b/net/quic/core/quic_versions_test.cc index 7fc0131..1a4a553a5 100644 --- a/net/quic/core/quic_versions_test.cc +++ b/net/quic/core/quic_versions_test.cc
@@ -4,6 +4,7 @@ #include "net/quic/core/quic_versions.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_flags.h" #include "net/quic/platform/api/quic_test.h" #include "net/quic/test_tools/quic_test_utils.h" @@ -39,9 +40,9 @@ // Loop over all supported versions and make sure that we never hit the // default case (i.e. all supported versions should be successfully converted // to valid QuicVersionLabels). - for (size_t i = 0; i < arraysize(kSupportedTransportVersions); ++i) { - QuicTransportVersion version = kSupportedTransportVersions[i]; - EXPECT_LT(0u, QuicVersionToQuicVersionLabel(version)); + for (size_t i = 0; i < QUIC_ARRAYSIZE(kSupportedTransportVersions); ++i) { + QuicTransportVersion version = kSupportedTransportVersions[i]; + EXPECT_LT(0u, QuicVersionToQuicVersionLabel(version)); } } @@ -78,7 +79,7 @@ EXPECT_EQ(QUIC_VERSION_35, QuicVersionLabelToQuicVersion(MakeQuicTag('5', '3', '0', 'Q'))); - for (size_t i = 0; i < arraysize(kSupportedTransportVersions); ++i) { + for (size_t i = 0; i < QUIC_ARRAYSIZE(kSupportedTransportVersions); ++i) { QuicTransportVersion version = kSupportedTransportVersions[i]; // Get the label from the version (we can loop over QuicVersions easily). @@ -117,7 +118,7 @@ log.StartCapturingLogs(); #endif - for (size_t i = 0; i < arraysize(kSupportedTransportVersions); ++i) { + for (size_t i = 0; i < QUIC_ARRAYSIZE(kSupportedTransportVersions); ++i) { QuicVersionLabel version_label = QuicVersionToQuicVersionLabel(kSupportedTransportVersions[i]); EXPECT_EQ(PROTOCOL_QUIC_CRYPTO, @@ -261,7 +262,7 @@ QuicTransportVersion single_version[] = {QUIC_VERSION_35}; QuicTransportVersionVector versions_vector; - for (size_t i = 0; i < arraysize(single_version); ++i) { + for (size_t i = 0; i < QUIC_ARRAYSIZE(single_version); ++i) { versions_vector.push_back(single_version[i]); } EXPECT_EQ("QUIC_VERSION_35", @@ -270,14 +271,14 @@ QuicTransportVersion multiple_versions[] = {QUIC_VERSION_UNSUPPORTED, QUIC_VERSION_35}; versions_vector.clear(); - for (size_t i = 0; i < arraysize(multiple_versions); ++i) { + for (size_t i = 0; i < QUIC_ARRAYSIZE(multiple_versions); ++i) { versions_vector.push_back(multiple_versions[i]); } EXPECT_EQ("QUIC_VERSION_UNSUPPORTED,QUIC_VERSION_35", QuicTransportVersionVectorToString(versions_vector)); // Make sure that all supported versions are present in QuicVersionToString. - for (size_t i = 0; i < arraysize(kSupportedTransportVersions); ++i) { + for (size_t i = 0; i < QUIC_ARRAYSIZE(kSupportedTransportVersions); ++i) { QuicTransportVersion version = kSupportedTransportVersions[i]; EXPECT_NE("QUIC_VERSION_UNSUPPORTED", QuicVersionToString(version)); } @@ -364,7 +365,7 @@ // yet a typo was made in doing the #defines and it was caught // only in some test far removed from here... Better safe than sorry. TEST_F(QuicVersionsTest, CheckVersionNumbersForTypos) { - static_assert(arraysize(net::kSupportedTransportVersions) == 7u, + static_assert(QUIC_ARRAYSIZE(net::kSupportedTransportVersions) == 7u, "Supported versions out of sync"); EXPECT_EQ(QUIC_VERSION_35, 35); EXPECT_EQ(QUIC_VERSION_37, 37);
diff --git a/net/quic/core/tls_handshaker.cc b/net/quic/core/tls_handshaker.cc index bbb9c95..ba15d0c 100644 --- a/net/quic/core/tls_handshaker.cc +++ b/net/quic/core/tls_handshaker.cc
@@ -8,6 +8,7 @@ #include "net/quic/core/quic_crypto_stream.h" #include "net/quic/core/tls_client_handshaker.h" #include "net/quic/core/tls_server_handshaker.h" +#include "net/quic/platform/api/quic_arraysize.h" namespace net { @@ -60,12 +61,12 @@ size_t hash_len = EVP_MD_size(Prf()); client_secret_out->resize(hash_len); server_secret_out->resize(hash_len); - return (SSL_export_keying_material(ssl(), client_secret_out->data(), hash_len, - kClientLabel, arraysize(kClientLabel) - 1, - nullptr, 0, 0) == 1) && - (SSL_export_keying_material(ssl(), server_secret_out->data(), hash_len, - kServerLabel, arraysize(kServerLabel) - 1, - nullptr, 0, 0) == 1); + return (SSL_export_keying_material( + ssl(), client_secret_out->data(), hash_len, kClientLabel, + QUIC_ARRAYSIZE(kClientLabel) - 1, nullptr, 0, 0) == 1) && + (SSL_export_keying_material( + ssl(), server_secret_out->data(), hash_len, kServerLabel, + QUIC_ARRAYSIZE(kServerLabel) - 1, nullptr, 0, 0) == 1); } namespace {
diff --git a/net/quic/core/tls_handshaker_test.cc b/net/quic/core/tls_handshaker_test.cc index c697925..08919bd5 100644 --- a/net/quic/core/tls_handshaker_test.cc +++ b/net/quic/core/tls_handshaker_test.cc
@@ -4,6 +4,7 @@ #include "net/quic/core/tls_client_handshaker.h" #include "net/quic/core/tls_server_handshaker.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_test.h" #include "net/quic/test_tools/crypto_test_utils.h" #include "net/quic/test_tools/fake_proof_source.h" @@ -365,7 +366,7 @@ }; QuicStreamFrame alert(kCryptoStreamId, false, client_stream_.stream_bytes_read(), - QuicStringPiece(alert_msg, arraysize(alert_msg))); + QuicStringPiece(alert_msg, QUIC_ARRAYSIZE(alert_msg))); client_stream_.OnStreamFrame(alert); EXPECT_FALSE(client_stream_.handshake_confirmed()); @@ -386,7 +387,7 @@ }; QuicStreamFrame alert(kCryptoStreamId, false, server_stream_->stream_bytes_read(), - QuicStringPiece(alert_msg, arraysize(alert_msg))); + QuicStringPiece(alert_msg, QUIC_ARRAYSIZE(alert_msg))); server_stream_->OnStreamFrame(alert); EXPECT_FALSE(server_stream_->handshake_confirmed());
diff --git a/net/quic/platform/api/quic_arraysize.h b/net/quic/platform/api/quic_arraysize.h new file mode 100644 index 0000000..effd46fc --- /dev/null +++ b/net/quic/platform/api/quic_arraysize.h
@@ -0,0 +1,12 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef NET_QUIC_PLATFORM_API_QUIC_ARRAYSIZE_H_ +#define NET_QUIC_PLATFORM_API_QUIC_ARRAYSIZE_H_ + +#include "net/quic/platform/impl/quic_arraysize_impl.h" + +#define QUIC_ARRAYSIZE(array) QUIC_ARRAYSIZE_IMPL(array) + +#endif // NET_QUIC_PLATFORM_API_QUIC_ARRAYSIZE_H_
diff --git a/net/quic/platform/api/quic_hostname_utils_test.cc b/net/quic/platform/api/quic_hostname_utils_test.cc index 65bbcb1..9412d5b 100644 --- a/net/quic/platform/api/quic_hostname_utils_test.cc +++ b/net/quic/platform/api/quic_hostname_utils_test.cc
@@ -4,6 +4,7 @@ #include "net/quic/platform/api/quic_hostname_utils.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_test.h" using std::string; @@ -53,7 +54,7 @@ }, }; - for (size_t i = 0; i < arraysize(tests); ++i) { + for (size_t i = 0; i < QUIC_ARRAYSIZE(tests); ++i) { char buf[256]; snprintf(buf, sizeof(buf), "%s", tests[i].input); EXPECT_EQ(string(tests[i].expected),
diff --git a/net/quic/platform/impl/quic_arraysize_impl.h b/net/quic/platform/impl/quic_arraysize_impl.h new file mode 100644 index 0000000..0dd9cb3 --- /dev/null +++ b/net/quic/platform/impl/quic_arraysize_impl.h
@@ -0,0 +1,10 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef NET_QUIC_PLATFORM_IMPL_QUIC_ARRAYSIZE_IMPL_H_ +#define NET_QUIC_PLATFORM_IMPL_QUIC_ARRAYSIZE_IMPL_H_ + +#define QUIC_ARRAYSIZE_IMPL(array) arraysize(array) + +#endif // NET_QUIC_PLATFORM_IMPL_QUIC_ARRAYSIZE_IMPL_H_
diff --git a/net/quic/quartc/quartc_factory.cc b/net/quic/quartc/quartc_factory.cc index b9d924d08..3e182fa 100644 --- a/net/quic/quartc/quartc_factory.cc +++ b/net/quic/quartc/quartc_factory.cc
@@ -120,8 +120,6 @@ // Note: These settings have no effect for Exoblaze builds since // SetQuicReloadableFlag() gets stubbed out. - SetQuicReloadableFlag(quic_bbr_slower_startup, true); - SetQuicReloadableFlag(quic_bbr_fully_drain_queue, true); SetQuicReloadableFlag(quic_bbr_less_probe_rtt, true); for (const auto option : quartc_session_config.bbr_options) { switch (option) {
diff --git a/net/quic/test_tools/quic_test_utils.cc b/net/quic/test_tools/quic_test_utils.cc index 6c3c6ce..1859654 100644 --- a/net/quic/test_tools/quic_test_utils.cc +++ b/net/quic/test_tools/quic_test_utils.cc
@@ -17,6 +17,7 @@ #include "net/quic/core/quic_framer.h" #include "net/quic/core/quic_packet_creator.h" #include "net/quic/core/quic_utils.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_endian.h" #include "net/quic/platform/api/quic_flags.h" #include "net/quic/platform/api/quic_logging.h" @@ -100,7 +101,7 @@ char buffer[SHA_DIGEST_LENGTH]; SHA1(reinterpret_cast<const uint8_t*>(data.data()), data.size(), reinterpret_cast<uint8_t*>(buffer)); - return string(buffer, arraysize(buffer)); + return string(buffer, QUIC_ARRAYSIZE(buffer)); } uint64_t SimpleRandom::RandUint64() {
diff --git a/net/spdy/chromium/http2_push_promise_index.cc b/net/spdy/chromium/http2_push_promise_index.cc index 7eb3378..48362a4 100644 --- a/net/spdy/chromium/http2_push_promise_index.cc +++ b/net/spdy/chromium/http2_push_promise_index.cc
@@ -3,7 +3,9 @@ // found in the LICENSE file. #include "net/spdy/chromium/http2_push_promise_index.h" +#include "base/trace_event/memory_usage_estimator.h" +#include <algorithm> #include <utility> namespace net { @@ -14,6 +16,74 @@ DCHECK(unclaimed_pushed_streams_.empty()); } +bool Http2PushPromiseIndex::RegisterUnclaimedPushedStream( + const GURL& url, + SpdyStreamId stream_id, + Delegate* delegate) { + DCHECK(!url.is_empty()); + DCHECK_GT(stream_id, kNoPushedStreamFound); + DCHECK(delegate); + + // Find the entry with |url| for |delegate| if such exists (there can be at + // most one such entry). It is okay to cast away const from |delegate|, + // because it is only used for lookup. + auto it = unclaimed_pushed_streams_.lower_bound(UnclaimedPushedStream{ + url, const_cast<Delegate*>(delegate), kNoPushedStreamFound}); + // If such entry is found, do not allow registering another one. + if (it != unclaimed_pushed_streams_.end() && it->url == url && + it->delegate == delegate) { + return false; + } + + unclaimed_pushed_streams_.insert( + it, UnclaimedPushedStream{url, delegate, stream_id}); + + return true; +} + +bool Http2PushPromiseIndex::UnregisterUnclaimedPushedStream( + const GURL& url, + SpdyStreamId stream_id, + Delegate* delegate) { + DCHECK(!url.is_empty()); + DCHECK_GT(stream_id, kNoPushedStreamFound); + DCHECK(delegate); + + size_t result = unclaimed_pushed_streams_.erase( + UnclaimedPushedStream{url, delegate, stream_id}); + + return result == 1; +} + +// The runtime of this method is linear in unclaimed_pushed_streams_.size(), +// which is acceptable, because it is only used in NetLog, tests, and DCHECKs. +size_t Http2PushPromiseIndex::CountStreamsForSession( + const Delegate* delegate) const { + DCHECK(delegate); + + return std::count_if(unclaimed_pushed_streams_.begin(), + unclaimed_pushed_streams_.end(), + [&delegate](const UnclaimedPushedStream& entry) { + return entry.delegate == delegate; + }); +} + +SpdyStreamId Http2PushPromiseIndex::FindStream(const GURL& url, + const Delegate* delegate) const { + // Find the entry with |url| for |delegate| if such exists (there can be at + // most one such entry). It is okay to cast away const from |delegate|, + // because it is only used for lookup. + auto it = unclaimed_pushed_streams_.lower_bound(UnclaimedPushedStream{ + url, const_cast<Delegate*>(delegate), kNoPushedStreamFound}); + + if (it == unclaimed_pushed_streams_.end() || it->url != url || + it->delegate != delegate) { + return kNoPushedStreamFound; + } + + return it->stream_id; +} + void Http2PushPromiseIndex::FindSession(const SpdySessionKey& key, const GURL& url, base::WeakPtr<SpdySession>* session, @@ -23,13 +93,14 @@ *session = nullptr; *stream_id = kNoPushedStreamFound; - auto it = unclaimed_pushed_streams_.lower_bound( - UnclaimedPushedStream{url, kNoPushedStreamFound, nullptr}); - - if (it == unclaimed_pushed_streams_.end() || it->url != url) + // Do not allow cross-origin push for non-cryptographic schemes. + if (!url.SchemeIsCryptographic()) return; - DCHECK(url.SchemeIsCryptographic()); + // Find the first entry for |url|, if such exists. + auto it = unclaimed_pushed_streams_.lower_bound( + UnclaimedPushedStream{url, nullptr, kNoPushedStreamFound}); + while (it != unclaimed_pushed_streams_.end() && it->url == url) { if (it->delegate->ValidatePushedStream(key)) { *session = it->delegate->GetWeakPtrToSession(); @@ -41,30 +112,43 @@ } } -void Http2PushPromiseIndex::RegisterUnclaimedPushedStream( - const GURL& url, - SpdyStreamId stream_id, - Delegate* delegate) { - DCHECK(!url.is_empty()); - DCHECK(url.SchemeIsCryptographic()); - DCHECK(delegate); - - unclaimed_pushed_streams_.insert( - UnclaimedPushedStream{url, stream_id, delegate}); +size_t Http2PushPromiseIndex::EstimateMemoryUsage() const { + return base::trace_event::EstimateMemoryUsage(unclaimed_pushed_streams_); } -void Http2PushPromiseIndex::UnregisterUnclaimedPushedStream( - const GURL& url, - SpdyStreamId stream_id, - Delegate* delegate) { - DCHECK(!url.is_empty()); - DCHECK(url.SchemeIsCryptographic()); - DCHECK(delegate); +size_t Http2PushPromiseIndex::UnclaimedPushedStream::EstimateMemoryUsage() + const { + return base::trace_event::EstimateMemoryUsage(url) + sizeof(SpdyStreamId) + + sizeof(Delegate*); +} - size_t result = unclaimed_pushed_streams_.erase( - UnclaimedPushedStream{url, stream_id, delegate}); - LOG_IF(DFATAL, result != 1) - << "Only a previously registered entry can be unregistered."; +bool Http2PushPromiseIndex::CompareByUrl::operator()( + const UnclaimedPushedStream& a, + const UnclaimedPushedStream& b) const { + // Compare by URL first. + if (a.url < b.url) + return true; + if (a.url > b.url) + return false; + // For identical URL, put an entry with delegate == nullptr first. + // The C++ standard dictates that comparisons between |nullptr| and other + // pointers are unspecified, hence the need to handle this case separately. + if (a.delegate == nullptr && b.delegate != nullptr) { + return true; + } + if (a.delegate != nullptr && b.delegate == nullptr) { + return false; + } + // Then compare by Delegate. + // The C++ standard guarantees that both |nullptr < nullptr| and + // |nullptr > nullptr| are false, so there is no need to handle that case + // separately. + if (a.delegate < b.delegate) + return true; + if (a.delegate > b.delegate) + return false; + // If URL and Delegate are identical, then compare by stream ID. + return a.stream_id < b.stream_id; } } // namespace net
diff --git a/net/spdy/chromium/http2_push_promise_index.h b/net/spdy/chromium/http2_push_promise_index.h index b7e85ec..fd283bc 100644 --- a/net/spdy/chromium/http2_push_promise_index.h +++ b/net/spdy/chromium/http2_push_promise_index.h
@@ -7,6 +7,7 @@ #include <set> +#include "base/compiler_specific.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "net/base/net_export.h" @@ -24,28 +25,20 @@ } // namespace test -// This value is returned by Http2PushPromiseIndex::FindSession() and -// UnclaimedPushedStreamContainer::FindStream() if no stream is found. -// TODO(bnc): Move UnclaimedPushedStreamContainer::FindStream() to this class. -// https://crbug.com/791054 +// Value returned by FindSession() and FindStream() if no stream is found. const SpdyStreamId kNoPushedStreamFound = 0; -// This class manages cross-origin unclaimed pushed streams (push promises) from -// the receipt of PUSH_PROMISE frame until they are matched to a request. Each -// SpdySessionPool owns one instance of this class, which then allows requests -// to be matched with a pushed stream regardless of which HTTP/2 connection the -// stream is on. -// Only pushed streams with cryptographic schemes (for example, https) are -// allowed to be shared across connections. Non-cryptographic scheme pushes -// (for example, http) are fully managed within each SpdySession. -// TODO(bnc): Move unclaimed pushed stream management out of SpdySession, -// regardless of scheme, to avoid redundant bookkeeping and complicated -// interactions between SpdySession::UnclaimedPushedStreamContainer and -// Http2PushPromiseIndex. https://crbug.com/791054. +// This class manages unclaimed pushed streams (push promises) from the receipt +// of PUSH_PROMISE frame until they are matched to a request. +// Each SpdySessionPool owns one instance of this class. +// SpdySession uses this class to register, unregister and query pushed streams. +// HttpStreamFactoryImpl::Job uses this class to find a SpdySession with a +// pushed stream matching the request, if such exists, which is only allowed for +// requests with a cryptographic scheme. class NET_EXPORT Http2PushPromiseIndex { public: // Interface for validating pushed streams, signaling when a pushed stream is - // claimed, and generating weak pointer. + // claimed, and generating SpdySession weak pointer. class NET_EXPORT Delegate { public: Delegate() {} @@ -54,11 +47,13 @@ // Return true if the pushed stream can be used for a request with |key|. virtual bool ValidatePushedStream(const SpdySessionKey& key) const = 0; - // Called when a pushed stream is claimed. + // Called when a pushed stream is claimed. Guaranateed to be called + // synchronously after ValidatePushedStream() is called and returns true. virtual void OnPushedStreamClaimed(const GURL& url, SpdyStreamId stream_id) = 0; - // Generate weak pointer. + // Generate weak pointer. Guaranateed to be called synchronously after + // ValidatePushedStream() is called and returns true. virtual base::WeakPtr<SpdySession> GetWeakPtrToSession() = 0; private: @@ -68,6 +63,29 @@ Http2PushPromiseIndex(); ~Http2PushPromiseIndex(); + // Tries to register a Delegate with an unclaimed pushed stream for |url|. + // Caller must make sure |delegate| stays valid by unregistering the exact + // same entry before |delegate| is destroyed. + // Returns true if there is no unclaimed pushed stream with the same URL for + // the same Delegate, in which case the stream is registered. + bool RegisterUnclaimedPushedStream(const GURL& url, + SpdyStreamId stream_id, + Delegate* delegate) WARN_UNUSED_RESULT; + + // Tries to unregister a Delegate with an unclaimed pushed stream for |url| + // with given |stream_id|. + // Returns true if this exact entry is found, in which case it is removed. + bool UnregisterUnclaimedPushedStream(const GURL& url, + SpdyStreamId stream_id, + Delegate* delegate) WARN_UNUSED_RESULT; + + // Returns the number of pushed streams registered for |delegate|. + size_t CountStreamsForSession(const Delegate* delegate) const; + + // Returns the stream ID of the entry registered for |delegate| with |url|, + // or kNoPushedStreamFound if no such entry exists. + SpdyStreamId FindStream(const GURL& url, const Delegate* delegate) const; + // If there exists a session compatible with |key| that has an unclaimed push // stream for |url|, then sets |*session| and |*stream| to one such session // and stream. Makes no guarantee on which (session, stream_id) pair it @@ -78,61 +96,35 @@ base::WeakPtr<SpdySession>* session, SpdyStreamId* stream_id) const; - // (Un)registers a Delegate with an unclaimed pushed stream for |url|. - // Caller must make sure |delegate| stays valid by unregistering the exact - // same entry before |delegate| is destroyed. - void RegisterUnclaimedPushedStream(const GURL& url, - SpdyStreamId stream_id, - Delegate* delegate); - void UnregisterUnclaimedPushedStream(const GURL& url, - SpdyStreamId stream_id, - Delegate* delegate); + // Return the estimate of dynamically allocated memory in bytes. + size_t EstimateMemoryUsage() const; private: friend test::Http2PushPromiseIndexPeer; // An unclaimed pushed stream entry. - struct UnclaimedPushedStream { + struct NET_EXPORT UnclaimedPushedStream { GURL url; - SpdyStreamId stream_id; Delegate* delegate; + SpdyStreamId stream_id; + size_t EstimateMemoryUsage() const; }; // Function object satisfying the requirements of "Compare", see // http://en.cppreference.com/w/cpp/concept/Compare. - // Used for sorting entries by URL. Among entries with identical URL, put the - // one with |stream_id == kNoPushedStreamFound| first, so that it can be used - // with lower_bound() to search for the first entry with given URL. For - // entries with identical URL and stream ID, sort by |delegate| memory - // address. - struct CompareByUrl { + // A set ordered by this function object supports O(log n) lookup + // of the first entry with a given URL, by calling lower_bound() with an entry + // with that URL and with delegate = nullptr. + struct NET_EXPORT CompareByUrl { bool operator()(const UnclaimedPushedStream& a, - const UnclaimedPushedStream& b) const { - if (a.url < b.url) - return true; - if (a.url > b.url) - return false; - // Identical URL. - if (a.stream_id == kNoPushedStreamFound && - b.stream_id != kNoPushedStreamFound) { - return true; - } - if (a.stream_id != kNoPushedStreamFound && - b.stream_id == kNoPushedStreamFound) { - return false; - } - if (a.stream_id < b.stream_id) - return true; - if (a.stream_id > b.stream_id) - return false; - // Identical URL and stream ID. - return a.delegate < b.delegate; - } + const UnclaimedPushedStream& b) const; }; - // A collection of all unclaimed pushed streams. Delegate must unregister its - // streams before destruction, so that all pointers remain valid. It is - // possible that multiple Delegates have pushed streams for the same GURL. + // Collection of all unclaimed pushed streams. Delegate must unregister + // its streams before destruction, so that all pointers remain valid. + // Each Delegate can have at most one pushed stream for each URL (but each + // Delegate can have pushed streams for different URLs, and different + // Delegates can have pushed streams for the same GURL). std::set<UnclaimedPushedStream, CompareByUrl> unclaimed_pushed_streams_; DISALLOW_COPY_AND_ASSIGN(Http2PushPromiseIndex);
diff --git a/net/spdy/chromium/http2_push_promise_index_test.cc b/net/spdy/chromium/http2_push_promise_index_test.cc index 78675d45..47caeda 100644 --- a/net/spdy/chromium/http2_push_promise_index_test.cc +++ b/net/spdy/chromium/http2_push_promise_index_test.cc
@@ -84,6 +84,139 @@ Http2PushPromiseIndex index_; }; +// RegisterUnclaimedPushedStream() returns false +// if there is already a registered entry with same delegate and URL. +TEST_F(Http2PushPromiseIndexTest, CannotRegisterSameEntryTwice) { + TestDelegate delegate(key1_); + EXPECT_TRUE(index_.RegisterUnclaimedPushedStream(url1_, 2, &delegate)); + EXPECT_FALSE(index_.RegisterUnclaimedPushedStream(url1_, 4, &delegate)); + // Unregister first entry so that DCHECK() does not fail in destructor. + EXPECT_TRUE(index_.UnregisterUnclaimedPushedStream(url1_, 2, &delegate)); +} + +// UnregisterUnclaimedPushedStream() returns false +// if there is no identical entry registered. +// Case 1: no streams for the given URL. +TEST_F(Http2PushPromiseIndexTest, CannotUnregisterNonexistingEntry) { + TestDelegate delegate(key1_); + EXPECT_FALSE(index_.UnregisterUnclaimedPushedStream(url1_, 2, &delegate)); +} + +// UnregisterUnclaimedPushedStream() returns false +// if there is no identical entry registered. +// Case 2: there is a stream for the given URL with the same Delegate, +// but the stream ID does not match. +TEST_F(Http2PushPromiseIndexTest, CannotUnregisterEntryIfStreamIdDoesNotMatch) { + TestDelegate delegate(key1_); + EXPECT_TRUE(index_.RegisterUnclaimedPushedStream(url1_, 2, &delegate)); + EXPECT_FALSE(index_.UnregisterUnclaimedPushedStream(url1_, 4, &delegate)); + // Unregister first entry so that DCHECK() does not fail in destructor. + EXPECT_TRUE(index_.UnregisterUnclaimedPushedStream(url1_, 2, &delegate)); +} + +// UnregisterUnclaimedPushedStream() returns false +// if there is no identical entry registered. +// Case 3: there is a stream for the given URL with the same stream ID, +// but the delegate does not match. +TEST_F(Http2PushPromiseIndexTest, CannotUnregisterEntryIfDelegateDoesNotMatch) { + TestDelegate delegate1(key1_); + TestDelegate delegate2(key2_); + EXPECT_TRUE(index_.RegisterUnclaimedPushedStream(url1_, 2, &delegate1)); + EXPECT_FALSE(index_.UnregisterUnclaimedPushedStream(url1_, 2, &delegate2)); + // Unregister first entry so that DCHECK() does not fail in destructor. + EXPECT_TRUE(index_.UnregisterUnclaimedPushedStream(url1_, 2, &delegate1)); +} + +TEST_F(Http2PushPromiseIndexTest, CountStreamsForSession) { + TestDelegate delegate1(key1_); + TestDelegate delegate2(key2_); + + EXPECT_EQ(0u, index_.CountStreamsForSession(&delegate1)); + EXPECT_EQ(0u, index_.CountStreamsForSession(&delegate2)); + + EXPECT_TRUE(index_.RegisterUnclaimedPushedStream(url1_, 2, &delegate1)); + + EXPECT_EQ(1u, index_.CountStreamsForSession(&delegate1)); + EXPECT_EQ(0u, index_.CountStreamsForSession(&delegate2)); + + EXPECT_TRUE(index_.RegisterUnclaimedPushedStream(url2_, 4, &delegate1)); + + EXPECT_EQ(2u, index_.CountStreamsForSession(&delegate1)); + EXPECT_EQ(0u, index_.CountStreamsForSession(&delegate2)); + + EXPECT_TRUE(index_.RegisterUnclaimedPushedStream(url1_, 6, &delegate2)); + + EXPECT_EQ(2u, index_.CountStreamsForSession(&delegate1)); + EXPECT_EQ(1u, index_.CountStreamsForSession(&delegate2)); + + EXPECT_TRUE(index_.UnregisterUnclaimedPushedStream(url1_, 2, &delegate1)); + + EXPECT_EQ(1u, index_.CountStreamsForSession(&delegate1)); + EXPECT_EQ(1u, index_.CountStreamsForSession(&delegate2)); + + EXPECT_TRUE(index_.UnregisterUnclaimedPushedStream(url2_, 4, &delegate1)); + + EXPECT_EQ(0u, index_.CountStreamsForSession(&delegate1)); + EXPECT_EQ(1u, index_.CountStreamsForSession(&delegate2)); + + EXPECT_TRUE(index_.UnregisterUnclaimedPushedStream(url1_, 6, &delegate2)); + + EXPECT_EQ(0u, index_.CountStreamsForSession(&delegate1)); + EXPECT_EQ(0u, index_.CountStreamsForSession(&delegate2)); +} + +TEST_F(Http2PushPromiseIndexTest, FindStream) { + TestDelegate delegate1(key1_); + TestDelegate delegate2(key2_); + + EXPECT_EQ(kNoPushedStreamFound, index_.FindStream(url1_, &delegate1)); + EXPECT_EQ(kNoPushedStreamFound, index_.FindStream(url2_, &delegate1)); + EXPECT_EQ(kNoPushedStreamFound, index_.FindStream(url1_, &delegate2)); + EXPECT_EQ(kNoPushedStreamFound, index_.FindStream(url2_, &delegate2)); + + EXPECT_TRUE(index_.RegisterUnclaimedPushedStream(url1_, 2, &delegate1)); + + EXPECT_EQ(2u, index_.FindStream(url1_, &delegate1)); + EXPECT_EQ(kNoPushedStreamFound, index_.FindStream(url2_, &delegate1)); + EXPECT_EQ(kNoPushedStreamFound, index_.FindStream(url1_, &delegate2)); + EXPECT_EQ(kNoPushedStreamFound, index_.FindStream(url2_, &delegate2)); + + EXPECT_TRUE(index_.RegisterUnclaimedPushedStream(url2_, 4, &delegate1)); + + EXPECT_EQ(2u, index_.FindStream(url1_, &delegate1)); + EXPECT_EQ(4u, index_.FindStream(url2_, &delegate1)); + EXPECT_EQ(kNoPushedStreamFound, index_.FindStream(url1_, &delegate2)); + EXPECT_EQ(kNoPushedStreamFound, index_.FindStream(url2_, &delegate2)); + + EXPECT_TRUE(index_.RegisterUnclaimedPushedStream(url1_, 6, &delegate2)); + + EXPECT_EQ(2u, index_.FindStream(url1_, &delegate1)); + EXPECT_EQ(4u, index_.FindStream(url2_, &delegate1)); + EXPECT_EQ(6u, index_.FindStream(url1_, &delegate2)); + EXPECT_EQ(kNoPushedStreamFound, index_.FindStream(url2_, &delegate2)); + + EXPECT_TRUE(index_.UnregisterUnclaimedPushedStream(url1_, 2, &delegate1)); + + EXPECT_EQ(kNoPushedStreamFound, index_.FindStream(url1_, &delegate1)); + EXPECT_EQ(4u, index_.FindStream(url2_, &delegate1)); + EXPECT_EQ(6u, index_.FindStream(url1_, &delegate2)); + EXPECT_EQ(kNoPushedStreamFound, index_.FindStream(url2_, &delegate2)); + + EXPECT_TRUE(index_.UnregisterUnclaimedPushedStream(url2_, 4, &delegate1)); + + EXPECT_EQ(kNoPushedStreamFound, index_.FindStream(url1_, &delegate1)); + EXPECT_EQ(kNoPushedStreamFound, index_.FindStream(url2_, &delegate1)); + EXPECT_EQ(6u, index_.FindStream(url1_, &delegate2)); + EXPECT_EQ(kNoPushedStreamFound, index_.FindStream(url2_, &delegate2)); + + EXPECT_TRUE(index_.UnregisterUnclaimedPushedStream(url1_, 6, &delegate2)); + + EXPECT_EQ(kNoPushedStreamFound, index_.FindStream(url1_, &delegate1)); + EXPECT_EQ(kNoPushedStreamFound, index_.FindStream(url2_, &delegate1)); + EXPECT_EQ(kNoPushedStreamFound, index_.FindStream(url1_, &delegate2)); + EXPECT_EQ(kNoPushedStreamFound, index_.FindStream(url2_, &delegate2)); +} + // If |index_| is empty, then FindSession() should set its |stream_id| outparam // to kNoPushedStreamFound for any values of inparams. TEST_F(Http2PushPromiseIndexTest, Empty) { @@ -105,33 +238,13 @@ EXPECT_EQ(kNoPushedStreamFound, stream_id); } -// Trying to unregister a stream not in the index should log to DFATAL. -// Case 1: no streams for the given URL. -TEST_F(Http2PushPromiseIndexTest, UnregisterNonexistingEntryCrashes1) { - TestDelegate delegate(key1_); - EXPECT_DFATAL(index_.UnregisterUnclaimedPushedStream(url1_, 2, &delegate), - "Only a previously registered entry can be unregistered."); -} - -// Trying to unregister a stream not in the index should log to DFATAL. -// Case 2: there is a stream for the given URL, but not with the same stream ID. -TEST_F(Http2PushPromiseIndexTest, UnregisterNonexistingEntryCrashes2) { - TestDelegate delegate(key1_); - index_.RegisterUnclaimedPushedStream(url1_, 2, &delegate); - EXPECT_DFATAL(index_.UnregisterUnclaimedPushedStream(url1_, 4, &delegate), - "Only a previously registered entry can be unregistered."); - // Stream must be unregistered so that Http2PushPromiseIndex destructor - // does not crash. - index_.UnregisterUnclaimedPushedStream(url1_, 2, &delegate); -} - // Create two entries, both with a delegate that requires |key| to be equal to // |key1_|. Register the two entries with different URLs. Check that they can // be found by their respective URLs. TEST_F(Http2PushPromiseIndexTest, FindMultipleStreamsWithDifferentUrl) { // Register first entry. TestDelegate delegate1(key1_); - index_.RegisterUnclaimedPushedStream(url1_, 2, &delegate1); + EXPECT_TRUE(index_.RegisterUnclaimedPushedStream(url1_, 2, &delegate1)); // Retrieve first entry by its URL, no entry found for |url2_|. base::WeakPtr<SpdySession> session; @@ -145,7 +258,7 @@ // Register second entry. TestDelegate delegate2(key1_); - index_.RegisterUnclaimedPushedStream(url2_, 4, &delegate2); + EXPECT_TRUE(index_.RegisterUnclaimedPushedStream(url2_, 4, &delegate2)); // Retrieve each entry by their respective URLs. stream_id = kNoPushedStreamFound; @@ -157,7 +270,7 @@ EXPECT_EQ(4u, stream_id); // Unregister first entry. - index_.UnregisterUnclaimedPushedStream(url1_, 2, &delegate1); + EXPECT_TRUE(index_.UnregisterUnclaimedPushedStream(url1_, 2, &delegate1)); // No entry found for |url1_|, retrieve second entry by its URL. stream_id = 2; @@ -169,7 +282,7 @@ EXPECT_EQ(4u, stream_id); // Unregister second entry. - index_.UnregisterUnclaimedPushedStream(url2_, 4, &delegate2); + EXPECT_TRUE(index_.UnregisterUnclaimedPushedStream(url2_, 4, &delegate2)); // No entries found for either URL. stream_id = 2; @@ -187,7 +300,7 @@ TEST_F(Http2PushPromiseIndexTest, MultipleStreamsWithDifferentKeys) { // Register first entry. TestDelegate delegate1(key1_); - index_.RegisterUnclaimedPushedStream(url1_, 2, &delegate1); + EXPECT_TRUE(index_.RegisterUnclaimedPushedStream(url1_, 2, &delegate1)); // Retrieve first entry by its SpdySessionKey, no entry found for |key2_|. base::WeakPtr<SpdySession> session; @@ -201,7 +314,7 @@ // Register second entry. TestDelegate delegate2(key2_); - index_.RegisterUnclaimedPushedStream(url1_, 4, &delegate2); + EXPECT_TRUE(index_.RegisterUnclaimedPushedStream(url1_, 4, &delegate2)); // Retrieve each entry by their respective SpdySessionKeys. stream_id = kNoPushedStreamFound; @@ -213,7 +326,7 @@ EXPECT_EQ(4u, stream_id); // Unregister first entry. - index_.UnregisterUnclaimedPushedStream(url1_, 2, &delegate1); + EXPECT_TRUE(index_.UnregisterUnclaimedPushedStream(url1_, 2, &delegate1)); // No entry found for |key1_|, retrieve second entry by its SpdySessionKey. stream_id = 2; @@ -225,7 +338,7 @@ EXPECT_EQ(4u, stream_id); // Unregister second entry. - index_.UnregisterUnclaimedPushedStream(url1_, 4, &delegate2); + EXPECT_TRUE(index_.UnregisterUnclaimedPushedStream(url1_, 4, &delegate2)); // No entries found for either SpdySessionKeys. stream_id = 2; @@ -242,8 +355,8 @@ // the same SpdySessionKey. TestDelegate delegate1(key1_); TestDelegate delegate2(key1_); - index_.RegisterUnclaimedPushedStream(url1_, 2, &delegate1); - index_.RegisterUnclaimedPushedStream(url1_, 4, &delegate2); + EXPECT_TRUE(index_.RegisterUnclaimedPushedStream(url1_, 2, &delegate1)); + EXPECT_TRUE(index_.RegisterUnclaimedPushedStream(url1_, 4, &delegate2)); // Test that FindSession() returns one of the two entries. FindSession() // makes no guarantee about which entry it returns if there are multiple @@ -254,7 +367,7 @@ EXPECT_NE(kNoPushedStreamFound, stream_id); // Unregister the first entry. - index_.UnregisterUnclaimedPushedStream(url1_, 2, &delegate1); + EXPECT_TRUE(index_.UnregisterUnclaimedPushedStream(url1_, 2, &delegate1)); // Test that the second entry can still be retrieved. stream_id = kNoPushedStreamFound; @@ -262,7 +375,7 @@ EXPECT_EQ(4u, stream_id); // Unregister the second entry. - index_.UnregisterUnclaimedPushedStream(url1_, 4, &delegate2); + EXPECT_TRUE(index_.UnregisterUnclaimedPushedStream(url1_, 4, &delegate2)); // Test that no entry is found. stream_id = 2; @@ -278,14 +391,14 @@ EXPECT_CALL(delegate, ValidatePushedStream(key1_)).WillOnce(Return(true)); EXPECT_CALL(delegate, OnPushedStreamClaimed(url1_, 2)).Times(1); - index_.RegisterUnclaimedPushedStream(url1_, 2, &delegate); + EXPECT_TRUE(index_.RegisterUnclaimedPushedStream(url1_, 2, &delegate)); base::WeakPtr<SpdySession> session; SpdyStreamId stream_id = kNoPushedStreamFound; index_.FindSession(key1_, url1_, &session, &stream_id); EXPECT_EQ(2u, stream_id); - index_.UnregisterUnclaimedPushedStream(url1_, 2, &delegate); + EXPECT_TRUE(index_.UnregisterUnclaimedPushedStream(url1_, 2, &delegate)); }; // Test that Delegate::ValidatePushedStream() is called by FindSession(), and if @@ -295,22 +408,22 @@ EXPECT_CALL(delegate, ValidatePushedStream(key1_)).WillOnce(Return(false)); EXPECT_CALL(delegate, OnPushedStreamClaimed(_, _)).Times(0); - index_.RegisterUnclaimedPushedStream(url1_, 2, &delegate); + EXPECT_TRUE(index_.RegisterUnclaimedPushedStream(url1_, 2, &delegate)); base::WeakPtr<SpdySession> session; SpdyStreamId stream_id = 2; index_.FindSession(key1_, url1_, &session, &stream_id); EXPECT_EQ(kNoPushedStreamFound, stream_id); - index_.UnregisterUnclaimedPushedStream(url1_, 2, &delegate); + EXPECT_TRUE(index_.UnregisterUnclaimedPushedStream(url1_, 2, &delegate)); }; // Test that an entry is equivalent to itself. TEST(Http2PushPromiseIndexCompareByUrlTest, Reflexivity) { // Test with two entries: with and without a pushed stream. - Http2PushPromiseIndexPeer::UnclaimedPushedStream entry1{GURL(), 2, nullptr}; - Http2PushPromiseIndexPeer::UnclaimedPushedStream entry2{ - GURL(), kNoPushedStreamFound, nullptr}; + Http2PushPromiseIndexPeer::UnclaimedPushedStream entry1{GURL(), nullptr, 2}; + Http2PushPromiseIndexPeer::UnclaimedPushedStream entry2{GURL(), nullptr, + kNoPushedStreamFound}; // For "Compare", it is a requirement that comp(A, A) == false, see // http://en.cppreference.com/w/cpp/concept/Compare. This will in fact imply @@ -350,10 +463,10 @@ // Create four entries, two for the middle URL, with distinct stream IDs not // in ascending order. - Http2PushPromiseIndexPeer::UnclaimedPushedStream entry1{url1, 8, nullptr}; - Http2PushPromiseIndexPeer::UnclaimedPushedStream entry2{url2, 4, nullptr}; - Http2PushPromiseIndexPeer::UnclaimedPushedStream entry3{url2, 6, nullptr}; - Http2PushPromiseIndexPeer::UnclaimedPushedStream entry4{url3, 2, nullptr}; + Http2PushPromiseIndexPeer::UnclaimedPushedStream entry1{url1, nullptr, 8}; + Http2PushPromiseIndexPeer::UnclaimedPushedStream entry2{url2, nullptr, 4}; + Http2PushPromiseIndexPeer::UnclaimedPushedStream entry3{url2, nullptr, 6}; + Http2PushPromiseIndexPeer::UnclaimedPushedStream entry4{url3, nullptr, 2}; // Fill up a set. std::set<Http2PushPromiseIndexPeer::UnclaimedPushedStream, @@ -383,7 +496,7 @@ // given URL. In particular, the first entry with |url2| is |entry2|. EXPECT_TRUE( entries.lower_bound(Http2PushPromiseIndexPeer::UnclaimedPushedStream{ - url2, kNoPushedStreamFound, nullptr}) == entries.find(entry2)); + url2, nullptr, kNoPushedStreamFound}) == entries.find(entry2)); }; } // namespace test
diff --git a/net/spdy/chromium/spdy_network_transaction_unittest.cc b/net/spdy/chromium/spdy_network_transaction_unittest.cc index 71c8358..a70b626 100644 --- a/net/spdy/chromium/spdy_network_transaction_unittest.cc +++ b/net/spdy/chromium/spdy_network_transaction_unittest.cc
@@ -522,14 +522,17 @@ return session->active_streams_.size(); } - size_t num_unclaimed_pushed_streams(base::WeakPtr<SpdySession> session) { - return session->unclaimed_pushed_streams_.CountStreamsForSession(); + static size_t num_unclaimed_pushed_streams( + base::WeakPtr<SpdySession> session) { + return session->pool_->push_promise_index()->CountStreamsForSession( + session.get()); } - bool has_unclaimed_pushed_stream_for_url(base::WeakPtr<SpdySession> session, - const GURL& url) { - return session->unclaimed_pushed_streams_.FindStream(url) != - kNoPushedStreamFound; + static bool has_unclaimed_pushed_stream_for_url( + base::WeakPtr<SpdySession> session, + const GURL& url) { + return session->pool_->push_promise_index()->FindStream( + url, session.get()) != kNoPushedStreamFound; } const GURL default_url_;
diff --git a/net/spdy/chromium/spdy_session.cc b/net/spdy/chromium/spdy_session.cc index 8ce8ab3..fac017b 100644 --- a/net/spdy/chromium/spdy_session.cc +++ b/net/spdy/chromium/spdy_session.cc
@@ -746,7 +746,6 @@ transport_security_state_(transport_security_state), stream_hi_water_mark_(kFirstStreamId), last_accepted_push_stream_id_(0), - unclaimed_pushed_streams_(this), push_delegate_(push_delegate), num_pushed_streams_(0u), num_active_pushed_streams_(0u), @@ -857,7 +856,8 @@ } void SpdySession::CancelPush(const GURL& url) { - const SpdyStreamId stream_id = unclaimed_pushed_streams_.FindStream(url); + const SpdyStreamId stream_id = + pool_->push_promise_index()->FindStream(url, this); if (stream_id == kNoPushedStreamFound) return; @@ -1252,7 +1252,7 @@ dict->SetInteger("active_streams", active_streams_.size()); dict->SetInteger("unclaimed_pushed_streams", - unclaimed_pushed_streams_.CountStreamsForSession()); + pool_->push_promise_index()->CountStreamsForSession(this)); dict->SetString( "negotiated_protocol", @@ -1371,7 +1371,6 @@ SpdyEstimateMemoryUsage(spdy_session_key_) + SpdyEstimateMemoryUsage(pooled_aliases_) + SpdyEstimateMemoryUsage(active_streams_) + - SpdyEstimateMemoryUsage(unclaimed_pushed_streams_) + SpdyEstimateMemoryUsage(created_streams_) + SpdyEstimateMemoryUsage(write_queue_) + SpdyEstimateMemoryUsage(in_flight_write_) + @@ -1381,59 +1380,6 @@ SpdyEstimateMemoryUsage(priority_dependency_state_); } -SpdySession::UnclaimedPushedStreamContainer::UnclaimedPushedStreamContainer( - SpdySession* spdy_session) - : spdy_session_(spdy_session) {} -SpdySession::UnclaimedPushedStreamContainer::~UnclaimedPushedStreamContainer() = - default; - -SpdyStreamId SpdySession::UnclaimedPushedStreamContainer::FindStream( - const GURL& url) const { - PushedStreamMap::const_iterator it = streams_.find(url); - if (it == streams_.end()) - return kNoPushedStreamFound; - return it->second; -} - -bool SpdySession::UnclaimedPushedStreamContainer::erase( - const GURL& url, - SpdyStreamId stream_id) { - DCHECK(spdy_session_->pool_); - PushedStreamMap::const_iterator it = streams_.find(url); - if (it == streams_.end() || it->second != stream_id) - return false; - - // Only allow cross-origin push for secure resources. - if (it->first.SchemeIsCryptographic()) { - spdy_session_->pool_->push_promise_index()->UnregisterUnclaimedPushedStream( - it->first, stream_id, spdy_session_); - } - streams_.erase(it); - return true; -} - -bool SpdySession::UnclaimedPushedStreamContainer::insert( - const GURL& url, - SpdyStreamId stream_id) { - DCHECK(spdy_session_->pool_); - auto result = streams_.insert(std::make_pair(url, stream_id)); - if (!result.second) { - // Only one pushed stream is allowed for each URL. - return false; - } - // Only allow cross-origin push for https resources. - if (url.SchemeIsCryptographic()) { - spdy_session_->pool_->push_promise_index()->RegisterUnclaimedPushedStream( - url, stream_id, spdy_session_); - } - return true; -} - -size_t SpdySession::UnclaimedPushedStreamContainer::EstimateMemoryUsage() - const { - return SpdyEstimateMemoryUsage(streams_); -} - // {,Try}CreateStream() can be called with |in_io_loop_| set if a stream is // being created in response to another being closed due to received data. @@ -1681,7 +1627,8 @@ } // Insertion fails if there already is a pushed stream with the same path. - if (!unclaimed_pushed_streams_.insert(gurl, stream_id)) { + if (!pool_->push_promise_index()->RegisterUnclaimedPushedStream( + gurl, stream_id, this)) { EnqueueResetStreamFrame(stream_id, request_priority, ERROR_CODE_REFUSED_STREAM, "Duplicate pushed stream with url: " + gurl.spec()); @@ -1751,8 +1698,8 @@ // push is hardly used. Write tests for this and fix this. (See // http://crbug.com/261712 .) if (owned_stream->type() == SPDY_PUSH_STREAM) { - if (unclaimed_pushed_streams_.erase(owned_stream->url(), - owned_stream->stream_id())) { + if (pool_->push_promise_index()->UnregisterUnclaimedPushedStream( + owned_stream->url(), owned_stream->stream_id(), this)) { bytes_pushed_and_unclaimed_count_ += owned_stream->recv_bytes(); } bytes_pushed_count_ += owned_stream->recv_bytes(); @@ -2428,11 +2375,14 @@ } SpdyStream* SpdySession::GetActivePushStream(const GURL& url) { - const SpdyStreamId stream_id = unclaimed_pushed_streams_.FindStream(url); + const SpdyStreamId stream_id = + pool_->push_promise_index()->FindStream(url, this); if (stream_id == kNoPushedStreamFound) return nullptr; - const bool result = unclaimed_pushed_streams_.erase(url, stream_id); + const bool result = + pool_->push_promise_index()->UnregisterUnclaimedPushedStream( + url, stream_id, this); DCHECK(result); ActiveStreamMap::iterator active_it = active_streams_.find(stream_id); @@ -2500,7 +2450,7 @@ DcheckGoingAway(); DCHECK_EQ(availability_state_, STATE_DRAINING); DCHECK(active_streams_.empty()); - DCHECK_EQ(0u, unclaimed_pushed_streams_.CountStreamsForSession()); + DCHECK_EQ(0u, pool_->push_promise_index()->CountStreamsForSession(this)); } void SpdySession::DoDrainSession(Error err, const SpdyString& description) { @@ -2600,18 +2550,17 @@ if (active_it == active_streams_.end()) return; - // Grab URL for faster lookup in unclaimed_pushed_streams_. - const GURL& url = active_it->second->url(); // Make sure to cancel the correct stream. It is possible that the pushed // stream |stream_id| is already claimed, and another stream has been pushed // for the same URL. - if (unclaimed_pushed_streams_.FindStream(url) != stream_id) { + const GURL& url = active_it->second->url(); + if (pool_->push_promise_index()->FindStream(url, this) != stream_id) { return; } LogAbandonedActiveStream(active_it, ERR_TIMED_OUT); // CloseActiveStreamIterator() will remove the stream from - // |unclaimed_pushed_streams_|. + // |pool_->push_promise_index()|. ResetStreamIterator(active_it, ERROR_CODE_REFUSED_STREAM, "Stream not claimed."); } @@ -2725,8 +2674,8 @@ NetLogEventType::HTTP2_SESSION_RECV_GOAWAY, base::Bind(&NetLogSpdyRecvGoAwayCallback, last_accepted_stream_id, active_streams_.size(), - unclaimed_pushed_streams_.CountStreamsForSession(), error_code, - debug_data)); + pool_->push_promise_index()->CountStreamsForSession(this), + error_code, debug_data)); MakeUnavailable(); if (error_code == ERROR_CODE_HTTP_1_1_REQUIRED) { // TODO(bnc): Record histogram with number of open streams capped at 50.
diff --git a/net/spdy/chromium/spdy_session.h b/net/spdy/chromium/spdy_session.h index 61b4223..101ba98 100644 --- a/net/spdy/chromium/spdy_session.h +++ b/net/spdy/chromium/spdy_session.h
@@ -13,7 +13,6 @@ #include <set> #include <vector> -#include "base/compiler_specific.h" #include "base/containers/circular_deque.h" #include "base/gtest_prod_util.h" #include "base/macros.h" @@ -536,40 +535,6 @@ WRITE_STATE_DO_WRITE_COMPLETE, }; - // Container class for unclaimed pushed streams on a SpdySession. Guarantees - // that |spdy_session_.pool_| gets notified every time a stream is pushed or - // an unclaimed pushed stream is claimed. - class NET_EXPORT_PRIVATE UnclaimedPushedStreamContainer { - public: - UnclaimedPushedStreamContainer() = delete; - explicit UnclaimedPushedStreamContainer(SpdySession* spdy_session); - ~UnclaimedPushedStreamContainer(); - - size_t CountStreamsForSession() const { return streams_.size(); } - SpdyStreamId FindStream(const GURL& url) const; - - // Return true if there was an element with |url|, which was then erased. - bool erase(const GURL& url, SpdyStreamId stream_id) WARN_UNUSED_RESULT; - - // Return true if there was not already an entry with |url|, - // in which case the insertion was successful. - bool insert(const GURL& url, SpdyStreamId stream_id) WARN_UNUSED_RESULT; - - size_t EstimateMemoryUsage() const; - - private: - using PushedStreamMap = std::map<GURL, SpdyStreamId>; - - SpdySession* spdy_session_; - - // (Bijective) map from the URL to the ID of the streams that have - // already started to be pushed by the server, but do not have - // consumers yet. Contains a subset of |active_streams_|. - PushedStreamMap streams_; - - DISALLOW_COPY_AND_ASSIGN(UnclaimedPushedStreamContainer); - }; - // Called by SpdyStreamRequest to start a request to create a // stream. If OK is returned, then |stream| will be filled in with a // valid stream. If ERR_IO_PENDING is returned, then @@ -936,8 +901,6 @@ // them? ActiveStreamMap active_streams_; - UnclaimedPushedStreamContainer unclaimed_pushed_streams_; - // Not owned. |push_delegate_| outlives the session and handles server pushes // received by session. ServerPushDelegate* push_delegate_;
diff --git a/net/spdy/chromium/spdy_session_pool.cc b/net/spdy/chromium/spdy_session_pool.cc index b9ed8c7..e9536fa 100644 --- a/net/spdy/chromium/spdy_session_pool.cc +++ b/net/spdy/chromium/spdy_session_pool.cc
@@ -445,7 +445,8 @@ num_active_sessions++; } total_size += SpdyEstimateMemoryUsage(ObtainHpackHuffmanTable()) + - SpdyEstimateMemoryUsage(ObtainHpackStaticTable()); + SpdyEstimateMemoryUsage(ObtainHpackStaticTable()) + + SpdyEstimateMemoryUsage(push_promise_index_); base::trace_event::MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(SpdyStringPrintf( "%s/spdy_session_pool", parent_dump_absolute_name.c_str()));
diff --git a/net/spdy/chromium/spdy_session_unittest.cc b/net/spdy/chromium/spdy_session_unittest.cc index 1738b134..3e5da06 100644 --- a/net/spdy/chromium/spdy_session_unittest.cc +++ b/net/spdy/chromium/spdy_session_unittest.cc
@@ -321,12 +321,13 @@ size_t num_created_streams() { return session_->created_streams_.size(); } size_t num_unclaimed_pushed_streams() { - return session_->unclaimed_pushed_streams_.CountStreamsForSession(); + return spdy_session_pool_->push_promise_index()->CountStreamsForSession( + session_.get()); } bool has_unclaimed_pushed_stream_for_url(const GURL& url) { - return session_->unclaimed_pushed_streams_.FindStream(url) != - kNoPushedStreamFound; + return spdy_session_pool_->push_promise_index()->FindStream( + url, session_.get()) != kNoPushedStreamFound; } // Original socket limits. Some tests set these. Safest to always restore
diff --git a/net/tools/quic/quic_server_test.cc b/net/tools/quic/quic_server_test.cc index ed6068e..8f10b5f 100644 --- a/net/tools/quic/quic_server_test.cc +++ b/net/tools/quic/quic_server_test.cc
@@ -6,6 +6,7 @@ #include "net/quic/core/crypto/quic_random.h" #include "net/quic/core/quic_utils.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_flags.h" #include "net/quic/platform/api/quic_logging.h" #include "net/quic/platform/api/quic_socket_address.h" @@ -130,9 +131,9 @@ ASSERT_LT(0, fd); char buf[1024]; - memset(buf, 0, arraysize(buf)); + memset(buf, 0, QUIC_ARRAYSIZE(buf)); sockaddr_storage storage = server_address_.generic_address(); - int rc = sendto(fd, buf, arraysize(buf), 0, + int rc = sendto(fd, buf, QUIC_ARRAYSIZE(buf), 0, reinterpret_cast<sockaddr*>(&storage), sizeof(storage)); if (rc < 0) { QUIC_DLOG(INFO) << errno << " " << strerror(errno); @@ -196,7 +197,7 @@ }; // clang-format on QuicReceivedPacket encrypted_valid_packet( - reinterpret_cast<char*>(valid_packet), arraysize(valid_packet), + reinterpret_cast<char*>(valid_packet), QUIC_ARRAYSIZE(valid_packet), QuicTime::Zero(), false); EXPECT_CALL(dispatcher_, ProcessPacket(_, _, _)).Times(1);
diff --git a/net/tools/quic/quic_simple_server_stream_test.cc b/net/tools/quic/quic_simple_server_stream_test.cc index fb798d1..56810cd1 100644 --- a/net/tools/quic/quic_simple_server_stream_test.cc +++ b/net/tools/quic/quic_simple_server_stream_test.cc
@@ -10,6 +10,7 @@ #include "net/quic/core/quic_utils.h" #include "net/quic/core/spdy_utils.h" +#include "net/quic/platform/api/quic_arraysize.h" #include "net/quic/platform/api/quic_ptr_util.h" #include "net/quic/platform/api/quic_socket_address.h" #include "net/quic/platform/api/quic_test.h" @@ -603,7 +604,7 @@ 0x54, 0x54, 0x50, 0x2f, // TTP/ 0x31, 0x2e, 0x31, // 1.1 }; - QuicStringPiece data(arr, arraysize(arr)); + QuicStringPiece data(arr, QUIC_ARRAYSIZE(arr)); QuicStreamFrame frame(stream_->id(), true, 0, data); // Verify that we don't crash when we get a invalid headers in stream frame. stream_->OnStreamFrame(frame);
diff --git a/printing/common/pdf_metafile_utils.cc b/printing/common/pdf_metafile_utils.cc index 3a30ad00..0f77f7b 100644 --- a/printing/common/pdf_metafile_utils.cc +++ b/printing/common/pdf_metafile_utils.cc
@@ -39,8 +39,7 @@ metadata.fCreator = creator.empty() ? SkString("Chromium") : SkString(creator.c_str(), creator.size()); - return SkDocument::MakePDF(stream, SK_ScalarDefaultRasterDPI, metadata, - nullptr, false); + return SkDocument::MakePDF(stream, metadata); } } // namespace printing
diff --git a/printing/pdf_metafile_skia.cc b/printing/pdf_metafile_skia.cc index 96ee23a..2a73cfb 100644 --- a/printing/pdf_metafile_skia.cc +++ b/printing/pdf_metafile_skia.cc
@@ -10,7 +10,6 @@ #include <vector> #include "base/files/file.h" -#include "base/memory/ptr_util.h" #include "base/time/time.h" #include "cc/paint/paint_record.h" #include "cc/paint/paint_recorder.h" @@ -39,15 +38,14 @@ // Calling duplicate() keeps original asset state unchanged. std::unique_ptr<SkStreamAsset> assetCopy(asset->duplicate()); size_t length = assetCopy->getLength(); - if (length > size) - return false; - return (length == assetCopy->read(buffer, length)); + return length <= size && length == assetCopy->read(buffer, length); } } // namespace namespace printing { +// TODO(thestig): struct members should not have trailing underscore. struct Page { Page(SkSize s, sk_sp<cc::PaintRecord> c) : size_(s), content_(std::move(c)) {} Page(Page&& that) : size_(that.size_), content_(std::move(that.content_)) {} @@ -80,6 +78,11 @@ #endif }; +PdfMetafileSkia::PdfMetafileSkia(SkiaDocumentType type) + : data_(std::make_unique<PdfMetafileSkiaData>()) { + data_->type_ = type; +} + PdfMetafileSkia::~PdfMetafileSkia() = default; bool PdfMetafileSkia::Init() { @@ -91,7 +94,7 @@ // PdfMetafileSkia does. bool PdfMetafileSkia::InitFromData(const void* src_buffer, size_t src_buffer_size) { - data_->pdf_data_ = base::MakeUnique<SkMemoryStream>( + data_->pdf_data_ = std::make_unique<SkMemoryStream>( src_buffer, src_buffer_size, true /* copy_data? */); return true; } @@ -274,17 +277,11 @@ return true; } -PdfMetafileSkia::PdfMetafileSkia(SkiaDocumentType type) - : data_(new PdfMetafileSkiaData) { - data_->type_ = type; -} - std::unique_ptr<PdfMetafileSkia> PdfMetafileSkia::GetMetafileForCurrentPage( SkiaDocumentType type) { // If we only ever need the metafile for the last page, should we // only keep a handle on one PaintRecord? - std::unique_ptr<PdfMetafileSkia> metafile(new PdfMetafileSkia(type)); - + auto metafile = std::make_unique<PdfMetafileSkia>(type); if (data_->pages_.size() == 0) return metafile;
diff --git a/printing/pdf_metafile_skia.h b/printing/pdf_metafile_skia.h index e5898c8..a853973 100644 --- a/printing/pdf_metafile_skia.h +++ b/printing/pdf_metafile_skia.h
@@ -24,7 +24,8 @@ struct PdfMetafileSkiaData; -// This class uses Skia graphics library to generate a PDF document. +// This class uses Skia graphics library to generate a PDF or MSKP document. +// TODO(thestig): Rename to MetafileSkia. class PRINTING_EXPORT PdfMetafileSkia : public Metafile { public: explicit PdfMetafileSkia(SkiaDocumentType type);
diff --git a/services/device/generic_sensor/orientation_euler_angles_fusion_algorithm_using_quaternion.cc b/services/device/generic_sensor/orientation_euler_angles_fusion_algorithm_using_quaternion.cc index 99c7efb..5bb3c1e 100644 --- a/services/device/generic_sensor/orientation_euler_angles_fusion_algorithm_using_quaternion.cc +++ b/services/device/generic_sensor/orientation_euler_angles_fusion_algorithm_using_quaternion.cc
@@ -62,12 +62,12 @@ rotation_matrix, alpha_in_degrees, beta_in_degrees, gamma_in_degrees); } -constexpr mojom::SensorType GetFusedType(bool absolute) { +constexpr mojom::SensorType GetEulerAngleFusedType(bool absolute) { return absolute ? mojom::SensorType::ABSOLUTE_ORIENTATION_EULER_ANGLES : mojom::SensorType::RELATIVE_ORIENTATION_EULER_ANGLES; } -constexpr mojom::SensorType GetSourceType(bool absolute) { +constexpr mojom::SensorType GetQuaternionSourceType(bool absolute) { return absolute ? mojom::SensorType::ABSOLUTE_ORIENTATION_QUATERNION : mojom::SensorType::RELATIVE_ORIENTATION_QUATERNION; } @@ -76,8 +76,8 @@ OrientationEulerAnglesFusionAlgorithmUsingQuaternion:: OrientationEulerAnglesFusionAlgorithmUsingQuaternion(bool absolute) - : PlatformSensorFusionAlgorithm(GetFusedType(absolute), - {GetSourceType(absolute)}) {} + : PlatformSensorFusionAlgorithm(GetEulerAngleFusedType(absolute), + {GetQuaternionSourceType(absolute)}) {} OrientationEulerAnglesFusionAlgorithmUsingQuaternion:: ~OrientationEulerAnglesFusionAlgorithmUsingQuaternion() = default;
diff --git a/services/device/generic_sensor/orientation_quaternion_fusion_algorithm_using_euler_angles.cc b/services/device/generic_sensor/orientation_quaternion_fusion_algorithm_using_euler_angles.cc index 5364de6..f60837a 100644 --- a/services/device/generic_sensor/orientation_quaternion_fusion_algorithm_using_euler_angles.cc +++ b/services/device/generic_sensor/orientation_quaternion_fusion_algorithm_using_euler_angles.cc
@@ -39,12 +39,12 @@ *w = cx * cy * cz - sx * sy * sz; } -constexpr mojom::SensorType GetFusedType(bool absolute) { +constexpr mojom::SensorType GetQuaternionFusedType(bool absolute) { return absolute ? mojom::SensorType::ABSOLUTE_ORIENTATION_QUATERNION : mojom::SensorType::RELATIVE_ORIENTATION_QUATERNION; } -constexpr mojom::SensorType GetSourceType(bool absolute) { +constexpr mojom::SensorType GetEulerAngleSourceType(bool absolute) { return absolute ? mojom::SensorType::ABSOLUTE_ORIENTATION_EULER_ANGLES : mojom::SensorType::RELATIVE_ORIENTATION_EULER_ANGLES; } @@ -53,8 +53,8 @@ OrientationQuaternionFusionAlgorithmUsingEulerAngles:: OrientationQuaternionFusionAlgorithmUsingEulerAngles(bool absolute) - : PlatformSensorFusionAlgorithm(GetFusedType(absolute), - {GetSourceType(absolute)}) {} + : PlatformSensorFusionAlgorithm(GetQuaternionFusedType(absolute), + {GetEulerAngleSourceType(absolute)}) {} OrientationQuaternionFusionAlgorithmUsingEulerAngles:: ~OrientationQuaternionFusionAlgorithmUsingEulerAngles() = default;
diff --git a/services/device/generic_sensor/platform_sensor_and_provider_unittest_linux.cc b/services/device/generic_sensor/platform_sensor_and_provider_unittest_linux.cc index 39aeeaf..845b032 100644 --- a/services/device/generic_sensor/platform_sensor_and_provider_unittest_linux.cc +++ b/services/device/generic_sensor/platform_sensor_and_provider_unittest_linux.cc
@@ -109,10 +109,10 @@ // Mock for PlatformSensor's client interface that is used to deliver // error and data changes notifications. -class MockPlatformSensorClient : public PlatformSensor::Client { +class LinuxMockPlatformSensorClient : public PlatformSensor::Client { public: - MockPlatformSensorClient() = default; - explicit MockPlatformSensorClient(scoped_refptr<PlatformSensor> sensor) + LinuxMockPlatformSensorClient() = default; + explicit LinuxMockPlatformSensorClient(scoped_refptr<PlatformSensor> sensor) : sensor_(sensor) { if (sensor_) sensor_->AddClient(this); @@ -120,7 +120,7 @@ ON_CALL(*this, IsSuspended()).WillByDefault(Return(false)); } - ~MockPlatformSensorClient() override { + ~LinuxMockPlatformSensorClient() override { if (sensor_) sensor_->RemoveClient(this); } @@ -133,7 +133,7 @@ private: scoped_refptr<PlatformSensor> sensor_; - DISALLOW_COPY_AND_ASSIGN(MockPlatformSensorClient); + DISALLOW_COPY_AND_ASSIGN(LinuxMockPlatformSensorClient); }; class PlatformSensorAndProviderLinuxTest : public ::testing::Test { @@ -253,7 +253,7 @@ } // Waits before OnSensorReadingChanged is called. - void WaitOnSensorReadingChangedEvent(MockPlatformSensorClient* client, + void WaitOnSensorReadingChangedEvent(LinuxMockPlatformSensorClient* client, mojom::SensorType type) { run_loop_ = std::make_unique<base::RunLoop>(); EXPECT_CALL(*client, OnSensorReadingChanged(type)) @@ -264,7 +264,7 @@ } // Waits before OnSensorError is called. - void WaitOnSensorErrorEvent(MockPlatformSensorClient* client) { + void WaitOnSensorErrorEvent(LinuxMockPlatformSensorClient* client) { run_loop_ = std::make_unique<base::RunLoop>(); EXPECT_CALL(*client, OnSensorError()).WillOnce(Invoke([this]() { run_loop_->Quit(); @@ -337,7 +337,8 @@ auto sensor = CreateSensor(SensorType::AMBIENT_LIGHT); EXPECT_TRUE(sensor); - auto client = std::make_unique<NiceMock<MockPlatformSensorClient>>(sensor); + auto client = + std::make_unique<NiceMock<LinuxMockPlatformSensorClient>>(sensor); PlatformSensorConfiguration configuration(10); EXPECT_FALSE(sensor->StartListening(client.get(), configuration)); } @@ -354,7 +355,8 @@ auto sensor = CreateSensor(SensorType::AMBIENT_LIGHT); EXPECT_TRUE(sensor); - auto client = std::make_unique<NiceMock<MockPlatformSensorClient>>(sensor); + auto client = + std::make_unique<NiceMock<LinuxMockPlatformSensorClient>>(sensor); PlatformSensorConfiguration configuration(5); EXPECT_TRUE(sensor->StartListening(client.get(), configuration)); WaitOnSensorReadingChangedEvent(client.get(), sensor->GetType()); @@ -372,7 +374,8 @@ auto sensor = CreateSensor(SensorType::AMBIENT_LIGHT); EXPECT_TRUE(sensor); - auto client = std::make_unique<NiceMock<MockPlatformSensorClient>>(sensor); + auto client = + std::make_unique<NiceMock<LinuxMockPlatformSensorClient>>(sensor); PlatformSensorConfiguration configuration(5); EXPECT_TRUE(sensor->StartListening(client.get(), configuration)); GenerateDeviceRemovedEvent(sensors_dir_.GetPath()); @@ -496,7 +499,8 @@ EXPECT_TRUE(sensor); EXPECT_EQ(sensor->GetReportingMode(), mojom::ReportingMode::ON_CHANGE); - auto client = std::make_unique<NiceMock<MockPlatformSensorClient>>(sensor); + auto client = + std::make_unique<NiceMock<LinuxMockPlatformSensorClient>>(sensor); PlatformSensorConfiguration configuration( sensor->GetMaximumSupportedFrequency()); EXPECT_TRUE(sensor->StartListening(client.get(), configuration)); @@ -522,7 +526,7 @@ // created to make the sensor device manager identify this sensor with // ON_CHANGE reporting mode. This can be done by sending |kZero| as a // frequency value, which means a file is not created. - // This will allow the MockPlatformSensorClient to + // This will allow the LinuxMockPlatformSensorClient to // receive a notification and test if reading values are right. Otherwise // the test will not know when data is ready. double sensor_values[3] = {4.5, -2.45, -3.29}; @@ -538,7 +542,8 @@ // The reporting mode is ON_CHANGE only for this test. EXPECT_EQ(sensor->GetReportingMode(), mojom::ReportingMode::ON_CHANGE); - auto client = std::make_unique<NiceMock<MockPlatformSensorClient>>(sensor); + auto client = + std::make_unique<NiceMock<LinuxMockPlatformSensorClient>>(sensor); PlatformSensorConfiguration configuration(10); EXPECT_TRUE(sensor->StartListening(client.get(), configuration)); WaitOnSensorReadingChangedEvent(client.get(), sensor->GetType()); @@ -586,7 +591,8 @@ EXPECT_TRUE(sensor); EXPECT_EQ(sensor->GetReportingMode(), mojom::ReportingMode::CONTINUOUS); - auto client = std::make_unique<NiceMock<MockPlatformSensorClient>>(sensor); + auto client = + std::make_unique<NiceMock<LinuxMockPlatformSensorClient>>(sensor); PlatformSensorConfiguration configuration(10); EXPECT_TRUE(sensor->StartListening(client.get(), configuration)); @@ -617,7 +623,7 @@ // created to make the sensor device manager identify this sensor with // ON_CHANGE reporting mode. This can be done by sending |kZero| as a // frequency value, which means a file is not created. - // This will allow the MockPlatformSensorClient to + // This will allow the LinuxMockPlatformSensorClient to // receive a notification and test if reading values are right. Otherwise // the test will not know when data is ready. double sensor_values[3] = {2.2, -3.8, -108.7}; @@ -632,7 +638,8 @@ // The reporting mode is ON_CHANGE only for this test. EXPECT_EQ(sensor->GetReportingMode(), mojom::ReportingMode::ON_CHANGE); - auto client = std::make_unique<NiceMock<MockPlatformSensorClient>>(sensor); + auto client = + std::make_unique<NiceMock<LinuxMockPlatformSensorClient>>(sensor); PlatformSensorConfiguration configuration(10); EXPECT_TRUE(sensor->StartListening(client.get(), configuration)); WaitOnSensorReadingChangedEvent(client.get(), sensor->GetType()); @@ -669,7 +676,7 @@ // created to make the sensor device manager identify this sensor with // ON_CHANGE reporting mode. This can be done by sending |kZero| as a // frequency value, which means a file is not created. - // This will allow the MockPlatformSensorClient to + // This will allow the LinuxMockPlatformSensorClient to // receive a notification and test if reading values are right. Otherwise // the test will not know when data is ready. double sensor_values[3] = {2.2, -3.8, -108.7}; @@ -685,7 +692,8 @@ // The reporting mode is ON_CHANGE only for this test. EXPECT_EQ(sensor->GetReportingMode(), mojom::ReportingMode::ON_CHANGE); - auto client = std::make_unique<NiceMock<MockPlatformSensorClient>>(sensor); + auto client = + std::make_unique<NiceMock<LinuxMockPlatformSensorClient>>(sensor); PlatformSensorConfiguration configuration(10); EXPECT_TRUE(sensor->StartListening(client.get(), configuration)); WaitOnSensorReadingChangedEvent(client.get(), sensor->GetType()); @@ -727,7 +735,8 @@ EXPECT_TRUE(sensor); EXPECT_EQ(mojom::ReportingMode::CONTINUOUS, sensor->GetReportingMode()); - auto client = std::make_unique<NiceMock<MockPlatformSensorClient>>(sensor); + auto client = + std::make_unique<NiceMock<LinuxMockPlatformSensorClient>>(sensor); PlatformSensorConfiguration configuration( sensor->GetMaximumSupportedFrequency());
diff --git a/services/device/hid/BUILD.gn b/services/device/hid/BUILD.gn index e04d2d0..3ed04a2 100644 --- a/services/device/hid/BUILD.gn +++ b/services/device/hid/BUILD.gn
@@ -37,7 +37,6 @@ "//base", "//components/device_event_log", "//device/base", - "//net", "//services/device/public/cpp/hid", "//services/device/public/interfaces", ] @@ -76,6 +75,7 @@ public_deps = [ ":hid", + "//base", ] }
diff --git a/services/device/hid/DEPS b/services/device/hid/DEPS index 465c804..8ddbc98 100644 --- a/services/device/hid/DEPS +++ b/services/device/hid/DEPS
@@ -1,5 +1,4 @@ include_rules = [ "+chromeos/dbus", "+components/device_event_log", - "+net/base", ]
diff --git a/services/device/hid/hid_connection.cc b/services/device/hid/hid_connection.cc index 48e04da..a78d74f 100644 --- a/services/device/hid/hid_connection.cc +++ b/services/device/hid/hid_connection.cc
@@ -6,6 +6,7 @@ #include <algorithm> +#include "base/memory/ref_counted_memory.h" #include "base/stl_util.h" #include "components/device_event_log/device_event_log.h" #include "services/device/public/cpp/hid/hid_usage_and_page.h" @@ -92,7 +93,7 @@ PlatformRead(std::move(callback)); } -void HidConnection::Write(scoped_refptr<net::IOBuffer> buffer, +void HidConnection::Write(scoped_refptr<base::RefCountedBytes> buffer, size_t size, WriteCallback callback) { DCHECK(thread_checker_.CalledOnValidThread()); @@ -144,9 +145,10 @@ PlatformGetFeatureReport(report_id, std::move(callback)); } -void HidConnection::SendFeatureReport(scoped_refptr<net::IOBuffer> buffer, - size_t size, - WriteCallback callback) { +void HidConnection::SendFeatureReport( + scoped_refptr<base::RefCountedBytes> buffer, + size_t size, + WriteCallback callback) { DCHECK(thread_checker_.CalledOnValidThread()); if (device_info_->max_feature_report_size() == 0) { HID_LOG(USER) << "This device does not support feature reports.";
diff --git a/services/device/hid/hid_connection.h b/services/device/hid/hid_connection.h index 055c8493..4c9a1fd 100644 --- a/services/device/hid/hid_connection.h +++ b/services/device/hid/hid_connection.h
@@ -8,13 +8,16 @@ #include <stddef.h> #include <stdint.h> -#include "base/callback.h" +#include "base/callback_forward.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/threading/thread_checker.h" -#include "net/base/io_buffer.h" #include "services/device/hid/hid_device_info.h" +namespace base { +class RefCountedBytes; +} + namespace device { class HidConnection : public base::RefCountedThreadSafe<HidConnection> { @@ -24,8 +27,10 @@ kAnyReportId = 0xFF, }; - using ReadCallback = base::OnceCallback< - void(bool success, scoped_refptr<net::IOBuffer> buffer, size_t size)>; + using ReadCallback = + base::OnceCallback<void(bool success, + scoped_refptr<base::RefCountedBytes> buffer, + size_t size)>; using WriteCallback = base::OnceCallback<void(bool success)>; @@ -43,7 +48,7 @@ // The report ID (or 0 if report IDs are not supported by the device) is // always expected in the first byte of the buffer. - void Write(scoped_refptr<net::IOBuffer> buffer, + void Write(scoped_refptr<base::RefCountedBytes> buffer, size_t size, WriteCallback callback); @@ -54,7 +59,7 @@ // The report ID (or 0 if report IDs are not supported by the device) is // always expected in the first byte of the buffer. - void SendFeatureReport(scoped_refptr<net::IOBuffer> buffer, + void SendFeatureReport(scoped_refptr<base::RefCountedBytes> buffer, size_t size, WriteCallback callback); @@ -66,14 +71,15 @@ virtual void PlatformClose() = 0; virtual void PlatformRead(ReadCallback callback) = 0; - virtual void PlatformWrite(scoped_refptr<net::IOBuffer> buffer, + virtual void PlatformWrite(scoped_refptr<base::RefCountedBytes> buffer, size_t size, WriteCallback callback) = 0; virtual void PlatformGetFeatureReport(uint8_t report_id, ReadCallback callback) = 0; - virtual void PlatformSendFeatureReport(scoped_refptr<net::IOBuffer> buffer, - size_t size, - WriteCallback callback) = 0; + virtual void PlatformSendFeatureReport( + scoped_refptr<base::RefCountedBytes> buffer, + size_t size, + WriteCallback callback) = 0; bool IsReportIdProtected(uint8_t report_id); @@ -91,7 +97,7 @@ PendingHidReport(const PendingHidReport& other); ~PendingHidReport(); - scoped_refptr<net::IOBuffer> buffer; + scoped_refptr<base::RefCountedBytes> buffer; size_t size; };
diff --git a/services/device/hid/hid_connection_impl.cc b/services/device/hid/hid_connection_impl.cc index 2c2aacf..86083e4a 100644 --- a/services/device/hid/hid_connection_impl.cc +++ b/services/device/hid/hid_connection_impl.cc
@@ -6,6 +6,7 @@ #include "base/bind.h" #include "base/memory/ptr_util.h" +#include "base/memory/ref_counted_memory.h" namespace device { @@ -30,7 +31,7 @@ void HidConnectionImpl::OnRead(ReadCallback callback, bool success, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t size) { if (!success) { std::move(callback).Run(false, 0, base::nullopt); @@ -38,7 +39,7 @@ } DCHECK(buffer); - std::vector<uint8_t> data(buffer->data() + 1, buffer->data() + size); + std::vector<uint8_t> data(buffer->front() + 1, buffer->front() + size); std::move(callback).Run(true, buffer->data()[0], data); } @@ -48,11 +49,10 @@ DCHECK(hid_connection_); auto io_buffer = - base::MakeRefCounted<net::IOBufferWithSize>(buffer.size() + 1); + base::MakeRefCounted<base::RefCountedBytes>(buffer.size() + 1); io_buffer->data()[0] = report_id; - const char* data = reinterpret_cast<const char*>(buffer.data()); - memcpy(io_buffer->data() + 1, data, buffer.size()); + memcpy(io_buffer->front() + 1, buffer.data(), buffer.size()); hid_connection_->Write( io_buffer, io_buffer->size(), @@ -73,17 +73,18 @@ weak_factory_.GetWeakPtr(), std::move(callback))); } -void HidConnectionImpl::OnGetFeatureReport(GetFeatureReportCallback callback, - bool success, - scoped_refptr<net::IOBuffer> buffer, - size_t size) { +void HidConnectionImpl::OnGetFeatureReport( + GetFeatureReportCallback callback, + bool success, + scoped_refptr<base::RefCountedBytes> buffer, + size_t size) { if (!success) { std::move(callback).Run(false, base::nullopt); return; } DCHECK(buffer); - std::vector<uint8_t> data(buffer->data(), buffer->data() + size); + std::vector<uint8_t> data(buffer->front(), buffer->front() + size); std::move(callback).Run(true, data); } @@ -93,11 +94,10 @@ DCHECK(hid_connection_); auto io_buffer = - base::MakeRefCounted<net::IOBufferWithSize>(buffer.size() + 1); + base::MakeRefCounted<base::RefCountedBytes>(buffer.size() + 1); io_buffer->data()[0] = report_id; - const char* data = reinterpret_cast<const char*>(buffer.data()); - memcpy(io_buffer->data() + 1, data, buffer.size()); + memcpy(io_buffer->front() + 1, buffer.data(), buffer.size()); hid_connection_->SendFeatureReport( io_buffer, io_buffer->size(),
diff --git a/services/device/hid/hid_connection_impl.h b/services/device/hid/hid_connection_impl.h index 2e7c752..e037fc9d 100644 --- a/services/device/hid/hid_connection_impl.h +++ b/services/device/hid/hid_connection_impl.h
@@ -6,7 +6,6 @@ #define DEVICE_HID_HID_CONNECTION_IMPL_H_ #include "base/memory/ref_counted.h" -#include "net/base/io_buffer.h" #include "services/device/hid/hid_connection.h" #include "services/device/public/interfaces/hid.mojom.h" @@ -34,12 +33,12 @@ private: void OnRead(ReadCallback callback, bool success, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t size); void OnWrite(WriteCallback callback, bool success); void OnGetFeatureReport(GetFeatureReportCallback callback, bool success, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t size); void OnSendFeatureReport(SendFeatureReportCallback callback, bool success);
diff --git a/services/device/hid/hid_connection_linux.cc b/services/device/hid/hid_connection_linux.cc index 38f2bb5e..cc369e9 100644 --- a/services/device/hid/hid_connection_linux.cc +++ b/services/device/hid/hid_connection_linux.cc
@@ -16,6 +16,7 @@ #include "base/files/file_descriptor_watcher_posix.h" #include "base/macros.h" #include "base/memory/ptr_util.h" +#include "base/memory/ref_counted_memory.h" #include "base/posix/eintr_wrapper.h" #include "base/threading/thread_restrictions.h" #include "base/threading/thread_task_runner_handle.h" @@ -59,11 +60,11 @@ base::Unretained(this))); } - void Write(scoped_refptr<net::IOBuffer> buffer, + void Write(scoped_refptr<base::RefCountedBytes> buffer, size_t size, WriteCallback callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - ssize_t result = HANDLE_EINTR(write(fd_.get(), buffer->data(), size)); + ssize_t result = HANDLE_EINTR(write(fd_.get(), buffer->front(), size)); if (result < 0) { HID_PLOG(EVENT) << "Write failed"; origin_task_runner_->PostTask(FROM_HERE, @@ -77,11 +78,11 @@ } void GetFeatureReport(uint8_t report_id, - scoped_refptr<net::IOBufferWithSize> buffer, + scoped_refptr<base::RefCountedBytes> buffer, ReadCallback callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); int result = HANDLE_EINTR( - ioctl(fd_.get(), HIDIOCGFEATURE(buffer->size()), buffer->data())); + ioctl(fd_.get(), HIDIOCGFEATURE(buffer->size()), buffer->front())); if (result < 0) { HID_PLOG(EVENT) << "Failed to get feature report"; origin_task_runner_->PostTask( @@ -92,8 +93,9 @@ FROM_HERE, base::BindOnce(std::move(callback), false, nullptr, 0)); } else if (report_id == 0) { // Linux adds a 0 to the beginning of the data received from the device. - scoped_refptr<net::IOBuffer> copied_buffer(new net::IOBuffer(result - 1)); - memcpy(copied_buffer->data(), buffer->data() + 1, result - 1); + auto copied_buffer = + base::MakeRefCounted<base::RefCountedBytes>(result - 1); + memcpy(copied_buffer->front(), buffer->front() + 1, result - 1); origin_task_runner_->PostTask( FROM_HERE, base::BindOnce(std::move(callback), true, copied_buffer, result - 1)); @@ -103,12 +105,12 @@ } } - void SendFeatureReport(scoped_refptr<net::IOBuffer> buffer, + void SendFeatureReport(scoped_refptr<base::RefCountedBytes> buffer, size_t size, WriteCallback callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); int result = - HANDLE_EINTR(ioctl(fd_.get(), HIDIOCSFEATURE(size), buffer->data())); + HANDLE_EINTR(ioctl(fd_.get(), HIDIOCSFEATURE(size), buffer->front())); if (result < 0) { HID_PLOG(EVENT) << "Failed to send feature report"; origin_task_runner_->PostTask(FROM_HERE, @@ -123,8 +125,9 @@ void OnFileCanReadWithoutBlocking() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(report_buffer_size_)); - char* data = buffer->data(); + auto buffer = + base::MakeRefCounted<base::RefCountedBytes>(report_buffer_size_); + uint8_t* data = buffer->front(); size_t length = report_buffer_size_; if (!has_report_id_) { // Linux will not prefix the buffer with a report ID if report IDs are not @@ -205,9 +208,10 @@ ProcessReadQueue(); } -void HidConnectionLinux::PlatformWrite(scoped_refptr<net::IOBuffer> buffer, - size_t size, - WriteCallback callback) { +void HidConnectionLinux::PlatformWrite( + scoped_refptr<base::RefCountedBytes> buffer, + size_t size, + WriteCallback callback) { // Linux expects the first byte of the buffer to always be a report ID so the // buffer can be used directly. blocking_task_runner_->PostTask( @@ -221,8 +225,8 @@ // The first byte of the destination buffer is the report ID being requested // and is overwritten by the feature report. DCHECK_GT(device_info()->max_feature_report_size(), 0u); - scoped_refptr<net::IOBufferWithSize> buffer( - new net::IOBufferWithSize(device_info()->max_feature_report_size() + 1)); + auto buffer = base::MakeRefCounted<base::RefCountedBytes>( + device_info()->max_feature_report_size() + 1); buffer->data()[0] = report_id; blocking_task_runner_->PostTask( @@ -232,7 +236,7 @@ } void HidConnectionLinux::PlatformSendFeatureReport( - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t size, WriteCallback callback) { // Linux expects the first byte of the buffer to always be a report ID so the @@ -243,8 +247,9 @@ std::move(callback))); } -void HidConnectionLinux::ProcessInputReport(scoped_refptr<net::IOBuffer> buffer, - size_t size) { +void HidConnectionLinux::ProcessInputReport( + scoped_refptr<base::RefCountedBytes> buffer, + size_t size) { DCHECK(thread_checker().CalledOnValidThread()); DCHECK_GE(size, 1u);
diff --git a/services/device/hid/hid_connection_linux.h b/services/device/hid/hid_connection_linux.h index b07c0e7c..b972f35 100644 --- a/services/device/hid/hid_connection_linux.h +++ b/services/device/hid/hid_connection_linux.h
@@ -37,16 +37,17 @@ // HidConnection implementation. void PlatformClose() override; void PlatformRead(ReadCallback callback) override; - void PlatformWrite(scoped_refptr<net::IOBuffer> buffer, + void PlatformWrite(scoped_refptr<base::RefCountedBytes> buffer, size_t size, WriteCallback callback) override; void PlatformGetFeatureReport(uint8_t report_id, ReadCallback callback) override; - void PlatformSendFeatureReport(scoped_refptr<net::IOBuffer> buffer, + void PlatformSendFeatureReport(scoped_refptr<base::RefCountedBytes> buffer, size_t size, WriteCallback callback) override; - void ProcessInputReport(scoped_refptr<net::IOBuffer> buffer, size_t size); + void ProcessInputReport(scoped_refptr<base::RefCountedBytes> buffer, + size_t size); void ProcessReadQueue(); // |helper_| lives on the sequence to which |blocking_task_runner_| posts
diff --git a/services/device/hid/hid_connection_mac.cc b/services/device/hid/hid_connection_mac.cc index 768a729a..51fdabe 100644 --- a/services/device/hid/hid_connection_mac.cc +++ b/services/device/hid/hid_connection_mac.cc
@@ -7,6 +7,7 @@ #include "base/bind.h" #include "base/location.h" #include "base/mac/foundation_util.h" +#include "base/memory/ref_counted_memory.h" #include "base/numerics/safe_math.h" #include "base/single_thread_task_runner.h" #include "base/strings/stringprintf.h" @@ -80,9 +81,10 @@ ProcessReadQueue(); } -void HidConnectionMac::PlatformWrite(scoped_refptr<net::IOBuffer> buffer, - size_t size, - WriteCallback callback) { +void HidConnectionMac::PlatformWrite( + scoped_refptr<base::RefCountedBytes> buffer, + size_t size, + WriteCallback callback) { blocking_task_runner_->PostTask( FROM_HERE, base::BindOnce(&HidConnectionMac::SetReportAsync, this, kIOHIDReportTypeOutput, buffer, size, @@ -97,7 +99,7 @@ } void HidConnectionMac::PlatformSendFeatureReport( - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t size, WriteCallback callback) { blocking_task_runner_->PostTask( @@ -120,26 +122,25 @@ return; } - scoped_refptr<net::IOBufferWithSize> buffer; + scoped_refptr<base::RefCountedBytes> buffer; if (connection->device_info()->has_report_id()) { // report_id is already contained in report_bytes - buffer = - new net::IOBufferWithSize(base::checked_cast<size_t>(report_length)); - memcpy(buffer->data(), report_bytes, report_length); + buffer = base::MakeRefCounted<base::RefCountedBytes>( + report_bytes, base::checked_cast<size_t>(report_length)); } else { - buffer = new net::IOBufferWithSize(static_cast<size_t>( - (base::CheckedNumeric<size_t>(report_length) + 1).ValueOrDie())); - buffer->data()[0] = 0; - memcpy(buffer->data() + 1, report_bytes, report_length); + buffer = base::MakeRefCounted<base::RefCountedBytes>( + (base::CheckedNumeric<size_t>(report_length) + 1).ValueOrDie()); + buffer->front()[0] = 0; + memcpy(buffer->front() + 1, report_bytes, report_length); } connection->ProcessInputReport(buffer); } void HidConnectionMac::ProcessInputReport( - scoped_refptr<net::IOBufferWithSize> buffer) { + scoped_refptr<base::RefCountedBytes> buffer) { DCHECK(thread_checker().CalledOnValidThread()); - DCHECK_GE(buffer->size(), 1); + DCHECK_GE(buffer->size(), 1u); uint8_t report_id = buffer->data()[0]; if (IsReportIdProtected(report_id)) @@ -170,8 +171,8 @@ void HidConnectionMac::GetFeatureReportAsync(uint8_t report_id, ReadCallback callback) { - scoped_refptr<net::IOBufferWithSize> buffer( - new net::IOBufferWithSize(device_info()->max_feature_report_size() + 1)); + auto buffer = base::MakeRefCounted<base::RefCountedBytes>( + device_info()->max_feature_report_size() + 1); CFIndex report_size = buffer->size(); // The IOHIDDevice object is shared with the UI thread and so this function @@ -179,9 +180,9 @@ // version is NOT IMPLEMENTED. I've examined the open source implementation // of this function and believe it is a simple enough wrapper around the // kernel API that this is safe. - IOReturn result = IOHIDDeviceGetReport( - device_.get(), kIOHIDReportTypeFeature, report_id, - reinterpret_cast<uint8_t*>(buffer->data()), &report_size); + IOReturn result = + IOHIDDeviceGetReport(device_.get(), kIOHIDReportTypeFeature, report_id, + buffer->front(), &report_size); if (result == kIOReturnSuccess) { task_runner_->PostTask( FROM_HERE, base::BindOnce(&HidConnectionMac::ReturnAsyncResult, this, @@ -196,11 +197,12 @@ } } -void HidConnectionMac::SetReportAsync(IOHIDReportType report_type, - scoped_refptr<net::IOBuffer> buffer, - size_t size, - WriteCallback callback) { - uint8_t* data = reinterpret_cast<uint8_t*>(buffer->data()); +void HidConnectionMac::SetReportAsync( + IOHIDReportType report_type, + scoped_refptr<base::RefCountedBytes> buffer, + size_t size, + WriteCallback callback) { + uint8_t* data = buffer->front(); DCHECK_GE(size, 1u); uint8_t report_id = data[0]; if (report_id == 0) {
diff --git a/services/device/hid/hid_connection_mac.h b/services/device/hid/hid_connection_mac.h index ca129ce..0cd6ad5 100644 --- a/services/device/hid/hid_connection_mac.h +++ b/services/device/hid/hid_connection_mac.h
@@ -19,10 +19,6 @@ class SequencedTaskRunner; } -namespace net { -class IOBuffer; -} - namespace device { class HidConnectionMac : public HidConnection { @@ -36,12 +32,12 @@ // HidConnection implementation. void PlatformClose() override; void PlatformRead(ReadCallback callback) override; - void PlatformWrite(scoped_refptr<net::IOBuffer> buffer, + void PlatformWrite(scoped_refptr<base::RefCountedBytes> buffer, size_t size, WriteCallback callback) override; void PlatformGetFeatureReport(uint8_t report_id, ReadCallback callback) override; - void PlatformSendFeatureReport(scoped_refptr<net::IOBuffer> buffer, + void PlatformSendFeatureReport(scoped_refptr<base::RefCountedBytes> buffer, size_t size, WriteCallback callback) override; @@ -52,11 +48,11 @@ uint32_t report_id, uint8_t* report_bytes, CFIndex report_length); - void ProcessInputReport(scoped_refptr<net::IOBufferWithSize> buffer); + void ProcessInputReport(scoped_refptr<base::RefCountedBytes> buffer); void ProcessReadQueue(); void GetFeatureReportAsync(uint8_t report_id, ReadCallback callback); void SetReportAsync(IOHIDReportType report_type, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t size, WriteCallback callback); void ReturnAsyncResult(base::OnceClosure callback);
diff --git a/services/device/hid/hid_connection_unittest.cc b/services/device/hid/hid_connection_unittest.cc index 1ae139a..025f55b1 100644 --- a/services/device/hid/hid_connection_unittest.cc +++ b/services/device/hid/hid_connection_unittest.cc
@@ -12,6 +12,7 @@ #include "base/bind.h" #include "base/callback.h" +#include "base/memory/ref_counted_memory.h" #include "base/run_loop.h" #include "base/scoped_observer.h" #include "base/strings/utf_string_conversions.h" @@ -19,7 +20,6 @@ #include "base/test/test_io_thread.h" #include "device/test/usb_test_gadget.h" #include "device/usb/usb_device.h" -#include "net/base/io_buffer.h" #include "services/device/hid/hid_service.h" #include "services/device/public/interfaces/hid.mojom.h" #include "testing/gtest/include/gtest/gtest.h" @@ -28,8 +28,6 @@ namespace { -using net::IOBufferWithSize; - // Helper class that can be used to block until a HID device with a particular // serial number is available. Example usage: // @@ -109,7 +107,7 @@ ~TestIoCallback() {} void SetReadResult(bool success, - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t size) { result_ = success; buffer_ = buffer; @@ -135,14 +133,14 @@ return base::BindOnce(&TestIoCallback::SetWriteResult, base::Unretained(this)); } - scoped_refptr<net::IOBuffer> buffer() const { return buffer_; } + scoped_refptr<base::RefCountedBytes> buffer() const { return buffer_; } size_t size() const { return size_; } private: base::RunLoop run_loop_; bool result_; size_t size_; - scoped_refptr<net::IOBuffer> buffer_; + scoped_refptr<base::RefCountedBytes> buffer_; }; } // namespace @@ -190,7 +188,7 @@ const char kBufferSize = 9; for (char i = 0; i < 8; ++i) { - scoped_refptr<IOBufferWithSize> buffer(new IOBufferWithSize(kBufferSize)); + auto buffer = base::MakeRefCounted<base::RefCountedBytes>(kBufferSize); buffer->data()[0] = 0; for (unsigned char j = 1; j < kBufferSize; ++j) { buffer->data()[j] = i + j - 1;
diff --git a/services/device/hid/hid_connection_win.cc b/services/device/hid/hid_connection_win.cc index 7ef7346..27bdc28 100644 --- a/services/device/hid/hid_connection_win.cc +++ b/services/device/hid/hid_connection_win.cc
@@ -11,6 +11,7 @@ #include "base/files/file.h" #include "base/macros.h" #include "base/memory/ptr_util.h" +#include "base/memory/ref_counted_memory.h" #include "base/numerics/safe_conversions.h" #include "base/win/object_watcher.h" #include "components/device_event_log/device_event_log.h" @@ -33,7 +34,8 @@ public: typedef base::OnceCallback<void(PendingHidTransfer*, bool)> Callback; - PendingHidTransfer(scoped_refptr<net::IOBuffer> buffer, Callback callback); + PendingHidTransfer(scoped_refptr<base::RefCountedBytes> buffer, + Callback callback); ~PendingHidTransfer() override; void TakeResultFromWindowsAPI(BOOL result); @@ -46,7 +48,7 @@ private: // The buffer isn't used by this object but it's important that a reference // to it is held until the transfer completes. - scoped_refptr<net::IOBuffer> buffer_; + scoped_refptr<base::RefCountedBytes> buffer_; Callback callback_; OVERLAPPED overlapped_; base::win::ScopedHandle event_; @@ -55,8 +57,9 @@ DISALLOW_COPY_AND_ASSIGN(PendingHidTransfer); }; -PendingHidTransfer::PendingHidTransfer(scoped_refptr<net::IOBuffer> buffer, - PendingHidTransfer::Callback callback) +PendingHidTransfer::PendingHidTransfer( + scoped_refptr<base::RefCountedBytes> buffer, + PendingHidTransfer::Callback callback) : buffer_(buffer), callback_(std::move(callback)), event_(CreateEvent(NULL, FALSE, FALSE, NULL)) { @@ -102,29 +105,29 @@ void HidConnectionWin::PlatformRead(HidConnection::ReadCallback callback) { // Windows will always include the report ID (including zero if report IDs // are not in use) in the buffer. - scoped_refptr<net::IOBufferWithSize> buffer = new net::IOBufferWithSize( - base::checked_cast<int>(device_info()->max_input_report_size() + 1)); + auto buffer = base::MakeRefCounted<base::RefCountedBytes>( + device_info()->max_input_report_size() + 1); transfers_.push_back(std::make_unique<PendingHidTransfer>( buffer, base::BindOnce(&HidConnectionWin::OnReadComplete, this, buffer, std::move(callback)))); transfers_.back()->TakeResultFromWindowsAPI( - ReadFile(file_.Get(), buffer->data(), static_cast<DWORD>(buffer->size()), + ReadFile(file_.Get(), buffer->front(), static_cast<DWORD>(buffer->size()), NULL, transfers_.back()->GetOverlapped())); } -void HidConnectionWin::PlatformWrite(scoped_refptr<net::IOBuffer> buffer, - size_t size, - WriteCallback callback) { +void HidConnectionWin::PlatformWrite( + scoped_refptr<base::RefCountedBytes> buffer, + size_t size, + WriteCallback callback) { size_t expected_size = device_info()->max_output_report_size() + 1; DCHECK(size <= expected_size); // The Windows API always wants either a report ID (if supported) or zero at // the front of every output report and requires that the buffer size be equal // to the maximum output report size supported by this collection. if (size < expected_size) { - scoped_refptr<net::IOBuffer> tmp_buffer = - new net::IOBuffer(base::checked_cast<int>(expected_size)); - memcpy(tmp_buffer->data(), buffer->data(), size); - memset(tmp_buffer->data() + size, 0, expected_size - size); + auto tmp_buffer = + base::MakeRefCounted<base::RefCountedBytes>(expected_size); + memcpy(tmp_buffer->front(), buffer->front(), size); buffer = tmp_buffer; size = expected_size; } @@ -132,15 +135,15 @@ buffer, base::BindOnce(&HidConnectionWin::OnWriteComplete, this, std::move(callback)))); transfers_.back()->TakeResultFromWindowsAPI( - WriteFile(file_.Get(), buffer->data(), static_cast<DWORD>(size), NULL, + WriteFile(file_.Get(), buffer->front(), static_cast<DWORD>(size), NULL, transfers_.back()->GetOverlapped())); } void HidConnectionWin::PlatformGetFeatureReport(uint8_t report_id, ReadCallback callback) { // The first byte of the destination buffer is the report ID being requested. - scoped_refptr<net::IOBufferWithSize> buffer = new net::IOBufferWithSize( - base::checked_cast<int>(device_info()->max_feature_report_size() + 1)); + auto buffer = base::MakeRefCounted<base::RefCountedBytes>( + device_info()->max_feature_report_size() + 1); buffer->data()[0] = report_id; transfers_.push_back(std::make_unique<PendingHidTransfer>( @@ -148,12 +151,12 @@ buffer, std::move(callback)))); transfers_.back()->TakeResultFromWindowsAPI( DeviceIoControl(file_.Get(), IOCTL_HID_GET_FEATURE, NULL, 0, - buffer->data(), static_cast<DWORD>(buffer->size()), NULL, + buffer->front(), static_cast<DWORD>(buffer->size()), NULL, transfers_.back()->GetOverlapped())); } void HidConnectionWin::PlatformSendFeatureReport( - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t size, WriteCallback callback) { // The Windows API always wants either a report ID (if supported) or @@ -162,15 +165,16 @@ buffer, base::BindOnce(&HidConnectionWin::OnWriteComplete, this, std::move(callback)))); transfers_.back()->TakeResultFromWindowsAPI( - DeviceIoControl(file_.Get(), IOCTL_HID_SET_FEATURE, buffer->data(), + DeviceIoControl(file_.Get(), IOCTL_HID_SET_FEATURE, buffer->front(), static_cast<DWORD>(size), NULL, 0, NULL, transfers_.back()->GetOverlapped())); } -void HidConnectionWin::OnReadComplete(scoped_refptr<net::IOBuffer> buffer, - ReadCallback callback, - PendingHidTransfer* transfer_raw, - bool signaled) { +void HidConnectionWin::OnReadComplete( + scoped_refptr<base::RefCountedBytes> buffer, + ReadCallback callback, + PendingHidTransfer* transfer_raw, + bool signaled) { if (!file_.IsValid()) { std::move(callback).Run(false, nullptr, 0); return; @@ -201,7 +205,7 @@ } void HidConnectionWin::OnReadFeatureComplete( - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, ReadCallback callback, PendingHidTransfer* transfer_raw, bool signaled) {
diff --git a/services/device/hid/hid_connection_win.h b/services/device/hid/hid_connection_win.h index 5eb9fe6..479d86c 100644 --- a/services/device/hid/hid_connection_win.h +++ b/services/device/hid/hid_connection_win.h
@@ -33,20 +33,20 @@ // HidConnection implementation. void PlatformClose() override; void PlatformRead(ReadCallback callback) override; - void PlatformWrite(scoped_refptr<net::IOBuffer> buffer, + void PlatformWrite(scoped_refptr<base::RefCountedBytes> buffer, size_t size, WriteCallback callback) override; void PlatformGetFeatureReport(uint8_t report_id, ReadCallback callback) override; - void PlatformSendFeatureReport(scoped_refptr<net::IOBuffer> buffer, + void PlatformSendFeatureReport(scoped_refptr<base::RefCountedBytes> buffer, size_t size, WriteCallback callback) override; - void OnReadComplete(scoped_refptr<net::IOBuffer> buffer, + void OnReadComplete(scoped_refptr<base::RefCountedBytes> buffer, ReadCallback callback, PendingHidTransfer* transfer, bool signaled); - void OnReadFeatureComplete(scoped_refptr<net::IOBuffer> buffer, + void OnReadFeatureComplete(scoped_refptr<base::RefCountedBytes> buffer, ReadCallback callback, PendingHidTransfer* transfer, bool signaled);
diff --git a/services/device/hid/hid_service_win.cc b/services/device/hid/hid_service_win.cc index c331cfe..90ca8f80e 100644 --- a/services/device/hid/hid_service_win.cc +++ b/services/device/hid/hid_service_win.cc
@@ -25,7 +25,6 @@ #include "base/task_scheduler/post_task.h" #include "base/threading/sequenced_task_runner_handle.h" #include "components/device_event_log/device_event_log.h" -#include "net/base/io_buffer.h" #include "services/device/hid/hid_connection_win.h" #include "services/device/hid/hid_device_info.h"
diff --git a/services/device/hid/mock_hid_connection.cc b/services/device/hid/mock_hid_connection.cc index c344a79..e6b18391 100644 --- a/services/device/hid/mock_hid_connection.cc +++ b/services/device/hid/mock_hid_connection.cc
@@ -3,6 +3,8 @@ // found in the LICENSE file. #include "services/device/hid/mock_hid_connection.h" + +#include "base/memory/ref_counted_memory.h" #include "services/device/hid/hid_device_info.h" namespace device { @@ -16,30 +18,30 @@ void MockHidConnection::PlatformClose() {} void MockHidConnection::PlatformRead(ReadCallback callback) { - const char data[] = "TestRead"; - auto buffer = base::MakeRefCounted<net::IOBuffer>(sizeof(data)); - // report_id. - buffer->data()[0] = 1; - memcpy(buffer->data() + 1, data, sizeof(data) - 1); - std::move(callback).Run(true, buffer, sizeof(data)); + // The first byte is the report id. + const uint8_t data[] = "\1TestRead"; + auto buffer = + base::MakeRefCounted<base::RefCountedBytes>(data, sizeof(data) - 1); + std::move(callback).Run(true, buffer, buffer->size()); } -void MockHidConnection::PlatformWrite(scoped_refptr<net::IOBuffer> buffer, - size_t size, - WriteCallback callback) { +void MockHidConnection::PlatformWrite( + scoped_refptr<base::RefCountedBytes> buffer, + size_t size, + WriteCallback callback) { std::move(callback).Run(true); } void MockHidConnection::PlatformGetFeatureReport(uint8_t report_id, ReadCallback callback) { - const char data[] = "TestGetFeatureReport"; - auto buffer = base::MakeRefCounted<net::IOBuffer>(sizeof(data) - 1); - memcpy(buffer->data(), data, sizeof(data) - 1); - std::move(callback).Run(true, buffer, sizeof(data) - 1); + const uint8_t data[] = "TestGetFeatureReport"; + auto buffer = + base::MakeRefCounted<base::RefCountedBytes>(data, sizeof(data) - 1); + std::move(callback).Run(true, buffer, buffer->size()); } void MockHidConnection::PlatformSendFeatureReport( - scoped_refptr<net::IOBuffer> buffer, + scoped_refptr<base::RefCountedBytes> buffer, size_t size, WriteCallback callback) { std::move(callback).Run(true);
diff --git a/services/device/hid/mock_hid_connection.h b/services/device/hid/mock_hid_connection.h index 7234dc4..19df851 100644 --- a/services/device/hid/mock_hid_connection.h +++ b/services/device/hid/mock_hid_connection.h
@@ -18,12 +18,12 @@ // HidConnection implementation. void PlatformClose() override; void PlatformRead(ReadCallback callback) override; - void PlatformWrite(scoped_refptr<net::IOBuffer> buffer, + void PlatformWrite(scoped_refptr<base::RefCountedBytes> buffer, size_t size, WriteCallback callback) override; void PlatformGetFeatureReport(uint8_t report_id, ReadCallback callback) override; - void PlatformSendFeatureReport(scoped_refptr<net::IOBuffer> buffer, + void PlatformSendFeatureReport(scoped_refptr<base::RefCountedBytes> buffer, size_t size, WriteCallback callback) override;
diff --git a/services/device/wake_lock/power_save_blocker/power_save_blocker_x11.cc b/services/device/wake_lock/power_save_blocker/power_save_blocker_x11.cc index eca7c9c..d4f2565 100644 --- a/services/device/wake_lock/power_save_blocker/power_save_blocker_x11.cc +++ b/services/device/wake_lock/power_save_blocker/power_save_blocker_x11.cc
@@ -465,6 +465,7 @@ return NO_API; std::unique_ptr<base::Environment> env(base::Environment::Create()); switch (base::nix::GetDesktopEnvironment(env.get())) { + case base::nix::DESKTOP_ENVIRONMENT_CINNAMON: case base::nix::DESKTOP_ENVIRONMENT_GNOME: case base::nix::DESKTOP_ENVIRONMENT_PANTHEON: case base::nix::DESKTOP_ENVIRONMENT_UNITY:
diff --git a/services/network/public/interfaces/data_pipe_getter.mojom b/services/network/public/interfaces/data_pipe_getter.mojom index cfadd97..551ca48 100644 --- a/services/network/public/interfaces/data_pipe_getter.mojom +++ b/services/network/public/interfaces/data_pipe_getter.mojom
@@ -12,4 +12,9 @@ // size was known, the callback is instead called with the net::Error // |status|. Read(handle<data_pipe_producer> pipe) => (int32 status, uint64 size); + + // Makes a clone so there can be multiple handles to this interface. This + // doesn't imply the data itself is cloned: this can be an inexpensive + // operation. + Clone(DataPipeGetter& request); };
diff --git a/services/proxy_resolver/public/interfaces/proxy_resolver.mojom b/services/proxy_resolver/public/interfaces/proxy_resolver.mojom index 7ac4562811..c76489d 100644 --- a/services/proxy_resolver/public/interfaces/proxy_resolver.mojom +++ b/services/proxy_resolver/public/interfaces/proxy_resolver.mojom
@@ -7,6 +7,7 @@ // TODO(amistry): Resolve the conflict between these two sets of definitions. module proxy_resolver.mojom; +import "net/interfaces/address_family.mojom"; import "net/interfaces/host_resolver_service.mojom"; import "url/mojo/url.mojom";
diff --git a/services/service_manager/sandbox/mac/BUILD.gn b/services/service_manager/sandbox/mac/BUILD.gn index 3fb46cb..c1701de7 100644 --- a/services/service_manager/sandbox/mac/BUILD.gn +++ b/services/service_manager/sandbox/mac/BUILD.gn
@@ -7,6 +7,7 @@ sources = [ "cdm.sb", "common.sb", + "common_v2.sb", "gpu.sb", "nacl_loader.sb", "ppapi.sb",
diff --git a/services/service_manager/sandbox/mac/common_v2.sb b/services/service_manager/sandbox/mac/common_v2.sb new file mode 100644 index 0000000..e5a9781f --- /dev/null +++ b/services/service_manager/sandbox/mac/common_v2.sb
@@ -0,0 +1,142 @@ +; Copyright 2017 The Chromium Authors. All rights reserved. +; Use of this source code is governed by a BSD-style license that can be +; found in the LICENSE file. +(version 1) + +; Helper function to check if a param is set to true. +(define (param-true? str) (string=? (param str) "TRUE")) + +; Helper function to determine if a parameter is defined or not. +(define (param-defined? str) (string? (param str))) + +; Define constants for all of the parameter strings passed in. +(define browser-pid "BROWSER_PID") +(define bundle-id "BUNDLE_ID") +(define bundle-path "BUNDLE_PATH") +(define component-path "COMPONENT_PATH") +(define current-pid "CURRENT_PID") +(define disable-sandbox-denial-logging "DISABLE_SANDBOX_DENIAL_LOGGING") +(define enable-logging "ENABLE_LOGGING") +(define executable-path "EXECUTABLE_PATH") +(define homedir-as-literal "USER_HOMEDIR_AS_LITERAL") +(define log-file-path "LOG_FILE_PATH") +(define os-version (string->number (param "OS_VERSION"))) +(define permitted-dir "PERMITTED_DIR") + +; Backwards compatibility for 10.9 +(if (not (defined? 'path)) + (define path literal)) +(if (not (defined? 'iokit-registry-entry-class)) + (define iokit-registry-entry-class iokit-user-client-class)) + +; --enable-sandbox-logging causes the sandbox to log failures to the syslog. +(if (param-true? disable-sandbox-denial-logging) + (deny default (with no-log)) + (deny default)) + +(if (param-true? enable-logging) (debug deny)) + +; Allow sending signals to self - https://crbug.com/20370 +(allow signal (target self)) + +; Consumes a subpath and appends it to the user's homedir path. +(define (user-homedir-path subpath) + (string-append (param homedir-as-literal) subpath)) + +; Allow logging for all processes. +(allow file-write* (path (param log-file-path))) + +; Allow component builds to work. +(if (param-defined? component-path) + (allow file-read* (subpath (param component-path)))) + +(allow process-exec (path (param executable-path))) +(allow file-read* (path (param executable-path))) + +(allow mach-lookup (global-name (string-append (param bundle-id) + ".rohitfork." + (param browser-pid)))) + +; Allow realpath() to work. +(allow file-read-metadata (subpath "/")) + +; All processes can read the bundle contents. +(allow file-read* (subpath (param bundle-path))) + +; Allow reads of system libraries and frameworks. +(allow file-read-data + (subpath "/System/Library/Frameworks") + (subpath "/System/Library/PrivateFrameworks") + (subpath "/usr/lib")) + +; Reads from /etc. +; This is read by CFPrefs calling getpwuid in a loop. libinfo then fails to +; contact any of the opendirectoryd mach services, and falls back to +; the /etc/passwd file for the user info. The access is OK because +; no actual password hashes are in /etc/passwd anymore. +(allow file-read-data (path "/private/etc/passwd")) + +; Access to /dev. +(allow file-ioctl file-read-data file-write-data (path "/dev/dtracehelper")) + +(allow file-read-data + (path "/dev/null") + (path "/dev/random") + (path "/dev/urandom")) + +(if (= os-version 1013) + (begin (allow file-read-data (subpath "/private/var/db/timezone")) + (allow file-read-data (subpath "/usr/share/zoneinfo.default")))) + +(if (< os-version 1013) + (allow file-read-data (subpath "/usr/share/zoneinfo"))) + +; Reads from /Library. +(allow file-read-data + (path "/Library/Preferences/.GlobalPreferences.plist") + (path "/System/Library/CoreServices/SystemVersion.plist")) + +; Reads from /usr. +(allow file-read-data + (subpath "/usr/share/icu") + (subpath "/usr/share/locale")) + +; Access to the home directory. +(allow file-read-data + (path (user-homedir-path "/Library/Preferences/.GlobalPreferences.plist")) + (regex (user-homedir-path #"/Library/Preferences/ByHost/.GlobalPreferences.*"))) + +; Mach IPC needed by all Chromium Helper instances. +(allow mach-lookup + ; crbug.com/792229 + (global-name "com.apple.logd") + (global-name "com.apple.system.logger") + ; crbug.com/792228 + (global-name "com.apple.system.opendirectoryd.libinfo")) + +; sysctls permitted. +(if (= os-version 1009) + (allow sysctl-read) + ; else + (allow sysctl-read + (sysctl-name "hw.activecpu") + (sysctl-name "hw.busfrequency_compat") + (sysctl-name "hw.byteorder") + (sysctl-name "hw.cachelinesize_compat") + (sysctl-name "hw.cpufrequency_compat") + (sysctl-name "hw.cputype") + (sysctl-name "hw.machine") + (sysctl-name "hw.ncpu") + (sysctl-name "hw.pagesize_compat") + (sysctl-name "hw.physicalcpu_max") + (sysctl-name "hw.tbfrequency_compat") + (sysctl-name "hw.vectorunit") + (sysctl-name "kern.hostname") + (sysctl-name "kern.maxfilesperproc") + (sysctl-name "kern.osrelease") + (sysctl-name "kern.ostype") + (sysctl-name "kern.osversion") + (sysctl-name (string-append "kern.proc.pid." (param current-pid))) + (sysctl-name "kern.usrstack64") + (sysctl-name "kern.version") + (sysctl-name "sysctl.proc_cputype")))
diff --git a/services/service_manager/sandbox/mac/renderer_v2.sb b/services/service_manager/sandbox/mac/renderer_v2.sb index c7527be..5d56ee23 100644 --- a/services/service_manager/sandbox/mac/renderer_v2.sb +++ b/services/service_manager/sandbox/mac/renderer_v2.sb
@@ -1,132 +1,40 @@ ; Copyright 2017 The Chromium Authors. All rights reserved. ; Use of this source code is governed by a BSD-style license that can be ; found in the LICENSE file. -(version 1) -; The top of this will be the V2 common profile. - -; Helper function to check if a param is set to true. -(define (param-true? str) (string=? (param str) "TRUE")) - -; Helper function to determine if a parameter is defined or not. -(define (param-defined? str) (string? (param str))) - -; Define constants for all of the parameter strings passed in. -(define browser-pid "BROWSER_PID") -(define bundle-id "BUNDLE_ID") -(define bundle-path "BUNDLE_PATH") -(define component-path "COMPONENT_PATH") -(define current-pid "CURRENT_PID") -(define disable-sandbox-denial-logging "DISABLE_SANDBOX_DENIAL_LOGGING") -(define enable-logging "ENABLE_LOGGING") -(define executable-path "EXECUTABLE_PATH") -(define homedir-as-literal "USER_HOMEDIR_AS_LITERAL") -(define log-file-path "LOG_FILE_PATH") -(define os-version (string->number (param "OS_VERSION"))) - -; Backwards compatibility for 10.9 -(if (not (defined? 'path)) - (define path literal)) -(if (not (defined? 'iokit-registry-entry-class)) - (define iokit-registry-entry-class iokit-user-client-class)) - -; --enable-sandbox-logging causes the sandbox to log failures to the syslog. -(if (param-true? disable-sandbox-denial-logging) - (deny default (with no-log)) - (deny default)) - -(if (param-true? enable-logging) (debug deny)) - -; Allow sending signals to self - https://crbug.com/20370 -(allow signal (target self)) - -; Consumes a subpath and appends it to the user's homedir path. -(define (user-homedir-path subpath) - (string-append (param homedir-as-literal) subpath)) - -; Allow logging for all processes. -(allow file-write* (path (param log-file-path))) - -; Allow component builds to work. -(if (param-defined? component-path) - (allow file-read* (subpath (param component-path)))) - -(allow process-exec (path (param executable-path))) -(allow file-read* (path (param executable-path))) - -(allow mach-lookup (global-name (string-append (param bundle-id) - ".rohitfork." - (param browser-pid)))) -; Allow realpath() to work. -(allow file-read-metadata (subpath "/")) +; --- The contents of common.sb implicitly included here. --- ; Allow cf prefs to work. (allow user-preference-read) -; All processes can read the bundle contents. -(allow file-read* (subpath (param bundle-path))) - -; End of common.sb? -(allow file-ioctl file-read-data file-write-data (path "/dev/dtracehelper")) - ; File reads. ; Reads from the home directory. (allow file-read-data (path (user-homedir-path "/.CFUserTextEncoding")) (path (user-homedir-path "/Library/Preferences/com.apple.universalaccess.plist")) - (path (user-homedir-path "/Library/Preferences/.GlobalPreferences.plist")) - (regex (user-homedir-path #"/Library/Preferences/ByHost/.GlobalPreferences.*")) (subpath (user-homedir-path "/Library/Fonts"))) ; Reads of /dev devices. (allow file-read-data (path "/dev/autofs_nowait") - (path "/dev/fd") - (path "/dev/null") - (path "/dev/random") - (path "/dev/urandom")) + (path "/dev/fd")) (allow file-write-data (path "/dev/null")) -; Reads from /etc. -; This is read by CFPrefs calling getpwuid in a loop. libinfo then fails to -; contact any of the opendirectoryd mach services, and falls back to -; the /etc/passwd file for the user info. The access is OK because -; no actual password hashes are in /etc/passwd anymore. -(allow file-read-data (path "/private/etc/passwd")) - -; Reads from /usr. -(allow file-read-data - (subpath "/usr/lib") - (subpath "/usr/share/icu") - (subpath "/usr/share/locale")) - -(if (= os-version 1013) - (begin (allow file-read-data (subpath "/private/var/db/timezone")) - (allow file-read-data (subpath "/usr/share/zoneinfo.default")))) - -(if (< os-version 1013) - (allow file-read-data (subpath "/usr/share/zoneinfo"))) - ; Reads from /Library. -(allow file-read-data - (subpath "/Library/Fonts") - (path "/Library/Preferences/.GlobalPreferences.plist")) +(allow file-read-data (subpath "/Library/Fonts")) ; Reads from /System. (allow file-read-data (path "/System/Library/CoreServices/checkfixlist") (path "/System/Library/CoreServices/CoreTypes.bundle/Contents/Library/AppExceptions.bundle/Exceptions.plist") (path "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/Exceptions.plist") - (path "/System/Library/CoreServices/SystemVersion.plist") (path "/System/Library/Preferences/Logging/Subsystems/com.apple.SkyLight.plist") (subpath "/System/Library/ColorSync/Profiles") (subpath "/System/Library/CoreServices/SystemAppearance.bundle") (subpath "/System/Library/CoreServices/SystemVersion.bundle") (subpath "/System/Library/Fonts") - (subpath "/System/Library/Frameworks") - (subpath "/System/Library/LinguisticData") - (subpath "/System/Library/PrivateFrameworks")) + (subpath "/System/Library/LinguisticData")) ; IOKit (allow iokit-open @@ -137,19 +45,19 @@ (allow ipc-posix-shm-read-data (ipc-posix-name "apple.cfprefs.317580v1") (ipc-posix-name "apple.cfprefs.daemonv1") + ; crbug.com/792217 (ipc-posix-name "apple.shm.notification_center")) ; mach IPC (allow mach-lookup + ; crbug.com/792257 (global-name "com.apple.distributed_notifications@Uv3") (global-name "com.apple.fonts") ; crbug.com/756145, crbug.com/786615 (global-name "com.apple.FontObjectsServer") - (global-name "com.apple.logd") (global-name "com.apple.lsd.mapdb") - (global-name "com.apple.system.logger") + ; crbug.com/792217 (global-name "com.apple.system.notification_center") - (global-name "com.apple.system.opendirectoryd.libinfo") (global-name "com.apple.windowserver.active")) ; MacOS dropped FontServer to replace it with the (XPC based) com.apple.fonts, @@ -161,30 +69,3 @@ ; /System/Library/Asssets/com_apple_MobileAsset_Font*. ; (https://crbug.com/662686) (allow file-read* (extension "com.apple.app-sandbox.read")) - -; sysctl -(if (= os-version 1009) - (allow sysctl-read) - ; else - (allow sysctl-read - (sysctl-name "hw.activecpu") - (sysctl-name "hw.busfrequency_compat") - (sysctl-name "hw.byteorder") - (sysctl-name "hw.cachelinesize_compat") - (sysctl-name "hw.cpufrequency_compat") - (sysctl-name "hw.cputype") - (sysctl-name "hw.machine") - (sysctl-name "hw.ncpu") - (sysctl-name "hw.pagesize_compat") - (sysctl-name "hw.physicalcpu_max") - (sysctl-name "hw.tbfrequency_compat") - (sysctl-name "hw.vectorunit") - (sysctl-name "kern.hostname") - (sysctl-name "kern.maxfilesperproc") - (sysctl-name "kern.osrelease") - (sysctl-name "kern.ostype") - (sysctl-name "kern.osversion") - (sysctl-name (string-append "kern.proc.pid." (param current-pid))) - (sysctl-name "kern.usrstack64") - (sysctl-name "kern.version") - (sysctl-name "sysctl.proc_cputype")))
diff --git a/services/service_manager/sandbox/win/sandbox_win.cc b/services/service_manager/sandbox/win/sandbox_win.cc index dfdb688..132a3e4 100644 --- a/services/service_manager/sandbox/win/sandbox_win.cc +++ b/services/service_manager/sandbox/win/sandbox_win.cc
@@ -838,13 +838,6 @@ TRACE_EVENT_END0("startup", "StartProcessWithAccess::LAUNCHPROCESS"); - base::debug::GlobalActivityTracker* tracker = - base::debug::GlobalActivityTracker::Get(); - if (tracker) { - tracker->RecordProcessLaunch(target.process_id(), - cmd_line->GetCommandLineString()); - } - if (sandbox::SBOX_ALL_OK != result) { base::UmaHistogramSparse("Process.Sandbox.Launch.Error", last_error); if (result == sandbox::SBOX_ERROR_GENERIC) @@ -854,6 +847,13 @@ return result; } + base::debug::GlobalActivityTracker* tracker = + base::debug::GlobalActivityTracker::Get(); + if (tracker) { + tracker->RecordProcessLaunch(target.process_id(), + cmd_line->GetCommandLineString()); + } + if (sandbox::SBOX_ALL_OK != last_warning) LogLaunchWarning(last_warning, last_error);
diff --git a/services/ui/ws/display_manager.cc b/services/ui/ws/display_manager.cc index f135b3be..3ef25e2 100644 --- a/services/ui/ws/display_manager.cc +++ b/services/ui/ws/display_manager.cc
@@ -131,23 +131,10 @@ primary_display_index = i; found_internal_display |= display.id() == internal_display_id; Display* ws_display = GetDisplayById(display.id()); - if (!ws_display) { - if (display.id() == display::kUnifiedDisplayId) { - if (displays.size() != 1u) { - LOG(ERROR) << "SetDisplayConfiguration passed 2+ displays in unified"; - return false; - } - if (mirrors.size() <= 1u) { - LOG(ERROR) << "SetDisplayConfiguration passed <2 mirrors in unified"; - return false; - } - NOTIMPLEMENTED() << "TODO(crbug.com/764472): Mus unified mode."; - return false; - } else { - LOG(ERROR) << "SetDisplayConfiguration passed unknown display id " - << display.id(); - return false; - } + if (!ws_display && display.id() != display::kUnifiedDisplayId) { + LOG(ERROR) << "SetDisplayConfiguration passed unknown display id " + << display.id(); + return false; } } if (primary_display_index == std::numeric_limits<size_t>::max()) {
diff --git a/services/ui/ws/platform_display_default.cc b/services/ui/ws/platform_display_default.cc index 74149f68..9a52033 100644 --- a/services/ui/ws/platform_display_default.cc +++ b/services/ui/ws/platform_display_default.cc
@@ -13,6 +13,7 @@ #include "services/ui/public/interfaces/cursor/cursor_struct_traits.h" #include "services/ui/ws/server_window.h" #include "services/ui/ws/threaded_image_cursors.h" +#include "services/viz/privileged/interfaces/compositing/display_private.mojom.h" #include "ui/display/display.h" #include "ui/events/event.h" #include "ui/events/event_utils.h" @@ -85,7 +86,9 @@ NOTREACHED() << "Unsupported platform"; #endif - platform_window_->Show(); + // Show the platform window, unless it's the virtual unified display window. + if (delegate_->GetDisplay().id() != display::kUnifiedDisplayId) + platform_window_->Show(); if (image_cursors_) { image_cursors_->SetDisplay(delegate_->GetDisplay(), metrics_.device_scale_factor); @@ -246,16 +249,22 @@ return; viz::mojom::CompositorFrameSinkAssociatedPtr compositor_frame_sink; - viz::mojom::DisplayPrivateAssociatedPtr display_private; viz::mojom::CompositorFrameSinkClientPtr compositor_frame_sink_client; viz::mojom::CompositorFrameSinkClientRequest compositor_frame_sink_client_request = mojo::MakeRequest(&compositor_frame_sink_client); + // TODO(ccameron): |display_client| is not bound. This will need to + // change to support macOS. + viz::mojom::DisplayPrivateAssociatedPtr display_private; + viz::mojom::DisplayClientPtr display_client; + viz::mojom::DisplayClientRequest display_client_request = + mojo::MakeRequest(&display_client); + root_window_->CreateRootCompositorFrameSink( widget_, mojo::MakeRequest(&compositor_frame_sink), std::move(compositor_frame_sink_client), - mojo::MakeRequest(&display_private)); + mojo::MakeRequest(&display_private), std::move(display_client)); display_private->SetDisplayVisible(true); frame_generator_ = std::make_unique<FrameGenerator>();
diff --git a/services/ui/ws/server_window.cc b/services/ui/ws/server_window.cc index efc68f3..8cda2618 100644 --- a/services/ui/ws/server_window.cc +++ b/services/ui/ws/server_window.cc
@@ -98,7 +98,8 @@ gfx::AcceleratedWidget widget, viz::mojom::CompositorFrameSinkAssociatedRequest sink_request, viz::mojom::CompositorFrameSinkClientPtr client, - viz::mojom::DisplayPrivateAssociatedRequest display_request) { + viz::mojom::DisplayPrivateAssociatedRequest display_request, + viz::mojom::DisplayClientPtr display_client) { has_created_compositor_frame_sink_ = true; // TODO(fsamuel): AcceleratedWidget cannot be transported over IPC for Mac // or Android. We should instead use GpuSurfaceTracker here on those @@ -106,7 +107,8 @@ delegate_->GetVizHostProxy()->CreateRootCompositorFrameSink( frame_sink_id_, widget, viz::CreateRendererSettings(viz::BufferUsageAndFormatList()), - std::move(sink_request), std::move(client), std::move(display_request)); + std::move(sink_request), std::move(client), std::move(display_request), + std::move(display_client)); } void ServerWindow::CreateCompositorFrameSink(
diff --git a/services/ui/ws/server_window.h b/services/ui/ws/server_window.h index 2998481..2b13a6e4c 100644 --- a/services/ui/ws/server_window.h +++ b/services/ui/ws/server_window.h
@@ -71,7 +71,8 @@ gfx::AcceleratedWidget widget, viz::mojom::CompositorFrameSinkAssociatedRequest sink_request, viz::mojom::CompositorFrameSinkClientPtr client, - viz::mojom::DisplayPrivateAssociatedRequest display_request); + viz::mojom::DisplayPrivateAssociatedRequest display_request, + viz::mojom::DisplayClientPtr display_client); void CreateCompositorFrameSink( viz::mojom::CompositorFrameSinkRequest request,
diff --git a/services/ui/ws/server_window_delegate.h b/services/ui/ws/server_window_delegate.h index 32073df..d3a256d 100644 --- a/services/ui/ws/server_window_delegate.h +++ b/services/ui/ws/server_window_delegate.h
@@ -50,7 +50,8 @@ const viz::RendererSettings& renderer_settings, viz::mojom::CompositorFrameSinkAssociatedRequest request, viz::mojom::CompositorFrameSinkClientPtr client, - viz::mojom::DisplayPrivateAssociatedRequest display_private_request) = 0; + viz::mojom::DisplayPrivateAssociatedRequest display_private_request, + viz::mojom::DisplayClientPtr display_client) = 0; virtual void CreateCompositorFrameSink( const viz::FrameSinkId& frame_sink_id,
diff --git a/services/ui/ws/window_server.cc b/services/ui/ws/window_server.cc index d3c5a17..824b15a 100644 --- a/services/ui/ws/window_server.cc +++ b/services/ui/ws/window_server.cc
@@ -87,15 +87,15 @@ const viz::RendererSettings& renderer_settings, viz::mojom::CompositorFrameSinkAssociatedRequest request, viz::mojom::CompositorFrameSinkClientPtr client, - viz::mojom::DisplayPrivateAssociatedRequest display_private_request) - override { + viz::mojom::DisplayPrivateAssociatedRequest display_private_request, + viz::mojom::DisplayClientPtr display_client) override { if (manager_) { // No software compositing on ChromeOS. bool force_software_compositing = false; manager_->CreateRootCompositorFrameSink( frame_sink_id, surface_handle, force_software_compositing, renderer_settings, std::move(request), std::move(client), - std::move(display_private_request)); + std::move(display_private_request), std::move(display_client)); } }
diff --git a/services/viz/privileged/interfaces/compositing/display_private.mojom b/services/viz/privileged/interfaces/compositing/display_private.mojom index ee8824d23..90a4e0e 100644 --- a/services/viz/privileged/interfaces/compositing/display_private.mojom +++ b/services/viz/privileged/interfaces/compositing/display_private.mojom
@@ -5,6 +5,7 @@ module viz.mojom; import "mojo/common/time.mojom"; +import "ui/gfx/mojo/ca_layer_params.mojom"; import "ui/gfx/mojo/color_space.mojom"; import "ui/gfx/mojo/transform.mojom"; @@ -27,3 +28,7 @@ // if the display is using an external BeginFrame source. SetAuthoritativeVSyncInterval(mojo.common.mojom.TimeDelta interval); }; + +interface DisplayClient { + OnDisplayReceivedCALayerParams(gfx.mojom.CALayerParams ca_layer_params); +};
diff --git a/services/viz/privileged/interfaces/compositing/frame_sink_manager.mojom b/services/viz/privileged/interfaces/compositing/frame_sink_manager.mojom index 3bcd7eb..8046a4a 100644 --- a/services/viz/privileged/interfaces/compositing/frame_sink_manager.mojom +++ b/services/viz/privileged/interfaces/compositing/frame_sink_manager.mojom
@@ -57,7 +57,8 @@ RendererSettings renderer_settings, associated CompositorFrameSink& compositor_frame_sink, CompositorFrameSinkClient compositor_frame_sink_client, - associated DisplayPrivate& display_private); + associated DisplayPrivate& display_private, + DisplayClient display_client); // CreateCompositorFrameSink is used by unprivileged clients. This // CompositorFrameSink is not a root, and has to be parented by another
diff --git a/services/viz/privileged/interfaces/compositing/renderer_settings.mojom b/services/viz/privileged/interfaces/compositing/renderer_settings.mojom index 36f9bfe..2acfcf2 100644 --- a/services/viz/privileged/interfaces/compositing/renderer_settings.mojom +++ b/services/viz/privileged/interfaces/compositing/renderer_settings.mojom
@@ -19,6 +19,7 @@ ResourceSettings resource_settings; bool should_clear_root_render_pass; bool show_overdraw_feedback; + bool enable_draw_occlusion; int32 slow_down_compositing_scale_factor; bool use_skia_renderer; };
diff --git a/services/viz/privileged/interfaces/compositing/renderer_settings_struct_traits.cc b/services/viz/privileged/interfaces/compositing/renderer_settings_struct_traits.cc index c7f5dcc..55d1a594 100644 --- a/services/viz/privileged/interfaces/compositing/renderer_settings_struct_traits.cc +++ b/services/viz/privileged/interfaces/compositing/renderer_settings_struct_traits.cc
@@ -22,6 +22,7 @@ out->gl_composited_overlay_candidate_quad_border = data.gl_composited_overlay_candidate_quad_border(); out->show_overdraw_feedback = data.show_overdraw_feedback(); + out->enable_draw_occlusion = data.enable_draw_occlusion(); out->highp_threshold_min = data.highp_threshold_min(); out->disallow_non_exact_resource_reuse = data.disallow_non_exact_resource_reuse();
diff --git a/services/viz/privileged/interfaces/compositing/renderer_settings_struct_traits.h b/services/viz/privileged/interfaces/compositing/renderer_settings_struct_traits.h index 51064329..8b1c004 100644 --- a/services/viz/privileged/interfaces/compositing/renderer_settings_struct_traits.h +++ b/services/viz/privileged/interfaces/compositing/renderer_settings_struct_traits.h
@@ -56,6 +56,10 @@ return input.show_overdraw_feedback; } + static bool enable_draw_occlusion(const viz::RendererSettings& input) { + return input.enable_draw_occlusion; + } + static int highp_threshold_min(const viz::RendererSettings& input) { return input.highp_threshold_min; }
diff --git a/services/viz/privileged/interfaces/struct_traits_unittest.cc b/services/viz/privileged/interfaces/struct_traits_unittest.cc index 694edf5c..af5b931a 100644 --- a/services/viz/privileged/interfaces/struct_traits_unittest.cc +++ b/services/viz/privileged/interfaces/struct_traits_unittest.cc
@@ -41,6 +41,7 @@ input.release_overlay_resources_after_gpu_query = true; input.gl_composited_overlay_candidate_quad_border = true; input.show_overdraw_feedback = true; + input.enable_draw_occlusion = true; input.highp_threshold_min = -1; input.disallow_non_exact_resource_reuse = true; input.use_skia_renderer = true; @@ -68,6 +69,7 @@ EXPECT_EQ(input.gl_composited_overlay_candidate_quad_border, output.gl_composited_overlay_candidate_quad_border); EXPECT_EQ(input.show_overdraw_feedback, output.show_overdraw_feedback); + EXPECT_EQ(input.enable_draw_occlusion, output.enable_draw_occlusion); EXPECT_EQ(input.highp_threshold_min, output.highp_threshold_min); EXPECT_EQ(input.disallow_non_exact_resource_reuse, output.disallow_non_exact_resource_reuse);
diff --git a/skia/ext/texture_handle.h b/skia/ext/texture_handle.h index a5409c5f..83cb759 100644 --- a/skia/ext/texture_handle.h +++ b/skia/ext/texture_handle.h
@@ -9,12 +9,7 @@ namespace skia { -// TODO(bsalomon): Remove both of these conversions when Skia bug 5019 is fixed. -inline GrBackendObject GrGLTextureInfoToGrBackendObject( - const GrGLTextureInfo& info) { - return reinterpret_cast<GrBackendObject>(&info); -} - +// TODO(bsalomon): Remove this conversion when Skia bug 5019 is fixed. inline const GrGLTextureInfo* GrBackendObjectToGrGLTextureInfo( GrBackendObject object) { return reinterpret_cast<const GrGLTextureInfo*>(object);
diff --git a/storage/browser/database/database_quota_client.cc b/storage/browser/database/database_quota_client.cc index e53dd0c..bd6f49c 100644 --- a/storage/browser/database/database_quota_client.cc +++ b/storage/browser/database/database_quota_client.cc
@@ -20,6 +20,7 @@ #include "storage/browser/database/database_tracker.h" #include "storage/browser/database/database_util.h" #include "storage/common/database/database_identifier.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" using storage::QuotaClient; @@ -81,11 +82,11 @@ return; } - storage::QuotaStatusCode status; + blink::QuotaStatusCode status; if (result == net::OK) - status = storage::kQuotaStatusOk; + status = blink::QuotaStatusCode::kOk; else - status = storage::kQuotaStatusUnknown; + status = blink::QuotaStatusCode::kUnknown; original_task_runner->PostTask(FROM_HERE, base::BindOnce(callback, status)); } @@ -183,12 +184,12 @@ // All databases are in the temp namespace for now, so nothing to delete. if (type != storage::kStorageTypeTemporary) { - callback.Run(storage::kQuotaStatusOk); + callback.Run(blink::QuotaStatusCode::kOk); return; } // DidDeleteOriginData() translates the net::Error response to a - // storage::QuotaStatusCode if necessary, and no-ops as appropriate if + // blink::QuotaStatusCode if necessary, and no-ops as appropriate if // DatabaseTracker::ScheduleDatabasesForDeletion will also invoke the // callback. auto delete_callback = base::BindRepeating(
diff --git a/storage/browser/database/database_quota_client_unittest.cc b/storage/browser/database/database_quota_client_unittest.cc index f10643ef..4db4769 100644 --- a/storage/browser/database/database_quota_client_unittest.cc +++ b/storage/browser/database/database_quota_client_unittest.cc
@@ -178,14 +178,14 @@ bool DeleteOriginData(storage::QuotaClient* client, storage::StorageType type, const GURL& origin) { - delete_status_ = storage::kQuotaStatusUnknown; + delete_status_ = blink::QuotaStatusCode::kUnknown; client->DeleteOriginData( origin, type, base::AdaptCallbackForRepeating( base::BindOnce(&DatabaseQuotaClientTest::OnDeleteOriginDataComplete, weak_factory_.GetWeakPtr()))); base::RunLoop().RunUntilIdle(); - return delete_status_ == storage::kQuotaStatusOk; + return delete_status_ == blink::QuotaStatusCode::kOk; } MockDatabaseTracker* mock_tracker() { return mock_tracker_.get(); } @@ -197,14 +197,14 @@ origins_ = origins; } - void OnDeleteOriginDataComplete(storage::QuotaStatusCode status) { + void OnDeleteOriginDataComplete(blink::QuotaStatusCode status) { delete_status_ = status; } base::test::ScopedTaskEnvironment scoped_task_environment_; int64_t usage_; std::set<GURL> origins_; - storage::QuotaStatusCode delete_status_; + blink::QuotaStatusCode delete_status_; scoped_refptr<MockDatabaseTracker> mock_tracker_; base::WeakPtrFactory<DatabaseQuotaClientTest> weak_factory_; };
diff --git a/storage/browser/fileapi/copy_or_move_operation_delegate_unittest.cc b/storage/browser/fileapi/copy_or_move_operation_delegate_unittest.cc index c02cd38..df6d4d37 100644 --- a/storage/browser/fileapi/copy_or_move_operation_delegate_unittest.cc +++ b/storage/browser/fileapi/copy_or_move_operation_delegate_unittest.cc
@@ -387,9 +387,9 @@ void GetUsageAndQuota(storage::FileSystemType type, int64_t* usage, int64_t* quota) { - storage::QuotaStatusCode status = AsyncFileTestHelper::GetUsageAndQuota( + blink::QuotaStatusCode status = AsyncFileTestHelper::GetUsageAndQuota( quota_manager_.get(), origin_, type, usage, quota); - ASSERT_EQ(storage::kQuotaStatusOk, status); + ASSERT_EQ(blink::QuotaStatusCode::kOk, status); } private:
diff --git a/storage/browser/fileapi/file_system_operation_impl.cc b/storage/browser/fileapi/file_system_operation_impl.cc index 90219de5..5791ffa2 100644 --- a/storage/browser/fileapi/file_system_operation_impl.cc +++ b/storage/browser/fileapi/file_system_operation_impl.cc
@@ -416,11 +416,11 @@ void FileSystemOperationImpl::DidGetUsageAndQuotaAndRunTask( const base::Closure& task, const base::Closure& error_callback, - storage::QuotaStatusCode status, + blink::QuotaStatusCode status, int64_t usage, int64_t quota) { - if (status != storage::kQuotaStatusOk) { - LOG(WARNING) << "Got unexpected quota error : " << status; + if (status != blink::QuotaStatusCode::kOk) { + LOG(WARNING) << "Got unexpected quota error : " << static_cast<int>(status); error_callback.Run(); return; }
diff --git a/storage/browser/fileapi/file_system_operation_impl.h b/storage/browser/fileapi/file_system_operation_impl.h index eed8df5..1a625dc7 100644 --- a/storage/browser/fileapi/file_system_operation_impl.h +++ b/storage/browser/fileapi/file_system_operation_impl.h
@@ -19,7 +19,7 @@ #include "storage/browser/fileapi/file_system_url.h" #include "storage/browser/fileapi/file_writer_delegate.h" #include "storage/browser/storage_browser_export.h" -#include "storage/common/quota/quota_types.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" namespace storage { @@ -124,7 +124,7 @@ // |error_callback|. void DidGetUsageAndQuotaAndRunTask(const base::Closure& task, const base::Closure& error_callback, - storage::QuotaStatusCode status, + blink::QuotaStatusCode status, int64_t usage, int64_t quota);
diff --git a/storage/browser/fileapi/file_system_operation_impl_unittest.cc b/storage/browser/fileapi/file_system_operation_impl_unittest.cc index aa82eab9..d9dc80f 100644 --- a/storage/browser/fileapi/file_system_operation_impl_unittest.cc +++ b/storage/browser/fileapi/file_system_operation_impl_unittest.cc
@@ -253,14 +253,11 @@ } void GetUsageAndQuota(int64_t* usage, int64_t* quota) { - storage::QuotaStatusCode status = - AsyncFileTestHelper::GetUsageAndQuota(quota_manager_.get(), - sandbox_file_system_.origin(), - sandbox_file_system_.type(), - usage, - quota); + blink::QuotaStatusCode status = AsyncFileTestHelper::GetUsageAndQuota( + quota_manager_.get(), sandbox_file_system_.origin(), + sandbox_file_system_.type(), usage, quota); scoped_task_environment_.RunUntilIdle(); - ASSERT_EQ(storage::kQuotaStatusOk, status); + ASSERT_EQ(blink::QuotaStatusCode::kOk, status); } int64_t ComputePathCost(const FileSystemURL& url) {
diff --git a/storage/browser/fileapi/file_system_quota_client.cc b/storage/browser/fileapi/file_system_quota_client.cc index 1a2feb2..e6274ae 100644 --- a/storage/browser/fileapi/file_system_quota_client.cc +++ b/storage/browser/fileapi/file_system_quota_client.cc
@@ -18,6 +18,7 @@ #include "storage/browser/fileapi/file_system_usage_cache.h" #include "storage/browser/fileapi/sandbox_file_system_backend.h" #include "storage/common/fileapi/file_system_util.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" #include "url/gurl.h" using storage::StorageType; @@ -58,19 +59,18 @@ callback.Run(*origins_ptr); } -storage::QuotaStatusCode DeleteOriginOnFileTaskRunner( - FileSystemContext* context, - const GURL& origin, - FileSystemType type) { +blink::QuotaStatusCode DeleteOriginOnFileTaskRunner(FileSystemContext* context, + const GURL& origin, + FileSystemType type) { FileSystemBackend* provider = context->GetFileSystemBackend(type); if (!provider || !provider->GetQuotaUtil()) - return storage::kQuotaErrorNotSupported; + return blink::QuotaStatusCode::kErrorNotSupported; base::File::Error result = provider->GetQuotaUtil()->DeleteOriginDataOnFileTaskRunner( context, context->quota_manager_proxy(), origin, type); if (result == base::File::FILE_OK) - return storage::kQuotaStatusOk; - return storage::kQuotaErrorInvalidModification; + return blink::QuotaStatusCode::kOk; + return blink::QuotaStatusCode::kErrorInvalidModification; } } // namespace
diff --git a/storage/browser/fileapi/file_system_quota_client_unittest.cc b/storage/browser/fileapi/file_system_quota_client_unittest.cc index ccf04f85..1e6c93a 100644 --- a/storage/browser/fileapi/file_system_quota_client_unittest.cc +++ b/storage/browser/fileapi/file_system_quota_client_unittest.cc
@@ -22,6 +22,7 @@ #include "storage/common/fileapi/file_system_util.h" #include "storage/common/quota/quota_types.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" #include "url/gurl.h" using content::AsyncFileTestHelper; @@ -45,7 +46,7 @@ public: FileSystemQuotaClientTest() : additional_callback_count_(0), - deletion_status_(storage::kQuotaStatusUnknown), + deletion_status_(blink::QuotaStatusCode::kUnknown), weak_factory_(this) {} void SetUp() override { @@ -200,7 +201,7 @@ void DeleteOriginData(FileSystemQuotaClient* quota_client, const std::string& origin, storage::StorageType type) { - deletion_status_ = storage::kQuotaStatusUnknown; + deletion_status_ = blink::QuotaStatusCode::kUnknown; quota_client->DeleteOriginData( GURL(origin), type, base::Bind(&FileSystemQuotaClientTest::OnDeleteOrigin, @@ -208,7 +209,7 @@ } int64_t usage() const { return usage_; } - storage::QuotaStatusCode status() { return deletion_status_; } + blink::QuotaStatusCode status() { return deletion_status_; } int additional_callback_count() const { return additional_callback_count_; } void set_additional_callback_count(int count) { additional_callback_count_ = count; @@ -225,7 +226,7 @@ ++additional_callback_count_; } - void OnDeleteOrigin(storage::QuotaStatusCode status) { + void OnDeleteOrigin(blink::QuotaStatusCode status) { deletion_status_ = status; } @@ -235,7 +236,7 @@ int64_t usage_; int additional_callback_count_; std::set<GURL> origins_; - storage::QuotaStatusCode deletion_status_; + blink::QuotaStatusCode deletion_status_; base::WeakPtrFactory<FileSystemQuotaClientTest> weak_factory_; DISALLOW_COPY_AND_ASSIGN(FileSystemQuotaClientTest); @@ -530,15 +531,15 @@ DeleteOriginData(quota_client.get(), "http://foo.com/", kTemporary); base::RunLoop().RunUntilIdle(); - EXPECT_EQ(storage::kQuotaStatusOk, status()); + EXPECT_EQ(blink::QuotaStatusCode::kOk, status()); DeleteOriginData(quota_client.get(), "http://bar.com/", kPersistent); base::RunLoop().RunUntilIdle(); - EXPECT_EQ(storage::kQuotaStatusOk, status()); + EXPECT_EQ(blink::QuotaStatusCode::kOk, status()); DeleteOriginData(quota_client.get(), "http://buz.com/", kTemporary); base::RunLoop().RunUntilIdle(); - EXPECT_EQ(storage::kQuotaStatusOk, status()); + EXPECT_EQ(blink::QuotaStatusCode::kOk, status()); EXPECT_EQ(0, GetOriginUsage( quota_client.get(), "http://foo.com/", kTemporary));
diff --git a/storage/browser/fileapi/obfuscated_file_util_unittest.cc b/storage/browser/fileapi/obfuscated_file_util_unittest.cc index 3d18579..35ae9f78 100644 --- a/storage/browser/fileapi/obfuscated_file_util_unittest.cc +++ b/storage/browser/fileapi/obfuscated_file_util_unittest.cc
@@ -159,7 +159,7 @@ origin_(GURL("http://www.example.com")), type_(storage::kFileSystemTypeTemporary), sandbox_file_system_(origin_, type_), - quota_status_(storage::kQuotaStatusUnknown), + quota_status_(blink::QuotaStatusCode::kUnknown), usage_(-1), weak_factory_(this) {} @@ -282,7 +282,7 @@ sandbox_file_system_.type(), &usage_, "a); - EXPECT_EQ(storage::kQuotaStatusOk, quota_status_); + EXPECT_EQ(blink::QuotaStatusCode::kOk, quota_status_); } void RevokeUsageCache() { @@ -823,7 +823,7 @@ GURL origin_; storage::FileSystemType type_; SandboxFileSystemTestHelper sandbox_file_system_; - storage::QuotaStatusCode quota_status_; + blink::QuotaStatusCode quota_status_; int64_t usage_; storage::MockFileChangeObserver change_observer_; storage::ChangeObserverList change_observers_;
diff --git a/storage/browser/fileapi/quota/quota_backend_impl.cc b/storage/browser/fileapi/quota/quota_backend_impl.cc index 668a40d..e777687c9 100644 --- a/storage/browser/fileapi/quota/quota_backend_impl.cc +++ b/storage/browser/fileapi/quota/quota_backend_impl.cc
@@ -106,14 +106,14 @@ void QuotaBackendImpl::DidGetUsageAndQuotaForReserveQuota( const QuotaReservationInfo& info, const ReserveQuotaCallback& callback, - storage::QuotaStatusCode status, + blink::QuotaStatusCode status, int64_t usage, int64_t quota) { DCHECK(file_task_runner_->RunsTasksInCurrentSequence()); DCHECK(info.origin.is_valid()); DCHECK_LE(0, usage); DCHECK_LE(0, quota); - if (status != storage::kQuotaStatusOk) { + if (status != blink::QuotaStatusCode::kOk) { callback.Run(base::File::FILE_ERROR_FAILED, 0); return; }
diff --git a/storage/browser/fileapi/quota/quota_backend_impl.h b/storage/browser/fileapi/quota/quota_backend_impl.h index 66c69744..ed364bd6 100644 --- a/storage/browser/fileapi/quota/quota_backend_impl.h +++ b/storage/browser/fileapi/quota/quota_backend_impl.h
@@ -13,7 +13,7 @@ #include "storage/browser/fileapi/quota/quota_reservation_manager.h" #include "storage/browser/fileapi/sandbox_file_system_backend_delegate.h" #include "storage/browser/storage_browser_export.h" -#include "storage/common/quota/quota_status_code.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" namespace base { class SequencedTaskRunner; @@ -75,7 +75,7 @@ void DidGetUsageAndQuotaForReserveQuota(const QuotaReservationInfo& info, const ReserveQuotaCallback& callback, - storage::QuotaStatusCode status, + blink::QuotaStatusCode status, int64_t usage, int64_t quota);
diff --git a/storage/browser/fileapi/quota/quota_backend_impl_unittest.cc b/storage/browser/fileapi/quota/quota_backend_impl_unittest.cc index 83b3281d..323c789 100644 --- a/storage/browser/fileapi/quota/quota_backend_impl_unittest.cc +++ b/storage/browser/fileapi/quota/quota_backend_impl_unittest.cc
@@ -72,7 +72,7 @@ const GURL& origin, storage::StorageType type, const UsageAndQuotaCallback& callback) override { - callback.Run(storage::kQuotaStatusOk, usage_, quota_); + callback.Run(blink::QuotaStatusCode::kOk, usage_, quota_); } int storage_modified_count() { return storage_modified_count_; }
diff --git a/storage/browser/fileapi/sandbox_file_stream_writer.cc b/storage/browser/fileapi/sandbox_file_stream_writer.cc index 0f4895d5c..4b09e38 100644 --- a/storage/browser/fileapi/sandbox_file_stream_writer.cc +++ b/storage/browser/fileapi/sandbox_file_stream_writer.cc
@@ -169,13 +169,13 @@ void SandboxFileStreamWriter::DidGetUsageAndQuota( const net::CompletionCallback& callback, - storage::QuotaStatusCode status, + blink::QuotaStatusCode status, int64_t usage, int64_t quota) { if (CancelIfRequested()) return; - if (status != storage::kQuotaStatusOk) { - LOG(WARNING) << "Got unexpected quota error : " << status; + if (status != blink::QuotaStatusCode::kOk) { + LOG(WARNING) << "Got unexpected quota error : " << static_cast<int>(status); // crbug.com/349708 TRACE_EVENT0("io", "SandboxFileStreamWriter::DidGetUsageAndQuota FAILED");
diff --git a/storage/browser/fileapi/sandbox_file_stream_writer.h b/storage/browser/fileapi/sandbox_file_stream_writer.h index 31e46d9..8b20b0b 100644 --- a/storage/browser/fileapi/sandbox_file_stream_writer.h +++ b/storage/browser/fileapi/sandbox_file_stream_writer.h
@@ -18,7 +18,7 @@ #include "storage/browser/fileapi/task_runner_bound_observer_list.h" #include "storage/browser/storage_browser_export.h" #include "storage/common/fileapi/file_system_types.h" -#include "storage/common/quota/quota_types.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" #include "url/gurl.h" namespace storage { @@ -58,7 +58,7 @@ const base::FilePath& platform_path, scoped_refptr<storage::ShareableFileReference> file_ref); void DidGetUsageAndQuota(const net::CompletionCallback& callback, - storage::QuotaStatusCode status, + blink::QuotaStatusCode status, int64_t usage, int64_t quota); void DidInitializeForWrite(net::IOBuffer* buf, int buf_len,
diff --git a/storage/browser/quota/quota_callbacks.h b/storage/browser/quota/quota_callbacks.h index dd8a369..d868abe 100644 --- a/storage/browser/quota/quota_callbacks.h +++ b/storage/browser/quota/quota_callbacks.h
@@ -16,8 +16,8 @@ #include "base/callback.h" #include "base/containers/flat_map.h" #include "storage/browser/quota/quota_client.h" -#include "storage/common/quota/quota_status_code.h" #include "storage/common/quota/quota_types.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" class GURL; @@ -29,14 +29,15 @@ // Common callback types that are used throughout in the quota module. typedef base::Callback<void(int64_t usage, int64_t unlimited_usage)> GlobalUsageCallback; -typedef base::Callback<void(QuotaStatusCode status, int64_t quota)> +typedef base::Callback<void(blink::QuotaStatusCode status, int64_t quota)> QuotaCallback; typedef base::Callback<void(int64_t usage)> UsageCallback; typedef base::Callback<void(int64_t usage, base::flat_map<QuotaClient::ID, int64_t>)> UsageWithBreakdownCallback; -typedef base::Callback<void(QuotaStatusCode, int64_t)> AvailableSpaceCallback; -typedef base::Callback<void(QuotaStatusCode)> StatusCallback; +typedef base::Callback<void(blink::QuotaStatusCode, int64_t)> + AvailableSpaceCallback; +typedef base::Callback<void(blink::QuotaStatusCode)> StatusCallback; typedef base::Callback<void(const std::set<GURL>& origins, StorageType type)> GetOriginsCallback; typedef base::Callback<void(const UsageInfoEntries&)> GetUsageInfoCallback;
diff --git a/storage/browser/quota/quota_client.h b/storage/browser/quota/quota_client.h index 973f4ad7..9a29ab18 100644 --- a/storage/browser/quota/quota_client.h +++ b/storage/browser/quota/quota_client.h
@@ -14,6 +14,7 @@ #include "base/callback.h" #include "storage/browser/storage_browser_export.h" #include "storage/common/quota/quota_types.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" #include "url/gurl.h" namespace storage { @@ -27,7 +28,7 @@ typedef base::Callback<void(int64_t usage)> GetUsageCallback; typedef base::Callback<void(const std::set<GURL>& origins)> GetOriginsCallback; - typedef base::Callback<void(QuotaStatusCode status)> DeletionCallback; + typedef base::Callback<void(blink::QuotaStatusCode status)> DeletionCallback; virtual ~QuotaClient() {}
diff --git a/storage/browser/quota/quota_manager.cc b/storage/browser/quota/quota_manager.cc index ec301148..cdb5fc9a 100644 --- a/storage/browser/quota/quota_manager.cc +++ b/storage/browser/quota/quota_manager.cc
@@ -209,7 +209,7 @@ void DidGetUsageAndQuotaForWebApps( const QuotaManager::UsageAndQuotaCallback& callback, - QuotaStatusCode status, + blink::QuotaStatusCode status, int64_t usage, int64_t quota, base::flat_map<QuotaClient::ID, int64_t> usage_breakdown) { @@ -260,9 +260,9 @@ // Determine host_quota differently depending on type. if (is_unlimited_) { - SetDesiredHostQuota(barrier, kQuotaStatusOk, kNoLimit); + SetDesiredHostQuota(barrier, blink::QuotaStatusCode::kOk, kNoLimit); } else if (type_ == kStorageTypeSyncable) { - SetDesiredHostQuota(barrier, kQuotaStatusOk, + SetDesiredHostQuota(barrier, blink::QuotaStatusCode::kOk, kSyncableStorageDefaultHostQuota); } else if (type_ == kStorageTypePersistent) { manager()->GetPersistentHostQuota( @@ -276,7 +276,7 @@ void Aborted() override { weak_factory_.InvalidateWeakPtrs(); - callback_.Run(kQuotaErrorAbort, 0, 0, + callback_.Run(blink::QuotaStatusCode::kErrorAbort, 0, 0, base::flat_map<QuotaClient::ID, int64_t>()); DeleteSoon(); } @@ -292,7 +292,7 @@ host_usage_ + std::max(INT64_C(0), available_space_ - settings_.must_remain_available)); - callback_.Run(kQuotaStatusOk, host_usage_, host_quota, + callback_.Run(blink::QuotaStatusCode::kOk, host_usage_, host_quota, std::move(host_usage_breakdown_)); if (type_ == kStorageTypeTemporary && !is_incognito_ && !is_unlimited_) { UMA_HISTOGRAM_MBYTES("Quota.QuotaForOrigin", host_quota); @@ -317,7 +317,8 @@ int64_t host_quota = is_session_only_ ? settings.session_only_per_host_quota : settings.per_host_quota; - SetDesiredHostQuota(barrier_closure, kQuotaStatusOk, host_quota); + SetDesiredHostQuota(barrier_closure, blink::QuotaStatusCode::kOk, + host_quota); } } @@ -339,7 +340,7 @@ } void SetDesiredHostQuota(const base::Closure& barrier_closure, - QuotaStatusCode status, + blink::QuotaStatusCode status, int64_t quota) { desired_host_quota_ = quota; barrier_closure.Run(); @@ -389,15 +390,15 @@ void Aborted() override { weak_factory_.InvalidateWeakPtrs(); - callback_.Run(kQuotaErrorAbort, QuotaSettings(), 0, 0, 0, false); + callback_.Run(blink::QuotaStatusCode::kErrorAbort, QuotaSettings(), 0, 0, 0, + false); DeleteSoon(); } void Completed() override { weak_factory_.InvalidateWeakPtrs(); - callback_.Run(kQuotaStatusOk, settings_, - available_space_, total_space_, - global_usage_, global_usage_is_complete_); + callback_.Run(blink::QuotaStatusCode::kOk, settings_, available_space_, + total_space_, global_usage_, global_usage_is_complete_); DeleteSoon(); } @@ -578,26 +579,26 @@ // Only remove the entire origin if we didn't skip any client types. if (skipped_clients_ == 0) manager()->DeleteOriginFromDatabase(origin_, type_, is_eviction_); - callback_.Run(kQuotaStatusOk); + callback_.Run(blink::QuotaStatusCode::kOk); } else { // crbug.com/349708 TRACE_EVENT0("io", "QuotaManager::OriginDataDeleter::Completed Error"); - callback_.Run(kQuotaErrorInvalidModification); + callback_.Run(blink::QuotaStatusCode::kErrorInvalidModification); } DeleteSoon(); } void Aborted() override { - callback_.Run(kQuotaErrorAbort); + callback_.Run(blink::QuotaStatusCode::kErrorAbort); DeleteSoon(); } private: - void DidDeleteOriginData(QuotaStatusCode status) { + void DidDeleteOriginData(blink::QuotaStatusCode status) { DCHECK_GT(remaining_clients_, 0); - if (status != kQuotaStatusOk) + if (status != blink::QuotaStatusCode::kOk) ++error_count_; if (--remaining_clients_ == 0) @@ -656,18 +657,18 @@ // crbug.com/349708 TRACE_EVENT0("io", "QuotaManager::HostDataDeleter::Completed Ok"); - callback_.Run(kQuotaStatusOk); + callback_.Run(blink::QuotaStatusCode::kOk); } else { // crbug.com/349708 TRACE_EVENT0("io", "QuotaManager::HostDataDeleter::Completed Error"); - callback_.Run(kQuotaErrorInvalidModification); + callback_.Run(blink::QuotaStatusCode::kErrorInvalidModification); } DeleteSoon(); } void Aborted() override { - callback_.Run(kQuotaErrorAbort); + callback_.Run(blink::QuotaStatusCode::kErrorAbort); DeleteSoon(); } @@ -698,10 +699,10 @@ } } - void DidDeleteOriginData(QuotaStatusCode status) { + void DidDeleteOriginData(blink::QuotaStatusCode status) { DCHECK_GT(remaining_deleters_, 0); - if (status != kQuotaStatusOk) + if (status != blink::QuotaStatusCode::kOk) ++error_count_; if (--remaining_deleters_ == 0) @@ -868,7 +869,7 @@ DCHECK(origin == origin.GetOrigin()); if (!IsSupportedType(type) || (is_incognito_ && !IsSupportedIncognitoType(type))) { - callback.Run(kQuotaErrorNotSupported, 0, 0, + callback.Run(blink::QuotaStatusCode::kErrorNotSupported, 0, 0, base::flat_map<QuotaClient::ID, int64_t>()); return; } @@ -891,7 +892,7 @@ if (IsStorageUnlimited(origin, type)) { // TODO(michaeln): This seems like a non-obvious odd behavior, probably for // apps/extensions, but it would be good to eliminate this special case. - callback.Run(kQuotaStatusOk, 0, kNoLimit); + callback.Run(blink::QuotaStatusCode::kOk, 0, kNoLimit); return; } @@ -949,7 +950,7 @@ const StatusCallback& callback) { LazyInitialize(); if (host.empty() || clients_.empty()) { - callback.Run(kQuotaStatusOk); + callback.Run(blink::QuotaStatusCode::kOk); return; } @@ -965,7 +966,7 @@ // This could happen if we are called on file:///. // TODO(kinuko) We may want to respect --allow-file-access-from-files // command line switch. - callback.Run(kQuotaStatusOk, 0); + callback.Run(blink::QuotaStatusCode::kOk, 0); return; } @@ -990,12 +991,12 @@ LazyInitialize(); if (host.empty()) { // This could happen if we are called on file:///. - callback.Run(kQuotaErrorNotSupported, 0); + callback.Run(blink::QuotaStatusCode::kErrorNotSupported, 0); return; } if (new_quota < 0) { - callback.Run(kQuotaErrorInvalidModification, -1); + callback.Run(blink::QuotaStatusCode::kErrorInvalidModification, -1); return; } @@ -1003,7 +1004,7 @@ new_quota = std::min(new_quota, kPerHostPersistentQuotaLimit); if (db_disabled_) { - callback.Run(kQuotaErrorInvalidAccess, -1); + callback.Run(blink::QuotaStatusCode::kErrorInvalidAccess, -1); return; } @@ -1333,14 +1334,14 @@ base::Bind(&QuotaManager::DidDatabaseWork, weak_factory_.GetWeakPtr())); } -void QuotaManager::DidOriginDataEvicted(QuotaStatusCode status) { +void QuotaManager::DidOriginDataEvicted(blink::QuotaStatusCode status) { DCHECK(io_thread_->BelongsToCurrentThread()); // We only try evict origins that are not in use, so basically // deletion attempt for eviction should not fail. Let's record // the origin if we get error and exclude it from future eviction // if the error happens consistently (> kThresholdOfErrorsToBeBlacklisted). - if (status != kQuotaStatusOk) + if (status != blink::QuotaStatusCode::kOk) origins_in_error_[eviction_context_.evicted_origin]++; eviction_context_.evict_origin_data_callback.Run(status); @@ -1355,7 +1356,7 @@ LazyInitialize(); if (origin.is_empty() || clients_.empty()) { - callback.Run(kQuotaStatusOk); + callback.Run(blink::QuotaStatusCode::kOk); return; } @@ -1563,7 +1564,8 @@ bool success) { DidDatabaseWork(success); persistent_host_quota_callbacks_.Run( - host, kQuotaStatusOk, std::min(*quota, kPerHostPersistentQuotaLimit)); + host, blink::QuotaStatusCode::kOk, + std::min(*quota, kPerHostPersistentQuotaLimit)); } void QuotaManager::DidSetPersistentHostQuota(const std::string& host, @@ -1571,7 +1573,9 @@ const int64_t* new_quota, bool success) { DidDatabaseWork(success); - callback.Run(success ? kQuotaStatusOk : kQuotaErrorInvalidAccess, *new_quota); + callback.Run(success ? blink::QuotaStatusCode::kOk + : blink::QuotaStatusCode::kErrorInvalidAccess, + *new_quota); } void QuotaManager::DidGetLRUOrigin(const GURL* origin,
diff --git a/storage/browser/quota/quota_manager.h b/storage/browser/quota/quota_manager.h index 1e9d545d..f17e9b6 100644 --- a/storage/browser/quota/quota_manager.h +++ b/storage/browser/quota/quota_manager.h
@@ -32,6 +32,7 @@ #include "storage/browser/quota/special_storage_policy.h" #include "storage/browser/quota/storage_observer.h" #include "storage/browser/storage_browser_export.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" namespace base { class FilePath; @@ -66,7 +67,7 @@ class STORAGE_EXPORT QuotaEvictionHandler { public: using EvictionRoundInfoCallback = - base::Callback<void(QuotaStatusCode status, + base::Callback<void(blink::QuotaStatusCode status, const QuotaSettings& settings, int64_t available_space, int64_t total_space, @@ -112,10 +113,10 @@ public base::RefCountedThreadSafe<QuotaManager, QuotaManagerDeleter> { public: typedef base::Callback< - void(QuotaStatusCode, int64_t /* usage */, int64_t /* quota */)> + void(blink::QuotaStatusCode, int64_t /* usage */, int64_t /* quota */)> UsageAndQuotaCallback; typedef base::Callback<void( - QuotaStatusCode, + blink::QuotaStatusCode, int64_t /* usage */, int64_t /* quota */, base::flat_map<QuotaClient::ID, int64_t> /* usage breakdown */)> @@ -297,7 +298,10 @@ DumpOriginInfoTableCallback; typedef CallbackQueue<base::Closure> ClosureQueue; - typedef CallbackQueueMap<QuotaCallback, std::string, QuotaStatusCode, int64_t> + typedef CallbackQueueMap<QuotaCallback, + std::string, + blink::QuotaStatusCode, + int64_t> HostQuotaCallbackMap; using QuotaSettingsCallbackQueue = CallbackQueue<QuotaSettingsCallback, const QuotaSettings&>; @@ -366,7 +370,7 @@ StorageType type, bool is_eviction); - void DidOriginDataEvicted(QuotaStatusCode status); + void DidOriginDataEvicted(blink::QuotaStatusCode status); void ReportHistogram(); void DidGetTemporaryGlobalUsageForHistogram(int64_t usage,
diff --git a/storage/browser/quota/quota_manager_proxy.cc b/storage/browser/quota/quota_manager_proxy.cc index 40655bfe..219709e7 100644 --- a/storage/browser/quota/quota_manager_proxy.cc +++ b/storage/browser/quota/quota_manager_proxy.cc
@@ -13,6 +13,7 @@ #include "base/strings/string_number_conversions.h" #include "base/task_runner_util.h" #include "base/trace_event/trace_event.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" namespace storage { @@ -21,7 +22,7 @@ void DidGetUsageAndQuota( base::SequencedTaskRunner* original_task_runner, const QuotaManagerProxy::UsageAndQuotaCallback& callback, - QuotaStatusCode status, + blink::QuotaStatusCode status, int64_t usage, int64_t quota) { if (!original_task_runner->RunsTasksInCurrentSequence()) { @@ -139,7 +140,8 @@ return; } if (!manager_) { - DidGetUsageAndQuota(original_task_runner, callback, kQuotaErrorAbort, 0, 0); + DidGetUsageAndQuota(original_task_runner, callback, + blink::QuotaStatusCode::kErrorAbort, 0, 0); return; }
diff --git a/storage/browser/quota/quota_manager_unittest.cc b/storage/browser/quota/quota_manager_unittest.cc index 67d9c0c..6b142ced 100644 --- a/storage/browser/quota/quota_manager_unittest.cc +++ b/storage/browser/quota/quota_manager_unittest.cc
@@ -33,18 +33,13 @@ #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" -using storage::kQuotaErrorAbort; -using storage::kQuotaErrorInvalidModification; -using storage::kQuotaErrorNotSupported; -using storage::kQuotaStatusOk; -using storage::kQuotaStatusUnknown; using storage::kStorageTypePersistent; using storage::kStorageTypeSyncable; using storage::kStorageTypeTemporary; using storage::kStorageTypeUnknown; using storage::QuotaClient; using storage::QuotaManager; -using storage::QuotaStatusCode; +using blink::QuotaStatusCode; using storage::StorageType; using storage::UsageInfo; using storage::UsageInfoEntries; @@ -143,7 +138,7 @@ void GetUsageAndQuotaForWebApps(const GURL& origin, StorageType type) { - quota_status_ = kQuotaStatusUnknown; + quota_status_ = QuotaStatusCode::kUnknown; usage_ = -1; quota_ = -1; quota_manager_->GetUsageAndQuotaForWebApps( @@ -152,7 +147,7 @@ } void GetUsageAndQuotaWithBreakdown(const GURL& origin, StorageType type) { - quota_status_ = kQuotaStatusUnknown; + quota_status_ = QuotaStatusCode::kUnknown; usage_ = -1; quota_ = -1; usage_breakdown_.clear(); @@ -164,7 +159,7 @@ void GetUsageAndQuotaForStorageClient(const GURL& origin, StorageType type) { - quota_status_ = kQuotaStatusUnknown; + quota_status_ = QuotaStatusCode::kUnknown; usage_ = -1; quota_ = -1; quota_manager_->GetUsageAndQuota( @@ -186,7 +181,7 @@ } void GetPersistentHostQuota(const std::string& host) { - quota_status_ = kQuotaStatusUnknown; + quota_status_ = QuotaStatusCode::kUnknown; quota_ = -1; quota_manager_->GetPersistentHostQuota( host, @@ -195,7 +190,7 @@ } void SetPersistentHostQuota(const std::string& host, int64_t new_quota) { - quota_status_ = kQuotaStatusUnknown; + quota_status_ = QuotaStatusCode::kUnknown; quota_ = -1; quota_manager_->SetPersistentHostQuota( host, new_quota, @@ -239,7 +234,7 @@ const GURL& origin, StorageType type) { DCHECK(client); - quota_status_ = kQuotaStatusUnknown; + quota_status_ = QuotaStatusCode::kUnknown; client->DeleteOriginData( origin, type, base::Bind(&QuotaManagerTest::StatusCallback, @@ -248,7 +243,7 @@ void EvictOriginData(const GURL& origin, StorageType type) { - quota_status_ = kQuotaStatusUnknown; + quota_status_ = QuotaStatusCode::kUnknown; quota_manager_->EvictOriginData( origin, type, base::Bind(&QuotaManagerTest::StatusCallback, @@ -258,7 +253,7 @@ void DeleteOriginData(const GURL& origin, StorageType type, int quota_client_mask) { - quota_status_ = kQuotaStatusUnknown; + quota_status_ = QuotaStatusCode::kUnknown; quota_manager_->DeleteOriginData( origin, type, quota_client_mask, base::Bind(&QuotaManagerTest::StatusCallback, @@ -268,7 +263,7 @@ void DeleteHostData(const std::string& host, StorageType type, int quota_client_mask) { - quota_status_ = kQuotaStatusUnknown; + quota_status_ = QuotaStatusCode::kUnknown; quota_manager_->DeleteHostData( host, type, quota_client_mask, base::Bind(&QuotaManagerTest::StatusCallback, @@ -283,7 +278,7 @@ } void GetEvictionRoundInfo() { - quota_status_ = kQuotaStatusUnknown; + quota_status_ = QuotaStatusCode::kUnknown; settings_ = storage::QuotaSettings(); available_space_ = -1; total_space_ = -1; @@ -570,20 +565,20 @@ GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kPerm); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(80, usage()); EXPECT_EQ(0, quota()); GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(10, usage()); EXPECT_LE(0, quota()); int64_t quota_returned_for_foo = quota(); GetUsageAndQuotaForWebApps(GURL("http://bar.com/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(0, usage()); EXPECT_EQ(quota_returned_for_foo, quota()); } @@ -591,12 +586,12 @@ TEST_F(QuotaManagerTest, GetUsage_NoClient) { GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(0, usage()); GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kPerm); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(0, usage()); GetHostUsage("foo.com", kTemp); @@ -622,12 +617,12 @@ RegisterClient(CreateClient(NULL, 0, QuotaClient::kFileSystem)); GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(0, usage()); GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kPerm); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(0, usage()); GetHostUsage("foo.com", kTemp); @@ -668,7 +663,7 @@ GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(10 + 20, usage()); // The host's quota should be its full portion of the global quota @@ -677,7 +672,7 @@ GetUsageAndQuotaForWebApps(GURL("http://bar.com/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(5 + 7, usage()); EXPECT_EQ(kPerHostQuota, quota()); } @@ -706,37 +701,37 @@ GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(1 + 128, usage()); EXPECT_EQ(kPerHostQuota, quota()); GetUsageAndQuotaForWebApps(GURL("http://bar.com/"), kPerm); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(4, usage()); EXPECT_EQ(0, quota()); GetUsageAndQuotaForWebApps(GURL("http://unlimited/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(512, usage()); EXPECT_EQ(kAvailableSpaceForApp + usage(), quota()); GetUsageAndQuotaForWebApps(GURL("http://unlimited/"), kPerm); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(8, usage()); EXPECT_EQ(kAvailableSpaceForApp + usage(), quota()); GetGlobalUsage(kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(1 + 2 + 128 + 512, usage()); EXPECT_EQ(512, unlimited_usage()); GetGlobalUsage(kPerm); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(4 + 8 + 256, usage()); EXPECT_EQ(8, unlimited_usage()); } @@ -764,7 +759,7 @@ GetUsageAndQuotaWithBreakdown(GURL("http://foo.com/"), kPerm); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(80, usage()); usage_breakdown_expected[QuotaClient::kFileSystem] = 80; usage_breakdown_expected[QuotaClient::kDatabase] = 0; @@ -773,7 +768,7 @@ GetUsageAndQuotaWithBreakdown(GURL("http://foo.com/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(1 + 4 + 8, usage()); usage_breakdown_expected[QuotaClient::kFileSystem] = 1; usage_breakdown_expected[QuotaClient::kDatabase] = 4; @@ -782,7 +777,7 @@ GetUsageAndQuotaWithBreakdown(GURL("http://bar.com/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(0, usage()); usage_breakdown_expected[QuotaClient::kFileSystem] = 0; usage_breakdown_expected[QuotaClient::kDatabase] = 0; @@ -795,13 +790,13 @@ GetUsageAndQuotaWithBreakdown(GURL("http://foo.com/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(0, usage()); EXPECT_EQ(usage_breakdown_expected, usage_breakdown()); GetUsageAndQuotaWithBreakdown(GURL("http://foo.com/"), kPerm); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(0, usage()); EXPECT_EQ(usage_breakdown_expected, usage_breakdown()); @@ -828,14 +823,14 @@ GetUsageAndQuotaWithBreakdown(GURL("http://foo.com/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(10 + 20, usage()); usage_breakdown_expected[QuotaClient::kFileSystem] = 10 + 20; EXPECT_EQ(usage_breakdown_expected, usage_breakdown()); GetUsageAndQuotaWithBreakdown(GURL("http://bar.com/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(5 + 7, usage()); usage_breakdown_expected[QuotaClient::kFileSystem] = 5 + 7; EXPECT_EQ(usage_breakdown_expected, usage_breakdown()); @@ -862,7 +857,7 @@ GetUsageAndQuotaWithBreakdown(GURL("http://foo.com/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(1 + 128, usage()); usage_breakdown_expected[QuotaClient::kFileSystem] = 1; usage_breakdown_expected[QuotaClient::kDatabase] = 128; @@ -870,7 +865,7 @@ GetUsageAndQuotaWithBreakdown(GURL("http://bar.com/"), kPerm); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(4, usage()); usage_breakdown_expected[QuotaClient::kFileSystem] = 4; usage_breakdown_expected[QuotaClient::kDatabase] = 0; @@ -878,7 +873,7 @@ GetUsageAndQuotaWithBreakdown(GURL("http://unlimited/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(512, usage()); usage_breakdown_expected[QuotaClient::kFileSystem] = 0; usage_breakdown_expected[QuotaClient::kDatabase] = 512; @@ -886,7 +881,7 @@ GetUsageAndQuotaWithBreakdown(GURL("http://unlimited/"), kPerm); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(8, usage()); usage_breakdown_expected[QuotaClient::kFileSystem] = 8; usage_breakdown_expected[QuotaClient::kDatabase] = 0; @@ -904,7 +899,7 @@ GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), type); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(10 + 20, usage()); client->ModifyOriginAndNotify(GURL("http://foo.com/"), type, 30); @@ -913,14 +908,14 @@ GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), type); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(10 + 20 + 30 - 5 + 1, usage()); int foo_usage = usage(); client->AddOriginAndNotify(GURL("http://bar.com/"), type, 40); GetUsageAndQuotaForWebApps(GURL("http://bar.com/"), type); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(40, usage()); GetGlobalUsage(type); @@ -951,7 +946,7 @@ GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kTemp); GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(10 + 20, usage()); EXPECT_EQ(kPerHostQuota, quota()); @@ -961,7 +956,7 @@ GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kTemp); RunAdditionalUsageAndQuotaTask(GURL("http://bar.com/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(10 + 20, usage()); EXPECT_EQ(kPerHostQuota, quota()); EXPECT_EQ(2, additional_callback_count()); @@ -993,7 +988,7 @@ // Nuke before waiting for callbacks. set_quota_manager(NULL); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaErrorAbort, status()); + EXPECT_EQ(QuotaStatusCode::kErrorAbort, status()); } TEST_F(QuotaManagerTest, GetTemporaryUsageAndQuota_Overbudget) { @@ -1017,19 +1012,19 @@ GetUsageAndQuotaForWebApps(GURL("http://usage1/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(1, usage()); EXPECT_EQ(kPerHostQuota, quota()); GetUsageAndQuotaForWebApps(GURL("http://usage10/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(10, usage()); EXPECT_EQ(kPerHostQuota, quota()); GetUsageAndQuotaForWebApps(GURL("http://usage200/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(200, usage()); EXPECT_EQ(kPerHostQuota, quota()); // should be clamped to the nominal quota } @@ -1056,25 +1051,25 @@ GetUsageAndQuotaForWebApps(GURL("http://usage10/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(10, usage()); EXPECT_EQ(kPerHostQuotaFor1000, quota()); GetUsageAndQuotaForWebApps(GURL("http://usage50/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(50, usage()); EXPECT_EQ(kPerHostQuotaFor1000, quota()); GetUsageAndQuotaForWebApps(GURL("http://unlimited/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(4000, usage()); EXPECT_EQ(kAvailableSpaceForApp + usage(), quota()); GetUsageAndQuotaForStorageClient(GURL("http://unlimited/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(0, usage()); EXPECT_EQ(QuotaManager::kNoLimit, quota()); @@ -1084,25 +1079,25 @@ GetUsageAndQuotaForWebApps(GURL("http://usage10/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(10, usage()); EXPECT_EQ(kPerHostQuotaFor100, quota()); GetUsageAndQuotaForWebApps(GURL("http://usage50/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(50, usage()); EXPECT_EQ(kPerHostQuotaFor100, quota()); GetUsageAndQuotaForWebApps(GURL("http://unlimited/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(4000, usage()); EXPECT_EQ(kAvailableSpaceForApp + usage(), quota()); GetUsageAndQuotaForStorageClient(GURL("http://unlimited/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(0, usage()); EXPECT_EQ(QuotaManager::kNoLimit, quota()); @@ -1117,25 +1112,25 @@ GetUsageAndQuotaForWebApps(GURL("http://usage10/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(10, usage()); EXPECT_EQ(kPerHostQuotaFor100, quota()); GetUsageAndQuotaForWebApps(GURL("http://usage50/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(50, usage()); EXPECT_EQ(kPerHostQuotaFor100, quota()); GetUsageAndQuotaForWebApps(GURL("http://unlimited/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(4000, usage()); EXPECT_EQ(kPerHostQuotaFor100, quota()); GetUsageAndQuotaForStorageClient(GURL("http://unlimited/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(4000, usage()); EXPECT_EQ(kPerHostQuotaFor100, quota()); } @@ -1194,14 +1189,14 @@ GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kPerm); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(0, usage()); EXPECT_EQ(0, quota()); SetPersistentHostQuota("foo.com", 100); GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kPerm); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(0, usage()); EXPECT_EQ(100, quota()); @@ -1232,7 +1227,7 @@ mock_special_storage_policy()->AddUnlimited(GURL("http://unlimited/")); GetUsageAndQuotaForWebApps(GURL("http://unlimited/"), kSync); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(0, usage()); EXPECT_EQ(kAvailableSpaceForApp, quota()); } @@ -1254,7 +1249,7 @@ SetPersistentHostQuota("foo.com", 100); GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kPerm); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(10 + 20 + 13 + 19, usage()); EXPECT_EQ(100, quota()); } @@ -1278,7 +1273,7 @@ GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kPerm); GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kPerm); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(10 + 20, usage()); EXPECT_EQ(100, quota()); @@ -1288,7 +1283,7 @@ GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kPerm); RunAdditionalUsageAndQuotaTask(GURL("http://bar.com/"), kPerm); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(10 + 20, usage()); EXPECT_EQ(2, additional_callback_count()); } @@ -1312,7 +1307,7 @@ // Nuke before waiting for callbacks. set_quota_manager(NULL); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaErrorAbort, status()); + EXPECT_EQ(QuotaStatusCode::kErrorAbort, status()); } TEST_F(QuotaManagerTest, GetUsage_Simple) { @@ -1426,7 +1421,7 @@ DeleteClientOriginData(client, GURL("http://foo.com/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); GetGlobalUsage(kTemp); scoped_task_environment_.RunUntilIdle(); @@ -1617,7 +1612,7 @@ ++i) { EvictOriginData(GURL("http://foo.com/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaErrorInvalidModification, status()); + EXPECT_EQ(QuotaStatusCode::kErrorInvalidModification, status()); } DumpOriginInfoTable(); @@ -1685,7 +1680,7 @@ GetEvictionRoundInfo(); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(21, usage()); EXPECT_EQ(kPoolSize, settings().pool_size); EXPECT_LE(0, available_space()); @@ -1713,7 +1708,7 @@ DeleteHostData(std::string(), kTemp, kAllClients); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); GetGlobalUsage(kTemp); scoped_task_environment_.RunUntilIdle(); @@ -1729,7 +1724,7 @@ DeleteHostData("foo.com", kTemp, kAllClients); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); GetGlobalUsage(kTemp); scoped_task_environment_.RunUntilIdle(); @@ -2190,12 +2185,12 @@ TEST_F(QuotaManagerTest, QuotaForEmptyHost) { GetPersistentHostQuota(std::string()); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(0, quota()); SetPersistentHostQuota(std::string(), 10); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaErrorNotSupported, status()); + EXPECT_EQ(QuotaStatusCode::kErrorNotSupported, status()); } TEST_F(QuotaManagerTest, DeleteSpecificClientTypeSingleOrigin) { @@ -2416,7 +2411,7 @@ GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kPerm); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(80, usage()); EXPECT_EQ(0, quota()); @@ -2431,20 +2426,20 @@ GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(10, usage()); EXPECT_LE(kPerHostQuota, quota()); mock_special_storage_policy()->AddUnlimited(GURL("http://foo.com/")); GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kPerm); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(80, usage()); EXPECT_EQ(available_space() + usage(), quota()); GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kTemp); scoped_task_environment_.RunUntilIdle(); - EXPECT_EQ(kQuotaStatusOk, status()); + EXPECT_EQ(QuotaStatusCode::kOk, status()); EXPECT_EQ(10, usage()); EXPECT_EQ(available_space() + usage(), quota()); }
diff --git a/storage/browser/quota/quota_temporary_storage_evictor.cc b/storage/browser/quota/quota_temporary_storage_evictor.cc index f236621..c4c13fc4 100644 --- a/storage/browser/quota/quota_temporary_storage_evictor.cc +++ b/storage/browser/quota/quota_temporary_storage_evictor.cc
@@ -164,7 +164,7 @@ } void QuotaTemporaryStorageEvictor::OnGotEvictionRoundInfo( - QuotaStatusCode status, + blink::QuotaStatusCode status, const QuotaSettings& settings, int64_t available_space, int64_t total_space, @@ -175,7 +175,7 @@ // Note: if there is no storage pressure, |current_usage| // may not be fully calculated and may be 0. - if (status != kQuotaStatusOk) + if (status != blink::QuotaStatusCode::kOk) ++statistics_.num_errors_on_getting_usage_and_quota; int64_t usage_overage = std::max( @@ -203,7 +203,7 @@ round_statistics_.usage_on_end_of_round = current_usage; int64_t amount_to_evict = std::max(usage_overage, diskspace_shortage); - if (status == kQuotaStatusOk && amount_to_evict > 0) { + if (status == blink::QuotaStatusCode::kOk && amount_to_evict > 0) { // Space is getting tight. Get the least recently used origin and continue. // TODO(michaeln): if the reason for eviction is low physical disk space, // make 'unlimited' origins subject to eviction too. @@ -246,7 +246,7 @@ } void QuotaTemporaryStorageEvictor::OnEvictionComplete( - QuotaStatusCode status) { + blink::QuotaStatusCode status) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); // Just calling ConsiderEviction() or StartEvictionTimerWithDelay() here is @@ -255,7 +255,7 @@ // origin permanently. The evictor skips origins which had deletion errors // a few times. - if (status == kQuotaStatusOk) { + if (status == blink::QuotaStatusCode::kOk) { ++statistics_.num_evicted_origins; ++round_statistics_.num_evicted_origins_in_round; // We many need to get rid of more space so reconsider immediately.
diff --git a/storage/browser/quota/quota_temporary_storage_evictor.h b/storage/browser/quota/quota_temporary_storage_evictor.h index 42d3e14..45e9c0cf 100644 --- a/storage/browser/quota/quota_temporary_storage_evictor.h +++ b/storage/browser/quota/quota_temporary_storage_evictor.h
@@ -16,7 +16,7 @@ #include "base/sequence_checker.h" #include "base/timer/timer.h" #include "storage/browser/storage_browser_export.h" -#include "storage/common/quota/quota_types.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" class GURL; @@ -83,14 +83,14 @@ void StartEvictionTimerWithDelay(int delay_ms); void ConsiderEviction(); - void OnGotEvictionRoundInfo(QuotaStatusCode status, + void OnGotEvictionRoundInfo(blink::QuotaStatusCode status, const QuotaSettings& settings, int64_t available_space, int64_t total_space, int64_t current_usage, bool current_usage_is_complete); void OnGotEvictionOrigin(const GURL& origin); - void OnEvictionComplete(QuotaStatusCode status); + void OnEvictionComplete(blink::QuotaStatusCode status); void OnEvictionRoundStarted(); void OnEvictionRoundFinished();
diff --git a/storage/browser/quota/quota_temporary_storage_evictor_unittest.cc b/storage/browser/quota/quota_temporary_storage_evictor_unittest.cc index f8a1cc8..d7d5193 100644 --- a/storage/browser/quota/quota_temporary_storage_evictor_unittest.cc +++ b/storage/browser/quota/quota_temporary_storage_evictor_unittest.cc
@@ -40,25 +40,25 @@ StorageType type, const storage::StatusCallback& callback) override { if (error_on_evict_origin_data_) { - callback.Run(storage::kQuotaErrorInvalidModification); + callback.Run(blink::QuotaStatusCode::kErrorInvalidModification); return; } int64_t origin_usage = EnsureOriginRemoved(origin); if (origin_usage >= 0) available_space_ += origin_usage; - callback.Run(storage::kQuotaStatusOk); + callback.Run(blink::QuotaStatusCode::kOk); } void GetEvictionRoundInfo( const EvictionRoundInfoCallback& callback) override { if (error_on_get_usage_and_quota_) { - callback.Run(storage::kQuotaErrorAbort, storage::QuotaSettings(), 0, 0, - 0, false); + callback.Run(blink::QuotaStatusCode::kErrorAbort, + storage::QuotaSettings(), 0, 0, 0, false); return; } if (!task_for_get_usage_and_quota_.is_null()) task_for_get_usage_and_quota_.Run(); - callback.Run(storage::kQuotaStatusOk, settings_, available_space_, + callback.Run(blink::QuotaStatusCode::kOk, settings_, available_space_, available_space_ * 2, GetUsage(), true); }
diff --git a/storage/browser/quota/storage_monitor.cc b/storage/browser/quota/storage_monitor.cc index a24bc5e..0e14400 100644 --- a/storage/browser/quota/storage_monitor.cc +++ b/storage/browser/quota/storage_monitor.cc
@@ -12,7 +12,6 @@ #include "base/trace_event/trace_event.h" #include "net/base/url_util.h" #include "storage/browser/quota/quota_manager.h" -#include "storage/common/quota/quota_status_code.h" namespace storage { @@ -217,11 +216,11 @@ void HostStorageObservers::GotHostUsageAndQuota( const StorageObserver::Filter& filter, - QuotaStatusCode status, + blink::QuotaStatusCode status, int64_t usage, int64_t quota) { initializing_ = false; - if (status != kQuotaStatusOk) + if (status != blink::QuotaStatusCode::kOk) return; initialized_ = true; cached_quota_ = quota;
diff --git a/storage/browser/quota/storage_monitor.h b/storage/browser/quota/storage_monitor.h index 85e3e3d..95d447d 100644 --- a/storage/browser/quota/storage_monitor.h +++ b/storage/browser/quota/storage_monitor.h
@@ -15,6 +15,7 @@ #include "base/time/time.h" #include "base/timer/timer.h" #include "storage/browser/quota/storage_observer.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" namespace content { class StorageMonitorTestBase; @@ -95,7 +96,7 @@ private: void StartInitialization(const StorageObserver::Filter& filter); void GotHostUsageAndQuota(const StorageObserver::Filter& filter, - QuotaStatusCode status, + blink::QuotaStatusCode status, int64_t usage, int64_t quota); void DispatchEvent(const StorageObserver::Filter& filter, bool is_update);
diff --git a/storage/browser/quota/storage_monitor_unittest.cc b/storage/browser/quota/storage_monitor_unittest.cc index 23f185f..12f6585ce 100644 --- a/storage/browser/quota/storage_monitor_unittest.cc +++ b/storage/browser/quota/storage_monitor_unittest.cc
@@ -20,14 +20,12 @@ #include "storage/browser/test/mock_storage_client.h" #include "testing/gtest/include/gtest/gtest.h" +using blink::QuotaStatusCode; using storage::HostStorageObservers; -using storage::kQuotaErrorNotSupported; -using storage::kQuotaStatusOk; using storage::kStorageTypePersistent; using storage::kStorageTypeTemporary; using storage::QuotaClient; using storage::QuotaManager; -using storage::QuotaStatusCode; using storage::SpecialStoragePolicy; using storage::StorageMonitor; using storage::StorageObserver; @@ -73,7 +71,7 @@ storage::GetQuotaSettingsFunc()), callback_usage_(0), callback_quota_(0), - callback_status_(kQuotaStatusOk), + callback_status_(QuotaStatusCode::kOk), initialized_(false) {} void SetCallbackParams(int64_t usage, int64_t quota, QuotaStatusCode status) { @@ -322,7 +320,7 @@ false); const int64_t kUsage = 324554; const int64_t kQuota = 234354354; - quota_manager_->SetCallbackParams(kUsage, kQuota, kQuotaStatusOk); + quota_manager_->SetCallbackParams(kUsage, kQuota, QuotaStatusCode::kOk); MockObserver mock_observer; HostStorageObservers host_observers(quota_manager_.get()); @@ -350,7 +348,7 @@ TEST_F(HostStorageObserversTest, InitializeOnObserver) { const int64_t kUsage = 74387; const int64_t kQuota = 92834743; - quota_manager_->SetCallbackParams(kUsage, kQuota, kQuotaStatusOk); + quota_manager_->SetCallbackParams(kUsage, kQuota, QuotaStatusCode::kOk); HostStorageObservers host_observers(quota_manager_.get()); // |host_observers| should not be initialized after the first observer is @@ -408,7 +406,7 @@ false); const int64_t kUsage = -324554; const int64_t kQuota = -234354354; - quota_manager_->SetCallbackParams(kUsage, kQuota, kQuotaStatusOk); + quota_manager_->SetCallbackParams(kUsage, kQuota, QuotaStatusCode::kOk); MockObserver mock_observer; HostStorageObservers host_observers(quota_manager_.get()); @@ -432,7 +430,8 @@ // Set up the quota manager to return an error status. const int64_t kUsage = 6656; const int64_t kQuota = 99585556; - quota_manager_->SetCallbackParams(kUsage, kQuota, kQuotaErrorNotSupported); + quota_manager_->SetCallbackParams(kUsage, kQuota, + QuotaStatusCode::kErrorNotSupported); // Verify that |host_observers| is not initialized and an event has not been // dispatched. @@ -443,7 +442,7 @@ EXPECT_EQ(0, GetRequiredUpdatesCount(host_observers)); // Now ensure that quota manager returns a good status. - quota_manager_->SetCallbackParams(kUsage, kQuota, kQuotaStatusOk); + quota_manager_->SetCallbackParams(kUsage, kQuota, QuotaStatusCode::kOk); host_observers.NotifyUsageChange(params.filter, 9048543); StorageObserver::Event expected_event(params.filter, kUsage, kQuota); EXPECT_EQ(1, mock_observer.EventCount()); @@ -482,7 +481,7 @@ EXPECT_EQ(0, GetRequiredUpdatesCount(host_observers)); // Simulate an asynchronous callback from QuotaManager. - quota_manager_->SetCallbackParams(kUsage, kQuota, kQuotaStatusOk); + quota_manager_->SetCallbackParams(kUsage, kQuota, QuotaStatusCode::kOk); quota_manager_->InvokeCallback(); StorageObserver::Event expected_event(params.filter, kUsage + kDelta, kQuota); EXPECT_EQ(1, mock_observer.EventCount()); @@ -614,7 +613,7 @@ // Verify dispatch of events. const int64_t kUsage = 5325; const int64_t kQuota = 903845; - quota_manager_->SetCallbackParams(kUsage, kQuota, kQuotaStatusOk); + quota_manager_->SetCallbackParams(kUsage, kQuota, QuotaStatusCode::kOk); storage_monitor_->NotifyUsageChange(params1_.filter, 9048543); StorageObserver::Event expected_event(params1_.filter, kUsage, kQuota);
diff --git a/storage/browser/quota/usage_tracker_unittest.cc b/storage/browser/quota/usage_tracker_unittest.cc index 82aad28e..0963f37 100644 --- a/storage/browser/quota/usage_tracker_unittest.cc +++ b/storage/browser/quota/usage_tracker_unittest.cc
@@ -16,7 +16,7 @@ #include "storage/browser/test/mock_special_storage_policy.h" #include "testing/gtest/include/gtest/gtest.h" -using storage::kQuotaStatusOk; +using blink::QuotaStatusCode; using storage::kStorageTypeTemporary; using storage::QuotaClient; using storage::QuotaClientList; @@ -109,7 +109,7 @@ EXPECT_EQ(kStorageTypeTemporary, type); usage_map_.erase(origin); base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::Bind(callback, kQuotaStatusOk)); + FROM_HERE, base::Bind(callback, QuotaStatusCode::kOk)); } bool DoesSupport(storage::StorageType type) const override {
diff --git a/storage/browser/test/async_file_test_helper.cc b/storage/browser/test/async_file_test_helper.cc index 837d1554..ec428f8 100644 --- a/storage/browser/test/async_file_test_helper.cc +++ b/storage/browser/test/async_file_test_helper.cc
@@ -73,11 +73,11 @@ run_loop->Quit(); } -void DidGetUsageAndQuota(storage::QuotaStatusCode* status_out, +void DidGetUsageAndQuota(blink::QuotaStatusCode* status_out, int64_t* usage_out, int64_t* quota_out, base::OnceClosure done_callback, - storage::QuotaStatusCode status, + blink::QuotaStatusCode status, int64_t usage, int64_t quota) { if (status_out) @@ -256,13 +256,13 @@ return (result == base::File::FILE_OK) && file_info.is_directory; } -storage::QuotaStatusCode AsyncFileTestHelper::GetUsageAndQuota( +blink::QuotaStatusCode AsyncFileTestHelper::GetUsageAndQuota( storage::QuotaManager* quota_manager, const GURL& origin, storage::FileSystemType type, int64_t* usage, int64_t* quota) { - storage::QuotaStatusCode status = storage::kQuotaStatusUnknown; + blink::QuotaStatusCode status = blink::QuotaStatusCode::kUnknown; base::RunLoop run_loop; quota_manager->GetUsageAndQuota( origin, FileSystemTypeToQuotaStorageType(type),
diff --git a/storage/browser/test/async_file_test_helper.h b/storage/browser/test/async_file_test_helper.h index 55c8f8c..0993079c 100644 --- a/storage/browser/test/async_file_test_helper.h +++ b/storage/browser/test/async_file_test_helper.h
@@ -10,7 +10,7 @@ #include "storage/browser/fileapi/file_system_operation.h" #include "storage/common/fileapi/file_system_types.h" -#include "storage/common/quota/quota_status_code.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" class GURL; @@ -100,7 +100,7 @@ const storage::FileSystemURL& url); // Returns usage and quota. It's valid to pass NULL to |usage| and/or |quota|. - static storage::QuotaStatusCode GetUsageAndQuota( + static blink::QuotaStatusCode GetUsageAndQuota( storage::QuotaManager* quota_manager, const GURL& origin, storage::FileSystemType type,
diff --git a/storage/browser/test/mock_quota_manager.cc b/storage/browser/test/mock_quota_manager.cc index d3af9010..0820ad73 100644 --- a/storage/browser/test/mock_quota_manager.cc +++ b/storage/browser/test/mock_quota_manager.cc
@@ -13,8 +13,6 @@ #include "base/threading/thread_task_runner_handle.h" #include "url/gurl.h" -using storage::kQuotaStatusOk; - namespace content { MockQuotaManager::OriginInfo::OriginInfo( @@ -50,7 +48,7 @@ storage::StorageType type, const UsageAndQuotaCallback& callback) { StorageInfo& info = usage_and_quota_map_[std::make_pair(origin, type)]; - callback.Run(storage::kQuotaStatusOk, info.usage, info.quota); + callback.Run(blink::QuotaStatusCode::kOk, info.usage, info.quota); } void MockQuotaManager::SetQuota(const GURL& origin, @@ -119,9 +117,9 @@ } base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, - base::Bind(&MockQuotaManager::DidDeleteOriginData, - weak_factory_.GetWeakPtr(), callback, kQuotaStatusOk)); + FROM_HERE, base::Bind(&MockQuotaManager::DidDeleteOriginData, + weak_factory_.GetWeakPtr(), callback, + blink::QuotaStatusCode::kOk)); } MockQuotaManager::~MockQuotaManager() = default; @@ -139,9 +137,8 @@ callback.Run(*origins, storage_type); } -void MockQuotaManager::DidDeleteOriginData( - const StatusCallback& callback, - QuotaStatusCode status) { +void MockQuotaManager::DidDeleteOriginData(const StatusCallback& callback, + blink::QuotaStatusCode status) { callback.Run(status); }
diff --git a/storage/browser/test/mock_quota_manager.h b/storage/browser/test/mock_quota_manager.h index 4ead56c..c373eec 100644 --- a/storage/browser/test/mock_quota_manager.h +++ b/storage/browser/test/mock_quota_manager.h
@@ -23,7 +23,6 @@ using storage::GetOriginsCallback; using storage::QuotaClient; using storage::QuotaManager; -using storage::QuotaStatusCode; using storage::SpecialStoragePolicy; using storage::StatusCallback; using storage::StorageType; @@ -138,7 +137,7 @@ std::set<GURL>* origins, StorageType storage_type); void DidDeleteOriginData(const StatusCallback& callback, - QuotaStatusCode status); + blink::QuotaStatusCode status); // The list of stored origins that have been added via AddOrigin. std::vector<OriginInfo> origins_;
diff --git a/storage/browser/test/mock_quota_manager_unittest.cc b/storage/browser/test/mock_quota_manager_unittest.cc index 59a1b370..4236f45 100644 --- a/storage/browser/test/mock_quota_manager_unittest.cc +++ b/storage/browser/test/mock_quota_manager_unittest.cc
@@ -18,7 +18,6 @@ #include "storage/browser/test/mock_storage_client.h" #include "testing/gtest/include/gtest/gtest.h" -using storage::kQuotaStatusOk; using storage::kStorageTypePersistent; using storage::kStorageTypeTemporary; @@ -79,9 +78,9 @@ weak_factory_.GetWeakPtr())); } - void DeletedOriginData(QuotaStatusCode status) { + void DeletedOriginData(blink::QuotaStatusCode status) { ++deletion_callback_count_; - EXPECT_EQ(kQuotaStatusOk, status); + EXPECT_EQ(blink::QuotaStatusCode::kOk, status); } int deletion_callback_count() const {
diff --git a/storage/browser/test/mock_storage_client.cc b/storage/browser/test/mock_storage_client.cc index 66da6dec..2013e27 100644 --- a/storage/browser/test/mock_storage_client.cc +++ b/storage/browser/test/mock_storage_client.cc
@@ -15,9 +15,6 @@ #include "net/base/url_util.h" #include "storage/browser/quota/quota_manager_proxy.h" -using storage::kQuotaErrorInvalidModification; -using storage::kQuotaStatusOk; - namespace content { using std::make_pair; @@ -172,7 +169,7 @@ ErrorOriginSet::iterator itr_error = error_origins_.find(make_pair(origin_url, type)); if (itr_error != error_origins_.end()) { - callback.Run(kQuotaErrorInvalidModification); + callback.Run(blink::QuotaStatusCode::kErrorInvalidModification); return; } @@ -185,7 +182,7 @@ origin_data_.erase(itr); } - callback.Run(kQuotaStatusOk); + callback.Run(blink::QuotaStatusCode::kOk); } } // namespace content
diff --git a/storage/common/BUILD.gn b/storage/common/BUILD.gn index b3454ba..3328336 100644 --- a/storage/common/BUILD.gn +++ b/storage/common/BUILD.gn
@@ -29,8 +29,6 @@ "fileapi/file_system_types.h", "fileapi/file_system_util.cc", "fileapi/file_system_util.h", - "quota/quota_status_code.cc", - "quota/quota_status_code.h", "quota/quota_types.h", "storage_common_export.h", "storage_histograms.cc",
diff --git a/storage/common/quota/quota_status_code.cc b/storage/common/quota/quota_status_code.cc deleted file mode 100644 index b3976e5..0000000 --- a/storage/common/quota/quota_status_code.cc +++ /dev/null
@@ -1,29 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "base/logging.h" -#include "storage/common/quota/quota_status_code.h" - -namespace storage { - -const char* QuotaStatusCodeToString(QuotaStatusCode status) { - switch (status) { - case kQuotaStatusOk: - return "OK."; - case kQuotaErrorNotSupported: - return "Operation not supported."; - case kQuotaErrorInvalidModification: - return "Invalid modification."; - case kQuotaErrorInvalidAccess: - return "Invalid access."; - case kQuotaErrorAbort: - return "Quota operation aborted."; - case kQuotaStatusUnknown: - return "Unknown error."; - } - NOTREACHED(); - return "Unknown error."; -} - -} // namespace storage
diff --git a/storage/common/quota/quota_status_code.h b/storage/common/quota/quota_status_code.h deleted file mode 100644 index c55f8a5..0000000 --- a/storage/common/quota/quota_status_code.h +++ /dev/null
@@ -1,30 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef STORAGE_COMMON_QUOTA_QUOTA_STATUS_CODE_H_ -#define STORAGE_COMMON_QUOTA_QUOTA_STATUS_CODE_H_ - -#include "storage/common/storage_common_export.h" -#include "third_party/WebKit/public/platform/WebStorageQuotaError.h" - -namespace storage { - -enum QuotaStatusCode { - kQuotaStatusOk = 0, - kQuotaErrorNotSupported = blink::kWebStorageQuotaErrorNotSupported, - kQuotaErrorInvalidModification = - blink::kWebStorageQuotaErrorInvalidModification, - kQuotaErrorInvalidAccess = blink::kWebStorageQuotaErrorInvalidAccess, - kQuotaErrorAbort = blink::kWebStorageQuotaErrorAbort, - kQuotaStatusUnknown = -1, - - kQuotaStatusLast = kQuotaErrorAbort, -}; - -STORAGE_COMMON_EXPORT const char* QuotaStatusCodeToString( - QuotaStatusCode status); - -} // namespace storage - -#endif // STORAGE_COMMON_QUOTA_QUOTA_STATUS_CODE_H_
diff --git a/storage/common/quota/quota_types.h b/storage/common/quota/quota_types.h index 381d8473..1c164382 100644 --- a/storage/common/quota/quota_types.h +++ b/storage/common/quota/quota_types.h
@@ -5,8 +5,6 @@ #ifndef STORAGE_COMMON_QUOTA_QUOTA_TYPES_H_ #define STORAGE_COMMON_QUOTA_QUOTA_TYPES_H_ -#include "storage/common/quota/quota_status_code.h" - namespace storage { enum StorageType {
diff --git a/storage/common/quota/quota_types.mojom b/storage/common/quota/quota_types.mojom index 915a673..4258de7b 100644 --- a/storage/common/quota/quota_types.mojom +++ b/storage/common/quota/quota_types.mojom
@@ -13,7 +13,7 @@ kUnknown, }; -// TODO(sashab): Remove duplicate definition storage::QuotaStatusCode. +// TODO(sashab): Remove duplicate definition blink::QuotaStatusCode. enum QuotaStatusCode { kOk = 0, kErrorNotSupported,
diff --git a/storage/common/quota/quota_types.typemap b/storage/common/quota/quota_types.typemap index d55ef180..f179778 100644 --- a/storage/common/quota/quota_types.typemap +++ b/storage/common/quota/quota_types.typemap
@@ -4,14 +4,15 @@ mojom = "//storage/common/quota/quota_types.mojom" public_headers = [ - "//storage/common/quota/quota_status_code.h", + "//third_party/WebKit/common/quota/quota_status_code.h", "//storage/common/quota/quota_types.h", ] traits_headers = [ "//storage/common/quota/quota_types_struct_traits.h" ] deps = [ "//storage/common", + "//third_party/WebKit/common:blink_common", ] type_mappings = [ - "storage.mojom.QuotaStatusCode=storage::QuotaStatusCode", + "storage.mojom.QuotaStatusCode=blink::QuotaStatusCode", "storage.mojom.StorageType=storage::StorageType", ]
diff --git a/storage/common/quota/quota_types_struct_traits.h b/storage/common/quota/quota_types_struct_traits.h index 73cfb742..3231850 100644 --- a/storage/common/quota/quota_types_struct_traits.h +++ b/storage/common/quota/quota_types_struct_traits.h
@@ -6,9 +6,9 @@ #define CONTENT_COMMON_QUOTA_MESSAGES_STRUCT_TRAITS_H_ #include "mojo/public/cpp/bindings/enum_traits.h" -#include "storage/common/quota/quota_status_code.h" #include "storage/common/quota/quota_types.h" #include "storage/common/quota/quota_types.mojom.h" +#include "third_party/WebKit/common/quota/quota_status_code.h" namespace mojo { @@ -58,21 +58,21 @@ }; template <> -struct EnumTraits<storage::mojom::QuotaStatusCode, storage::QuotaStatusCode> { +struct EnumTraits<storage::mojom::QuotaStatusCode, blink::QuotaStatusCode> { static storage::mojom::QuotaStatusCode ToMojom( - storage::QuotaStatusCode status_code) { + blink::QuotaStatusCode status_code) { switch (status_code) { - case storage::kQuotaStatusOk: + case blink::QuotaStatusCode::kOk: return storage::mojom::QuotaStatusCode::kOk; - case storage::kQuotaErrorNotSupported: + case blink::QuotaStatusCode::kErrorNotSupported: return storage::mojom::QuotaStatusCode::kErrorNotSupported; - case storage::kQuotaErrorInvalidModification: + case blink::QuotaStatusCode::kErrorInvalidModification: return storage::mojom::QuotaStatusCode::kErrorInvalidModification; - case storage::kQuotaErrorInvalidAccess: + case blink::QuotaStatusCode::kErrorInvalidAccess: return storage::mojom::QuotaStatusCode::kErrorInvalidAccess; - case storage::kQuotaErrorAbort: + case blink::QuotaStatusCode::kErrorAbort: return storage::mojom::QuotaStatusCode::kErrorAbort; - case storage::kQuotaStatusUnknown: + case blink::QuotaStatusCode::kUnknown: return storage::mojom::QuotaStatusCode::kUnknown; } NOTREACHED(); @@ -80,25 +80,25 @@ } static bool FromMojom(storage::mojom::QuotaStatusCode status_code, - storage::QuotaStatusCode* out) { + blink::QuotaStatusCode* out) { switch (status_code) { case storage::mojom::QuotaStatusCode::kOk: - *out = storage::kQuotaStatusOk; + *out = blink::QuotaStatusCode::kOk; return true; case storage::mojom::QuotaStatusCode::kErrorNotSupported: - *out = storage::kQuotaErrorNotSupported; + *out = blink::QuotaStatusCode::kErrorNotSupported; return true; case storage::mojom::QuotaStatusCode::kErrorInvalidModification: - *out = storage::kQuotaErrorInvalidModification; + *out = blink::QuotaStatusCode::kErrorInvalidModification; return true; case storage::mojom::QuotaStatusCode::kErrorInvalidAccess: - *out = storage::kQuotaErrorInvalidAccess; + *out = blink::QuotaStatusCode::kErrorInvalidAccess; return true; case storage::mojom::QuotaStatusCode::kErrorAbort: - *out = storage::kQuotaErrorAbort; + *out = blink::QuotaStatusCode::kErrorAbort; return true; case storage::mojom::QuotaStatusCode::kUnknown: - *out = storage::kQuotaStatusUnknown; + *out = blink::QuotaStatusCode::kUnknown; return true; } NOTREACHED();
diff --git a/testing/android/empty_apk/AndroidManifest.xml b/testing/android/empty_apk/AndroidManifest.xml index cc5ee70..610dcdd 100644 --- a/testing/android/empty_apk/AndroidManifest.xml +++ b/testing/android/empty_apk/AndroidManifest.xml
@@ -5,5 +5,4 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="{{package}}"> - <application></application> </manifest>
diff --git a/testing/buildbot/chromium.chromiumos.json b/testing/buildbot/chromium.chromiumos.json index 9eb1af6..7e17457 100644 --- a/testing/buildbot/chromium.chromiumos.json +++ b/testing/buildbot/chromium.chromiumos.json
@@ -817,8 +817,7 @@ }, { "args": [ - "--mus", - "--test-launcher-filter-file=../../testing/buildbot/filters/ash_unittests_mus.filter" + "--mus" ], "name": "ash_unittests-mus", "override_isolate_target": "ash_unittests",
diff --git a/testing/buildbot/chromium.fyi.json b/testing/buildbot/chromium.fyi.json index 32cfa05..de20f56 100644 --- a/testing/buildbot/chromium.fyi.json +++ b/testing/buildbot/chromium.fyi.json
@@ -4101,6 +4101,25 @@ "chrome" ] }, + "Linux Viz": { + "additional_compile_targets": [ + "all" + ], + "gtest_tests": [ + { + "args": [ + "--enable-viz", + "--test-launcher-filter-file=../../testing/buildbot/filters/mojo.fyi.viz.content_browsertests.filter" + ], + "name": "viz_content_browsertests", + "swarming": { + "can_use_on_swarming_builders": true, + "shards": 2 + }, + "test": "content_browsertests" + } + ] + }, "Linux x64 Goma Canary (clobber)": { "additional_compile_targets": [ "all" @@ -4254,8 +4273,7 @@ }, { "args": [ - "--mus", - "--test-launcher-filter-file=../../testing/buildbot/filters/ash_unittests_mus.filter" + "--mus" ], "name": "ash_unittests-mus", "override_isolate_target": "ash_unittests", @@ -4425,6 +4443,18 @@ { "args": [ "--enable-viz", + "--test-launcher-filter-file=../../testing/buildbot/filters/viz.browser_tests.filter" + ], + "name": "viz_browser_tests", + "swarming": { + "can_use_on_swarming_builders": true, + "shards": 5 + }, + "test": "browser_tests" + }, + { + "args": [ + "--enable-viz", "--test-launcher-filter-file=../../testing/buildbot/filters/mojo.fyi.viz.content_browsertests.filter" ], "name": "viz_content_browsertests", @@ -6051,7 +6081,6 @@ }, { "args": [ - "--gtest-filter-file=../../testing/buildbot/filters/site-per-process.content_browsertests.filter", "--site-per-process", "--test-launcher-filter-file=../../testing/buildbot/filters/site-per-process.content_browsertests.filter" ], @@ -6101,119 +6130,8 @@ ] }, "Site Isolation Linux": { - "gtest_tests": [ - { - "args": [ - "--site-per-process" - ], - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "app_shell_unittests" - }, - { - "args": [ - "--site-per-process", - "--test-launcher-filter-file=../../testing/buildbot/filters/site-per-process.browser_tests.filter" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "shards": 5 - }, - "test": "browser_tests" - }, - { - "args": [ - "--site-per-process" - ], - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "components_browsertests" - }, - { - "args": [ - "--site-per-process" - ], - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "components_unittests" - }, - { - "args": [ - "--site-per-process", - "--test-launcher-filter-file=../../testing/buildbot/filters/site-per-process.content_browsertests.filter" - ], - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "content_browsertests" - }, - { - "args": [ - "--site-per-process" - ], - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "content_unittests" - }, - { - "args": [ - "--site-per-process" - ], - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "extensions_browsertests" - }, - { - "args": [ - "--site-per-process" - ], - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "extensions_unittests" - }, - { - "args": [ - "--site-per-process", - "--test-launcher-filter-file=../../testing/buildbot/filters/site-per-process.interactive_ui_tests.filter" - ], - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "interactive_ui_tests" - }, - { - "args": [ - "--site-per-process" - ], - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "nacl_loader_unittests" - }, - { - "args": [ - "--site-per-process" - ], - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "sync_integration_tests" - }, - { - "args": [ - "--site-per-process" - ], - "swarming": { - "can_use_on_swarming_builders": true - }, - "test": "unit_tests" - } + "additional_compile_targets": [ + "base_unittests" ], "isolated_scripts": [ { @@ -6232,7 +6150,7 @@ ], "script": "//third_party/WebKit/Tools/Scripts/merge-layout-test-results" }, - "name": "webkit_layout_tests", + "name": "site_per_process_webkit_layout_tests", "results_handler": "layout tests", "swarming": { "can_use_on_swarming_builders": true,
diff --git a/testing/buildbot/chromium.gpu.fyi.json b/testing/buildbot/chromium.gpu.fyi.json index 913d511..a6070aa 100644 --- a/testing/buildbot/chromium.gpu.fyi.json +++ b/testing/buildbot/chromium.gpu.fyi.json
@@ -13085,6 +13085,28 @@ }, { "args": [ + "--enable-gpu", + "--test-launcher-bot-mode", + "--test-launcher-jobs=1", + "--gtest_filter=VrBrowserTest.*", + "--gtest_also_run_disabled_tests" + ], + "name": "vr_browser_tests", + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "10de:1cb3-23.21.13.8792", + "os": "Windows-10", + "pool": "Chrome-GPU" + } + ] + }, + "test": "browser_tests", + "use_xvfb": false + }, + { + "args": [ "--use-gpu-in-tests", "--use-cmd-decoder=validating" ],
diff --git a/testing/buildbot/chromium.linux.json b/testing/buildbot/chromium.linux.json index 2ccb815..0b8a0be 100644 --- a/testing/buildbot/chromium.linux.json +++ b/testing/buildbot/chromium.linux.json
@@ -588,6 +588,26 @@ "test": "components_browsertests" }, { + "args": [ + "--site-per-process" + ], + "name": "site_per_process_components_browsertests", + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "components_browsertests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "components_unittests" + }, + { + "args": [ + "--site-per-process" + ], + "name": "site_per_process_components_unittests", "swarming": { "can_use_on_swarming_builders": true }, @@ -701,6 +721,26 @@ "test": "extensions_browsertests" }, { + "args": [ + "--site-per-process" + ], + "name": "site_per_process_extensions_browsertests", + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "extensions_browsertests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "extensions_unittests" + }, + { + "args": [ + "--site-per-process" + ], + "name": "site_per_process_extensions_unittests", "swarming": { "can_use_on_swarming_builders": true }, @@ -773,6 +813,16 @@ "test": "interactive_ui_tests" }, { + "args": [ + "--site-per-process" + ], + "name": "site_per_process_interactive_ui_tests", + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "interactive_ui_tests" + }, + { "swarming": { "can_use_on_swarming_builders": true }, @@ -935,6 +985,16 @@ "test": "sync_integration_tests" }, { + "args": [ + "--site-per-process" + ], + "name": "site_per_process_sync_integration_tests", + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "sync_integration_tests" + }, + { "swarming": { "can_use_on_swarming_builders": false }, @@ -1213,6 +1273,26 @@ "test": "components_browsertests" }, { + "args": [ + "--site-per-process" + ], + "name": "site_per_process_components_browsertests", + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "components_browsertests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "components_unittests" + }, + { + "args": [ + "--site-per-process" + ], + "name": "site_per_process_components_unittests", "swarming": { "can_use_on_swarming_builders": true }, @@ -1314,6 +1394,26 @@ "test": "extensions_browsertests" }, { + "args": [ + "--site-per-process" + ], + "name": "site_per_process_extensions_browsertests", + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "extensions_browsertests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "extensions_unittests" + }, + { + "args": [ + "--site-per-process" + ], + "name": "site_per_process_extensions_unittests", "swarming": { "can_use_on_swarming_builders": true }, @@ -1387,6 +1487,16 @@ "test": "interactive_ui_tests" }, { + "args": [ + "--site-per-process" + ], + "name": "site_per_process_interactive_ui_tests", + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "interactive_ui_tests" + }, + { "swarming": { "can_use_on_swarming_builders": true }, @@ -1552,6 +1662,16 @@ "test": "sync_integration_tests" }, { + "args": [ + "--site-per-process" + ], + "name": "site_per_process_sync_integration_tests", + "swarming": { + "can_use_on_swarming_builders": true + }, + "test": "sync_integration_tests" + }, + { "swarming": { "can_use_on_swarming_builders": true },
diff --git a/testing/buildbot/chromium.memory.json b/testing/buildbot/chromium.memory.json index b363c23..d3815de 100644 --- a/testing/buildbot/chromium.memory.json +++ b/testing/buildbot/chromium.memory.json
@@ -736,8 +736,7 @@ }, { "args": [ - "--mus", - "--test-launcher-filter-file=../../testing/buildbot/filters/ash_unittests_mus.filter" + "--mus" ], "name": "ash_unittests-mus", "override_isolate_target": "ash_unittests",
diff --git a/testing/buildbot/chromium.perf.fyi.json b/testing/buildbot/chromium.perf.fyi.json index 3c201d9..badfe3a 100644 --- a/testing/buildbot/chromium.perf.fyi.json +++ b/testing/buildbot/chromium.perf.fyi.json
@@ -29,6 +29,78 @@ "ignore_task_failure": false, "io_timeout": 360 } + }, + { + "args": [ + "heap_profiling.mobile.disabled", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=android-chromium" + ], + "isolate_name": "telemetry_perf_tests", + "name": "heap_profiling.mobile.disabled", + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "id": "build46-b1--device2", + "pool": "Chrome-perf-fyi" + } + ], + "expiration": 3600, + "hard_timeout": 1080, + "ignore_task_failure": false, + "io_timeout": 360 + } + }, + { + "args": [ + "heap_profiling.mobile.native", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=android-chromium" + ], + "isolate_name": "telemetry_perf_tests", + "name": "heap_profiling.mobile.native", + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "id": "build46-b1--device2", + "pool": "Chrome-perf-fyi" + } + ], + "expiration": 3600, + "hard_timeout": 1080, + "ignore_task_failure": false, + "io_timeout": 360 + } + }, + { + "args": [ + "heap_profiling.mobile.pseudo", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=android-chromium" + ], + "isolate_name": "telemetry_perf_tests", + "name": "heap_profiling.mobile.pseudo", + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "id": "build46-b1--device2", + "pool": "Chrome-perf-fyi" + } + ], + "expiration": 3600, + "hard_timeout": 1080, + "ignore_task_failure": false, + "io_timeout": 360 + } } ] },
diff --git a/testing/buildbot/chromium.perf.json b/testing/buildbot/chromium.perf.json index 96f421e..219e69d 100644 --- a/testing/buildbot/chromium.perf.json +++ b/testing/buildbot/chromium.perf.json
@@ -3790,7 +3790,7 @@ } ], "expiration": 36000, - "hard_timeout": 10800, + "hard_timeout": 14400, "ignore_task_failure": false, "io_timeout": 600, "upload_test_results": true @@ -3821,7 +3821,7 @@ } ], "expiration": 36000, - "hard_timeout": 10800, + "hard_timeout": 14400, "ignore_task_failure": true, "io_timeout": 600, "upload_test_results": true @@ -8503,7 +8503,7 @@ } ], "expiration": 36000, - "hard_timeout": 10800, + "hard_timeout": 14400, "ignore_task_failure": false, "io_timeout": 600, "upload_test_results": true @@ -8534,7 +8534,7 @@ } ], "expiration": 36000, - "hard_timeout": 10800, + "hard_timeout": 14400, "ignore_task_failure": true, "io_timeout": 600, "upload_test_results": true @@ -11227,7 +11227,7 @@ } ], "expiration": 36000, - "hard_timeout": 10800, + "hard_timeout": 14400, "ignore_task_failure": false, "io_timeout": 600, "upload_test_results": true @@ -15498,7 +15498,7 @@ } ], "expiration": 36000, - "hard_timeout": 10800, + "hard_timeout": 14400, "ignore_task_failure": false, "io_timeout": 600, "upload_test_results": true @@ -15529,7 +15529,7 @@ } ], "expiration": 36000, - "hard_timeout": 10800, + "hard_timeout": 14400, "ignore_task_failure": true, "io_timeout": 600, "upload_test_results": true @@ -18222,7 +18222,7 @@ } ], "expiration": 36000, - "hard_timeout": 10800, + "hard_timeout": 14400, "ignore_task_failure": false, "io_timeout": 600, "upload_test_results": true @@ -22493,7 +22493,7 @@ } ], "expiration": 36000, - "hard_timeout": 10800, + "hard_timeout": 14400, "ignore_task_failure": false, "io_timeout": 600, "upload_test_results": true @@ -22524,7 +22524,7 @@ } ], "expiration": 36000, - "hard_timeout": 10800, + "hard_timeout": 14400, "ignore_task_failure": true, "io_timeout": 600, "upload_test_results": true @@ -27164,7 +27164,7 @@ } ], "expiration": 36000, - "hard_timeout": 10800, + "hard_timeout": 14400, "ignore_task_failure": false, "io_timeout": 600, "upload_test_results": true @@ -27195,7 +27195,7 @@ } ], "expiration": 36000, - "hard_timeout": 10800, + "hard_timeout": 14400, "ignore_task_failure": true, "io_timeout": 600, "upload_test_results": true
diff --git a/testing/buildbot/filters/BUILD.gn b/testing/buildbot/filters/BUILD.gn index 7c7b3e61..61191ac 100644 --- a/testing/buildbot/filters/BUILD.gn +++ b/testing/buildbot/filters/BUILD.gn
@@ -21,7 +21,6 @@ data = [ "//testing/buildbot/filters/ash_unittests_mash.filter", - "//testing/buildbot/filters/ash_unittests_mus.filter", ] } @@ -34,6 +33,7 @@ "//testing/buildbot/filters/mojo.fyi.network_browser_tests.filter", "//testing/buildbot/filters/browser_tests_cros_asan.filter", "//testing/buildbot/filters/site-per-process.browser_tests.filter", + "//testing/buildbot/filters/viz.browser_tests.filter", ] }
diff --git a/testing/buildbot/filters/README.md b/testing/buildbot/filters/README.md index 8c85770b..23e588d5 100644 --- a/testing/buildbot/filters/README.md +++ b/testing/buildbot/filters/README.md
@@ -53,13 +53,13 @@ --test-launcher-filter-file=testing/buildbot/filters/site-per-process.content_browsertests.filter ``` -When running tests on Android, the test filter file can be specified using -`--gtest-filter-file` command line flag. Example test invocation: +When running tests on Android, the test filter file can also be specified using +`--test-launcher-filter-file` command line flag. Example test invocation: ```bash $ out/android/bin/run_content_browsertests \ --site-per-process \ - --gtest-filter-file=testing/buildbot/filters/site-per-process.content_browsertests.filter + --test-launcher-filter-file=testing/buildbot/filters/site-per-process.content_browsertests.filter ``` ## Applicability
diff --git a/testing/buildbot/filters/ash_unittests_mus.filter b/testing/buildbot/filters/ash_unittests_mus.filter deleted file mode 100644 index ddc30685..0000000 --- a/testing/buildbot/filters/ash_unittests_mus.filter +++ /dev/null
@@ -1,6 +0,0 @@ --UnifiedMouseWarpControllerTest.BoundaryTestGrid --UnifiedMouseWarpControllerTest.WarpMouse --UnifiedMouseWarpControllerTest.BoundaryAndWarpSimpleTest - -# When adding new exclusions be sure to file bug with reason. Group with the -# above if applicable.
diff --git a/testing/buildbot/filters/mojo.fyi.mash.browser_tests.filter b/testing/buildbot/filters/mojo.fyi.mash.browser_tests.filter index 70cf6f7d..7b5ab94 100644 --- a/testing/buildbot/filters/mojo.fyi.mash.browser_tests.filter +++ b/testing/buildbot/filters/mojo.fyi.mash.browser_tests.filter
@@ -35,9 +35,6 @@ -ArcAppDeferredLauncherBrowserTest.* -ArcAppDeferredLauncherWithParamsBrowserTestInstance/ArcAppDeferredLauncherWithParamsBrowserTest.* -# Times out. Possibly general extensions test problem. --AppWindowApiTest.* - # AutomationManagerAura::Enable() uses ash to get active window. More generally, # chrome a11y code directly accesses ash system UI widgets and views. -AutomationApiTest.*
diff --git a/testing/buildbot/filters/mojo.fyi.viz.content_browsertests.filter b/testing/buildbot/filters/mojo.fyi.viz.content_browsertests.filter index 8c40236..1705e83 100644 --- a/testing/buildbot/filters/mojo.fyi.viz.content_browsertests.filter +++ b/testing/buildbot/filters/mojo.fyi.viz.content_browsertests.filter
@@ -86,26 +86,11 @@ # TODO: investigate flaky failure http://crbug.com/790683 -SitePerProcessBrowserTest.CrossSiteIframeBlockedByXFrameOptionsOrCSP -# TODO: investigate flaky failure http://crbug.com/792739 +# TODO: investigate flaky failures http://crbug.com/792739 -SitePerProcessFeaturePolicyBrowserTest.TestFeaturePolicyReplicationFromRemoteFrames - -# TODO: investigate flaky failure http://crbug.com/792740 -IsolatedOriginTest.ProcessLimit +-SitePerProcessBrowserTest.RFPHDestruction # Tests failures related to surface sync. http://crbug.com/793302 --RenderWidgetHostViewBrowserTestBase.CompositorWorksWhenReusingRenderer -RenderWidgetInitialSizeTest.InitialSize -RenderWidgetTest.OnResize --ScreenOrientationBrowserTest.ScreenOrientationChange --ScreenOrientationBrowserTest.WindowOrientationChange --ScreenOrientationOOPIFBrowserTest.ScreenOrientation --ScreenOrientationOOPIFBrowserTest.ScreenOrientationInPendingMainFrame --SitePerProcessBrowserTest.CommunicateWithProxyAfterCancelPending --SitePerProcessBrowserTest.CrossProcessInertSubframe --SitePerProcessBrowserTest.CrossSiteIframeDisplayNone --SitePerProcessBrowserTest.FileChooserInSubframe --SitePerProcessBrowserTest.MainframeTouchEventRouting --SitePerProcessBrowserTest.RecreateMainFrameAfterCancelPending --SitePerProcessBrowserTest.ReuseNonLiveRenderViewHostAfterCancelPending --WheelScrollLatchingBrowserTest.WheelEventTarget --WheelScrollLatchingDisabledBrowserTest.WheelEventTarget
diff --git a/testing/buildbot/filters/viz.browser_tests.filter b/testing/buildbot/filters/viz.browser_tests.filter new file mode 100644 index 0000000..50532d2 --- /dev/null +++ b/testing/buildbot/filters/viz.browser_tests.filter
@@ -0,0 +1,58 @@ +-CastStreamingApiTestWithPixelOutput.EndToEnd +-CloudPrintPolicyTest.NormalPassedFlag +-ContextMenuBrowserTest.OpenLinkInProfile +-DevToolsAutoOpenerTest.TestAutoOpenForTabs +-ExtensionApiNewTabTest.Tabs +-ExtensionApiTabTest.TabHighlight +-ExtensionApiTabTest.Tabs2 +-ExtensionApiTabTest.TabsOnUpdated +-ExtensionTabsTest.GetAllWindows +-ExtensionTabsTest.GetAllWindowsAllTypes +-PDFExtensionClipboardTest.CombinedShiftArrowPresses +-PDFExtensionClipboardTest.IndividualShiftLeftArrowPresses +-PDFExtensionTest.ContextMenuCoordinates +-PluginPowerSaverBrowserTest.BackgroundTabPlugins +-PluginPowerSaverBrowserTest.BackgroundTabTinyPlugins +-PluginPowerSaverBrowserTest.BlockTinyPlugins +-PluginPowerSaverBrowserTest.EssentialPlugins +-PluginPowerSaverBrowserTest.ExpandingSmallPlugin +-PluginPowerSaverBrowserTest.ExpandingTinyPlugins +-PluginPowerSaverBrowserTest.LargePostersNotThrottled +-PluginPowerSaverBrowserTest.OriginWhitelisting +-PluginPowerSaverBrowserTest.PosterTests +-PluginPowerSaverBrowserTest.RunAllFlashInAllowMode +-PluginPowerSaverBrowserTest.SmallCrossOrigin +-PluginPowerSaverBrowserTest.SmallerThanPlayIcon +-PluginPowerSaverBrowserTest.ZoomIndependent +-PolicyMakeDefaultBrowserTest.MakeDefaultDisabled +-ProcessManagementTest.ProcessOverflow +-ProcessMemoryMetricsEmitterTest.FetchDuringTrace +-ProcessMemoryMetricsEmitterTest.ForegroundAndBackgroundPages +-ServiceWorkerTestWithJSBindings/ServiceWorkerTest.BackgroundPageIsWokenIfAsleep/0 +-ServiceWorkerTestWithJSBindings/ServiceWorkerTest.FetchArbitraryPaths/0 +-ServiceWorkerTestWithJSBindings/ServiceWorkerTest.ServiceWorkerSuspensionOnExtensionUnload/0 +-ServiceWorkerTestWithNativeBindings/ServiceWorkerTest.BackgroundPageIsWokenIfAsleep/0 +-ServiceWorkerTestWithNativeBindings/ServiceWorkerTest.FetchArbitraryPaths/0 +-ServiceWorkerTestWithNativeBindings/ServiceWorkerTest.ServiceWorkerSuspensionOnExtensionUnload/0 +-SmartSessionRestoreTest.*CorrectLoadingOrder +-TabCaptureApiPixelTest.EndToEndThroughWebRTC +-TabCaptureApiPixelTest.EndToEndWithoutRemoting +-TabCaptureApiPixelTest.OffscreenTabEndToEnd +-TabCaptureApiPixelTest.OffscreenTabEvilTests +-TaskManagerViewTest.SelectionConsistency +-ThumbnailTest.ShouldCaptureOnNavigatingAwayExplicitWait +-ThumbnailTest.ShouldCaptureOnNavigatingAwaySlowPageLoad +-ThumbnailTest.ShouldContainProperContentIfCapturedOnNavigatingAway +-ThumbnailTest.ShouldContainProperContentIfCapturedOnTabSwitch +-TranslateLanguageBrowserTest.TranslateAndRevert +-WebViewScrollBubbling/WebViewGuestScrollTouchTest.TestGuestGestureScrollsBubble/0 +-WebViewScrollBubbling/WebViewGuestScrollTouchTest.TestGuestGestureScrollsBubble/1 +-WebViewScrollBubbling/WebViewGuestScrollTouchTest.TestGuestGestureScrollsBubble/2 +-WebViewScrollBubbling/WebViewGuestScrollTouchTest.TestGuestGestureScrollsBubble/3 +-WebViewTests/WebViewFocusTest.TouchFocusesEmbedder/0 +-WebViewTests/WebViewTest.InterstitialPageFocusedWidget/1 +-WebViewTests/WebViewTest.ReloadAfterCrash/1 +-WebViewTests/WebViewTest.Shim_TestAssignSrcAfterCrash/0 +-WebViewTests/WebViewTest.Shim_TestContentScriptIsInjectedAfterTerminateAndReloadWebView/0 +-WebViewTests/WebViewTest.Shim_TestReloadAfterTerminate/0 +-WebViewTests/WebViewTest.Shim_TestTerminateAfterExit/0
diff --git a/testing/buildbot/filters/viz.content_browsertests.filter b/testing/buildbot/filters/viz.content_browsertests.filter index 8c40236..1705e83 100644 --- a/testing/buildbot/filters/viz.content_browsertests.filter +++ b/testing/buildbot/filters/viz.content_browsertests.filter
@@ -86,26 +86,11 @@ # TODO: investigate flaky failure http://crbug.com/790683 -SitePerProcessBrowserTest.CrossSiteIframeBlockedByXFrameOptionsOrCSP -# TODO: investigate flaky failure http://crbug.com/792739 +# TODO: investigate flaky failures http://crbug.com/792739 -SitePerProcessFeaturePolicyBrowserTest.TestFeaturePolicyReplicationFromRemoteFrames - -# TODO: investigate flaky failure http://crbug.com/792740 -IsolatedOriginTest.ProcessLimit +-SitePerProcessBrowserTest.RFPHDestruction # Tests failures related to surface sync. http://crbug.com/793302 --RenderWidgetHostViewBrowserTestBase.CompositorWorksWhenReusingRenderer -RenderWidgetInitialSizeTest.InitialSize -RenderWidgetTest.OnResize --ScreenOrientationBrowserTest.ScreenOrientationChange --ScreenOrientationBrowserTest.WindowOrientationChange --ScreenOrientationOOPIFBrowserTest.ScreenOrientation --ScreenOrientationOOPIFBrowserTest.ScreenOrientationInPendingMainFrame --SitePerProcessBrowserTest.CommunicateWithProxyAfterCancelPending --SitePerProcessBrowserTest.CrossProcessInertSubframe --SitePerProcessBrowserTest.CrossSiteIframeDisplayNone --SitePerProcessBrowserTest.FileChooserInSubframe --SitePerProcessBrowserTest.MainframeTouchEventRouting --SitePerProcessBrowserTest.RecreateMainFrameAfterCancelPending --SitePerProcessBrowserTest.ReuseNonLiveRenderViewHostAfterCancelPending --WheelScrollLatchingBrowserTest.WheelEventTarget --WheelScrollLatchingDisabledBrowserTest.WheelEventTarget
diff --git a/testing/buildbot/test_suite_exceptions.pyl b/testing/buildbot/test_suite_exceptions.pyl index 44f04c2..f6dfe61 100644 --- a/testing/buildbot/test_suite_exceptions.pyl +++ b/testing/buildbot/test_suite_exceptions.pyl
@@ -3361,16 +3361,30 @@ }, }, }, + 'site_per_process_components_browsertests': { + 'remove_from': [ + # chromium.linux + 'Linux Tests (dbg)(1)(32)', + # chromium.sandbox + 'Linux Tests SANDBOX', + ], + }, + 'site_per_process_components_unittests': { + 'remove_from': [ + # chromium.linux + 'Linux Tests (dbg)(1)(32)', + # chromium.sandbox + 'Linux Tests SANDBOX', + ], + }, 'site_per_process_content_browsertests': { 'remove_from': [ + # chromium.linux 'Linux Tests (dbg)(1)(32)', ], 'modifications': { # chromium.fyi 'Site Isolation Android': { - 'args': [ - '--gtest-filter-file=../../testing/buildbot/filters/site-per-process.content_browsertests.filter', - ], 'swarming': { 'shards': 6, }, @@ -3379,9 +3393,42 @@ }, 'site_per_process_content_unittests': { 'remove_from': [ + # chromium.linux 'Linux Tests (dbg)(1)(32)', ], }, + 'site_per_process_extensions_browsertests': { + 'remove_from': [ + # chromium.linux + 'Linux Tests (dbg)(1)(32)', + # chromium.sandbox + 'Linux Tests SANDBOX', + ], + }, + 'site_per_process_extensions_unittests': { + 'remove_from': [ + # chromium.linux + 'Linux Tests (dbg)(1)(32)', + # chromium.sandbox + 'Linux Tests SANDBOX', + ], + }, + 'site_per_process_interactive_ui_tests': { + 'remove_from': [ + # chromium.linux + 'Linux Tests (dbg)(1)(32)', + # chromium.sandbox + 'Linux Tests SANDBOX', + ], + }, + 'site_per_process_sync_integration_tests': { + 'remove_from': [ + # chromium.linux + 'Linux Tests (dbg)(1)(32)', + # chromium.sandbox + 'Linux Tests SANDBOX', + ], + }, 'site_per_process_unit_tests': { 'remove_from': [ # chromium.fyi
diff --git a/testing/buildbot/test_suites.pyl b/testing/buildbot/test_suites.pyl index 493a150..80408bb 100644 --- a/testing/buildbot/test_suites.pyl +++ b/testing/buildbot/test_suites.pyl
@@ -983,6 +983,21 @@ }, }, + 'linux_viz_gtests': { + # TODO(jonross): merge all viz tests into one config, use exceptions to + # differentiate between the fyi and cq filters. + 'viz_content_browsertests': { + 'args': [ + '--enable-viz', + '--test-launcher-filter-file=../../testing/buildbot/filters/mojo.fyi.viz.content_browsertests.filter', + ], + 'swarming': { + 'shards': 2, + }, + 'test': 'content_browsertests', + }, + }, + 'mash_chromium_gtests': { 'ash_unittests-mash': { 'test': 'ash_unittests', @@ -1084,6 +1099,16 @@ 'media_service_unittests': {}, 'services_unittests': {}, 'views_mus_interactive_ui_tests': {}, + 'viz_browser_tests': { + 'args': [ + '--enable-viz', + '--test-launcher-filter-file=../../testing/buildbot/filters/viz.browser_tests.filter' + ], + 'swarming': { + 'shards': 5, + }, + 'test': 'browser_tests', + }, 'viz_content_browsertests': { 'args': [ '--enable-viz', @@ -1102,7 +1127,6 @@ 'override_isolate_target': 'ash_unittests', 'args': [ '--mus', - '--test-launcher-filter-file=../../testing/buildbot/filters/ash_unittests_mus.filter', ], }, 'mus_browser_tests': { @@ -1142,7 +1166,6 @@ 'ash_unittests-mus': { 'args': [ '--mus', - '--test-launcher-filter-file=../../testing/buildbot/filters/ash_unittests_mus.filter', ], 'override_isolate_target': 'ash_unittests', 'test': 'ash_unittests', @@ -1247,6 +1270,38 @@ 'devtools_eslint': {}, }, + 'linux_specific_site_per_process_isolated_scripts': { + # TODO(crbug.com/786554): merge this into + # linux_specific_chromium_isolated_scripts to run on + # linux_chromium_rel_ng when we're sure we have the capacity. + 'site_per_process_webkit_layout_tests': { + 'args': [ + '--additional-driver-flag', + '--site-per-process', + '--additional-driver-flag', + '--isolate-origins=http://www.web-platform.test:8001/,http://www1.web-platform.test:8001/,http://www2.web-platform.test:8001/,http://xn--n8j6ds53lwwkrqhv28a.web-platform.test:8001/,http://xn--lve-6lad.web-platform.test:8001/,http://www.web-platform.test:8081/,http://www1.web-platform.test:8081/,http://www2.web-platform.test:8081/,http://xn--n8j6ds53lwwkrqhv28a.web-platform.test:8081/,http://xn--lve-6lad.web-platform.test:8081/,https://www.web-platform.test:8444/,https://www1.web-platform.test:8444/,https://www2.web-platform.test:8444/,https://xn--n8j6ds53lwwkrqhv28a.web-platform.test:8444/,https://xn--lve-6lad.web-platform.test:8444/', + '--additional-expectations', + 'src/third_party/WebKit/LayoutTests/FlagExpectations/site-per-process', + ], + 'isolate_name': 'webkit_layout_tests_exparchive', + 'merge': { + 'args': [ + '--verbose', + ], + 'script': '//third_party/WebKit/Tools/Scripts/merge-layout-test-results', + }, + 'results_handler': 'layout tests', + 'swarming': { + 'dimension_sets': [ + { + 'os': 'Ubuntu-14.04' + }, + ], + 'shards': 10, + }, + }, + }, + 'mac_specific_chromium_gtests': { 'mac_installer_unittests': {}, 'sandbox_mac_unittests': {}, @@ -1468,6 +1523,45 @@ }, }, + 'site_isolation_chromium_linux_gtests': { + 'site_per_process_components_browsertests': { + 'args': [ + '--site-per-process', + ], + 'test': 'components_browsertests', + }, + 'site_per_process_components_unittests': { + 'args': [ + '--site-per-process', + ], + 'test': 'components_unittests', + }, + 'site_per_process_extensions_browsertests': { + 'args': [ + '--site-per-process', + ], + 'test': 'extensions_browsertests', + }, + 'site_per_process_extensions_unittests': { + 'args': [ + '--site-per-process', + ], + 'test': 'extensions_unittests', + }, + 'site_per_process_interactive_ui_tests': { + 'args': [ + '--site-per-process', + ], + 'test': 'interactive_ui_tests', + }, + 'site_per_process_sync_integration_tests': { + 'args': [ + '--site-per-process', + ], + 'test': 'sync_integration_tests', + }, + }, + 'site_isolation_android_fyi_specific_gtests': { # TODO(kbr): a couple of these look like accidents. # content_browsertests and content_unittests are already run on @@ -1492,7 +1586,7 @@ }, }, - 'site_isolation_linux_and_win_fyi_gtests': { + 'site_isolation_win_fyi_gtests': { # TODO(kbr): most of the tests on this bot have different names # than the other site isolation bots, so we can't simply reuse the # site_isolation_chromium_gtests test suite. These should be @@ -1547,6 +1641,18 @@ '--site-per-process', ], }, + 'installer_util_unittests': { + 'args': [ + '--site-per-process', + ], + 'swarming': { + 'dimension_sets': [ + { + 'integrity': 'high', + } + ], + }, + }, 'nacl_loader_unittests': { 'args': [ '--site-per-process', @@ -1564,50 +1670,6 @@ }, }, - 'site_isolation_linux_fyi_isolated_scripts': { - 'webkit_layout_tests': { - 'args': [ - '--additional-driver-flag', - '--site-per-process', - '--additional-driver-flag', - '--isolate-origins=http://www.web-platform.test:8001/,http://www1.web-platform.test:8001/,http://www2.web-platform.test:8001/,http://xn--n8j6ds53lwwkrqhv28a.web-platform.test:8001/,http://xn--lve-6lad.web-platform.test:8001/,http://www.web-platform.test:8081/,http://www1.web-platform.test:8081/,http://www2.web-platform.test:8081/,http://xn--n8j6ds53lwwkrqhv28a.web-platform.test:8081/,http://xn--lve-6lad.web-platform.test:8081/,https://www.web-platform.test:8444/,https://www1.web-platform.test:8444/,https://www2.web-platform.test:8444/,https://xn--n8j6ds53lwwkrqhv28a.web-platform.test:8444/,https://xn--lve-6lad.web-platform.test:8444/', - '--additional-expectations', - 'src/third_party/WebKit/LayoutTests/FlagExpectations/site-per-process', - ], - 'isolate_name': 'webkit_layout_tests_exparchive', - 'merge': { - 'args': [ - '--verbose', - ], - 'script': '//third_party/WebKit/Tools/Scripts/merge-layout-test-results', - }, - 'results_handler': 'layout tests', - 'swarming': { - 'dimension_sets': [ - { - 'os': 'Ubuntu-14.04' - }, - ], - 'shards': 10, - }, - }, - }, - - 'site_isolation_win_fyi_specific_gtests': { - 'installer_util_unittests': { - 'args': [ - '--site-per-process', - ], - 'swarming': { - 'dimension_sets': [ - { - 'integrity': 'high', - } - ], - }, - }, - }, - 'system_webview_shell_instrumentation_tests': { 'system_webview_shell_layout_test_apk': {}, }, @@ -1870,6 +1932,7 @@ 'non_clang_win_chromium_gtests', 'non_mac_non_clang_win_chromium_gtests', 'site_isolation_chromium_gtests', + 'site_isolation_chromium_linux_gtests', 'viz_gtests', ], @@ -2209,15 +2272,6 @@ 'site_isolation_chromium_gtests', ], - 'site_isolation_linux_fyi_gtests': [ - 'site_isolation_linux_and_win_fyi_gtests', - ], - - 'site_isolation_win_fyi_gtests': [ - 'site_isolation_linux_and_win_fyi_gtests', - 'site_isolation_win_fyi_specific_gtests', - ], - 'system_webview_and_webview_ui_instrumentation_tests': [ 'system_webview_shell_instrumentation_tests', 'webview_ui_instrumentation_tests',
diff --git a/testing/buildbot/waterfalls.pyl b/testing/buildbot/waterfalls.pyl index 1abe673..ca6358e 100644 --- a/testing/buildbot/waterfalls.pyl +++ b/testing/buildbot/waterfalls.pyl
@@ -1075,6 +1075,14 @@ 'gtest_tests': 'goma_gtests', }, }, + 'Linux Viz': { + 'additional_compile_targets': [ + 'all', + ], + 'test_suites': { + 'gtest_tests': 'linux_viz_gtests', + }, + }, 'Mac Builder (dbg) Goma Canary': { 'additional_compile_targets': [ 'all', @@ -1196,9 +1204,17 @@ }, }, 'Site Isolation Linux': { + # TODO(dpranke): Remove this builder once the tests are running on + # the main 'Linux Tests' bot; base_unittests is a placeholder + # to keep the builder from building "all". + 'additional_compile_targets': [ + 'base_unittests', + ], 'test_suites': { - 'gtest_tests': 'site_isolation_linux_fyi_gtests', - 'isolated_scripts': 'site_isolation_linux_fyi_isolated_scripts', + # TODO(crbug.com/786554): merge this into + # linux_specific_chromium_isolated_scripts to run on + # linux_chromium_rel_ng when we're sure we have the capacity. + 'isolated_scripts': 'linux_specific_site_per_process_isolated_scripts', }, }, 'Site Isolation Win': {
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index f0887bc..70fc0587 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -506,15 +506,52 @@ "platforms": [ "chromeos", "linux", + "mac", "win" ], "experiments": [ { - "name": "EnabledWithGoogleBranding", + "name": "EnabledWithGoogleBranding_Launched", "enable_features": [ - "AutofillUpstreamRequestCvcIfMissing", - "AutofillUpstreamShowGoogleLogo", - "AutofillUpstreamShowNewUi" + "AutofillUpstreamRequestCvcIfMissing" + ] + } + ] + } + ], + "AutofillUpstreamSendDetectedValues": [ + { + "platforms": [ + "android", + "chromeos", + "linux", + "mac", + "win" + ], + "experiments": [ + { + "name": "Enabled", + "enable_features": [ + "AutofillUpstreamSendDetectedValues" + ] + } + ] + } + ], + "AutofillUpstreamSendPanFirstSix": [ + { + "platforms": [ + "android", + "chromeos", + "linux", + "mac", + "win" + ], + "experiments": [ + { + "name": "Enabled", + "enable_features": [ + "AutofillUpstreamSendPanFirstSix" ] } ] @@ -1923,10 +1960,16 @@ ], "experiments": [ { - "name": "MoreFrequentTierTwo", + "name": "UnifyWifiAndFallbackTier1", "params": { + "fetching_interval_hours-fallback-active_suggestions_consumer": "24", "soft_fetching_interval_hours-fallback-active_ntp_user": "4", - "soft_fetching_interval_hours-wifi-active_ntp_user": "4" + "soft_fetching_interval_hours-fallback-rare_ntp_user": "4", + "soft_fetching_interval_hours-wifi-active_ntp_user": "4", + "soft_fetching_interval_hours-wifi-rare_ntp_user": "4", + "startup_fetching_interval_hours-fallback-rare_ntp_user": "24", + "startup_fetching_interval_hours-wifi-rare_ntp_user": "24", + "user_classifier_rare_user_opens_ntp_at_most_once_per_hours": "96" }, "enable_features": [ "NTPArticleSuggestions"
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG index 7bd6c10f..aa87157 100644 --- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG +++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG
@@ -7,7 +7,6 @@ # We currently write back whitespace-collapsed strings to LayoutText, causing # the following failures. Once we can paint inlines directly from fragment tree, # we can stop the writeback. -crbug.com/714962 editing/text-iterator/findString-restarts-at-last-position.html [ Failure Pass ] # Editing does not completely work with LayoutNG yet. @@ -22,7 +21,6 @@ crbug.com/789878 fast/css/readwrite-contenteditable.html [ Failure Pass ] crbug.com/707656 fast/inline-block/14498-positionForCoordinates.html [ Failure Pass ] crbug.com/789878 fast/inline/inline-focus-ring.html [ Failure Pass ] -crbug.com/707656 paint/invalidation/remove-anonymous-block-crash.html [ Crash Pass ] # TextIterator differ in trailing spaces. crbug.com/591099 fast/text/bidi-isolate-nextlinebreak-failure.html [ Failure ] @@ -35,13 +33,9 @@ crbug.com/591099 fast/text/whitespace/028.html [ Failure ] # Fix only in NGPaint. -crbug.com/591099 fast/text/justify-ideograph-leading-expansion.html [ Failure Pass ] -crbug.com/591099 fast/text/justify-nbsp.html [ Failure Pass ] -crbug.com/591099 fast/text/justify-vertical.html [ Failure Pass ] crbug.com/591099 fast/text/word-space.html [ Failure ] # Glyph overflow. -crbug.com/591099 fast/text/shadow-no-blur.html [ Failure Pass ] # Improved shaping we can rebase once we switch. crbug.com/591099 fast/text/font-initial.html [ Failure ] @@ -50,7 +44,6 @@ # Non-interoperable behavior not worth to fix. crbug.com/591099 fast/text/apply-start-width-after-skipped-text.html [ Skip ] -crbug.com/714962 intersection-observer/text-target.html [ Failure Pass ] # New passes crbug.com/626703 external/wpt/css/css-ui/text-overflow-021.html [ Failure ] @@ -118,7 +111,6 @@ crbug.com/591099 accessibility/removed-continuation-element-causes-crash.html [ Failure ] crbug.com/591099 accessibility/role-attribute.html [ Crash ] crbug.com/591099 accessibility/scroll-div-horiz-sends-notification.html [ Failure ] -crbug.com/591099 accessibility/set-selection-whitespace.html [ Failure Pass ] crbug.com/591099 accessibility/slider-thumb-bounds.html [ Crash ] crbug.com/591099 accessibility/table-cells.html [ Failure Pass ] crbug.com/591099 accessibility/table-header-column-row.html [ Failure Timeout ] @@ -221,7 +213,6 @@ crbug.com/591099 compositing/gestures/gesture-tapHighlight-2-iframe-scrolled-outer.html [ Failure ] crbug.com/591099 compositing/gestures/gesture-tapHighlight-2-iframe.html [ Failure ] crbug.com/591099 compositing/gestures/gesture-tapHighlight-img-and-text-2.html [ Failure ] -crbug.com/591099 compositing/gestures/gesture-tapHighlight-img-transformed.html [ Failure Pass ] crbug.com/591099 compositing/iframes/become-composited-nested-iframes.html [ Failure ] crbug.com/591099 compositing/iframes/become-overlapped-iframe.html [ Failure ] crbug.com/591099 compositing/iframes/composited-iframe-alignment.html [ Failure ] @@ -317,7 +308,6 @@ crbug.com/591099 compositing/overflow/clip-parent-reset.html [ Failure ] crbug.com/591099 compositing/overflow/clipping-ancestor-with-accelerated-scrolling-ancestor.html [ Failure ] crbug.com/591099 compositing/overflow/composited-layer-under-border-radius-under-composited-layer.html [ Failure ] -crbug.com/591099 compositing/overflow/composited-nested-sticky-left.html [ Failure Pass ] crbug.com/591099 compositing/overflow/composited-scrolling-paint-phases.html [ Failure ] crbug.com/591099 compositing/overflow/content-gains-scrollbars.html [ Failure ] crbug.com/591099 compositing/overflow/content-loses-scrollbars.html [ Failure ] @@ -409,7 +399,6 @@ crbug.com/591099 compositing/rtl/rtl-iframe-relative.html [ Failure ] crbug.com/591099 compositing/rtl/rtl-overflow-scrolling.html [ Failure ] crbug.com/591099 compositing/rtl/rtl-relative.html [ Failure ] -crbug.com/591099 compositing/scrollbars/nested-overlay-scrollbars.html [ Crash ] crbug.com/591099 compositing/self-painting-layers.html [ Failure ] crbug.com/591099 compositing/shadows/shadow-drawing.html [ Failure ] crbug.com/591099 compositing/sibling-positioning.html [ Failure ] @@ -582,7 +571,6 @@ crbug.com/591099 css2.1/20110323/border-conflict-style-079.htm [ Failure ] crbug.com/591099 css2.1/20110323/border-conflict-style-088.htm [ Failure ] crbug.com/591099 css2.1/20110323/border-spacing-applies-to-015.htm [ Failure ] -crbug.com/591099 css2.1/20110323/c541-word-sp-001.htm [ Failure Pass ] crbug.com/591099 css2.1/20110323/c543-txt-decor-000.html [ Failure ] crbug.com/591099 css2.1/20110323/height-width-inline-table-001.htm [ Failure ] crbug.com/591099 css2.1/20110323/height-width-table-001.htm [ Failure ] @@ -1971,7 +1959,7 @@ crbug.com/591099 css3/selectors3/xml/css3-modsel-d3.xml [ Failure ] crbug.com/591099 css3/selectors3/xml/css3-modsel-d4.xml [ Failure ] crbug.com/591099 editing/assert_selection.html [ Failure ] -crbug.com/591099 editing/caret/caret-color-001.html [ Failure ] +crbug.com/591099 editing/caret/caret-color-001.html [ Failure Timeout ] crbug.com/591099 editing/caret/caret-color-002.html [ Crash Failure ] crbug.com/591099 editing/caret/caret-color-003.html [ Crash Failure Timeout ] crbug.com/591099 editing/caret/caret-color-004.html [ Crash Failure ] @@ -1997,7 +1985,6 @@ crbug.com/591099 editing/deleting/5483370.html [ Crash Failure ] crbug.com/591099 editing/deleting/delete-3865854-fix.html [ Failure ] crbug.com/591099 editing/deleting/delete-at-paragraph-boundaries-011.html [ Failure Timeout ] -crbug.com/591099 editing/deleting/delete-block-table.html [ Failure Pass ] crbug.com/591099 editing/deleting/delete-br-013.html [ Failure ] crbug.com/591099 editing/deleting/delete-empty-table.html [ Failure ] crbug.com/591099 editing/deleting/delete-line-001.html [ Failure ] @@ -2014,16 +2001,10 @@ crbug.com/591099 editing/deleting/delete-line-015.html [ Failure ] crbug.com/591099 editing/deleting/delete-line-016.html [ Failure ] crbug.com/591099 editing/deleting/delete-line-017.html [ Failure ] -crbug.com/591099 editing/deleting/delete_block_merge_contents_1.html [ Failure Pass ] crbug.com/591099 editing/deleting/merge-different-styles.html [ Failure ] crbug.com/591099 editing/deleting/merge-endOfParagraph.html [ Failure ] crbug.com/591099 editing/deleting/merge-no-br.html [ Crash Failure ] -crbug.com/591099 editing/deleting/merge-paragraph-from-address.html [ Failure Pass Timeout ] -crbug.com/591099 editing/deleting/merge-paragraph-from-listing.html [ Failure Pass ] -crbug.com/591099 editing/deleting/merge-paragraph-into-blockquote.html [ Failure Pass ] -crbug.com/591099 editing/deleting/merge-paragraph-into-pre.html [ Failure Pass ] crbug.com/591099 editing/deleting/merge-whitespace-pre.html [ Failure ] -crbug.com/591099 editing/deleting/merge_paragraph_into_h1.html [ Failure Pass ] crbug.com/591099 editing/deleting/move-nodes-001.html [ Failure ] crbug.com/591099 editing/deleting/table-cells.html [ Failure ] crbug.com/591099 editing/deleting/transpose-empty.html [ Failure ] @@ -2046,12 +2027,10 @@ crbug.com/591099 editing/execCommand/insertImage.html [ Failure ] crbug.com/591099 editing/execCommand/outdent-collapse-table-crash-2.html [ Crash Pass ] crbug.com/591099 editing/execCommand/outdent-multiparagraph-list.html [ Failure ] -crbug.com/591099 editing/execCommand/outdent-selection.html [ Crash Failure Pass ] crbug.com/591099 editing/execCommand/query-command-state.html [ Timeout ] crbug.com/591099 editing/execCommand/query-format-block.html [ Pass Timeout ] crbug.com/591099 editing/execCommand/queryCommandState-02.html [ Failure ] crbug.com/591099 editing/execCommand/remove-list-from-range-selection.html [ Failure ] -crbug.com/591099 editing/execCommand/selection-after-insert-list.html [ Failure Pass ] crbug.com/591099 editing/input/caret-at-the-edge-of-contenteditable.html [ Failure ] crbug.com/591099 editing/input/caret-at-the-edge-of-input.html [ Failure ] crbug.com/591099 editing/input/caret-read-only-after-editable.html [ Failure ] @@ -2108,14 +2087,7 @@ crbug.com/591099 editing/pasteboard/copy-in-password-field.html [ Failure ] crbug.com/591099 editing/pasteboard/copy-paste-white-space.html [ Crash Failure ] crbug.com/591099 editing/pasteboard/copy-standalone-image.html [ Failure ] -crbug.com/591099 editing/pasteboard/drag-and-drop-image-contenteditable.html [ Pass Timeout ] -crbug.com/591099 editing/pasteboard/drag-and-drop-inputimage-contenteditable.html [ Pass Timeout ] -crbug.com/591099 editing/pasteboard/drag-and-drop-objectimage-contenteditable.html [ Pass Timeout ] -crbug.com/591099 editing/pasteboard/drag-drop-dead-frame.html [ Pass Timeout ] -crbug.com/591099 editing/pasteboard/drag-drop-modifies-page.html [ Failure Pass ] crbug.com/591099 editing/pasteboard/drag-drop-url-text.html [ Failure ] -crbug.com/591099 editing/pasteboard/drag-drop-url-with-style.html [ Failure Pass ] -crbug.com/591099 editing/pasteboard/drag-image-in-about-blank-frame.html [ Failure Pass ] crbug.com/591099 editing/pasteboard/drag-image-to-contenteditable-in-iframe.html [ Failure ] crbug.com/591099 editing/pasteboard/drag-list-item.html [ Failure ] crbug.com/591099 editing/pasteboard/drag-selected-image-to-contenteditable.html [ Failure ] @@ -2127,7 +2099,6 @@ crbug.com/591099 editing/pasteboard/input-field-1.html [ Failure ] crbug.com/591099 editing/pasteboard/merge-start-blockquote.html [ Failure ] crbug.com/591099 editing/pasteboard/merge-start-list.html [ Failure ] -crbug.com/591099 editing/pasteboard/mixed_editability.html [ Failure Pass ] crbug.com/591099 editing/pasteboard/paste-blockquote-after-blockquote.html [ Failure ] crbug.com/591099 editing/pasteboard/paste-blockquote-into-blockquote-4.html [ Failure ] crbug.com/591099 editing/pasteboard/paste-line-endings-001.html [ Failure ] @@ -2139,14 +2110,9 @@ crbug.com/591099 editing/pasteboard/paste-pre-001.html [ Failure ] crbug.com/591099 editing/pasteboard/paste-text-016.html [ Failure ] crbug.com/591099 editing/pasteboard/paste-text-at-tabspan-003.html [ Failure ] -crbug.com/591099 editing/pasteboard/paste-visible-script.html [ Failure Pass ] crbug.com/591099 editing/pasteboard/pasting-tabs.html [ Failure ] crbug.com/591099 editing/pasteboard/quirks-mode-br-1.html [ Failure ] -crbug.com/591099 editing/pasteboard/smart-drag-drop.html [ Failure Pass ] -crbug.com/591099 editing/pasteboard/smart-paste-in-text-control.html [ Failure Pass ] -crbug.com/591099 editing/pasteboard/smart_paste.html [ Failure Pass ] crbug.com/591099 editing/pasteboard/styled-element-markup.html [ Failure ] -crbug.com/591099 editing/pasteboard/subframe-dragndrop-1.html [ Failure Pass ] crbug.com/591099 editing/selection/4402375.html [ Failure ] crbug.com/591099 editing/selection/4776665.html [ Failure ] crbug.com/591099 editing/selection/4960137.html [ Failure ] @@ -2182,12 +2148,9 @@ crbug.com/591099 editing/selection/dont-select-text-overflow-ellipsis-when-wrapping-rtl-mixed.html [ Crash Failure ] crbug.com/591099 editing/selection/dont-select-text-overflow-ellipsis-when-wrapping-rtl.html [ Crash Failure ] crbug.com/591099 editing/selection/dont-select-text-overflow-ellipsis-when-wrapping.html [ Crash Failure ] -crbug.com/591099 editing/selection/double_click_and_modify.html [ Failure Pass ] crbug.com/591099 editing/selection/doubleclick-beside-cr-span.html [ Failure Timeout ] -crbug.com/591099 editing/selection/doubleclick-whitespace.html [ Failure Pass ] crbug.com/591099 editing/selection/drag-in-iframe.html [ Failure ] crbug.com/591099 editing/selection/drag-select-1.html [ Crash Failure ] -crbug.com/591099 editing/selection/drag-selection-nodes.html [ Failure Pass ] crbug.com/591099 editing/selection/drag-to-contenteditable-iframe.html [ Failure ] crbug.com/591099 editing/selection/drag_with_unfocused_selection.html [ Failure ] crbug.com/591099 editing/selection/editable-div-clear-on-keydown.html [ Failure ] @@ -2201,9 +2164,7 @@ crbug.com/591099 editing/selection/extend-selection-character.html [ Timeout ] crbug.com/591099 editing/selection/extend-selection-home-end.html [ Timeout ] crbug.com/591099 editing/selection/extend-selection-word.html [ Timeout ] -crbug.com/591099 editing/selection/find-in-text-control.html [ Failure Pass ] crbug.com/591099 editing/selection/focus-body.html [ Failure ] -crbug.com/591099 editing/selection/focus_editable_html_element.html [ Pass Timeout ] crbug.com/591099 editing/selection/home-end.html [ Timeout ] crbug.com/591099 editing/selection/inactive-selection.html [ Failure ] crbug.com/591099 editing/selection/inline-closest-leaf-child.html [ Failure ] @@ -2221,13 +2182,9 @@ crbug.com/591099 editing/selection/mixed-editability-8.html [ Failure ] crbug.com/591099 editing/selection/mixed-editability-9.html [ Failure ] crbug.com/591099 editing/selection/modify_extend/extend_by_character.html [ Failure ] -crbug.com/591099 editing/selection/modify_extend/extend_selection_enclosing_block.html [ Failure Pass ] crbug.com/591099 editing/selection/modify_move/move_by_sentence_boundary.html [ Failure ] crbug.com/591099 editing/selection/mouse/click-left-of-rtl-wrapping-text.html [ Failure ] -crbug.com/591099 editing/selection/mouse/click-user-select-all-contenteditable.html [ Failure Pass ] crbug.com/591099 editing/selection/mouse/click-user-select-all-textarea.html [ Failure ] -crbug.com/591099 editing/selection/mouse/drag-user-select-all-contenteditable.html [ Failure Pass ] -crbug.com/591099 editing/selection/mouse/drag-user-select-all-textarea.html [ Failure Pass ] crbug.com/591099 editing/selection/mouse/extend_by_word_with_base_is_end.html [ Failure ] crbug.com/591099 editing/selection/move-3875618-fix.html [ Failure ] crbug.com/591099 editing/selection/move-3875641-fix.html [ Failure ] @@ -2240,12 +2197,10 @@ crbug.com/591099 editing/selection/move-past-trailing-space.html [ Failure ] crbug.com/591099 editing/selection/paint-hyphen.html [ Failure ] crbug.com/591099 editing/selection/paragraph-granularity.html [ Failure ] -crbug.com/591099 editing/selection/paragraph-with-ruby.html [ Failure Pass ] crbug.com/591099 editing/selection/previous-line-position.html [ Failure ] crbug.com/591099 editing/selection/programmatic-selection-on-mac-is-directionless.html [ Crash Timeout ] crbug.com/591099 editing/selection/range-between-block-and-inline.html [ Failure ] crbug.com/591099 editing/selection/readonly-disabled-hittest.html [ Failure ] -crbug.com/591099 editing/selection/readonly-disabled-text-selection.html [ Failure Pass ] crbug.com/591099 editing/selection/replaced-boundaries-1.html [ Failure ] crbug.com/591099 editing/selection/replaced-boundaries-2.html [ Failure ] crbug.com/591099 editing/selection/replaced-boundaries-3.html [ Failure ] @@ -2268,8 +2223,6 @@ crbug.com/591099 editing/selection/select-text-overflow-ellipsis.html [ Crash Failure ] crbug.com/591099 editing/selection/selectNode.html [ Failure ] crbug.com/591099 editing/selection/selectNodeContents.html [ Failure ] -crbug.com/591099 editing/selection/select_all/select_all_overflow_hidden_table.html [ Failure Pass ] -crbug.com/591099 editing/selection/select_all/select_all_user_select_none.html [ Failure Pass ] crbug.com/591099 editing/selection/selection-3748164-fix.html [ Failure ] crbug.com/591099 editing/selection/selection-background.html [ Failure ] crbug.com/591099 editing/selection/selection-button-text.html [ Failure ] @@ -2277,13 +2230,10 @@ crbug.com/591099 editing/selection/shift-click.html [ Failure ] crbug.com/591099 editing/selection/transformed-selection-rects.html [ Failure ] crbug.com/591099 editing/selection/triple-click-in-pre.html [ Failure ] -crbug.com/591099 editing/selection/user-select-all-with-shift.html [ Failure Pass ] crbug.com/591099 editing/selection/user-select/user-select-all.html [ Failure ] crbug.com/591099 editing/selection/word-granularity.html [ Failure ] crbug.com/591099 editing/selection/wrapped-line-caret-1.html [ Failure ] crbug.com/591099 editing/selection/wrapped-line-caret-2.html [ Failure ] -crbug.com/591099 editing/spelling/context_click_on_selected_misspelling.html [ Pass Timeout ] -crbug.com/591099 editing/spelling/context_click_select_misspelling.html [ Failure Pass ] crbug.com/591099 editing/style/4916887.html [ Failure ] crbug.com/591099 editing/style/5065910.html [ Failure ] crbug.com/591099 editing/style/5084241.html [ Failure ] @@ -2295,8 +2245,6 @@ crbug.com/591099 editing/style/block-styles-007.html [ Failure ] crbug.com/591099 editing/style/font-family-with-space.html [ Failure ] crbug.com/591099 editing/style/highlight.html [ Failure ] -crbug.com/591099 editing/style/justify-without-enclosing-block.xhtml [ Failure Pass ] -crbug.com/591099 editing/style/non-inheritable-styles.html [ Failure Pass ] crbug.com/591099 editing/style/remove-underline-across-paragraph-in-bold.html [ Crash Failure ] crbug.com/591099 editing/style/remove-underline-across-paragraph.html [ Crash Failure ] crbug.com/591099 editing/style/table-selection.html [ Failure ] @@ -2335,29 +2283,17 @@ crbug.com/591099 external/wpt/css/CSS2/floats/floats-wrap-bfc-003-right-table.xht [ Failure Pass ] crbug.com/591099 external/wpt/css/CSS2/floats/floats-wrap-bfc-004.xht [ Failure ] crbug.com/591099 external/wpt/css/CSS2/floats/floats-zero-height-wrap-002.xht [ Failure ] -crbug.com/591099 external/wpt/css/CSS2/linebox/inline-formatting-context-001.xht [ Failure Pass ] crbug.com/591099 external/wpt/css/CSS2/normal-flow/block-in-inline-percents-001.xht [ Failure ] crbug.com/591099 external/wpt/css/CSS2/normal-flow/max-height-percentage-002.xht [ Failure ] crbug.com/591099 external/wpt/css/CSS2/normal-flow/root-box-001.xht [ Failure ] crbug.com/591099 external/wpt/css/CSS2/positioning/abspos-007.xht [ Failure ] -crbug.com/591099 external/wpt/css/CSS2/positioning/position-relative-027.xht [ Failure Pass ] -crbug.com/591099 external/wpt/css/CSS2/positioning/position-relative-028.xht [ Failure Pass ] -crbug.com/591099 external/wpt/css/CSS2/positioning/position-relative-029.xht [ Failure Pass ] -crbug.com/591099 external/wpt/css/CSS2/positioning/position-relative-030.xht [ Failure Pass ] -crbug.com/591099 external/wpt/css/CSS2/positioning/positioning-float-002.xht [ Failure Pass ] crbug.com/591099 external/wpt/css/CSS2/positioning/relpos-calcs-004.xht [ Failure ] crbug.com/591099 external/wpt/css/CSS2/positioning/relpos-calcs-005.xht [ Failure ] crbug.com/591099 external/wpt/css/CSS2/text/text-decoration-applies-to-015.xht [ Failure ] crbug.com/591099 external/wpt/css/CSS2/text/text-indent-012.xht [ Failure ] crbug.com/591099 external/wpt/css/CSS2/text/text-indent-percent-001.xht [ Failure ] -crbug.com/591099 external/wpt/css/CSS2/text/text-transform-capitalize-003.xht [ Failure Pass ] -crbug.com/591099 external/wpt/css/css-display/display-contents-dynamic-flex-002-inline.html [ Failure Pass ] -crbug.com/591099 external/wpt/css/css-display/display-contents-dynamic-flex-002-none.html [ Failure Pass ] crbug.com/591099 external/wpt/css/css-display/display-contents-dynamic-table-001-inline.html [ Failure ] crbug.com/591099 external/wpt/css/css-display/display-flow-root-001.html [ Failure ] -crbug.com/591099 external/wpt/css/css-flexbox/anonymous-flex-item-001.html [ Failure Pass ] -crbug.com/591099 external/wpt/css/css-flexbox/anonymous-flex-item-003.html [ Failure Pass ] -crbug.com/591099 external/wpt/css/css-flexbox/anonymous-flex-item-006.html [ Failure Pass ] crbug.com/591099 external/wpt/css/css-flexbox/percentage-heights-001.html [ Failure ] crbug.com/591099 external/wpt/css/css-fonts/matching/stretch-distance-over-weight-distance.html [ Pass ] crbug.com/591099 external/wpt/css/css-fonts/matching/style-ranges-over-weight-direction.html [ Pass ] @@ -2519,9 +2455,6 @@ crbug.com/591099 external/wpt/css/css-ui/box-sizing-009.html [ Failure ] crbug.com/591099 external/wpt/css/css-ui/outline-011.html [ Failure Pass ] crbug.com/591099 external/wpt/css/css-ui/outline-019.html [ Failure Pass ] -crbug.com/591099 external/wpt/css/css-ui/text-overflow-002.html [ Failure Pass ] -crbug.com/591099 external/wpt/css/css-ui/text-overflow-004.html [ Failure Pass ] -crbug.com/591099 external/wpt/css/css-ui/text-overflow-007.html [ Failure Pass ] crbug.com/591099 external/wpt/css/css-ui/text-overflow-012.html [ Failure ] crbug.com/591099 external/wpt/css/css-ui/text-overflow-013.html [ Failure ] crbug.com/591099 external/wpt/css/css-ui/text-overflow-014.html [ Crash Failure ] @@ -2548,18 +2481,12 @@ crbug.com/591099 external/wpt/css/css-writing-modes/float-contiguous-vrl-004.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/float-contiguous-vrl-006.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/float-contiguous-vrl-008.xht [ Failure ] -crbug.com/591099 external/wpt/css/css-writing-modes/float-lft-orthog-htb-in-vrl-002.xht [ Failure Pass ] -crbug.com/591099 external/wpt/css/css-writing-modes/float-rgt-orthog-htb-in-vrl-003.xht [ Failure Pass ] crbug.com/591099 external/wpt/css/css-writing-modes/float-vlr-013.xht [ Failure ] -crbug.com/591099 external/wpt/css/css-writing-modes/float-vrl-002.xht [ Failure Pass ] crbug.com/591099 external/wpt/css/css-writing-modes/float-vrl-004.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/float-vrl-006.xht [ Failure Pass ] -crbug.com/591099 external/wpt/css/css-writing-modes/float-vrl-010.xht [ Failure Pass ] crbug.com/591099 external/wpt/css/css-writing-modes/float-vrl-012.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/horizontal-rule-vrl-002.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/inline-block-alignment-006.xht [ Failure ] -crbug.com/591099 external/wpt/css/css-writing-modes/inline-table-alignment-002.xht [ Failure Pass ] -crbug.com/591099 external/wpt/css/css-writing-modes/inline-table-alignment-004.xht [ Failure Pass ] crbug.com/591099 external/wpt/css/css-writing-modes/margin-collapse-vrl-010.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/ortho-htb-alongside-vrl-floats-002.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/ortho-htb-alongside-vrl-floats-010.xht [ Failure ] @@ -2606,9 +2533,7 @@ crbug.com/591099 external/wpt/css/cssom-view/elementFromPoint-002.html [ Failure ] crbug.com/591099 external/wpt/css/cssom-view/elementFromPoint-003.html [ Failure ] crbug.com/591099 external/wpt/css/cssom-view/elementFromPoint.html [ Failure ] -crbug.com/591099 external/wpt/css/cssom-view/elementsFromPoint-iframes.html [ Failure Pass ] crbug.com/591099 external/wpt/css/cssom-view/elementsFromPoint-svg.html [ Failure ] -crbug.com/591099 external/wpt/css/cssom-view/elementsFromPoint.html [ Failure Pass ] crbug.com/591099 external/wpt/css/geometry/interfaces.html [ Pass Timeout ] crbug.com/591099 external/wpt/css/geometry/interfaces.worker.html [ Pass Timeout ] crbug.com/591099 external/wpt/css/selectors/focus-within-004.html [ Failure ] @@ -2748,7 +2673,6 @@ crbug.com/591099 external/wpt/html-media-capture/capture_image_cancel-manual.html [ Failure ] crbug.com/591099 external/wpt/html-media-capture/capture_video_cancel-manual.html [ Failure ] crbug.com/591099 external/wpt/html/browsers/windows/noreferrer-window-name.html [ Timeout ] -crbug.com/591099 external/wpt/html/dom/documents/dom-tree-accessors/Document.currentScript.html [ Crash Pass ] crbug.com/591099 external/wpt/html/dom/interfaces.html [ Timeout ] crbug.com/591099 external/wpt/html/infrastructure/urls/resolving-urls/query-encoding/utf-16be.html [ Timeout ] crbug.com/591099 external/wpt/html/infrastructure/urls/resolving-urls/query-encoding/utf-16le.html [ Crash Timeout ] @@ -2761,11 +2685,6 @@ crbug.com/591099 external/wpt/html/rendering/replaced-elements/svg-embedded-sizing/svg-in-img-auto.html [ Failure ] crbug.com/591099 external/wpt/html/rendering/replaced-elements/svg-embedded-sizing/svg-in-img-percentage.html [ Failure ] crbug.com/591099 external/wpt/html/rendering/replaced-elements/svg-inline-sizing/svg-inline.html [ Failure Timeout ] -crbug.com/591099 external/wpt/html/semantics/embedded-content/the-area-element/area-coords.html [ Failure Pass ] -crbug.com/591099 external/wpt/html/semantics/embedded-content/the-area-element/area-processing.html [ Failure Pass ] -crbug.com/591099 external/wpt/html/semantics/embedded-content/the-area-element/area-shape.html [ Failure Pass ] -crbug.com/591099 external/wpt/html/semantics/embedded-content/the-img-element/usemap-casing.html [ Failure Pass ] -crbug.com/591099 external/wpt/html/semantics/embedded-content/the-object-element/usemap-casing.html [ Failure Pass ] crbug.com/591099 external/wpt/html/semantics/grouping-content/the-li-element/grouping-li-reftest-002.html [ Failure ] crbug.com/591099 external/wpt/html/semantics/grouping-content/the-li-element/grouping-li-reftest-list-owner-menu.html [ Failure ] crbug.com/591099 external/wpt/html/semantics/grouping-content/the-li-element/grouping-li-reftest-list-owner-skip-no-boxes.html [ Failure ] @@ -2880,7 +2799,7 @@ crbug.com/591099 fast/backgrounds/background-svg-scaling.html [ Failure ] crbug.com/591099 fast/backgrounds/background-with-sub-pixel-offset-positioning.html [ Failure ] crbug.com/591099 fast/backgrounds/body-generated-image-propagated-to-root.html [ Failure ] -crbug.com/591099 fast/backgrounds/border-radius-split-background-image.html [ Failure ] +crbug.com/591099 fast/backgrounds/border-radius-split-background-image.html [ Crash Failure ] crbug.com/591099 fast/backgrounds/border-radius-split-background.html [ Failure ] crbug.com/591099 fast/backgrounds/gradient-background-leakage-2.html [ Failure ] crbug.com/591099 fast/backgrounds/gradient-background-leakage-hidpi.html [ Failure ] @@ -2962,7 +2881,6 @@ crbug.com/591099 fast/block/float/negative-margin-on-element-avoiding-floats.html [ Failure ] crbug.com/591099 fast/block/float/nopaint-after-layer-destruction.html [ Failure ] crbug.com/591099 fast/block/float/nopaint-after-layer-destruction2.html [ Failure ] -crbug.com/591099 fast/block/float/overhanging-float-crashes-when-sibling-becomes-formatting-context.html [ Failure Pass ] crbug.com/591099 fast/block/float/overhanging-float-remove-from-fixed-position-block.html [ Failure ] crbug.com/591099 fast/block/float/overhanging-float-remove-from-fixed-position-block2.html [ Failure ] crbug.com/591099 fast/block/float/overlapping-floats-paint-hittest-order-1.html [ Failure ] @@ -3141,7 +3059,6 @@ crbug.com/591099 fast/canvas/canvas-shadow-source-in.html [ Failure ] crbug.com/591099 fast/canvas/canvas-transforms-during-path.html [ Failure ] crbug.com/591099 fast/canvas/fill-stroke-clip-reset-path.html [ Failure ] -crbug.com/591099 fast/canvas/fillrect_gradient.html [ Failure Pass ] crbug.com/591099 fast/canvas/patternfill-repeat.html [ Failure ] crbug.com/591099 fast/clip/001.html [ Failure ] crbug.com/591099 fast/clip/004.html [ Failure ] @@ -3223,8 +3140,6 @@ crbug.com/591099 fast/css-grid-layout/grid-columns-rows-get-set.html [ Timeout ] crbug.com/591099 fast/css-grid-layout/grid-container-change-explicit-grid-recompute-child.html [ Failure ] crbug.com/591099 fast/css-grid-layout/grid-container-change-named-grid-lines-recompute-child.html [ Failure ] -crbug.com/591099 fast/css-grid-layout/grid-container-ignore-first-letter.html [ Failure ] -crbug.com/591099 fast/css-grid-layout/grid-container-ignore-first-line.html [ Failure ] crbug.com/591099 fast/css-grid-layout/grid-container-scroll-accounts-for-sizing.html [ Failure ] crbug.com/591099 fast/css-grid-layout/grid-dynamic-updates-relayout.html [ Failure ] crbug.com/591099 fast/css-grid-layout/grid-gutters-and-flex-content.html [ Failure ] @@ -3293,8 +3208,6 @@ crbug.com/591099 fast/css-grid-layout/minmax-min-content-column-resolution-rows.html [ Failure ] crbug.com/591099 fast/css-grid-layout/minmax-spanning-resolution-columns.html [ Failure ] crbug.com/591099 fast/css-grid-layout/minmax-spanning-resolution-rows.html [ Failure ] -crbug.com/591099 fast/css-grid-layout/mozilla/grid-repeat-auto-fill-fit-005-part-1.html [ Failure Pass ] -crbug.com/591099 fast/css-grid-layout/mozilla/grid-repeat-auto-fill-fit-005-part-2.html [ Failure Pass ] crbug.com/591099 fast/css-grid-layout/named-grid-line-get-set.html [ Pass Timeout ] crbug.com/591099 fast/css-grid-layout/named-grid-lines-with-named-grid-areas-dynamic-get-set.html [ Failure ] crbug.com/591099 fast/css-grid-layout/named-grid-lines-with-named-grid-areas-resolution.html [ Failure ] @@ -3382,7 +3295,6 @@ crbug.com/591099 fast/css/containment/size-and-layout-containment.html [ Failure ] crbug.com/591099 fast/css/continuationCrash.html [ Failure ] crbug.com/591099 fast/css/counters/counter-traverse-table-cell.html [ Failure ] -crbug.com/591099 fast/css/counters/nesting.html [ Crash Pass ] crbug.com/591099 fast/css/create_element_align.xhtml [ Failure ] crbug.com/591099 fast/css/css-imports.html [ Failure ] crbug.com/591099 fast/css/css-properties-position-relative-as-parent-fixed.html [ Failure ] @@ -3392,7 +3304,6 @@ crbug.com/591099 fast/css/css3-nth-child.html [ Failure ] crbug.com/591099 fast/css/css3-space-in-nth-and-lang.html [ Failure ] crbug.com/591099 fast/css/dfn-default-font-style.html [ Failure ] -crbug.com/591099 fast/css/dynamic-class-pseudo-elements.html [ Crash Pass ] crbug.com/591099 fast/css/dynamic-sibling-selector.html [ Failure ] crbug.com/591099 fast/css/empty-body-test.html [ Crash Failure ] crbug.com/591099 fast/css/empty-generated-content.html [ Failure ] @@ -3441,7 +3352,6 @@ crbug.com/591099 fast/css/h1-in-section-elements.html [ Failure ] crbug.com/591099 fast/css/hover-active-quirks.html [ Failure ] crbug.com/591099 fast/css/hover-affects-ancestor.html [ Failure ] -crbug.com/591099 fast/css/hover-after-clicking-embed.html [ Failure Pass ] crbug.com/591099 fast/css/hover-subselector.html [ Failure ] crbug.com/591099 fast/css/hsl-color.html [ Failure ] crbug.com/591099 fast/css/hsla-color.html [ Failure ] @@ -3577,8 +3487,6 @@ crbug.com/591099 fast/css/text-overflow-ellipsis-text-align-justify.html [ Failure ] crbug.com/591099 fast/css/text-overflow-ellipsis-text-align-left.html [ Failure ] crbug.com/591099 fast/css/text-overflow-ellipsis-text-align-right.html [ Failure ] -crbug.com/591099 fast/css/text-overflow-ellipsis-vertical-select.html [ Failure Pass ] -crbug.com/591099 fast/css/text-overflow-ellipsis-vertical.html [ Failure Pass ] crbug.com/591099 fast/css/text-overflow-ellipsis.html [ Failure ] crbug.com/591099 fast/css/text-overflow-input.html [ Failure ] crbug.com/591099 fast/css/text-rendering.html [ Failure ] @@ -3610,7 +3518,6 @@ crbug.com/591099 fast/css3-text/css3-text-indent/text-indent-each-line-hanging.html [ Failure ] crbug.com/591099 fast/css3-text/css3-text-indent/text-indent-leading-out-of-flow.html [ Failure ] crbug.com/591099 fast/css3-text/css3-text-indent/text-indent-out-of-flow-each-line-hanging.html [ Failure ] -crbug.com/591099 fast/css3-text/css3-text-justify/text-justify-8bits.html [ Failure Pass ] crbug.com/591099 fast/css3-text/css3-text-justify/text-justify-distribute.html [ Failure ] crbug.com/591099 fast/deprecated-flexbox/004.html [ Failure ] crbug.com/591099 fast/deprecated-flexbox/009-horizontal.html [ Failure ] @@ -3620,7 +3527,6 @@ crbug.com/591099 fast/deprecated-flexbox/relpos-flex-item-with-percent-height-abspos-child.html [ Failure ] crbug.com/591099 fast/deprecated-flexbox/relpos-flex-item-with-percent-height-abspos-descendant.html [ Failure ] crbug.com/591099 fast/deprecated-flexbox/repaint-scrollbar.html [ Failure ] -crbug.com/591099 fast/dnd/dropEffect-for-image.html [ Pass Timeout ] crbug.com/591099 fast/doctypes/001.html [ Failure ] crbug.com/591099 fast/doctypes/002.html [ Failure ] crbug.com/591099 fast/doctypes/003.html [ Failure ] @@ -3628,7 +3534,6 @@ crbug.com/591099 fast/dom/34176.html [ Failure ] crbug.com/591099 fast/dom/52776.html [ Failure ] crbug.com/591099 fast/dom/Document/CaretRangeFromPoint/caretRangeFromPoint-with-before-style.html [ Failure ] -crbug.com/591099 fast/dom/Document/document-elementFromPoint-on-option-element.html [ Failure Pass ] crbug.com/591099 fast/dom/Element/class-attribute-whitespace.html [ Failure ] crbug.com/591099 fast/dom/Element/getBoundingClientRect.html [ Failure ] crbug.com/591099 fast/dom/Element/null-offset-parent.html [ Failure ] @@ -3694,13 +3599,11 @@ crbug.com/591099 fast/dom/empty-hash-and-search.html [ Failure ] crbug.com/591099 fast/dom/focus-contenteditable.html [ Failure ] crbug.com/591099 fast/dom/fragment-activation-focuses-target.html [ Failure ] -crbug.com/591099 fast/dom/horizontal-scrollbar-in-rtl.html [ Failure Pass ] crbug.com/591099 fast/dom/importNodeHTML.html [ Failure ] crbug.com/591099 fast/dom/importNodeXML.xhtml [ Failure ] crbug.com/591099 fast/dom/inner-text-001.html [ Failure ] crbug.com/591099 fast/dom/inner-text-first-letter.html [ Failure ] crbug.com/591099 fast/dom/inner-text.html [ Failure ] -crbug.com/591099 fast/dom/insertedIntoDocument-child.html [ Failure Pass ] crbug.com/591099 fast/dom/insertedIntoDocument-no-crash.html [ Failure ] crbug.com/591099 fast/dom/insertedIntoDocument-sibling.html [ Failure ] crbug.com/591099 fast/dom/nodesFromRect/nodesFromRect-basic.html [ Failure ] @@ -3711,7 +3614,6 @@ crbug.com/591099 fast/dom/offset-parent-positioned-and-inline.html [ Failure ] crbug.com/591099 fast/dom/open-and-close-by-DOM.html [ Failure ] crbug.com/591099 fast/dom/outerText.html [ Failure ] -crbug.com/591099 fast/dom/replaced-image-map.html [ Failure Pass ] crbug.com/591099 fast/dom/row-inner-text.html [ Failure ] crbug.com/591099 fast/dom/rtl-scroll-to-leftmost-and-resize.html [ Failure ] crbug.com/591099 fast/dom/scroll-reveal-left-overflow.html [ Failure ] @@ -3719,7 +3621,6 @@ crbug.com/591099 fast/dom/set-outer-html.html [ Failure ] crbug.com/591099 fast/dom/shadow/content-child-whitespace-between-span.html [ Crash ] crbug.com/591099 fast/dom/shadow/querySelector-for-useragent-shadowroot.html [ Crash ] -crbug.com/591099 fast/dom/shadow/selection-in-nested-shadow.html [ Failure Pass ] crbug.com/591099 fast/dom/shadow/selections-in-shadow.html [ Timeout ] crbug.com/591099 fast/dom/shadow/shadow-contents-event.html [ Crash ] crbug.com/591099 fast/dom/shadow/shadow-dom-event-dispatching-details-summary.html [ Crash ] @@ -3785,14 +3686,12 @@ crbug.com/591099 fast/encoding/invalid-UTF-8.html [ Failure ] crbug.com/591099 fast/encoding/latin1-unencodables.html [ Failure ] crbug.com/591099 fast/encoding/namespace-tolerance.html [ Failure ] -crbug.com/591099 fast/encoding/preload-encoding.html [ Crash Pass ] crbug.com/591099 fast/encoding/utf-16-big-endian.html [ Failure ] crbug.com/591099 fast/encoding/utf-16-little-endian.html [ Failure ] crbug.com/591099 fast/encoding/x-user-defined-unencodables.html [ Failure ] crbug.com/591099 fast/encoding/xmacroman-encoding-test.html [ Failure ] crbug.com/591099 fast/encoding/yentest2.html [ Failure ] crbug.com/591099 fast/events/anchor-empty-focus.html [ Failure ] -crbug.com/591099 fast/events/autoscroll-in-overflow-hidden-html.html [ Failure Pass ] crbug.com/591099 fast/events/autoscroll-in-textfield.html [ Failure ] crbug.com/591099 fast/events/autoscroll-nonscrollable-iframe-in-scrollable-div.html [ Failure ] crbug.com/591099 fast/events/autoscroll-should-not-stop-on-keypress.html [ Failure ] @@ -3801,48 +3700,27 @@ crbug.com/591099 fast/events/change-frame-focus.html [ Failure ] crbug.com/591099 fast/events/check-defocus-event-order-when-triggered-by-mouse-click.html [ Failure ] crbug.com/591099 fast/events/check-defocus-event-order-when-triggered-by-tab.html [ Failure ] -crbug.com/591099 fast/events/click-focus-anchor.html [ Failure Pass ] -crbug.com/591099 fast/events/click-focus-svganchor-has-ring.html [ Failure Pass ] crbug.com/591099 fast/events/click-range-slider.html [ Crash ] -crbug.com/591099 fast/events/click-svganchor-blur-refocus-window.html [ Failure Pass ] -crbug.com/591099 fast/events/click-svganchor-refocus-window.html [ Failure Pass ] crbug.com/591099 fast/events/context-no-deselect.html [ Failure ] crbug.com/591099 fast/events/domactivate-sets-underlying-click-event-as-handled.html [ Crash ] -crbug.com/591099 fast/events/drag-and-drop-autoscroll-inner-frame.html [ Pass Timeout ] -crbug.com/591099 fast/events/drag-dragend-detaches.html [ Failure Pass ] -crbug.com/591099 fast/events/drag-image-filename.html [ Pass Timeout ] crbug.com/591099 fast/events/drag-selects-image.html [ Failure ] -crbug.com/591099 fast/events/drag-svg-image-crash.html [ Pass Timeout ] crbug.com/591099 fast/events/drag_and_drop_into_removed_on_focus.html [ Failure ] -crbug.com/591099 fast/events/event-hit-testing-fallback-to-iframe.html [ Failure Pass ] crbug.com/591099 fast/events/event-listener-on-link.html [ Failure ] crbug.com/591099 fast/events/event-trusted.html [ Failure ] -crbug.com/591099 fast/events/frame-click-focus.html [ Failure Pass ] -crbug.com/591099 fast/events/frame-detached-in-mousedown.html [ Pass Timeout ] crbug.com/591099 fast/events/frame-programmatic-focus.html [ Failure ] crbug.com/591099 fast/events/frame-scroll-fake-mouse-move.html [ Failure ] crbug.com/591099 fast/events/frame-tab-focus.html [ Failure ] crbug.com/591099 fast/events/hit-test-counts.html [ Failure ] -crbug.com/591099 fast/events/iframe-mousewheel.html [ Failure Pass ] -crbug.com/591099 fast/events/iframe-onmousemove.html [ Pass Timeout ] -crbug.com/591099 fast/events/inputevents/beforeinput-remove-iframe-crash.html [ Failure Pass ] crbug.com/591099 fast/events/js-keyboard-event-creation.html [ Failure ] crbug.com/591099 fast/events/key-events-in-input-text.html [ Failure ] crbug.com/591099 fast/events/keyboardevent-getModifierState.html [ Timeout ] -crbug.com/591099 fast/events/keydown-1.html [ Failure Pass ] crbug.com/591099 fast/events/keydown-keypress-focus-change.html [ Failure ] crbug.com/591099 fast/events/keydown-keypress-preventDefault.html [ Failure ] crbug.com/591099 fast/events/keypress-focus-change.html [ Failure ] crbug.com/591099 fast/events/media-element-focus-tab.html [ Failure ] -crbug.com/591099 fast/events/middleClickAutoscroll-in-iframe.html [ Pass Timeout ] -crbug.com/591099 fast/events/middleClickAutoscroll-nested-divs-forbidden.html [ Timeout ] -crbug.com/591099 fast/events/mouse-cursor-style-change-iframe.html [ Failure Pass ] +crbug.com/591099 fast/events/middleClickAutoscroll-nested-divs-forbidden.html [ Pass Timeout ] crbug.com/591099 fast/events/mouse-drag-from-frame-to-other-frame.html [ Failure ] -crbug.com/591099 fast/events/mouse-drag-from-frame.html [ Failure Pass ] crbug.com/591099 fast/events/mouse-event-buttons-attribute.html [ Timeout ] -crbug.com/591099 fast/events/mouse-events-within-no-element.html [ Failure Pass ] -crbug.com/591099 fast/events/mouse-focus-imagemap.html [ Failure Pass ] -crbug.com/591099 fast/events/mouse-moved-remove-frame-crash.html [ Pass Timeout ] crbug.com/591099 fast/events/mouseevent-getModifierState.html [ Timeout ] crbug.com/591099 fast/events/mousemove-after-drag-over-scrollbar.html [ Failure ] crbug.com/591099 fast/events/mousemove-to-resizer-changes-cursor.html [ Failure ] @@ -3853,9 +3731,7 @@ crbug.com/591099 fast/events/onclick-list-marker.html [ Failure ] crbug.com/591099 fast/events/onload-re-entry.html [ Failure ] crbug.com/591099 fast/events/onload-webkit-before-webcore.html [ Failure ] -crbug.com/591099 fast/events/page-scaled-mouse-click-iframe.html [ Failure Pass ] crbug.com/591099 fast/events/pointer-events-2.html [ Failure ] -crbug.com/591099 fast/events/pointerevents/mouse-on-object.html [ Failure Pass ] crbug.com/591099 fast/events/pointerevents/mouse-pointer-capture-transition-events.html [ Timeout ] crbug.com/591099 fast/events/pointerevents/mouse-pointer-capture.html [ Failure Pass Timeout ] crbug.com/591099 fast/events/pointerevents/mouse-pointer-event-properties.html [ Timeout ] @@ -3866,16 +3742,12 @@ crbug.com/591099 fast/events/popup-allowed-from-gesture-initiated-event.html [ Crash Failure ] crbug.com/591099 fast/events/popup-allowed-from-gesture-only-once-iframes.html [ Timeout ] crbug.com/591099 fast/events/popup-blocked-from-different-frames.html [ Failure ] -crbug.com/591099 fast/events/popup-blocking-click-in-iframe.html [ Pass Timeout ] -crbug.com/591099 fast/events/remove-target-in-mouseup.html [ Failure Pass ] -crbug.com/591099 fast/events/remove-target-with-shadow-in-drag.html [ Failure Pass ] crbug.com/591099 fast/events/reveal-link-when-focused.html [ Failure ] crbug.com/591099 fast/events/right-click-focus.html [ Failure ] crbug.com/591099 fast/events/scroll-after-click-on-tab-index.html [ Failure ] crbug.com/591099 fast/events/scroll-div-with-prevent-default-in-subframe.html [ Failure ] crbug.com/591099 fast/events/scroll-to-anchor-in-overflow-hidden.html [ Failure ] crbug.com/591099 fast/events/select-element.html [ Timeout ] -crbug.com/591099 fast/events/select-onchange-mouse-released-outside.html [ Failure Pass ] crbug.com/591099 fast/events/selectstart-by-double-triple-clicks.html [ Failure ] crbug.com/591099 fast/events/selectstart-by-drag.html [ Failure ] crbug.com/591099 fast/events/selectstart-by-single-click-with-shift.html [ Failure ] @@ -3887,11 +3759,6 @@ crbug.com/591099 fast/events/touch/compositor-touch-hit-rects.html [ Failure ] crbug.com/591099 fast/events/touch/gesture/gesture-click-on-inline-continations.html [ Failure ] crbug.com/591099 fast/events/touch/gesture/gesture-tap-frame-move.html [ Failure ] -crbug.com/591099 fast/events/touch/gesture/gesture-tap-mouse-events-between-frames.html [ Failure Pass ] -crbug.com/591099 fast/events/touch/gesture/gesture-tap-near-iframe.html [ Failure Pass ] -crbug.com/591099 fast/events/touch/gesture/long-press-drag-drop-touch-editing-combined-in-iframe.html [ Failure Pass ] -crbug.com/591099 fast/events/touch/gesture/long-press-focuses-frame.html [ Failure Pass ] -crbug.com/591099 fast/events/touch/gesture/touch-gesture-scroll-iframe-editable.html [ Failure Pass ] crbug.com/591099 fast/events/touch/gesture/touch-gesture-scroll-iframe-past-extent.html [ Failure Timeout ] crbug.com/591099 fast/events/touch/touch-action-range-input-csp.html [ Crash ] crbug.com/591099 fast/events/touch/touch-action-range-input.html [ Crash ] @@ -3903,7 +3770,6 @@ crbug.com/591099 fast/events/window-onerror-11.html [ Failure ] crbug.com/591099 fast/events/window-onerror-12.html [ Failure ] crbug.com/591099 fast/files/file-in-input-display.html [ Failure Timeout ] -crbug.com/591099 fast/files/null-origin-string.html [ Pass Timeout ] crbug.com/591099 fast/forms/001.html [ Failure ] crbug.com/591099 fast/forms/006.html [ Failure ] crbug.com/591099 fast/forms/007.html [ Failure ] @@ -4076,12 +3942,8 @@ crbug.com/591099 fast/forms/select/listbox-appearance-basic.html [ Failure ] crbug.com/591099 fast/forms/select/listbox-bidi-align.html [ Failure ] crbug.com/591099 fast/forms/select/listbox-clip.html [ Failure ] -crbug.com/591099 fast/forms/select/listbox-drag-in-non-multiple.html [ Failure Pass ] crbug.com/591099 fast/forms/select/listbox-in-multi-column.html [ Failure ] -crbug.com/591099 fast/forms/select/listbox-onchange.html [ Failure Pass ] crbug.com/591099 fast/forms/select/listbox-scrollbar-incremental-load.html [ Failure ] -crbug.com/591099 fast/forms/select/listbox-selection-2.html [ Failure Pass ] -crbug.com/591099 fast/forms/select/listbox-selection.html [ Failure Pass ] crbug.com/591099 fast/forms/select/listbox-tap.html [ Failure ] crbug.com/591099 fast/forms/select/listbox-width-change.html [ Failure ] crbug.com/591099 fast/forms/select/listbox-with-display-none-option.html [ Failure ] @@ -4099,7 +3961,6 @@ crbug.com/591099 fast/forms/select/menulist-style-color.html [ Failure ] crbug.com/591099 fast/forms/select/menulist-update-text-popup.html [ Failure ] crbug.com/591099 fast/forms/select/menulist-width-change.html [ Failure ] -crbug.com/591099 fast/forms/select/multiselect-in-listbox-mouse-release-outside.html [ Failure Pass ] crbug.com/591099 fast/forms/select/optgroup-clicking.html [ Failure ] crbug.com/591099 fast/forms/select/optgroup-disabled.html [ Failure ] crbug.com/591099 fast/forms/select/optgroup-rendering.html [ Failure ] @@ -4128,7 +3989,6 @@ crbug.com/591099 fast/forms/select/select-generated-content.html [ Failure ] crbug.com/591099 fast/forms/select/select-initial-position.html [ Failure ] crbug.com/591099 fast/forms/select/select-item-background-clip.html [ Failure ] -crbug.com/591099 fast/forms/select/select-list-box-mouse-focus.html [ Failure Pass ] crbug.com/591099 fast/forms/select/select-list-box-with-height.html [ Failure ] crbug.com/591099 fast/forms/select/select-listbox-multiple-no-focusring.html [ Failure ] crbug.com/591099 fast/forms/select/select-multiple-elements-with-mouse-drag-with-options-less-than-size.html [ Failure ] @@ -4321,8 +4181,6 @@ crbug.com/591099 fast/hidpi/image-set-list-style-image.html [ Failure ] crbug.com/591099 fast/hidpi/image-set-shape-outside.html [ Failure ] crbug.com/591099 fast/hidpi/image-srcset-intrinsic-size.html [ Failure ] -crbug.com/591099 fast/history/form-submit-in-frame-via-onclick.html [ Pass Timeout ] -crbug.com/591099 fast/history/form-submit-in-frame.html [ Pass Timeout ] crbug.com/591099 fast/history/saves-state-after-frame-nav.html [ Failure ] crbug.com/591099 fast/html/draggable-controls.html [ Failure ] crbug.com/591099 fast/html/select-dropdown-consistent-background-color.html [ Failure ] @@ -4336,7 +4194,6 @@ crbug.com/591099 fast/inline/continuation-outlines-with-layers.html [ Failure ] crbug.com/591099 fast/inline/continuation-outlines.html [ Failure ] crbug.com/591099 fast/inline/drawStyledEmptyInlines.html [ Failure ] -crbug.com/591099 fast/inline/drawStyledEmptyInlinesWithWS.html [ Failure Pass ] crbug.com/591099 fast/inline/emptyInlinesWithinLists.html [ Failure ] crbug.com/591099 fast/inline/inline-borders-with-bidi-override.html [ Failure ] crbug.com/591099 fast/inline/inline-box-background-long-image.html [ Failure ] @@ -4349,7 +4206,6 @@ crbug.com/591099 fast/inline/left-right-center-inline-alignment-in-ltr-and-rtl-blocks.html [ Failure ] crbug.com/591099 fast/inline/out-of-flow-objects-and-whitespace-after-empty-inline.html [ Failure ] crbug.com/591099 fast/inline/outline-continuations.html [ Failure ] -crbug.com/591099 fast/inline/relative-positioned-overflow.html [ Failure Pass ] crbug.com/591099 fast/inline/styledEmptyInlinesWithBRs.html [ Failure ] crbug.com/591099 fast/innerHTML/004.xhtml [ Failure ] crbug.com/591099 fast/innerHTML/005.html [ Failure ] @@ -4438,7 +4294,6 @@ crbug.com/591099 fast/lists/dynamic-marker-crash.html [ Failure ] crbug.com/591099 fast/lists/inline-before-content-after-list-marker.html [ Failure ] crbug.com/591099 fast/lists/inlineBoxWrapperNullCheck.html [ Failure ] -crbug.com/591099 fast/lists/li-style-alpha-huge-value-crash.html [ Failure Pass ] crbug.com/591099 fast/lists/list-color-change-no-layout.html [ Failure ] crbug.com/591099 fast/lists/list-item-line-height.html [ Failure ] crbug.com/591099 fast/lists/list-marker-before-content-table.html [ Failure ] @@ -4461,7 +4316,6 @@ crbug.com/591099 fast/loader/local-image-from-local.html [ Failure ] crbug.com/591099 fast/loader/navigation-scheduler-user-gesture.html [ Failure Timeout ] crbug.com/591099 fast/loader/opaque-base-url.html [ Failure ] -crbug.com/591099 fast/loader/show-only-one-beforeunload-dialog.html [ Failure Pass ] crbug.com/591099 fast/loader/text-document-wrapping.html [ Failure ] crbug.com/591099 fast/masking/clip-path-inset-large-radii.html [ Failure ] crbug.com/591099 fast/masking/clip-path-selection.html [ Failure ] @@ -5016,11 +4870,10 @@ crbug.com/591099 compositing/perspective-interest-rect.html [ Failure ] crbug.com/714962 compositing/squashing/squash-composited-input.html [ Failure Pass ] crbug.com/714962 compositing/squashing/squash-overflow-hidden-scrolltop.html [ Failure ] -crbug.com/591099 compositing/squashing/squashing-does-not-stop-transform-propagation.html [ Crash ] +crbug.com/591099 compositing/squashing/squashing-does-not-stop-transform-propagation.html [ Crash Pass ] crbug.com/714962 compositing/squashing/universal-accelerated-overflow-scrolling.html [ Failure ] crbug.com/714962 compositing/transitions/transform-on-large-layer.html [ Failure ] -crbug.com/714962 compositing/visibility/visibility-image-layers.html [ Failure Pass ] -crbug.com/591099 compositing/will-change/will-change-preserve-backface-visibility.html [ Crash ] +crbug.com/591099 compositing/will-change/will-change-preserve-backface-visibility.html [ Crash Pass ] crbug.com/591099 compositing/z-order/collect-layers-does-not-initialize-pos-z-order-list.html [ Crash ] crbug.com/714962 css1/font_properties/font.html [ Failure ] crbug.com/714962 css1/text_properties/text_align.html [ Failure ] @@ -5039,11 +4892,9 @@ crbug.com/714962 css3/filters/effect-reference-on-transparent-element.html [ Failure ] crbug.com/714962 css3/filters/effect-reference-tile.html [ Crash ] crbug.com/714962 css3/filters/empty-element-with-filter.html [ Failure ] -crbug.com/714962 css3/filters/filter-region-transformed-child.html [ Failure Pass ] crbug.com/714962 css3/filters/filterRegions.html [ Failure ] crbug.com/714962 css3/filters/nested-filter.html [ Failure ] crbug.com/714962 css3/flexbox/content-height-with-scrollbars.html [ Failure ] -crbug.com/714962 css3/flexbox/flex-flow-auto-margins-no-available-space.html [ Failure Pass ] crbug.com/591099 css3/flexbox/flexitem-stretch-range.html [ Crash ] crbug.com/591099 css3/flexbox/mozilla/flexbox-inlinecontent-horiz-5.xhtml [ Failure Pass ] crbug.com/714962 css3/flexbox/mozilla/flexbox-items-as-stacking-contexts-2.html [ Failure ] @@ -5071,8 +4922,6 @@ crbug.com/714962 css3/masking/mask-composite-missing-image.html [ Failure ] crbug.com/714962 css3/tab-size-complex-path.html [ Failure ] crbug.com/714962 css3/tab-size.html [ Failure ] -crbug.com/591099 dom/legacy_dom_conformance/xhtml/level2/html/HTMLImageElement05.xhtml [ Failure Pass ] -crbug.com/591099 dom/legacy_dom_conformance/xhtml/level2/html/HTMLImageElement12.xhtml [ Failure Pass ] crbug.com/591099 editing/caret/caret-painting-low-dpi.html [ Failure ] crbug.com/714962 editing/caret/in-multicol-child.html [ Failure ] crbug.com/714962 editing/deleting/4916235-1.html [ Failure ] @@ -5088,7 +4937,6 @@ crbug.com/714962 editing/pasteboard/drag-drop-input-textarea.html [ Failure ] crbug.com/714962 editing/pasteboard/file-input-files-access.html [ Failure ] crbug.com/714962 editing/pasteboard/paste-table-001.html [ Failure ] -crbug.com/591099 editing/selection/5354455-1.html [ Failure Pass ] crbug.com/714962 editing/selection/anchor-focus1.html [ Failure ] crbug.com/714962 editing/selection/anchor-focus2.html [ Failure ] crbug.com/714962 editing/selection/anchor-focus3.html [ Failure ] @@ -5146,8 +4994,6 @@ crbug.com/591099 external/wpt/css/CSS2/normal-flow/inline-block-replaced-height-004.xht [ Failure ] crbug.com/591099 external/wpt/css/CSS2/normal-flow/inline-block-replaced-height-005.xht [ Failure ] crbug.com/591099 external/wpt/css/CSS2/normal-flow/inline-block-replaced-height-007.xht [ Failure ] -crbug.com/714962 external/wpt/css/CSS2/normal-flow/inline-block-valign-001.xht [ Failure Pass ] -crbug.com/714962 external/wpt/css/CSS2/normal-flow/inline-block-valign-002.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/CSS2/normal-flow/inline-block-zorder-001.xht [ Failure ] crbug.com/714962 external/wpt/css/CSS2/normal-flow/inline-block-zorder-002.xht [ Failure ] crbug.com/591099 external/wpt/css/CSS2/normal-flow/inline-replaced-height-004.xht [ Failure ] @@ -5161,18 +5007,6 @@ crbug.com/714962 external/wpt/css/CSS2/normal-flow/min-height-104.xht [ Failure ] crbug.com/714962 external/wpt/css/CSS2/normal-flow/min-height-106.xht [ Failure ] crbug.com/591099 external/wpt/css/CSS2/positioning/absolute-replaced-height-001.xht [ Failure ] -crbug.com/714962 external/wpt/css/CSS2/positioning/bottom-offset-001.xht [ Failure Pass ] -crbug.com/714962 external/wpt/css/CSS2/positioning/bottom-offset-002.xht [ Failure Pass ] -crbug.com/714962 external/wpt/css/CSS2/positioning/bottom-offset-003.xht [ Failure Pass ] -crbug.com/714962 external/wpt/css/CSS2/positioning/left-offset-001.xht [ Failure Pass ] -crbug.com/714962 external/wpt/css/CSS2/positioning/left-offset-002.xht [ Failure Pass ] -crbug.com/714962 external/wpt/css/CSS2/positioning/position-relative-032.xht [ Failure Pass ] -crbug.com/714962 external/wpt/css/CSS2/positioning/right-offset-001.xht [ Failure Pass ] -crbug.com/714962 external/wpt/css/CSS2/positioning/right-offset-002.xht [ Failure Pass ] -crbug.com/714962 external/wpt/css/CSS2/positioning/right-offset-003.xht [ Failure Pass ] -crbug.com/714962 external/wpt/css/CSS2/positioning/top-offset-001.xht [ Failure Pass ] -crbug.com/714962 external/wpt/css/CSS2/positioning/top-offset-002.xht [ Failure Pass ] -crbug.com/714962 external/wpt/css/CSS2/positioning/top-offset-003.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/CSS2/text/text-indent-overflow-001.xht [ Failure ] crbug.com/714962 external/wpt/css/CSS2/text/text-indent-overflow-004.xht [ Failure ] crbug.com/714962 external/wpt/css/css-backgrounds/background-attachment-local/attachment-local-clipping-color-5.html [ Failure ] @@ -5191,7 +5025,6 @@ crbug.com/591099 external/wpt/css/css-flexbox/flexbox_columns-flexitems-2.html [ Failure ] crbug.com/591099 external/wpt/css/css-flexbox/flexbox_columns-flexitems.html [ Failure ] crbug.com/591099 external/wpt/css/css-flexbox/percentage-heights-003.html [ Pass ] -crbug.com/714962 external/wpt/css/css-flexbox/percentage-heights-004.html [ Failure Pass ] crbug.com/714962 external/wpt/css/css-flexbox/position-absolute-005.html [ Failure ] crbug.com/714962 external/wpt/css/css-fonts/font-display/font-display.html [ Failure ] crbug.com/714962 external/wpt/css/css-fonts/font-features-across-space-1.html [ Pass ] @@ -5297,9 +5130,7 @@ crbug.com/591099 external/wpt/css/css-multicol/multicol-rule-fraction-002.xht [ Failure ] crbug.com/591099 external/wpt/css/css-multicol/multicol-rule-fraction-003.xht [ Failure ] crbug.com/591099 external/wpt/css/css-multicol/multicol-rule-groove-000.xht [ Failure ] -crbug.com/591099 external/wpt/css/css-multicol/multicol-rule-hidden-000.xht [ Failure Pass ] crbug.com/591099 external/wpt/css/css-multicol/multicol-rule-large-001.xht [ Failure ] -crbug.com/591099 external/wpt/css/css-multicol/multicol-rule-none-000.xht [ Failure Pass ] crbug.com/591099 external/wpt/css/css-multicol/multicol-rule-percent-001.xht [ Failure ] crbug.com/591099 external/wpt/css/css-multicol/multicol-rule-px-001.xht [ Failure ] crbug.com/591099 external/wpt/css/css-multicol/multicol-rule-ridge-000.xht [ Failure ] @@ -5340,22 +5171,10 @@ crbug.com/714962 external/wpt/css/css-multicol/multicol-width-large-002.xht [ Failure ] crbug.com/591099 external/wpt/css/css-multicol/multicol-width-small-001.xht [ Failure ] crbug.com/591099 external/wpt/css/css-multicol/multicol-zero-height-001.xht [ Failure ] -crbug.com/714962 external/wpt/css/css-paint-api/background-image-alpha.https.html [ Failure Pass ] -crbug.com/714962 external/wpt/css/css-paint-api/paint-arguments.https.html [ Failure Pass ] -crbug.com/714962 external/wpt/css/css-paint-api/paint-function-arguments.https.html [ Failure Pass ] -crbug.com/714962 external/wpt/css/css-paint-api/style-background-image.https.html [ Failure ] +crbug.com/714962 external/wpt/css/css-paint-api/style-background-image.https.html [ Failure Pass ] crbug.com/714962 external/wpt/css/css-paint-api/style-before-pseudo.https.html [ Failure ] crbug.com/714962 external/wpt/css/css-paint-api/style-first-letter-pseudo.https.html [ Failure ] -crbug.com/714962 external/wpt/css/css-position/position-sticky-inline.html [ Failure Pass ] -crbug.com/714962 external/wpt/css/css-position/position-sticky-left.html [ Failure Pass ] -crbug.com/714962 external/wpt/css/css-position/position-sticky-margins.html [ Failure Pass ] crbug.com/591099 external/wpt/css/css-position/position-sticky-nested-inline.html [ Crash ] -crbug.com/714962 external/wpt/css/css-position/position-sticky-nested-left.html [ Failure Pass ] -crbug.com/714962 external/wpt/css/css-position/position-sticky-nested-right.html [ Failure Pass ] -crbug.com/714962 external/wpt/css/css-position/position-sticky-nested-top.html [ Failure Pass ] -crbug.com/714962 external/wpt/css/css-position/position-sticky-overflow-padding.html [ Failure Pass ] -crbug.com/714962 external/wpt/css/css-position/position-sticky-right.html [ Failure Pass ] -crbug.com/714962 external/wpt/css/css-position/position-sticky-top.html [ Failure Pass ] crbug.com/714962 external/wpt/css/css-scroll-anchoring/start-edge-in-block-layout-direction.html [ Failure ] crbug.com/714962 external/wpt/css/css-scroll-anchoring/wrapped-text.html [ Failure ] crbug.com/591099 external/wpt/css/css-style-attr/style-attr-urls-001.xht [ Failure ] @@ -5387,7 +5206,6 @@ crbug.com/714962 external/wpt/css/css-ui/outline-004.html [ Failure ] crbug.com/714962 external/wpt/css/css-ui/text-overflow-001.html [ Failure ] crbug.com/714962 external/wpt/css/css-ui/text-overflow-003.html [ Failure ] -crbug.com/591099 external/wpt/css/css-ui/text-overflow-006.html [ Failure Pass ] crbug.com/714962 external/wpt/css/css-ui/text-overflow-008.html [ Crash Failure ] crbug.com/714962 external/wpt/css/css-ui/text-overflow-009.html [ Failure ] crbug.com/591099 external/wpt/css/css-ui/text-overflow-010.html [ Pass ] @@ -5406,7 +5224,7 @@ crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-017.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-019.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-021.xht [ Failure Pass ] -crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-023.xht [ Failure ] +crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-023.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-025.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-027.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-029.xht [ Failure Pass ] @@ -5416,7 +5234,7 @@ crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-037.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-039.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-041.xht [ Failure Pass ] -crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-043.xht [ Failure ] +crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-043.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-045.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-047.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-049.xht [ Failure Pass ] @@ -5431,7 +5249,7 @@ crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-067.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-069.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-071.xht [ Failure ] -crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-073.xht [ Failure ] +crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-073.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-075.xht [ Failure ] crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-077.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-079.xht [ Failure Pass ] @@ -5634,7 +5452,6 @@ crbug.com/714962 external/wpt/css/css-writing-modes/direction-vlr-005.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/direction-vrl-002.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/direction-vrl-004.xht [ Failure Pass ] -crbug.com/714962 external/wpt/css/css-writing-modes/float-contiguous-vlr-009.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/float-shrink-to-fit-vrl-008.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/float-vlr-005.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/float-vlr-007.xht [ Failure ] @@ -5684,9 +5501,9 @@ crbug.com/591099 external/wpt/css/css-writing-modes/table-column-order-004.xht [ Pass ] crbug.com/591099 external/wpt/css/css-writing-modes/table-column-order-005.xht [ Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vlr-003.xht [ Failure Pass ] -crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vlr-005.xht [ Failure ] +crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vlr-005.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vlr-007.xht [ Failure ] -crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vlr-009.xht [ Failure ] +crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vlr-009.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vlr-011.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vlr-013.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vlr-015.xht [ Failure Pass ] @@ -5694,7 +5511,7 @@ crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vlr-019.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vrl-002.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vrl-004.xht [ Failure ] -crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vrl-006.xht [ Failure ] +crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vrl-006.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vrl-008.xht [ Failure Pass ] crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vrl-010.xht [ Failure ] crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vrl-012.xht [ Failure Pass ] @@ -5733,26 +5550,11 @@ crbug.com/714962 external/wpt/css/selectors/focus-within-001.html [ Failure ] crbug.com/714962 external/wpt/css/selectors/focus-within-007.html [ Failure ] crbug.com/714962 external/wpt/css/selectors/focus-within-008.html [ Failure ] -crbug.com/714962 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-align-self-horiz-002.xhtml [ Failure Pass ] -crbug.com/714962 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-align-self-horiz-004.xhtml [ Failure Pass ] -crbug.com/714962 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-baseline-multi-line-horiz-001.html [ Failure Pass ] -crbug.com/714962 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-baseline-multi-line-horiz-002.html [ Failure Pass ] -crbug.com/714962 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-baseline-multi-line-vert-001.html [ Failure Pass ] -crbug.com/714962 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-baseline-multi-line-vert-002.html [ Failure Pass ] -crbug.com/714962 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-basic-block-horiz-001.xhtml [ Failure Pass ] crbug.com/714962 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-basic-fieldset-horiz-001.xhtml [ Failure ] crbug.com/714962 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-basic-img-horiz-001.xhtml [ Failure ] crbug.com/714962 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-basic-textarea-horiz-001.xhtml [ Failure ] crbug.com/714962 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-flex-flow-002.html [ Failure ] -crbug.com/714962 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-intrinsic-ratio-003.html [ Failure Pass ] -crbug.com/714962 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-intrinsic-ratio-004.html [ Failure Pass ] crbug.com/714962 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-items-as-stacking-contexts-002.html [ Failure ] -crbug.com/714962 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-items-as-stacking-contexts-003.html [ Failure Pass ] -crbug.com/714962 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-justify-content-horiz-002.xhtml [ Failure Pass ] -crbug.com/714962 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-mbp-horiz-001-rtl-reverse.xhtml [ Failure Pass ] -crbug.com/714962 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-mbp-horiz-001.xhtml [ Failure Pass ] -crbug.com/714962 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-mbp-horiz-002a.xhtml [ Failure Pass ] -crbug.com/714962 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-mbp-horiz-002b.xhtml [ Failure Pass ] crbug.com/714962 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/selectors4/class-id-attr-selector-invalidation-01.html [ Failure ] crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/writing-modes-3/text-combine-upright-compression-001.html [ Crash ] crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/writing-modes-3/text-combine-upright-compression-002.html [ Crash ] @@ -5792,7 +5594,6 @@ crbug.com/714962 external/wpt/html/rendering/non-replaced-elements/the-fieldset-element-0/min-width-not-important.html [ Failure ] crbug.com/714962 external/wpt/html/rendering/the-css-user-agent-style-sheet-and-presentational-hints/body-bgcolor-attribute-change.html [ Failure ] crbug.com/714962 external/wpt/html/semantics/document-metadata/the-link-element/stylesheet-change-href.html [ Failure ] -crbug.com/591099 external/wpt/html/semantics/embedded-content/the-img-element/current-pixel-density/basic.html [ Failure Pass ] crbug.com/591099 external/wpt/html/semantics/forms/the-form-element/form-elements-filter.html [ Crash ] crbug.com/591099 external/wpt/html/semantics/forms/the-form-element/form-nameditem.html [ Crash ] crbug.com/591099 external/wpt/html/semantics/grouping-content/the-ol-element/grouping-ol.html [ Crash ] @@ -5843,7 +5644,6 @@ crbug.com/591099 external/wpt/webrtc/interfaces.https.html [ Pass Timeout ] crbug.com/591099 external/wpt/websockets/cookies/005.html [ Pass ] crbug.com/591099 external/wpt/websockets/cookies/007.html [ Failure Pass ] -crbug.com/591099 external/wpt/websockets/opening-handshake/005.html [ Failure Pass ] crbug.com/591099 external/wpt/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/class_object/class_white-space_pre-wrap_wrapped.html [ Crash ] crbug.com/591099 external/wpt/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/italic_object/italic_white-space_pre-wrap_wrapped.html [ Crash ] crbug.com/591099 external/wpt/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/underline_object/underline_white-space_pre-wrap_wrapped.html [ Crash ] @@ -5854,9 +5654,7 @@ crbug.com/714962 fast/block/basic/016.html [ Failure ] crbug.com/591099 fast/block/block-remove-child-delete-line-box-crash.html [ Crash ] crbug.com/591099 fast/block/child-not-removed-from-parent-lineboxes-crash.html [ Crash ] -crbug.com/714962 fast/block/float/002.html [ Failure Pass ] crbug.com/714962 fast/block/float/015.html [ Failure ] -crbug.com/714962 fast/block/float/017.html [ Failure Pass ] crbug.com/714962 fast/block/float/021.html [ Failure ] crbug.com/714962 fast/block/float/025.html [ Failure ] crbug.com/714962 fast/block/float/026.html [ Failure ] @@ -5864,7 +5662,6 @@ crbug.com/714962 fast/block/float/028.html [ Failure ] crbug.com/714962 fast/block/float/avoidance-percent-width-strict.html [ Failure ] crbug.com/591099 fast/block/float/float-on-line-obeys-container-padding.html [ Failure ] -crbug.com/714962 fast/block/float/float-should-dirty-line-even-when-it-doesnt-intersect-it-3.html [ Failure Pass ] crbug.com/714962 fast/block/float/float-should-dirty-line-when-adjacent-to-line-breaks-2.html [ Failure ] crbug.com/714962 fast/block/float/float-should-dirty-line-when-adjacent-to-line-breaks.html [ Failure ] crbug.com/714962 fast/block/float/intruding-float-add-in-sibling-block-on-static-position.html [ Failure ] @@ -5873,16 +5670,13 @@ crbug.com/714962 fast/block/float/intruding-float-remove-from-sibling-block-on-absolute-position2.html [ Failure ] crbug.com/714962 fast/block/float/intruding-float-remove-from-sibling-block-on-fixed-position.html [ Failure ] crbug.com/714962 fast/block/float/intruding-float-remove-from-sibling-block-on-fixed-position2.html [ Failure ] -crbug.com/714962 fast/block/float/max-width-clear-float-with-overflow-hidden.html [ Failure Pass ] crbug.com/714962 fast/block/float/overhanging-after-height-decrease.html [ Failure ] crbug.com/714962 fast/block/float/overhanging-float-add-in-static-position-block.html [ Failure ] crbug.com/714962 fast/block/float/overhanging-float-add-in-static-position-block2.html [ Failure ] crbug.com/714962 fast/block/float/overhanging-float-remove-from-absolute-position-block.html [ Failure ] crbug.com/714962 fast/block/float/overhanging-float-remove-from-absolute-position-block2.html [ Failure ] -crbug.com/591099 fast/block/float/overhanging-tall-block.html [ Failure Pass ] crbug.com/714962 fast/block/float/relayout-nested-float-after-line.html [ Failure ] crbug.com/714962 fast/block/float/shrink-to-avoid-float-complexity.html [ Failure ] -crbug.com/714962 fast/block/float/trailing-float-with-content.html [ Failure Pass ] crbug.com/714962 fast/block/layer-not-removed-from-parent-crash.html [ Failure ] crbug.com/591099 fast/block/line-layout/line-break-removal-near-textarea-crash.html [ Crash Failure ] crbug.com/714962 fast/block/margin-collapse/044.html [ Failure ] @@ -5891,19 +5685,14 @@ crbug.com/591099 fast/block/positioning/052.html [ Crash Pass ] crbug.com/591099 fast/block/positioning/058.html [ Crash Pass ] crbug.com/591099 fast/block/positioning/abspositioned-object-under-split-relpositioned-inline-crash.html [ Crash ] -crbug.com/714962 fast/block/positioning/auto/006.html [ Failure Pass ] -crbug.com/714962 fast/block/positioning/auto/vertical-lr/006.html [ Failure Pass ] crbug.com/714962 fast/block/positioning/auto/vertical-rl/006.html [ Failure ] crbug.com/591099 fast/block/positioning/complex-positioned-movement-inline-ancestor.html [ Crash ] crbug.com/591099 fast/block/positioning/complex-positioned-movement-inline.html [ Crash ] -crbug.com/714962 fast/block/positioning/differing-writing-modes-replaced.html [ Failure Pass ] -crbug.com/714962 fast/block/positioning/differing-writing-modes.html [ Failure Pass ] crbug.com/591099 fast/block/positioning/insert-positioned-in-anonymous-crash.html [ Crash ] crbug.com/714962 fast/block/positioning/offsetLeft-offsetTop-multicolumn.html [ Failure ] crbug.com/591099 fast/block/positioning/positioned-movement-layout-when-height-changes.html [ Crash ] crbug.com/591099 fast/block/positioning/removing-inside-relpositioned-inline-crash.html [ Crash ] crbug.com/714962 fast/borders/block-mask-overlay-image.html [ Failure ] -crbug.com/714962 fast/borders/border-image-fill-no-border.html [ Failure Pass ] crbug.com/591099 fast/borders/border-image-inherits-with-border.html [ Failure Pass ] crbug.com/714962 fast/borders/border-image-outset-split-inline.html [ Failure ] crbug.com/714962 fast/borders/border-image-scaled.html [ Failure ] @@ -5911,7 +5700,6 @@ crbug.com/714962 fast/borders/border-radius-inline-flow.html [ Failure ] crbug.com/714962 fast/borders/border-radius-percent.html [ Failure ] crbug.com/714962 fast/borders/border-radius-split-inline.html [ Failure ] -crbug.com/714962 fast/borders/border-radius-with-composited-child.html [ Failure Pass ] crbug.com/714962 fast/borders/border-styles-split.html [ Failure ] crbug.com/714962 fast/borders/borderRadiusArcs01.html [ Failure ] crbug.com/714962 fast/borders/borderRadiusDouble01.html [ Failure ] @@ -5930,8 +5718,6 @@ crbug.com/714962 fast/borders/dashed-1px-with-border-radius.html [ Failure ] crbug.com/714962 fast/borders/different-color-borders.html [ Failure ] crbug.com/714962 fast/borders/table-borders.html [ Failure ] -crbug.com/714962 fast/borders/thin-dotted-borders.html [ Failure Pass ] -crbug.com/714962 fast/box-shadow/image-box-shadow.html [ Failure Pass ] crbug.com/591099 fast/box-sizing/replaced.html [ Failure Pass ] crbug.com/714962 fast/canvas-api/canvas-scroll-path-into-view.html [ Failure ] crbug.com/591099 fast/canvas-api/fallback-content.html [ Crash ] @@ -5945,7 +5731,6 @@ crbug.com/714962 fast/css-generated-content/hover-inline.html [ Failure ] crbug.com/591099 fast/css-generated-content/summary-before-after-content.html [ Crash ] crbug.com/591099 fast/css-grid-layout/grid-baseline-margins.html [ Pass ] -crbug.com/714962 fast/css-grid-layout/grid-content-alignment-overflow.html [ Failure Pass ] crbug.com/714962 fast/css-grid-layout/grid-item-margins-and-writing-modes.html [ Failure ] crbug.com/714962 fast/css-grid-layout/grid-item-paddings-and-writing-modes.html [ Failure ] crbug.com/714962 fast/css-grid-layout/grid-self-baseline-vertical-lr-06.html [ Failure ] @@ -5985,19 +5770,7 @@ crbug.com/714962 fast/css/invalidation/sheet-loaded-before-invalidation.html [ Failure ] crbug.com/714962 fast/css/invalidation/style-invalidation-before-attach.html [ Failure ] crbug.com/591099 fast/css/large-number-round-trip.html [ Crash ] -crbug.com/714962 fast/css/object-fit-canvas.html [ Failure Pass ] -crbug.com/714962 fast/css/object-fit-embed.html [ Failure Pass ] -crbug.com/714962 fast/css/object-fit-img-svg.html [ Failure Pass ] -crbug.com/714962 fast/css/object-fit-img-svg2.html [ Failure Pass ] -crbug.com/714962 fast/css/object-fit-img.html [ Failure Pass ] -crbug.com/714962 fast/css/object-fit-input-image.html [ Failure Pass ] -crbug.com/714962 fast/css/object-fit-shrink.html [ Failure Pass ] -crbug.com/714962 fast/css/object-fit-video-poster.html [ Failure Pass ] crbug.com/591099 fast/css/object-position-svg.html [ Crash Pass ] -crbug.com/714962 fast/css/object-position-with-fit-contain.html [ Failure Pass ] -crbug.com/714962 fast/css/object-position-with-fit-cover.html [ Failure Pass ] -crbug.com/714962 fast/css/object-position-with-fit-none.html [ Failure Pass ] -crbug.com/714962 fast/css/object-position.html [ Failure Pass ] crbug.com/714962 fast/css/outline-small-visual-overflow.html [ Failure ] crbug.com/591099 fast/css/placeholder-shown-basics.html [ Crash ] crbug.com/591099 fast/css/positioned-in-relative-position-inline-crash.html [ Crash ] @@ -6008,7 +5781,6 @@ crbug.com/591099 fast/css/sticky/inline-sticky-abspos-child.html [ Crash Failure ] crbug.com/714962 fast/css/sticky/replaced-sticky.html [ Failure ] crbug.com/714962 fast/css/sticky/sticky-both-sides-bottom-right-constrained.html [ Failure ] -crbug.com/714962 fast/css/sticky/sticky-top-overflow.html [ Failure Pass ] crbug.com/591099 fast/css/sticky/sticky-vertically-overconstrained.html [ Failure ] crbug.com/714962 fast/css/text-align-webkit-match-parent.html [ Failure ] crbug.com/714962 fast/css/text-overflow-ellipsis-vertical-hittest.html [ Timeout ] @@ -6040,9 +5812,7 @@ crbug.com/714962 fast/dom/Element/client-rect-list-argument.html [ Failure ] crbug.com/714962 fast/dom/Element/getClientRects.html [ Failure ] crbug.com/591099 fast/dom/HTMLDocument/object-by-name-or-id.html [ Crash ] -crbug.com/591099 fast/dom/HTMLImageElement/fallback-image-moved-across-documents.html [ Failure Pass ] crbug.com/714962 fast/dom/HTMLObjectElement/fallback-content-behaviour.html [ Failure ] -crbug.com/714962 fast/dom/HTMLProgressElement/progress-writing-mode.html [ Failure Pass ] crbug.com/714962 fast/dom/MutationObserver/observe-element-resize.html [ Failure ] crbug.com/591099 fast/dom/MutationObserver/shadow-dom.html [ Crash ] crbug.com/714962 fast/dom/Range/collapsed-range-bounding-client-rect.html [ Failure ] @@ -6087,7 +5857,7 @@ crbug.com/591099 fast/dynamic/continuation-detach-crash.html [ Crash ] crbug.com/714962 fast/dynamic/focus-clear-resolver-crash.html [ Failure ] crbug.com/591099 fast/dynamic/static-to-relative-with-absolute-child.html [ Crash ] -crbug.com/714962 fast/events/autoscroll-disabled-in-fix.html [ Timeout ] +crbug.com/714962 fast/events/autoscroll-disabled-in-fix.html [ Pass Timeout ] crbug.com/714962 fast/events/autoscroll-upwards-propagation-overflow-hidden-body.html [ Failure ] crbug.com/714962 fast/events/click-checkbox-blur-refocus-window.html [ Failure ] crbug.com/714962 fast/events/click-checkbox-refocus-window.html [ Failure ] @@ -6180,7 +5950,6 @@ crbug.com/714962 fast/forms/file/file-input-reset-validation.html [ Timeout ] crbug.com/714962 fast/forms/file/file-input-reset.html [ Failure ] crbug.com/714962 fast/forms/file/file-reset-in-change.html [ Failure ] -crbug.com/714962 fast/forms/file/file-vertical-padding-border.html [ Failure Pass ] crbug.com/714962 fast/forms/file/input-file-entries.html [ Timeout ] crbug.com/714962 fast/forms/file/input-file-value-with-zoom.html [ Failure ] crbug.com/714962 fast/forms/file/input-file-value.html [ Failure ] @@ -6222,7 +5991,6 @@ crbug.com/714962 fast/forms/number/number-spinbutton-state.html [ Failure ] crbug.com/714962 fast/forms/password-placeholder-text-security.html [ Failure ] crbug.com/591099 fast/forms/percent-height-auto-width-form-controls.html [ Crash ] -crbug.com/714962 fast/forms/placeholder-in-invisible-elements.html [ Failure Pass ] crbug.com/714962 fast/forms/radio/radio-arrow-with-modifier-keys.html [ Failure ] crbug.com/714962 fast/forms/radio/radio-focus-by-mouse.html [ Failure ] crbug.com/714962 fast/forms/radio/radio-group-arrow-cycle-edge.html [ Failure ] @@ -6260,7 +6028,6 @@ crbug.com/714962 fast/forms/select-popup/popup-menu-appearance-transform.html [ Failure ] crbug.com/714962 fast/forms/select-popup/popup-menu-appearance-zoom.html [ Failure ] crbug.com/714962 fast/forms/select/remove-element-from-within-focus-handler-crash.html [ Failure ] -crbug.com/714962 fast/forms/select/select-percent-width.html [ Failure Pass ] crbug.com/714962 fast/forms/setrangetext-within-events.html [ Failure ] crbug.com/714962 fast/forms/suggestion-picker/date-suggestion-picker-appearance-rtl.html [ Failure ] crbug.com/714962 fast/forms/suggestion-picker/date-suggestion-picker-appearance-with-scroll-bar.html [ Crash ] @@ -6291,7 +6058,6 @@ crbug.com/714962 fast/forms/text/placeholder-with-positioned-element.html [ Failure ] crbug.com/714962 fast/forms/text/textfield-inside-anchor.html [ Failure ] crbug.com/714962 fast/forms/textarea/drag-out-of-textarea.html [ Failure ] -crbug.com/714962 fast/forms/textarea/textarea-inline-block-baseline.html [ Failure Pass ] crbug.com/714962 fast/forms/textarea/textarea-resize-above-min-size-and-below-initial-size.html [ Failure ] crbug.com/714962 fast/forms/textarea/textarea-resize-below-min-intrinsic-size.html [ Failure Timeout ] crbug.com/714962 fast/forms/textarea/textarea-resize-below-min-size-zoomed.html [ Failure ] @@ -6305,8 +6071,6 @@ crbug.com/714962 fast/forms/week-multiple-fields/week-multiple-fields-clearbutton-change-and-input-events.html [ Failure ] crbug.com/714962 fast/forms/week-multiple-fields/week-multiple-fields-mouse-events.html [ Failure ] crbug.com/714962 fast/forms/week-multiple-fields/week-multiple-fields-spinbutton-change-and-input-events.html [ Failure ] -crbug.com/714962 fast/gradients/css3-color-stop-units.html [ Failure Pass ] -crbug.com/714962 fast/gradients/unprefixed-color-stop-units.html [ Failure Pass ] crbug.com/714962 fast/harness/legacy-results.html [ Failure ] crbug.com/591099 fast/hidpi/broken-image-icon-hidpi.html [ Failure ] crbug.com/714962 fast/hidpi/clip-text-in-hidpi.html [ Failure ] @@ -6317,7 +6081,6 @@ crbug.com/714962 fast/history/visited-link-hover-text-fill-color.html [ Failure ] crbug.com/714962 fast/history/visited-link-hover-text-stroke-color.html [ Failure ] crbug.com/714962 fast/history/visited-link-hover.html [ Failure ] -crbug.com/591099 fast/history/window-open.html [ Crash Pass ] crbug.com/591099 fast/html/clone-range.html [ Crash ] crbug.com/714962 fast/html/layout-runs-and-floats-crash.html [ Failure ] crbug.com/714962 fast/html/meter-user-modify.html [ Failure ] @@ -6369,7 +6132,6 @@ crbug.com/714962 fast/overflow/childFocusRingClip.html [ Failure ] crbug.com/714962 fast/overflow/clip-rects-fixed-ancestor.html [ Failure ] crbug.com/714962 fast/overflow/dynamic-hidden.html [ Failure ] -crbug.com/714962 fast/overflow/hidden-scrollbar-resize.html [ Failure Pass ] crbug.com/714962 fast/overflow/line-clamp-hides-trailing-anchor.html [ Failure ] crbug.com/714962 fast/overflow/overflow-float-stacking.html [ Failure ] crbug.com/714962 fast/overflow/overflow-stacking.html [ Failure ] @@ -6435,17 +6197,11 @@ crbug.com/591099 fast/replaced/computed-image-width-with-percent-height-inside-table-cell-and-fixed-ancestor-vertical-lr.html [ Failure ] crbug.com/591099 fast/replaced/computed-image-width-with-percent-height-inside-table-cell-and-fixed-ancestor.html [ Failure ] crbug.com/591099 fast/replaced/image-map-2.html [ Failure ] -crbug.com/591099 fast/replaced/image-map-alt-content.html [ Failure Pass ] -crbug.com/591099 fast/replaced/image-map-bug16782.html [ Failure Pass ] -crbug.com/591099 fast/replaced/image-map-cursor.html [ Failure Pass ] -crbug.com/591099 fast/replaced/image-map-on-image-with-inline-content-data.html [ Failure Pass ] -crbug.com/591099 fast/replaced/image-map.html [ Failure Pass ] crbug.com/591099 fast/replaced/max-width-percent.html [ Failure ] crbug.com/591099 fast/replaced/no-focus-ring-embed.html [ Timeout ] crbug.com/591099 fast/replaced/no-focus-ring-iframe.html [ Timeout ] crbug.com/591099 fast/replaced/no-focus-ring-object.html [ Timeout ] crbug.com/591099 fast/replaced/object-with-non-empty-classid-triggers-fallback.html [ Failure ] -crbug.com/591099 fast/replaced/outline-replaced-elements.html [ Failure Pass ] crbug.com/591099 fast/replaced/percent-height-in-anonymous-block-in-table.html [ Failure ] crbug.com/591099 fast/replaced/percent-height-in-anonymous-block.html [ Failure ] crbug.com/591099 fast/replaced/preferred-widths.html [ Failure ] @@ -6453,7 +6209,6 @@ crbug.com/591099 fast/replaced/replaced-last-line-layout.html [ Crash Pass ] crbug.com/591099 fast/replaced/selection-rect-in-table-cell.html [ Failure Pass ] crbug.com/591099 fast/replaced/selection-rect-transform.html [ Failure ] -crbug.com/591099 fast/replaced/selection-rect.html [ Failure Pass ] crbug.com/591099 fast/replaced/table-percent-height.html [ Failure ] crbug.com/591099 fast/replaced/table-percent-width.html [ Failure Pass ] crbug.com/591099 fast/replaced/table-replaced-element.html [ Failure ] @@ -6463,14 +6218,13 @@ crbug.com/714962 fast/replaced/vertical-rl/absolute-position-with-auto-width-and-left-and-right.html [ Failure ] crbug.com/591099 fast/replaced/width100percent-image.html [ Failure Pass ] crbug.com/714962 fast/replaced/width100percent-textarea.html [ Failure ] -crbug.com/591099 fast/rootscroller/set-root-scroller.html [ Failure ] +crbug.com/591099 fast/rootscroller/set-root-scroller.html [ Failure Pass ] crbug.com/591099 fast/ruby/add-text-to-block-ruby-with-after-pseudo-crash.html [ Crash ] crbug.com/591099 fast/ruby/base-shorter-than-text.html [ Failure ] crbug.com/591099 fast/ruby/float-object-doesnt-crash.html [ Crash ] crbug.com/591099 fast/ruby/float-overhang-from-ruby-text.html [ Failure ] crbug.com/591099 fast/ruby/floating-ruby-text.html [ Failure ] crbug.com/591099 fast/ruby/list-item-marker-in-block-ruby.html [ Crash ] -crbug.com/591099 fast/ruby/merge-adjacent-anonymous-blocks-inside-ruby-run.html [ Failure Pass ] crbug.com/591099 fast/ruby/nested-ruby.html [ Failure ] crbug.com/591099 fast/ruby/overhang-horizontal-no-overlap1.html [ Failure ] crbug.com/591099 fast/ruby/overhang-horizontal-no-overlap2.html [ Failure ] @@ -6509,7 +6263,6 @@ crbug.com/591099 fast/ruby/select-ruby.html [ Failure ] crbug.com/714962 fast/scroll-behavior/scroll-iframe-into-view-twice.html [ Failure ] crbug.com/714962 fast/scroll-behavior/scroll-over-resizer.html [ Failure ] -crbug.com/591099 fast/scroll-behavior/subframe-interrupted-scroll.html [ Failure Pass ] crbug.com/591099 fast/scrolling/content-box-smaller-than-scrollbar.html [ Failure ] crbug.com/591099 fast/scrolling/fractional-scroll-offset-fixed-position-non-composited.html [ Crash ] crbug.com/591099 fast/scrolling/horizontal-overflow-quirks.html [ Failure ] @@ -6716,20 +6469,15 @@ crbug.com/714962 fast/spatial-navigation/snav-zero-margin-content.html [ Failure ] crbug.com/591099 fast/sub-pixel/computedstylemargin.html [ Failure ] crbug.com/591099 fast/sub-pixel/float-wrap-zoom.html [ Failure ] -crbug.com/714962 fast/sub-pixel/inline-block-baseline.html [ Failure Pass ] crbug.com/591099 fast/sub-pixel/inline-block-with-padding.html [ Failure ] -crbug.com/714962 fast/sub-pixel/position-right-aligns-with-container.html [ Failure Pass ] crbug.com/591099 fast/sub-pixel/repaint-subpixel-layer-in-subpixel-composited-layer.html [ Failure ] crbug.com/591099 fast/sub-pixel/selection/selection-rect-in-sub-pixel-table.html [ Crash ] crbug.com/591099 fast/sub-pixel/should-not-repaint-subpixel-composited-layer.html [ Failure ] crbug.com/714962 fast/sub-pixel/size-of-span-with-different-positions.html [ Failure ] crbug.com/591099 fast/sub-pixel/sub-pixel-border-2.html [ Failure ] -crbug.com/714962 fast/sub-pixel/sub-pixel-iframe-copy-on-scroll.html [ Failure Pass ] crbug.com/591099 fast/sub-pixel/table-cells-with-padding-do-not-wrap.html [ Failure Pass ] crbug.com/591099 fast/sub-pixel/table-rtl-padding.html [ Failure Pass ] -crbug.com/714962 fast/sub-pixel/transformed-iframe-copy-on-scroll.html [ Failure Pass ] crbug.com/714962 fast/sub-pixel/width-of-inline-in-float.html [ Failure ] -crbug.com/714962 fast/table/008.html [ Failure Pass ] crbug.com/591099 fast/table/018.html [ Failure ] crbug.com/591099 fast/table/032.html [ Failure ] crbug.com/714962 fast/table/035-vertical.html [ Failure ] @@ -6801,7 +6549,6 @@ crbug.com/591099 fast/table/change-tbody-border-width.html [ Failure ] crbug.com/591099 fast/table/collapsed-border-overflow-hidden.html [ Failure ] crbug.com/591099 fast/table/column-in-inline.html [ Failure ] -crbug.com/591099 fast/table/convert-inline-to-table-cell.html [ Failure Pass ] crbug.com/591099 fast/table/dynamic-descendant-percentage-height.html [ Failure ] crbug.com/591099 fast/table/empty-table-percent-height.html [ Failure ] crbug.com/591099 fast/table/fixed-table-layout/table-with-percent-width.html [ Failure ] @@ -6815,7 +6562,6 @@ crbug.com/714962 fast/table/hittest-tablecell-with-borders-right-edge.html [ Failure ] crbug.com/591099 fast/table/incomplete-table-in-fragment-2.html [ Failure ] crbug.com/591099 fast/table/incomplete-table-in-fragment-hang.html [ Failure ] -crbug.com/714962 fast/table/inline-table-in-inline-block-last-baseline-align.html [ Failure Pass ] crbug.com/591099 fast/table/inline-table-margin-baseline.html [ Failure ] crbug.com/591099 fast/table/large-shrink-wrapped-width.html [ Failure ] crbug.com/591099 fast/table/min-max-width-preferred-size.html [ Failure Pass ] @@ -6937,8 +6683,6 @@ crbug.com/591099 fast/text-autosizing/wide-block.html [ Failure ] crbug.com/591099 fast/text-autosizing/wide-child.html [ Failure ] crbug.com/591099 fast/text-autosizing/wide-in-narrow-overflow-scroll.html [ Failure ] -crbug.com/714962 fast/text/align-center-rtl-spill.html [ Failure Pass ] -crbug.com/591099 fast/text/atomic-inline-before-ellipsis.html [ Failure Pass ] crbug.com/714962 fast/text/atsui-multiple-renderers.html [ Failure ] crbug.com/714962 fast/text/basic/002.html [ Failure ] crbug.com/591099 fast/text/basic/007.html [ Failure Pass ] @@ -6955,9 +6699,7 @@ crbug.com/591099 fast/text/complex-text-opacity.html [ Failure ] crbug.com/591099 fast/text/container-align-with-inlines.html [ Failure ] crbug.com/714962 fast/text/content-following-inline-isolate-with-collapsed-whitespace.html [ Failure ] -crbug.com/591099 fast/text/decorations-transformed.html [ Failure Pass ] crbug.com/591099 fast/text/decorations-with-text-combine.html [ Failure ] -crbug.com/591099 fast/text/descent-clip-in-scaled-page.html [ Failure Pass ] crbug.com/714962 fast/text/drawBidiText.html [ Failure ] crbug.com/591099 fast/text/ellipsis-at-edge-of-ltr-text-in-rtl-flow.html [ Failure ] crbug.com/591099 fast/text/ellipsis-at-edge-of-rtl-text-in-ltr-flow.html [ Failure ] @@ -6966,7 +6708,6 @@ crbug.com/591099 fast/text/ellipsis-in-relative-inline-right.html [ Failure ] crbug.com/591099 fast/text/ellipsis-in-relative-inline.html [ Failure ] crbug.com/591099 fast/text/ellipsis-ltr-text-in-ltr-flow-underline.html [ Failure ] -crbug.com/591099 fast/text/ellipsis-ltr-text-in-ltr-flow.html [ Failure Pass ] crbug.com/591099 fast/text/ellipsis-ltr-text-in-rtl-flow-leading-space.html [ Failure ] crbug.com/591099 fast/text/ellipsis-ltr-text-in-rtl-flow-underline.html [ Failure ] crbug.com/591099 fast/text/ellipsis-ltr-text-in-rtl-flow.html [ Failure ] @@ -6978,8 +6719,6 @@ crbug.com/591099 fast/text/ellipsis-rtl-text-in-ltr-flow-underline.html [ Failure ] crbug.com/591099 fast/text/ellipsis-rtl-text-in-ltr-flow.html [ Failure ] crbug.com/591099 fast/text/ellipsis-rtl-text-in-rtl-flow-underline.html [ Failure ] -crbug.com/591099 fast/text/ellipsis-rtl-text-in-rtl-flow.html [ Failure Pass ] -crbug.com/591099 fast/text/ellipsis-stroked.html [ Failure Pass ] crbug.com/591099 fast/text/ellipsis-with-list-marker-in-ltr-flow.html [ Failure ] crbug.com/591099 fast/text/ellipsis-with-list-marker-in-rtl-flow.html [ Failure ] crbug.com/591099 fast/text/emoji-web-font.html [ Failure Pass ] @@ -7022,13 +6761,11 @@ crbug.com/714962 fast/text/international/combining-marks-position.html [ Failure ] crbug.com/714962 fast/text/international/complex-character-based-fallback.html [ Failure ] crbug.com/714962 fast/text/international/danda-space.html [ Failure ] -crbug.com/591099 fast/text/international/draw-complex-text-from-to.html [ Failure Pass ] crbug.com/714962 fast/text/international/hindi-whitespace.html [ Failure ] crbug.com/591099 fast/text/international/inline-plaintext-is-isolated.html [ Failure Pass ] crbug.com/714962 fast/text/international/iso-8859-8.html [ Failure ] crbug.com/714962 fast/text/international/listbox-width-rtl.html [ Failure ] crbug.com/714962 fast/text/international/plane2.html [ Failure ] -crbug.com/591099 fast/text/international/rtl-negative-letter-spacing.html [ Failure Pass ] crbug.com/714962 fast/text/international/rtl-selection-rect-with-fallback.html [ Failure ] crbug.com/591099 fast/text/international/shape-across-elements.html [ Failure ] crbug.com/591099 fast/text/international/text-combine-image-test.html [ Failure ] @@ -7038,13 +6775,10 @@ crbug.com/714962 fast/text/international/vertical-text-glyph-test.html [ Failure ] crbug.com/714962 fast/text/international/vertical-text-metrics-test.html [ Failure ] crbug.com/591099 fast/text/justify-ideograph-vertical.html [ Failure ] -crbug.com/714962 fast/text/justify-padding-distribution.html [ Failure Pass ] crbug.com/591099 fast/text/large-text-composed-char.html [ Timeout ] crbug.com/591099 fast/text/letter-spacing-leading-and-trailing.html [ Crash Failure ] crbug.com/714962 fast/text/line-break-after-inline-latin1.html [ Failure ] -crbug.com/591099 fast/text/long-word.html [ Failure Pass ] crbug.com/714962 fast/text/multiglyph-characters.html [ Failure ] -crbug.com/591099 fast/text/offsetForPosition-cluster-at-zero.html [ Failure Pass ] crbug.com/591099 fast/text/orientation-sideways.html [ Failure ] crbug.com/591099 fast/text/place-ellipsis-in-inline-block-adjacent-float-2.html [ Failure ] crbug.com/591099 fast/text/place-ellipsis-in-inline-block-adjacent-float.html [ Failure ] @@ -7124,10 +6858,8 @@ crbug.com/714962 fast/text/whitespace/reattach-slotted-whitespace.html [ Failure ] crbug.com/636993 fast/text/whitespace/text-align-justify-and-whitespace-pre.html [ Failure ] crbug.com/591099 fast/text/whitespace/whitespace-in-pre.html [ Failure ] -crbug.com/591099 fast/text/wide-preformatted.html [ Failure Pass ] crbug.com/714962 fast/text/word-break-soft-hyphen.html [ Failure ] crbug.com/591099 fast/text/word-break.html [ Failure ] -crbug.com/591099 fast/text/word-space-between-inlines.html [ Failure Pass ] crbug.com/591099 fast/text/writing-root-with-overflow-clip-baseline.html [ Crash ] crbug.com/591099 fast/text/zero-width-characters-complex-script.html [ Failure ] crbug.com/591099 fast/text/zero-width-characters.html [ Failure ] @@ -7137,11 +6869,8 @@ crbug.com/591099 fast/tokenizer/missing-style-end-tag-1.html [ Failure ] crbug.com/591099 fast/tokenizer/missing-style-end-tag-2.html [ Failure ] crbug.com/591099 fast/tokenizer/nested-cached-scripts-and-stylesheet.html [ Failure ] -crbug.com/591099 fast/tokenizer/nested-multiple-scripts.html [ Crash Pass ] crbug.com/591099 fast/tokenizer/script-after-frameset.html [ Failure ] crbug.com/591099 fast/tokenizer/script_extra_close.html [ Failure ] -crbug.com/591099 fast/tokenizer/write-partial-entity.html [ Crash Pass ] -crbug.com/591099 fast/url/degenerate-file-base.html [ Crash Pass ] crbug.com/591099 fast/workers/shared-worker-location.html [ Failure ] crbug.com/591099 fast/workers/worker-location.html [ Failure ] crbug.com/591099 fast/writing-mode/Kusa-Makura-background-canvas.html [ Failure ] @@ -7157,7 +6886,6 @@ crbug.com/714962 fast/writing-mode/border-styles-vertical-rl.html [ Failure ] crbug.com/714962 fast/writing-mode/border-vertical-lr.html [ Failure ] crbug.com/591099 fast/writing-mode/borders.html [ Failure ] -crbug.com/591099 fast/writing-mode/box-shadow-horizontal-tb-tile-edge.html [ Failure Pass ] crbug.com/714962 fast/writing-mode/broken-ideograph-small-caps.html [ Failure ] crbug.com/714962 fast/writing-mode/broken-ideographic-font.html [ Failure ] crbug.com/714962 fast/writing-mode/english-lr-text.html [ Failure ] @@ -7171,7 +6899,6 @@ crbug.com/591099 fast/writing-mode/japanese-ruby-vertical-lr.html [ Failure ] crbug.com/591099 fast/writing-mode/japanese-ruby-vertical-rl.html [ Failure ] crbug.com/591099 fast/writing-mode/logical-height-after-clear.html [ Failure ] -crbug.com/714962 fast/writing-mode/orthogonal-inline-block.html [ Failure Pass ] crbug.com/591099 fast/writing-mode/orthogonal-writing-modes-available-width-absolute-crash.html [ Failure ] crbug.com/591099 fast/writing-mode/orthogonal-writing-modes-in-layoutview-with-floats.html [ Crash ] crbug.com/591099 fast/writing-mode/percentage-height-orthogonal-writing-modes-quirks.html [ Failure ] @@ -7264,7 +6991,6 @@ crbug.com/591099 fragmentation/single-line-cells-multiple-tables-caption-repeating-thead-tfoot-with-border-spacing-at-top-of-row-3.html [ Failure ] crbug.com/591099 fragmentation/single-line-cells-multiple-tables-caption-repeating-thead-tfoot-with-border-spacing-at-top-of-row-4.html [ Failure ] crbug.com/591099 fragmentation/single-line-cells-multiple-tables-caption-repeating-thead-tfoot-with-border-spacing-at-top-of-row.html [ Failure ] -crbug.com/591099 fragmentation/single-line-cells-multiple-tables-caption-repeating-thead-with-border-spacing-at-top-of-row-3.html [ Failure Pass ] crbug.com/591099 fragmentation/single-line-cells-nested-repeating-thead-2.html [ Failure ] crbug.com/591099 fragmentation/single-line-cells-nested-repeating-thead-3.html [ Failure ] crbug.com/591099 fragmentation/single-line-cells-nested-repeating-thead-4.html [ Failure ] @@ -7304,13 +7030,9 @@ crbug.com/591099 fragmentation/unbreakable-tall-float-before-block.html [ Failure ] crbug.com/591099 fragmentation/unbreakable-tall-float-before-line.html [ Failure ] crbug.com/591099 fullscreen/enter-exit-full-screen-hover.html [ Crash ] -crbug.com/591099 fullscreen/exit-full-screen-iframe.html [ Pass Timeout ] crbug.com/591099 fullscreen/full-screen-css.html [ Crash ] crbug.com/591099 fullscreen/full-screen-element-stack.html [ Crash ] -crbug.com/591099 fullscreen/full-screen-iframe-allowed-nested.html [ Pass Timeout ] -crbug.com/591099 fullscreen/full-screen-iframe-allowed.html [ Pass Timeout ] crbug.com/591099 fullscreen/full-screen-iframe-not-allowed.html [ Failure Timeout ] -crbug.com/591099 fullscreen/full-screen-iframe-ua-style.html [ Pass Timeout ] crbug.com/591099 fullscreen/full-screen-remove-ancestor-after.html [ Crash Pass ] crbug.com/591099 fullscreen/full-screen-ruleset-crash.html [ Crash Pass ] crbug.com/591099 fullscreen/full-screen-twice-newapi.html [ Crash ] @@ -7324,12 +7046,10 @@ crbug.com/591099 hittesting/border-hittest-inlineFlowBox.html [ Failure ] crbug.com/714962 hittesting/border-hittest-with-image-fallback.html [ Failure ] crbug.com/714962 hittesting/culled-inline.html [ Failure ] -crbug.com/591099 hittesting/hittest-child-of-inlineblock.html [ Failure Pass ] crbug.com/591099 hittesting/image-with-border-radius.html [ Failure ] crbug.com/714962 hittesting/image-with-clip-path.html [ Failure ] crbug.com/591099 hittesting/inline-with-clip-path.html [ Failure ] crbug.com/591099 hittesting/inner-border-radius-hittest.html [ Failure ] -crbug.com/591099 hittesting/text-overflow-inline-image.html [ Pass Timeout ] crbug.com/591099 html/details_summary/details-add-child-1.html [ Crash ] crbug.com/591099 html/details_summary/details-add-child-2.html [ Crash ] crbug.com/591099 html/details_summary/details-add-details-child-1.html [ Crash ] @@ -7443,7 +7163,6 @@ crbug.com/591099 html/grouping_content/listing.html [ Failure ] crbug.com/591099 html/marquee/marquee-scroll.html [ Failure ] crbug.com/591099 html/marquee/marquee-scrollamount.html [ Failure ] -crbug.com/714962 html/marquee/marquee-vspace-hspace.html [ Failure Pass ] crbug.com/714962 html/sections/body-legacy-colors.html [ Timeout ] crbug.com/591099 html/tabular_data/col_width_resizing_table.html [ Failure ] crbug.com/591099 html/tabular_data/table_border_invalid.html [ Failure ] @@ -7530,7 +7249,7 @@ crbug.com/714962 http/tests/devtools/elements/shadow/shadow-host-display-modes.js [ Crash ] crbug.com/714962 http/tests/devtools/elements/styles-1/add-new-rule-with-style-after-body.js [ Crash Pass ] crbug.com/714962 http/tests/devtools/elements/styles-1/edit-value-url-with-color.js [ Crash ] -crbug.com/714962 http/tests/devtools/elements/styles-2/force-pseudo-state.js [ Crash ] +crbug.com/714962 http/tests/devtools/elements/styles-2/force-pseudo-state.js [ Crash Pass ] crbug.com/714962 http/tests/devtools/elements/styles-2/paste-property.js [ Crash Pass ] crbug.com/714962 http/tests/devtools/elements/styles-2/pseudo-elements.js [ Crash ] crbug.com/591099 http/tests/devtools/elements/styles-3/style-rule-from-imported-stylesheet.js [ Crash Pass ] @@ -7545,7 +7264,6 @@ crbug.com/591099 http/tests/devtools/elements/styles-3/styles-disable-inherited.js [ Failure Pass ] crbug.com/714962 http/tests/devtools/elements/styles-4/styles-live-locations-leak.js [ Crash ] crbug.com/714962 http/tests/devtools/elements/styles-4/styles-update-from-js.js [ Crash ] -crbug.com/591099 http/tests/devtools/elements/styles-4/svg-style.js [ Failure Pass ] crbug.com/714962 http/tests/devtools/elements/styles-4/undo-add-new-rule.js [ Crash ] crbug.com/714962 http/tests/devtools/elements/styles-4/undo-add-property.js [ Crash ] crbug.com/591099 http/tests/devtools/elements/styles/selector-line-deprecated.js [ Crash Pass ] @@ -7553,28 +7271,21 @@ crbug.com/714962 http/tests/devtools/elements/styles/undo-change-property.js [ Crash Pass ] crbug.com/714962 http/tests/devtools/elements/styles/undo-property-toggle.js [ Crash Pass ] crbug.com/714962 http/tests/devtools/elements/styles/undo-set-selector-text.js [ Crash ] -crbug.com/591099 http/tests/devtools/extensions/extensions-network.js [ Failure Pass ] crbug.com/591099 http/tests/devtools/extensions/extensions-sidebar.js [ Crash Failure ] -crbug.com/591099 http/tests/devtools/extensions/extensions-timeline-api.js [ Failure Pass ] crbug.com/591099 http/tests/devtools/indexeddb/resources-panel.js [ Failure Timeout ] crbug.com/591099 http/tests/devtools/inspect-element.js [ Crash Pass ] crbug.com/714962 http/tests/devtools/jump-to-previous-editing-location.js [ Failure ] crbug.com/714962 http/tests/devtools/layers/layer-canvas-log.js [ Failure ] crbug.com/591099 http/tests/devtools/network/network-columns-visible.js [ Failure Timeout ] crbug.com/591099 http/tests/devtools/network/network-datareceived.js [ Failure ] -crbug.com/591099 http/tests/devtools/network/network-disable-cache-preloads.js [ Failure Pass ] crbug.com/591099 http/tests/devtools/persistence/automapping-sourcemap-nameclash.js [ Failure ] crbug.com/591099 http/tests/devtools/persistence/persistence-tabbed-editor-opens-filesystem-uisourcecode.js [ Failure Timeout ] crbug.com/591099 http/tests/devtools/runtime/runtime-getProperties.js [ Failure ] crbug.com/714962 http/tests/devtools/service-workers/service-workers-view.js [ Failure ] -crbug.com/591099 http/tests/devtools/sources/debugger-async/async-await/async-pause-on-exception.js [ Failure Pass ] crbug.com/591099 http/tests/devtools/sources/debugger-pause/debugger-pause-in-internal.js [ Failure ] -crbug.com/591099 http/tests/devtools/sources/debugger-pause/debugger-pause-on-exception.js [ Failure Pass ] -crbug.com/591099 http/tests/devtools/sources/debugger-pause/debugger-pause-on-promise-rejection.js [ Failure Pass ] crbug.com/591099 http/tests/devtools/sources/debugger-ui/function-generator-details.js [ Failure ] crbug.com/591099 http/tests/devtools/sources/debugger/live-edit-no-reveal.js [ Failure Pass ] crbug.com/591099 http/tests/devtools/sources/debugger/properties-special.js [ Failure ] -crbug.com/591099 http/tests/devtools/startup/console/console-format-startup.js [ Failure Pass ] crbug.com/591099 http/tests/devtools/startup/reattach-after-editing-styles.html [ Crash Pass Timeout ] crbug.com/591099 http/tests/devtools/text-autosizing-override.js [ Failure ] crbug.com/714962 http/tests/devtools/tracing/scroll-invalidations.js [ Failure ] @@ -7594,7 +7305,6 @@ crbug.com/591099 http/tests/feature-policy/payment-disabled.php [ Pass ] crbug.com/591099 http/tests/feature-policy/payment-enabledforall.php [ Pass ] crbug.com/591099 http/tests/filesystem/input-display.html [ Failure Timeout ] -crbug.com/591099 http/tests/images/drag-image-to-desktop.html [ Pass Timeout ] crbug.com/591099 http/tests/images/png-partial-load-as-document.html [ Failure Pass ] crbug.com/591099 http/tests/images/restyle-decode-error.html [ Failure ] crbug.com/783102 http/tests/incremental/frame-focus-before-load.html [ Pass Timeout ] @@ -7703,12 +7413,7 @@ crbug.com/591099 http/tests/security/contentSecurityPolicy/cached-frame-csp.html [ Failure ] crbug.com/591099 http/tests/security/contentSecurityPolicy/directive-parsing-03.html [ Failure ] crbug.com/591099 http/tests/security/contentSecurityPolicy/frame-src-cross-origin-load.html [ Failure ] -crbug.com/591099 http/tests/security/contentSecurityPolicy/frame-src-vs-shift-click.html [ Pass Timeout ] crbug.com/591099 http/tests/security/contentSecurityPolicy/multiple-report-policies.php [ Failure ] -crbug.com/591099 http/tests/security/contentSecurityPolicy/object-src-param-code-blocked.html [ Failure Pass ] -crbug.com/591099 http/tests/security/contentSecurityPolicy/object-src-param-movie-blocked.html [ Failure Pass ] -crbug.com/591099 http/tests/security/contentSecurityPolicy/object-src-param-src-blocked.html [ Failure Pass ] -crbug.com/591099 http/tests/security/contentSecurityPolicy/object-src-param-url-blocked.html [ Failure Pass ] crbug.com/591099 http/tests/security/contentSecurityPolicy/report-multiple-violations-01.php [ Failure ] crbug.com/591099 http/tests/security/contentSecurityPolicy/script-src-none-inline-event.html [ Failure ] crbug.com/591099 http/tests/security/contentSecurityPolicy/source-list-parsing-04.html [ Failure ] @@ -7720,8 +7425,6 @@ crbug.com/591099 http/tests/security/cross-origin-worker-indexeddb-allowed.html [ Failure ] crbug.com/591099 http/tests/security/dataTransfer-set-data-file-url.html [ Failure Timeout ] crbug.com/591099 http/tests/security/dataURL/xss-DENIED-from-data-url-sub-frame-to-data-url-sub-frame.html [ Failure ] -crbug.com/591099 http/tests/security/drag-drop-same-unique-origin.html [ Failure Pass ] -crbug.com/591099 http/tests/security/drag-over-remote-content-iframe.html [ Failure Pass ] crbug.com/591099 http/tests/security/feed-urls-from-remote.html [ Failure ] crbug.com/591099 http/tests/security/filesystem-iframe-from-remote.html [ Failure ] crbug.com/591099 http/tests/security/frameNavigation/sandbox-ALLOWED-top-navigation-with-two-flags.html [ Timeout ] @@ -7744,8 +7447,6 @@ crbug.com/591099 http/tests/security/local-JavaScript-from-remote.html [ Failure ] crbug.com/591099 http/tests/security/local-iFrame-from-remote.html [ Failure ] crbug.com/591099 http/tests/security/local-image-from-remote.html [ Failure ] -crbug.com/591099 http/tests/security/referrer-policy-redirect-link.html [ Pass Timeout ] -crbug.com/591099 http/tests/security/referrer-policy-rel-noreferrer.html [ Pass Timeout ] crbug.com/591099 http/tests/security/setDomainRelaxationForbiddenForURLScheme.html [ Crash Pass ] crbug.com/591099 http/tests/security/shape-image-cors-allow-origin.html [ Failure ] crbug.com/591099 http/tests/security/shape-image-cors-data-url.html [ Failure ] @@ -7758,11 +7459,9 @@ crbug.com/591099 http/tests/serviceworker/webexposed/global-interface-listing-service-worker.html [ Timeout ] crbug.com/591099 http/tests/shapes/shape-outside-image-shape-margin.html [ Failure ] crbug.com/591099 http/tests/shapes/shape-outside-svg-image-shape-margin.html [ Failure ] -crbug.com/591099 http/tests/subresource_filter/image-allow-disallow-transitions.html [ Failure Pass ] crbug.com/591099 http/tests/text-autosizing/narrow-iframe.html [ Failure ] crbug.com/591099 http/tests/text-autosizing/wide-iframe.html [ Failure ] crbug.com/591099 http/tests/uri/css-href.php [ Failure ] -crbug.com/591099 http/tests/webaudio/autoplay-crossorigin.html [ Pass Timeout ] crbug.com/714962 http/tests/webfont/font-display-intervention.html [ Failure ] crbug.com/591099 http/tests/websocket/invalid-subprotocol-characters.html [ Timeout ] crbug.com/591099 http/tests/workers/shared-worker-performance-timeline.html [ Pass ] @@ -7828,7 +7527,6 @@ crbug.com/714962 ietestcenter/css3/flexbox/flexbox-layout-003.htm [ Failure Pass ] crbug.com/591099 ietestcenter/css3/multicolumn/column-block-formatting-context-001.htm [ Failure ] crbug.com/591099 ietestcenter/css3/multicolumn/column-containing-block-001.htm [ Failure ] -crbug.com/591099 ietestcenter/css3/multicolumn/column-containing-block-002.htm [ Crash Failure Pass ] crbug.com/591099 ietestcenter/css3/multicolumn/column-containing-block-003.htm [ Failure ] crbug.com/714962 ietestcenter/css3/multicolumn/column-width-applies-to-001.htm [ Failure ] crbug.com/714962 ietestcenter/css3/multicolumn/column-width-applies-to-002.htm [ Failure ] @@ -7844,7 +7542,6 @@ crbug.com/714962 ietestcenter/css3/multicolumn/column-width-applies-to-015.htm [ Failure ] crbug.com/591099 ietestcenter/css3/text/textshadow-002.htm [ Failure ] crbug.com/714962 ietestcenter/css3/text/textshadow-003.htm [ Failure ] -crbug.com/591099 ietestcenter/css3/text/textshadow-009.htm [ Failure Pass ] crbug.com/591099 ietestcenter/css3/text/textshadow-010.htm [ Failure ] crbug.com/591099 imagecapture/MediaStreamTrack-getCapabilities.html [ Failure Pass ] crbug.com/591099 images/12-55.html [ Failure ] @@ -7855,13 +7552,11 @@ crbug.com/591099 images/alt-text-wrapping.html [ Failure ] crbug.com/591099 images/color-jpeg-with-color-profile.html [ Failure ] crbug.com/714962 images/color-profile-background-clip-text.html [ Failure ] -crbug.com/714962 images/color-profile-border-fade.html [ Failure ] +crbug.com/714962 images/color-profile-border-fade.html [ Failure Pass ] crbug.com/591099 images/color-profile-border-image-source.html [ Failure ] crbug.com/591099 images/color-profile-border-radius.html [ Failure ] -crbug.com/591099 images/color-profile-drag-image.html [ Failure Pass ] crbug.com/591099 images/color-profile-filter.html [ Failure ] crbug.com/591099 images/color-profile-group.html [ Failure ] -crbug.com/591099 images/color-profile-iframe.html [ Failure Pass ] crbug.com/591099 images/color-profile-image-filter-all.html [ Failure ] crbug.com/591099 images/color-profile-image-object-fit.html [ Failure ] crbug.com/591099 images/color-profile-image-profile-match.html [ Failure ] @@ -7882,7 +7577,6 @@ crbug.com/591099 images/cross-fade-svg-size.html [ Failure ] crbug.com/591099 images/cross-fade-tiled.html [ Failure ] crbug.com/714962 images/drag-image-transformed-parent.html [ Failure ] -crbug.com/591099 images/drag-svg-image.html [ Failure Pass ] crbug.com/591099 images/embed-does-not-propagate-dimensions-to-object-ancestor.html [ Failure ] crbug.com/591099 images/exif-orientation-css.html [ Failure ] crbug.com/591099 images/exif-orientation-height-image-document.html [ Failure ] @@ -7937,8 +7631,6 @@ crbug.com/591099 images/rendering-broken-images.html [ Failure ] crbug.com/591099 images/sprite-no-bleed.html [ Failure ] crbug.com/591099 images/webp-flip.html [ Failure ] -crbug.com/591099 images/width-on-broken-data-src.html [ Failure Pass ] -crbug.com/591099 images/zoomed-img-size.html [ Crash Pass ] crbug.com/591099 inspector-protocol/accessibility/accessibility-ignoredNodes.js [ Failure Timeout ] crbug.com/714962 inspector-protocol/accessibility/accessibility-ignoredNodesModal.js [ Failure ] crbug.com/591099 inspector-protocol/accessibility/accessibility-modal.js [ Crash ] @@ -7969,7 +7661,6 @@ crbug.com/591099 intersection-observer/remove-element.html [ Failure ] crbug.com/714962 intersection-observer/root-margin.html [ Failure ] crbug.com/591099 intersection-observer/same-document-root.html [ Failure ] -crbug.com/714962 jquery/offset.html [ Failure Pass ] crbug.com/591099 media/autoplay/document-user-activation.html [ Failure ] crbug.com/591099 media/controls-drag-timebar-rendering.html [ Failure Pass ] crbug.com/591099 media/controls-timeline.html [ Failure ] @@ -8010,7 +7701,6 @@ crbug.com/591099 mhtml/image_document.mht [ Failure ] crbug.com/591099 mhtml/invalid-bad-boundary2.mht [ Failure ] crbug.com/591099 mhtml/malformed_mhtml_no_footer.mht [ Failure ] -crbug.com/714962 mhtml/shared_buffer_bug.mht [ Failure Pass ] crbug.com/591099 overflow/overflow-basic-002.html [ Pass ] crbug.com/591099 overflow/overflow-position-003.html [ Failure ] crbug.com/591099 overflow/overflow-transform-perspective.html [ Failure ] @@ -8087,7 +7777,6 @@ crbug.com/591099 paint/invalidation/bugzilla-6388.html [ Failure ] crbug.com/591099 paint/invalidation/bugzilla-6473.html [ Failure ] crbug.com/591099 paint/invalidation/bugzilla-7235.html [ Crash ] -crbug.com/591099 paint/invalidation/button-inner-no-repaint.html [ Failure Pass ] crbug.com/714962 paint/invalidation/canvas-resize-no-full-invalidation.html [ Failure ] crbug.com/714962 paint/invalidation/caret-outside-block.html [ Failure ] crbug.com/714962 paint/invalidation/caret-subpixel.html [ Failure ] @@ -8144,7 +7833,7 @@ crbug.com/591099 paint/invalidation/compositing/layer-repaint.html [ Failure ] crbug.com/591099 paint/invalidation/compositing/multi-subsequence-composited.html [ Failure ] crbug.com/591099 paint/invalidation/compositing/new-stacking-context.html [ Failure ] -crbug.com/591099 paint/invalidation/compositing/newly-composited-on-scroll.html [ Crash ] +crbug.com/591099 paint/invalidation/compositing/newly-composited-on-scroll.html [ Crash Pass ] crbug.com/591099 paint/invalidation/compositing/opacity-between-absolute.html [ Failure ] crbug.com/591099 paint/invalidation/compositing/opacity-between-absolute2.html [ Failure ] crbug.com/591099 paint/invalidation/compositing/overflow-into-content.html [ Failure ] @@ -8223,14 +7912,12 @@ crbug.com/591099 paint/invalidation/filters/filter-repaint-on-accelerated-layer.html [ Failure ] crbug.com/714962 paint/invalidation/first-line-inline-child.html [ Failure ] crbug.com/591099 paint/invalidation/flexbox/align-content-change-keeping-geometry.html [ Failure ] -crbug.com/591099 paint/invalidation/flexbox/align-content-change-no-flex.html [ Failure Pass ] crbug.com/591099 paint/invalidation/flexbox/align-content-change.html [ Failure ] crbug.com/591099 paint/invalidation/flexbox/align-content-distribution-change-grid.html [ Failure ] crbug.com/591099 paint/invalidation/flexbox/align-items-change.html [ Failure ] crbug.com/591099 paint/invalidation/flexbox/align-self-change-grid.html [ Failure ] crbug.com/591099 paint/invalidation/flexbox/align-self-change-keeping-geometry-grid.html [ Failure ] crbug.com/591099 paint/invalidation/flexbox/align-self-change-keeping-geometry.html [ Failure ] -crbug.com/591099 paint/invalidation/flexbox/align-self-change-no-flex.html [ Failure Pass ] crbug.com/591099 paint/invalidation/flexbox/align-self-change.html [ Failure ] crbug.com/591099 paint/invalidation/flexbox/justify-content-change.html [ Failure ] crbug.com/591099 paint/invalidation/flexbox/justify-content-distribution-change-grid.html [ Failure ] @@ -8541,7 +8228,6 @@ crbug.com/591099 paint/invalidation/selection/selection-after-remove.html [ Failure ] crbug.com/714962 paint/invalidation/selection/selection-and-text-repaint.html [ Failure ] crbug.com/591099 paint/invalidation/selection/selection-change-in-iframe-with-relative-parent.html [ Crash Failure ] -crbug.com/591099 paint/invalidation/selection/selection-clear-after-move.html [ Failure Pass ] crbug.com/591099 paint/invalidation/selection/selection-clear.html [ Failure ] crbug.com/714962 paint/invalidation/selection/selection-in-composited-scrolling-container.html [ Failure ] crbug.com/714962 paint/invalidation/selection/selection-in-non-composited-scrolling-container.html [ Failure ] @@ -8617,7 +8303,6 @@ crbug.com/714962 paint/invalidation/svg/modify-transferred-listitem-different-attr.html [ Failure ] crbug.com/591099 paint/invalidation/svg/nested-embedded-svg-size-changes-no-layout-triggers-1.html [ Failure ] crbug.com/591099 paint/invalidation/svg/nested-embedded-svg-size-changes-no-layout-triggers-2.html [ Crash Failure ] -crbug.com/591099 paint/invalidation/svg/nested-embedded-svg-size-changes.html [ Failure Pass ] crbug.com/591099 paint/invalidation/svg/object-sizing-no-width-height-change-content-box-size.xhtml [ Failure ] crbug.com/714962 paint/invalidation/svg/outline-offset-text.html [ Failure ] crbug.com/591099 paint/invalidation/svg/overflow-repaint.html [ Failure ] @@ -8862,11 +8547,7 @@ crbug.com/591099 plugins/embed-attributes-style.html [ Failure ] crbug.com/591099 plugins/focus.html [ Failure Timeout ] crbug.com/591099 plugins/iframe-plugin-bgcolor.html [ Failure ] -crbug.com/591099 plugins/keyboard-events.html [ Failure Pass ] -crbug.com/591099 plugins/mouse-capture-inside-shadow.html [ Pass Timeout ] crbug.com/591099 plugins/mouse-click-plugin-clears-selection.html [ Failure ] -crbug.com/591099 plugins/mouse-events-fixedpos.html [ Failure Pass ] -crbug.com/591099 plugins/mouse-events.html [ Failure Pass ] crbug.com/591099 plugins/plugin-initiate-popup-window.html [ Timeout ] crbug.com/591099 plugins/refcount-leaks.html [ Failure ] crbug.com/591099 plugins/tabindex.html [ Failure ] @@ -8934,14 +8615,12 @@ crbug.com/714962 scrollbars/disabled-scrollbar.html [ Failure ] crbug.com/714962 scrollbars/overlay-scrollbars-within-overflow-scroll.html [ Failure ] crbug.com/714962 scrollbars/resize-scales-with-dpi-150.html [ Failure ] -crbug.com/591099 scrollbars/scrollbar-added-during-drag.html [ Pass Timeout ] crbug.com/714962 scrollbars/scrollbar-buttons.html [ Failure ] crbug.com/591099 scrollbars/scrollbar-click-does-not-blur-content.html [ Failure ] crbug.com/591099 scrollbars/scrollbar-large-overflow-rectangle.html [ Crash ] crbug.com/591099 scrollbars/scrollbar-miss-mousemove-disabled.html [ Failure ] crbug.com/714962 scrollbars/scrollbar-orientation.html [ Failure ] crbug.com/591099 scrollbars/scrollbar-owning-renderer-crash.html [ Failure ] -crbug.com/714962 scrollbars/scrollbar-pointer-events.html [ Failure Pass ] crbug.com/714962 scrollbars/scrollbar-position-crash.html [ Failure ] crbug.com/591099 scrollbars/scrollbars-on-positioned-content.html [ Failure ] crbug.com/591099 security/autocomplete-cleared-on-back.html [ Failure ] @@ -9031,116 +8710,6 @@ crbug.com/714962 svg/W3C-SVG-1.1/text-align-05-b.svg [ Failure ] crbug.com/714962 svg/W3C-SVG-1.1/text-text-05-t.svg [ Failure ] crbug.com/714962 svg/W3C-SVG-1.1/text-text-06-t.svg [ Failure ] -crbug.com/591099 svg/animations/animVal-basics.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-calcMode-spline-by.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-calcMode-spline-from-by.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-calcMode-spline-from-to.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-calcMode-spline-to.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-calcMode-spline-values.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-color-calcMode-discrete.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-color-fill-currentColor.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-color-fill-from-by.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-color-rgba-calcMode-discrete.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-color-transparent.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-css-xml-attributeType.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-currentColor.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-dynamic-update-attributeName.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-end-attribute.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-endElement-beginElement.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-from-to-keyTimes.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-gradient-transform.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-inherit-css-property.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-keySplines.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-marker-orient-from-angle-to-angle.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-marker-orient-from-angle-to-auto.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-marker-orient-from-auto-to-angle.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-marker-orient-from-auto-to-auto-start-reverse.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-marker-orient-to-angle.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-mpath-insert.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-number-calcMode-discrete-keyTimes.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-number-calcMode-discrete.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-path-animation-Cc-Ss.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-path-animation-Ll-Vv-Hh.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-path-animation-Mm-Aa-Z.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-path-animation-Qq-Tt.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-path-animation-cC-sS-inverse.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-path-animation-lL-vV-hH-inverse.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-path-animation-mM-aA-Z-inverse.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-path-animation-qQ-tT-inverse.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-path-nested-transforms.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-path-to-animation.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animate-text-nested-transforms.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animateTransform-pattern-transform.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animateTransform-translate-attributetype-auto.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animateTransform-translate-invalid-attributetype.html [ Pass Timeout ] -crbug.com/591099 svg/animations/animation-begin-change-js.html [ Pass Timeout ] -crbug.com/591099 svg/animations/deferred-insertion.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgPreserveAspectRatio-animation-1.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgangle-animation-deg-to-grad.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgangle-animation-deg-to-rad.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgangle-animation-grad-to-deg.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgangle-animation-grad-to-rad.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgangle-animation-rad-to-deg.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgangle-animation-rad-to-grad.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgboolean-animation-1.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgenum-animation-1.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgenum-animation-10.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgenum-animation-11.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgenum-animation-12.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgenum-animation-13.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgenum-animation-2.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgenum-animation-3.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgenum-animation-4.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgenum-animation-5.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgenum-animation-6.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgenum-animation-7.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgenum-animation-8.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgenum-animation-9.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svginteger-animation-1.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svginteger-animation-2.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svglength-animation-LengthModeHeight.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svglength-animation-LengthModeOther.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svglength-animation-LengthModeWidth.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svglength-animation-invalid-value-1.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svglength-animation-invalid-value-2.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svglength-animation-invalid-value-3.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svglength-animation-number-to-number.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svglength-animation-px-to-cm.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svglength-animation-px-to-ems.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svglength-animation-px-to-exs.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svglength-animation-px-to-in.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svglength-animation-px-to-number.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svglength-animation-px-to-pc.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svglength-animation-px-to-percentage.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svglength-animation-px-to-pt.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svglength-animation-px-to-px.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svglength-animation-unitType.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svglength-animation-values.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svglengthlist-animation-1.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svglengthlist-animation-2.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svglengthlist-animation-3.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svglengthlist-animation-4.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svglengthlist-animation-5.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgnumber-animation-1.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgnumber-animation-2.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgnumber-animation-3.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgnumber-animation-4.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgnumberlist-animation-1.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgnumberlist-animation-2.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgnumberoptionalnumber-animation-1.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgnumberoptionalnumber-animation-2.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgnumberoptionalnumber-animation-3.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgnumberoptionalnumber-animation-4.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgpath-animation-1.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgpointlist-animation-1.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgpointlist-animation-2.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgrect-animation-1.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgrect-animation-2.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgstring-animation-fallback-to-discrete.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgtransform-animation-1.html [ Pass Timeout ] -crbug.com/591099 svg/animations/svgtransform-animation-discrete.html [ Pass Timeout ] -crbug.com/591099 svg/animations/use-animate-transform-and-position.html [ Pass Timeout ] -crbug.com/591099 svg/animations/use-animate-width-and-height.html [ Pass Timeout ] crbug.com/591099 svg/as-background-image/animated-svg-as-background.html [ Crash Failure ] crbug.com/591099 svg/as-background-image/background-image-preserveaspectRatio-support.html [ Failure ] crbug.com/591099 svg/as-background-image/background-image-tiled.html [ Failure ] @@ -9278,7 +8847,6 @@ crbug.com/591099 svg/custom/anchor-on-use.svg [ Failure ] crbug.com/591099 svg/custom/bug45331.svg [ Failure ] crbug.com/714962 svg/custom/clamped-masking-clipping.svg [ Failure ] -crbug.com/591099 svg/custom/click-overflowing-element.html [ Failure Pass ] crbug.com/714962 svg/custom/clip-mask-negative-scale.svg [ Failure ] crbug.com/714962 svg/custom/clip-path-referencing-use.svg [ Failure ] crbug.com/714962 svg/custom/clip-path-with-css-transform-1.svg [ Failure ] @@ -9292,7 +8860,6 @@ crbug.com/591099 svg/custom/embedding-external-svgs.xhtml [ Failure ] crbug.com/591099 svg/custom/external-paintserver-reference.svg [ Failure ] crbug.com/591099 svg/custom/filter-css-transform-resolution.html [ Failure ] -crbug.com/591099 svg/custom/focus-event-handling.xhtml [ Failure Pass ] crbug.com/714962 svg/custom/focus-ring.svg [ Failure ] crbug.com/591099 svg/custom/foreign-object-skew.svg [ Failure ] crbug.com/591099 svg/custom/getscreenctm-in-mixed-content.xhtml [ Failure ] @@ -9336,7 +8903,6 @@ crbug.com/591099 svg/custom/rootmost-svg-xy-attrs.xhtml [ Failure ] crbug.com/591099 svg/custom/second-inline-text.xhtml [ Failure ] crbug.com/591099 svg/custom/simpleCDF.xml [ Failure ] -crbug.com/591099 svg/custom/size-follows-container-size.html [ Failure Pass ] crbug.com/591099 svg/custom/svg-allowed-in-dashboard-object.html [ Failure ] crbug.com/591099 svg/custom/svg-float-border-padding.xml [ Failure ] crbug.com/591099 svg/custom/svg-fonts-in-html.html [ Failure ] @@ -9344,12 +8910,10 @@ crbug.com/591099 svg/custom/svg-fonts-with-no-element-reference.html [ Failure ] crbug.com/591099 svg/custom/svg-fonts-word-spacing.html [ Failure ] crbug.com/714962 svg/custom/svg-overflow-types.svg [ Failure ] -crbug.com/714962 svg/custom/svg-root-with-opacity.html [ Failure Pass ] crbug.com/591099 svg/custom/tabindex-order.html [ Failure ] crbug.com/714962 svg/custom/text-clip.svg [ Failure ] crbug.com/591099 svg/custom/text-match-highlight.html [ Failure ] crbug.com/591099 svg/custom/text-zoom.xhtml [ Failure ] -crbug.com/591099 svg/custom/touch-events.html [ Failure Pass ] crbug.com/714962 svg/custom/transformed-outlines.svg [ Failure ] crbug.com/591099 svg/custom/transformed-text-pattern.html [ Failure ] crbug.com/591099 svg/custom/tref-with-progress-tag-setpseudo-assert.html [ Failure ] @@ -9378,18 +8942,8 @@ crbug.com/591099 svg/custom/xhtml-no-svg-renderer.xhtml [ Failure ] crbug.com/714962 svg/dom/SVGStringList-basics.xhtml [ Failure ] crbug.com/591099 svg/dom/svg-root-lengths.html [ Failure ] -crbug.com/591099 svg/dom/title-in-shadow-tree.html [ Failure Pass ] -crbug.com/591099 svg/dom/tooltip-title-external-svg.html [ Failure Pass ] crbug.com/591099 svg/dom/tooltip-title-inline-svg.html [ Failure ] -crbug.com/591099 svg/dom/tooltip-title-with-use.html [ Failure Pass ] crbug.com/714962 svg/dynamic-updates/SVG-dynamic-css-transform.html [ Failure ] -crbug.com/591099 svg/dynamic-updates/SVGAElement-dom-href-attr.html [ Failure Pass ] -crbug.com/591099 svg/dynamic-updates/SVGAElement-dom-target-attr.html [ Failure Pass ] -crbug.com/591099 svg/dynamic-updates/SVGAElement-svgdom-href-prop.html [ Failure Pass ] -crbug.com/591099 svg/dynamic-updates/SVGAElement-svgdom-target-prop.html [ Failure Pass ] -crbug.com/591099 svg/dynamic-updates/SVGClipPath-influences-hitTesting.html [ Failure Pass ] -crbug.com/591099 svg/dynamic-updates/SVGClipPathElement-css-transform-influences-hitTesting.html [ Failure Pass ] -crbug.com/591099 svg/dynamic-updates/SVGClipPathElement-transform-influences-hitTesting.html [ Crash Failure Pass ] crbug.com/714962 svg/dynamic-updates/SVGMaskElement-dom-height-attr.html [ Failure ] crbug.com/714962 svg/dynamic-updates/SVGMaskElement-dom-maskContentUnits-attr.html [ Failure ] crbug.com/714962 svg/dynamic-updates/SVGMaskElement-dom-maskUnits-attr.html [ Failure ] @@ -9424,16 +8978,11 @@ crbug.com/591099 svg/hittest/pointer-events-all2.html [ Failure ] crbug.com/591099 svg/hittest/rect-hittest.html [ Failure ] crbug.com/714962 svg/hittest/rect-miterlimit.html [ Failure ] -crbug.com/591099 svg/hittest/singular-transform-6.html [ Failure Pass ] -crbug.com/591099 svg/hittest/svg-inside-table.xhtml [ Failure Pass ] -crbug.com/591099 svg/hittest/svg-padding.xhtml [ Failure Pass ] crbug.com/591099 svg/hittest/text-small-font-size.html [ Failure ] -crbug.com/591099 svg/hittest/text-vertical.html [ Failure Pass ] crbug.com/591099 svg/hittest/update-ellipse.html [ Failure ] crbug.com/591099 svg/hittest/update-rect.html [ Failure ] crbug.com/591099 svg/hittest/zero-length-butt-cap-path.xhtml [ Failure ] crbug.com/591099 svg/hittest/zero-length-round-cap-path.xhtml [ Failure ] -crbug.com/591099 svg/hittest/zero-length-square-cap-path.xhtml [ Failure Pass ] crbug.com/591099 svg/hittest/zero-stroke-width.html [ Failure ] crbug.com/591099 svg/hixie/data-types/002.xhtml [ Failure ] crbug.com/591099 svg/hixie/error/012.xml [ Failure ] @@ -9482,7 +9031,6 @@ crbug.com/714962 svg/text/layout-inline-children-assert.html [ Failure ] crbug.com/591099 svg/text/ligature-queries.html [ Failure ] crbug.com/591099 svg/text/scaling-font-with-geometric-precision.html [ Failure ] -crbug.com/591099 svg/text/select-svg-text-with-collapsed-whitespace.html [ Failure Pass ] crbug.com/714962 svg/text/select-text-svgfont.html [ Failure ] crbug.com/591099 svg/text/selection-background-color.xhtml [ Failure ] crbug.com/591099 svg/text/selection-dragging-outside-1.html [ Failure ] @@ -9539,7 +9087,6 @@ crbug.com/591099 tables/layering/paint-test-layering-1.html [ Failure ] crbug.com/591099 tables/layering/paint-test-layering-2.html [ Failure ] crbug.com/591099 tables/mozilla/bugs/bug101674.html [ Failure Pass ] -crbug.com/714962 tables/mozilla/bugs/bug103533.html [ Failure Pass ] crbug.com/714962 tables/mozilla/bugs/bug106158-1.html [ Failure ] crbug.com/591099 tables/mozilla/bugs/bug106158-2.html [ Failure Pass ] crbug.com/714962 tables/mozilla/bugs/bug106816.html [ Failure ] @@ -9551,7 +9098,6 @@ crbug.com/591099 tables/mozilla/bugs/bug1188.html [ Failure Pass ] crbug.com/714962 tables/mozilla/bugs/bug11944.html [ Failure ] crbug.com/591099 tables/mozilla/bugs/bug12008.html [ Failure ] -crbug.com/714962 tables/mozilla/bugs/bug12268.html [ Failure Pass ] crbug.com/591099 tables/mozilla/bugs/bug126742.html [ Failure ] crbug.com/591099 tables/mozilla/bugs/bug1271.html [ Failure ] crbug.com/714962 tables/mozilla/bugs/bug1302.html [ Failure ] @@ -9572,14 +9118,12 @@ crbug.com/591099 tables/mozilla/bugs/bug149275-2.html [ Failure ] crbug.com/714962 tables/mozilla/bugs/bug16252.html [ Failure ] crbug.com/714962 tables/mozilla/bugs/bug17130-1.html [ Failure ] -crbug.com/714962 tables/mozilla/bugs/bug17587.html [ Failure Pass ] crbug.com/714962 tables/mozilla/bugs/bug18359.html [ Failure ] crbug.com/591099 tables/mozilla/bugs/bug18440.html [ Failure ] crbug.com/591099 tables/mozilla/bugs/bug18664.html [ Failure ] crbug.com/714962 tables/mozilla/bugs/bug18955.html [ Failure ] crbug.com/714962 tables/mozilla/bugs/bug19599.html [ Failure ] crbug.com/591099 tables/mozilla/bugs/bug20579.html [ Failure Pass ] -crbug.com/714962 tables/mozilla/bugs/bug215629.html [ Failure Pass ] crbug.com/591099 tables/mozilla/bugs/bug219693-1.html [ Failure ] crbug.com/591099 tables/mozilla/bugs/bug219693-2.html [ Failure ] crbug.com/591099 tables/mozilla/bugs/bug221784-2.html [ Failure ] @@ -9611,7 +9155,6 @@ crbug.com/714962 tables/mozilla/bugs/bug4427.html [ Failure ] crbug.com/714962 tables/mozilla/bugs/bug44523.html [ Failure ] crbug.com/714962 tables/mozilla/bugs/bug4501.html [ Failure ] -crbug.com/714962 tables/mozilla/bugs/bug4527.html [ Failure Pass ] crbug.com/714962 tables/mozilla/bugs/bug4576.html [ Failure ] crbug.com/714962 tables/mozilla/bugs/bug46268-1.html [ Failure ] crbug.com/714962 tables/mozilla/bugs/bug46268-2.html [ Failure ] @@ -9789,7 +9332,6 @@ crbug.com/591099 tables/mozilla/other/wa_table_thtd_rowspan.html [ Failure ] crbug.com/591099 tables/mozilla/other/wa_table_tr_align.html [ Failure ] crbug.com/591099 tables/mozilla_expected_failures/bugs/bug1010.html [ Failure ] -crbug.com/591099 tables/mozilla_expected_failures/bugs/bug10140.html [ Failure Pass ] crbug.com/714962 tables/mozilla_expected_failures/bugs/bug1055-2.html [ Failure ] crbug.com/714962 tables/mozilla_expected_failures/bugs/bug1128.html [ Failure ] crbug.com/714962 tables/mozilla_expected_failures/bugs/bug14007-1.html [ Failure ] @@ -9797,7 +9339,6 @@ crbug.com/591099 tables/mozilla_expected_failures/bugs/bug19526.html [ Failure ] crbug.com/714962 tables/mozilla_expected_failures/bugs/bug21518.html [ Failure ] crbug.com/714962 tables/mozilla_expected_failures/bugs/bug22122.html [ Failure ] -crbug.com/714962 tables/mozilla_expected_failures/bugs/bug23847.html [ Failure Pass ] crbug.com/714962 tables/mozilla_expected_failures/bugs/bug2479-5.html [ Failure ] crbug.com/714962 tables/mozilla_expected_failures/bugs/bug25707.html [ Failure ] crbug.com/714962 tables/mozilla_expected_failures/bugs/bug32205-4.html [ Failure ] @@ -9805,8 +9346,6 @@ crbug.com/714962 tables/mozilla_expected_failures/bugs/bug4294.html [ Failure ] crbug.com/714962 tables/mozilla_expected_failures/bugs/bug51000.html [ Failure ] crbug.com/714962 tables/mozilla_expected_failures/bugs/bug56024.html [ Failure ] -crbug.com/591099 tables/mozilla_expected_failures/bugs/bug61042-1.html [ Failure Pass ] -crbug.com/591099 tables/mozilla_expected_failures/bugs/bug61042-2.html [ Failure Pass ] crbug.com/591099 tables/mozilla_expected_failures/bugs/bug7113.html [ Failure ] crbug.com/714962 tables/mozilla_expected_failures/bugs/bug72393.html [ Failure ] crbug.com/714962 tables/mozilla_expected_failures/bugs/bug80762-2.html [ Failure ] @@ -9838,7 +9377,6 @@ crbug.com/714962 touchadjustment/context-menu-text-subtargets.html [ Failure ] crbug.com/714962 touchadjustment/context-menu.html [ Failure ] crbug.com/714962 touchadjustment/disabled-formelements.html [ Failure ] -crbug.com/591099 touchadjustment/editable-content.html [ Failure Pass ] crbug.com/714962 touchadjustment/event-triggered-widgets.html [ Failure ] crbug.com/714962 touchadjustment/html-label.html [ Failure ] crbug.com/714962 touchadjustment/iframe.html [ Failure ] @@ -9927,13 +9465,11 @@ crbug.com/591099 virtual/gpu-rasterization/images/alt-text-wrapping.html [ Failure ] crbug.com/591099 virtual/gpu-rasterization/images/color-jpeg-with-color-profile.html [ Failure ] crbug.com/591099 virtual/gpu-rasterization/images/color-profile-background-clip-text.html [ Failure ] -crbug.com/714962 virtual/gpu-rasterization/images/color-profile-border-fade.html [ Failure ] +crbug.com/714962 virtual/gpu-rasterization/images/color-profile-border-fade.html [ Failure Pass ] crbug.com/591099 virtual/gpu-rasterization/images/color-profile-border-image-source.html [ Failure ] crbug.com/591099 virtual/gpu-rasterization/images/color-profile-border-radius.html [ Failure ] -crbug.com/591099 virtual/gpu-rasterization/images/color-profile-drag-image.html [ Failure Pass ] crbug.com/591099 virtual/gpu-rasterization/images/color-profile-filter.html [ Failure Timeout ] crbug.com/591099 virtual/gpu-rasterization/images/color-profile-group.html [ Failure ] -crbug.com/591099 virtual/gpu-rasterization/images/color-profile-iframe.html [ Failure Pass ] crbug.com/591099 virtual/gpu-rasterization/images/color-profile-image-filter-all.html [ Failure ] crbug.com/591099 virtual/gpu-rasterization/images/color-profile-image-object-fit.html [ Failure ] crbug.com/591099 virtual/gpu-rasterization/images/color-profile-image-profile-match.html [ Failure ] @@ -9953,7 +9489,6 @@ crbug.com/591099 virtual/gpu-rasterization/images/cross-fade-sizing.html [ Failure ] crbug.com/591099 virtual/gpu-rasterization/images/cross-fade-tiled.html [ Failure ] crbug.com/714962 virtual/gpu-rasterization/images/drag-image-transformed-parent.html [ Failure ] -crbug.com/591099 virtual/gpu-rasterization/images/drag-svg-image.html [ Failure Pass ] crbug.com/591099 virtual/gpu-rasterization/images/embed-does-not-propagate-dimensions-to-object-ancestor.html [ Failure ] crbug.com/591099 virtual/gpu-rasterization/images/exif-orientation-css.html [ Failure ] crbug.com/591099 virtual/gpu-rasterization/images/exif-orientation-height-image-document.html [ Failure ] @@ -10008,9 +9543,6 @@ crbug.com/591099 virtual/gpu-rasterization/images/rendering-broken-images.html [ Failure ] crbug.com/591099 virtual/gpu-rasterization/images/sprite-no-bleed.html [ Failure ] crbug.com/591099 virtual/gpu-rasterization/images/webp-flip.html [ Failure ] -crbug.com/591099 virtual/gpu-rasterization/images/width-on-broken-data-src.html [ Failure Pass ] -crbug.com/591099 virtual/gpu-rasterization/images/zoomed-img-size.html [ Crash Pass ] -crbug.com/591099 virtual/gpu/fast/canvas/OffscreenCanvas-2d-imageSmoothing.html [ Pass Timeout ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-createImageBitmap-colorClamping.html [ Pass ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-createImageBitmap-drawImage.html [ Timeout ] crbug.com/714962 virtual/gpu/fast/canvas/canvas-css-clip-path.html [ Failure ] @@ -10025,7 +9557,6 @@ crbug.com/714962 virtual/gpu/fast/canvas/canvas-textMetrics-width.html [ Failure ] crbug.com/591099 virtual/gpu/fast/canvas/canvas-transforms-during-path.html [ Failure Timeout ] crbug.com/591099 virtual/gpu/fast/canvas/fill-stroke-clip-reset-path.html [ Failure ] -crbug.com/591099 virtual/gpu/fast/canvas/fillrect_gradient.html [ Failure Pass ] crbug.com/714962 virtual/gpu/fast/canvas/image-object-in-canvas.html [ Failure ] crbug.com/591099 virtual/gpu/fast/canvas/patternfill-repeat.html [ Failure Timeout ] crbug.com/714962 virtual/gpu/fast/canvas/setWidthResetAfterForcedRender.html [ Failure ] @@ -10045,7 +9576,6 @@ crbug.com/714962 virtual/incremental-shadow-dom/fast/dom/shadow/input-color-in-content.html [ Timeout ] crbug.com/714962 virtual/incremental-shadow-dom/fast/dom/shadow/scrollbar.html [ Crash ] crbug.com/714962 virtual/incremental-shadow-dom/fast/dom/shadow/select-in-shadowdom.html [ Failure ] -crbug.com/591099 virtual/incremental-shadow-dom/fast/dom/shadow/selection-in-nested-shadow.html [ Failure Pass ] crbug.com/591099 virtual/incremental-shadow-dom/fast/dom/shadow/selections-in-shadow.html [ Timeout ] crbug.com/714962 virtual/incremental-shadow-dom/fast/dom/shadow/shadow-boundary-crossing.html [ Failure ] crbug.com/591099 virtual/incremental-shadow-dom/fast/dom/shadow/shadow-dom-event-dispatching-svg-in-shadow-subtree.html [ Failure ] @@ -10079,7 +9609,6 @@ crbug.com/591099 virtual/layout_ng/fast/block/float/float-on-zero-height-line.html [ Pass ] crbug.com/591099 virtual/layout_ng/fast/block/float/marquee-shrink-to-avoid-floats.html [ Pass ] crbug.com/591099 virtual/layout_ng/fast/block/float/nested-clearance.html [ Pass ] -crbug.com/591099 virtual/layout_ng/fast/block/float/shrink-to-avoid-float-complexity.html [ Failure Pass ] crbug.com/591099 virtual/layout_ng/fast/block/margin-collapse/self-collapsing-cols-creates-block-formatting-context.html [ Pass ] crbug.com/591099 virtual/layout_ng/overflow/overflow-basic-003.html [ Pass ] crbug.com/591099 virtual/layout_ng/overflow/overflow-bug-chrome-ng-001.html [ Pass ] @@ -10096,7 +9625,6 @@ crbug.com/591099 virtual/mojo-localstorage/ [ Skip ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/anchor-empty-focus.html [ Failure ] crbug.com/714962 virtual/mouseevent_fractional/fast/events/autoscroll-disabled-in-fix.html [ Timeout ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/autoscroll-in-overflow-hidden-html.html [ Failure Pass ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/autoscroll-in-textfield.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/autoscroll-nonscrollable-iframe-in-scrollable-div.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/autoscroll-should-not-stop-on-keypress.html [ Failure ] @@ -10108,12 +9636,8 @@ crbug.com/591099 virtual/mouseevent_fractional/fast/events/check-defocus-event-order-when-triggered-by-tab.html [ Failure ] crbug.com/714962 virtual/mouseevent_fractional/fast/events/click-checkbox-blur-refocus-window.html [ Failure ] crbug.com/714962 virtual/mouseevent_fractional/fast/events/click-checkbox-refocus-window.html [ Failure ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/click-focus-anchor.html [ Failure Pass ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/click-focus-svganchor-has-ring.html [ Failure Pass ] crbug.com/714962 virtual/mouseevent_fractional/fast/events/click-over-descendant-elements.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/click-range-slider.html [ Crash ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/click-svganchor-blur-refocus-window.html [ Failure Pass ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/click-svganchor-refocus-window.html [ Failure Pass ] crbug.com/714962 virtual/mouseevent_fractional/fast/events/click-with-large-negative-text-indent.html [ Failure ] crbug.com/714962 virtual/mouseevent_fractional/fast/events/content-changed-during-drop.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/context-no-deselect.html [ Failure ] @@ -10121,53 +9645,37 @@ crbug.com/714962 virtual/mouseevent_fractional/fast/events/contextmenu-scrolled-page-with-frame.html [ Failure ] crbug.com/714962 virtual/mouseevent_fractional/fast/events/document-elementFromPoint.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/domactivate-sets-underlying-click-event-as-handled.html [ Crash ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/drag-and-drop-autoscroll-inner-frame.html [ Pass Timeout ] crbug.com/714962 virtual/mouseevent_fractional/fast/events/drag-and-drop-subframe-dataTransfer.html [ Timeout ] crbug.com/714962 virtual/mouseevent_fractional/fast/events/drag-dataTransferItemList-file-handling.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/drag-dragend-detaches.html [ Failure Pass ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/drag-image-filename.html [ Pass Timeout ] crbug.com/714962 virtual/mouseevent_fractional/fast/events/drag-in-frames.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/drag-selects-image.html [ Failure ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/drag-svg-image-crash.html [ Pass Timeout ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/drag_and_drop_into_removed_on_focus.html [ Failure ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/event-hit-testing-fallback-to-iframe.html [ Failure Pass ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/event-listener-on-link.html [ Failure ] crbug.com/714962 virtual/mouseevent_fractional/fast/events/event-on-culled-inline-with-pseudo.html [ Failure ] crbug.com/714962 virtual/mouseevent_fractional/fast/events/event-on-culled_inline.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/event-trusted.html [ Failure ] crbug.com/714962 virtual/mouseevent_fractional/fast/events/file-input-hidden-in-ondrop.html [ Timeout ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/frame-click-focus.html [ Failure Pass ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/frame-detached-in-mousedown.html [ Pass Timeout ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/frame-programmatic-focus.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/frame-scroll-fake-mouse-move.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/frame-tab-focus.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/hit-test-counts.html [ Failure ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/iframe-mousewheel.html [ Failure Pass ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/iframe-onmousemove.html [ Pass Timeout ] crbug.com/714962 virtual/mouseevent_fractional/fast/events/input-element-display-none-in-dragleave-crash.html [ Failure ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/inputevents/beforeinput-remove-iframe-crash.html [ Failure Pass ] crbug.com/714962 virtual/mouseevent_fractional/fast/events/inputevents/inputevent-drag-drop.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/js-keyboard-event-creation.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/key-events-in-input-text.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/keyboardevent-getModifierState.html [ Timeout ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/keydown-1.html [ Failure Pass ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/keydown-keypress-focus-change.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/keydown-keypress-preventDefault.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/keypress-focus-change.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/media-element-focus-tab.html [ Failure ] crbug.com/714962 virtual/mouseevent_fractional/fast/events/middleClickAutoscroll-click-hyperlink.html [ Timeout ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/middleClickAutoscroll-in-iframe.html [ Pass Timeout ] crbug.com/714962 virtual/mouseevent_fractional/fast/events/middleClickAutoscroll-latching.html [ Timeout ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/middleClickAutoscroll-nested-divs-forbidden.html [ Timeout ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/mouse-cursor-style-change-iframe.html [ Failure Pass ] +crbug.com/591099 virtual/mouseevent_fractional/fast/events/middleClickAutoscroll-nested-divs-forbidden.html [ Pass Timeout ] crbug.com/714962 virtual/mouseevent_fractional/fast/events/mouse-down-on-pseudo-element-remove-crash.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/mouse-drag-from-frame-to-other-frame.html [ Failure ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/mouse-drag-from-frame.html [ Failure Pass ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/mouse-event-buttons-attribute.html [ Timeout ] crbug.com/714962 virtual/mouseevent_fractional/fast/events/mouse-events-on-textarea-resize.html [ Failure ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/mouse-events-within-no-element.html [ Failure Pass ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/mouse-focus-imagemap.html [ Failure Pass ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/mouse-moved-remove-frame-crash.html [ Pass Timeout ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/mouse-relative-position.html [ Failure ] crbug.com/714962 virtual/mouseevent_fractional/fast/events/mouseenter-mouseleave-inline-attributes.html [ Failure ] crbug.com/714962 virtual/mouseevent_fractional/fast/events/mouseenter-mouseleave.html [ Failure ] @@ -10183,7 +9691,6 @@ crbug.com/591099 virtual/mouseevent_fractional/fast/events/onclick-list-marker.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/onload-re-entry.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/onload-webkit-before-webcore.html [ Failure ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/page-scaled-mouse-click-iframe.html [ Failure Pass ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/pointer-events-2.html [ Failure ] crbug.com/714962 virtual/mouseevent_fractional/fast/events/pointerevents/mouse-node-remove.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/pointerevents/mouse-on-object.html [ Failure Pass ] @@ -10204,16 +9711,12 @@ crbug.com/591099 virtual/mouseevent_fractional/fast/events/popup-blocked-from-different-frames.html [ Failure ] crbug.com/714962 virtual/mouseevent_fractional/fast/events/popup-blocked-from-untrusted-mouse-click.html [ Timeout ] crbug.com/714962 virtual/mouseevent_fractional/fast/events/popup-blocked-from-wrong-event.html [ Timeout ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/popup-blocking-click-in-iframe.html [ Pass Timeout ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/remove-target-in-mouseup.html [ Failure Pass ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/remove-target-with-shadow-in-drag.html [ Failure Pass ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/reveal-link-when-focused.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/right-click-focus.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/scroll-after-click-on-tab-index.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/scroll-div-with-prevent-default-in-subframe.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/scroll-to-anchor-in-overflow-hidden.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/select-element.html [ Timeout ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/select-onchange-mouse-released-outside.html [ Failure Pass ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/selectstart-by-double-triple-clicks.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/selectstart-by-drag.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/selectstart-by-single-click-with-shift.html [ Failure ] @@ -10228,13 +9731,8 @@ crbug.com/591099 virtual/mouseevent_fractional/fast/events/touch/gesture/gesture-click-on-inline-continations.html [ Failure ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/touch/gesture/gesture-tap-frame-move.html [ Failure ] crbug.com/714962 virtual/mouseevent_fractional/fast/events/touch/gesture/gesture-tap-input-after-composition.html [ Failure ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/touch/gesture/gesture-tap-mouse-events-between-frames.html [ Failure Pass ] crbug.com/714962 virtual/mouseevent_fractional/fast/events/touch/gesture/gesture-tap-mouse-events.html [ Failure ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/touch/gesture/gesture-tap-near-iframe.html [ Failure Pass ] crbug.com/714962 virtual/mouseevent_fractional/fast/events/touch/gesture/gesture-tap-result.html [ Failure ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/touch/gesture/long-press-drag-drop-touch-editing-combined-in-iframe.html [ Failure Pass ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/touch/gesture/long-press-focuses-frame.html [ Failure Pass ] -crbug.com/591099 virtual/mouseevent_fractional/fast/events/touch/gesture/touch-gesture-scroll-iframe-editable.html [ Failure Pass ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/touch/gesture/touch-gesture-scroll-iframe-past-extent.html [ Failure Timeout ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/touch/touch-action-range-input-crash.html [ Crash ] crbug.com/591099 virtual/mouseevent_fractional/fast/events/touch/touch-action-range-input-csp.html [ Crash ] @@ -10260,18 +9758,15 @@ crbug.com/591099 virtual/rootlayerscrolls/ [ Skip ] crbug.com/591099 virtual/scalefactor150/fast/hidpi/static/calendar-picker-appearance.html [ Failure ] crbug.com/591099 virtual/scalefactor150/fast/hidpi/static/data-suggestion-picker-appearance.html [ Failure ] -crbug.com/591099 virtual/scalefactor150/fast/hidpi/static/drag-image.html [ Failure Pass ] crbug.com/591099 virtual/scalefactor150/fast/hidpi/static/popup-menu-with-scrollbar-appearance.html [ Failure ] crbug.com/591099 virtual/scalefactor150/fast/hidpi/static/validation-bubble-appearance-hidpi.html [ Failure ] crbug.com/714962 virtual/scalefactor200/fast/hidpi/static/calendar-picker-appearance.html [ Failure ] crbug.com/714962 virtual/scalefactor200/fast/hidpi/static/data-suggestion-picker-appearance.html [ Failure ] -crbug.com/591099 virtual/scalefactor200/fast/hidpi/static/drag-image.html [ Failure Pass ] crbug.com/714962 virtual/scalefactor200/fast/hidpi/static/popup-menu-appearance.html [ Failure ] crbug.com/591099 virtual/scalefactor200/fast/hidpi/static/popup-menu-with-scrollbar-appearance.html [ Failure ] crbug.com/591099 virtual/scalefactor200/fast/hidpi/static/validation-bubble-appearance-hidpi.html [ Failure ] crbug.com/714962 virtual/scalefactor200withzoom/fast/hidpi/static/calendar-picker-appearance.html [ Failure ] crbug.com/714962 virtual/scalefactor200withzoom/fast/hidpi/static/data-suggestion-picker-appearance.html [ Failure ] -crbug.com/591099 virtual/scalefactor200withzoom/fast/hidpi/static/drag-image.html [ Failure Pass ] crbug.com/714962 virtual/scalefactor200withzoom/fast/hidpi/static/popup-menu-appearance.html [ Failure ] crbug.com/591099 virtual/scalefactor200withzoom/fast/hidpi/static/popup-menu-with-scrollbar-appearance.html [ Failure ] crbug.com/591099 virtual/scalefactor200withzoom/fast/hidpi/static/validation-bubble-appearance-hidpi.html [ Failure ] @@ -10353,6 +9848,7 @@ crbug.com/591099 virtual/spv175/compositing/geometry/outline-change.html [ Failure ] crbug.com/591099 virtual/spv175/compositing/geometry/partial-layout-update.html [ Failure ] crbug.com/591099 virtual/spv175/compositing/geometry/preserve-3d-switching.html [ Failure ] +crbug.com/591099 virtual/spv175/compositing/geometry/repaint-foreground-layer.html [ Failure ] crbug.com/591099 virtual/spv175/compositing/geometry/root-layer-update.html [ Failure ] crbug.com/591099 virtual/spv175/compositing/geometry/tall-page-composited.html [ Failure ] crbug.com/591099 virtual/spv175/compositing/geometry/transformed-abs-position-inside-composited.html [ Failure ] @@ -10393,7 +9889,6 @@ crbug.com/714962 virtual/spv175/compositing/gestures/gesture-tapHighlight-2-overflow-div.html [ Crash ] crbug.com/591099 virtual/spv175/compositing/gestures/gesture-tapHighlight-img-and-text-2.html [ Failure ] crbug.com/714962 virtual/spv175/compositing/gestures/gesture-tapHighlight-img-and-text.html [ Failure ] -crbug.com/591099 virtual/spv175/compositing/gestures/gesture-tapHighlight-img-transformed.html [ Failure Pass ] crbug.com/714962 virtual/spv175/compositing/gestures/gesture-tapHighlight-img.html [ Failure ] crbug.com/714962 virtual/spv175/compositing/gestures/gesture-tapHighlight-invisible-inline-squashing.html [ Crash ] crbug.com/714962 virtual/spv175/compositing/gestures/gesture-tapHighlight-invisible-inline.html [ Crash ] @@ -10513,7 +10008,6 @@ crbug.com/591099 virtual/spv175/compositing/overflow/clip-parent-reset.html [ Failure ] crbug.com/591099 virtual/spv175/compositing/overflow/clipping-ancestor-with-accelerated-scrolling-ancestor.html [ Failure ] crbug.com/591099 virtual/spv175/compositing/overflow/composited-layer-under-border-radius-under-composited-layer.html [ Failure ] -crbug.com/591099 virtual/spv175/compositing/overflow/composited-nested-sticky-left.html [ Failure Pass ] crbug.com/591099 virtual/spv175/compositing/overflow/composited-scrolling-paint-phases.html [ Failure ] crbug.com/591099 virtual/spv175/compositing/overflow/content-gains-scrollbars.html [ Failure ] crbug.com/591099 virtual/spv175/compositing/overflow/content-loses-scrollbars.html [ Failure ] @@ -10550,6 +10044,7 @@ crbug.com/591099 virtual/spv175/compositing/overflow/scaled-mask.html [ Failure ] crbug.com/591099 virtual/spv175/compositing/overflow/scaled-overflow.html [ Failure ] crbug.com/591099 virtual/spv175/compositing/overflow/scroll-ancestor-update.html [ Failure ] +crbug.com/591099 virtual/spv175/compositing/overflow/scroll-neg-z-index-and-composited-child.html [ Failure ] crbug.com/591099 virtual/spv175/compositing/overflow/scroll-parent-absolute-with-backdrop-filter.html [ Failure ] crbug.com/591099 virtual/spv175/compositing/overflow/scroll-parent-absolute.html [ Failure ] crbug.com/591099 virtual/spv175/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor.html [ Failure ] @@ -10611,9 +10106,9 @@ crbug.com/591099 virtual/spv175/compositing/rtl/rtl-iframe-fixed-overflow.html [ Failure ] crbug.com/591099 virtual/spv175/compositing/rtl/rtl-iframe-fixed.html [ Failure ] crbug.com/591099 virtual/spv175/compositing/rtl/rtl-iframe-relative.html [ Failure ] +crbug.com/591099 virtual/spv175/compositing/rtl/rtl-overflow-invalidation.html [ Failure ] crbug.com/591099 virtual/spv175/compositing/rtl/rtl-overflow-scrolling.html [ Failure ] crbug.com/591099 virtual/spv175/compositing/rtl/rtl-relative.html [ Failure ] -crbug.com/591099 virtual/spv175/compositing/scrollbars/nested-overlay-scrollbars.html [ Crash ] crbug.com/591099 virtual/spv175/compositing/self-painting-layers.html [ Failure ] crbug.com/591099 virtual/spv175/compositing/shadows/shadow-drawing.html [ Failure ] crbug.com/591099 virtual/spv175/compositing/sibling-positioning.html [ Failure ] @@ -10650,7 +10145,7 @@ crbug.com/714962 virtual/spv175/compositing/squashing/squash-with-ancestor-reflection.html [ Pass ] crbug.com/591099 virtual/spv175/compositing/squashing/squashed-layer-loses-graphicslayer.html [ Failure ] crbug.com/591099 virtual/spv175/compositing/squashing/squashed-repaints.html [ Failure ] -crbug.com/591099 virtual/spv175/compositing/squashing/squashing-does-not-stop-transform-propagation.html [ Crash ] +crbug.com/591099 virtual/spv175/compositing/squashing/squashing-does-not-stop-transform-propagation.html [ Crash Pass ] crbug.com/591099 virtual/spv175/compositing/squashing/squashing-inside-perspective.html [ Failure ] crbug.com/591099 virtual/spv175/compositing/squashing/squashing-print.html [ Failure ] crbug.com/591099 virtual/spv175/compositing/squashing/squashing-sparsity-heuristic.html [ Failure ] @@ -10671,7 +10166,7 @@ crbug.com/591099 virtual/spv175/compositing/webgl/webgl-nonpremultiplied-blend.html [ Failure ] crbug.com/591099 virtual/spv175/compositing/webgl/webgl-reflection.html [ Failure ] crbug.com/591099 virtual/spv175/compositing/will-change/composited-layers.html [ Failure ] -crbug.com/591099 virtual/spv175/compositing/will-change/will-change-preserve-backface-visibility.html [ Crash ] +crbug.com/591099 virtual/spv175/compositing/will-change/will-change-preserve-backface-visibility.html [ Crash Pass ] crbug.com/591099 virtual/spv175/compositing/z-order/collect-layers-does-not-initialize-pos-z-order-list.html [ Crash ] crbug.com/591099 virtual/spv175/compositing/z-order/negative-z-index.html [ Failure ] crbug.com/591099 virtual/spv175/paint/background/fieldset-legend-background-shadow-border-radius.html [ Failure ] @@ -10743,7 +10238,6 @@ crbug.com/591099 virtual/spv175/paint/invalidation/bugzilla-6388.html [ Failure ] crbug.com/591099 virtual/spv175/paint/invalidation/bugzilla-6473.html [ Failure ] crbug.com/591099 virtual/spv175/paint/invalidation/bugzilla-7235.html [ Crash ] -crbug.com/591099 virtual/spv175/paint/invalidation/button-inner-no-repaint.html [ Failure Pass ] crbug.com/591099 virtual/spv175/paint/invalidation/clip/caret-ancestor-clip-change.html [ Failure ] crbug.com/591099 virtual/spv175/paint/invalidation/clip/clip-unclip-and-change.html [ Failure ] crbug.com/591099 virtual/spv175/paint/invalidation/clip/clip-with-layout-delta.html [ Failure ] @@ -10795,7 +10289,7 @@ crbug.com/591099 virtual/spv175/paint/invalidation/compositing/layer-repaint.html [ Failure ] crbug.com/591099 virtual/spv175/paint/invalidation/compositing/multi-subsequence-composited.html [ Failure ] crbug.com/591099 virtual/spv175/paint/invalidation/compositing/new-stacking-context.html [ Failure ] -crbug.com/591099 virtual/spv175/paint/invalidation/compositing/newly-composited-on-scroll.html [ Crash ] +crbug.com/591099 virtual/spv175/paint/invalidation/compositing/newly-composited-on-scroll.html [ Crash Pass ] crbug.com/591099 virtual/spv175/paint/invalidation/compositing/opacity-between-absolute.html [ Failure ] crbug.com/591099 virtual/spv175/paint/invalidation/compositing/opacity-between-absolute2.html [ Failure ] crbug.com/591099 virtual/spv175/paint/invalidation/compositing/overflow-into-content.html [ Failure ] @@ -10872,14 +10366,12 @@ crbug.com/591099 virtual/spv175/paint/invalidation/filters/filter-repaint-on-accelerated-layer.html [ Failure ] crbug.com/714962 virtual/spv175/paint/invalidation/first-line-inline-child.html [ Failure ] crbug.com/591099 virtual/spv175/paint/invalidation/flexbox/align-content-change-keeping-geometry.html [ Failure ] -crbug.com/591099 virtual/spv175/paint/invalidation/flexbox/align-content-change-no-flex.html [ Failure Pass ] crbug.com/591099 virtual/spv175/paint/invalidation/flexbox/align-content-change.html [ Failure ] crbug.com/591099 virtual/spv175/paint/invalidation/flexbox/align-content-distribution-change-grid.html [ Failure ] crbug.com/591099 virtual/spv175/paint/invalidation/flexbox/align-items-change.html [ Failure ] crbug.com/591099 virtual/spv175/paint/invalidation/flexbox/align-self-change-grid.html [ Failure ] crbug.com/591099 virtual/spv175/paint/invalidation/flexbox/align-self-change-keeping-geometry-grid.html [ Failure ] crbug.com/591099 virtual/spv175/paint/invalidation/flexbox/align-self-change-keeping-geometry.html [ Failure ] -crbug.com/591099 virtual/spv175/paint/invalidation/flexbox/align-self-change-no-flex.html [ Failure Pass ] crbug.com/591099 virtual/spv175/paint/invalidation/flexbox/align-self-change.html [ Failure ] crbug.com/591099 virtual/spv175/paint/invalidation/flexbox/justify-content-change.html [ Failure ] crbug.com/591099 virtual/spv175/paint/invalidation/flexbox/justify-content-distribution-change-grid.html [ Failure ] @@ -11084,7 +10576,6 @@ crbug.com/591099 virtual/spv175/paint/invalidation/reflection/scroll-absolute-layer-with-reflection.html [ Failure ] crbug.com/591099 virtual/spv175/paint/invalidation/reflection/scroll-fixed-layer-with-reflection.html [ Failure ] crbug.com/591099 virtual/spv175/paint/invalidation/reflection/scroll-fixed-reflected-layer.html [ Failure ] -crbug.com/591099 virtual/spv175/paint/invalidation/remove-anonymous-block-crash.html [ Crash Pass ] crbug.com/591099 virtual/spv175/paint/invalidation/remove-block-after-layout.html [ Failure ] crbug.com/591099 virtual/spv175/paint/invalidation/remove-inline-after-layout.html [ Failure ] crbug.com/591099 virtual/spv175/paint/invalidation/remove-inline-layer-after-layout.html [ Failure ] @@ -11189,7 +10680,6 @@ crbug.com/714962 virtual/spv175/paint/invalidation/svg/hit-test-with-br.xhtml [ Failure ] crbug.com/591099 virtual/spv175/paint/invalidation/svg/nested-embedded-svg-size-changes-no-layout-triggers-1.html [ Failure ] crbug.com/591099 virtual/spv175/paint/invalidation/svg/nested-embedded-svg-size-changes-no-layout-triggers-2.html [ Failure ] -crbug.com/591099 virtual/spv175/paint/invalidation/svg/nested-embedded-svg-size-changes.html [ Failure Pass ] crbug.com/591099 virtual/spv175/paint/invalidation/svg/object-sizing-no-width-height-change-content-box-size.xhtml [ Failure ] crbug.com/591099 virtual/spv175/paint/invalidation/svg/overflow-repaint.html [ Failure ] crbug.com/591099 virtual/spv175/paint/invalidation/svg/relative-sized-content-with-resources.xhtml [ Failure ] @@ -11315,7 +10805,7 @@ crbug.com/591099 virtual/spv175/paint/invalidation/window-resize/window-resize-percent-width-height.html [ Failure ] crbug.com/591099 virtual/spv175/paint/invalidation/window-resize/window-resize-positioned-bottom.html [ Failure ] crbug.com/591099 virtual/spv175/paint/invalidation/window-resize/window-resize-positioned-percent-top.html [ Failure ] -crbug.com/591099 virtual/spv175/paint/invalidation/window-resize/window-resize-vertical-writing-mode.html [ Failure ] +crbug.com/591099 virtual/spv175/paint/invalidation/window-resize/window-resize-vertical-writing-mode.html [ Crash Failure ] crbug.com/591099 virtual/spv175/paint/invalidation/window-resize/window-resize-viewport-percent.html [ Failure ] crbug.com/591099 virtual/spv175/paint/markers/active-suggestion-marker-basic.html [ Failure ] crbug.com/591099 virtual/spv175/paint/markers/active-suggestion-marker-split.html [ Failure ]
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-features=NetworkService b/third_party/WebKit/LayoutTests/FlagExpectations/enable-features=NetworkService index d5f1363..783e3899 100644 --- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-features=NetworkService +++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-features=NetworkService
@@ -81,7 +81,6 @@ Bug(none) http/tests/cookies/same-site/popup-cross-site-post.html [ Failure ] Bug(none) http/tests/cookies/same-site/popup-cross-site.html [ Failure ] Bug(none) http/tests/devtools/sources/compile-javascript.js [ Failure Timeout ] -Bug(none) http/tests/devtools/sources/debugger-ui/source-frame-count.js [ Failure ] Bug(none) http/tests/encoding/meta-switch-mid-parse-with-title.html [ Timeout ] Bug(none) http/tests/encoding/meta-switch-mid-parse.html [ Timeout ] crbug.com/778542 http/tests/devtools/tracing/timeline-js/timeline-script-id.js [ Failure ] @@ -232,46 +231,46 @@ crbug.com/777879 external/wpt/FileAPI/file/send-file-form.html [ Crash ] # NetworkService: ServiceWorker URLLoader are destroyed before the end of a navigation. -# See https://crbug.com/790933 -Bug(790933) external/wpt/fetch/api/abort/serviceworker-intercepted.https.html [ Pass Timeout ] -Bug(790933) external/wpt/service-workers/service-worker/claim-affect-other-registration.https.html [ Pass Timeout ] -Bug(790933) external/wpt/service-workers/service-worker/client-navigate.https.html [ Pass Failure Crash Timeout ] -Bug(790933) external/wpt/service-workers/service-worker/fetch-canvas-tainting-cache.https.html [ Pass Timeout ] -Bug(790933) external/wpt/service-workers/service-worker/fetch-canvas-tainting.https.html [ Pass Timeout ] -Bug(790933) external/wpt/service-workers/service-worker/fetch-cors-exposed-header-names.https.html [ Pass Timeout ] -Bug(790933) external/wpt/service-workers/service-worker/fetch-cors-xhr.https.html [ Pass Timeout ] -Bug(790933) external/wpt/service-workers/service-worker/fetch-csp.https.html [ Pass Timeout ] -Bug(790933) external/wpt/service-workers/service-worker/fetch-event-redirect.https.html [ Pass Crash Timeout ] -Bug(790933) external/wpt/service-workers/service-worker/fetch-event.https.html [ Pass Failure Crash Timeout ] -Bug(790933) external/wpt/service-workers/service-worker/fetch-frame-resource.https.html [ Pass Failure Timeout ] -Bug(790933) external/wpt/service-workers/service-worker/fetch-header-visibility.https.html [ Pass Failure Crash Timeout ] -Bug(790933) external/wpt/service-workers/service-worker/fetch-mixed-content-to-inscope.https.html [ Pass Timeout ] -Bug(790933) external/wpt/service-workers/service-worker/fetch-mixed-content-to-outscope.https.html [ Pass Timeout ] -Bug(790933) external/wpt/service-workers/service-worker/fetch-request-css-cross-origin-mime-check.https.html [ Pass Timeout ] -Bug(790933) external/wpt/service-workers/service-worker/fetch-request-no-freshness-headers.https.html [ Pass Timeout ] -Bug(790933) external/wpt/service-workers/service-worker/fetch-request-redirect.https.html [ Pass Timeout ] -Bug(790933) external/wpt/service-workers/service-worker/fetch-response-taint.https.html [ Pass Timeout ] -Bug(790933) external/wpt/service-workers/service-worker/getregistrations.https.html [ Pass Failure Timeout ] -Bug(790933) external/wpt/service-workers/service-worker/navigation-preload/chunked-encoding.https.html [ Pass Timeout ] -Bug(790933) external/wpt/service-workers/service-worker/navigation-preload/redirect.https.html [ Pass Timeout ] -Bug(790933) external/wpt/service-workers/service-worker/navigation-preload/request-headers.https.html [ Pass Timeout ] -Bug(790933) external/wpt/service-workers/service-worker/navigation-redirect-body.https.html [ Pass Timeout ] -Bug(790933) external/wpt/service-workers/service-worker/referer.https.html [ Pass Timeout ] -Bug(790933) external/wpt/service-workers/service-worker/referrer-policy-header.https.html [ Pass Timeout ] -Bug(790933) external/wpt/service-workers/service-worker/sandboxed-iframe-fetch-event.https.html [ Pass Timeout ] -Bug(790933) http/tests/devtools/service-workers/service-workers-navigation-preload.js [ Pass Timeout ] -Bug(790933) http/tests/fetch/referrer/origin-when-cross-origin-serviceworker-from-document.html [ Pass Timeout Crash ] -Bug(790933) http/tests/fetch/referrer/serviceworker-from-origin-only-document.html [ Pass Timeout ] -Bug(790933) http/tests/local/serviceworker/fetch-request-body-file.html [ Pass Crash Failure Timeout ] -Bug(790933) http/tests/serviceworker/chromium.fetch-canvas-tainting.html [ Pass Timeout ] -Bug(790933) http/tests/serviceworker/chromium.fetch-cors-xhr.html [ Pass Timeout ] -Bug(790933) http/tests/serviceworker/chromium.fetch-csp.html [ Pass Timeout ] -Bug(790933) http/tests/serviceworker/chromium.redirected-response.html [ Pass Timeout ] -Bug(790933) http/tests/serviceworker/chromium.respond-to-same-origin-request-with-cross-origin-response.html [ Pass Timeout ] -Bug(790933) http/tests/serviceworker/chromium.respond-to-same-origin-request-with-redirected-cross-origin-response.html [ Pass Timeout ] -Bug(790933) http/tests/serviceworker/chromium/css-import-crash.html [ Pass Timeout ] -Bug(790933) http/tests/serviceworker/chromium/fetch-request-with-gc.html [ Pass Timeout ] -Bug(790933) http/tests/serviceworker/chromium/fetch-script-onerror.html [ Pass Timeout ] -Bug(790933) http/tests/serviceworker/chromium/stop-worker-during-respond-with.html [ Pass Failure Timeout ] -Bug(790933) http/tests/serviceworker/navigation-preload/chromium/navigation-preload-gc-before-response.html [ Pass Timeout ] -Bug(790933) http/tests/serviceworker/navigation-preload/chromium/use-counter.html [ Pass Timeout ] +crbug.com/790933 external/wpt/fetch/api/abort/serviceworker-intercepted.https.html [ Pass Timeout ] +crbug.com/790933 external/wpt/service-workers/service-worker/claim-affect-other-registration.https.html [ Pass Timeout ] +crbug.com/790933 external/wpt/service-workers/service-worker/client-navigate.https.html [ Pass Failure Crash Timeout ] +crbug.com/790933 external/wpt/service-workers/service-worker/fetch-canvas-tainting-cache.https.html [ Pass Timeout ] +crbug.com/790933 external/wpt/service-workers/service-worker/fetch-canvas-tainting.https.html [ Pass Timeout ] +crbug.com/790933 external/wpt/service-workers/service-worker/fetch-cors-exposed-header-names.https.html [ Pass Timeout ] +crbug.com/790933 external/wpt/service-workers/service-worker/fetch-cors-xhr.https.html [ Pass Timeout ] +crbug.com/790933 external/wpt/service-workers/service-worker/fetch-csp.https.html [ Pass Timeout ] +crbug.com/790933 external/wpt/service-workers/service-worker/fetch-event-redirect.https.html [ Pass Crash Timeout ] +crbug.com/790933 external/wpt/service-workers/service-worker/fetch-event.https.html [ Pass Failure Crash Timeout ] +crbug.com/790933 external/wpt/service-workers/service-worker/fetch-frame-resource.https.html [ Pass Failure Timeout ] +crbug.com/790933 external/wpt/service-workers/service-worker/fetch-header-visibility.https.html [ Pass Failure Crash Timeout ] +crbug.com/790933 external/wpt/service-workers/service-worker/fetch-mixed-content-to-inscope.https.html [ Pass Timeout ] +crbug.com/790933 external/wpt/service-workers/service-worker/fetch-mixed-content-to-outscope.https.html [ Pass Timeout ] +crbug.com/790933 external/wpt/service-workers/service-worker/fetch-request-css-cross-origin-mime-check.https.html [ Pass Timeout ] +crbug.com/790933 external/wpt/service-workers/service-worker/fetch-request-no-freshness-headers.https.html [ Pass Timeout ] +crbug.com/790933 external/wpt/service-workers/service-worker/fetch-request-redirect.https.html [ Pass Timeout ] +crbug.com/790933 external/wpt/service-workers/service-worker/fetch-response-taint.https.html [ Pass Timeout ] +crbug.com/790933 external/wpt/service-workers/service-worker/getregistrations.https.html [ Pass Failure Timeout ] +crbug.com/790933 external/wpt/service-workers/service-worker/navigation-preload/chunked-encoding.https.html [ Pass Timeout ] +crbug.com/790933 external/wpt/service-workers/service-worker/navigation-preload/redirect.https.html [ Pass Timeout ] +crbug.com/790933 external/wpt/service-workers/service-worker/navigation-preload/request-headers.https.html [ Pass Timeout ] +crbug.com/790933 external/wpt/service-workers/service-worker/navigation-redirect.https.html [ Pass Timeout ] +crbug.com/790933 external/wpt/service-workers/service-worker/navigation-redirect-body.https.html [ Pass Timeout ] +crbug.com/790933 external/wpt/service-workers/service-worker/referer.https.html [ Pass Timeout ] +crbug.com/790933 external/wpt/service-workers/service-worker/referrer-policy-header.https.html [ Pass Timeout ] +crbug.com/790933 external/wpt/service-workers/service-worker/sandboxed-iframe-fetch-event.https.html [ Pass Timeout ] +crbug.com/790933 http/tests/devtools/service-workers/service-workers-navigation-preload.js [ Pass Timeout ] +crbug.com/790933 http/tests/fetch/referrer/origin-when-cross-origin-serviceworker-from-document.html [ Pass Timeout Crash ] +crbug.com/790933 http/tests/fetch/referrer/serviceworker-from-origin-only-document.html [ Pass Timeout ] +crbug.com/790933 http/tests/local/serviceworker/fetch-request-body-file.html [ Pass Crash Failure Timeout ] +crbug.com/790933 http/tests/serviceworker/chromium.fetch-canvas-tainting.html [ Pass Timeout ] +crbug.com/790933 http/tests/serviceworker/chromium.fetch-cors-xhr.html [ Pass Timeout ] +crbug.com/790933 http/tests/serviceworker/chromium.fetch-csp.html [ Pass Timeout ] +crbug.com/790933 http/tests/serviceworker/chromium.redirected-response.html [ Pass Timeout ] +crbug.com/790933 http/tests/serviceworker/chromium.respond-to-same-origin-request-with-cross-origin-response.html [ Pass Timeout ] +crbug.com/790933 http/tests/serviceworker/chromium.respond-to-same-origin-request-with-redirected-cross-origin-response.html [ Pass Timeout ] +crbug.com/790933 http/tests/serviceworker/chromium/css-import-crash.html [ Pass Timeout ] +crbug.com/790933 http/tests/serviceworker/chromium/fetch-request-with-gc.html [ Pass Timeout ] +crbug.com/790933 http/tests/serviceworker/chromium/fetch-script-onerror.html [ Pass Timeout ] +crbug.com/790933 http/tests/serviceworker/chromium/stop-worker-during-respond-with.html [ Pass Failure Timeout ] +crbug.com/790933 http/tests/serviceworker/navigation-preload/chromium/navigation-preload-gc-before-response.html [ Pass Timeout ] +crbug.com/790933 http/tests/serviceworker/navigation-preload/chromium/use-counter.html [ Pass Timeout ]
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index f2bf4e7..1c0493c8 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -334,6 +334,9 @@ crbug.com/711807 external/wpt/css/CSS2/normal-flow/replaced-intrinsic-002.xht [ Skip ] crbug.com/711807 external/wpt/css/CSS2/normal-flow/width-inherit-001.xht [ Skip ] +#### external/wpt/css/css-position +crbug.com/752022 external/wpt/css/css-position/position-sticky-offset-overflow.html [ Failure ] + #### crbug.com/783229 overflow crbug.com/724697 overflow/overflow-basic-002.html [ Failure ] crbug.com/724701 overflow/overflow-basic-004.html [ Failure ] @@ -739,9 +742,6 @@ crbug.com/788610 virtual/incremental-shadow-dom/fast/dom/shadow/shadow-contents-event.html [ Failure Crash ] crbug.com/788610 virtual/incremental-shadow-dom/fast/dom/shadow/shadow-contents-select.html [ Failure Crash ] crbug.com/788610 virtual/incremental-shadow-dom/fast/dom/shadow/shadow-dom-event-dispatching-details-summary.html [ Failure Crash ] -crbug.com/788635 virtual/incremental-shadow-dom/fast/dom/shadow/shadowdom-for-textarea-only-shadow.html [ Failure Crash ] -crbug.com/788635 virtual/incremental-shadow-dom/fast/dom/shadow/shadowdom-for-textarea-with-attribute.html [ Failure Crash ] -crbug.com/788635 virtual/incremental-shadow-dom/fast/dom/shadow/shadowdom-for-textarea-with-style.html [ Failure Crash ] crbug.com/788635 virtual/incremental-shadow-dom/fast/dom/shadow/tree-scope-crash.html [ Failure Crash ] crbug.com/788610 virtual/incremental-shadow-dom/fast/dom/shadow/user-modify-in-datalist-crash.html [ Failure Crash ] crbug.com/776656 virtual/incremental-shadow-dom/fast/dom/shadow/user-modify-inheritance.html [ Failure ] @@ -805,14 +805,6 @@ # Run these tests with under virtual/scalefactor... only. crbug.com/567837 fast/hidpi/static [ Skip ] -# This test fails under the feature "Stop creating layout objects for elements -# inside display: none iframes" [crbug.com/650433]. The root cause is a -# long-standing fullscreen bug. No one is going to fix the issue in the near -# future, as foolip@ is in the process of performing a significant fullscreen -# refactor. See [crbug.com/676432] for a minimized repro. -crbug.com/676432 fullscreen/full-screen-iframe-zIndex.html [ Skip ] -crbug.com/676432 virtual/android/fullscreen/full-screen-iframe-zIndex.html [ Skip ] - crbug.com/538697 [ Win ] virtual/threaded/printing/webgl-oversized-printing.html [ Failure Crash ] crbug.com/538697 [ Win ] printing/webgl-oversized-printing.html [ Failure Crash ] @@ -1062,7 +1054,7 @@ crbug.com/498539 virtual/threaded/http/tests/devtools/tracing/timeline-misc/timeline-bound-function.js [ Pass Failure ] crbug.com/498539 [ Mac ] http/tests/devtools/sources/debugger/live-edit-no-reveal.js [ Crash Pass Timeout Failure ] -crbug.com/498539 crbug.com/794869 [ Win7 ] http/tests/devtools/elements/styles-4/styles-update-from-js.js [ Crash Pass Failure ] +crbug.com/498539 crbug.com/794869 [ Win7 Mac ] http/tests/devtools/elements/styles-4/styles-update-from-js.js [ Crash Pass Failure ] crbug.com/487281 [ Mac ] fast/forms/select/menulist-narrow-width.html [ Failure ] @@ -1128,8 +1120,6 @@ crbug.com/552494 virtual/prefer_compositing_to_lcd_text/scrollbars/overflow-scrollbar-combinations.html [ Pass Failure ] crbug.com/552494 virtual/rootlayerscrolls/scrollbars/overflow-scrollbar-combinations.html [ Pass Failure ] -crbug.com/659456 http/tests/devtools/persistence/automapping-sourcemap.js [ Pass Failure ] - crbug.com/652964 [ Linux Win ] fast/text/hyphens/hyphen-min-preferred-width-mock.html [ Skip ] crbug.com/652964 [ Linux Win ] fast/text/hyphens/hyphens-align.html [ Skip ] crbug.com/652964 [ Linux Win ] fast/text/hyphens/hyphens-auto.html [ Skip ] @@ -1503,7 +1493,7 @@ crbug.com/665577 [ Linux Win ] virtual/threaded/fast/scroll-behavior/smooth-scroll/mousewheel-scroll-interrupted.html [ Pass Failure ] crbug.com/665577 [ Linux Win ] virtual/threaded/fast/scroll-behavior/smooth-scroll/track-scroll.html [ Pass Failure ] -crbug.com/599670 [ Win Linux ] http/tests/devtools/resource-parameters-ipv6.js [ Timeout Failure Pass ] +crbug.com/599670 [ Win ] http/tests/devtools/resource-parameters-ipv6.js [ Timeout Pass ] crbug.com/472330 fast/borders/border-image-outset-split-inline-vertical-lr.html [ Failure ] crbug.com/472330 fast/writing-mode/box-shadow-vertical-lr.html [ Failure ] crbug.com/472330 fast/writing-mode/box-shadow-vertical-rl.html [ Failure ] @@ -1830,7 +1820,6 @@ crbug.com/605059 [ Retina ] fast/text/international/rtl-negative-letter-spacing.html [ Failure ] -crbug.com/610464 [ Linux Win7 Debug ] http/tests/devtools/components/throttler.js [ Failure Pass ] crbug.com/654477 [ Win ] compositing/video/video-controls-layer-creation.html [ Pass Failure ] crbug.com/654477 fast/hidpi/video-controls-in-hidpi.html [ Failure ] crbug.com/654477 fast/layers/video-layer.html [ Failure ] @@ -1871,7 +1860,6 @@ crbug.com/399507 virtual/threaded/http/tests/devtools/tracing/timeline-paint/layer-tree.js [ Skip ] crbug.com/636424 [ Win7 Debug ] editing/selection/modify_move/move-by-word-visually-crash-test-5.html [ Pass Timeout ] -crbug.com/638618 http/tests/devtools/editor/text-editor-search-switch-editor.js [ Skip ] # These tests have test harness errors and PASS lines that have a # non-deterministic order. @@ -2005,6 +1993,10 @@ crbug.com/751952 virtual/origin-trials-runtimeflags-disabled/http/tests/origin_trials/webexposed/budget-api-origin-trial-interfaces.html [ Pass Failure ] # ====== New tests from wpt-importer added here ====== +crbug.com/626703 [ Android Win7 ] external/wpt/longtask-timing/longtask-in-sibling-iframe.html [ Timeout ] +crbug.com/626703 [ Linux Win ] external/wpt/css/css-color/t425-hsla-onscreen-b.xht [ Failure ] +crbug.com/626703 external/wpt/css/css-color/t32-opacity-offscreen-b.xht [ Failure ] +crbug.com/626703 external/wpt/css/css-color/t32-opacity-offscreen-with-alpha-c.xht [ Failure ] crbug.com/626703 external/wpt/css/css-color/hsla-004.html [ Failure ] crbug.com/626703 external/wpt/css/css-color/hsla-006.html [ Failure ] crbug.com/626703 external/wpt/css/css-color/hsla-001.html [ Failure ] @@ -2586,7 +2578,6 @@ crbug.com/701047 [ Mac10.12 ] editing/style/block-style-003.html [ Failure ] crbug.com/701047 [ Mac10.12 ] editing/style/block-styles-007.html [ Failure ] -crbug.com/660295 http/tests/devtools/elements/elements-panel-restore-selection-when-node-comes-later.js [ Pass Failure ] crbug.com/735245 http/tests/devtools/application-panel/storage-view-reports-quota.js [ Pass Timeout Failure ] # [css-grid] @@ -2745,6 +2736,7 @@ crbug.com/688670 media/track/track-cue-rendering-after-controls-removed.html [ Pass Failure ] crbug.com/664858 virtual/threaded/fast/scroll-behavior/overflow-scroll-animates.html [ Skip ] +crbug.com/664858 virtual/threaded/fast/scroll-behavior/smooth-scroll/horizontal-smooth-scroll-in-rtl.html [ Skip ] crbug.com/664858 virtual/threaded/fast/scroll-behavior/smooth-scroll/main-thread-scrolling-reason-added.html [ Skip ] crbug.com/664858 virtual/threaded/fast/scroll-behavior/smooth-scroll/ongoing-smooth-scroll-anchors.html [ Skip ] crbug.com/664858 virtual/threaded/fast/scroll-behavior/smooth-scroll/ongoing-smooth-scroll-vertical-rl-anchors.html [ Skip ] @@ -2985,7 +2977,6 @@ # Sheriff failures 2017-03-10 crbug.com/741210 [ Mac ] inspector-protocol/emulation/device-emulation-restore.js [ Failure ] -crbug.com/700374 [ Win ] http/tests/devtools/workers-on-navigation.js [ Failure Pass ] # Sheriff failures 2017-03-21 crbug.com/703518 http/tests/devtools/tracing/worker-js-frames.js [ Failure Pass ] @@ -3174,7 +3165,6 @@ # For Skia roll crbug.com/630695 fast/css/transformed-mask.html [ NeedsManualRebaseline ] -crbug.com/v8/4958 http/tests/devtools/persistence/automapping-sourcemap-nameclash.js [ NeedsManualRebaseline ] crbug.com/v8/4958 inspector-protocol/debugger/domdebugger-getEventListeners.js [ NeedsManualRebaseline ] crbug.com/v8/4958 http/tests/devtools/console/console-eval-scoped.js [ NeedsManualRebaseline ] crbug.com/v8/4958 http/tests/devtools/console/console-functions.js [ NeedsManualRebaseline ] @@ -3506,8 +3496,6 @@ crbug.com/762399 [ Android ] http/tests/cache/zero-length-xhr.html [ Pass Crash ] # Sheriff failures 2017-09-08 -crbug.com/763208 http/tests/devtools/sources/debugger-ui/source-frame-count.js [ Pass Failure ] - crbug.com/763667 external/wpt/upgrade-insecure-requests/iframe-redirect-upgrade.https.html [ Timeout ] # Sheriff failures 2017-09-11 @@ -3699,3 +3687,6 @@ crbug.com/779087 external/wpt/feature-policy/autoplay-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html [ Skip ] crbug.com/779087 external/wpt/feature-policy/autoplay-default-feature-policy.https.sub.html [ Skip ] crbug.com/779087 external/wpt/feature-policy/autoplay-disabled-by-feature-policy.https.sub.html [ Skip ] + +# Sheriff failures 2017-12-15 +crbug.com/795250 [ Win7 ] virtual/scroll_customization/fast/events/touch/gesture/gesture-tap-hover-state-iframe.html [ Pass Failure ]
diff --git a/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json b/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json index d431e090..93120802 100644 --- a/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json +++ b/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json
@@ -31601,6 +31601,30 @@ {} ] ], + "css/css-color/hex-003.html": [ + [ + "/css/css-color/hex-003.html", + [ + [ + "/css/css-color/hex-003-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-color/hex-004.html": [ + [ + "/css/css-color/hex-004.html", + [ + [ + "/css/css-color/hex-003-ref.html", + "==" + ] + ], + {} + ] + ], "css/css-color/hsl-001.html": [ [ "/css/css-color/hsl-001.html", @@ -32189,6 +32213,66 @@ {} ] ], + "css/css-color/t32-opacity-basic-0.0-a.xht": [ + [ + "/css/css-color/t32-opacity-basic-0.0-a.xht", + [ + [ + "/css/css-color/t32-opacity-basic-0.0-a-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-color/t32-opacity-basic-1.0-a.xht": [ + [ + "/css/css-color/t32-opacity-basic-1.0-a.xht", + [ + [ + "/css/css-color/t32-opacity-basic-1.0-a-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-color/t32-opacity-clamping-0.0-b.xht": [ + [ + "/css/css-color/t32-opacity-clamping-0.0-b.xht", + [ + [ + "/css/css-color/t32-opacity-basic-0.0-a-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-color/t32-opacity-clamping-1.0-b.xht": [ + [ + "/css/css-color/t32-opacity-clamping-1.0-b.xht", + [ + [ + "/css/css-color/t32-opacity-clamping-1.0-b-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-color/t32-opacity-offscreen-b.xht": [ + [ + "/css/css-color/t32-opacity-offscreen-b.xht", + [ + [ + "/css/css-color/t32-opacity-offscreen-b-ref.html", + "==" + ] + ], + {} + ] + ], "css/css-color/t32-opacity-offscreen-multiple-boxes-1-c.xht": [ [ "/css/css-color/t32-opacity-offscreen-multiple-boxes-1-c.xht", @@ -32213,6 +32297,42 @@ {} ] ], + "css/css-color/t32-opacity-offscreen-with-alpha-c.xht": [ + [ + "/css/css-color/t32-opacity-offscreen-with-alpha-c.xht", + [ + [ + "/css/css-color/t32-opacity-offscreen-with-alpha-c-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-color/t41-html4-keywords-a.xht": [ + [ + "/css/css-color/t41-html4-keywords-a.xht", + [ + [ + "/css/css-color/t41-html4-keywords-a-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-color/t421-rgb-clip-outside-gamut-b.xht": [ + [ + "/css/css-color/t421-rgb-clip-outside-gamut-b.xht", + [ + [ + "/css/css-color/t421-rgb-clip-outside-gamut-b-ref.html", + "==" + ] + ], + {} + ] + ], "css/css-color/t421-rgb-func-int-a.xht": [ [ "/css/css-color/t421-rgb-func-int-a.xht", @@ -32297,6 +32417,30 @@ {} ] ], + "css/css-color/t421-rgb-values-meaning-b.xht": [ + [ + "/css/css-color/t421-rgb-values-meaning-b.xht", + [ + [ + "/css/css-color/t421-rgb-values-meaning-b-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-color/t422-rgba-a0.0-a.xht": [ + [ + "/css/css-color/t422-rgba-a0.0-a.xht", + [ + [ + "/css/css-color/t32-opacity-basic-0.0-a-ref.html", + "==" + ] + ], + {} + ] + ], "css/css-color/t422-rgba-a1.0-a.xht": [ [ "/css/css-color/t422-rgba-a1.0-a.xht", @@ -32417,6 +32561,18 @@ {} ] ], + "css/css-color/t422-rgba-values-meaning-b.xht": [ + [ + "/css/css-color/t422-rgba-values-meaning-b.xht", + [ + [ + "/css/css-color/t422-rgba-values-meaning-b-ref.html", + "==" + ] + ], + {} + ] + ], "css/css-color/t423-transparent-1-a.xht": [ [ "/css/css-color/t423-transparent-1-a.xht", @@ -32465,6 +32621,18 @@ {} ] ], + "css/css-color/t424-hsl-h-rotating-b.xht": [ + [ + "/css/css-color/t424-hsl-h-rotating-b.xht", + [ + [ + "/css/css-color/t424-hsl-h-rotating-b-ref.html", + "==" + ] + ], + {} + ] + ], "css/css-color/t424-hsl-parsing-f.xht": [ [ "/css/css-color/t424-hsl-parsing-f.xht", @@ -32669,6 +32837,30 @@ {} ] ], + "css/css-color/t425-hsla-h-rotating-b.xht": [ + [ + "/css/css-color/t425-hsla-h-rotating-b.xht", + [ + [ + "/css/css-color/t425-hsla-h-rotating-b-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-color/t425-hsla-onscreen-b.xht": [ + [ + "/css/css-color/t425-hsla-onscreen-b.xht", + [ + [ + "/css/css-color/t422-rgba-onscreen-b-ref.html", + "==" + ] + ], + {} + ] + ], "css/css-color/t425-hsla-onscreen-multiple-boxes-c.xht": [ [ "/css/css-color/t425-hsla-onscreen-multiple-boxes-c.xht", @@ -32705,6 +32897,18 @@ {} ] ], + "css/css-color/t43-svg-keywords-a.xht": [ + [ + "/css/css-color/t43-svg-keywords-a.xht", + [ + [ + "/css/css-color/t43-svg-keywords-a-ref.html", + "==" + ] + ], + {} + ] + ], "css/css-color/t44-currentcolor-background-b.xht": [ [ "/css/css-color/t44-currentcolor-background-b.xht", @@ -33845,6 +34049,18 @@ {} ] ], + "css/css-display/display-contents-unusual-html-elements-none.html": [ + [ + "/css/css-display/display-contents-unusual-html-elements-none.html", + [ + [ + "/css/css-display/display-contents-pass-ref.html", + "==" + ] + ], + {} + ] + ], "css/css-display/display-flow-root-001.html": [ [ "/css/css-display/display-flow-root-001.html", @@ -38297,6 +38513,62 @@ {} ] ], + "css/css-fonts/font-default-01.html": [ + [ + "/css/css-fonts/font-default-01.html", + [ + [ + "/css/css-fonts/font-default-01-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-fonts/font-default-02.html": [ + [ + "/css/css-fonts/font-default-02.html", + [ + [ + "/css/css-fonts/font-default-02-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-fonts/font-default-03.html": [ + [ + "/css/css-fonts/font-default-03.html", + [ + [ + "/css/css-fonts/font-default-03-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-fonts/font-default-04.html": [ + [ + "/css/css-fonts/font-default-04.html", + [ + [ + "/css/css-fonts/font-default-04-a-ref.html", + "==" + ], + [ + "/css/css-fonts/font-default-04-b-ref.html", + "==" + ], + [ + "/css/css-fonts/font-default-04-c-ref.html", + "==" + ] + ], + {} + ] + ], "css/css-fonts/font-display/font-display.html": [ [ "/css/css-fonts/font-display/font-display.html", @@ -99467,6 +99739,11 @@ {} ] ], + "css/css-color/hex-003-ref.html": [ + [ + {} + ] + ], "css/css-color/htaccess": [ [ {} @@ -99487,6 +99764,26 @@ {} ] ], + "css/css-color/t32-opacity-basic-0.0-a-ref.html": [ + [ + {} + ] + ], + "css/css-color/t32-opacity-basic-1.0-a-ref.html": [ + [ + {} + ] + ], + "css/css-color/t32-opacity-clamping-1.0-b-ref.html": [ + [ + {} + ] + ], + "css/css-color/t32-opacity-offscreen-b-ref.html": [ + [ + {} + ] + ], "css/css-color/t32-opacity-offscreen-multiple-boxes-1-c-ref.html": [ [ {} @@ -99497,6 +99794,31 @@ {} ] ], + "css/css-color/t32-opacity-offscreen-with-alpha-c-ref.html": [ + [ + {} + ] + ], + "css/css-color/t41-html4-keywords-a-ref.html": [ + [ + {} + ] + ], + "css/css-color/t421-rgb-clip-outside-gamut-b-ref.html": [ + [ + {} + ] + ], + "css/css-color/t421-rgb-hex3-expand-b-ref.html": [ + [ + {} + ] + ], + "css/css-color/t421-rgb-values-meaning-b-ref.html": [ + [ + {} + ] + ], "css/css-color/t422-rgba-a1.0-a-ref.html": [ [ {} @@ -99542,6 +99864,11 @@ {} ] ], + "css/css-color/t422-rgba-values-meaning-b-ref.html": [ + [ + {} + ] + ], "css/css-color/t423-transparent-2-a-ref.html": [ [ {} @@ -99557,6 +99884,11 @@ {} ] ], + "css/css-color/t424-hsl-h-rotating-b-ref.html": [ + [ + {} + ] + ], "css/css-color/t424-hsl-parsing-f-ref.html": [ [ {} @@ -99642,11 +99974,21 @@ {} ] ], + "css/css-color/t425-hsla-h-rotating-b-ref.html": [ + [ + {} + ] + ], "css/css-color/t425-hsla-values-b-ref.html": [ [ {} ] ], + "css/css-color/t43-svg-keywords-a-ref.html": [ + [ + {} + ] + ], "css/css-color/t44-currentcolor-background-b-ref.html": [ [ {} @@ -101182,6 +101524,36 @@ {} ] ], + "css/css-fonts/font-default-01-ref.html": [ + [ + {} + ] + ], + "css/css-fonts/font-default-02-ref.html": [ + [ + {} + ] + ], + "css/css-fonts/font-default-03-ref.html": [ + [ + {} + ] + ], + "css/css-fonts/font-default-04-a-ref.html": [ + [ + {} + ] + ], + "css/css-fonts/font-default-04-b-ref.html": [ + [ + {} + ] + ], + "css/css-fonts/font-default-04-c-ref.html": [ + [ + {} + ] + ], "css/css-fonts/font-display/font-display-ref.html": [ [ {} @@ -167445,6 +167817,30 @@ {} ] ], + "css/css-grid/grid-model/grid-container-ignores-first-letter-001.html": [ + [ + "/css/css-grid/grid-model/grid-container-ignores-first-letter-001.html", + {} + ] + ], + "css/css-grid/grid-model/grid-container-ignores-first-line-001.html": [ + [ + "/css/css-grid/grid-model/grid-container-ignores-first-line-001.html", + {} + ] + ], + "css/css-grid/grid-model/grid-item-accepts-first-letter-001.html": [ + [ + "/css/css-grid/grid-model/grid-item-accepts-first-letter-001.html", + {} + ] + ], + "css/css-grid/grid-model/grid-item-accepts-first-line-001.html": [ + [ + "/css/css-grid/grid-model/grid-item-accepts-first-line-001.html", + {} + ] + ], "css/css-grid/grid-model/grid-support-display-001.html": [ [ "/css/css-grid/grid-model/grid-support-display-001.html", @@ -167493,6 +167889,12 @@ {} ] ], + "css/css-position/position-sticky-offset-overflow.html": [ + [ + "/css/css-position/position-sticky-offset-overflow.html", + {} + ] + ], "css/css-position/position-sticky-offset-top-left.html": [ [ "/css/css-position/position-sticky-offset-top-left.html", @@ -223653,138 +224055,36 @@ {} ] ], - "css/css-color/hex-003.html": [ - [ - "/css/css-color/hex-003.html", - {} - ] - ], - "css/css-color/hex-004.html": [ - [ - "/css/css-color/hex-004.html", - {} - ] - ], - "css/css-color/t32-opacity-basic-0.0-a.xht": [ - [ - "/css/css-color/t32-opacity-basic-0.0-a.xht", - {} - ] - ], "css/css-color/t32-opacity-basic-0.6-a.xht": [ [ "/css/css-color/t32-opacity-basic-0.6-a.xht", {} ] ], - "css/css-color/t32-opacity-basic-1.0-a.xht": [ - [ - "/css/css-color/t32-opacity-basic-1.0-a.xht", - {} - ] - ], - "css/css-color/t32-opacity-clamping-0.0-b.xht": [ - [ - "/css/css-color/t32-opacity-clamping-0.0-b.xht", - {} - ] - ], - "css/css-color/t32-opacity-clamping-1.0-b.xht": [ - [ - "/css/css-color/t32-opacity-clamping-1.0-b.xht", - {} - ] - ], - "css/css-color/t32-opacity-offscreen-b.xht": [ - [ - "/css/css-color/t32-opacity-offscreen-b.xht", - {} - ] - ], - "css/css-color/t32-opacity-offscreen-with-alpha-c.xht": [ - [ - "/css/css-color/t32-opacity-offscreen-with-alpha-c.xht", - {} - ] - ], "css/css-color/t32-opacity-zorder-c.xht": [ [ "/css/css-color/t32-opacity-zorder-c.xht", {} ] ], - "css/css-color/t41-html4-keywords-a.xht": [ - [ - "/css/css-color/t41-html4-keywords-a.xht", - {} - ] - ], - "css/css-color/t421-rgb-clip-outside-gamut-b.xht": [ - [ - "/css/css-color/t421-rgb-clip-outside-gamut-b.xht", - {} - ] - ], "css/css-color/t421-rgb-hex3-expand-b.xht": [ [ "/css/css-color/t421-rgb-hex3-expand-b.xht", {} ] ], - "css/css-color/t421-rgb-values-meaning-b.xht": [ - [ - "/css/css-color/t421-rgb-values-meaning-b.xht", - {} - ] - ], - "css/css-color/t422-rgba-a0.0-a.xht": [ - [ - "/css/css-color/t422-rgba-a0.0-a.xht", - {} - ] - ], "css/css-color/t422-rgba-a0.6-a.xht": [ [ "/css/css-color/t422-rgba-a0.6-a.xht", {} ] ], - "css/css-color/t422-rgba-values-meaning-b.xht": [ - [ - "/css/css-color/t422-rgba-values-meaning-b.xht", - {} - ] - ], - "css/css-color/t424-hsl-h-rotating-b.xht": [ - [ - "/css/css-color/t424-hsl-h-rotating-b.xht", - {} - ] - ], "css/css-color/t425-hsla-basic-a.xht": [ [ "/css/css-color/t425-hsla-basic-a.xht", {} ] ], - "css/css-color/t425-hsla-h-rotating-b.xht": [ - [ - "/css/css-color/t425-hsla-h-rotating-b.xht", - {} - ] - ], - "css/css-color/t425-hsla-onscreen-b.xht": [ - [ - "/css/css-color/t425-hsla-onscreen-b.xht", - {} - ] - ], - "css/css-color/t43-svg-keywords-a.xht": [ - [ - "/css/css-color/t43-svg-keywords-a.xht", - {} - ] - ], "css/css-color/t451-system-colors-a.xht": [ [ "/css/css-color/t451-system-colors-a.xht", @@ -253436,13 +253736,17 @@ "2d8036af7162bb8d5bf6f58aeb208e5b59a5c603", "reftest" ], + "css/css-color/hex-003-ref.html": [ + "ae310bf928918fbfaeb9321492d64ca51b8d5b9d", + "support" + ], "css/css-color/hex-003.html": [ - "eb6eb446c5bcf8192978c993f17335c4156cb64a", - "visual" + "00a369523764c1e142b1443e334f9e2bb757c641", + "reftest" ], "css/css-color/hex-004.html": [ - "1c13db92fee4b0c222a9c7a73618898f910ac5fb", - "visual" + "1faab141bd125d7e6652deed6ca23771989580cf", + "reftest" ], "css/css-color/hsl-001.html": [ "fa05f869ed6143538c863ca399affee8e12e33d5", @@ -253656,29 +253960,45 @@ "6ef52952d60deab37c102778a0fb56db704d98ed", "reftest" ], + "css/css-color/t32-opacity-basic-0.0-a-ref.html": [ + "97a8963a38c6dbbb18a594f11c9bb2c7e5f0a2b1", + "support" + ], "css/css-color/t32-opacity-basic-0.0-a.xht": [ - "641b6fe0e8b58160019ac388a1882258c8c3b119", - "visual" + "36abb11ff05c7968832d741f9a02269ce87ff141", + "reftest" ], "css/css-color/t32-opacity-basic-0.6-a.xht": [ "9d9df3be674bb5f1337be87670d46c0eed026e67", "visual" ], + "css/css-color/t32-opacity-basic-1.0-a-ref.html": [ + "0d121aca3970b1271f2b4849dfe49ef5798e7920", + "support" + ], "css/css-color/t32-opacity-basic-1.0-a.xht": [ - "a7a452594764791117888b0dcd3739d42ffd5796", - "visual" + "182ecc55a7ea82037c5999cbd51b51aab1c7809a", + "reftest" ], "css/css-color/t32-opacity-clamping-0.0-b.xht": [ - "7c70a818e5bb401e2960972859c52c159c95b876", - "visual" + "3e797a55789abf7162b65f30bbf550a27a7ee314", + "reftest" + ], + "css/css-color/t32-opacity-clamping-1.0-b-ref.html": [ + "c138f6411fd49193a8cbbe74c920dc64c2851a43", + "support" ], "css/css-color/t32-opacity-clamping-1.0-b.xht": [ - "aa6bfc4d262295dbc51b9bb0487c969eae00bddc", - "visual" + "b8fa4d8d0e54a0a2fc8f945af7f436181fa30b7b", + "reftest" + ], + "css/css-color/t32-opacity-offscreen-b-ref.html": [ + "f727493bfcd31d29a98b0b69982c85e7785bdf23", + "support" ], "css/css-color/t32-opacity-offscreen-b.xht": [ - "47f51b98cb3789796bec5e8eccf3a304c2cfb0c4", - "visual" + "dc3520769d1c6b310602423121d7cbe7a6349bbb", + "reftest" ], "css/css-color/t32-opacity-offscreen-multiple-boxes-1-c-ref.html": [ "3594dd7b57e2b39cab4cb628f6477b2b2a4f8cfb", @@ -253696,21 +254016,33 @@ "e02af1fea5690440983c959a6dd94fef08f41ad7", "reftest" ], + "css/css-color/t32-opacity-offscreen-with-alpha-c-ref.html": [ + "d1b756d83fdf8e3aa27a37a600c0939166b1ce43", + "support" + ], "css/css-color/t32-opacity-offscreen-with-alpha-c.xht": [ - "bd319bbe03dabc9b0bf609a9ed179a4fd8f50ba2", - "visual" + "8834024cf1e7d6743af492fd1d1526963b795186", + "reftest" ], "css/css-color/t32-opacity-zorder-c.xht": [ "d9c0793e3afa75b3e5b7860b1f0361b25a2490f4", "visual" ], + "css/css-color/t41-html4-keywords-a-ref.html": [ + "fe35d8991f77bec0c5b9e29354001650fc0939e3", + "support" + ], "css/css-color/t41-html4-keywords-a.xht": [ - "bd840b00197a086e255e50efe597725f70f167ef", - "visual" + "e08edc3b93fbfd9b7161aa0cc28485af280b8a3e", + "reftest" + ], + "css/css-color/t421-rgb-clip-outside-gamut-b-ref.html": [ + "8806ba740a49bef0d53dc49bfb24a525373bf64a", + "support" ], "css/css-color/t421-rgb-clip-outside-gamut-b.xht": [ - "1a8665f07bc06176ec3e395656db26a87ca1884b", - "visual" + "6e82b4076c59aa8a9c43f26c07dd14c33e0bc39c", + "reftest" ], "css/css-color/t421-rgb-func-int-a.xht": [ "affae2fcb347e5945b7341b8228d8e1009729977", @@ -253736,6 +254068,10 @@ "84148b6e86b2a3a68aacdec844019436d0f836c7", "reftest" ], + "css/css-color/t421-rgb-hex3-expand-b-ref.html": [ + "dbbee69e8d5443b8ef7a4efd2401c5c24b3e81cb", + "support" + ], "css/css-color/t421-rgb-hex3-expand-b.xht": [ "771ed736fef0db765beb042a658e55784c96c843", "visual" @@ -253744,13 +254080,17 @@ "ee949724f35b9e5579f821bbff4a708b2528dd7d", "reftest" ], + "css/css-color/t421-rgb-values-meaning-b-ref.html": [ + "dfdf69248220eb810031c2be74d8a58ee7990eac", + "support" + ], "css/css-color/t421-rgb-values-meaning-b.xht": [ - "ee4de49d2eb086958078f75ad87c1111f7de7ad7", - "visual" + "39c64ce7bd432b452fa970ff3147cf2eb5938c80", + "reftest" ], "css/css-color/t422-rgba-a0.0-a.xht": [ - "c99a9fc1f4193b0757a5ab704425ee761eadba16", - "visual" + "9c724ccc138d206374d86de3c07f75097d05c8e3", + "reftest" ], "css/css-color/t422-rgba-a0.6-a.xht": [ "b113473c73598e0ac6f54669c0b69bf35315dd74", @@ -253832,9 +254172,13 @@ "52cd48c468414a3e6d94a31c0bab6f5d04bfcc3c", "reftest" ], + "css/css-color/t422-rgba-values-meaning-b-ref.html": [ + "68e97f16df077b9103bfaf9380b6741141391982", + "support" + ], "css/css-color/t422-rgba-values-meaning-b.xht": [ - "cf37fdfa70940f3892d1bae3882a99a4512f58aa", - "visual" + "acf8b78878f7e802ea942ef971bd1488ad7c3421", + "reftest" ], "css/css-color/t423-transparent-1-a.xht": [ "3cc81ffe93d23180f24b7379c37276214074846b", @@ -253864,9 +254208,13 @@ "0ed35609de1852fa2870276606ab042291bd02bb", "reftest" ], + "css/css-color/t424-hsl-h-rotating-b-ref.html": [ + "9ca080fa1c31a9c7245c0d6451d8965500e77efd", + "support" + ], "css/css-color/t424-hsl-h-rotating-b.xht": [ - "acae31c06007d39c80b2796c99c1946ccde209bb", - "visual" + "b4f0e1c01af1a7c3c9ab31a34307e8f1ac70ec55", + "reftest" ], "css/css-color/t424-hsl-parsing-f-ref.html": [ "286da104ec5ceaac14c64fec235b2cc109ae6d3a", @@ -254008,13 +254356,17 @@ "257c0df648f50c198036a710151aca334522fed5", "reftest" ], + "css/css-color/t425-hsla-h-rotating-b-ref.html": [ + "cd455e72ebe236dc65f86dc9f480d9952c6730b7", + "support" + ], "css/css-color/t425-hsla-h-rotating-b.xht": [ - "07a0c79524074b22ac7ae73f9bcb56d8ba2bc70d", - "visual" + "1be1bd816dc4e2ee02a129879dfc53e571222a82", + "reftest" ], "css/css-color/t425-hsla-onscreen-b.xht": [ - "de76f1a5104324c95c59eee4cdb2601790e178c5", - "visual" + "544cf0bbf9cf4330090f559b0f5609b3dc44015c", + "reftest" ], "css/css-color/t425-hsla-onscreen-multiple-boxes-c.xht": [ "d2dc37794501b0ef2b05409c89367c4e01ac4ccb", @@ -254032,9 +254384,13 @@ "a9e194307d3ed4ee0f9aacf3c780598bd18d7d40", "reftest" ], + "css/css-color/t43-svg-keywords-a-ref.html": [ + "9119ed188422f341e6f6f7befbcac55cc24d890b", + "support" + ], "css/css-color/t43-svg-keywords-a.xht": [ - "b779696e6c036e877bb84cd978f1e944ce0fd788", - "visual" + "13a33016ff37bc8750efad1c4ef7357427d69f3f", + "reftest" ], "css/css-color/t44-currentcolor-background-b-ref.html": [ "53ee23e6007353180358a3291698fa66ae3d43b7", @@ -254556,6 +254912,10 @@ "f51f4df4bc1e93e84fc53a0d3352f737f6a68c0f", "reftest" ], + "css/css-display/display-contents-unusual-html-elements-none.html": [ + "dc354fb4f1896f655186cf57dd100f475a4ce5f0", + "reftest" + ], "css/css-display/display-flow-root-001-ref.html": [ "a9d3c569ae10db047d3f6ff3b0888a6d74cece61", "support" @@ -257700,6 +258060,46 @@ "955b6034a43ed937c87df87b35e37d6cdb4f1e0d", "reftest" ], + "css/css-fonts/font-default-01-ref.html": [ + "4c9d7b41e3677da2c9fab71098a34463f4ecdf06", + "support" + ], + "css/css-fonts/font-default-01.html": [ + "f8cacf1d1151773294d278025d2e9e3c859da7ee", + "reftest" + ], + "css/css-fonts/font-default-02-ref.html": [ + "c82b34b553a4884e8855e72d53fbb4e2a188150d", + "support" + ], + "css/css-fonts/font-default-02.html": [ + "65c7f00a58f50eaa8318197ead5bfd090a3b9fe3", + "reftest" + ], + "css/css-fonts/font-default-03-ref.html": [ + "9d058bd5f6ff7c1ae78c30971d4ccbc300bb9659", + "support" + ], + "css/css-fonts/font-default-03.html": [ + "6904aa08cd31f40a1025cdca5fd67c80adb766c2", + "reftest" + ], + "css/css-fonts/font-default-04-a-ref.html": [ + "e19a9893bd2a3324359fee3221463fde0cda83c1", + "support" + ], + "css/css-fonts/font-default-04-b-ref.html": [ + "be7941d593507cacc4dd0e6f7ea965da5028e17a", + "support" + ], + "css/css-fonts/font-default-04-c-ref.html": [ + "d7cbdc050d5bf76b2d2d1e9ef7e6bf2b0ab949fc", + "support" + ], + "css/css-fonts/font-default-04.html": [ + "4f5d1d1f375f61a09d30ef28deda1b2a54f4c620", + "reftest" + ], "css/css-fonts/font-display/font-display-failure-fallback.html": [ "9fbf0c808f338c5d668554ab62f10cfe0ca93c91", "testharness" @@ -266528,6 +266928,14 @@ "f94336e80a72225b05970dec330508c33445c87a", "testharness" ], + "css/css-grid/grid-model/grid-container-ignores-first-letter-001.html": [ + "e46492228ce6fdf83d9661c06db745e9c6689bb4", + "testharness" + ], + "css/css-grid/grid-model/grid-container-ignores-first-line-001.html": [ + "8e8895681b8f7e8f5d416faedf5b081f7fc42243", + "testharness" + ], "css/css-grid/grid-model/grid-display-grid-001.html": [ "4eb94a6ac52aec622d55911c68677263d9533246", "reftest" @@ -266612,6 +267020,14 @@ "2075376b219560fbf9b9e6c3cb125ba2d066e966", "reftest" ], + "css/css-grid/grid-model/grid-item-accepts-first-letter-001.html": [ + "bc3aa0022584b2dc6253aeb1bbca50b6b7c05f54", + "testharness" + ], + "css/css-grid/grid-model/grid-item-accepts-first-line-001.html": [ + "0af2d39207188e1398e69f1e2d81848ba1bee2ee", + "testharness" + ], "css/css-grid/grid-model/grid-margins-no-collapse-001.html": [ "f68bfb76a8158d9bd8c9e3ef2e8aab11401b0360", "reftest" @@ -268576,6 +268992,10 @@ "88e35164b6ede3adf9727989cf59ff9956bdbae7", "reftest" ], + "css/css-position/position-sticky-offset-overflow.html": [ + "cab620b2008a9df57abc6907b1199e35a4099241", + "testharness" + ], "css/css-position/position-sticky-offset-top-left.html": [ "a25b64d016644c272ea92b6129a59eefb21d2fa0", "testharness" @@ -341245,7 +341665,7 @@ "support" ], "service-workers/service-worker/resources/interfaces-worker.sub.js": [ - "96ced133fb78081eece4929ad3c1e40299fc9300", + "229dd043c0e98e9f70f54277bba7c4c3db6d000d", "support" ], "service-workers/service-worker/resources/invalid-blobtype-iframe.https.html": [
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/hex-003-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/hex-003-ref.html new file mode 100644 index 0000000..613528e9 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/hex-003-ref.html
@@ -0,0 +1,9 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Green text reference for hex shorthand tests</title> +<style> + .test { color: #007700} +</style> +<body> + <p class="test">Test passes if this text is green</p> +</body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/hex-003.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/hex-003.html index db710cf..a6a19ad 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/hex-003.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/hex-003.html
@@ -3,11 +3,11 @@ <title>CSS Color 4: The RGB hexadecimal notations: #RRGGBB</title> <link rel="author" title="Chris Lilley" href="mailto:chris@w3.org"> <link rel="help" href="https://drafts.csswg.org/css-color-4/#hex-notation"> +<link rel="match" href="hex-003-ref.html"> <meta name="assert" content="3 digit hex"> <style> .test {color: #070} </style> <body> <p class="test">Test passes if this text is green</p> - <!-- #007700, not #008000, but visually similar. Thus, no reftest --> </body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/hex-004.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/hex-004.html index f6ea47f7..074fb1d47 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/hex-004.html +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/hex-004.html
@@ -4,10 +4,10 @@ <link rel="author" title="Chris Lilley" href="mailto:chris@w3.org"> <link rel="help" href="https://drafts.csswg.org/css-color-4/#hex-notation"> <meta name="assert" content="4 digit hex, fully opaque"> +<link rel="match" href="hex-003-ref.html"> <style> .test {color: #070F} </style> <body> <p class="test">Test passes if this text is green</p> - <!-- #007700, not #008000, but visually similar. Thus, no reftest --> </body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-basic-0.0-a-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-basic-0.0-a-ref.html new file mode 100644 index 0000000..298c489 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-basic-0.0-a-ref.html
@@ -0,0 +1,6 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Reference</title> +<body> + <p id="one">This should be the only text visible on this page.</p> +</body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-basic-0.0-a.xht b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-basic-0.0-a.xht index 20a2dd3..637638d9 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-basic-0.0-a.xht +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-basic-0.0-a.xht
@@ -5,6 +5,7 @@ <link rel="author" title="L. David Baron" href="https://dbaron.org/" /> <link rel="author" title="Mozilla Corporation" href="http://mozilla.com/" /> <link rel="help" href="http://www.w3.org/TR/css3-color/#transparency" /> + <link rel="match" href="t32-opacity-basic-0.0-a-ref.html" /> <meta name="flags" content="" /> <meta name="assert" content="Opacity of 0.0 makes box transparent." /> <style type="text/css"><![CDATA[
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-basic-1.0-a-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-basic-1.0-a-ref.html new file mode 100644 index 0000000..b59c82f4 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-basic-1.0-a-ref.html
@@ -0,0 +1,7 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Reference</title> +<body> + <p id="one">This text should be the same color as the line below.</p> + <p id="two">This text should be the same color as the line above.</p> +</body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-basic-1.0-a.xht b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-basic-1.0-a.xht index 01dc48c..6d8ea9ec 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-basic-1.0-a.xht +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-basic-1.0-a.xht
@@ -5,6 +5,7 @@ <link rel="author" title="L. David Baron" href="https://dbaron.org/" /> <link rel="author" title="Mozilla Corporation" href="http://mozilla.com/" /> <link rel="help" href="http://www.w3.org/TR/css3-color/#transparency" /> + <link rel="match" href="t32-opacity-basic-1.0-a-ref.html" /> <meta name="flags" content="" /> <meta name="assert" content="Opacity of 1.0 makes box fully opaque." /> <style type="text/css"><![CDATA[
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-clamping-0.0-b.xht b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-clamping-0.0-b.xht index 61687c0..966f7e0 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-clamping-0.0-b.xht +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-clamping-0.0-b.xht
@@ -5,6 +5,7 @@ <link rel="author" title="L. David Baron" href="https://dbaron.org/" /> <link rel="author" title="Mozilla Corporation" href="http://mozilla.com/" /> <link rel="help" href="http://www.w3.org/TR/css3-color/#transparency" /> + <link rel="match" href="t32-opacity-basic-0.0-a-ref.html" /> <meta name="flags" content="" /> <meta name="assert" content="Opacity values less than 0.0 are clamped to 0.0" /> <style type="text/css"><![CDATA[
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-clamping-1.0-b-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-clamping-1.0-b-ref.html new file mode 100644 index 0000000..08854a1 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-clamping-1.0-b-ref.html
@@ -0,0 +1,11 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Reference</title> +<body> + <p id="one">There should be six lines of text on this page, all the same color. [1 of 6]</p> + <p id="two">There should be six lines of text on this page, all the same color. [2 of 6]</p> + <p id="three">There should be six lines of text on this page, all the same color. [3 of 6]</p> + <p id="four">There should be six lines of text on this page, all the same color. [4 of 6]</p> + <p id="five">There should be six lines of text on this page, all the same color. [5 of 6]</p> + <p id="six">There should be six lines of text on this page, all the same color. [6 of 6]</p> +</body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-clamping-1.0-b.xht b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-clamping-1.0-b.xht index 56bca60..31121cb 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-clamping-1.0-b.xht +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-clamping-1.0-b.xht
@@ -5,6 +5,7 @@ <link rel="author" title="L. David Baron" href="https://dbaron.org/" /> <link rel="author" title="Mozilla Corporation" href="http://mozilla.com/" /> <link rel="help" href="http://www.w3.org/TR/css3-color/#transparency" /> + <link rel="match" href="t32-opacity-clamping-1.0-b-ref.html" /> <meta name="flags" content="" /> <meta name="assert" content="Opacity values greater than 1.0 are clamped to 1.0" /> <style type="text/css"><![CDATA[
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-offscreen-b-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-offscreen-b-ref.html new file mode 100644 index 0000000..2a3ae62 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-offscreen-b-ref.html
@@ -0,0 +1,16 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Reference</title> +<style> + div { width: 5em; height: 1em; margin: 2px 0; } + .test { background: rgb(153, 153, 255); } +</style> +<body> + <p>The following five boxes should be the same color:</p> + + <div class="test"></div> + <div class="test"></div> + <div class="test"></div> + <div class="test"></div> + <div class="test"></div> +</body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-offscreen-b.xht b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-offscreen-b.xht index 2303fac..a373f98 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-offscreen-b.xht +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-offscreen-b.xht
@@ -5,6 +5,7 @@ <link rel="author" title="L. David Baron" href="https://dbaron.org/" /> <link rel="author" title="Mozilla Corporation" href="http://mozilla.com/" /> <link rel="help" href="http://www.w3.org/TR/css3-color/#transparency" /> + <link rel="match" href="t32-opacity-offscreen-b-ref.html" /> <meta name="flags" content="" /> <meta name="assert" content="That opacity specifies compositing the contents as a single offscreen buffer." /> <style type="text/css"><![CDATA[
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-offscreen-with-alpha-c-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-offscreen-with-alpha-c-ref.html new file mode 100644 index 0000000..923e449 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-offscreen-with-alpha-c-ref.html
@@ -0,0 +1,15 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Reference</title> +<style> + div { width: 5em; height: 1em; margin: 2px 0; } + .test { background: rgb(204, 204, 255); } +</style> +<body> + <p>The following four boxes should be the same color:</p> + + <div class="test"></div> + <div class="test"></div> + <div class="test"></div> + <div class="test"></div> +</body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-offscreen-with-alpha-c.xht b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-offscreen-with-alpha-c.xht index 5fa074c..fdd9ae2 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-offscreen-with-alpha-c.xht +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t32-opacity-offscreen-with-alpha-c.xht
@@ -5,6 +5,7 @@ <link rel="author" title="L. David Baron" href="https://dbaron.org/" /> <link rel="author" title="Mozilla Corporation" href="http://mozilla.com/" /> <link rel="help" href="http://www.w3.org/TR/css3-color/#transparency" /> + <link rel="match" href="t32-opacity-offscreen-with-alpha-c-ref.html" /> <meta name="flags" content="" /> <meta name="assert" content="That alpha within the offscreen buffer is composited correctly." /> <style type="text/css"><![CDATA[
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t41-html4-keywords-a-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t41-html4-keywords-a-ref.html new file mode 100644 index 0000000..4f95dff --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t41-html4-keywords-a-ref.html
@@ -0,0 +1,32 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Reference</title> +<style> + html, body { background: #dddddd; color: #000000; } + table { border-spacing: 0; padding: 0; border: none; } + td { border: none; padding: 0; } +</style> +<body> + <p>Each row in the following table (except the first and last, to show where the columns are) should have two cells with the same background color. None of them should match the background of the page.</p> + + <table> + <tr><td style="background: black"> </td><td style="background: white"> </td></tr> + <tr><td style="background: #000000" colspan=2> </td></tr> + <tr><td style="background: #008000" colspan=2> </td></tr> + <tr><td style="background: #C0C0C0" colspan=2> </td></tr> + <tr><td style="background: #00FF00" colspan=2> </td></tr> + <tr><td style="background: #808080" colspan=2> </td></tr> + <tr><td style="background: #808000" colspan=2> </td></tr> + <tr><td style="background: #FFFFFF" colspan=2> </td></tr> + <tr><td style="background: #FFFF00" colspan=2> </td></tr> + <tr><td style="background: #800000" colspan=2> </td></tr> + <tr><td style="background: #000080" colspan=2> </td></tr> + <tr><td style="background: #FF0000" colspan=2> </td></tr> + <tr><td style="background: #0000FF" colspan=2> </td></tr> + <tr><td style="background: #800080" colspan=2> </td></tr> + <tr><td style="background: #008080" colspan=2> </td></tr> + <tr><td style="background: #FF00FF" colspan=2> </td></tr> + <tr><td style="background: #00FFFF" colspan=2> </td></tr> + <tr><td style="background: white"> </td><td style="background: black"> </td></tr> + </table> +</body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t41-html4-keywords-a.xht b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t41-html4-keywords-a.xht index 1862f827..3a3e332 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t41-html4-keywords-a.xht +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t41-html4-keywords-a.xht
@@ -5,6 +5,7 @@ <link rel="author" title="L. David Baron" href="https://dbaron.org/" /> <link rel="author" title="Mozilla Corporation" href="http://mozilla.com/" /> <link rel="help" href="http://www.w3.org/TR/css3-color/#html4" /> + <link rel="match" href="t41-html4-keywords-a-ref.html" /> <meta name="flags" content="" /> <meta name="assert" content="Test that the HTML4 color keywords have the correct values." /> <style type="text/css"><![CDATA[
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t421-rgb-clip-outside-gamut-b-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t421-rgb-clip-outside-gamut-b-ref.html new file mode 100644 index 0000000..81bbc51 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t421-rgb-clip-outside-gamut-b-ref.html
@@ -0,0 +1,42 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Reference</title> +<style> + table { border-spacing: 0 2px; padding: 0; border: none; } + td { border: none; padding: 0; height: 1.2em; } +</style> +<body> + <p><strong>WARNING: This test assumes that the device gamut is sRGB + (as it will be for many CRT monitors).</strong></p> + <p>Every row in this table should have both columns the same color:</p> + <table> + <tr> + <th style="background:white; color: black">Column 1</th> + <th style="background:black; color: white">Column 2</th> + </tr> + <tr> + <td colspan='2' style="background: rgb(0, 255, 0)"> </td> + </tr> + <tr> + <td colspan='2' style="background: rgb(0, 0, 255)"> </td> + </tr> + <tr> + <td colspan='2' style="background: rgb(0, 255, 0)"> </td> + </tr> + <tr> + <td colspan='2' style="background: rgb(0, 255, 0)"> </td> + </tr> + <tr> + <td colspan='2' style="background: rgb(0, 255, 0)"> </td> + </tr> + <tr> + <td colspan='2' style="background: rgb(0, 255, 0)"> </td> + </tr> + <tr> + <td colspan='2' style="background: rgb(50, 0, 255)"> </td> + </tr> + <tr> + <td colspan='2' style="background: rgb(0, 50, 255)"> </td> + </tr> + </table> +</body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t421-rgb-clip-outside-gamut-b.xht b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t421-rgb-clip-outside-gamut-b.xht index 5e00ea6..1fd50ff 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t421-rgb-clip-outside-gamut-b.xht +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t421-rgb-clip-outside-gamut-b.xht
@@ -5,6 +5,7 @@ <link rel="author" title="L. David Baron" href="https://dbaron.org/" /> <link rel="author" title="Mozilla Corporation" href="http://mozilla.com/" /> <link rel="help" href="http://www.w3.org/TR/css3-color/#rgb-color" /> + <link rel="match" href="t421-rgb-clip-outside-gamut-b-ref.html" /> <meta name="flags" content="" /> <meta name="assert" content="Test clipping of rgb() values outside the device gamut." /> <style type="text/css"><![CDATA[
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t421-rgb-hex3-expand-b-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t421-rgb-hex3-expand-b-ref.html new file mode 100644 index 0000000..842ead1 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t421-rgb-hex3-expand-b-ref.html
@@ -0,0 +1,24 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Reference</title> +<style> + table { border-spacing: 0; padding: 0; border: none; } + td { border: none; padding: 0; width: 1.2em; height: 1.2em; } +</style> +<body> + <p>The left and right cells in each row of the following table should be the <em>same</em> color.</p> + + <table> + <tr><td style="background: #ee9922"> </td><td style="background: #ee9922"> </td></tr> + <tr><td style="background: #ffbb00"> </td><td style="background: #ffbb00"> </td></tr> + <tr><td style="background: #338811"> </td><td style="background: #338811"> </td></tr> + </table> + + <p>The left and right cells in each row of the following table should be slightly <em>different</em> colors. The right side should be slightly darker than the left.</p> + + <table> + <tr><td style="background: #e09020"> </td><td style="background: #e09020"> </td></tr> + <tr><td style="background: #f0b000"> </td><td style="background: #f0b000"> </td></tr> + <tr><td style="background: #308010"> </td><td style="background: #308010"> </td></tr> + </table> +</body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t421-rgb-values-meaning-b-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t421-rgb-values-meaning-b-ref.html new file mode 100644 index 0000000..b468f0eb --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t421-rgb-values-meaning-b-ref.html
@@ -0,0 +1,1539 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Reference</title> +<style> + table { border-spacing: 0; padding: 0; border: none; } + td { border: none; padding: 0; } + td { width: 1.2em; height: 1.2em; } +</style> +<body> + <p>The following table should have four matching rows gradually changing from red at the left to black at the right (plus a checkerboard at both ends to show where the rows are):</p> + + <table border="border"> + <tr> + <td style="background: black"> </td> + <td style="background: #ff0000"> </td> + <td style="background: #ee0000"> </td> + <td style="background: #dd0000"> </td> + <td style="background: #cc0000"> </td> + <td style="background: #bb0000"> </td> + <td style="background: #aa0000"> </td> + <td style="background: #990000"> </td> + <td style="background: #880000"> </td> + <td style="background: #770000"> </td> + <td style="background: #660000"> </td> + <td style="background: #550000"> </td> + <td style="background: #440000"> </td> + <td style="background: #330000"> </td> + <td style="background: #220000"> </td> + <td style="background: #110000"> </td> + <td style="background: #000000"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #ff0000"> </td> + <td style="background: #ee0000"> </td> + <td style="background: #dd0000"> </td> + <td style="background: #cc0000"> </td> + <td style="background: #bb0000"> </td> + <td style="background: #aa0000"> </td> + <td style="background: #990000"> </td> + <td style="background: #880000"> </td> + <td style="background: #770000"> </td> + <td style="background: #660000"> </td> + <td style="background: #550000"> </td> + <td style="background: #440000"> </td> + <td style="background: #330000"> </td> + <td style="background: #220000"> </td> + <td style="background: #110000"> </td> + <td style="background: #000000"> </td> + <td style="background: black"> </td> + </tr> + <tr> + <td style="background: black"> </td> + <td style="background: #ff0000"> </td> + <td style="background: #ee0000"> </td> + <td style="background: #dd0000"> </td> + <td style="background: #cc0000"> </td> + <td style="background: #bb0000"> </td> + <td style="background: #aa0000"> </td> + <td style="background: #990000"> </td> + <td style="background: #880000"> </td> + <td style="background: #770000"> </td> + <td style="background: #660000"> </td> + <td style="background: #550000"> </td> + <td style="background: #440000"> </td> + <td style="background: #330000"> </td> + <td style="background: #220000"> </td> + <td style="background: #110000"> </td> + <td style="background: #000000"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #ff0000"> </td> + <td style="background: #ee0000"> </td> + <td style="background: #dd0000"> </td> + <td style="background: #cc0000"> </td> + <td style="background: #bb0000"> </td> + <td style="background: #aa0000"> </td> + <td style="background: #990000"> </td> + <td style="background: #880000"> </td> + <td style="background: #770000"> </td> + <td style="background: #660000"> </td> + <td style="background: #550000"> </td> + <td style="background: #440000"> </td> + <td style="background: #330000"> </td> + <td style="background: #220000"> </td> + <td style="background: #110000"> </td> + <td style="background: #000000"> </td> + <td style="background: black"> </td> + </tr> + </table> + + <p>The following table should have four matching rows gradually changing from white at the left to red at the right (plus a checkerboard at both ends to show where the rows are):</p> + + <table border="border"> + <tr> + <td style="background: black"> </td> + <td style="background: #ffffff"> </td> + <td style="background: #ffeeee"> </td> + <td style="background: #ffdddd"> </td> + <td style="background: #ffcccc"> </td> + <td style="background: #ffbbbb"> </td> + <td style="background: #ffaaaa"> </td> + <td style="background: #ff9999"> </td> + <td style="background: #ff8888"> </td> + <td style="background: #ff7777"> </td> + <td style="background: #ff6666"> </td> + <td style="background: #ff5555"> </td> + <td style="background: #ff4444"> </td> + <td style="background: #ff3333"> </td> + <td style="background: #ff2222"> </td> + <td style="background: #ff1111"> </td> + <td style="background: #ff0000"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #ffffff"> </td> + <td style="background: #ffeeee"> </td> + <td style="background: #ffdddd"> </td> + <td style="background: #ffcccc"> </td> + <td style="background: #ffbbbb"> </td> + <td style="background: #ffaaaa"> </td> + <td style="background: #ff9999"> </td> + <td style="background: #ff8888"> </td> + <td style="background: #ff7777"> </td> + <td style="background: #ff6666"> </td> + <td style="background: #ff5555"> </td> + <td style="background: #ff4444"> </td> + <td style="background: #ff3333"> </td> + <td style="background: #ff2222"> </td> + <td style="background: #ff1111"> </td> + <td style="background: #ff0000"> </td> + <td style="background: black"> </td> + </tr> + <tr> + <td style="background: black"> </td> + <td style="background: #ffffff"> </td> + <td style="background: #ffeeee"> </td> + <td style="background: #ffdddd"> </td> + <td style="background: #ffcccc"> </td> + <td style="background: #ffbbbb"> </td> + <td style="background: #ffaaaa"> </td> + <td style="background: #ff9999"> </td> + <td style="background: #ff8888"> </td> + <td style="background: #ff7777"> </td> + <td style="background: #ff6666"> </td> + <td style="background: #ff5555"> </td> + <td style="background: #ff4444"> </td> + <td style="background: #ff3333"> </td> + <td style="background: #ff2222"> </td> + <td style="background: #ff1111"> </td> + <td style="background: #ff0000"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #ffffff"> </td> + <td style="background: #ffeeee"> </td> + <td style="background: #ffdddd"> </td> + <td style="background: #ffcccc"> </td> + <td style="background: #ffbbbb"> </td> + <td style="background: #ffaaaa"> </td> + <td style="background: #ff9999"> </td> + <td style="background: #ff8888"> </td> + <td style="background: #ff7777"> </td> + <td style="background: #ff6666"> </td> + <td style="background: #ff5555"> </td> + <td style="background: #ff4444"> </td> + <td style="background: #ff3333"> </td> + <td style="background: #ff2222"> </td> + <td style="background: #ff1111"> </td> + <td style="background: #ff0000"> </td> + <td style="background: black"> </td> + </tr> + </table> + + <p>The following table should have four matching rows gradually changing from green at the left to black at the right (plus a checkerboard at both ends to show where the rows are):</p> + + <table border="border"> + <tr> + <td style="background: black"> </td> + <td style="background: #00ff00"> </td> + <td style="background: #00ee00"> </td> + <td style="background: #00dd00"> </td> + <td style="background: #00cc00"> </td> + <td style="background: #00bb00"> </td> + <td style="background: #00aa00"> </td> + <td style="background: #009900"> </td> + <td style="background: #008800"> </td> + <td style="background: #007700"> </td> + <td style="background: #006600"> </td> + <td style="background: #005500"> </td> + <td style="background: #004400"> </td> + <td style="background: #003300"> </td> + <td style="background: #002200"> </td> + <td style="background: #001100"> </td> + <td style="background: #000000"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #00ff00"> </td> + <td style="background: #00ee00"> </td> + <td style="background: #00dd00"> </td> + <td style="background: #00cc00"> </td> + <td style="background: #00bb00"> </td> + <td style="background: #00aa00"> </td> + <td style="background: #009900"> </td> + <td style="background: #008800"> </td> + <td style="background: #007700"> </td> + <td style="background: #006600"> </td> + <td style="background: #005500"> </td> + <td style="background: #004400"> </td> + <td style="background: #003300"> </td> + <td style="background: #002200"> </td> + <td style="background: #001100"> </td> + <td style="background: #000000"> </td> + <td style="background: black"> </td> + </tr> + <tr> + <td style="background: black"> </td> + <td style="background: #00ff00"> </td> + <td style="background: #00ee00"> </td> + <td style="background: #00dd00"> </td> + <td style="background: #00cc00"> </td> + <td style="background: #00bb00"> </td> + <td style="background: #00aa00"> </td> + <td style="background: #009900"> </td> + <td style="background: #008800"> </td> + <td style="background: #007700"> </td> + <td style="background: #006600"> </td> + <td style="background: #005500"> </td> + <td style="background: #004400"> </td> + <td style="background: #003300"> </td> + <td style="background: #002200"> </td> + <td style="background: #001100"> </td> + <td style="background: #000000"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #00ff00"> </td> + <td style="background: #00ee00"> </td> + <td style="background: #00dd00"> </td> + <td style="background: #00cc00"> </td> + <td style="background: #00bb00"> </td> + <td style="background: #00aa00"> </td> + <td style="background: #009900"> </td> + <td style="background: #008800"> </td> + <td style="background: #007700"> </td> + <td style="background: #006600"> </td> + <td style="background: #005500"> </td> + <td style="background: #004400"> </td> + <td style="background: #003300"> </td> + <td style="background: #002200"> </td> + <td style="background: #001100"> </td> + <td style="background: #000000"> </td> + <td style="background: black"> </td> + </tr> + </table> + + <p>The following table should have four matching rows gradually changing from white at the left to green at the right (plus a checkerboard at both ends to show where the rows are):</p> + + <table border="border"> + <tr> + <td style="background: black"> </td> + <td style="background: #ffffff"> </td> + <td style="background: #eeffee"> </td> + <td style="background: #ddffdd"> </td> + <td style="background: #ccffcc"> </td> + <td style="background: #bbffbb"> </td> + <td style="background: #aaffaa"> </td> + <td style="background: #99ff99"> </td> + <td style="background: #88ff88"> </td> + <td style="background: #77ff77"> </td> + <td style="background: #66ff66"> </td> + <td style="background: #55ff55"> </td> + <td style="background: #44ff44"> </td> + <td style="background: #33ff33"> </td> + <td style="background: #22ff22"> </td> + <td style="background: #11ff11"> </td> + <td style="background: #00ff00"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #ffffff"> </td> + <td style="background: #eeffee"> </td> + <td style="background: #ddffdd"> </td> + <td style="background: #ccffcc"> </td> + <td style="background: #bbffbb"> </td> + <td style="background: #aaffaa"> </td> + <td style="background: #99ff99"> </td> + <td style="background: #88ff88"> </td> + <td style="background: #77ff77"> </td> + <td style="background: #66ff66"> </td> + <td style="background: #55ff55"> </td> + <td style="background: #44ff44"> </td> + <td style="background: #33ff33"> </td> + <td style="background: #22ff22"> </td> + <td style="background: #11ff11"> </td> + <td style="background: #00ff00"> </td> + <td style="background: black"> </td> + </tr> + <tr> + <td style="background: black"> </td> + <td style="background: #ffffff"> </td> + <td style="background: #eeffee"> </td> + <td style="background: #ddffdd"> </td> + <td style="background: #ccffcc"> </td> + <td style="background: #bbffbb"> </td> + <td style="background: #aaffaa"> </td> + <td style="background: #99ff99"> </td> + <td style="background: #88ff88"> </td> + <td style="background: #77ff77"> </td> + <td style="background: #66ff66"> </td> + <td style="background: #55ff55"> </td> + <td style="background: #44ff44"> </td> + <td style="background: #33ff33"> </td> + <td style="background: #22ff22"> </td> + <td style="background: #11ff11"> </td> + <td style="background: #00ff00"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #ffffff"> </td> + <td style="background: #eeffee"> </td> + <td style="background: #ddffdd"> </td> + <td style="background: #ccffcc"> </td> + <td style="background: #bbffbb"> </td> + <td style="background: #aaffaa"> </td> + <td style="background: #99ff99"> </td> + <td style="background: #88ff88"> </td> + <td style="background: #77ff77"> </td> + <td style="background: #66ff66"> </td> + <td style="background: #55ff55"> </td> + <td style="background: #44ff44"> </td> + <td style="background: #33ff33"> </td> + <td style="background: #22ff22"> </td> + <td style="background: #11ff11"> </td> + <td style="background: #00ff00"> </td> + <td style="background: black"> </td> + </tr> + </table> + + <p>The following table should have four matching rows gradually changing from blue at the left to black at the right (plus a checkerboard at both ends to show where the rows are):</p> + + <table border="border"> + <tr> + <td style="background: black"> </td> + <td style="background: #0000ff"> </td> + <td style="background: #0000ee"> </td> + <td style="background: #0000dd"> </td> + <td style="background: #0000cc"> </td> + <td style="background: #0000bb"> </td> + <td style="background: #0000aa"> </td> + <td style="background: #000099"> </td> + <td style="background: #000088"> </td> + <td style="background: #000077"> </td> + <td style="background: #000066"> </td> + <td style="background: #000055"> </td> + <td style="background: #000044"> </td> + <td style="background: #000033"> </td> + <td style="background: #000022"> </td> + <td style="background: #000011"> </td> + <td style="background: #000000"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #0000ff"> </td> + <td style="background: #0000ee"> </td> + <td style="background: #0000dd"> </td> + <td style="background: #0000cc"> </td> + <td style="background: #0000bb"> </td> + <td style="background: #0000aa"> </td> + <td style="background: #000099"> </td> + <td style="background: #000088"> </td> + <td style="background: #000077"> </td> + <td style="background: #000066"> </td> + <td style="background: #000055"> </td> + <td style="background: #000044"> </td> + <td style="background: #000033"> </td> + <td style="background: #000022"> </td> + <td style="background: #000011"> </td> + <td style="background: #000000"> </td> + <td style="background: black"> </td> + </tr> + <tr> + <td style="background: black"> </td> + <td style="background: #0000ff"> </td> + <td style="background: #0000ee"> </td> + <td style="background: #0000dd"> </td> + <td style="background: #0000cc"> </td> + <td style="background: #0000bb"> </td> + <td style="background: #0000aa"> </td> + <td style="background: #000099"> </td> + <td style="background: #000088"> </td> + <td style="background: #000077"> </td> + <td style="background: #000066"> </td> + <td style="background: #000055"> </td> + <td style="background: #000044"> </td> + <td style="background: #000033"> </td> + <td style="background: #000022"> </td> + <td style="background: #000011"> </td> + <td style="background: #000000"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #0000ff"> </td> + <td style="background: #0000ee"> </td> + <td style="background: #0000dd"> </td> + <td style="background: #0000cc"> </td> + <td style="background: #0000bb"> </td> + <td style="background: #0000aa"> </td> + <td style="background: #000099"> </td> + <td style="background: #000088"> </td> + <td style="background: #000077"> </td> + <td style="background: #000066"> </td> + <td style="background: #000055"> </td> + <td style="background: #000044"> </td> + <td style="background: #000033"> </td> + <td style="background: #000022"> </td> + <td style="background: #000011"> </td> + <td style="background: #000000"> </td> + <td style="background: black"> </td> + </tr> + </table> + + <p>The following table should have four matching rows gradually changing from white at the left to blue at the right (plus a checkerboard at both ends to show where the rows are):</p> + + <table border="border"> + <tr> + <td style="background: black"> </td> + <td style="background: #ffffff"> </td> + <td style="background: #eeeeff"> </td> + <td style="background: #ddddff"> </td> + <td style="background: #ccccff"> </td> + <td style="background: #bbbbff"> </td> + <td style="background: #aaaaff"> </td> + <td style="background: #9999ff"> </td> + <td style="background: #8888ff"> </td> + <td style="background: #7777ff"> </td> + <td style="background: #6666ff"> </td> + <td style="background: #5555ff"> </td> + <td style="background: #4444ff"> </td> + <td style="background: #3333ff"> </td> + <td style="background: #2222ff"> </td> + <td style="background: #1111ff"> </td> + <td style="background: #0000ff"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #ffffff"> </td> + <td style="background: #eeeeff"> </td> + <td style="background: #ddddff"> </td> + <td style="background: #ccccff"> </td> + <td style="background: #bbbbff"> </td> + <td style="background: #aaaaff"> </td> + <td style="background: #9999ff"> </td> + <td style="background: #8888ff"> </td> + <td style="background: #7777ff"> </td> + <td style="background: #6666ff"> </td> + <td style="background: #5555ff"> </td> + <td style="background: #4444ff"> </td> + <td style="background: #3333ff"> </td> + <td style="background: #2222ff"> </td> + <td style="background: #1111ff"> </td> + <td style="background: #0000ff"> </td> + <td style="background: black"> </td> + </tr> + <tr> + <td style="background: black"> </td> + <td style="background: #ffffff"> </td> + <td style="background: #eeeeff"> </td> + <td style="background: #ddddff"> </td> + <td style="background: #ccccff"> </td> + <td style="background: #bbbbff"> </td> + <td style="background: #aaaaff"> </td> + <td style="background: #9999ff"> </td> + <td style="background: #8888ff"> </td> + <td style="background: #7777ff"> </td> + <td style="background: #6666ff"> </td> + <td style="background: #5555ff"> </td> + <td style="background: #4444ff"> </td> + <td style="background: #3333ff"> </td> + <td style="background: #2222ff"> </td> + <td style="background: #1111ff"> </td> + <td style="background: #0000ff"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #ffffff"> </td> + <td style="background: #eeeeff"> </td> + <td style="background: #ddddff"> </td> + <td style="background: #ccccff"> </td> + <td style="background: #bbbbff"> </td> + <td style="background: #aaaaff"> </td> + <td style="background: #9999ff"> </td> + <td style="background: #8888ff"> </td> + <td style="background: #7777ff"> </td> + <td style="background: #6666ff"> </td> + <td style="background: #5555ff"> </td> + <td style="background: #4444ff"> </td> + <td style="background: #3333ff"> </td> + <td style="background: #2222ff"> </td> + <td style="background: #1111ff"> </td> + <td style="background: #0000ff"> </td> + <td style="background: black"> </td> + </tr> + </table> + + <p>The following table should have four matching rows gradually changing from yellow at the left to black at the right (plus a checkerboard at both ends to show where the rows are):</p> + + <table border="border"> + <tr> + <td style="background: black"> </td> + <td style="background: #ffff00"> </td> + <td style="background: #eeee00"> </td> + <td style="background: #dddd00"> </td> + <td style="background: #cccc00"> </td> + <td style="background: #bbbb00"> </td> + <td style="background: #aaaa00"> </td> + <td style="background: #999900"> </td> + <td style="background: #888800"> </td> + <td style="background: #777700"> </td> + <td style="background: #666600"> </td> + <td style="background: #555500"> </td> + <td style="background: #444400"> </td> + <td style="background: #333300"> </td> + <td style="background: #222200"> </td> + <td style="background: #111100"> </td> + <td style="background: #000000"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #ffff00"> </td> + <td style="background: #eeee00"> </td> + <td style="background: #dddd00"> </td> + <td style="background: #cccc00"> </td> + <td style="background: #bbbb00"> </td> + <td style="background: #aaaa00"> </td> + <td style="background: #999900"> </td> + <td style="background: #888800"> </td> + <td style="background: #777700"> </td> + <td style="background: #666600"> </td> + <td style="background: #555500"> </td> + <td style="background: #444400"> </td> + <td style="background: #333300"> </td> + <td style="background: #222200"> </td> + <td style="background: #111100"> </td> + <td style="background: #000000"> </td> + <td style="background: black"> </td> + </tr> + <tr> + <td style="background: black"> </td> + <td style="background: #ffff00"> </td> + <td style="background: #eeee00"> </td> + <td style="background: #dddd00"> </td> + <td style="background: #cccc00"> </td> + <td style="background: #bbbb00"> </td> + <td style="background: #aaaa00"> </td> + <td style="background: #999900"> </td> + <td style="background: #888800"> </td> + <td style="background: #777700"> </td> + <td style="background: #666600"> </td> + <td style="background: #555500"> </td> + <td style="background: #444400"> </td> + <td style="background: #333300"> </td> + <td style="background: #222200"> </td> + <td style="background: #111100"> </td> + <td style="background: #000000"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #ffff00"> </td> + <td style="background: #eeee00"> </td> + <td style="background: #dddd00"> </td> + <td style="background: #cccc00"> </td> + <td style="background: #bbbb00"> </td> + <td style="background: #aaaa00"> </td> + <td style="background: #999900"> </td> + <td style="background: #888800"> </td> + <td style="background: #777700"> </td> + <td style="background: #666600"> </td> + <td style="background: #555500"> </td> + <td style="background: #444400"> </td> + <td style="background: #333300"> </td> + <td style="background: #222200"> </td> + <td style="background: #111100"> </td> + <td style="background: #000000"> </td> + <td style="background: black"> </td> + </tr> + </table> + + <p>The following table should have four matching rows gradually changing from white at the left to yellow at the right (plus a checkerboard at both ends to show where the rows are):</p> + + <table border="border"> + <tr> + <td style="background: black"> </td> + <td style="background: #ffffff"> </td> + <td style="background: #ffffee"> </td> + <td style="background: #ffffdd"> </td> + <td style="background: #ffffcc"> </td> + <td style="background: #ffffbb"> </td> + <td style="background: #ffffaa"> </td> + <td style="background: #ffff99"> </td> + <td style="background: #ffff88"> </td> + <td style="background: #ffff77"> </td> + <td style="background: #ffff66"> </td> + <td style="background: #ffff55"> </td> + <td style="background: #ffff44"> </td> + <td style="background: #ffff33"> </td> + <td style="background: #ffff22"> </td> + <td style="background: #ffff11"> </td> + <td style="background: #ffff00"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #ffffff"> </td> + <td style="background: #ffffee"> </td> + <td style="background: #ffffdd"> </td> + <td style="background: #ffffcc"> </td> + <td style="background: #ffffbb"> </td> + <td style="background: #ffffaa"> </td> + <td style="background: #ffff99"> </td> + <td style="background: #ffff88"> </td> + <td style="background: #ffff77"> </td> + <td style="background: #ffff66"> </td> + <td style="background: #ffff55"> </td> + <td style="background: #ffff44"> </td> + <td style="background: #ffff33"> </td> + <td style="background: #ffff22"> </td> + <td style="background: #ffff11"> </td> + <td style="background: #ffff00"> </td> + <td style="background: black"> </td> + </tr> + <tr> + <td style="background: black"> </td> + <td style="background: #ffffff"> </td> + <td style="background: #ffffee"> </td> + <td style="background: #ffffdd"> </td> + <td style="background: #ffffcc"> </td> + <td style="background: #ffffbb"> </td> + <td style="background: #ffffaa"> </td> + <td style="background: #ffff99"> </td> + <td style="background: #ffff88"> </td> + <td style="background: #ffff77"> </td> + <td style="background: #ffff66"> </td> + <td style="background: #ffff55"> </td> + <td style="background: #ffff44"> </td> + <td style="background: #ffff33"> </td> + <td style="background: #ffff22"> </td> + <td style="background: #ffff11"> </td> + <td style="background: #ffff00"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #ffffff"> </td> + <td style="background: #ffffee"> </td> + <td style="background: #ffffdd"> </td> + <td style="background: #ffffcc"> </td> + <td style="background: #ffffbb"> </td> + <td style="background: #ffffaa"> </td> + <td style="background: #ffff99"> </td> + <td style="background: #ffff88"> </td> + <td style="background: #ffff77"> </td> + <td style="background: #ffff66"> </td> + <td style="background: #ffff55"> </td> + <td style="background: #ffff44"> </td> + <td style="background: #ffff33"> </td> + <td style="background: #ffff22"> </td> + <td style="background: #ffff11"> </td> + <td style="background: #ffff00"> </td> + <td style="background: black"> </td> + </tr> + </table> + + <p>The following table should have four matching rows gradually changing from fuchsia at the left to black at the right (plus a checkerboard at both ends to show where the rows are):</p> + + <table border="border"> + <tr> + <td style="background: black"> </td> + <td style="background: #ff00ff"> </td> + <td style="background: #ee00ee"> </td> + <td style="background: #dd00dd"> </td> + <td style="background: #cc00cc"> </td> + <td style="background: #bb00bb"> </td> + <td style="background: #aa00aa"> </td> + <td style="background: #990099"> </td> + <td style="background: #880088"> </td> + <td style="background: #770077"> </td> + <td style="background: #660066"> </td> + <td style="background: #550055"> </td> + <td style="background: #440044"> </td> + <td style="background: #330033"> </td> + <td style="background: #220022"> </td> + <td style="background: #110011"> </td> + <td style="background: #000000"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #ff00ff"> </td> + <td style="background: #ee00ee"> </td> + <td style="background: #dd00dd"> </td> + <td style="background: #cc00cc"> </td> + <td style="background: #bb00bb"> </td> + <td style="background: #aa00aa"> </td> + <td style="background: #990099"> </td> + <td style="background: #880088"> </td> + <td style="background: #770077"> </td> + <td style="background: #660066"> </td> + <td style="background: #550055"> </td> + <td style="background: #440044"> </td> + <td style="background: #330033"> </td> + <td style="background: #220022"> </td> + <td style="background: #110011"> </td> + <td style="background: #000000"> </td> + <td style="background: black"> </td> + </tr> + <tr> + <td style="background: black"> </td> + <td style="background: #ff00ff"> </td> + <td style="background: #ee00ee"> </td> + <td style="background: #dd00dd"> </td> + <td style="background: #cc00cc"> </td> + <td style="background: #bb00bb"> </td> + <td style="background: #aa00aa"> </td> + <td style="background: #990099"> </td> + <td style="background: #880088"> </td> + <td style="background: #770077"> </td> + <td style="background: #660066"> </td> + <td style="background: #550055"> </td> + <td style="background: #440044"> </td> + <td style="background: #330033"> </td> + <td style="background: #220022"> </td> + <td style="background: #110011"> </td> + <td style="background: #000000"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #ff00ff"> </td> + <td style="background: #ee00ee"> </td> + <td style="background: #dd00dd"> </td> + <td style="background: #cc00cc"> </td> + <td style="background: #bb00bb"> </td> + <td style="background: #aa00aa"> </td> + <td style="background: #990099"> </td> + <td style="background: #880088"> </td> + <td style="background: #770077"> </td> + <td style="background: #660066"> </td> + <td style="background: #550055"> </td> + <td style="background: #440044"> </td> + <td style="background: #330033"> </td> + <td style="background: #220022"> </td> + <td style="background: #110011"> </td> + <td style="background: #000000"> </td> + <td style="background: black"> </td> + </tr> + </table> + + <p>The following table should have four matching rows gradually changing from white at the left to fuchsia at the right (plus a checkerboard at both ends to show where the rows are):</p> + + <table border="border"> + <tr> + <td style="background: black"> </td> + <td style="background: #ffffff"> </td> + <td style="background: #ffeeff"> </td> + <td style="background: #ffddff"> </td> + <td style="background: #ffccff"> </td> + <td style="background: #ffbbff"> </td> + <td style="background: #ffaaff"> </td> + <td style="background: #ff99ff"> </td> + <td style="background: #ff88ff"> </td> + <td style="background: #ff77ff"> </td> + <td style="background: #ff66ff"> </td> + <td style="background: #ff55ff"> </td> + <td style="background: #ff44ff"> </td> + <td style="background: #ff33ff"> </td> + <td style="background: #ff22ff"> </td> + <td style="background: #ff11ff"> </td> + <td style="background: #ff00ff"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #ffffff"> </td> + <td style="background: #ffeeff"> </td> + <td style="background: #ffddff"> </td> + <td style="background: #ffccff"> </td> + <td style="background: #ffbbff"> </td> + <td style="background: #ffaaff"> </td> + <td style="background: #ff99ff"> </td> + <td style="background: #ff88ff"> </td> + <td style="background: #ff77ff"> </td> + <td style="background: #ff66ff"> </td> + <td style="background: #ff55ff"> </td> + <td style="background: #ff44ff"> </td> + <td style="background: #ff33ff"> </td> + <td style="background: #ff22ff"> </td> + <td style="background: #ff11ff"> </td> + <td style="background: #ff00ff"> </td> + <td style="background: black"> </td> + </tr> + <tr> + <td style="background: black"> </td> + <td style="background: #ffffff"> </td> + <td style="background: #ffeeff"> </td> + <td style="background: #ffddff"> </td> + <td style="background: #ffccff"> </td> + <td style="background: #ffbbff"> </td> + <td style="background: #ffaaff"> </td> + <td style="background: #ff99ff"> </td> + <td style="background: #ff88ff"> </td> + <td style="background: #ff77ff"> </td> + <td style="background: #ff66ff"> </td> + <td style="background: #ff55ff"> </td> + <td style="background: #ff44ff"> </td> + <td style="background: #ff33ff"> </td> + <td style="background: #ff22ff"> </td> + <td style="background: #ff11ff"> </td> + <td style="background: #ff00ff"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #ffffff"> </td> + <td style="background: #ffeeff"> </td> + <td style="background: #ffddff"> </td> + <td style="background: #ffccff"> </td> + <td style="background: #ffbbff"> </td> + <td style="background: #ffaaff"> </td> + <td style="background: #ff99ff"> </td> + <td style="background: #ff88ff"> </td> + <td style="background: #ff77ff"> </td> + <td style="background: #ff66ff"> </td> + <td style="background: #ff55ff"> </td> + <td style="background: #ff44ff"> </td> + <td style="background: #ff33ff"> </td> + <td style="background: #ff22ff"> </td> + <td style="background: #ff11ff"> </td> + <td style="background: #ff00ff"> </td> + <td style="background: black"> </td> + </tr> + </table> + + <p>The following table should have four matching rows gradually changing from aqua at the left to black at the right (plus a checkerboard at both ends to show where the rows are):</p> + + <table border="border"> + <tr> + <td style="background: black"> </td> + <td style="background: #00ffff"> </td> + <td style="background: #00eeee"> </td> + <td style="background: #00dddd"> </td> + <td style="background: #00cccc"> </td> + <td style="background: #00bbbb"> </td> + <td style="background: #00aaaa"> </td> + <td style="background: #009999"> </td> + <td style="background: #008888"> </td> + <td style="background: #007777"> </td> + <td style="background: #006666"> </td> + <td style="background: #005555"> </td> + <td style="background: #004444"> </td> + <td style="background: #003333"> </td> + <td style="background: #002222"> </td> + <td style="background: #001111"> </td> + <td style="background: #000000"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #00ffff"> </td> + <td style="background: #00eeee"> </td> + <td style="background: #00dddd"> </td> + <td style="background: #00cccc"> </td> + <td style="background: #00bbbb"> </td> + <td style="background: #00aaaa"> </td> + <td style="background: #009999"> </td> + <td style="background: #008888"> </td> + <td style="background: #007777"> </td> + <td style="background: #006666"> </td> + <td style="background: #005555"> </td> + <td style="background: #004444"> </td> + <td style="background: #003333"> </td> + <td style="background: #002222"> </td> + <td style="background: #001111"> </td> + <td style="background: #000000"> </td> + <td style="background: black"> </td> + </tr> + <tr> + <td style="background: black"> </td> + <td style="background: #00ffff"> </td> + <td style="background: #00eeee"> </td> + <td style="background: #00dddd"> </td> + <td style="background: #00cccc"> </td> + <td style="background: #00bbbb"> </td> + <td style="background: #00aaaa"> </td> + <td style="background: #009999"> </td> + <td style="background: #008888"> </td> + <td style="background: #007777"> </td> + <td style="background: #006666"> </td> + <td style="background: #005555"> </td> + <td style="background: #004444"> </td> + <td style="background: #003333"> </td> + <td style="background: #002222"> </td> + <td style="background: #001111"> </td> + <td style="background: #000000"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #00ffff"> </td> + <td style="background: #00eeee"> </td> + <td style="background: #00dddd"> </td> + <td style="background: #00cccc"> </td> + <td style="background: #00bbbb"> </td> + <td style="background: #00aaaa"> </td> + <td style="background: #009999"> </td> + <td style="background: #008888"> </td> + <td style="background: #007777"> </td> + <td style="background: #006666"> </td> + <td style="background: #005555"> </td> + <td style="background: #004444"> </td> + <td style="background: #003333"> </td> + <td style="background: #002222"> </td> + <td style="background: #001111"> </td> + <td style="background: #000000"> </td> + <td style="background: black"> </td> + </tr> + </table> + + <p>The following table should have four matching rows gradually changing from white at the left to aqua at the right (plus a checkerboard at both ends to show where the rows are):</p> + + <table border="border"> + <tr> + <td style="background: black"> </td> + <td style="background: #ffffff"> </td> + <td style="background: #eeffff"> </td> + <td style="background: #ddffff"> </td> + <td style="background: #ccffff"> </td> + <td style="background: #bbffff"> </td> + <td style="background: #aaffff"> </td> + <td style="background: #99ffff"> </td> + <td style="background: #88ffff"> </td> + <td style="background: #77ffff"> </td> + <td style="background: #66ffff"> </td> + <td style="background: #55ffff"> </td> + <td style="background: #44ffff"> </td> + <td style="background: #33ffff"> </td> + <td style="background: #22ffff"> </td> + <td style="background: #11ffff"> </td> + <td style="background: #00ffff"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #ffffff"> </td> + <td style="background: #eeffff"> </td> + <td style="background: #ddffff"> </td> + <td style="background: #ccffff"> </td> + <td style="background: #bbffff"> </td> + <td style="background: #aaffff"> </td> + <td style="background: #99ffff"> </td> + <td style="background: #88ffff"> </td> + <td style="background: #77ffff"> </td> + <td style="background: #66ffff"> </td> + <td style="background: #55ffff"> </td> + <td style="background: #44ffff"> </td> + <td style="background: #33ffff"> </td> + <td style="background: #22ffff"> </td> + <td style="background: #11ffff"> </td> + <td style="background: #00ffff"> </td> + <td style="background: black"> </td> + </tr> + <tr> + <td style="background: black"> </td> + <td style="background: #ffffff"> </td> + <td style="background: #eeffff"> </td> + <td style="background: #ddffff"> </td> + <td style="background: #ccffff"> </td> + <td style="background: #bbffff"> </td> + <td style="background: #aaffff"> </td> + <td style="background: #99ffff"> </td> + <td style="background: #88ffff"> </td> + <td style="background: #77ffff"> </td> + <td style="background: #66ffff"> </td> + <td style="background: #55ffff"> </td> + <td style="background: #44ffff"> </td> + <td style="background: #33ffff"> </td> + <td style="background: #22ffff"> </td> + <td style="background: #11ffff"> </td> + <td style="background: #00ffff"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #ffffff"> </td> + <td style="background: #eeffff"> </td> + <td style="background: #ddffff"> </td> + <td style="background: #ccffff"> </td> + <td style="background: #bbffff"> </td> + <td style="background: #aaffff"> </td> + <td style="background: #99ffff"> </td> + <td style="background: #88ffff"> </td> + <td style="background: #77ffff"> </td> + <td style="background: #66ffff"> </td> + <td style="background: #55ffff"> </td> + <td style="background: #44ffff"> </td> + <td style="background: #33ffff"> </td> + <td style="background: #22ffff"> </td> + <td style="background: #11ffff"> </td> + <td style="background: #00ffff"> </td> + <td style="background: black"> </td> + </tr> + </table> + + <p>The following table should have four matching rows gradually changing from red at the left to green at the right (plus a checkerboard at both ends to show where the rows are):</p> + + <table border="border"> + <tr> + <td style="background: black"> </td> + <td style="background: #ff0000"> </td> + <td style="background: #ee1100"> </td> + <td style="background: #dd2200"> </td> + <td style="background: #cc3300"> </td> + <td style="background: #bb4400"> </td> + <td style="background: #aa5500"> </td> + <td style="background: #996600"> </td> + <td style="background: #887700"> </td> + <td style="background: #778800"> </td> + <td style="background: #669900"> </td> + <td style="background: #55aa00"> </td> + <td style="background: #44bb00"> </td> + <td style="background: #33cc00"> </td> + <td style="background: #22dd00"> </td> + <td style="background: #11ee00"> </td> + <td style="background: #00ff00"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #ff0000"> </td> + <td style="background: #ee1100"> </td> + <td style="background: #dd2200"> </td> + <td style="background: #cc3300"> </td> + <td style="background: #bb4400"> </td> + <td style="background: #aa5500"> </td> + <td style="background: #996600"> </td> + <td style="background: #887700"> </td> + <td style="background: #778800"> </td> + <td style="background: #669900"> </td> + <td style="background: #55aa00"> </td> + <td style="background: #44bb00"> </td> + <td style="background: #33cc00"> </td> + <td style="background: #22dd00"> </td> + <td style="background: #11ee00"> </td> + <td style="background: #00ff00"> </td> + <td style="background: black"> </td> + </tr> + <tr> + <td style="background: black"> </td> + <td style="background: #ff0000"> </td> + <td style="background: #ee1100"> </td> + <td style="background: #dd2200"> </td> + <td style="background: #cc3300"> </td> + <td style="background: #bb4400"> </td> + <td style="background: #aa5500"> </td> + <td style="background: #996600"> </td> + <td style="background: #887700"> </td> + <td style="background: #778800"> </td> + <td style="background: #669900"> </td> + <td style="background: #55aa00"> </td> + <td style="background: #44bb00"> </td> + <td style="background: #33cc00"> </td> + <td style="background: #22dd00"> </td> + <td style="background: #11ee00"> </td> + <td style="background: #00ff00"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #ff0000"> </td> + <td style="background: #ee1100"> </td> + <td style="background: #dd2200"> </td> + <td style="background: #cc3300"> </td> + <td style="background: #bb4400"> </td> + <td style="background: #aa5500"> </td> + <td style="background: #996600"> </td> + <td style="background: #887700"> </td> + <td style="background: #778800"> </td> + <td style="background: #669900"> </td> + <td style="background: #55aa00"> </td> + <td style="background: #44bb00"> </td> + <td style="background: #33cc00"> </td> + <td style="background: #22dd00"> </td> + <td style="background: #11ee00"> </td> + <td style="background: #00ff00"> </td> + <td style="background: black"> </td> + </tr> + </table> + + <p>The following table should have four matching rows gradually changing from green at the left to blue at the right (plus a checkerboard at both ends to show where the rows are):</p> + + <table border="border"> + <tr> + <td style="background: black"> </td> + <td style="background: #00ff00"> </td> + <td style="background: #00ee11"> </td> + <td style="background: #00dd22"> </td> + <td style="background: #00cc33"> </td> + <td style="background: #00bb44"> </td> + <td style="background: #00aa55"> </td> + <td style="background: #009966"> </td> + <td style="background: #008877"> </td> + <td style="background: #007788"> </td> + <td style="background: #006699"> </td> + <td style="background: #0055aa"> </td> + <td style="background: #0044bb"> </td> + <td style="background: #0033cc"> </td> + <td style="background: #0022dd"> </td> + <td style="background: #0011ee"> </td> + <td style="background: #0000ff"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #00ff00"> </td> + <td style="background: #00ee11"> </td> + <td style="background: #00dd22"> </td> + <td style="background: #00cc33"> </td> + <td style="background: #00bb44"> </td> + <td style="background: #00aa55"> </td> + <td style="background: #009966"> </td> + <td style="background: #008877"> </td> + <td style="background: #007788"> </td> + <td style="background: #006699"> </td> + <td style="background: #0055aa"> </td> + <td style="background: #0044bb"> </td> + <td style="background: #0033cc"> </td> + <td style="background: #0022dd"> </td> + <td style="background: #0011ee"> </td> + <td style="background: #0000ff"> </td> + <td style="background: black"> </td> + </tr> + <tr> + <td style="background: black"> </td> + <td style="background: #00ff00"> </td> + <td style="background: #00ee11"> </td> + <td style="background: #00dd22"> </td> + <td style="background: #00cc33"> </td> + <td style="background: #00bb44"> </td> + <td style="background: #00aa55"> </td> + <td style="background: #009966"> </td> + <td style="background: #008877"> </td> + <td style="background: #007788"> </td> + <td style="background: #006699"> </td> + <td style="background: #0055aa"> </td> + <td style="background: #0044bb"> </td> + <td style="background: #0033cc"> </td> + <td style="background: #0022dd"> </td> + <td style="background: #0011ee"> </td> + <td style="background: #0000ff"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #00ff00"> </td> + <td style="background: #00ee11"> </td> + <td style="background: #00dd22"> </td> + <td style="background: #00cc33"> </td> + <td style="background: #00bb44"> </td> + <td style="background: #00aa55"> </td> + <td style="background: #009966"> </td> + <td style="background: #008877"> </td> + <td style="background: #007788"> </td> + <td style="background: #006699"> </td> + <td style="background: #0055aa"> </td> + <td style="background: #0044bb"> </td> + <td style="background: #0033cc"> </td> + <td style="background: #0022dd"> </td> + <td style="background: #0011ee"> </td> + <td style="background: #0000ff"> </td> + <td style="background: black"> </td> + </tr> + </table> + + <p>The following table should have four matching rows gradually changing from blue at the left to red at the right (plus a checkerboard at both ends to show where the rows are):</p> + + <table border="border"> + <tr> + <td style="background: black"> </td> + <td style="background: #00ff00"> </td> + <td style="background: #00ee11"> </td> + <td style="background: #00dd22"> </td> + <td style="background: #00cc33"> </td> + <td style="background: #00bb44"> </td> + <td style="background: #00aa55"> </td> + <td style="background: #009966"> </td> + <td style="background: #008877"> </td> + <td style="background: #007788"> </td> + <td style="background: #006699"> </td> + <td style="background: #0055aa"> </td> + <td style="background: #0044bb"> </td> + <td style="background: #0033cc"> </td> + <td style="background: #0022dd"> </td> + <td style="background: #0011ee"> </td> + <td style="background: #0000ff"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #00ff00"> </td> + <td style="background: #00ee11"> </td> + <td style="background: #00dd22"> </td> + <td style="background: #00cc33"> </td> + <td style="background: #00bb44"> </td> + <td style="background: #00aa55"> </td> + <td style="background: #009966"> </td> + <td style="background: #008877"> </td> + <td style="background: #007788"> </td> + <td style="background: #006699"> </td> + <td style="background: #0055aa"> </td> + <td style="background: #0044bb"> </td> + <td style="background: #0033cc"> </td> + <td style="background: #0022dd"> </td> + <td style="background: #0011ee"> </td> + <td style="background: #0000ff"> </td> + <td style="background: black"> </td> + </tr> + <tr> + <td style="background: black"> </td> + <td style="background: #00ff00"> </td> + <td style="background: #00ee11"> </td> + <td style="background: #00dd22"> </td> + <td style="background: #00cc33"> </td> + <td style="background: #00bb44"> </td> + <td style="background: #00aa55"> </td> + <td style="background: #009966"> </td> + <td style="background: #008877"> </td> + <td style="background: #007788"> </td> + <td style="background: #006699"> </td> + <td style="background: #0055aa"> </td> + <td style="background: #0044bb"> </td> + <td style="background: #0033cc"> </td> + <td style="background: #0022dd"> </td> + <td style="background: #0011ee"> </td> + <td style="background: #0000ff"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #00ff00"> </td> + <td style="background: #00ee11"> </td> + <td style="background: #00dd22"> </td> + <td style="background: #00cc33"> </td> + <td style="background: #00bb44"> </td> + <td style="background: #00aa55"> </td> + <td style="background: #009966"> </td> + <td style="background: #008877"> </td> + <td style="background: #007788"> </td> + <td style="background: #006699"> </td> + <td style="background: #0055aa"> </td> + <td style="background: #0044bb"> </td> + <td style="background: #0033cc"> </td> + <td style="background: #0022dd"> </td> + <td style="background: #0011ee"> </td> + <td style="background: #0000ff"> </td> + <td style="background: black"> </td> + </tr> + </table> + + <p>The following table should have four matching rows gradually changing from fuchsia at the left to aqua at the right (plus a checkerboard at both ends to show where the rows are):</p> + + <table border="border"> + <tr> + <td style="background: black"> </td> + <td style="background: #ff00ff"> </td> + <td style="background: #ee11ff"> </td> + <td style="background: #dd22ff"> </td> + <td style="background: #cc33ff"> </td> + <td style="background: #bb44ff"> </td> + <td style="background: #aa55ff"> </td> + <td style="background: #9966ff"> </td> + <td style="background: #8877ff"> </td> + <td style="background: #7788ff"> </td> + <td style="background: #6699ff"> </td> + <td style="background: #55aaff"> </td> + <td style="background: #44bbff"> </td> + <td style="background: #33ccff"> </td> + <td style="background: #22ddff"> </td> + <td style="background: #11eeff"> </td> + <td style="background: #00ffff"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #ff00ff"> </td> + <td style="background: #ee11ff"> </td> + <td style="background: #dd22ff"> </td> + <td style="background: #cc33ff"> </td> + <td style="background: #bb44ff"> </td> + <td style="background: #aa55ff"> </td> + <td style="background: #9966ff"> </td> + <td style="background: #8877ff"> </td> + <td style="background: #7788ff"> </td> + <td style="background: #6699ff"> </td> + <td style="background: #55aaff"> </td> + <td style="background: #44bbff"> </td> + <td style="background: #33ccff"> </td> + <td style="background: #22ddff"> </td> + <td style="background: #11eeff"> </td> + <td style="background: #00ffff"> </td> + <td style="background: black"> </td> + </tr> + <tr> + <td style="background: black"> </td> + <td style="background: #ff00ff"> </td> + <td style="background: #ee11ff"> </td> + <td style="background: #dd22ff"> </td> + <td style="background: #cc33ff"> </td> + <td style="background: #bb44ff"> </td> + <td style="background: #aa55ff"> </td> + <td style="background: #9966ff"> </td> + <td style="background: #8877ff"> </td> + <td style="background: #7788ff"> </td> + <td style="background: #6699ff"> </td> + <td style="background: #55aaff"> </td> + <td style="background: #44bbff"> </td> + <td style="background: #33ccff"> </td> + <td style="background: #22ddff"> </td> + <td style="background: #11eeff"> </td> + <td style="background: #00ffff"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #ff00ff"> </td> + <td style="background: #ee11ff"> </td> + <td style="background: #dd22ff"> </td> + <td style="background: #cc33ff"> </td> + <td style="background: #bb44ff"> </td> + <td style="background: #aa55ff"> </td> + <td style="background: #9966ff"> </td> + <td style="background: #8877ff"> </td> + <td style="background: #7788ff"> </td> + <td style="background: #6699ff"> </td> + <td style="background: #55aaff"> </td> + <td style="background: #44bbff"> </td> + <td style="background: #33ccff"> </td> + <td style="background: #22ddff"> </td> + <td style="background: #11eeff"> </td> + <td style="background: #00ffff"> </td> + <td style="background: black"> </td> + </tr> + </table> + + <p>The following table should have four matching rows gradually changing from yellow at the left to fuchsia at the right (plus a checkerboard at both ends to show where the rows are):</p> + + <table border="border"> + <tr> + <td style="background: black"> </td> + <td style="background: #ffff00"> </td> + <td style="background: #ffee11"> </td> + <td style="background: #ffdd22"> </td> + <td style="background: #ffcc33"> </td> + <td style="background: #ffbb44"> </td> + <td style="background: #ffaa55"> </td> + <td style="background: #ff9966"> </td> + <td style="background: #ff8877"> </td> + <td style="background: #ff7788"> </td> + <td style="background: #ff6699"> </td> + <td style="background: #ff55aa"> </td> + <td style="background: #ff44bb"> </td> + <td style="background: #ff33cc"> </td> + <td style="background: #ff22dd"> </td> + <td style="background: #ff11ee"> </td> + <td style="background: #ff00ff"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #ffff00"> </td> + <td style="background: #ffee11"> </td> + <td style="background: #ffdd22"> </td> + <td style="background: #ffcc33"> </td> + <td style="background: #ffbb44"> </td> + <td style="background: #ffaa55"> </td> + <td style="background: #ff9966"> </td> + <td style="background: #ff8877"> </td> + <td style="background: #ff7788"> </td> + <td style="background: #ff6699"> </td> + <td style="background: #ff55aa"> </td> + <td style="background: #ff44bb"> </td> + <td style="background: #ff33cc"> </td> + <td style="background: #ff22dd"> </td> + <td style="background: #ff11ee"> </td> + <td style="background: #ff00ff"> </td> + <td style="background: black"> </td> + </tr> + <tr> + <td style="background: black"> </td> + <td style="background: #ffff00"> </td> + <td style="background: #ffee11"> </td> + <td style="background: #ffdd22"> </td> + <td style="background: #ffcc33"> </td> + <td style="background: #ffbb44"> </td> + <td style="background: #ffaa55"> </td> + <td style="background: #ff9966"> </td> + <td style="background: #ff8877"> </td> + <td style="background: #ff7788"> </td> + <td style="background: #ff6699"> </td> + <td style="background: #ff55aa"> </td> + <td style="background: #ff44bb"> </td> + <td style="background: #ff33cc"> </td> + <td style="background: #ff22dd"> </td> + <td style="background: #ff11ee"> </td> + <td style="background: #ff00ff"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #ffff00"> </td> + <td style="background: #ffee11"> </td> + <td style="background: #ffdd22"> </td> + <td style="background: #ffcc33"> </td> + <td style="background: #ffbb44"> </td> + <td style="background: #ffaa55"> </td> + <td style="background: #ff9966"> </td> + <td style="background: #ff8877"> </td> + <td style="background: #ff7788"> </td> + <td style="background: #ff6699"> </td> + <td style="background: #ff55aa"> </td> + <td style="background: #ff44bb"> </td> + <td style="background: #ff33cc"> </td> + <td style="background: #ff22dd"> </td> + <td style="background: #ff11ee"> </td> + <td style="background: #ff00ff"> </td> + <td style="background: black"> </td> + </tr> + </table> + + <p>The following table should have four matching rows gradually changing from aqua at the left to yellow at the right (plus a checkerboard at both ends to show where the rows are):</p> + + <table border="border"> + <tr> + <td style="background: black"> </td> + <td style="background: #00ffff"> </td> + <td style="background: #11ffee"> </td> + <td style="background: #22ffdd"> </td> + <td style="background: #33ffcc"> </td> + <td style="background: #44ffbb"> </td> + <td style="background: #55ffaa"> </td> + <td style="background: #66ff99"> </td> + <td style="background: #77ff88"> </td> + <td style="background: #88ff77"> </td> + <td style="background: #99ff66"> </td> + <td style="background: #aaff55"> </td> + <td style="background: #bbff44"> </td> + <td style="background: #ccff33"> </td> + <td style="background: #ddff22"> </td> + <td style="background: #eeff11"> </td> + <td style="background: #ffff00"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #00ffff"> </td> + <td style="background: #11ffee"> </td> + <td style="background: #22ffdd"> </td> + <td style="background: #33ffcc"> </td> + <td style="background: #44ffbb"> </td> + <td style="background: #55ffaa"> </td> + <td style="background: #66ff99"> </td> + <td style="background: #77ff88"> </td> + <td style="background: #88ff77"> </td> + <td style="background: #99ff66"> </td> + <td style="background: #aaff55"> </td> + <td style="background: #bbff44"> </td> + <td style="background: #ccff33"> </td> + <td style="background: #ddff22"> </td> + <td style="background: #eeff11"> </td> + <td style="background: #ffff00"> </td> + <td style="background: black"> </td> + </tr> + <tr> + <td style="background: black"> </td> + <td style="background: #00ffff"> </td> + <td style="background: #11ffee"> </td> + <td style="background: #22ffdd"> </td> + <td style="background: #33ffcc"> </td> + <td style="background: #44ffbb"> </td> + <td style="background: #55ffaa"> </td> + <td style="background: #66ff99"> </td> + <td style="background: #77ff88"> </td> + <td style="background: #88ff77"> </td> + <td style="background: #99ff66"> </td> + <td style="background: #aaff55"> </td> + <td style="background: #bbff44"> </td> + <td style="background: #ccff33"> </td> + <td style="background: #ddff22"> </td> + <td style="background: #eeff11"> </td> + <td style="background: #ffff00"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: #00ffff"> </td> + <td style="background: #11ffee"> </td> + <td style="background: #22ffdd"> </td> + <td style="background: #33ffcc"> </td> + <td style="background: #44ffbb"> </td> + <td style="background: #55ffaa"> </td> + <td style="background: #66ff99"> </td> + <td style="background: #77ff88"> </td> + <td style="background: #88ff77"> </td> + <td style="background: #99ff66"> </td> + <td style="background: #aaff55"> </td> + <td style="background: #bbff44"> </td> + <td style="background: #ccff33"> </td> + <td style="background: #ddff22"> </td> + <td style="background: #eeff11"> </td> + <td style="background: #ffff00"> </td> + <td style="background: black"> </td> + </tr> + </table> +</body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t421-rgb-values-meaning-b.xht b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t421-rgb-values-meaning-b.xht index 760a4416..b628d3e 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t421-rgb-values-meaning-b.xht +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t421-rgb-values-meaning-b.xht
@@ -5,6 +5,7 @@ <link rel="author" title="L. David Baron" href="https://dbaron.org/" /> <link rel="author" title="Mozilla Corporation" href="http://mozilla.com/" /> <link rel="help" href="http://www.w3.org/TR/css3-color/#rgb-color" /> + <link rel="match" href="t421-rgb-values-meaning-b-ref.html" /> <meta name="flags" content="" /> <meta name="assert" content="Test that the color components in rgb colors are interpreted correctly." /> <style type="text/css"><![CDATA[
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t422-rgba-a0.0-a.xht b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t422-rgba-a0.0-a.xht index fe3d5c3..28f41b8 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t422-rgba-a0.0-a.xht +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t422-rgba-a0.0-a.xht
@@ -5,6 +5,7 @@ <link rel="author" title="L. David Baron" href="https://dbaron.org/" /> <link rel="author" title="Mozilla Corporation" href="http://mozilla.com/" /> <link rel="help" href="http://www.w3.org/TR/css3-color/#rgba-color" /> + <link rel="match" href="t32-opacity-basic-0.0-a-ref.html" /> <meta name="flags" content="" /> <meta name="assert" content="Opacity of 0.0 makes text transparent." /> <style type="text/css"><![CDATA[
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t422-rgba-values-meaning-b-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t422-rgba-values-meaning-b-ref.html new file mode 100644 index 0000000..08631f2e --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t422-rgba-values-meaning-b-ref.html
@@ -0,0 +1,432 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Reference</title> +<style> + table { border-spacing: 0; padding: 0; border: none; } + td { border: none; padding: 0; } + td { width: 1.2em; height: 1.2em; } +</style> +<body> + <p>The following table should have four matching rows changing (in 5 steps) from red at the left to black at the right: (plus a checkerboard at both ends to show where the rows are):</p> + + <div style="background: black"> + <table border="border"> + <tr> + <td style="background: black"> </td> + <td style="background: rgb(255, 0, 0)"> </td> + <td style="background: rgb(204, 0, 0)"> </td> + <td style="background: rgb(153, 0, 0)"> </td> + <td style="background: rgb(102, 0, 0)"> </td> + <td style="background: rgb(51, 0, 0)"> </td> + <td style="background: rgb(0, 0, 0)"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: rgb(255, 0, 0)"> </td> + <td style="background: rgb(204, 0, 0)"> </td> + <td style="background: rgb(153, 0, 0)"> </td> + <td style="background: rgb(102, 0, 0)"> </td> + <td style="background: rgb(51, 0, 0)"> </td> + <td style="background: rgb(0, 0, 0)"> </td> + <td style="background: black"> </td> + </tr> + <tr> + <td style="background: black"> </td> + <td style="background: rgb(255, 0, 0)"> </td> + <td style="background: rgb(204, 0, 0)"> </td> + <td style="background: rgb(153, 0, 0)"> </td> + <td style="background: rgb(102, 0, 0)"> </td> + <td style="background: rgb(51, 0, 0)"> </td> + <td style="background: rgb(0, 0, 0)"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: rgb(255, 0, 0)"> </td> + <td style="background: rgb(204, 0, 0)"> </td> + <td style="background: rgb(153, 0, 0)"> </td> + <td style="background: rgb(102, 0, 0)"> </td> + <td style="background: rgb(51, 0, 0)"> </td> + <td style="background: rgb(0, 0, 0)"> </td> + <td style="background: black"> </td> + </tr> + </table> + </div> + + <p>The following table should have four matching rows changing (in 5 steps) from red at the left to white at the right: (plus a checkerboard at both ends to show where the rows are):</p> + + <div style="background: white"> + <table border="border"> + <tr> + <td style="background: black"> </td> + <td style="background: rgb(255, 0, 0)"> </td> + <td style="background: rgb(255, 51, 51)"> </td> + <td style="background: rgb(255, 102, 102)"> </td> + <td style="background: rgb(255, 153, 153)"> </td> + <td style="background: rgb(255, 204, 204)"> </td> + <td style="background: rgb(255, 255, 255)"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: rgb(255, 0, 0)"> </td> + <td style="background: rgb(255, 51, 51)"> </td> + <td style="background: rgb(255, 102, 102)"> </td> + <td style="background: rgb(255, 153, 153)"> </td> + <td style="background: rgb(255, 204, 204)"> </td> + <td style="background: rgb(255, 255, 255)"> </td> + <td style="background: black"> </td> + </tr> + <tr> + <td style="background: black"> </td> + <td style="background: rgb(255, 0, 0)"> </td> + <td style="background: rgb(255, 51, 51)"> </td> + <td style="background: rgb(255, 102, 102)"> </td> + <td style="background: rgb(255, 153, 153)"> </td> + <td style="background: rgb(255, 204, 204)"> </td> + <td style="background: rgb(255, 255, 255)"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: rgb(255, 0, 0)"> </td> + <td style="background: rgb(255, 51, 51)"> </td> + <td style="background: rgb(255, 102, 102)"> </td> + <td style="background: rgb(255, 153, 153)"> </td> + <td style="background: rgb(255, 204, 204)"> </td> + <td style="background: rgb(255, 255, 255)"> </td> + <td style="background: black"> </td> + </tr> + </table> + </div> + + <p>The following table should have four matching rows changing (in 5 steps) from green at the left to black at the right: (plus a checkerboard at both ends to show where the rows are):</p> + + <div style="background: black"> + <table border="border"> + <tr> + <td style="background: black"> </td> + <td style="background: rgb(0, 255, 0)"> </td> + <td style="background: rgb(0, 204, 0)"> </td> + <td style="background: rgb(0, 153, 0)"> </td> + <td style="background: rgb(0, 102, 0)"> </td> + <td style="background: rgb(0, 51, 0)"> </td> + <td style="background: rgb(0, 0, 0)"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: rgb(0, 255, 0)"> </td> + <td style="background: rgb(0, 204, 0)"> </td> + <td style="background: rgb(0, 153, 0)"> </td> + <td style="background: rgb(0, 102, 0)"> </td> + <td style="background: rgb(0, 51, 0)"> </td> + <td style="background: rgb(0, 0, 0)"> </td> + <td style="background: black"> </td> + </tr> + <tr> + <td style="background: black"> </td> + <td style="background: rgb(0, 255, 0)"> </td> + <td style="background: rgb(0, 204, 0)"> </td> + <td style="background: rgb(0, 153, 0)"> </td> + <td style="background: rgb(0, 102, 0)"> </td> + <td style="background: rgb(0, 51, 0)"> </td> + <td style="background: rgb(0, 0, 0)"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: rgb(0, 255, 0)"> </td> + <td style="background: rgb(0, 204, 0)"> </td> + <td style="background: rgb(0, 153, 0)"> </td> + <td style="background: rgb(0, 102, 0)"> </td> + <td style="background: rgb(0, 51, 0)"> </td> + <td style="background: rgb(0, 0, 0)"> </td> + <td style="background: black"> </td> + </tr> + </table> + </div> + + <p>The following table should have four matching rows changing (in 5 steps) from green at the left to white at the right: (plus a checkerboard at both ends to show where the rows are):</p> + + <div style="background: white"> + <table border="border"> + <tr> + <td style="background: black"> </td> + <td style="background: rgb(0, 255, 0)"> </td> + <td style="background: rgb(51, 255, 51)"> </td> + <td style="background: rgb(102, 255, 102)"> </td> + <td style="background: rgb(153, 255, 153)"> </td> + <td style="background: rgb(204, 255, 204)"> </td> + <td style="background: rgb(255, 255, 255)"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: rgb(0, 255, 0)"> </td> + <td style="background: rgb(51, 255, 51)"> </td> + <td style="background: rgb(102, 255, 102)"> </td> + <td style="background: rgb(153, 255, 153)"> </td> + <td style="background: rgb(204, 255, 204)"> </td> + <td style="background: rgb(255, 255, 255)"> </td> + <td style="background: black"> </td> + </tr> + <tr> + <td style="background: black"> </td> + <td style="background: rgb(0, 255, 0)"> </td> + <td style="background: rgb(51, 255, 51)"> </td> + <td style="background: rgb(102, 255, 102)"> </td> + <td style="background: rgb(153, 255, 153)"> </td> + <td style="background: rgb(204, 255, 204)"> </td> + <td style="background: rgb(255, 255, 255)"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: rgb(0, 255, 0)"> </td> + <td style="background: rgb(51, 255, 51)"> </td> + <td style="background: rgb(102, 255, 102)"> </td> + <td style="background: rgb(153, 255, 153)"> </td> + <td style="background: rgb(204, 255, 204)"> </td> + <td style="background: rgb(255, 255, 255)"> </td> + <td style="background: black"> </td> + </tr> + </table> + </div> + + <p>The following table should have four matching rows changing (in 5 steps) from blue at the left to black at the right: (plus a checkerboard at both ends to show where the rows are):</p> + + <div style="background: black"> + <table border="border"> + <tr> + <td style="background: black"> </td> + <td style="background: rgb(0, 0, 255)"> </td> + <td style="background: rgb(0, 0, 204)"> </td> + <td style="background: rgb(0, 0, 153)"> </td> + <td style="background: rgb(0, 0, 102)"> </td> + <td style="background: rgb(0, 0, 51)"> </td> + <td style="background: rgb(0, 0, 0)"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: rgb(0, 0, 255)"> </td> + <td style="background: rgb(0, 0, 204)"> </td> + <td style="background: rgb(0, 0, 153)"> </td> + <td style="background: rgb(0, 0, 102)"> </td> + <td style="background: rgb(0, 0, 51)"> </td> + <td style="background: rgb(0, 0, 0)"> </td> + <td style="background: black"> </td> + </tr> + <tr> + <td style="background: black"> </td> + <td style="background: rgb(0, 0, 255)"> </td> + <td style="background: rgb(0, 0, 204)"> </td> + <td style="background: rgb(0, 0, 153)"> </td> + <td style="background: rgb(0, 0, 102)"> </td> + <td style="background: rgb(0, 0, 51)"> </td> + <td style="background: rgb(0, 0, 0)"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: rgb(0, 0, 255)"> </td> + <td style="background: rgb(0, 0, 204)"> </td> + <td style="background: rgb(0, 0, 153)"> </td> + <td style="background: rgb(0, 0, 102)"> </td> + <td style="background: rgb(0, 0, 51)"> </td> + <td style="background: rgb(0, 0, 0)"> </td> + <td style="background: black"> </td> + </tr> + </table> + </div> + + <p>The following table should have four matching rows changing (in 5 steps) from blue at the left to white at the right: (plus a checkerboard at both ends to show where the rows are):</p> + + <div style="background: white"> + <table border="border"> + <tr> + <td style="background: black"> </td> + <td style="background: rgb(0, 0, 255)"> </td> + <td style="background: rgb(51, 51, 255)"> </td> + <td style="background: rgb(102, 102, 255)"> </td> + <td style="background: rgb(153, 153, 255)"> </td> + <td style="background: rgb(204, 204, 255)"> </td> + <td style="background: rgb(255, 255, 255)"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: rgb(0, 0, 255)"> </td> + <td style="background: rgb(51, 51, 255)"> </td> + <td style="background: rgb(102, 102, 255)"> </td> + <td style="background: rgb(153, 153, 255)"> </td> + <td style="background: rgb(204, 204, 255)"> </td> + <td style="background: rgb(255, 255, 255)"> </td> + <td style="background: black"> </td> + </tr> + <tr> + <td style="background: black"> </td> + <td style="background: rgb(0, 0, 255)"> </td> + <td style="background: rgb(51, 51, 255)"> </td> + <td style="background: rgb(102, 102, 255)"> </td> + <td style="background: rgb(153, 153, 255)"> </td> + <td style="background: rgb(204, 204, 255)"> </td> + <td style="background: rgb(255, 255, 255)"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: rgb(0, 0, 255)"> </td> + <td style="background: rgb(51, 51, 255)"> </td> + <td style="background: rgb(102, 102, 255)"> </td> + <td style="background: rgb(153, 153, 255)"> </td> + <td style="background: rgb(204, 204, 255)"> </td> + <td style="background: rgb(255, 255, 255)"> </td> + <td style="background: black"> </td> + </tr> + </table> + </div> + + <p>The following table should have four matching rows changing (in 5 steps) from red at the left to green at the right: (plus a checkerboard at both ends to show where the rows are):</p> + + <div style="background: lime"> + <table border="border"> + <tr> + <td style="background: black"> </td> + <td style="background: rgb(255, 0, 0)"> </td> + <td style="background: rgb(204, 51, 0)"> </td> + <td style="background: rgb(153, 102, 0)"> </td> + <td style="background: rgb(102, 153, 0)"> </td> + <td style="background: rgb(51, 204, 0)"> </td> + <td style="background: rgb(0, 255, 0)"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: rgb(255, 0, 0)"> </td> + <td style="background: rgb(204, 51, 0)"> </td> + <td style="background: rgb(153, 102, 0)"> </td> + <td style="background: rgb(102, 153, 0)"> </td> + <td style="background: rgb(51, 204, 0)"> </td> + <td style="background: rgb(0, 255, 0)"> </td> + <td style="background: black"> </td> + </tr> + <tr> + <td style="background: black"> </td> + <td style="background: rgb(255, 0, 0)"> </td> + <td style="background: rgb(204, 51, 0)"> </td> + <td style="background: rgb(153, 102, 0)"> </td> + <td style="background: rgb(102, 153, 0)"> </td> + <td style="background: rgb(51, 204, 0)"> </td> + <td style="background: rgb(0, 255, 0)"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: rgb(255, 0, 0)"> </td> + <td style="background: rgb(204, 51, 0)"> </td> + <td style="background: rgb(153, 102, 0)"> </td> + <td style="background: rgb(102, 153, 0)"> </td> + <td style="background: rgb(51, 204, 0)"> </td> + <td style="background: rgb(0, 255, 0)"> </td> + <td style="background: black"> </td> + </tr> + </table> + </div> + + <p>The following table should have four matching rows changing (in 5 steps) from green at the left to blue at the right: (plus a checkerboard at both ends to show where the rows are):</p> + + <div style="background: blue"> + <table border="border"> + <tr> + <td style="background: black"> </td> + <td style="background: rgb(0, 255, 0)"> </td> + <td style="background: rgb(0, 204, 51)"> </td> + <td style="background: rgb(0, 153, 102)"> </td> + <td style="background: rgb(0, 102, 153)"> </td> + <td style="background: rgb(0, 51, 204)"> </td> + <td style="background: rgb(0, 0, 255)"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: rgb(0, 255, 0)"> </td> + <td style="background: rgb(0, 204, 51)"> </td> + <td style="background: rgb(0, 153, 102)"> </td> + <td style="background: rgb(0, 102, 153)"> </td> + <td style="background: rgb(0, 51, 204)"> </td> + <td style="background: rgb(0, 0, 255)"> </td> + <td style="background: black"> </td> + </tr> + <tr> + <td style="background: black"> </td> + <td style="background: rgb(0, 255, 0)"> </td> + <td style="background: rgb(0, 204, 51)"> </td> + <td style="background: rgb(0, 153, 102)"> </td> + <td style="background: rgb(0, 102, 153)"> </td> + <td style="background: rgb(0, 51, 204)"> </td> + <td style="background: rgb(0, 0, 255)"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: rgb(0, 255, 0)"> </td> + <td style="background: rgb(0, 204, 51)"> </td> + <td style="background: rgb(0, 153, 102)"> </td> + <td style="background: rgb(0, 102, 153)"> </td> + <td style="background: rgb(0, 51, 204)"> </td> + <td style="background: rgb(0, 0, 255)"> </td> + <td style="background: black"> </td> + </tr> + </table> + </div> + + <p>The following table should have four matching rows changing (in 5 steps) from blue at the left to red at the right (plus a checkerboard at both ends to show where the rows are):</p> + + <div style="background: red"> + <table border="border"> + <tr> + <td style="background: black"> </td> + <td style="background: rgb(0, 0, 255)"> </td> + <td style="background: rgb(51, 0, 204)"> </td> + <td style="background: rgb(102, 0, 153)"> </td> + <td style="background: rgb(153, 0, 102)"> </td> + <td style="background: rgb(204, 0, 51)"> </td> + <td style="background: rgb(255, 0, 0)"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: rgb(0, 0, 255)"> </td> + <td style="background: rgb(51, 0, 204)"> </td> + <td style="background: rgb(102, 0, 153)"> </td> + <td style="background: rgb(153, 0, 102)"> </td> + <td style="background: rgb(204, 0, 51)"> </td> + <td style="background: rgb(255, 0, 0)"> </td> + <td style="background: black"> </td> + </tr> + <tr> + <td style="background: black"> </td> + <td style="background: rgb(0, 0, 255)"> </td> + <td style="background: rgb(51, 0, 204)"> </td> + <td style="background: rgb(102, 0, 153)"> </td> + <td style="background: rgb(153, 0, 102)"> </td> + <td style="background: rgb(204, 0, 51)"> </td> + <td style="background: rgb(255, 0, 0)"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td style="background: rgb(0, 0, 255)"> </td> + <td style="background: rgb(51, 0, 204)"> </td> + <td style="background: rgb(102, 0, 153)"> </td> + <td style="background: rgb(153, 0, 102)"> </td> + <td style="background: rgb(204, 0, 51)"> </td> + <td style="background: rgb(255, 0, 0)"> </td> + <td style="background: black"> </td> + </tr> + </table> + </div> +</body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t422-rgba-values-meaning-b.xht b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t422-rgba-values-meaning-b.xht index 27e21cf..daea66c4 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t422-rgba-values-meaning-b.xht +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t422-rgba-values-meaning-b.xht
@@ -5,6 +5,7 @@ <link rel="author" title="L. David Baron" href="https://dbaron.org/" /> <link rel="author" title="Mozilla Corporation" href="http://mozilla.com/" /> <link rel="help" href="http://www.w3.org/TR/css3-color/#rgba-color" /> + <link rel="match" href="t422-rgba-values-meaning-b-ref.html" /> <meta name="flags" content="" /> <meta name="assert" content="Test that the color components in rgba colors are interpreted correctly." /> <style type="text/css"><![CDATA[
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t424-hsl-h-rotating-b-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t424-hsl-h-rotating-b-ref.html new file mode 100644 index 0000000..60585ea9 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t424-hsl-h-rotating-b-ref.html
@@ -0,0 +1,62 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Reference</title> +<style> + table { border-spacing: 0; padding: 0; border: none; } + td { border: none; padding: 0; } + td { width: 1.2em; height: 1.2em; } + #one { background: #FF0000; } + #two { background: #FFFF00; } + #three { background: #00FF00; } + #four { background: #00FFFF; } + #five { background: #0000FF; } + #six { background: #FF00FF; } +</style> +<body> + <p>Each column in the following table should have every cell the + same color, except for the checkerboard pattern at the right and + left used to indicate the row positions.</p> + + <table> + <tr> + <td style="background: white"> </td> + <td id="one"> </td> + <td id="two"> </td> + <td id="three"> </td> + <td id="four"> </td> + <td id="five"> </td> + <td id="six"> </td> + <td style="background: black"> </td> + </tr> + <tr> + <td style="background: black"> </td> + <td id="one"> </td> + <td id="two"> </td> + <td id="three"> </td> + <td id="four"> </td> + <td id="five"> </td> + <td id="six"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td id="one"> </td> + <td id="two"> </td> + <td id="three"> </td> + <td id="four"> </td> + <td id="five"> </td> + <td id="six"> </td> + <td style="background: black"> </td> + </tr> + <tr> + <td style="background: black"> </td> + <td id="one"> </td> + <td id="two"> </td> + <td id="three"> </td> + <td id="four"> </td> + <td id="five"> </td> + <td id="six"> </td> + <td style="background: white"> </td> + </tr> + </table> +</body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t424-hsl-h-rotating-b.xht b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t424-hsl-h-rotating-b.xht index 08196e4..4d2d4cf 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t424-hsl-h-rotating-b.xht +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t424-hsl-h-rotating-b.xht
@@ -5,6 +5,7 @@ <link rel="author" title="L. David Baron" href="https://dbaron.org/" /> <link rel="author" title="Mozilla Corporation" href="http://mozilla.com/" /> <link rel="help" href="http://www.w3.org/TR/css3-color/#hsl-color" /> + <link rel="match" href="t424-hsl-h-rotating-b-ref.html" /> <meta name="flags" content="" /> <meta name="assert" content="H values in hsl() colors should be treated like angles, even when outside [0,360)" /> <style type="text/css"><![CDATA[
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t425-hsla-h-rotating-b-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t425-hsla-h-rotating-b-ref.html new file mode 100644 index 0000000..2aec2f33 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t425-hsla-h-rotating-b-ref.html
@@ -0,0 +1,63 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Reference</title> +<style> + table { border-spacing: 0; padding: 0; border: none; } + td { border: none; padding: 0; } + td { width: 1.2em; height: 1.2em; } + #one { background: #FF0000; } + #two { background: rgba(255, 255, 0, 0.8); } + #three { background: rgba(0, 255, 0, 0.4); } + #four { background: rgba(0, 255, 255, 0.6); } + #five { background: rgba(0, 0, 255, 0.8); } + #six { background: rgba(255, 0, 255, 0.4); } +</style> +<body> + <p>Each column in the following table should have every cell the + same color, except for the checkerboard pattern at the right and + left used to indicate the row positions.</p> + + <table> + <tr> + <td style="background: white"> </td> + <td id="one"> </td> + <td id="two"> </td> + <td id="three"> </td> + <td id="four"> </td> + <td id="five"> </td> + <td id="six"> </td> + <td style="background: black"> </td> + </tr> + <tr> + <td style="background: black"> </td> + <td id="one"> </td> + <td id="two"> </td> + <td id="three"> </td> + <td id="four"> </td> + <td id="five"> </td> + <td id="six"> </td> + <td style="background: white"> </td> + </tr> + <tr> + <td style="background: white"> </td> + <td id="one"> </td> + <td id="two"> </td> + <td id="three"> </td> + <td id="four"> </td> + <td id="five"> </td> + <td id="six"> </td> + <td style="background: black"> </td> + </tr> + <tr> + <td style="background: black"> </td> + <td id="one"> </td> + <td id="two"> </td> + <td id="three"> </td> + <td id="four"> </td> + <td id="five"> </td> + <td id="six"> </td> + <td style="background: white"> </td> + </tr> + </table> + +</body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t425-hsla-h-rotating-b.xht b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t425-hsla-h-rotating-b.xht index b9339ad..09747330 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t425-hsla-h-rotating-b.xht +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t425-hsla-h-rotating-b.xht
@@ -6,6 +6,7 @@ <link rel="author" title="Mozilla Corporation" href="http://mozilla.com/" /> <link rel="help" href="http://www.w3.org/TR/css3-color/#hsl-color" /> <link rel="help" href="http://www.w3.org/TR/css3-color/#hsla-color" /> + <link rel="match" href="t425-hsla-h-rotating-b-ref.html" /> <meta name="flags" content="" /> <meta name="assert" content="H values in hsla() colors should be treated like angles, even when outside [0,360)" /> <style type="text/css"><![CDATA[
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t425-hsla-onscreen-b.xht b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t425-hsla-onscreen-b.xht index 3b5c0b5..60b9efc9 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t425-hsla-onscreen-b.xht +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t425-hsla-onscreen-b.xht
@@ -5,11 +5,12 @@ <link rel="author" title="L. David Baron" href="https://dbaron.org/" /> <link rel="author" title="Mozilla Corporation" href="http://mozilla.com/" /> <link rel="help" href="http://www.w3.org/TR/css3-color/#hsla-color" /> + <link rel="match" href="t422-rgba-onscreen-b-ref.html" /> <meta name="flags" content="" /> <meta name="assert" content="Test that hsla() does not behave like opacity and draw in an offscreen buffer." /> <style type="text/css"><![CDATA[ html, body { background: white; } - table { border-spacing: 0; padding: 0; border: none; } + table { border-spacing: 0 2px; padding: 0; border: none; } td { border: none; padding: 0; } td, div { height: 1.2em; }
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t43-svg-keywords-a-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t43-svg-keywords-a-ref.html new file mode 100644 index 0000000..cd26c49 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t43-svg-keywords-a-ref.html
@@ -0,0 +1,165 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Reference</title> +<style> + html, body { background: #dddddd; color: #000000; } + table { border-spacing: 0; padding: 0; border: none; } + td { border: none; padding: 0; } +</style> +<body> + <p>Each row in the following table (except the first and last, to show where the columns are) should have two cells with the same background color. None of them should match the background of the page.</p> + + <table> + <tr><td style="background: black"> </td><td style="background: white"> </td></tr> + + <tr><td style="background: #f0f8ff" colspan=2> </td> + <tr><td style="background: #faebd7" colspan=2> </td> + <tr><td style="background: #00ffff" colspan=2> </td> + <tr><td style="background: #7fffd4" colspan=2> </td> + <tr><td style="background: #f0ffff" colspan=2> </td> + <tr><td style="background: #f5f5dc" colspan=2> </td> + <tr><td style="background: #ffe4c4" colspan=2> </td> + <tr><td style="background: #000000" colspan=2> </td> + <tr><td style="background: #ffebcd" colspan=2> </td> + <tr><td style="background: #0000ff" colspan=2> </td> + <tr><td style="background: #8a2be2" colspan=2> </td> + <tr><td style="background: #a52a2a" colspan=2> </td> + <tr><td style="background: #deb887" colspan=2> </td> + <tr><td style="background: #5f9ea0" colspan=2> </td> + <tr><td style="background: #7fff00" colspan=2> </td> + <tr><td style="background: #d2691e" colspan=2> </td> + <tr><td style="background: #ff7f50" colspan=2> </td> + <tr><td style="background: #6495ed" colspan=2> </td> + <tr><td style="background: #fff8dc" colspan=2> </td> + <tr><td style="background: #dc143c" colspan=2> </td> + <tr><td style="background: #00ffff" colspan=2> </td> + <tr><td style="background: #00008b" colspan=2> </td> + <tr><td style="background: #008b8b" colspan=2> </td> + <tr><td style="background: #b8860b" colspan=2> </td> + <tr><td style="background: #a9a9a9" colspan=2> </td> + <tr><td style="background: #006400" colspan=2> </td> + <tr><td style="background: #a9a9a9" colspan=2> </td> + <tr><td style="background: #bdb76b" colspan=2> </td> + <tr><td style="background: #8b008b" colspan=2> </td> + <tr><td style="background: #556b2f" colspan=2> </td> + <tr><td style="background: #ff8c00" colspan=2> </td> + <tr><td style="background: #9932cc" colspan=2> </td> + <tr><td style="background: #8b0000" colspan=2> </td> + <tr><td style="background: #e9967a" colspan=2> </td> + <tr><td style="background: #8fbc8f" colspan=2> </td> + <tr><td style="background: #483d8b" colspan=2> </td> + <tr><td style="background: #2f4f4f" colspan=2> </td> + <tr><td style="background: #2f4f4f" colspan=2> </td> + <tr><td style="background: #00ced1" colspan=2> </td> + <tr><td style="background: #9400d3" colspan=2> </td> + <tr><td style="background: #ff1493" colspan=2> </td> + <tr><td style="background: #00bfff" colspan=2> </td> + <tr><td style="background: #696969" colspan=2> </td> + <tr><td style="background: #696969" colspan=2> </td> + <tr><td style="background: #1e90ff" colspan=2> </td> + <tr><td style="background: #b22222" colspan=2> </td> + <tr><td style="background: #fffaf0" colspan=2> </td> + <tr><td style="background: #228b22" colspan=2> </td> + <tr><td style="background: #ff00ff" colspan=2> </td> + <tr><td style="background: #dcdcdc" colspan=2> </td> + <tr><td style="background: #f8f8ff" colspan=2> </td> + <tr><td style="background: #ffd700" colspan=2> </td> + <tr><td style="background: #daa520" colspan=2> </td> + <tr><td style="background: #808080" colspan=2> </td> + <tr><td style="background: #008000" colspan=2> </td> + <tr><td style="background: #adff2f" colspan=2> </td> + <tr><td style="background: #808080" colspan=2> </td> + <tr><td style="background: #f0fff0" colspan=2> </td> + <tr><td style="background: #ff69b4" colspan=2> </td> + <tr><td style="background: #cd5c5c" colspan=2> </td> + <tr><td style="background: #4b0082" colspan=2> </td> + <tr><td style="background: #fffff0" colspan=2> </td> + <tr><td style="background: #f0e68c" colspan=2> </td> + <tr><td style="background: #e6e6fa" colspan=2> </td> + <tr><td style="background: #fff0f5" colspan=2> </td> + <tr><td style="background: #7cfc00" colspan=2> </td> + <tr><td style="background: #fffacd" colspan=2> </td> + <tr><td style="background: #add8e6" colspan=2> </td> + <tr><td style="background: #f08080" colspan=2> </td> + <tr><td style="background: #e0ffff" colspan=2> </td> + <tr><td style="background: #fafad2" colspan=2> </td> + <tr><td style="background: #d3d3d3" colspan=2> </td> + <tr><td style="background: #90ee90" colspan=2> </td> + <tr><td style="background: #d3d3d3" colspan=2> </td> + <tr><td style="background: #ffb6c1" colspan=2> </td> + <tr><td style="background: #ffa07a" colspan=2> </td> + <tr><td style="background: #20b2aa" colspan=2> </td> + <tr><td style="background: #87cefa" colspan=2> </td> + <tr><td style="background: #778899" colspan=2> </td> + <tr><td style="background: #778899" colspan=2> </td> + <tr><td style="background: #b0c4de" colspan=2> </td> + <tr><td style="background: #ffffe0" colspan=2> </td> + <tr><td style="background: #00ff00" colspan=2> </td> + <tr><td style="background: #32cd32" colspan=2> </td> + <tr><td style="background: #faf0e6" colspan=2> </td> + <tr><td style="background: #ff00ff" colspan=2> </td> + <tr><td style="background: #800000" colspan=2> </td> + <tr><td style="background: #66cdaa" colspan=2> </td> + <tr><td style="background: #0000cd" colspan=2> </td> + <tr><td style="background: #ba55d3" colspan=2> </td> + <tr><td style="background: #9370db" colspan=2> </td> + <tr><td style="background: #3cb371" colspan=2> </td> + <tr><td style="background: #7b68ee" colspan=2> </td> + <tr><td style="background: #00fa9a" colspan=2> </td> + <tr><td style="background: #48d1cc" colspan=2> </td> + <tr><td style="background: #c71585" colspan=2> </td> + <tr><td style="background: #191970" colspan=2> </td> + <tr><td style="background: #f5fffa" colspan=2> </td> + <tr><td style="background: #ffe4e1" colspan=2> </td> + <tr><td style="background: #ffe4b5" colspan=2> </td> + <tr><td style="background: #ffdead" colspan=2> </td> + <tr><td style="background: #000080" colspan=2> </td> + <tr><td style="background: #fdf5e6" colspan=2> </td> + <tr><td style="background: #808000" colspan=2> </td> + <tr><td style="background: #6b8e23" colspan=2> </td> + <tr><td style="background: #ffa500" colspan=2> </td> + <tr><td style="background: #ff4500" colspan=2> </td> + <tr><td style="background: #da70d6" colspan=2> </td> + <tr><td style="background: #eee8aa" colspan=2> </td> + <tr><td style="background: #98fb98" colspan=2> </td> + <tr><td style="background: #afeeee" colspan=2> </td> + <tr><td style="background: #db7093" colspan=2> </td> + <tr><td style="background: #ffefd5" colspan=2> </td> + <tr><td style="background: #ffdab9" colspan=2> </td> + <tr><td style="background: #cd853f" colspan=2> </td> + <tr><td style="background: #ffc0cb" colspan=2> </td> + <tr><td style="background: #dda0dd" colspan=2> </td> + <tr><td style="background: #b0e0e6" colspan=2> </td> + <tr><td style="background: #800080" colspan=2> </td> + <tr><td style="background: #ff0000" colspan=2> </td> + <tr><td style="background: #bc8f8f" colspan=2> </td> + <tr><td style="background: #4169e1" colspan=2> </td> + <tr><td style="background: #8b4513" colspan=2> </td> + <tr><td style="background: #fa8072" colspan=2> </td> + <tr><td style="background: #f4a460" colspan=2> </td> + <tr><td style="background: #2e8b57" colspan=2> </td> + <tr><td style="background: #fff5ee" colspan=2> </td> + <tr><td style="background: #a0522d" colspan=2> </td> + <tr><td style="background: #c0c0c0" colspan=2> </td> + <tr><td style="background: #87ceeb" colspan=2> </td> + <tr><td style="background: #6a5acd" colspan=2> </td> + <tr><td style="background: #708090" colspan=2> </td> + <tr><td style="background: #708090" colspan=2> </td> + <tr><td style="background: #fffafa" colspan=2> </td> + <tr><td style="background: #00ff7f" colspan=2> </td> + <tr><td style="background: #4682b4" colspan=2> </td> + <tr><td style="background: #d2b48c" colspan=2> </td> + <tr><td style="background: #008080" colspan=2> </td> + <tr><td style="background: #d8bfd8" colspan=2> </td> + <tr><td style="background: #ff6347" colspan=2> </td> + <tr><td style="background: #40e0d0" colspan=2> </td> + <tr><td style="background: #ee82ee" colspan=2> </td> + <tr><td style="background: #f5deb3" colspan=2> </td> + <tr><td style="background: #ffffff" colspan=2> </td> + <tr><td style="background: #f5f5f5" colspan=2> </td> + <tr><td style="background: #ffff00" colspan=2> </td> + <tr><td style="background: #9acd32" colspan=2> </td> + + <tr><td style="background: white"> </td><td style="background: black"> </td></tr> + </table> +</body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t43-svg-keywords-a.xht b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t43-svg-keywords-a.xht index 69b6aef..75bbf4f 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t43-svg-keywords-a.xht +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-color/t43-svg-keywords-a.xht
@@ -5,6 +5,7 @@ <link rel="author" title="L. David Baron" href="https://dbaron.org/" /> <link rel="author" title="Mozilla Corporation" href="http://mozilla.com/" /> <link rel="help" href="http://www.w3.org/TR/css3-color/#html4" /> + <link rel="match" href="t43-svg-keywords-a-ref.html" /> <meta name="flags" content="" /> <meta name="assert" content="Test that the HTML4 color keywords have the correct values." /> <style type="text/css"><![CDATA[
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-display/display-contents-unusual-html-elements-none.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-display/display-contents-unusual-html-elements-none.html new file mode 100644 index 0000000..403ff5c --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-display/display-contents-unusual-html-elements-none.html
@@ -0,0 +1,31 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Display: display:contents and unusual HTML elements as display:none</title> +<link rel="author" title="Rune Lillesveen" href="mailto:futhark@chromium.org"> +<link rel="help" href="https://drafts.csswg.org/css-display/#unbox-html"> +<link rel="match" href="display-contents-pass-ref.html"> +<style> + body { overflow: hidden } + br, wbr, meter, progress, canvas, embed, object, audio, iframe, img, video, + input, textarea, select { + display: contents; + border: 10px solid red; + width: 200px; height: 200px; + } +</style> +<p>You should see the word PASS below.</p> +<div> + <meter></meter> + <progress></progress> + <canvas></canvas> + <embed> + <object>FAIL</object> + <audio controls></audio> + <iframe></iframe> + <img> + <video></video> + <input></input> + <textarea></textarea> + <select></select> +</div> +P<br>A<wbr>S<br>S
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/font-default-01-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/font-default-01-ref.html new file mode 100644 index 0000000..bbe0251 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/font-default-01-ref.html
@@ -0,0 +1,24 @@ +<!DOCTYPE html> +<html lang="en"> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> +<title>CSS Test: font default features</title> +<link rel="author" title="Chris Lilley" href="chris@w3.org"> +<style> + @font-face { + font-family: fwf; + src: url(support/fonts/FontWithFancyFeatures.otf); + } + .tests { + font-family: fwf; + font-size: 4em; + line-height: 1.1; + } +</style> + +<body> +<!-- test font does not currently test for rlig or locl --> +<p>Test passes if the two lines below are identical, with six check marks (✓). </p> +<section class="tests"> + <p class="ref">AAAAAA</p> + <p class="ref">AAAAAA</p> +</section> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/font-default-01.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/font-default-01.html new file mode 100644 index 0000000..c9045ed --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/font-default-01.html
@@ -0,0 +1,27 @@ +<!DOCTYPE html> +<html lang="en"> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> +<title>CSS Test: font default features</title> +<link rel="author" title="Chris Lilley" href="chris@w3.org"> +<link rel="help" href="hhttps://www.w3.org/TR/css-fonts-3/#default-features"> +<link rel="match" href="font-default-01-ref.html"> +<meta name="assert" content="Required ligatures, common ligatures and contextual forms must be enabled by default (OpenType features: rlig, liga, clig, calt), along with localized forms (OpenType feature: locl), and features required for proper display of composed characters and marks (OpenType features: ccmp, mark, mkmk)."> +<style> + @font-face { + font-family: fwf; + src: url(support/fonts/FontWithFancyFeatures.otf); + } + .tests { + font-family: fwf; + font-size: 4em; + line-height: 1.1; + } +</style> + +<body> +<!-- test font does not currently test for rlig or locl --> +<p>Test passes if the two lines below are identical, with six check marks (✓). </p> +<section class="tests"> + <p class="test">CDGÂÂÄ</p> + <p class="ref">AAAAAA</p> +</section> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/font-default-02-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/font-default-02-ref.html new file mode 100644 index 0000000..6d45ace --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/font-default-02-ref.html
@@ -0,0 +1,28 @@ +<!DOCTYPE html> +<html lang="en"> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> +<title>CSS Test: font default features</title> +<link rel="author" title="Chris Lilley" href="chris@w3.org"> +<style> + @font-face { + font-family: fwf; + src: url(support/fonts/FontWithFancyFeatures.otf); + } + .tests { + font-family: fwf; + font-size: 4em; + line-height: 1.1; + } + .test { + font-variant: normal; + } +</style> + +<body> +<!-- test font does not currently test for rlig or locl --> +<p>Test passes if the three lines below are identical, with six check marks (✓). </p> +<section class="tests"> + <p class="ref">AAAAAA</p> + <p class="ref">AAAAAA</p> + <p class="ref">AAAAAA</p> +</section> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/font-default-02.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/font-default-02.html new file mode 100644 index 0000000..24f61942 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/font-default-02.html
@@ -0,0 +1,32 @@ +<!DOCTYPE html> +<html lang="en"> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> +<title>CSS Test: font default features</title> +<link rel="author" title="Chris Lilley" href="chris@w3.org"> +<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#default-features"> +<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-variant-prop"> +<link rel="match" href="font-default-02-ref.html"> +<meta name="assert" content="These features must always be enabled, even when the value of the ‘font-variant’ and ‘font-feature-settings’ properties is ‘normal’. "> +<style> + @font-face { + font-family: fwf; + src: url(support/fonts/FontWithFancyFeatures.otf); + } + .tests { + font-family: fwf; + font-size: 4em; + line-height: 1.1; + } + .test { + font-variant: normal; + } +</style> + +<body> +<!-- test font does not currently test for rlig or locl --> +<p>Test passes if the three lines below are identical, with six check marks (✓). </p> +<section class="tests"> + <p class="default">CDGÂÂÄ</p> + <p class="test">CDGÂÂÄ</p> + <p class="ref">AAAAAA</p> +</section> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/font-default-03-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/font-default-03-ref.html new file mode 100644 index 0000000..2f1d160 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/font-default-03-ref.html
@@ -0,0 +1,28 @@ +<!DOCTYPE html> +<html lang="en"> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> +<title>CSS Test: font default features</title> +<link rel="author" title="Chris Lilley" href="chris@w3.org"> +<style> + @font-face { + font-family: fwf; + src: url(support/fonts/FontWithFancyFeatures.otf); + } + .tests { + font-family: fwf; + font-size: 4em; + line-height: 1.1; + } + .test { + font-feature-settings: normal; + } +</style> + +<body> +<!-- test font does not currently test for rlig or locl --> +<p>Test passes if the three lines below are identical, with six check marks (✓). </p> +<section class="tests"> + <p class="default">CDGÂÂÄ</p> + <p class="test">CDGÂÂÄ</p> + <p class="ref">AAAAAA</p> +</section> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/font-default-03.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/font-default-03.html new file mode 100644 index 0000000..a72a4bc --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/font-default-03.html
@@ -0,0 +1,32 @@ +<!DOCTYPE html> +<html lang="en"> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> +<title>CSS Test: font default features</title> +<link rel="author" title="Chris Lilley" href="chris@w3.org"> +<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#default-features"> +<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-feature-settings-prop"> +<link rel="match" href="font-default-03-ref.html"> +<meta name="assert" content="These features must always be enabled, even when the value of the ‘font-variant’ and ‘font-feature-settings’ properties is ‘normal’. "> +<style> + @font-face { + font-family: fwf; + src: url(support/fonts/FontWithFancyFeatures.otf); + } + .tests { + font-family: fwf; + font-size: 4em; + line-height: 1.1; + } + .test { + font-feature-settings: normal; + } +</style> + +<body> +<!-- test font does not currently test for rlig or locl --> +<p>Test passes if the three lines below are identical, with six check marks (✓). </p> +<section class="tests"> + <p class="default">CDGÂÂÄ</p> + <p class="test">CDGÂÂÄ</p> + <p class="ref">AAAAAA</p> +</section> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/font-default-04-a-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/font-default-04-a-ref.html new file mode 100644 index 0000000..cf428d2c --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/font-default-04-a-ref.html
@@ -0,0 +1,32 @@ +<!DOCTYPE html> +<html lang="en"> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> +<title>CSS Test: font default features</title> +<link rel="author" title="Chris Lilley" href="chris@w3.org"> +<meta name="assert" content="For upright text within vertical text runs, vertical alternates (OpenType feature: vert) must be enabled"> +<style> + @font-face { + font-family: fwf; + src: url(support/fonts/FontWithFancyFeatures.otf); + } + .tests { + font-family: fwf; + font-size: 4em; + line-height: 1.1; + writing-mode: vertical-rl; + text-orientation: upright; + color: green; + } + .default { + color: purple; + } +</style> + +<body> +<p>Test passes if the first <em>vertical</em> line (in purple) has <em>at least one</em> check mark +and the next two lines (in green) are identical, with two check marks (✓).</p> +<section class="tests"> + <p class="default">AB</p> + <p><span class="test1">A</span><span class="test2">A</span></p> + <p class="ref">AA</p> +</section> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/font-default-04-b-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/font-default-04-b-ref.html new file mode 100644 index 0000000..3051b273 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/font-default-04-b-ref.html
@@ -0,0 +1,32 @@ +<!DOCTYPE html> +<html lang="en"> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> +<title>CSS Test: font default features</title> +<link rel="author" title="Chris Lilley" href="chris@w3.org"> +<meta name="assert" content="For upright text within vertical text runs, vertical alternates (OpenType feature: vert) must be enabled"> +<style> + @font-face { + font-family: fwf; + src: url(support/fonts/FontWithFancyFeatures.otf); + } + .tests { + font-family: fwf; + font-size: 4em; + line-height: 1.1; + writing-mode: vertical-rl; + text-orientation: upright; + color: green; + } + .default { + color: purple; + } +</style> + +<body> +<p>Test passes if the first <em>vertical</em> line (in purple) has <em>at least one</em> check mark +and the next two lines (in green) are identical, with two check marks (✓).</p> +<section class="tests"> + <p class="default">BA</p> + <p><span class="test1">A</span><span class="test2">A</span></p> + <p class="ref">AA</p> +</section> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/font-default-04-c-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/font-default-04-c-ref.html new file mode 100644 index 0000000..773acfc --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/font-default-04-c-ref.html
@@ -0,0 +1,32 @@ +<!DOCTYPE html> +<html lang="en"> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> +<title>CSS Test: font default features</title> +<link rel="author" title="Chris Lilley" href="chris@w3.org"> +<meta name="assert" content="For upright text within vertical text runs, vertical alternates (OpenType feature: vert) must be enabled"> +<style> + @font-face { + font-family: fwf; + src: url(support/fonts/FontWithFancyFeatures.otf); + } + .tests { + font-family: fwf; + font-size: 4em; + line-height: 1.1; + writing-mode: vertical-rl; + text-orientation: upright; + color: green; + } + .default { + color: purple; + } +</style> + +<body> +<p>Test passes if the first <em>vertical</em> line (in purple) has <em>at least one</em> check mark +and the next two lines (in green) are identical, with two check marks (✓).</p> +<section class="tests"> + <p class="default">AA</p> + <p><span class="test1">A</span><span class="test2">A</span></p> + <p class="ref">AA</p> +</section> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/font-default-04.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/font-default-04.html new file mode 100644 index 0000000..5493d72 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-fonts/font-default-04.html
@@ -0,0 +1,45 @@ +<!DOCTYPE html> +<html lang="en"> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> +<title>CSS Test: font default features</title> +<link rel="author" title="Chris Lilley" href="chris@w3.org"> +<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#default-features"> +<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-feature-settings-prop"> +<link rel="help" href="https://www.w3.org/TR/css-writing-modes-3/#block-flow"> +<link rel="help" href="https://www.w3.org/TR/css-writing-modes-3/#text-orientation"> +<link rel="match" href="font-default-04-a-ref.html"> +<link rel="match" href="font-default-04-b-ref.html"> +<link rel="match" href="font-default-04-c-ref.html"> +<meta name="assert" content="For upright text within vertical text runs, vertical alternates (OpenType feature: vert) must be enabled"> +<style> + @font-face { + font-family: fwf; + src: url(support/fonts/FontWithFancyFeatures.otf); + } + .tests { + font-family: fwf; + font-size: 4em; + line-height: 1.1; + writing-mode: vertical-rl; + text-orientation: upright; + color: green; + } + .default { + color: purple; + } + .test1 { + font-feature-settings: "vert" on; + } + .test2 { + font-feature-settings: "vert" 2; + } +</style> + +<body> +<p>Test passes if the first <em>vertical</em> line (in purple) has <em>at least one</em> check mark +and the next two lines (in green) are identical, with two check marks (✓).</p> +<section class="tests"> + <p class="default">Å人</p> + <p><span class="test1">Å</span><span class="test2">人</span></p> + <p class="ref">AA</p> +</section> \ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/grid-model/grid-container-ignores-first-letter-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/grid-model/grid-container-ignores-first-letter-001.html new file mode 100644 index 0000000..f94fdcfe --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/grid-model/grid-container-ignores-first-letter-001.html
@@ -0,0 +1,108 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Grid Layout Test: '::first-letter' is ignored in grid containers</title> +<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com"> +<link rel="help" href="http://www.w3.org/TR/css-grid-1/#grid-containers"> +<link rel="help" href="http://www.w3.org/TR/css3-selectors/#first-letter"> +<meta name="assert" content="The test checks that grid item should ignore grid container's first-letter pseudo-element."> +<link href="../support/grid.css" rel="stylesheet"> +<style> + body { line-height: 20px; } + .grid-first-letter::first-letter { line-height: 100px; color: red; } + .container-first-letter::first-letter { line-height: 200px; color: green; } +</style> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/check-layout-th.js"></script> + +<body onload="checkLayout('.container');"> + +<div id="log"></div> + +<div class="container"> + <div class="grid grid-first-letter"> + <div class="item" data-expected-height=20>The first item.</div> + <div class="item" data-expected-height=20>The second item.</div> + </div> +</div> + +<div class="container"> + <div class="inline-grid grid-first-letter"> + <div class="item" data-expected-height=20>The first item.</div> + <div class="item" data-expected-height=20>The second item.</div> + </div> +</div> + +<div class="container"> + <div class="grid grid-first-letter" data-expected-height=20> + Anonymous item. + </div> +</div> + +<div class="container"> + <div class="inline-grid grid-first-letter" data-expected-height=20> + Anonymous item. + </div> +</div> + +<div class="container container-first-letter"> + <div class="grid grid-first-letter"> + <div class="item" data-expected-height=20>The first item.</div> + <div class="item" data-expected-height=20>The second item.</div> + </div> + <div data-expected-height=200>Out of grid.</div> +</div> + +<div class="container container-first-letter"> + <div class="inline-grid grid-first-letter"> + <div class="item" data-expected-height=20>The first item.</div> + <div class="item" data-expected-height=20>The second item.</div> + </div> + <div data-expected-height=20>Out of grid.</div> +</div> + +<div class="container container-first-letter"> + <div class="grid grid-first-letter" data-expected-height=20> + Anonymous item. + </div> + <div data-expected-height=200>Out of grid.</div> +</div> + +<div class="container container-first-letter"> + <div class="inline-grid grid-first-letter" data-expected-height=20> + Anonymous item. + </div> + <div data-expected-height=20>Out of grid.</div> +</div> + +<div class="container container-first-letter"> + <div class="grid"> + <div class="item" data-expected-height=20>The first item.</div> + <div class="item" data-expected-height=20>The second item.</div> + </div> + <div data-expected-height=200>Out of grid.</div> +</div> + +<div class="container container-first-letter"> + <div class="inline-grid"> + <div class="item" data-expected-height=20>The first item.</div> + <div class="item" data-expected-height=20>The second item.</div> + </div> + <div data-expected-height=20>Out of grid.</div> +</div> + +<div class="container container-first-letter"> + <div class="grid" data-expected-height=20> + Anonymous item. + </div> + <div data-expected-height=200>Out of grid.</div> +</div> + +<div class="container container-first-letter"> + <div class="inline-grid" data-expected-height=20> + Anonymous item. + </div> + <div data-expected-height=20>Out of grid.</div> +</div> + +</body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/grid-model/grid-container-ignores-first-line-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/grid-model/grid-container-ignores-first-line-001.html new file mode 100644 index 0000000..b491298 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/grid-model/grid-container-ignores-first-line-001.html
@@ -0,0 +1,92 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Grid Layout Test: '::first-line' is ignored in grid containers</title> +<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com"> +<link rel="help" href="http://www.w3.org/TR/css-grid-1/#grid-containers"> +<link rel="help" href="http://www.w3.org/TR/css3-selectors/#first-formatted-line"> +<meta name="assert" content="The test checks that grid item should ignore grid container's first-line pseudo-element."> +<link href="../support/grid.css" rel="stylesheet"> +<style> + body { line-height: 20px; } + .grid-first-line::first-line { line-height: 100px; } + .container::first-line { line-height: 200px; } +</style> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/check-layout-th.js"></script> + +<body onload="checkLayout('.grid,.inline-grid');"> + +<div id="log"></div> + +<div class="grid grid-first-line"> + <div class="item" data-expected-height=20>The first item.</div> + <div class="item" data-expected-height=20>The second item.</div> +</div> + +<div class="inline-grid grid-first-line"> + <div class="item" data-expected-height=20>The first item.</div> + <div class="item" data-expected-height=20>The second item.</div> +</div> + +<div class="grid grid-first-line" data-expected-height=20> + Anonymous item. +</div> + +<div class="inline-grid grid-first-line" data-expected-height=20> + Anonymous item. +</div> + +<div class="container"> + <div class="grid grid-first-line"> + <div class="item" data-expected-height=20>The first item.</div> + <div class="item" data-expected-height=20>The second item.</div> + </div> +</div> + +<div class="container"> + <div class="inline-grid grid-first-line"> + <div class="item" data-expected-height=20>The first item.</div> + <div class="item" data-expected-height=20>The second item.</div> + </div> +</div> + +<div class="container"> + <div class="grid grid-first-line" data-expected-height=20> + Anonymous item. + </div> +</div> + +<div class="container"> + <div class="inline-grid grid-first-line" data-expected-height=20> + Anonymous item. + </div> +</div> + +<div class="container"> + <div class="grid"> + <div class="item" data-expected-height=20>The first item.</div> + <div class="item" data-expected-height=20>The second item.</div> + </div> +</div> + +<div class="container"> + <div class="inline-grid"> + <div class="item" data-expected-height=20>The first item.</div> + <div class="item" data-expected-height=20>The second item.</div> + </div> +</div> + +<div class="container"> + <div class="grid" data-expected-height=20> + Anonymous item. + </div> +</div> + +<div class="container"> + <div class="inline-grid" data-expected-height=20> + Anonymous item. + </div> +</div> + +</body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/grid-model/grid-item-accepts-first-letter-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/grid-model/grid-item-accepts-first-letter-001.html new file mode 100644 index 0000000..c9454fe --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/grid-model/grid-item-accepts-first-letter-001.html
@@ -0,0 +1,30 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Grid Layout Test: '::first-letter' is valid in grid items</title> +<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com"> +<link rel="help" href="http://www.w3.org/TR/css-grid-1/#grid-containers"> +<link rel="help" href="http://www.w3.org/TR/css3-selectors/#first-letter"> +<meta name="assert" content="The test checks that grid items accept first-letter pseudo-element."> +<link href="../support/grid.css" rel="stylesheet"> +<style> + .item::first-letter { line-height: 100px; } +</style> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/check-layout-th.js"></script> + +<body onload="checkLayout('.grid,.inline-grid');"> + +<div id="log"></div> + +<div class="grid"> + <div class="item" data-expected-height=100>The first item.</div> + <div class="item" data-expected-height=100>The second item.</div> +</div> + +<div class="inline-grid"> + <div class="item" data-expected-height=100>The first item.</div> + <div class="item" data-expected-height=100>The second item.</div> +</div> + +</body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/grid-model/grid-item-accepts-first-line-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/grid-model/grid-item-accepts-first-line-001.html new file mode 100644 index 0000000..1330b376 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/grid-model/grid-item-accepts-first-line-001.html
@@ -0,0 +1,30 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Grid Layout Test: '::first-line' is valid in grid items</title> +<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com"> +<link rel="help" href="http://www.w3.org/TR/css-grid-1/#grid-containers"> +<link rel="help" href="http://www.w3.org/TR/css3-selectors/#first-formatted-line"> +<meta name="assert" content="The test checks that grid items accept first-line pseudo-element."> +<link href="../support/grid.css" rel="stylesheet"> +<style> + .item::first-line { line-height: 100px; } +</style> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/check-layout-th.js"></script> + +<body onload="checkLayout('.grid,.inline-grid');"> + +<div id="log"></div> + +<div class="grid"> + <div class="item" data-expected-height=100>The first item.</div> + <div class="item" data-expected-height=100>The second item.</div> +</div> + +<div class="inline-grid"> + <div class="item" data-expected-height=100>The first item.</div> + <div class="item" data-expected-height=100>The second item.</div> +</div> + +</body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-offset-overflow.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-offset-overflow.html new file mode 100644 index 0000000..f4afed40 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-offset-overflow.html
@@ -0,0 +1,60 @@ +<!DOCTYPE html> +<title>Sticky positioning can cause overflow but must be accessible.</title> +<link rel="help" href="https://www.w3.org/TR/css-position-3/#sticky-pos" /> +<meta name="assert" content="This test checks that a sticky positioned element +can cause overflow but must still be accessible through scrolling" /> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<style> +.container { + overflow: scroll; + width: 100px; + height: 100px; +} + +.box { + background-color: green; + height: 50px; + width: 50px; +} + +.sticky { + position: sticky; + top: 200px; /* Forces the sticky position element below the overflow. */ +} +</style> + +<div id="scroller1" class="container"> + <div class="sticky box"></div> +</div> + +<div id="scroller2" class="container"> + <div class="sticky box"></div> +</div> + +<script> +test(() => { + var scroller = document.getElementById('scroller1'); + var sticky = scroller.querySelector('.sticky'); + + var stickyOffset = sticky.offsetTop - + scroller.scrollTop - scroller.offsetTop; + assert_equals(stickyOffset, 200); + assert_equals(scroller.scrollHeight, 250); +}, 'sticky position offset should be able to cause overflow'); + +test(() => { + var scroller = document.getElementById('scroller2'); + var sticky = scroller.querySelector('.sticky'); + + scroller.scrollTop = 150; + var stickyOffset = sticky.offsetTop - + scroller.scrollTop - scroller.offsetTop; + assert_equals(stickyOffset, 50); + // Scroll height should be unaffected. + assert_equals(scroller.scrollHeight, 250); + +}, 'sticky position offset in overflow should be accessible'); +</script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/interfaces-worker.sub.js b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/interfaces-worker.sub.js index 99f36b9..7bdf101 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/interfaces-worker.sub.js +++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/interfaces-worker.sub.js
@@ -57,21 +57,20 @@ new FetchEvent('FetchEvent', {request: req}).clientId, '', 'Default FetchEvent.clientId should be the empty string'); assert_equals( - new FetchEvent('FetchEvent', {request: req}).isReload, - false, 'Default FetchEvent.isReload should be false'); - assert_equals( new FetchEvent('FetchEvent', {request: req, cancelable: false}).cancelable, false, 'FetchEvent.cancelable should be false'); assert_equals( new FetchEvent('FetchEvent', {request: req, clientId : 'test-client-id'}).clientId, 'test-client-id', 'FetchEvent.clientId with option {clientId : "test-client-id"} should be "test-client-id"'); assert_equals( - new FetchEvent('FetchEvent', {request: req, isReload : true}).isReload, true, - 'FetchEvent.isReload with option {isReload : true} should be true'); - assert_equals( - new FetchEvent('FetchEvent', {request : req, isReload : true}).request.url, + new FetchEvent('FetchEvent', {request : req}).request.url, 'http://{{host}}/', 'FetchEvent.request.url should return the value it was initialized to'); + assert_equals( + new FetchEvent('FetchEvent', {request : req}).isReload, + undefined, + 'FetchEvent.isReload should not exist'); + }, 'Event constructors'); test(() => {
diff --git a/third_party/WebKit/LayoutTests/external/wpt/svg/extensibility/foreignObject/properties.svg b/third_party/WebKit/LayoutTests/external/wpt/svg/extensibility/foreignObject/properties.svg new file mode 100644 index 0000000..a89e1e5 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/svg/extensibility/foreignObject/properties.svg
@@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" + xmlns:h="http://www.w3.org/1999/xhtml"> + <metadata> + <h:link rel="help" href="https://svgwg.org/svg2-draft/single-page.html#embedded-ForeignObjectElement"/> + <h:link rel="help" href="https://svgwg.org/svg2-draft/single-page.html#styling-PresentationAttributes"/> + <h:meta name="assert" content="x y width height are presentation attributes of foreignObject"/> + </metadata> + <style> + .c { + x: 10px; + y: 20px; + width: 30px; + height: 40px; + } + </style> + <foreignObject id="first"></foreignObject> + <foreignObject id="second" class="c"></foreignObject> + <foreignObject id="third" x="50" y="60" width="70" height="80"></foreignObject> + <foreignObject id="fourth" x="50" y="60" width="70" height="80" class="c"></foreignObject> + <h:script src="/resources/testharness.js"/> + <h:script src="/resources/testharnessreport.js"/> + <script><![CDATA[ + test(function() { + var first = document.getElementById('first'); + var second = document.getElementById('second'); + var third = document.getElementById('third'); + var fourth = document.getElementById('fourth'); + + assert_equals(getComputedStyle(first).x, "0px"); + assert_equals(getComputedStyle(first).y, "0px"); + assert_equals(getComputedStyle(first).width, "auto"); + assert_equals(getComputedStyle(first).height, "auto"); + + assert_equals(getComputedStyle(second).x, "10px"); + assert_equals(getComputedStyle(second).y, "20px"); + assert_equals(getComputedStyle(second).width, "30px"); + assert_equals(getComputedStyle(second).height, "40px"); + + assert_equals(getComputedStyle(third).x, "50px"); + assert_equals(getComputedStyle(third).y, "60px"); + assert_equals(getComputedStyle(third).width, "70px"); + assert_equals(getComputedStyle(third).height, "80px"); + + assert_equals(getComputedStyle(fourth).x, "10px"); + assert_equals(getComputedStyle(fourth).y, "20px"); + assert_equals(getComputedStyle(fourth).width, "30px"); + assert_equals(getComputedStyle(fourth).height, "40px"); + }); + ]]></script> +</svg>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/webgl/create-query-crash-expected.html b/third_party/WebKit/LayoutTests/fast/canvas/webgl/create-query-crash-expected.html new file mode 100644 index 0000000..f35283f --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/canvas/webgl/create-query-crash-expected.html
@@ -0,0 +1,3 @@ +<!DOCTYPE html> +Test passes by not crashing +
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/webgl/create-query-crash.html b/third_party/WebKit/LayoutTests/fast/canvas/webgl/create-query-crash.html new file mode 100644 index 0000000..c2de82d4 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/canvas/webgl/create-query-crash.html
@@ -0,0 +1,8 @@ +<!DOCTYPE html> +Test passes by not crashing +<br> +<canvas id='c'></canvas> +<script> +// Regression test for crbug.com/793667 +document.getElementById('c').transferControlToOffscreen().getContext('webgl2').createQuery(); +</script>
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-container-ignore-first-letter-expected.txt b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-container-ignore-first-letter-expected.txt deleted file mode 100644 index 9fdb39e..0000000 --- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-container-ignore-first-letter-expected.txt +++ /dev/null
@@ -1,40 +0,0 @@ -This test grid item should ignore grid container's first-letter pseudo-element. - -The first item. -The second item. -PASS -The first item. -The second item. - PASS -Anonymous item. -PASS -Anonymous item. -PASS -The first item. -The second item. -Out of grid. -PASS -The first item. -The second item. -Out of grid. -PASS -Anonymous item. -Out of grid. -PASS -Anonymous item. -Out of grid. -PASS -The first item. -The second item. -Out of grid. -PASS -The first item. -The second item. -Out of grid. -PASS -Anonymous item. -Out of grid. -PASS -Anonymous item. -Out of grid. -PASS
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-container-ignore-first-letter.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-container-ignore-first-letter.html deleted file mode 100644 index 910c8039..0000000 --- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-container-ignore-first-letter.html +++ /dev/null
@@ -1,101 +0,0 @@ -<!DOCTYPE html> -<html> -<link href="resources/grid.css" rel="stylesheet"> -<style> - body { line-height: 20px; } - .grid-first-letter::first-letter { line-height: 100px; color: red; } - .container-first-letter::first-letter { line-height: 200px; color: green; } -</style> - -<script src="../../resources/check-layout.js"></script> -<body onload="checkLayout('.container');"> -<p>This test grid item should ignore grid container's first-letter pseudo-element.</p> - -<div class="container"> - <div class="grid grid-first-letter"> - <div class="item" data-expected-height=20>The first item.</div> - <div class="item" data-expected-height=20>The second item.</div> - </div> -</div> - -<div class="container"> - <div class="inline-grid grid-first-letter"> - <div class="item" data-expected-height=20>The first item.</div> - <div class="item" data-expected-height=20>The second item.</div> - </div> -</div> - -<div class="container"> - <div class="grid grid-first-letter" data-expected-height=20> - Anonymous item. - </div> -</div> - -<div class="container"> - <div class="inline-grid grid-first-letter" data-expected-height=20> - Anonymous item. - </div> -</div> - -<div class="container container-first-letter"> - <div class="grid grid-first-letter"> - <div class="item" data-expected-height=20>The first item.</div> - <div class="item" data-expected-height=20>The second item.</div> - </div> - <div data-expected-height=200>Out of grid.</div> -</div> - -<div class="container container-first-letter"> - <div class="inline-grid grid-first-letter"> - <div class="item" data-expected-height=20>The first item.</div> - <div class="item" data-expected-height=20>The second item.</div> - </div> - <div data-expected-height=20>Out of grid.</div> -</div> - -<div class="container container-first-letter"> - <div class="grid grid-first-letter" data-expected-height=20> - Anonymous item. - </div> - <div data-expected-height=200>Out of grid.</div> -</div> - -<div class="container container-first-letter"> - <div class="inline-grid grid-first-letter" data-expected-height=20> - Anonymous item. - </div> - <div data-expected-height=20>Out of grid.</div> -</div> - -<div class="container container-first-letter"> - <div class="grid"> - <div class="item" data-expected-height=20>The first item.</div> - <div class="item" data-expected-height=20>The second item.</div> - </div> - <div data-expected-height=200>Out of grid.</div> -</div> - -<div class="container container-first-letter"> - <div class="inline-grid"> - <div class="item" data-expected-height=20>The first item.</div> - <div class="item" data-expected-height=20>The second item.</div> - </div> - <div data-expected-height=20>Out of grid.</div> -</div> - -<div class="container container-first-letter"> - <div class="grid" data-expected-height=20> - Anonymous item. - </div> - <div data-expected-height=200>Out of grid.</div> -</div> - -<div class="container container-first-letter"> - <div class="inline-grid" data-expected-height=20> - Anonymous item. - </div> - <div data-expected-height=20>Out of grid.</div> -</div> - -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-container-ignore-first-line-expected.txt b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-container-ignore-first-line-expected.txt deleted file mode 100644 index ac5a3745..0000000 --- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-container-ignore-first-line-expected.txt +++ /dev/null
@@ -1,32 +0,0 @@ -This test grid item should ignore grid container's first-line pseudo-element. - -The first item. -The second item. -PASS -The first item. -The second item. -PASS -Anonymous item. -PASS -Anonymous item. -PASS -The first item. -The second item. -PASS -The first item. -The second item. - PASS -Anonymous item. -PASS -Anonymous item. -PASS -The first item. -The second item. -PASS -The first item. -The second item. - PASS -Anonymous item. -PASS -Anonymous item. -PASS
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-container-ignore-first-line.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-container-ignore-first-line.html deleted file mode 100644 index 3ad93ea..0000000 --- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-container-ignore-first-line.html +++ /dev/null
@@ -1,85 +0,0 @@ -<!DOCTYPE html> -<html> -<link href="resources/grid.css" rel="stylesheet"> -<style> - body { line-height: 20px; } - .grid-first-line::first-line { line-height: 100px; } - .container::first-line { line-height: 200px; } -</style> - -<script src="../../resources/check-layout.js"></script> -<body onload="checkLayout('.grid,.inline-grid');"> -<p>This test grid item should ignore grid container's first-line pseudo-element.</p> - -<div class="grid grid-first-line"> - <div class="item" data-expected-height=20>The first item.</div> - <div class="item" data-expected-height=20>The second item.</div> -</div> - -<div class="inline-grid grid-first-line"> - <div class="item" data-expected-height=20>The first item.</div> - <div class="item" data-expected-height=20>The second item.</div> -</div> - -<div class="grid grid-first-line" data-expected-height=20> - Anonymous item. -</div> - -<div class="inline-grid grid-first-line" data-expected-height=20> - Anonymous item. -</div> - -<div class="container"> - <div class="grid grid-first-line"> - <div class="item" data-expected-height=20>The first item.</div> - <div class="item" data-expected-height=20>The second item.</div> - </div> -</div> - -<div class="container"> - <div class="inline-grid grid-first-line"> - <div class="item" data-expected-height=20>The first item.</div> - <div class="item" data-expected-height=20>The second item.</div> - </div> -</div> - -<div class="container"> - <div class="grid grid-first-line" data-expected-height=20> - Anonymous item. - </div> -</div> - -<div class="container"> - <div class="inline-grid grid-first-line" data-expected-height=20> - Anonymous item. - </div> -</div> - -<div class="container"> - <div class="grid"> - <div class="item" data-expected-height=20>The first item.</div> - <div class="item" data-expected-height=20>The second item.</div> - </div> -</div> - -<div class="container"> - <div class="inline-grid"> - <div class="item" data-expected-height=20>The first item.</div> - <div class="item" data-expected-height=20>The second item.</div> - </div> -</div> - -<div class="container"> - <div class="grid" data-expected-height=20> - Anonymous item. - </div> -</div> - -<div class="container"> - <div class="inline-grid" data-expected-height=20> - Anonymous item. - </div> -</div> - -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-item-first-letter-valid-expected.txt b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-item-first-letter-valid-expected.txt deleted file mode 100644 index 6e8bae51..0000000 --- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-item-first-letter-valid-expected.txt +++ /dev/null
@@ -1,8 +0,0 @@ -This test grid item's first-letter pseudo-element should be valid. - -The first item. -The second item. -PASS -The first item. -The second item. -PASS
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-item-first-letter-valid.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-item-first-letter-valid.html deleted file mode 100644 index b980093..0000000 --- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-item-first-letter-valid.html +++ /dev/null
@@ -1,23 +0,0 @@ -<!DOCTYPE html> -<html> -<link href="resources/grid.css" rel="stylesheet"> -<style> - .item::first-letter { line-height: 100px; } -</style> - -<script src="../../resources/check-layout.js"></script> -<body onload="checkLayout('.grid'); checkLayout('.inline-grid');"> -<p>This test grid item's first-letter pseudo-element should be valid.</p> - -<div class="grid"> - <div class="item" data-expected-height=100>The first item.</div> - <div class="item" data-expected-height=100>The second item.</div> -</div> - -<div class="inline-grid"> - <div class="item" data-expected-height=100>The first item.</div> - <div class="item" data-expected-height=100>The second item.</div> -</div> - -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-item-first-line-valid-expected.txt b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-item-first-line-valid-expected.txt deleted file mode 100644 index 390d3d6..0000000 --- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-item-first-line-valid-expected.txt +++ /dev/null
@@ -1,8 +0,0 @@ -This test grid item's first-line pseudo-element should be valid. - -The first item. -The second item. -PASS -The first item. -The second item. -PASS
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-item-first-line-valid.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-item-first-line-valid.html deleted file mode 100644 index e1c36c7..0000000 --- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-item-first-line-valid.html +++ /dev/null
@@ -1,23 +0,0 @@ -<!DOCTYPE html> -<html> -<link href="resources/grid.css" rel="stylesheet"> -<style> - .item::first-line { line-height: 100px; } -</style> - -<script src="../../resources/check-layout.js"></script> -<body onload="checkLayout('.grid'); checkLayout('.inline-grid');"> -<p>This test grid item's first-line pseudo-element should be valid.</p> - -<div class="grid"> - <div class="item" data-expected-height=100>The first item.</div> - <div class="item" data-expected-height=100>The second item.</div> -</div> - -<div class="inline-grid"> - <div class="item" data-expected-height=100>The first item.</div> - <div class="item" data-expected-height=100>The second item.</div> -</div> - -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-navigated-expected.txt index 859fa58..81a6c0f 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-navigated-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-navigated-expected.txt
@@ -100,6 +100,7 @@ PASS oldChildWindow.onended is newChildWindow.onended PASS oldChildWindow.onerror is newChildWindow.onerror PASS oldChildWindow.onfocus is newChildWindow.onfocus +PASS oldChildWindow.onfreeze is newChildWindow.onfreeze PASS oldChildWindow.ongotpointercapture is newChildWindow.ongotpointercapture PASS oldChildWindow.onhashchange is newChildWindow.onhashchange PASS oldChildWindow.oninput is newChildWindow.oninput @@ -144,6 +145,7 @@ PASS oldChildWindow.onrejectionhandled is newChildWindow.onrejectionhandled PASS oldChildWindow.onreset is newChildWindow.onreset PASS oldChildWindow.onresize is newChildWindow.onresize +PASS oldChildWindow.onresume is newChildWindow.onresume PASS oldChildWindow.onscroll is newChildWindow.onscroll PASS oldChildWindow.onsearch is newChildWindow.onsearch PASS oldChildWindow.onseeked is newChildWindow.onseeked
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-and-gced-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-and-gced-expected.txt index 7a1d813..83142da 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-and-gced-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-and-gced-expected.txt
@@ -68,6 +68,7 @@ PASS childWindow.onended is null PASS childWindow.onerror is null PASS childWindow.onfocus is null +PASS childWindow.onfreeze is null PASS childWindow.ongotpointercapture is null PASS childWindow.onhashchange is null PASS childWindow.oninput is null @@ -112,6 +113,7 @@ PASS childWindow.onrejectionhandled is null PASS childWindow.onreset is null PASS childWindow.onresize is null +PASS childWindow.onresume is null PASS childWindow.onscroll is null PASS childWindow.onsearch is null PASS childWindow.onseeked is null
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-expected.txt index 53abae6c..516952e 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-expected.txt
@@ -68,6 +68,7 @@ PASS childWindow.onended is null PASS childWindow.onerror is null PASS childWindow.onfocus is null +PASS childWindow.onfreeze is null PASS childWindow.ongotpointercapture is null PASS childWindow.onhashchange is null PASS childWindow.oninput is null @@ -112,6 +113,7 @@ PASS childWindow.onrejectionhandled is null PASS childWindow.onreset is null PASS childWindow.onresize is null +PASS childWindow.onresume is null PASS childWindow.onscroll is null PASS childWindow.onsearch is null PASS childWindow.onseeked is null
diff --git a/third_party/WebKit/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-only-shadow-expected.html b/third_party/WebKit/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-only-shadow-expected.html deleted file mode 100644 index 00f3d352..0000000 --- a/third_party/WebKit/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-only-shadow-expected.html +++ /dev/null
@@ -1,7 +0,0 @@ -<!DOCTYPE html> - -<p>When the AuthorShadowDOM has only a shadow element, this should be rendered like no Shadow DOM is added.</p> -<form> - <textarea>Something in the air</textarea> -</form> -
diff --git a/third_party/WebKit/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-only-shadow.html b/third_party/WebKit/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-only-shadow.html deleted file mode 100644 index 5116a8d..0000000 --- a/third_party/WebKit/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-only-shadow.html +++ /dev/null
@@ -1,11 +0,0 @@ -<!DOCTYPE html> - -<p>When the AuthorShadowDOM has only a shadow element, this should be rendered like no Shadow DOM is added.</p> -<form> - <textarea id="host">Something in the air</textarea> -</form> - -<script> -var shadowRoot = host.createShadowRoot(); -shadowRoot.appendChild(document.createElement('shadow')); -</script>
diff --git a/third_party/WebKit/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-with-attribute-expected.html b/third_party/WebKit/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-with-attribute-expected.html deleted file mode 100644 index 926aed89..0000000 --- a/third_party/WebKit/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-with-attribute-expected.html +++ /dev/null
@@ -1,6 +0,0 @@ -<!DOCTYPE html> - -<p>When the AuthorShadowDOM has only a shadow element, this should be rendered like no Shadow DOM is added.</p> -<form> - <textarea rows="8" cols="20">Something in the air</textarea> -</form>
diff --git a/third_party/WebKit/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-with-attribute.html b/third_party/WebKit/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-with-attribute.html deleted file mode 100644 index 78aa707..0000000 --- a/third_party/WebKit/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-with-attribute.html +++ /dev/null
@@ -1,11 +0,0 @@ -<!DOCTYPE html> - -<p>When the AuthorShadowDOM has only a shadow element, this should be rendered like no Shadow DOM is added.</p> -<form> - <textarea id="host" rows="8" cols="20">Something in the air</textarea> -</form> - -<script> -var shadowRoot = host.createShadowRoot(); -shadowRoot.appendChild(document.createElement('shadow')); -</script>
diff --git a/third_party/WebKit/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-with-style-expected.html b/third_party/WebKit/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-with-style-expected.html deleted file mode 100644 index e13700b..0000000 --- a/third_party/WebKit/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-with-style-expected.html +++ /dev/null
@@ -1,18 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -textarea { - margin: 10px; - border: 2px dashed black; - padding: 10px; -} -</head> -<body> - -<p>When the AuthorShadowDOM has only a shadow element, this should be rendered like no Shadow DOM is added.</p> -<form> - <textarea>Something in the air</textarea> -</form> - -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-with-style.html b/third_party/WebKit/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-with-style.html deleted file mode 100644 index ad4a501..0000000 --- a/third_party/WebKit/LayoutTests/fast/dom/shadow/shadowdom-for-textarea-with-style.html +++ /dev/null
@@ -1,22 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -textarea { - margin: 10px; - border: 2px dashed black; - padding: 10px; -} -</head> -<body> - -<p>When the AuthorShadowDOM has only a shadow element, this should be rendered like no Shadow DOM is added.</p> -<form> - <textarea id="host">Something in the air</textarea> -</form> - -<script> -var shadowRoot = host.createShadowRoot(); -shadowRoot.appendChild(document.createElement('shadow')); -</script> -</body> -</html>
diff --git a/third_party/WebKit/LayoutTests/fast/harness/results.html b/third_party/WebKit/LayoutTests/fast/harness/results.html index 2269f48..e474f99b 100644 --- a/third_party/WebKit/LayoutTests/fast/harness/results.html +++ b/third_party/WebKit/LayoutTests/fast/harness/results.html
@@ -15,7 +15,11 @@ button { margin-top: 4px; } - +input { + vertical-align: middle; + margin-top: 0; + margin-bottom: 0; +} p, h2, h3, h4 { margin: 8px 0 4px 0; } @@ -142,11 +146,6 @@ font-family: sans-serif; font-size: smaller; } -#filters input { - vertical-align: middle; - margin-top: 0; - margin-bottom: 0; -} .flag { display: inline-block; @@ -169,6 +168,10 @@ color: gray; } +#copied { + color: #4F8A10; + margin-left: 5px; +} </style> <body> <h3>Test run summary <span id="builder_name"></span></h3> @@ -187,12 +190,12 @@ <li><b>Tab</b> to select the next test. <li><b>Enter</b> to see test details. This will automatically close other details. <li><b>ctrl A</b> to select text of all tests for easy copying. - <li><b>f</b> to flag. + <li><b>f</b> to flag/unflag a test. </ul> <p>Modifiers:</p> <ul> <li><b>Shift</b> hold shift key to keep other details open. - <li><b>Meta</b> meta means all. Toggle all flags, open all results (max 100). + <li><b>Meta</b> meta means all. Set/unset all flags or open/close all results (max 100). </ul> <p>This page lets you query and display test results.</p> @@ -322,12 +325,12 @@ <option value="crashsite">Crash site</option> <option value="textmismatch">Text mismatch</option> </select> - <span style="margin-left: 20px"> - <button id="copy_report" title="Copy the shown tests to clipboard in the current format" - onclick="GUI.copyReport()" disabled>Copy report</button> - <button id="copy_single_line" title="Copy the shown tests to clipboard in a single line for use in command lines." - onclick="GUI.copySingleLine()" disabled>Copy single line</button> + <button id="copy_report" title="Copy the shown/flagged tests to clipboard in the current format" + onclick="GUI.copyResult(false)" disabled>Copy report</button> + <button id="copy_single_line" title="Copy the shown/flagged tests to clipboard in a single line for use in command lines." + onclick="GUI.copyResult(true)" disabled>Copy single line</button> + <label id="flagged_only" class="hidden"><input id="flagged_only_checkbox" type="checkbox" checked>Flagged only</label> <span id="copied" class="hidden">Copied.</span> </span> </div> @@ -378,8 +381,10 @@ } traverse(filter, action) { + console.time("traverse"); action = action || function() {}; this._helper(this.root, "", filter, action); + console.timeEnd("traverse"); } reset() { @@ -472,7 +477,8 @@ }, printFlag: (test) => { - return `<div class="flag ${test.flagged ? "flagged" : ""}"></div>`; + return `<div class="flag ${test.flagged ? "flagged" : ""}" + title="Hold Meta key to flag/unflag all tests."></div>`; }, printPlainTest: (test, path, traversal) => { @@ -557,8 +563,7 @@ report.appendChild(pre); }, - renderResultList: (html) => { - let report = document.querySelector("#report"); + renderResultList: (html, report) => { if (report.childNodes.length === 0 && html.length === 0) { Report.indicateNone(report); return; @@ -599,8 +604,7 @@ return container; }, - renderGroup: (html, keyed_title, null_title) => { - let report = document.querySelector("#report"); + renderGroup: (html, report, keyed_title, null_title) => { if (report.childNodes.length === 0 && html.length === 0) { Report.indicateNone(report); return; @@ -622,12 +626,12 @@ renderMap[key].container.insertAdjacentHTML('beforeend', renderMap[key].html); }, - renderGroupCrashSite: (html) => { - Report.renderGroup(html, "Crash site", "Didn't crash"); + renderGroupCrashSite: (html, report) => { + Report.renderGroup(html, report, "Crash site", "Didn't crash"); }, - renderGroupTextMismatch: (html) => { - Report.renderGroup(html, "Text mismatch failure", "Didn't find text mismatch"); + renderGroupTextMismatch: (html, report) => { + Report.renderGroup(html, report, "Text mismatch failure", "Didn't find text mismatch"); }, getTestById: (testId) => { @@ -794,6 +798,7 @@ // generateReport is async, returns promise. // promise id fullfilled when traversal completes. Display will continue async. generateReport: function(name, filter, report) { + console.time("generateReport"); if (this.currentRAF) window.cancelAnimationFrame(this.currentRAF); report = report || Report.getDefaultPrinter(); @@ -816,15 +821,15 @@ let callback = _ => { this.currentRAF = null; let html = traversal.html.slice(index, index + chunkSize); - report.render(html); + report.render(html, document.querySelector("#report")); index += chunkSize; document.querySelector("#progress").style.width = Math.min((index / traversal.html.length * 100), 100) + "%"; if (index < traversal.html.length) { this.currentRAF = window.requestAnimationFrame(callback); } else { document.querySelector("#report_count").innerText = traversal.filteredCount; - document.querySelector("#copy_report").disabled = traversal.html.length == 0; - document.querySelector("#copy_single_line").disabled = traversal.html.length == 0; + GUI.updateCopyButtons(); + console.timeEnd("generateReport"); } }; window.setTimeout( _ => { @@ -1049,7 +1054,7 @@ ; // Clicks in anchor, input or result-frame should perform default action } else if (GUI.isFlag(ev.target)) { GUI.toggleFlag(ev.target, ev); - } else if (expectation) { + } else if (expectation && window.getSelection().type != "Range") { GUI.toggleResults(expectation, ev); ev.preventDefault(); ev.stopPropagation(); @@ -1140,22 +1145,50 @@ }, 2000); }, - copyReport: function() { - GUI.copyText(document.querySelector("#report")); + copyResult: function(asSingleLine) { + console.time("copyResult"); + let flaggedOnly = document.querySelector(".flagged") && + document.querySelector("#flagged_only_checkbox").checked; + if (!flaggedOnly && !asSingleLine) { + GUI.copyText(document.querySelector("#report")); + return; + } + + let printer = Report.getDefaultPrinter(); + let singleLine = ""; + let traversal = new Traversal(globalResults.tests); + traversal.traverse(Query.lastReport.filter, (test, path) => { + if (flaggedOnly && !test.flagged) + return; + if (asSingleLine) { + let pathParser = new PathParser(path); + singleLine += pathParser.dir + pathParser.file + " "; + } else { + printer.print(test, path, traversal); + } + }); + let div = document.createElement("div"); + div.setAttribute("style", "overflow: hidden; color: white; height: 1px"); + if (asSingleLine) + div.textContent = singleLine; + else + printer.render(traversal.html, div); + document.body.appendChild(div); + GUI.copyText(div); + document.body.removeChild(div); + console.timeEnd("copyResult"); }, - copySingleLine: function() { - let singleLine = ""; - new Traversal(globalResults.tests).traverse(Query.lastReport.filter, (_, path) => { - let pathParser = new PathParser(path); - singleLine += pathParser.dir + pathParser.file + " "; - }); - let pre = document.createElement("pre"); - pre.setAttribute("style", "overflow: hidden; color: white; height: 1px"); - pre.textContent = singleLine; - document.body.appendChild(pre); - GUI.copyText(pre); - document.body.removeChild(pre); + updateCopyButtons: function() { + let has_result = document.querySelector(".expect"); + document.querySelector("#copy_report").disabled = !has_result; + document.querySelector("#copy_single_line").disabled = !has_result; + + let flagged_only = document.querySelector("#flagged_only"); + if (document.querySelector(".flagged")) + flagged_only.classList.remove("hidden"); + else + flagged_only.classList.add("hidden"); }, printSummary: function (fullResults) { @@ -1242,6 +1275,7 @@ } } } + GUI.updateCopyButtons(); }, toggleResults: function(expectation, event) {
diff --git a/third_party/WebKit/LayoutTests/fast/overflow/auto-with-block-overflow-expected.html b/third_party/WebKit/LayoutTests/fast/overflow/auto-with-block-overflow-expected.html new file mode 100644 index 0000000..0f78995 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/overflow/auto-with-block-overflow-expected.html
@@ -0,0 +1,8 @@ +<!DOCTYPE html> +<style> + /* Prevent auto viewport overflow, because that would trigger another + layout pass, hiding the bug. */ + body { overflow:hidden; } +</style> +<p>There should be a green square below. No red, orange or yellow.</p> +<div style="width:50px; height:50px; background:green;"></div>
diff --git a/third_party/WebKit/LayoutTests/fast/overflow/auto-with-block-overflow.html b/third_party/WebKit/LayoutTests/fast/overflow/auto-with-block-overflow.html new file mode 100644 index 0000000..0d41302c --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/overflow/auto-with-block-overflow.html
@@ -0,0 +1,19 @@ +<!DOCTYPE html> +<style> + /* Prevent auto viewport overflow, because that would trigger another + layout pass, hiding the bug. */ + body { overflow:hidden; } +</style> +<p>There should be a green square below. No red, orange or yellow.</p> +<!-- The outer container is there to clip painting of the scrollbar, + to make it easier to write a reftest. --> +<div style="overflow:hidden; width:50px; height:50px; background:orange;"> + <!-- The overflow:auto block needs auto width to be able to + reproduce the bug. Use a wide wrapper, so that the scrollbar + gets clipped. --> + <div style="width:100px; background:red;"> + <div style="overflow:auto; height:50px; background:yellow;"> + <div style="height:51px; background:green;"></div> + </div> + </div> +</div>
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/compositing/scrollbars/nested-overlay-scrollbars-expected.txt b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/compositing/scrollbars/nested-overlay-scrollbars-expected.txt new file mode 100644 index 0000000..1fb4025 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/compositing/scrollbars/nested-overlay-scrollbars-expected.txt
@@ -0,0 +1,118 @@ +{ + "layers": [ + { + "name": "LayoutView #document", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow (positioned) DIV id='outer'", + "position": [8, 8], + "bounds": [404, 404] + }, + { + "name": "Scrolling Layer", + "position": [10, 10], + "bounds": [400, 400], + "drawsContent": false + }, + { + "name": "Scrolling Contents Layer", + "position": [10, 10], + "bounds": [400, 704], + "transform": 1 + }, + { + "name": "LayoutNGBlockFlow (positioned) DIV id='inner'", + "position": [10, 510], + "bounds": [204, 204], + "transform": 1 + }, + { + "name": "Scrolling Layer", + "position": [12, 512], + "bounds": [200, 200], + "drawsContent": false, + "transform": 1 + }, + { + "name": "Scrolling Contents Layer", + "position": [12, 512], + "bounds": [5000, 9000], + "transform": 1 + }, + { + "name": "Squashing Containment Layer", + "position": [10, 10], + "drawsContent": false, + "transform": 1 + }, + { + "name": "LayoutNGBlockFlow (positioned) DIV id='grey'", + "position": [12, 512], + "bounds": [100, 800], + "contentsOpaque": true, + "backgroundColor": "#808080", + "transform": 1 + }, + { + "name": "Squashing Layer (first squashed layer: LayoutNGBlockFlow (positioned) DIV id='spacer')", + "position": [12, 2512], + "bounds": [5000, 1000], + "transform": 1 + }, + { + "name": "Overflow Controls Host Layer", + "position": [12, 512], + "bounds": [204, 204], + "drawsContent": false, + "transform": 1 + }, + { + "name": "Horizontal Scrollbar Layer", + "position": [14, 707], + "bounds": [193, 7], + "drawsContent": false, + "transform": 1 + }, + { + "name": "Vertical Scrollbar Layer", + "position": [207, 514], + "bounds": [7, 193], + "drawsContent": false, + "transform": 1 + }, + { + "name": "Scroll Corner Layer", + "position": [207, 707], + "bounds": [7, 7], + "transform": 1 + }, + { + "name": "Overflow Controls Host Layer", + "position": [8, 8], + "bounds": [404, 404], + "drawsContent": false + }, + { + "name": "Vertical Scrollbar Layer", + "position": [403, 10], + "bounds": [7, 400], + "drawsContent": false + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [0, -304, 0, 1] + ], + "flattenInheritedTransform": false + } + ] +} +
diff --git a/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/virtual/spv175/compositing/scrollbars/nested-overlay-scrollbars-expected.txt b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/virtual/spv175/compositing/scrollbars/nested-overlay-scrollbars-expected.txt new file mode 100644 index 0000000..cf4a154 --- /dev/null +++ b/third_party/WebKit/LayoutTests/flag-specific/enable-blink-features=LayoutNG/virtual/spv175/compositing/scrollbars/nested-overlay-scrollbars-expected.txt
@@ -0,0 +1,128 @@ +{ + "layers": [ + { + "name": "LayoutView #document", + "bounds": [800, 600], + "backgroundColor": "#FFFFFF" + }, + { + "name": "Scrolling Layer", + "bounds": [800, 600], + "drawsContent": false + }, + { + "name": "Scrolling Contents Layer", + "bounds": [800, 600], + "contentsOpaque": true, + "backgroundColor": "#FFFFFF" + }, + { + "name": "LayoutNGBlockFlow (positioned) DIV id='outer'", + "position": [8, 8], + "bounds": [404, 404] + }, + { + "name": "Scrolling Layer", + "position": [10, 10], + "bounds": [400, 400], + "drawsContent": false + }, + { + "name": "Scrolling Contents Layer", + "position": [10, 10], + "bounds": [400, 704], + "transform": 1 + }, + { + "name": "LayoutNGBlockFlow (positioned) DIV id='inner'", + "position": [10, 510], + "bounds": [204, 204], + "transform": 1 + }, + { + "name": "Scrolling Layer", + "position": [12, 512], + "bounds": [200, 200], + "drawsContent": false, + "transform": 1 + }, + { + "name": "Scrolling Contents Layer", + "position": [12, 512], + "bounds": [5000, 9000], + "transform": 1 + }, + { + "name": "Squashing Containment Layer", + "position": [10, 10], + "drawsContent": false, + "transform": 1 + }, + { + "name": "LayoutNGBlockFlow (positioned) DIV id='grey'", + "position": [12, 512], + "bounds": [100, 800], + "contentsOpaque": true, + "backgroundColor": "#808080", + "transform": 1 + }, + { + "name": "Squashing Layer (first squashed layer: LayoutNGBlockFlow (positioned) DIV id='spacer')", + "position": [12, 2512], + "bounds": [5000, 1000], + "transform": 1 + }, + { + "name": "Overflow Controls Host Layer", + "position": [12, 512], + "bounds": [204, 204], + "drawsContent": false, + "transform": 1 + }, + { + "name": "Horizontal Scrollbar Layer", + "position": [14, 707], + "bounds": [193, 7], + "drawsContent": false, + "transform": 1 + }, + { + "name": "Vertical Scrollbar Layer", + "position": [207, 514], + "bounds": [7, 193], + "drawsContent": false, + "transform": 1 + }, + { + "name": "Scroll Corner Layer", + "position": [207, 707], + "bounds": [7, 7], + "transform": 1 + }, + { + "name": "Overflow Controls Host Layer", + "position": [8, 8], + "bounds": [404, 404], + "drawsContent": false + }, + { + "name": "Vertical Scrollbar Layer", + "position": [403, 10], + "bounds": [7, 400], + "drawsContent": false + } + ], + "transforms": [ + { + "id": 1, + "transform": [ + [1, 0, 0, 0], + [0, 1, 0, 0], + [0, 0, 1, 0], + [0, -304, 0, 1] + ], + "flattenInheritedTransform": false + } + ] +} +
diff --git a/third_party/WebKit/LayoutTests/fragmentation/auto-overflow-expected.html b/third_party/WebKit/LayoutTests/fragmentation/auto-overflow-expected.html new file mode 100644 index 0000000..dc0413e --- /dev/null +++ b/third_party/WebKit/LayoutTests/fragmentation/auto-overflow-expected.html
@@ -0,0 +1,3 @@ +<!DOCTYPE html> +<p>There should be a hotpink square below.</p> +<div style="width:50px; height:50px; background:hotpink;"></div>
diff --git a/third_party/WebKit/LayoutTests/fragmentation/auto-overflow.html b/third_party/WebKit/LayoutTests/fragmentation/auto-overflow.html new file mode 100644 index 0000000..e0e579a18 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fragmentation/auto-overflow.html
@@ -0,0 +1,9 @@ +<!DOCTYPE html> +<p>There should be a hotpink square below.</p> +<div id="multicol" style="columns:3; column-fill:auto; column-gap:0; height:50px;"> + <div style="overflow:auto; height:100px; background:hotpink;"></div> +</div> +<script> + document.body.offsetTop; + document.getElementById("multicol").style.width = "75px"; +</script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/components/throttler.js b/third_party/WebKit/LayoutTests/http/tests/devtools/components/throttler.js index 41a9692..90a8f518 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/components/throttler.js +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/components/throttler.js
@@ -8,91 +8,91 @@ class TimeoutMock { constructor() { this._timeoutId = 0; - this._timeoutIdToProcess = {}; - this._timeoutIdToMillis = {}; + this._timeoutIdToProcess = new Map(); + this._timeoutIdToMillis = new Map(); + this._time = 1; this.setTimeout = this.setTimeout.bind(this); this.clearTimeout = this.clearTimeout.bind(this); + this.getTime = this.getTime.bind(this); } /** - * @param {!Function} operation - * @param {number} timeout - */ + * @param {!Function} operation + * @param {number} timeout + */ setTimeout(operation, timeout) { - this._timeoutIdToProcess[++this._timeoutId] = operation; - this._timeoutIdToMillis[this._timeoutId] = timeout; + this._timeoutIdToProcess.set(++this._timeoutId, operation); + this._timeoutIdToMillis.set(this._timeoutId, timeout); return this._timeoutId; } /** - * - * @param {number} timeoutId - */ + * + * @param {number} timeoutId + */ clearTimeout(timeoutId) { - delete this._timeoutIdToProcess[timeoutId]; - delete this._timeoutIdToMillis[timeoutId]; + this._timeoutIdToProcess.delete(timeoutId); + this._timeoutIdToMillis.delete(timeoutId); } /** - * @return {!Array<number>} - */ + * @return {!Array<number>} + */ activeTimersTimeouts() { - return Object.values(this._timeoutIdToMillis); + return Array.from(this._timeoutIdToMillis.values()); + } + + getTime() { + return this._time; } fireAllTimers() { - for (const timeoutId in this._timeoutIdToProcess) - this._timeoutIdToProcess[timeoutId].call(window); - this._timeoutIdToProcess = {}; - this._timeoutIdToMillis = {}; + this._time = Math.max(...this.activeTimersTimeouts()) + 1; + for (const timeoutId of this._timeoutIdToProcess.keys()) + this._timeoutIdToProcess.get(timeoutId).call(window); + this._timeoutIdToProcess.clear(); + this._timeoutIdToMillis.clear(); } } - var ProcessMock = function(name, runnable) { - this._runnable = runnable; - this.processName = name; - this.run = this.run.bind(this); - this.run.processName = name; + class ProcessMock { + constructor(name, runnable) { + this._runnable = runnable; + this.processName = name; + this.run = this.run.bind(this); + this.run.processName = name; - this.startPromise = new Promise(onStart.bind(this)); - this.finishPromise = new Promise(onFinish.bind(this)); - - function onStart(startCallback) { - this._startCallback = startCallback; + this.startPromise = new Promise(fulfill => this._startCallback = fulfill); + this.finishPromise = new Promise(fulfill => this._finishCallback = fulfill); } - function onFinish(finishCallback) { - this._finishCallback = finishCallback; - } - }; - - ProcessMock.create = function(name, runnable) { - return new ProcessMock(name, runnable); - }; - - ProcessMock.prototype = { - run: function() { + run() { TestRunner.addResult('Process \'' + this.processName + '\' STARTED.'); this._startCallback(); if (this._runnable) this._runnable.call(null); return this.finishPromise; - }, + } - finish: function() { + finish() { this.startPromise.then(onFinish.bind(this)); function onFinish() { TestRunner.addResult('Process \'' + this.processName + '\' FINISHED.'); this._finishCallback(); } - }, - }; + } + + static create(name, runnable) { + return new ProcessMock(name, runnable); + } + } var throttler = new Common.Throttler(1989); var timeoutMock = new TimeoutMock(); throttler._setTimeout = timeoutMock.setTimeout; throttler._clearTimeout = timeoutMock.clearTimeout; + throttler._getTime = timeoutMock.getTime; TestRunner.addSniffer(throttler, 'schedule', logSchedule, true); function testSimpleSchedule(next, runningProcess) { @@ -107,14 +107,12 @@ promise = waitForProcessFinish(); } - promise - .then(function() { - assertThrottlerTimeout(); - timeoutMock.fireAllTimers(); - process.finish(); - return waitForProcessFinish(); - }) - .then(next); + promise.then(() => { + assertThrottlerTimeout(); + timeoutMock.fireAllTimers(); + process.finish(); + return waitForProcessFinish(); + }).then(next); } function testAsSoonAsPossibleOverrideTimeout(next, runningProcess) {
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/editor/text-editor-search-switch-editor-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/editor/text-editor-search-switch-editor-expected.txt index ce32cd7..fe7e1bb4 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/editor/text-editor-search-switch-editor-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/editor/text-editor-search-switch-editor-expected.txt
@@ -7,5 +7,5 @@ viewports match, SUCCESS Comparing selection ranges... original selection range: {"startLine":203,"startColumn":7,"endLine":203,"endColumn":7} - current selection range: {"startLine":203,"startColumn":7,"endLine":203,"endColumn":13} + current selection range: {"startLine":203,"startColumn":7,"endLine":203,"endColumn":7}
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/elements/elements-panel-restore-selection-when-node-comes-later-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/elements/elements-panel-restore-selection-when-node-comes-later-expected.txt index cdbecaa26..f024bfc 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/elements/elements-panel-restore-selection-when-node-comes-later-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/elements/elements-panel-restore-selection-when-node-comes-later-expected.txt
@@ -5,6 +5,7 @@ Selected node: 'span' Running: firstReloadWithoutNodeInDOM +Page reloaded. Selected node: 'body' Running: secondReloadWithNodeInDOM
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/elements/elements-panel-restore-selection-when-node-comes-later.js b/third_party/WebKit/LayoutTests/http/tests/devtools/elements/elements-panel-restore-selection-when-node-comes-later.js index f5f4016..bf79249b 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/elements/elements-panel-restore-selection-when-node-comes-later.js +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/elements/elements-panel-restore-selection-when-node-comes-later.js
@@ -7,16 +7,7 @@ `Verify that last selected element is restored properly later, even if it failed to do so once.\n`); await TestRunner.loadModule('elements_test_runner'); await TestRunner.showPanel('elements'); - await TestRunner.loadHTML(` - <p> - Verify that last selected element is restored properly later, even if - it failed to do so once. - </p> - <div> - <span id="inspected"></span> - </div> - `); - await TestRunner.addScriptTag('../resources/elements-panel-shadow-selection-on-refresh.js'); + await TestRunner.navigatePromise('./resources/elements-panel-restore-selection-when-node-comes-later.html'); var node; @@ -80,17 +71,15 @@ } /** - * @param {string} pathToIgnore - */ + * @param {string} pathToIgnore + */ function overridePushNodeForPath(pathToIgnore) { var original = TestRunner.override(SDK.DOMModel.prototype, 'pushNodeByPathToFrontend', override); - function override(nodePath, callback) { - if (nodePath === pathToIgnore) { - setTimeout(callback.bind(null), 0); - return; - } - original(nodePath, callback); + function override(nodePath) { + if (nodePath === pathToIgnore) + return Promise.resolve(null); + return original(nodePath); } } })();
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/elements/resources/elements-panel-restore-selection-when-node-comes-later.html b/third_party/WebKit/LayoutTests/http/tests/devtools/elements/resources/elements-panel-restore-selection-when-node-comes-later.html new file mode 100644 index 0000000..50007572 --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/elements/resources/elements-panel-restore-selection-when-node-comes-later.html
@@ -0,0 +1,3 @@ +<div> + <span id="inspected"></span> +</div>
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/network/network-persistence-filename-safety.js b/third_party/WebKit/LayoutTests/http/tests/devtools/network/network-persistence-filename-safety.js index 4e48228..155b536 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/network/network-persistence-filename-safety.js +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/network/network-persistence-filename-safety.js
@@ -8,7 +8,6 @@ await TestRunner.loadModule('bindings_test_runner'); var {project} = await BindingsTestRunner.createOverrideProject('file:///tmp/'); - Persistence.networkPersistenceManager.addFileSystemOverridesProject(Persistence.NetworkPersistenceManager.inspectedPageDomain(), project); BindingsTestRunner.setOverridesEnabled(true); // Simple tests.
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/overrides/can-edit-iframe-html.js b/third_party/WebKit/LayoutTests/http/tests/devtools/overrides/can-edit-iframe-html.js index ab2dcad..9010739 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/overrides/can-edit-iframe-html.js +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/overrides/can-edit-iframe-html.js
@@ -9,7 +9,6 @@ var {project} = await BindingsTestRunner.createOverrideProject('file:///tmp/'); BindingsTestRunner.setOverridesEnabled(true); - Persistence.networkPersistenceManager.addFileSystemOverridesProject(Persistence.NetworkPersistenceManager.inspectedPageDomain(), project); // NOTE: localhost is considered coss-origin in this context and should be cross-origin. await TestRunner.addIframe('http://localhost:8000/devtools/resources/cross-origin-iframe.html');
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/overrides/files-save-without-hash.js b/third_party/WebKit/LayoutTests/http/tests/devtools/overrides/files-save-without-hash.js index c98f08b..bf437276 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/overrides/files-save-without-hash.js +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/overrides/files-save-without-hash.js
@@ -57,8 +57,6 @@ async function createFileSystem() { var {isolatedFileSystem, project} = await BindingsTestRunner.createOverrideProject(fileSystemPath); BindingsTestRunner.setOverridesEnabled(true); - Persistence.networkPersistenceManager.addFileSystemOverridesProject( - Persistence.NetworkPersistenceManager.inspectedPageDomain(), project); return {isolatedFileSystem, project}; } })();
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/overrides/project-added-with-existing-files-bind.js b/third_party/WebKit/LayoutTests/http/tests/devtools/overrides/project-added-with-existing-files-bind.js index 68dc7a7..b49d620 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/overrides/project-added-with-existing-files-bind.js +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/overrides/project-added-with-existing-files-bind.js
@@ -15,8 +15,6 @@ testFileSystem.addFile('127.0.0.1%3a8000/devtools/network/resources/empty.html', 'New Content'); BindingsTestRunner.setOverridesEnabled(true); - Persistence.networkPersistenceManager.addFileSystemOverridesProject( - Persistence.NetworkPersistenceManager.inspectedPageDomain(), project); TestRunner.addResult('Bound Files:'); for (var binding of bindings)
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-sourcemap-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-sourcemap-expected.txt index 831093a..ca97716 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-sourcemap-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-sourcemap-expected.txt
@@ -1,12 +1,12 @@ Verify that sourcemap sources are mapped with non-exact match. Binding created: { - network: http://127.0.0.1:8000/inspector/persistence/resources/s.css + network: http://127.0.0.1:8000/devtools/persistence/resources/s.css fileSystem: file:///var/www/dist/s.css exactMatch: true } Binding created: { - network: http://127.0.0.1:8000/inspector/persistence/resources/s.scss + network: http://127.0.0.1:8000/devtools/persistence/resources/s.scss fileSystem: file:///var/www/src/s.scss exactMatch: false }
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-sourcemap-nameclash-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-sourcemap-nameclash-expected.txt index e2343f57..24860b3 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-sourcemap-nameclash-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/persistence/automapping-sourcemap-nameclash-expected.txt
@@ -1,5 +1,3 @@ -CONSOLE MESSAGE: line 1: 1 -CONSOLE MESSAGE: line 1: function(){} Verify that sourcemap sources are mapped event when sourcemap compiled url matches with one of the source urls. Binding created: {
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/resource-har-conversion-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/resource-har-conversion-expected.txt index e774785..e9f8b31 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/resource-har-conversion-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/resource-har-conversion-expected.txt
@@ -98,7 +98,7 @@ statusText : "OK" } serverIPAddress : "127.0.0.1" - startedDateTime : <plausible> + startedDateTime : <string> time : <number> timings : <object> } @@ -141,7 +141,7 @@ statusText : "OK" } serverIPAddress : "127.0.0.1" - startedDateTime : <plausible> + startedDateTime : <string> time : <number> timings : <object> } @@ -153,7 +153,7 @@ onContentLoad : <number> onLoad : <number> } - startedDateTime : <plausible> + startedDateTime : <string> title : "http://127.0.0.1:8000/devtools/resources/inspected-page.html" } ]
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/resource-har-headers-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/resource-har-headers-expected.txt index 27b166e..eb07e76 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/resource-har-headers-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/resource-har-headers-expected.txt
@@ -67,7 +67,7 @@ statusText : "OK" } serverIPAddress : "" - startedDateTime : <object> + startedDateTime : <string> time : <number> timings : <object> }
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/resource-parameters-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/resource-parameters-expected.txt index a0fa3065..09243e7 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/resource-parameters-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/resource-parameters-expected.txt
@@ -45,7 +45,7 @@ content : { compression : <number> mimeType : "application/xml" - size : 14 + size : <number> } cookies : [ ] @@ -57,7 +57,7 @@ statusText : "OK" } serverIPAddress : "127.0.0.1" - startedDateTime : <plausible> + startedDateTime : <string> time : <number> timings : <object> }
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/resource-parameters-ipv6-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/resource-parameters-ipv6-expected.txt index e7d1d07..6db01b9b 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/resource-parameters-ipv6-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/resource-parameters-ipv6-expected.txt
@@ -45,7 +45,7 @@ content : { compression : <number> mimeType : "application/xml" - size : 14 + size : <number> } cookies : [ ] @@ -57,7 +57,7 @@ statusText : "OK" } serverIPAddress : "[::1]" - startedDateTime : <plausible> + startedDateTime : <string> time : <number> timings : <object> }
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/resource-parameters-ipv6.js b/third_party/WebKit/LayoutTests/http/tests/devtools/resource-parameters-ipv6.js index 9a65db8..af49fa0 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/resource-parameters-ipv6.js +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/resource-parameters-ipv6.js
@@ -26,7 +26,7 @@ function onRequestFinished(event) { var request = event.data; TestRunner.addResult(request.url()); - TestRunner.addObject(new NetworkLog.HAREntry(request).build(), NetworkTestRunner.HARPropertyFormatters); + TestRunner.addObject(new NetworkLog.HAREntry(request).build(), NetworkTestRunner.HARPropertyFormattersWithSize); TestRunner.completeTest(); } })();
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/resource-parameters.js b/third_party/WebKit/LayoutTests/http/tests/devtools/resource-parameters.js index e5c0729..dabf054 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/resource-parameters.js +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/resource-parameters.js
@@ -26,7 +26,7 @@ function onRequestFinished(event) { var request = event.data; TestRunner.addResult(request.url()); - TestRunner.addObject(new NetworkLog.HAREntry(request).build(), NetworkTestRunner.HARPropertyFormatters); + TestRunner.addObject(new NetworkLog.HAREntry(request).build(), NetworkTestRunner.HARPropertyFormattersWithSize); TestRunner.completeTest(); } })();
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/security/origin-view-then-interstitial-expected.txt b/third_party/WebKit/LayoutTests/http/tests/devtools/security/origin-view-then-interstitial-expected.txt index e5c78a5d..41cc7a7 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/security/origin-view-then-interstitial-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/security/origin-view-then-interstitial-expected.txt
@@ -23,7 +23,7 @@ <DIV class=security-summary-text > </DIV> </DIV> - <DIV class=security-explanation-list > + <DIV class=security-explanation-list security-explanations-main > </DIV> <DIV class=security-explanation-list security-explanations-extra > </DIV> @@ -78,7 +78,7 @@ <DIV class=security-summary-text > </DIV> </DIV> - <DIV class=security-explanation-list > + <DIV class=security-explanation-list security-explanations-main > </DIV> <DIV class=security-explanation-list security-explanations-extra > </DIV>
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/sources/debugger-ui/source-frame-count.js b/third_party/WebKit/LayoutTests/http/tests/devtools/sources/debugger-ui/source-frame-count.js deleted file mode 100644 index f9cead5..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/sources/debugger-ui/source-frame-count.js +++ /dev/null
@@ -1,46 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -(async function() { - TestRunner.addResult( - `Tests that scripts panel does not create too many source frames.\n`); - await TestRunner.loadModule('sources_test_runner'); - await TestRunner.showPanel('sources'); - await TestRunner.navigatePromise('resources/source-frame-count.html'); - - var framesOpened = 0; - - SourcesTestRunner.runDebuggerTestSuite([function testSourceFramesCount(next) { - var panel = UI.panels.sources; - - SourcesTestRunner.showScriptSource( - 'source-frame-count.html', function() {}); - SourcesTestRunner.showScriptSource('script1.js', function() {}); - SourcesTestRunner.showScriptSource('script2.js', function() {}); - SourcesTestRunner.showScriptSource('script3.js', function() {}); - SourcesTestRunner.showScriptSource('script4.js', function() {}); - SourcesTestRunner.showScriptSource('script5.js', reloadThePage); - - function reloadThePage() { - TestRunner.addResult('Reloading page...'); - TestRunner.reloadPage(didReload); - function didCreateSourceFrame() { - framesOpened++; - } - TestRunner.addSniffer( - SourceFrame.SourceFrame.prototype, 'wasShown', didCreateSourceFrame, - true); - } - - function didReload() { - if (framesOpened > 3) - TestRunner.addResult('Too many frames opened: ' + framesOpened); - else - TestRunner.addResult('Less than 3 frames opened'); - TestRunner.addResult( - 'Visible view: ' + panel.visibleView._uiSourceCode.name()); - next(); - } - }]); -})();
diff --git a/third_party/WebKit/LayoutTests/http/tests/devtools/workers-on-navigation.js b/third_party/WebKit/LayoutTests/http/tests/devtools/workers-on-navigation.js index 8ad3009..465fe60d 100644 --- a/third_party/WebKit/LayoutTests/http/tests/devtools/workers-on-navigation.js +++ b/third_party/WebKit/LayoutTests/http/tests/devtools/workers-on-navigation.js
@@ -31,8 +31,8 @@ } } }; - await TestRunner.navigatePromise('resources/workers-on-navigation-resource.html'); SDK.targetManager.observeTargets(observer); + await TestRunner.navigatePromise('resources/workers-on-navigation-resource.html'); await TestRunner.evaluateInPagePromise('startWorker()'); await TestRunner.reloadPagePromise(); navigated = true;
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/page/navigate-loader-id-expected.txt b/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/page/navigate-loader-id-expected.txt new file mode 100644 index 0000000..70d0628de --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/page/navigate-loader-id-expected.txt
@@ -0,0 +1,2 @@ +Tests that Page.navigate() returns the loader id that matches one in network events +
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/page/navigate-loader-id.js b/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/page/navigate-loader-id.js new file mode 100644 index 0000000..19353d3 --- /dev/null +++ b/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/page/navigate-loader-id.js
@@ -0,0 +1,16 @@ +(async function(testRunner) { + var {page, session, dp} = await testRunner.startBlank( + `Tests that Page.navigate() returns the loader id that matches one in network events`); + + await dp.Page.enable(); + await dp.Network.enable(); + var navigatePromise = dp.Page.navigate({url: testRunner.url('../resources/blank.html')}); + var requestWillBeSent = (await dp.Network.onceRequestWillBeSent()).params; + var navigateResult = (await navigatePromise).result; + + if (navigateResult.loaderId !== requestWillBeSent.loaderId) { + testRunner.fail(`loaderId from Page.navigate is ${navigateResult.loaderId} + and loaderId in RequestWillBeSent is ${requestWillBeSent.loaderId}`); + } + testRunner.completeTest(); +})
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium.fetch-event-request-body.html b/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium.fetch-event-request-body.html index 2a5760b..9f542a3 100644 --- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium.fetch-event-request-body.html +++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium.fetch-event-request-body.html
@@ -8,18 +8,20 @@ <script src="/resources/testharnessreport.js"></script> <script src="resources/test-helpers.js"></script> <script> -// This tests that FetchEvent#request.body is set. The service -// worker reads the body and then postMessage()'s back to the -// main page. It's using postMessage since there is some other -// bug with S13nSW that prevents using respondWith() with POST. +// This tests that FetchEvent#request.body is set. The service worker reads the +// body and then postMessage()'s back to the main page. It's using postMessage +// since there is some other bug with S13nSW that prevents using respondWith() +// with POST. promise_test(t => { const kScope = 'resources/new'; const kScript = 'resources/fetch-event-request-body-worker.js'; let sw; + let registration; return service_worker_unregister_and_register(t, kScript, kScope) .then(reg => { - add_completion_callback(() => { + registration = reg; + add_result_callback(() => { reg.unregister(); }); sw = reg.installing; @@ -46,6 +48,47 @@ }) .then(data => { assert_equals(data, 'i am the request body'); + return registration.unregister(); }); - }, 'FetchEvent#request.body is set'); + }, 'FetchEvent#request.body is set (text)'); + +promise_test(t => { + const kScope = 'resources/new-blob'; + const kScript = 'resources/fetch-event-request-body-worker.js'; + let sw; + + return service_worker_unregister_and_register(t, kScript, kScope) + .then(reg => { + add_completion_callback(() => { + reg.unregister(); + }); + sw = reg.installing; + return wait_for_state(t, sw, 'activated'); + }) + .then(() => { + return with_iframe(kScope); + }) + .then(frame => { + add_completion_callback(() => { + frame.remove(); + }); + + sw.postMessage('ping'); + var blob = new Blob(['it\'s me the blob', ' ', + 'and more blob!']); + + frame.contentWindow.fetch('blank.html?fetch-with-body', { + method: 'POST', + body: blob + }); + return new Promise(resolve => { + navigator.serviceWorker.addEventListener('message', e => { + resolve(e.data); + }); + }); + }) + .then(data => { + assert_equals(data, 'it\'s me the blob and more blob!'); + }); + }, 'FetchEvent#request.body is set (blob)'); </script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/fetch-event-request-body-worker.js b/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/fetch-event-request-body-worker.js index 1fbf6f6..0c41688 100644 --- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/fetch-event-request-body-worker.js +++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/fetch-event-request-body-worker.js
@@ -6,6 +6,7 @@ self.addEventListener('fetch', event => { if (event.request.url.indexOf('fetch-with-body') != -1) { + event.respondWith(new Response('(unused response)')); event.waitUntil(Promise.resolve() .then(() => { return event.request.text(); }) .then(body => { source.postMessage(body); }));
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/page/reload-dataurl-expected.txt b/third_party/WebKit/LayoutTests/inspector-protocol/page/reload-dataurl-expected.txt new file mode 100644 index 0000000..a5d49d64 --- /dev/null +++ b/third_party/WebKit/LayoutTests/inspector-protocol/page/reload-dataurl-expected.txt
@@ -0,0 +1,3 @@ +Tests reloading pages with data URLs. +Querying window.foo after reload (expect "undefined"): undefined +
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/page/reload-dataurl.js b/third_party/WebKit/LayoutTests/inspector-protocol/page/reload-dataurl.js new file mode 100644 index 0000000..13d343a9 --- /dev/null +++ b/third_party/WebKit/LayoutTests/inspector-protocol/page/reload-dataurl.js
@@ -0,0 +1,14 @@ +(async function(testRunner) { + var {page, session, dp} = await testRunner.startBlank('Tests reloading pages with data URLs.'); + + await dp.Page.enable(); + + await dp.Page.navigate({url: 'data:text/html,hello!'}); + await session.evaluate(() => window.foo = 42); + await dp.Page.reload(); + dp.Page.setLifecycleEventsEnabled({enabled: true}); + await dp.Page.onceLifecycleEvent(event => event.params.name === 'load'); + + testRunner.log('Querying window.foo after reload (expect "undefined"): ' + (await session.evaluate(() => window.foo))); + testRunner.completeTest(); +})
diff --git a/third_party/WebKit/LayoutTests/platform/linux/http/tests/devtools/resource-parameters-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/http/tests/devtools/resource-parameters-expected.txt deleted file mode 100644 index a0fa3065..0000000 --- a/third_party/WebKit/LayoutTests/platform/linux/http/tests/devtools/resource-parameters-expected.txt +++ /dev/null
@@ -1,64 +0,0 @@ -Tests that resources panel shows form data parameters. - -http://127.0.0.1:8000/devtools/resources/post-target.cgi?queryParam1=queryValue1&queryParam2= -{ - cache : { - } - connection : <string> - request : { - bodySize : <number> - cookies : [ - ] - headers : <object> - headersSize : <number> - httpVersion : "HTTP/1.1" - method : "POST" - postData : { - mimeType : "application/x-www-form-urlencoded" - params : [ - { - name : "formParam1" - value : "formValue1" - } - { - name : "formParam2" - value : "" - } - ] - text : "formParam1=formValue1&formParam2=" - } - queryString : [ - { - name : "queryParam1" - value : "queryValue1" - } - { - name : "queryParam2" - value : "" - } - ] - url : "http://127.0.0.1:8000/devtools/resources/post-target.cgi?queryParam1=queryValue1&queryParam2=" - } - response : { - _transferSize : <number> - bodySize : <number> - content : { - compression : <number> - mimeType : "application/xml" - size : 14 - } - cookies : [ - ] - headers : <object> - headersSize : <number> - httpVersion : "HTTP/1.1" - redirectURL : "" - status : 200 - statusText : "OK" - } - serverIPAddress : "127.0.0.1" - startedDateTime : <plausible> - time : <number> - timings : <object> -} -
diff --git a/third_party/WebKit/LayoutTests/platform/linux/http/tests/devtools/resource-parameters-ipv6-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/http/tests/devtools/resource-parameters-ipv6-expected.txt deleted file mode 100644 index e7d1d07..0000000 --- a/third_party/WebKit/LayoutTests/platform/linux/http/tests/devtools/resource-parameters-ipv6-expected.txt +++ /dev/null
@@ -1,64 +0,0 @@ -Tests that resources panel shows form data parameters. - -http://[::1]:8000/devtools/resources/post-target.cgi?queryParam1=queryValue1&queryParam2= -{ - cache : { - } - connection : <string> - request : { - bodySize : <number> - cookies : [ - ] - headers : <object> - headersSize : <number> - httpVersion : "HTTP/1.1" - method : "POST" - postData : { - mimeType : "application/x-www-form-urlencoded" - params : [ - { - name : "formParam1" - value : "formValue1" - } - { - name : "formParam2" - value : "" - } - ] - text : "formParam1=formValue1&formParam2=" - } - queryString : [ - { - name : "queryParam1" - value : "queryValue1" - } - { - name : "queryParam2" - value : "" - } - ] - url : "http://[::1]:8000/devtools/resources/post-target.cgi?queryParam1=queryValue1&queryParam2=" - } - response : { - _transferSize : <number> - bodySize : <number> - content : { - compression : <number> - mimeType : "application/xml" - size : 14 - } - cookies : [ - ] - headers : <object> - headersSize : <number> - httpVersion : "HTTP/1.1" - redirectURL : "" - status : 200 - statusText : "OK" - } - serverIPAddress : "[::1]" - startedDateTime : <plausible> - time : <number> - timings : <object> -} -
diff --git a/third_party/WebKit/LayoutTests/platform/win/http/tests/devtools/resource-parameters-expected.txt b/third_party/WebKit/LayoutTests/platform/win/http/tests/devtools/resource-parameters-expected.txt deleted file mode 100644 index 459214e..0000000 --- a/third_party/WebKit/LayoutTests/platform/win/http/tests/devtools/resource-parameters-expected.txt +++ /dev/null
@@ -1,64 +0,0 @@ -Tests that resources panel shows form data parameters. - -http://127.0.0.1:8000/devtools/resources/post-target.cgi?queryParam1=queryValue1&queryParam2= -{ - cache : { - } - connection : <string> - request : { - bodySize : <number> - cookies : [ - ] - headers : <object> - headersSize : <number> - httpVersion : "HTTP/1.1" - method : "POST" - postData : { - mimeType : "application/x-www-form-urlencoded" - params : [ - { - name : "formParam1" - value : "formValue1" - } - { - name : "formParam2" - value : "" - } - ] - text : "formParam1=formValue1&formParam2=" - } - queryString : [ - { - name : "queryParam1" - value : "queryValue1" - } - { - name : "queryParam2" - value : "" - } - ] - url : "http://127.0.0.1:8000/devtools/resources/post-target.cgi?queryParam1=queryValue1&queryParam2=" - } - response : { - _transferSize : <number> - bodySize : <number> - content : { - compression : <number> - mimeType : "application/xml" - size : 15 - } - cookies : [ - ] - headers : <object> - headersSize : <number> - httpVersion : "HTTP/1.1" - redirectURL : "" - status : 200 - statusText : "OK" - } - serverIPAddress : "127.0.0.1" - startedDateTime : <plausible> - time : <number> - timings : <object> -} -
diff --git a/third_party/WebKit/LayoutTests/platform/win/http/tests/devtools/resource-parameters-ipv6-expected.txt b/third_party/WebKit/LayoutTests/platform/win/http/tests/devtools/resource-parameters-ipv6-expected.txt deleted file mode 100644 index 896db25..0000000 --- a/third_party/WebKit/LayoutTests/platform/win/http/tests/devtools/resource-parameters-ipv6-expected.txt +++ /dev/null
@@ -1,64 +0,0 @@ -Tests that resources panel shows form data parameters. - -http://[::1]:8000/devtools/resources/post-target.cgi?queryParam1=queryValue1&queryParam2= -{ - cache : { - } - connection : <string> - request : { - bodySize : <number> - cookies : [ - ] - headers : <object> - headersSize : <number> - httpVersion : "HTTP/1.1" - method : "POST" - postData : { - mimeType : "application/x-www-form-urlencoded" - params : [ - { - name : "formParam1" - value : "formValue1" - } - { - name : "formParam2" - value : "" - } - ] - text : "formParam1=formValue1&formParam2=" - } - queryString : [ - { - name : "queryParam1" - value : "queryValue1" - } - { - name : "queryParam2" - value : "" - } - ] - url : "http://[::1]:8000/devtools/resources/post-target.cgi?queryParam1=queryValue1&queryParam2=" - } - response : { - _transferSize : <number> - bodySize : <number> - content : { - compression : <number> - mimeType : "application/xml" - size : 15 - } - cookies : [ - ] - headers : <object> - headersSize : <number> - httpVersion : "HTTP/1.1" - redirectURL : "" - status : 200 - statusText : "OK" - } - serverIPAddress : "[::1]" - startedDateTime : <plausible> - time : <number> - timings : <object> -} -
diff --git a/third_party/WebKit/LayoutTests/typedcssom/cssMatrixComponent.html b/third_party/WebKit/LayoutTests/typedcssom/cssMatrixComponent.html index 3920f6a..fe4f6ea 100644 --- a/third_party/WebKit/LayoutTests/typedcssom/cssMatrixComponent.html +++ b/third_party/WebKit/LayoutTests/typedcssom/cssMatrixComponent.html
@@ -72,6 +72,19 @@ } test(() => { + for (let param of testParams) { + let matrixComponent = new CSSMatrixComponent(param.input, {}); + assert_equals(matrixComponent.is2D, param.input.is2D); + matrixComponent = new CSSMatrixComponent(param.input, {is2D: undefined}); + assert_equals(matrixComponent.is2D, param.input.is2D); + matrixComponent = new CSSMatrixComponent(param.input, undefined); + assert_equals(matrixComponent.is2D, param.input.is2D); + matrixComponent = new CSSMatrixComponent(param.input, null); + assert_equals(matrixComponent.is2D, param.input.is2D); + } +}, "is2D value should be matrix's is2D when second parameter is not CSSMatrixComponentOptions"); + +test(() => { assert_throws(new TypeError(), () => { new CSSMatrixComponent(); }); assert_throws(new TypeError(), () => { new CSSMatrixComponent(0); }); assert_throws(new TypeError(), () => { new CSSMatrixComponent("string") });
diff --git a/third_party/WebKit/LayoutTests/typedcssom/inlinestyle/properties/transform.html b/third_party/WebKit/LayoutTests/typedcssom/inlinestyle/properties/transform.html index 105507e..9d77edf 100644 --- a/third_party/WebKit/LayoutTests/typedcssom/inlinestyle/properties/transform.html +++ b/third_party/WebKit/LayoutTests/typedcssom/inlinestyle/properties/transform.html
@@ -114,25 +114,6 @@ invalidObjects: [CSS.px(4)] }); -let crashTestStrings = { - 'skew(calc(5deg + 0.1rad))': 'skew(calc(10.7296deg))', - 'skew(calc(5deg + 0.1rad), 5deg)': 'skew(calc(10.7296deg), 5deg)', - 'skew(5deg, calc(5deg + 0.1rad))': 'skew(5deg, calc(10.7296deg))', - 'skewX(calc(5deg + 0.1rad))': 'skewX(calc(10.7296deg))', - 'skewY(calc(5deg + 0.1rad))': 'skewY(calc(10.7296deg))', - 'perspective(calc(10px + 5em))': 'perspective(calc(10px + 5em))', -}; - -for (let inputString in crashTestStrings) { - test(() => { - testElement.style.transform = inputString; - let result = testElement.attributeStyleMap.get('transform'); - assert_equals(result.constructor, CSSStyleValue, - 'result is a base CSSStyleValue'); - assert_equals(result.toString(), crashTestStrings[inputString]); - }, "Getting transform when it is set to " + inputString + " does not crash"); -} - // TODO(meade): Remove/update this test once translate is supported. test(function() { testElement.style.transform = 'translateY(50px)';
diff --git a/third_party/WebKit/LayoutTests/typedcssom/stylevalue-subclasses/cssPerspective-expected.txt b/third_party/WebKit/LayoutTests/typedcssom/stylevalue-subclasses/cssPerspective-expected.txt deleted file mode 100644 index 99c6425e..0000000 --- a/third_party/WebKit/LayoutTests/typedcssom/stylevalue-subclasses/cssPerspective-expected.txt +++ /dev/null
@@ -1,22 +0,0 @@ -This is a testharness.js-based test. -PASS Constructing a CSSPerspective with a keyword throws a TypeError -PASS Constructing a CSSPerspective with a double throws a TypeError -PASS Constructing a CSSPerspective with a unitless zero throws a TypeError -PASS Constructing a CSSPerspective with a string length throws a TypeError -PASS Constructing a CSSPerspective with a number CSSUnitValue throws a TypeError -PASS Constructing a CSSPerspective with a time dimension CSSUnitValue throws a TypeError -PASS Constructing a CSSPerspective with a CSSMathValue of angle type throws a TypeError -PASS Updating CSSPerspective.length with a keyword throws a TypeError -PASS Updating CSSPerspective.length with a double throws a TypeError -PASS Updating CSSPerspective.length with a unitless zero throws a TypeError -PASS Updating CSSPerspective.length with a string length throws a TypeError -PASS Updating CSSPerspective.length with a number CSSUnitValue throws a TypeError -PASS Updating CSSPerspective.length with a time dimension CSSUnitValue throws a TypeError -PASS Updating CSSPerspective.length with a CSSMathValue of angle type throws a TypeError -PASS CSSPerspective can be constructed from a length CSSUnitValue -PASS CSSPerspective.length can be updated to a length CSSUnitValue -FAIL CSSPerspective can be constructed from a CSSMathValue of length type Failed to construct 'CSSPerspective': Must pass length to CSSPerspective -FAIL CSSPerspective.length can be updated to a CSSMathValue of length type Failed to set the 'length' property on 'CSSPerspective': Must pass length to CSSPerspective -PASS Modifying CSSPerspective.is2D is a no-op -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/typedcssom/stylevalue-subclasses/cssSkew-expected.txt b/third_party/WebKit/LayoutTests/typedcssom/stylevalue-subclasses/cssSkew-expected.txt deleted file mode 100644 index 6399921..0000000 --- a/third_party/WebKit/LayoutTests/typedcssom/stylevalue-subclasses/cssSkew-expected.txt +++ /dev/null
@@ -1,33 +0,0 @@ -This is a testharness.js-based test. -PASS Constructing a CSSSkew with a keyword throws a TypeError -PASS Constructing a CSSSkew with a double throws a TypeError -PASS Constructing a CSSSkew with a unitless zero throws a TypeError -PASS Constructing a CSSSkew with a string angle throws a TypeError -PASS Constructing a CSSSkew with a number CSSUnitValue throws a TypeError -PASS Constructing a CSSSkew with a time dimension CSSUnitValue throws a TypeError -PASS Constructing a CSSSkew with a CSSMathValue of length type throws a TypeError -PASS Updating CSSSkew.ax with a keyword throws a TypeError -PASS Updating CSSSkew.ax with a double throws a TypeError -PASS Updating CSSSkew.ax with a unitless zero throws a TypeError -PASS Updating CSSSkew.ax with a string angle throws a TypeError -PASS Updating CSSSkew.ax with a number CSSUnitValue throws a TypeError -PASS Updating CSSSkew.ax with a time dimension CSSUnitValue throws a TypeError -PASS Updating CSSSkew.ax with a CSSMathValue of length type throws a TypeError -PASS Updating CSSSkew.ay with a keyword throws a TypeError -PASS Updating CSSSkew.ay with a double throws a TypeError -PASS Updating CSSSkew.ay with a unitless zero throws a TypeError -PASS Updating CSSSkew.ay with a string angle throws a TypeError -PASS Updating CSSSkew.ay with a number CSSUnitValue throws a TypeError -PASS Updating CSSSkew.ay with a time dimension CSSUnitValue throws a TypeError -PASS Updating CSSSkew.ay with a CSSMathValue of length type throws a TypeError -PASS CSSSkew can be constructed from an angle CSSUnitValue and an angle CSSUnitValue -FAIL CSSSkew can be constructed from an angle CSSUnitValue and a CSSMathValue of angle type Failed to construct 'CSSSkew': CSSSkew does not support non-angles -FAIL CSSSkew can be constructed from a CSSMathValue of angle type and an angle CSSUnitValue Failed to construct 'CSSSkew': CSSSkew does not support non-angles -FAIL CSSSkew can be constructed from a CSSMathValue of angle type and a CSSMathValue of angle type Failed to construct 'CSSSkew': CSSSkew does not support non-angles -PASS CSSSkew.ax can be updated to an angle CSSUnitValue -FAIL CSSSkew.ax can be updated to a CSSMathValue of angle type Failed to set the 'ax' property on 'CSSSkew': Must specify an angle unit -PASS CSSSkew.ay can be updated to an angle CSSUnitValue -FAIL CSSSkew.ay can be updated to a CSSMathValue of angle type Failed to set the 'ay' property on 'CSSSkew': Must specify an angle unit -PASS Modifying CSSSkew.is2D is a no-op -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/typedcssom/the-stylepropertymap/set-expected.txt b/third_party/WebKit/LayoutTests/typedcssom/the-stylepropertymap/set-expected.txt index 512886c..dccebf58 100644 --- a/third_party/WebKit/LayoutTests/typedcssom/the-stylepropertymap/set-expected.txt +++ b/third_party/WebKit/LayoutTests/typedcssom/the-stylepropertymap/set-expected.txt
@@ -3,6 +3,7 @@ PASS Setting a StylePropertyMap with an null property name throws TypeError PASS Setting a StylePropertyMap with an invalid CSSStyleValue throws TypeError PASS Setting a StylePropertyMap with an invalid String throws TypeError +PASS Setting a non list-valued property with multiple arguments throws TypeError PASS Setting a property with CSSStyleValue or String updates its value PASS Setting a list-valued property with CSSStyleValue or String updates its values FAIL Setting a custom property with CSSStyleValue or String updates its value Failed to execute 'set' on 'StylePropertyMap': Invalid propertyName: --foo
diff --git a/third_party/WebKit/LayoutTests/typedcssom/the-stylepropertymap/set.html b/third_party/WebKit/LayoutTests/typedcssom/the-stylepropertymap/set.html index 6791af40..7c04c5e 100644 --- a/third_party/WebKit/LayoutTests/typedcssom/the-stylepropertymap/set.html +++ b/third_party/WebKit/LayoutTests/typedcssom/the-stylepropertymap/set.html
@@ -24,6 +24,11 @@ test(() => { let styleMap = newDivWithStyle().attributeStyleMap; + assert_throws(new TypeError(), () => styleMap.set('width', CSS.px(10), CSS.px(10))); +}, 'Setting a non list-valued property with multiple arguments throws TypeError'); + +test(() => { + let styleMap = newDivWithStyle().attributeStyleMap; styleMap.set('width', CSS.px(10)); assert_style_value_array_equals(styleMap.get('width'), CSS.px(10));
diff --git a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/element-instance-property-listing-expected.txt b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/element-instance-property-listing-expected.txt index 5e57eaf..df97cbd 100644 --- a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/element-instance-property-listing-expected.txt +++ b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/element-instance-property-listing-expected.txt
@@ -582,6 +582,7 @@ property crossOrigin property currentSrc property decode + property decoding property height property hspace property isMap @@ -1735,6 +1736,7 @@ property transform svg element image property decode + property decoding property farthestViewportElement property getBBox property getCTM
diff --git a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-expected.txt index 247bb61..089a6e4e 100644 --- a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-expected.txt +++ b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-expected.txt
@@ -2205,6 +2205,7 @@ getter complete getter crossOrigin getter currentSrc + getter decoding getter height getter hspace getter isMap @@ -2228,6 +2229,7 @@ setter alt setter border setter crossOrigin + setter decoding setter height setter hspace setter isMap @@ -3205,6 +3207,7 @@ getter complete getter crossOrigin getter currentSrc + getter decoding getter height getter hspace getter isMap @@ -3228,6 +3231,7 @@ setter alt setter border setter crossOrigin + setter decoding setter height setter hspace setter isMap @@ -5178,6 +5182,7 @@ method getScreenCTM interface SVGImageElement : SVGGraphicsElement attribute @@toStringTag + getter decoding getter height getter href getter preserveAspectRatio @@ -5186,6 +5191,7 @@ getter y method constructor method decode + setter decoding interface SVGLength attribute @@toStringTag attribute SVG_LENGTHTYPE_CM
diff --git a/third_party/WebKit/LayoutTests/webexposed/element-instance-property-listing-expected.txt b/third_party/WebKit/LayoutTests/webexposed/element-instance-property-listing-expected.txt index 59db6af..9ca5887 100644 --- a/third_party/WebKit/LayoutTests/webexposed/element-instance-property-listing-expected.txt +++ b/third_party/WebKit/LayoutTests/webexposed/element-instance-property-listing-expected.txt
@@ -377,6 +377,7 @@ property onafterprint property onbeforeprint property onbeforeunload + property onfreeze property onhashchange property onlanguagechange property onmessage @@ -387,6 +388,7 @@ property onpageshow property onpopstate property onrejectionhandled + property onresume property onstorage property onunhandledrejection property onunload @@ -528,6 +530,7 @@ property onafterprint property onbeforeprint property onbeforeunload + property onfreeze property onhashchange property onlanguagechange property onmessage @@ -538,6 +541,7 @@ property onpageshow property onpopstate property onrejectionhandled + property onresume property onstorage property onunhandledrejection property onunload
diff --git a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt index 0cd4d94..d919b3fe 100644 --- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt +++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
@@ -2245,6 +2245,7 @@ getter onblur getter onerror getter onfocus + getter onfreeze getter onhashchange getter onlanguagechange getter onload @@ -2257,6 +2258,7 @@ getter onpopstate getter onrejectionhandled getter onresize + getter onresume getter onscroll getter onstorage getter onunhandledrejection @@ -2274,6 +2276,7 @@ setter onblur setter onerror setter onfocus + setter onfreeze setter onhashchange setter onlanguagechange setter onload @@ -2286,6 +2289,7 @@ setter onpopstate setter onrejectionhandled setter onresize + setter onresume setter onscroll setter onstorage setter onunhandledrejection @@ -2686,6 +2690,7 @@ getter onblur getter onerror getter onfocus + getter onfreeze getter onhashchange getter onlanguagechange getter onload @@ -2698,6 +2703,7 @@ getter onpopstate getter onrejectionhandled getter onresize + getter onresume getter onscroll getter onstorage getter onunhandledrejection @@ -2711,6 +2717,7 @@ setter onblur setter onerror setter onfocus + setter onfreeze setter onhashchange setter onlanguagechange setter onload @@ -2723,6 +2730,7 @@ setter onpopstate setter onrejectionhandled setter onresize + setter onresume setter onscroll setter onstorage setter onunhandledrejection @@ -9232,6 +9240,7 @@ getter onended getter onerror getter onfocus + getter onfreeze getter ongotpointercapture getter onhashchange getter oninput @@ -9276,6 +9285,7 @@ getter onrejectionhandled getter onreset getter onresize + getter onresume getter onscroll getter onsearch getter onseeked @@ -9414,6 +9424,7 @@ setter onended setter onerror setter onfocus + setter onfreeze setter ongotpointercapture setter onhashchange setter oninput @@ -9458,6 +9469,7 @@ setter onrejectionhandled setter onreset setter onresize + setter onresume setter onscroll setter onsearch setter onseeked
diff --git a/third_party/WebKit/Source/DEPS b/third_party/WebKit/Source/DEPS index a48bc83..06538f2 100644 --- a/third_party/WebKit/Source/DEPS +++ b/third_party/WebKit/Source/DEPS
@@ -2,6 +2,7 @@ "+base/callback.h", "+base/callback_forward.h", "+base/debug", + "+base/location.h", "+base/macros.h", "+base/memory/weak_ptr.h", "+base/gtest_prod_util.h",
diff --git a/third_party/WebKit/Source/OWNERS b/third_party/WebKit/Source/OWNERS index 99a70f4..caf20ca 100644 --- a/third_party/WebKit/Source/OWNERS +++ b/third_party/WebKit/Source/OWNERS
@@ -1,3 +1,5 @@ per-file DEPS=dcheng@chromium.org per-file DEPS=haraken@chromium.org per-file DEPS=jbroman@chromium.org +per-file README.md=haraken@chromium.org +
diff --git a/third_party/WebKit/Source/README.md b/third_party/WebKit/Source/README.md new file mode 100644 index 0000000..f18577d1 --- /dev/null +++ b/third_party/WebKit/Source/README.md
@@ -0,0 +1,110 @@ +# Blink directory structure + +This document describes a high-level architecture of Blink's top-level directories. + +## core/ and modules/ + +core/ and modules/ are directories to implement web platform features +defined in the specs. IDL files and their implementations should go to +core/ and modules/. + +Note that the specs do not have a notion of "core" and "modules". +The distinction between core/ and modules/ is for implementational convenience +to avoid putting everything in core/ (which decreases code modularity and +increases build time). Basically web platform features that are tighly coupled with +HTML, CSS and other fundamental parts of DOM should go to core/. +Other web platform features should go to modules/. + +In terms of dependencies, modules/ can depend on core/. +core/ cannot depend on modules/. modules/xxx/ can depend on modules/yyy/. + +## bindings/ + +bindings/ is a directory to put files that heavily use V8 APIs. + +In terms of dependencies, bindings/core/ and core/ are in the same link unit. +The only difference is how heavily they are using V8 APIs. +If a given file is using a lot of V8 APIs, it should go to bindings/core/. +Otherwise, it should go to core/. +(The same principle applies to bindings/modules/ and modules/.) + +The rationale for this split is: V8 APIs are complex, error-prone and +security-sensitive, so we want to put V8 API usages in one directory. + +## platform/ + +platform/ is a directory to implement low-level libraries of Blink. +For example, platform/scheduler/ implements a task scheduler for all tasks +posted by Blink. To avoid putting everything in core/ and modules/, +consider factoring out low-level functionalities to platform/. + +platform/wtf/ is a directory to implement Blink-specific containers +(e.g., Vector, HashTable, String). + +In terms of dependencies, core/ and modules/ can depend on platform/. +platform/ cannot depend on core/ and modules/. + +## controller/ + +controller/ is a directory to implement high-level functionalities +on top of core/ and modules/. Functionalities that use or drive Blink +should go to controller/. + +In terms of dependencies, controller/ can depend on core/ and modules/. +core/ and modules/ cannot depend on controller/. + +## devtools/ + +devtools/ implements a client-side of the Chrome DevTools, including all JS & +CSS to run the DevTools webapp. + +In terms of dependencies, devtools/ is a stand-alone directory. + +## build/ + +build/ contains scripts to build Blink. + +In terms of dependencies, build/ is a stand-alone directory. + +## Directory dependencies + +Dependencies only flow in the following order: + +- public/web/ +- controller/ +- modules/ and bindings/modules/ +- core/ and bindings/core/ +- platform/ +- public/platform/, //base/, V8 etc. + +See [this diagram](https://docs.google.com/document/d/1yYei-V76q3Mb-5LeJfNUMitmj6cqfA5gZGcWXoPaPYQ/edit). + +devtools/ and build/ are stand-alone directories. + +## Type dependencies + +core/, modules/, bindings/, platform/ and controller/ can use std:: types and +types defined in Chromium. The philosophy is that we should +share as much code between Chromium and Blink as possible. + +However, there are a couple of types that really need to be optimized +for Blink's workload (e.g., Vector, HashTable, Bind, AtomicString). +These types are defined in platform/wtf/. If there is an equivalent in +platform/wtf/, Blink must use the type in platform/wtf/ instead of the type +defined in Chromium. For example, Blink should not use std::vector +(except places where a conversion between std::vector and WTF::Vector is needed). + +To prevent use of random types, we control allowed types by whitelisting +them in DEPS and a [presubmit script](../Tools/Scripts/audit-non-blink-usage.py). + +## Mojo + +core/, modules/, bindings/, platform/ and controller/ can use Mojo and +directly talk with the browser process. This allows removal of unnecessary +public APIs and abstraction layers and it is highly recommended. + +## Contact + +If you have any questions about the directory architecture and dependencies, +reach out to platform-architecture-dev@chromium.org! +
diff --git a/third_party/WebKit/Source/bindings/core/v8/ActivityLoggerTest.cpp b/third_party/WebKit/Source/bindings/core/v8/ActivityLoggerTest.cpp index 51eb9ca6..63c1dfb 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ActivityLoggerTest.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ActivityLoggerTest.cpp
@@ -77,11 +77,11 @@ V8DOMActivityLogger::SetActivityLogger(kIsolatedWorldId, String(), WTF::WrapUnique(activity_logger_)); web_view_helper_.Initialize(); - script_controller_ = &web_view_helper_.WebView() + script_controller_ = &web_view_helper_.GetWebView() ->MainFrameImpl() ->GetFrame() ->GetScriptController(); - FrameTestHelpers::LoadFrame(web_view_helper_.WebView()->MainFrameImpl(), + FrameTestHelpers::LoadFrame(web_view_helper_.GetWebView()->MainFrameImpl(), "about:blank"); } @@ -90,7 +90,8 @@ void ExecuteScriptInMainWorld(const String& script) const { v8::HandleScope scope(v8::Isolate::GetCurrent()); script_controller_->ExecuteScriptInMainWorld(script); - PumpPendingRequestsForFrameToLoad(web_view_helper_.WebView()->MainFrame()); + PumpPendingRequestsForFrameToLoad( + web_view_helper_.GetWebView()->MainFrame()); } void ExecuteScriptInIsolatedWorld(const String& script) const { @@ -100,7 +101,8 @@ Vector<v8::Local<v8::Value>> results; script_controller_->ExecuteScriptInIsolatedWorld(kIsolatedWorldId, sources, nullptr); - PumpPendingRequestsForFrameToLoad(web_view_helper_.WebView()->MainFrame()); + PumpPendingRequestsForFrameToLoad( + web_view_helper_.GetWebView()->MainFrame()); } bool VerifyActivities(const String& activities) {
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptController.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptController.cpp index 36a7fb0..9393b89 100644 --- a/third_party/WebKit/Source/bindings/core/v8/ScriptController.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptController.cpp
@@ -40,6 +40,7 @@ #include "core/dom/Document.h" #include "core/dom/ScriptableDocumentParser.h" #include "core/dom/UserGestureIndicator.h" +#include "core/exported/WebPluginContainerImpl.h" #include "core/frame/LocalFrame.h" #include "core/frame/LocalFrameClient.h" #include "core/frame/Settings.h" @@ -53,7 +54,6 @@ #include "core/loader/FrameLoader.h" #include "core/loader/NavigationScheduler.h" #include "core/loader/ProgressTracker.h" -#include "core/plugins/PluginView.h" #include "core/probe/CoreProbes.h" #include "platform/Histogram.h" #include "platform/instrumentation/tracing/TraceEvent.h"
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8GCForContextDispose.cpp b/third_party/WebKit/Source/bindings/core/v8/V8GCForContextDispose.cpp index e17188b..fbc05ad 100644 --- a/third_party/WebKit/Source/bindings/core/v8/V8GCForContextDispose.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/V8GCForContextDispose.cpp
@@ -103,7 +103,7 @@ void V8GCForContextDispose::PseudoIdleTimerFired(TimerBase*) { V8PerIsolateData::MainThreadIsolate()->IdleNotificationDeadline( - MonotonicallyIncreasingTime()); + CurrentTimeTicksInSeconds()); Reset(); }
diff --git a/third_party/WebKit/Source/build/scripts/make_computed_style_base.py b/third_party/WebKit/Source/build/scripts/make_computed_style_base.py index e8cede1..70d0b5f 100755 --- a/third_party/WebKit/Source/build/scripts/make_computed_style_base.py +++ b/third_party/WebKit/Source/build/scripts/make_computed_style_base.py
@@ -26,7 +26,7 @@ # platform specific, so we define an ordering instead. # The ordering comes from the data obtained in: # https://codereview.chromium.org/2841413002 -# TODO(shend): Put alignment sizes into code form, rather than linking to a CL +# FIXME: Put alignment sizes into code form, rather than linking to a CL # which may disappear. ALIGNMENT_ORDER = [ # Aligns like double @@ -87,7 +87,7 @@ 'bool' ] -# TODO(shend): Improve documentation and add docstrings. +# FIXME: Improve documentation and add docstrings. def _flatten_list(x): """Flattens a list of lists into a single list.""" @@ -124,7 +124,7 @@ # } # # We then recursively convert this dictionary into a tree of Groups. - # TODO(shend): Skip the first step by changing Group attributes to methods. + # FIXME: Skip the first step by changing Group attributes to methods. def _dict_to_group(name, group_dict): fields_in_current_group = group_dict.pop(None) subgroups = [
diff --git a/third_party/WebKit/Source/build/scripts/name_utilities.py b/third_party/WebKit/Source/build/scripts/name_utilities.py index ad25bf6..1b13b0e5 100644 --- a/third_party/WebKit/Source/build/scripts/name_utilities.py +++ b/third_party/WebKit/Source/build/scripts/name_utilities.py
@@ -140,9 +140,9 @@ def enum_for_css_property_alias(property_name): return 'CSSPropertyAlias' + upper_camel_case(property_name) -# TODO(shend): Merge these with the above methods. +# FIXME: Merge these with the above methods. # and update all the generators to use these ones. -# TODO(shend): Switch external callers of these methods to use the high level +# FIXME: Switch external callers of these methods to use the high level # API below instead.
diff --git a/third_party/WebKit/Source/build/scripts/scripts.gni b/third_party/WebKit/Source/build/scripts/scripts.gni index f353cab..2f19ae0 100644 --- a/third_party/WebKit/Source/build/scripts/scripts.gni +++ b/third_party/WebKit/Source/build/scripts/scripts.gni
@@ -81,7 +81,7 @@ "//third_party/WebKit/Source/core:core_event_interfaces", ] -# TODO(shend): Remove this once everything that uses this switches over to +# TODO(crbug.com/732657): Remove this once everything that uses this switches over to # the 'code_generator' template instead. # Template to run most of scripts that process "*.json5" files. # script: script to run.
diff --git a/third_party/WebKit/Source/build/scripts/templates/CSSValueIDMappingsGenerated.h.tmpl b/third_party/WebKit/Source/build/scripts/templates/CSSValueIDMappingsGenerated.h.tmpl index 1060b7176..5de0d725 100644 --- a/third_party/WebKit/Source/build/scripts/templates/CSSValueIDMappingsGenerated.h.tmpl +++ b/third_party/WebKit/Source/build/scripts/templates/CSSValueIDMappingsGenerated.h.tmpl
@@ -15,9 +15,6 @@ namespace blink { -// TODO(shend): most enum values are stored contiguously so we just need -// a subtraction and static_cast. This is much faster than switches. - // Do not use these functions directly, use the non-generated versions // in CSSValueMappings.h
diff --git a/third_party/WebKit/Source/build/scripts/templates/fields/keyword.tmpl b/third_party/WebKit/Source/build/scripts/templates/fields/keyword.tmpl index a3d48a9..5023dc7 100644 --- a/third_party/WebKit/Source/build/scripts/templates/fields/keyword.tmpl +++ b/third_party/WebKit/Source/build/scripts/templates/fields/keyword.tmpl
@@ -4,7 +4,6 @@ {{base.decl_getter_method(field)}} {{base.decl_setter_method(field)}} {{base.decl_resetter_method(field)}} -{# TODO(shend): Add special keyword methods like cardinality #} {%- endmacro %} {% macro decl_protected_methods(field) -%}
diff --git a/third_party/WebKit/Source/core/BUILD.gn b/third_party/WebKit/Source/core/BUILD.gn index 62ffafb..a281724 100644 --- a/third_party/WebKit/Source/core/BUILD.gn +++ b/third_party/WebKit/Source/core/BUILD.gn
@@ -206,7 +206,6 @@ "//third_party/WebKit/Source/core/origin_trials", "//third_party/WebKit/Source/core/page", "//third_party/WebKit/Source/core/paint", - "//third_party/WebKit/Source/core/plugins", "//third_party/WebKit/Source/core/probe", "//third_party/WebKit/Source/core/resize_observer", "//third_party/WebKit/Source/core/streams", @@ -531,7 +530,7 @@ ] } -# TODO(shend): Need a better way to specify generated output files +# FIXME: Need a better way to specify generated output files css_properties("make_core_generated_css_longhand_property_classes") { script = "../build/scripts/core/css/properties/make_css_property_headers.py" in_files = [ "css/properties/CSSPropertyMethods.json5" ] @@ -765,7 +764,7 @@ ] } -# TODO(shend): Need a better way to specify generated output files +# FIXME: Need a better way to specify generated output files css_properties("make_core_generated_css_shorthand_property_classes") { script = "../build/scripts/core/css/properties/make_css_property_headers.py" in_files = [ "css/properties/CSSPropertyMethods.json5" ]
diff --git a/third_party/WebKit/Source/core/animation/AnimationClock.h b/third_party/WebKit/Source/core/animation/AnimationClock.h index 7cf9c60a98..be64a1ba3 100644 --- a/third_party/WebKit/Source/core/animation/AnimationClock.h +++ b/third_party/WebKit/Source/core/animation/AnimationClock.h
@@ -48,7 +48,7 @@ public: explicit AnimationClock(WTF::TimeFunction monotonically_increasing_time = - WTF::MonotonicallyIncreasingTime) + WTF::CurrentTimeTicksInSeconds) : monotonically_increasing_time_(monotonically_increasing_time), time_(0), task_for_which_time_was_calculated_(
diff --git a/third_party/WebKit/Source/core/animation/CompositorAnimations.cpp b/third_party/WebKit/Source/core/animation/CompositorAnimations.cpp index 9a49b91..49898d0 100644 --- a/third_party/WebKit/Source/core/animation/CompositorAnimations.cpp +++ b/third_party/WebKit/Source/core/animation/CompositorAnimations.cpp
@@ -139,77 +139,6 @@ } // namespace -bool CompositorAnimations::GetAnimatedBoundingBox(FloatBox& box, - const EffectModel& effect, - double min_value, - double max_value) { - const KeyframeEffectModelBase& keyframe_effect = - ToKeyframeEffectModelBase(effect); - - PropertyHandleSet properties = keyframe_effect.Properties(); - - if (properties.IsEmpty()) - return true; - - min_value = std::min(min_value, 0.0); - max_value = std::max(max_value, 1.0); - - for (const auto& property : properties) { - if (!property.IsCSSProperty()) - continue; - - // TODO: Add the ability to get expanded bounds for filters as well. - if (!IsTransformRelatedCSSProperty(property)) - continue; - - const PropertySpecificKeyframeVector& frames = - keyframe_effect.GetPropertySpecificKeyframes(property); - if (frames.IsEmpty() || frames.size() < 2) - continue; - - FloatBox original_box(box); - - for (size_t j = 0; j < frames.size() - 1; ++j) { - const AnimatableTransform* start_transform = - ToAnimatableTransform(frames[j]->GetAnimatableValue()); - const AnimatableTransform* end_transform = - ToAnimatableTransform(frames[j + 1]->GetAnimatableValue()); - if (!start_transform || !end_transform) - return false; - - // TODO: Add support for inflating modes other than Replace. - if (frames[j]->Composite() != EffectModel::kCompositeReplace) - return false; - - const TimingFunction& timing = frames[j]->Easing(); - double min = 0; - double max = 1; - if (j == 0) { - float frame_length = frames[j + 1]->Offset(); - if (frame_length > 0) { - min = min_value / frame_length; - } - } - - if (j == frames.size() - 2) { - float frame_length = frames[j + 1]->Offset() - frames[j]->Offset(); - if (frame_length > 0) { - max = 1 + (max_value - 1) / frame_length; - } - } - - FloatBox bounds; - timing.Range(&min, &max); - if (!end_transform->GetTransformOperations().BlendedBoundsForBox( - original_box, start_transform->GetTransformOperations(), min, max, - &bounds)) - return false; - box.ExpandTo(bounds); - } - } - return true; -} - CompositorAnimations::FailureCode CompositorAnimations::CheckCanStartEffectOnCompositor( const Timing& timing,
diff --git a/third_party/WebKit/Source/core/animation/CompositorAnimations.h b/third_party/WebKit/Source/core/animation/CompositorAnimations.h index aece02da0..e27a6553 100644 --- a/third_party/WebKit/Source/core/animation/CompositorAnimations.h +++ b/third_party/WebKit/Source/core/animation/CompositorAnimations.h
@@ -45,7 +45,6 @@ class CompositorAnimation; class CompositorAnimationPlayer; class Element; -class FloatBox; class KeyframeEffectModelBase; class CORE_EXPORT CompositorAnimations { @@ -121,11 +120,6 @@ static void AttachCompositedLayers(Element&, CompositorAnimationPlayer*); - static bool GetAnimatedBoundingBox(FloatBox&, - const EffectModel&, - double min_value, - double max_value); - struct CompositorTiming { Timing::PlaybackDirection direction; double scaled_duration;
diff --git a/third_party/WebKit/Source/core/animation/CompositorAnimationsTest.cpp b/third_party/WebKit/Source/core/animation/CompositorAnimationsTest.cpp index dacc5f4..bd33ab5 100644 --- a/third_party/WebKit/Source/core/animation/CompositorAnimationsTest.cpp +++ b/third_party/WebKit/Source/core/animation/CompositorAnimationsTest.cpp
@@ -152,18 +152,6 @@ timing, 0, std::numeric_limits<double>::quiet_NaN(), 0, effect, animations, player_playback_rate); } - bool GetAnimationBounds(FloatBox& bounding_box, - const KeyframeEffectModelBase& effect, - double min_value, - double max_value) { - // As the compositor code only understands AnimatableValues, we must - // snapshot the effect to make those available. - // TODO(crbug.com/725385): Remove once compositor uses InterpolationTypes. - auto style = ComputedStyle::Create(); - effect.SnapshotAllCompositorKeyframes(*element_.Get(), *style, nullptr); - return CompositorAnimations::GetAnimatedBoundingBox(bounding_box, effect, - min_value, max_value); - } bool DuplicateSingleKeyframeAndTestIsCandidateOnResult( StringKeyframe* frame) { @@ -325,7 +313,7 @@ WebURL url = URLTestHelpers::RegisterMockedURLLoadFromBase( WebString::FromUTF8(base_url_), testing_path, WebString::FromUTF8(file_name)); - FrameTestHelpers::LoadFrame(helper_.WebView()->MainFrameImpl(), + FrameTestHelpers::LoadFrame(helper_.GetWebView()->MainFrameImpl(), base_url_ + file_name); ForceFullCompositingUpdate(); URLTestHelpers::RegisterMockedURLUnregister(url); @@ -334,7 +322,7 @@ LocalFrame* GetFrame() const { return helper_.LocalMainFrame()->GetFrame(); } void ForceFullCompositingUpdate() { - helper_.WebView()->UpdateAllLifecyclePhases(); + helper_.GetWebView()->UpdateAllLifecyclePhases(); } private: @@ -440,33 +428,6 @@ timing_, *StringKeyframeEffectModel::Create(frames_mixed_properties))); } -TEST_F(AnimationCompositorAnimationsTest, AnimatedBoundingBox) { - Vector<String> transform_vector; - transform_vector.push_back("translate3d(0, 0, 0)"); - transform_vector.push_back("translate3d(200px, 200px, 0)"); - std::unique_ptr<StringKeyframeVector> frames = - CreateCompositableTransformKeyframeVector(transform_vector); - FloatBox bounds; - EXPECT_TRUE(GetAnimationBounds( - bounds, *StringKeyframeEffectModel::Create(*frames), 0, 1)); - EXPECT_EQ(FloatBox(0.0f, 0.f, 0.0f, 200.0f, 200.0f, 0.0f), bounds); - bounds = FloatBox(); - EXPECT_TRUE(GetAnimationBounds( - bounds, *StringKeyframeEffectModel::Create(*frames), -1, 1)); - EXPECT_EQ(FloatBox(-200.0f, -200.0, 0.0, 400.0f, 400.0f, 0.0f), bounds); - - transform_vector.push_back("translate3d(-300px, -400px, 1px)"); - bounds = FloatBox(); - frames = CreateCompositableTransformKeyframeVector(transform_vector); - EXPECT_TRUE(GetAnimationBounds( - bounds, *StringKeyframeEffectModel::Create(*frames), 0, 1)); - EXPECT_EQ(FloatBox(-300.0f, -400.f, 0.0f, 500.0f, 600.0f, 1.0f), bounds); - bounds = FloatBox(); - EXPECT_TRUE(GetAnimationBounds( - bounds, *StringKeyframeEffectModel::Create(*frames), -1, 2)); - EXPECT_EQ(FloatBox(-1300.0f, -1600.f, 0.0f, 1500.0f, 1800.0f, 3.0f), bounds); -} - TEST_F(AnimationCompositorAnimationsTest, ConvertTimingForCompositorStartDelay) { timing_.iteration_duration = 20.0;
diff --git a/third_party/WebKit/Source/core/animation/EffectStack.cpp b/third_party/WebKit/Source/core/animation/EffectStack.cpp index a111405..a240b9e0 100644 --- a/third_party/WebKit/Source/core/animation/EffectStack.cpp +++ b/third_party/WebKit/Source/core/animation/EffectStack.cpp
@@ -167,25 +167,4 @@ visitor->Trace(sampled_effects_); } -bool EffectStack::GetAnimatedBoundingBox(FloatBox& box, - const CSSProperty& property) const { - FloatBox original_box(box); - for (const auto& sampled_effect : sampled_effects_) { - if (sampled_effect->Effect() && - sampled_effect->Effect()->Affects(PropertyHandle(property))) { - KeyframeEffectReadOnly* effect = sampled_effect->Effect(); - const Timing& timing = effect->SpecifiedTiming(); - double start_range = 0; - double end_range = 1; - timing.timing_function->Range(&start_range, &end_range); - FloatBox expanding_box(original_box); - if (!CompositorAnimations::GetAnimatedBoundingBox( - expanding_box, *effect->Model(), start_range, end_range)) - return false; - box.ExpandTo(expanding_box); - } - } - return true; -} - } // namespace blink
diff --git a/third_party/WebKit/Source/core/animation/EffectStack.h b/third_party/WebKit/Source/core/animation/EffectStack.h index eb76920..8a7dd21 100644 --- a/third_party/WebKit/Source/core/animation/EffectStack.h +++ b/third_party/WebKit/Source/core/animation/EffectStack.h
@@ -69,7 +69,6 @@ KeyframeEffectReadOnly::Priority, PropertyHandleFilter = nullptr); - bool GetAnimatedBoundingBox(FloatBox&, const CSSProperty&) const; void Trace(blink::Visitor*); private:
diff --git a/third_party/WebKit/Source/core/animation/PendingAnimations.cpp b/third_party/WebKit/Source/core/animation/PendingAnimations.cpp index d80a978..efd28b5 100644 --- a/third_party/WebKit/Source/core/animation/PendingAnimations.cpp +++ b/third_party/WebKit/Source/core/animation/PendingAnimations.cpp
@@ -134,7 +134,7 @@ } // If not, go ahead and start any animations that were waiting. - NotifyCompositorAnimationStarted(MonotonicallyIncreasingTime()); + NotifyCompositorAnimationStarted(CurrentTimeTicksInSeconds()); DCHECK_EQ(pending_.size(), deferred.size()); return false;
diff --git a/third_party/WebKit/Source/core/animation/SizeInterpolationFunctions.cpp b/third_party/WebKit/Source/core/animation/SizeInterpolationFunctions.cpp index 9e3a579..46bf58a2 100644 --- a/third_party/WebKit/Source/core/animation/SizeInterpolationFunctions.cpp +++ b/third_party/WebKit/Source/core/animation/SizeInterpolationFunctions.cpp
@@ -79,7 +79,7 @@ float zoom, bool convert_width) { switch (fill_size.type) { - case kSizeLength: { + case EFillSizeType::kSizeLength: { const Length& side = convert_width ? fill_size.size.Width() : fill_size.size.Height(); if (side.IsAuto()) @@ -87,11 +87,11 @@ return WrapConvertedLength( LengthInterpolationFunctions::MaybeConvertLength(side, zoom)); } - case kContain: + case EFillSizeType::kContain: return ConvertKeyword(CSSValueContain); - case kCover: + case EFillSizeType::kCover: return ConvertKeyword(CSSValueCover); - case kSizeNone: + case EFillSizeType::kSizeNone: default: NOTREACHED(); return nullptr; @@ -199,10 +199,10 @@ switch (side_a.Keyword()) { case CSSValueCover: DCHECK_EQ(side_a.Keyword(), side_b.Keyword()); - return FillSize(kCover, LengthSize()); + return FillSize(EFillSizeType::kCover, LengthSize()); case CSSValueContain: DCHECK_EQ(side_a.Keyword(), side_b.Keyword()); - return FillSize(kContain, LengthSize()); + return FillSize(EFillSizeType::kContain, LengthSize()); case CSSValueAuto: break; default: @@ -211,7 +211,7 @@ } } return FillSize( - kSizeLength, + EFillSizeType::kSizeLength, LengthSize(CreateLength(interpolable_value_a, side_a, conversion_data), CreateLength(interpolable_value_b, side_b, conversion_data))); }
diff --git a/third_party/WebKit/Source/core/css/CSSDefaultStyleSheets.cpp b/third_party/WebKit/Source/core/css/CSSDefaultStyleSheets.cpp index f4b11a3..75c9b11 100644 --- a/third_party/WebKit/Source/core/css/CSSDefaultStyleSheets.cpp +++ b/third_party/WebKit/Source/core/css/CSSDefaultStyleSheets.cpp
@@ -77,22 +77,17 @@ CSSDefaultStyleSheets::CSSDefaultStyleSheets() : media_controls_style_sheet_loader_(nullptr) { - default_style_ = RuleSet::Create(); - default_print_style_ = RuleSet::Create(); - default_quirks_style_ = RuleSet::Create(); - // Strict-mode rules. String default_rules = GetDataResourceAsASCIIString("html.css") + LayoutTheme::GetTheme().ExtraDefaultStyleSheet(); default_style_sheet_ = ParseUASheet(default_rules); - default_style_->AddRulesFromSheet(DefaultStyleSheet(), ScreenEval()); - default_print_style_->AddRulesFromSheet(DefaultStyleSheet(), PrintEval()); // Quirks-mode rules. String quirks_rules = GetDataResourceAsASCIIString("quirks.css") + LayoutTheme::GetTheme().ExtraQuirksStyleSheet(); quirks_style_sheet_ = ParseUASheet(quirks_rules); - default_quirks_style_->AddRulesFromSheet(QuirksStyleSheet(), ScreenEval()); + + InitializeDefaultStyles(); #if DCHECK_IS_ON() default_style_->CompactRulesIfNeeded(); @@ -104,6 +99,31 @@ #endif } +void CSSDefaultStyleSheets::PrepareForLeakDetection() { + // Clear the optional style sheets. + media_controls_style_sheet_.Clear(); + mobile_viewport_style_sheet_.Clear(); + television_viewport_style_sheet_.Clear(); + xhtml_mobile_profile_style_sheet_.Clear(); + svg_style_sheet_.Clear(); + mathml_style_sheet_.Clear(); + fullscreen_style_sheet_.Clear(); + // Initialize the styles that have the lazily loaded style sheets. + InitializeDefaultStyles(); + default_view_source_style_.Clear(); +} + +void CSSDefaultStyleSheets::InitializeDefaultStyles() { + // This must be called only from constructor / PrepareForLeakDetection. + default_style_ = RuleSet::Create(); + default_print_style_ = RuleSet::Create(); + default_quirks_style_ = RuleSet::Create(); + + default_style_->AddRulesFromSheet(DefaultStyleSheet(), ScreenEval()); + default_print_style_->AddRulesFromSheet(DefaultStyleSheet(), PrintEval()); + default_quirks_style_->AddRulesFromSheet(QuirksStyleSheet(), ScreenEval()); +} + RuleSet* CSSDefaultStyleSheets::DefaultViewSourceStyle() { if (!default_view_source_style_) { default_view_source_style_ = RuleSet::Create();
diff --git a/third_party/WebKit/Source/core/css/CSSDefaultStyleSheets.h b/third_party/WebKit/Source/core/css/CSSDefaultStyleSheets.h index d67e68e..d73040f 100644 --- a/third_party/WebKit/Source/core/css/CSSDefaultStyleSheets.h +++ b/third_party/WebKit/Source/core/css/CSSDefaultStyleSheets.h
@@ -65,6 +65,8 @@ return fullscreen_style_sheet_.Get(); } + void PrepareForLeakDetection(); + // Media Controls UA stylesheet loading is handled by the media_controls // module. class CORE_EXPORT UAStyleSheetLoader { @@ -85,6 +87,7 @@ private: CSSDefaultStyleSheets(); + void InitializeDefaultStyles(); Member<RuleSet> default_style_; Member<RuleSet> default_quirks_style_;
diff --git a/third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h b/third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h index df5af1a2..1a2eac57 100644 --- a/third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h +++ b/third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h
@@ -844,16 +844,16 @@ inline CSSIdentifierValue::CSSIdentifierValue(EFillSizeType fill_size) : CSSValue(kIdentifierClass) { switch (fill_size) { - case kContain: + case EFillSizeType::kContain: value_id_ = CSSValueContain; break; - case kCover: + case EFillSizeType::kCover: value_id_ = CSSValueCover; break; - case kSizeNone: + case EFillSizeType::kSizeNone: value_id_ = CSSValueNone; break; - case kSizeLength: + case EFillSizeType::kSizeLength: default: NOTREACHED(); }
diff --git a/third_party/WebKit/Source/core/css/CSSProperties.json5 b/third_party/WebKit/Source/core/css/CSSProperties.json5 index cfcddde..ce4ee24 100644 --- a/third_party/WebKit/Source/core/css/CSSProperties.json5 +++ b/third_party/WebKit/Source/core/css/CSSProperties.json5
@@ -1487,7 +1487,7 @@ property_class: true, property_methods: ["ParseSingleValue"], field_group: "*", - field_size: 4, // TODO(shend): Make this use "kGridAutoFlowBits". + field_size: 4, // FIXME: Make this use "kGridAutoFlowBits". field_template: "primitive", default_value: "kAutoFlowRow", type_name: "GridAutoFlow", @@ -2875,7 +2875,7 @@ property_class: true, property_methods: ["ParseSingleValue"], field_group: "*", - field_size: 6, // TODO(shend): Make this use "kTouchActionBits". + field_size: 6, // FIXME: Make this use "kTouchActionBits". field_template: "primitive", include_paths: ["platform/graphics/TouchAction.h"], default_value: "TouchAction::kTouchActionAuto",
diff --git a/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp b/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp index 38e27e6..08358e99 100644 --- a/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp +++ b/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp
@@ -131,10 +131,10 @@ static CSSValue* ValueForFillSize(const FillSize& fill_size, const ComputedStyle& style) { - if (fill_size.type == kContain) + if (fill_size.type == EFillSizeType::kContain) return CSSIdentifierValue::Create(CSSValueContain); - if (fill_size.type == kCover) + if (fill_size.type == EFillSizeType::kCover) return CSSIdentifierValue::Create(CSSValueCover); if (fill_size.size.Height().IsAuto())
diff --git a/third_party/WebKit/Source/core/css/ComputedStyleExtraFields.json5 b/third_party/WebKit/Source/core/css/ComputedStyleExtraFields.json5 index 196cdf3..1d56d1d 100644 --- a/third_party/WebKit/Source/core/css/ComputedStyleExtraFields.json5 +++ b/third_party/WebKit/Source/core/css/ComputedStyleExtraFields.json5
@@ -136,7 +136,7 @@ mutable: true, }, // These are set if we used viewport or rem units when resolving a length. - // TODO(shend): HasViewportUnits should be a monotonic_flag. + // FIXME: HasViewportUnits should be a monotonic_flag. { name: "HasViewportUnits", field_template: "primitive", @@ -151,7 +151,6 @@ custom_compare: true, }, // These properties only have generated storage, and their methods are handwritten in ComputedStyle. - // TODO(shend): Remove these fields and delete the 'storage_only' template. { name: "EmptyState", field_template: "primitive", @@ -190,7 +189,7 @@ inherited: true, computed_style_custom_functions: ["getter", "setter"], }, - // TODO(shend): vertical align is actually a CSS property, but since we don't support union fields + // FIXME: vertical align is actually a CSS property, but since we don't support union fields // which can be either a keyword or Length, this is specified in this file for now. Remove this // once we can support union fields. { @@ -616,7 +615,6 @@ type_name: "bool", field_group: "*", }, - // TODO(shend): Investigate why this doesn't interact with other outline fields. { name: "OutlineStyleIsAuto", field_template: "primitive",
diff --git a/third_party/WebKit/Source/core/css/FontFaceSet.h b/third_party/WebKit/Source/core/css/FontFaceSet.h index dd8f2d0..684840f 100644 --- a/third_party/WebKit/Source/core/css/FontFaceSet.h +++ b/third_party/WebKit/Source/core/css/FontFaceSet.h
@@ -17,6 +17,7 @@ #include "platform/AsyncMethodRunner.h" #include "platform/bindings/ScriptWrappable.h" #include "platform/fonts/FontSelector.h" +#include "public/platform/TaskType.h" // Mac OS X 10.6 SDK defines check() macro that interferes with our check() // method @@ -44,9 +45,11 @@ ready_(new ReadyProperty(GetExecutionContext(), this, ReadyProperty::kReady)), + // TODO(scheduler-dev): Create an internal task type for fonts. async_runner_(AsyncMethodRunner<FontFaceSet>::Create( this, - &FontFaceSet::HandlePendingEventsAndPromises)) {} + &FontFaceSet::HandlePendingEventsAndPromises, + context.GetTaskRunner(TaskType::kUnthrottled))) {} ~FontFaceSet() = default; DEFINE_ATTRIBUTE_EVENT_LISTENER(loading);
diff --git a/third_party/WebKit/Source/core/css/StyleSheetContents.cpp b/third_party/WebKit/Source/core/css/StyleSheetContents.cpp index 43e94e7..26ec1722b 100644 --- a/third_party/WebKit/Source/core/css/StyleSheetContents.cpp +++ b/third_party/WebKit/Source/core/css/StyleSheetContents.cpp
@@ -335,7 +335,7 @@ const SecurityOrigin* security_origin) { TRACE_EVENT1("blink,devtools.timeline", "ParseAuthorStyleSheet", "data", InspectorParseAuthorStyleSheetEvent::Data(cached_style_sheet)); - double start_time = MonotonicallyIncreasingTime(); + double start_time = CurrentTimeTicksInSeconds(); bool is_same_origin_request = security_origin && security_origin->CanRequest(BaseURL()); @@ -374,7 +374,7 @@ DEFINE_STATIC_LOCAL(CustomCountHistogram, parse_histogram, ("Style.AuthorStyleSheet.ParseTime", 0, 10000000, 50)); - double parse_duration_seconds = (MonotonicallyIncreasingTime() - start_time); + double parse_duration_seconds = (CurrentTimeTicksInSeconds() - start_time); parse_histogram.Count(parse_duration_seconds * 1000 * 1000); if (Document* document = SingleOwnerDocument()) { CSSTiming::From(*document).RecordAuthorStyleSheetParseTime(
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSMatrixComponent.cpp b/third_party/WebKit/Source/core/css/cssom/CSSMatrixComponent.cpp index 7827bff..28e238c0 100644 --- a/third_party/WebKit/Source/core/css/cssom/CSSMatrixComponent.cpp +++ b/third_party/WebKit/Source/core/css/cssom/CSSMatrixComponent.cpp
@@ -29,7 +29,8 @@ CSSMatrixComponent* CSSMatrixComponent::Create( DOMMatrixReadOnly* matrix, const CSSMatrixComponentOptions& options) { - return new CSSMatrixComponent(matrix, options.is2D() || matrix->is2D()); + return new CSSMatrixComponent( + matrix, options.hasIs2D() ? options.is2D() : matrix->is2D()); } const DOMMatrix* CSSMatrixComponent::AsMatrix(ExceptionState&) const {
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSMatrixComponentOptions.idl b/third_party/WebKit/Source/core/css/cssom/CSSMatrixComponentOptions.idl index 3b926a5..a40c6930 100644 --- a/third_party/WebKit/Source/core/css/cssom/CSSMatrixComponentOptions.idl +++ b/third_party/WebKit/Source/core/css/cssom/CSSMatrixComponentOptions.idl
@@ -5,6 +5,6 @@ // Options for creating a CSSMatrixComponent. See CSSMatrixComponent for usage. // Spec: https://drafts.css-houdini.org/css-typed-om/#dictdef-cssmatrixcomponentoptions dictionary CSSMatrixComponentOptions { - boolean is2D = false; + boolean is2D; };
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSPerspective.cpp b/third_party/WebKit/Source/core/css/cssom/CSSPerspective.cpp index af4e165..1c9d0567 100644 --- a/third_party/WebKit/Source/core/css/cssom/CSSPerspective.cpp +++ b/third_party/WebKit/Source/core/css/cssom/CSSPerspective.cpp
@@ -10,48 +10,38 @@ namespace blink { +namespace { + +bool IsValidPerspectiveLength(CSSNumericValue* value) { + return value && + value->Type().MatchesBaseType(CSSNumericValueType::BaseType::kLength); +} + +} // namespace + CSSPerspective* CSSPerspective::Create(CSSNumericValue* length, ExceptionState& exception_state) { - if (length->GetType() != CSSStyleValue::StyleValueType::kLengthType) { + if (!IsValidPerspectiveLength(length)) { exception_state.ThrowTypeError("Must pass length to CSSPerspective"); return nullptr; } - if (length->ContainsPercent()) { - exception_state.ThrowTypeError( - "CSSPerspective does not support CSSNumericValues with percent units"); - return nullptr; - } return new CSSPerspective(length); } void CSSPerspective::setLength(CSSNumericValue* length, ExceptionState& exception_state) { - if (length->GetType() != CSSStyleValue::StyleValueType::kLengthType) { + if (!IsValidPerspectiveLength(length)) { exception_state.ThrowTypeError("Must pass length to CSSPerspective"); return; } - if (length->ContainsPercent()) { - exception_state.ThrowTypeError( - "CSSPerspective does not support CSSNumericValues with percent units"); - return; - } length_ = length; } CSSPerspective* CSSPerspective::FromCSSValue(const CSSFunctionValue& value) { DCHECK_EQ(value.FunctionType(), CSSValuePerspective); DCHECK_EQ(value.length(), 1U); - if (!value.Item(0).IsPrimitiveValue() || - !ToCSSPrimitiveValue(value.Item(0)).IsLength() || - ToCSSPrimitiveValue(value.Item(0)).IsCalculated()) - return nullptr; CSSNumericValue* length = CSSNumericValue::FromCSSValue(ToCSSPrimitiveValue(value.Item(0))); - // TODO(meade): This shouldn't happen once CSSNumericValue is fully - // implemented, so once that happens this check can be removed. - if (!length) - return nullptr; - DCHECK(!length->ContainsPercent()); return new CSSPerspective(length); } @@ -85,4 +75,9 @@ return result; } +CSSPerspective::CSSPerspective(CSSNumericValue* length) + : CSSTransformComponent(false /* is2D */), length_(length) { + DCHECK(length); +} + } // namespace blink
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSPerspective.h b/third_party/WebKit/Source/core/css/cssom/CSSPerspective.h index 556a8ef..d2d811e 100644 --- a/third_party/WebKit/Source/core/css/cssom/CSSPerspective.h +++ b/third_party/WebKit/Source/core/css/cssom/CSSPerspective.h
@@ -48,8 +48,7 @@ } private: - CSSPerspective(CSSNumericValue* length) - : CSSTransformComponent(false /* is2D */), length_(length) {} + CSSPerspective(CSSNumericValue* length); Member<CSSNumericValue> length_; DISALLOW_COPY_AND_ASSIGN(CSSPerspective);
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSRotation.cpp b/third_party/WebKit/Source/core/css/cssom/CSSRotation.cpp index 992d351..5583431a 100644 --- a/third_party/WebKit/Source/core/css/cssom/CSSRotation.cpp +++ b/third_party/WebKit/Source/core/css/cssom/CSSRotation.cpp
@@ -14,11 +14,11 @@ namespace { -bool IsValidCoordinate(const CSSNumericValue* value) { +bool IsValidRotateCoord(const CSSNumericValue* value) { return value && value->Type().MatchesNumber(); } -bool IsValidAngle(const CSSNumericValue* value) { +bool IsValidRotateAngle(const CSSNumericValue* value) { return value && value->Type().MatchesBaseType(CSSNumericValueType::BaseType::kAngle); } @@ -74,7 +74,7 @@ CSSRotation* CSSRotation::Create(CSSNumericValue* angle, ExceptionState& exception_state) { - if (!IsValidAngle(angle)) { + if (!IsValidRotateAngle(angle)) { exception_state.ThrowTypeError("Must pass an angle to CSSRotation"); return nullptr; } @@ -91,12 +91,12 @@ CSSNumericValue* y_value = CSSNumericValue::FromNumberish(y); CSSNumericValue* z_value = CSSNumericValue::FromNumberish(z); - if (!IsValidCoordinate(x_value) || !IsValidCoordinate(y_value) || - !IsValidCoordinate(z_value)) { + if (!IsValidRotateCoord(x_value) || !IsValidRotateCoord(y_value) || + !IsValidRotateCoord(z_value)) { exception_state.ThrowTypeError("Must specify an number unit"); return nullptr; } - if (!IsValidAngle(angle)) { + if (!IsValidRotateAngle(angle)) { exception_state.ThrowTypeError("Must pass an angle to CSSRotation"); return nullptr; } @@ -133,7 +133,7 @@ void CSSRotation::setAngle(CSSNumericValue* angle, ExceptionState& exception_state) { - if (!IsValidAngle(angle)) { + if (!IsValidRotateAngle(angle)) { exception_state.ThrowTypeError("Must pass an angle to CSSRotation"); return; } @@ -184,7 +184,7 @@ void CSSRotation::setX(const CSSNumberish& x, ExceptionState& exception_state) { CSSNumericValue* value = CSSNumericValue::FromNumberish(x); - if (!IsValidCoordinate(value)) { + if (!IsValidRotateCoord(value)) { exception_state.ThrowTypeError("Must specify a number unit"); return; } @@ -193,7 +193,7 @@ void CSSRotation::setY(const CSSNumberish& y, ExceptionState& exception_state) { CSSNumericValue* value = CSSNumericValue::FromNumberish(y); - if (!IsValidCoordinate(value)) { + if (!IsValidRotateCoord(value)) { exception_state.ThrowTypeError("Must specify a number unit"); return; } @@ -202,7 +202,7 @@ void CSSRotation::setZ(const CSSNumberish& z, ExceptionState& exception_state) { CSSNumericValue* value = CSSNumericValue::FromNumberish(z); - if (!IsValidCoordinate(value)) { + if (!IsValidRotateCoord(value)) { exception_state.ThrowTypeError("Must specify a number unit"); return; } @@ -215,10 +215,10 @@ CSSNumericValue* angle, bool is2D) : CSSTransformComponent(is2D), angle_(angle), x_(x), y_(y), z_(z) { - DCHECK(IsValidCoordinate(x)); - DCHECK(IsValidCoordinate(y)); - DCHECK(IsValidCoordinate(z)); - DCHECK(IsValidAngle(angle)); + DCHECK(IsValidRotateCoord(x)); + DCHECK(IsValidRotateCoord(y)); + DCHECK(IsValidRotateCoord(z)); + DCHECK(IsValidRotateAngle(angle)); } } // namespace blink
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSScale.cpp b/third_party/WebKit/Source/core/css/cssom/CSSScale.cpp index e29d042..8e519185 100644 --- a/third_party/WebKit/Source/core/css/cssom/CSSScale.cpp +++ b/third_party/WebKit/Source/core/css/cssom/CSSScale.cpp
@@ -11,6 +11,10 @@ namespace { +bool IsValidScaleCoord(CSSNumericValue* coord) { + return coord && coord->Type().MatchesNumber(); +} + CSSScale* FromScale(const CSSFunctionValue& value) { DCHECK(value.length() == 1U || value.length() == 2U); CSSNumericValue* x = @@ -64,7 +68,7 @@ CSSNumericValue* x_value = CSSNumericValue::FromNumberish(x); CSSNumericValue* y_value = CSSNumericValue::FromNumberish(y); - if (!IsValidCoordinate(x_value) || !IsValidCoordinate(y_value)) { + if (!IsValidScaleCoord(x_value) || !IsValidScaleCoord(y_value)) { exception_state.ThrowTypeError("Must specify an number unit"); return nullptr; } @@ -80,8 +84,8 @@ CSSNumericValue* y_value = CSSNumericValue::FromNumberish(y); CSSNumericValue* z_value = CSSNumericValue::FromNumberish(z); - if (!IsValidCoordinate(x_value) || !IsValidCoordinate(y_value) || - !IsValidCoordinate(z_value)) { + if (!IsValidScaleCoord(x_value) || !IsValidScaleCoord(y_value) || + !IsValidScaleCoord(z_value)) { exception_state.ThrowTypeError("Must specify a number for X, Y and Z"); return nullptr; } @@ -108,7 +112,7 @@ void CSSScale::setX(const CSSNumberish& x, ExceptionState& exception_state) { CSSNumericValue* value = CSSNumericValue::FromNumberish(x); - if (!IsValidCoordinate(value)) { + if (!IsValidScaleCoord(value)) { exception_state.ThrowTypeError("Must specify a number unit"); return; } @@ -119,7 +123,7 @@ void CSSScale::setY(const CSSNumberish& y, ExceptionState& exception_state) { CSSNumericValue* value = CSSNumericValue::FromNumberish(y); - if (!IsValidCoordinate(value)) { + if (!IsValidScaleCoord(value)) { exception_state.ThrowTypeError("Must specify a number unit"); return; } @@ -130,7 +134,7 @@ void CSSScale::setZ(const CSSNumberish& z, ExceptionState& exception_state) { CSSNumericValue* value = CSSNumericValue::FromNumberish(z); - if (!IsValidCoordinate(value)) { + if (!IsValidScaleCoord(value)) { exception_state.ThrowTypeError("Must specify a number unit"); return; } @@ -170,14 +174,9 @@ CSSNumericValue* z, bool is2D) : CSSTransformComponent(is2D), x_(x), y_(y), z_(z) { - DCHECK(IsValidCoordinate(x)); - DCHECK(IsValidCoordinate(y)); - DCHECK(IsValidCoordinate(z)); -} - -// static -bool CSSScale::IsValidCoordinate(CSSNumericValue* coord) { - return coord && coord->Type().MatchesNumber(); + DCHECK(IsValidScaleCoord(x)); + DCHECK(IsValidScaleCoord(y)); + DCHECK(IsValidScaleCoord(z)); } } // namespace blink
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSScale.h b/third_party/WebKit/Source/core/css/cssom/CSSScale.h index 08c6bd4..35b4db3 100644 --- a/third_party/WebKit/Source/core/css/cssom/CSSScale.h +++ b/third_party/WebKit/Source/core/css/cssom/CSSScale.h
@@ -72,8 +72,6 @@ Member<CSSNumericValue> y_; Member<CSSNumericValue> z_; - static bool IsValidCoordinate(CSSNumericValue* coord); - DISALLOW_COPY_AND_ASSIGN(CSSScale); };
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSSkew.cpp b/third_party/WebKit/Source/core/css/cssom/CSSSkew.cpp index cd79026c..6960888c 100644 --- a/third_party/WebKit/Source/core/css/cssom/CSSSkew.cpp +++ b/third_party/WebKit/Source/core/css/cssom/CSSSkew.cpp
@@ -14,11 +14,19 @@ namespace blink { +namespace { + +bool IsValidSkewAngle(CSSNumericValue* value) { + return value && + value->Type().MatchesBaseType(CSSNumericValueType::BaseType::kAngle); +} + +} // namespace + CSSSkew* CSSSkew::Create(CSSNumericValue* ax, CSSNumericValue* ay, ExceptionState& exception_state) { - if ((ax->GetType() != CSSStyleValue::StyleValueType::kAngleType) || - (ay->GetType() != CSSStyleValue::StyleValueType::kAngleType)) { + if (!IsValidSkewAngle(ax) || !IsValidSkewAngle(ay)) { exception_state.ThrowTypeError("CSSSkew does not support non-angles"); return nullptr; } @@ -26,45 +34,28 @@ } void CSSSkew::setAx(CSSNumericValue* value, ExceptionState& exception_state) { - if (value->GetType() != CSSStyleValue::StyleValueType::kAngleType) { + if (!IsValidSkewAngle(value)) { exception_state.ThrowTypeError("Must specify an angle unit"); return; } - if (!value->IsUnitValue()) { - exception_state.ThrowTypeError("Calculated angles are not supported yet"); - return; - } ax_ = value; } void CSSSkew::setAy(CSSNumericValue* value, ExceptionState& exception_state) { - if (value->GetType() != CSSStyleValue::StyleValueType::kAngleType) { + if (!IsValidSkewAngle(value)) { exception_state.ThrowTypeError("Must specify an angle unit"); return; } - if (!value->IsUnitValue()) { - exception_state.ThrowTypeError("Calculated angles are not supported yet"); - return; - } ay_ = value; } CSSSkew* CSSSkew::FromCSSValue(const CSSFunctionValue& value) { + DCHECK_GT(value.length(), 0U); const CSSPrimitiveValue& x_value = ToCSSPrimitiveValue(value.Item(0)); - if (x_value.IsCalculated()) { - // TODO(meade): Decide what we want to do with calc angles. - return nullptr; - } - DCHECK(x_value.IsAngle()); switch (value.FunctionType()) { case CSSValueSkew: if (value.length() == 2U) { const CSSPrimitiveValue& y_value = ToCSSPrimitiveValue(value.Item(1)); - if (y_value.IsCalculated()) { - // TODO(meade): Decide what we want to do with calc angles. - return nullptr; - } - DCHECK(y_value.IsAngle()); return CSSSkew::Create(CSSNumericValue::FromCSSValue(x_value), CSSNumericValue::FromCSSValue(y_value)); } @@ -109,4 +100,10 @@ return result; } +CSSSkew::CSSSkew(CSSNumericValue* ax, CSSNumericValue* ay) + : CSSTransformComponent(true /* is2D */), ax_(ax), ay_(ay) { + DCHECK(ax); + DCHECK(ay); +} + } // namespace blink
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSSkew.h b/third_party/WebKit/Source/core/css/cssom/CSSSkew.h index e386db0..54c44841 100644 --- a/third_party/WebKit/Source/core/css/cssom/CSSSkew.h +++ b/third_party/WebKit/Source/core/css/cssom/CSSSkew.h
@@ -53,8 +53,7 @@ } private: - CSSSkew(CSSNumericValue* ax, CSSNumericValue* ay) - : CSSTransformComponent(true /* is2D */), ax_(ax), ay_(ay) {} + CSSSkew(CSSNumericValue* ax, CSSNumericValue* ay); Member<CSSNumericValue> ax_; Member<CSSNumericValue> ay_;
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSTranslation.cpp b/third_party/WebKit/Source/core/css/cssom/CSSTranslation.cpp index 6fc3802..5aeb080 100644 --- a/third_party/WebKit/Source/core/css/cssom/CSSTranslation.cpp +++ b/third_party/WebKit/Source/core/css/cssom/CSSTranslation.cpp
@@ -14,12 +14,12 @@ namespace { -bool IsValidXYCoordinate(const CSSNumericValue* value) { +bool IsValidTranslateXY(const CSSNumericValue* value) { return value && value->Type().MatchesBaseTypePercentage( CSSNumericValueType::BaseType::kLength); } -bool IsValidZCoordinate(const CSSNumericValue* value) { +bool IsValidTranslateZ(const CSSNumericValue* value) { return value && value->Type().MatchesBaseType(CSSNumericValueType::BaseType::kLength); } @@ -87,7 +87,7 @@ CSSTranslation* CSSTranslation::Create(CSSNumericValue* x, CSSNumericValue* y, ExceptionState& exception_state) { - if (!IsValidXYCoordinate(x) || !IsValidXYCoordinate(y)) { + if (!IsValidTranslateXY(x) || !IsValidTranslateXY(y)) { exception_state.ThrowTypeError( "Must pass length or percentage to X and Y of CSSTranslation"); return nullptr; @@ -101,8 +101,8 @@ CSSNumericValue* y, CSSNumericValue* z, ExceptionState& exception_state) { - if (!IsValidXYCoordinate(x) || !IsValidXYCoordinate(y) || - !IsValidZCoordinate(z)) { + if (!IsValidTranslateXY(x) || !IsValidTranslateXY(y) || + !IsValidTranslateZ(z)) { exception_state.ThrowTypeError( "Must pass length or percentage to X, Y and Z of CSSTranslation"); return nullptr; @@ -139,7 +139,7 @@ } void CSSTranslation::setX(CSSNumericValue* x, ExceptionState& exception_state) { - if (!IsValidXYCoordinate(x)) { + if (!IsValidTranslateXY(x)) { exception_state.ThrowTypeError( "Must pass length or percentage to X of CSSTranslation"); return; @@ -148,7 +148,7 @@ } void CSSTranslation::setY(CSSNumericValue* y, ExceptionState& exception_state) { - if (!IsValidXYCoordinate(y)) { + if (!IsValidTranslateXY(y)) { exception_state.ThrowTypeError( "Must pass length or percent to Y of CSSTranslation"); return; @@ -157,7 +157,7 @@ } void CSSTranslation::setZ(CSSNumericValue* z, ExceptionState& exception_state) { - if (!IsValidZCoordinate(z)) { + if (!IsValidTranslateZ(z)) { exception_state.ThrowTypeError("Must pass length to Z of CSSTranslation"); return; } @@ -196,9 +196,9 @@ CSSNumericValue* z, bool is2D) : CSSTransformComponent(is2D), x_(x), y_(y), z_(z) { - DCHECK(IsValidXYCoordinate(x)); - DCHECK(IsValidXYCoordinate(y)); - DCHECK(IsValidZCoordinate(z)); + DCHECK(IsValidTranslateXY(x)); + DCHECK(IsValidTranslateXY(y)); + DCHECK(IsValidTranslateZ(z)); } } // namespace blink
diff --git a/third_party/WebKit/Source/core/css/cssom/StylePropertyMap.cpp b/third_party/WebKit/Source/core/css/cssom/StylePropertyMap.cpp index 6d18c28..01933a8 100644 --- a/third_party/WebKit/Source/core/css/cssom/StylePropertyMap.cpp +++ b/third_party/WebKit/Source/core/css/cssom/StylePropertyMap.cpp
@@ -97,8 +97,9 @@ SetProperty(property_id, result); } else { if (values.size() != 1) { - // FIXME: Is this actually the correct behaviour? - exception_state.ThrowTypeError("Not supported"); + exception_state.ThrowTypeError( + "Cannot set " + property_name + + " with multiple values as it is not list-valued"); return; }
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp b/third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp index 29a92d57..7308c13 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp +++ b/third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp
@@ -79,7 +79,7 @@ else if (declaration->CssParserMode() == kCSSFontFaceRuleMode) rule_type = StyleRule::kFontFace; CSSTokenizer tokenizer(string); - // TODO(shend): Use streams instead of ranges + // TODO(crbug.com/661854): Use streams instead of ranges parser.ConsumeDeclarationValue(CSSParserTokenRange(tokenizer.TokenizeToEOF()), unresolved_property, important, rule_type); bool did_parse = false; @@ -101,7 +101,7 @@ bool is_animation_tainted) { CSSParserImpl parser(context); CSSTokenizer tokenizer(value); - // TODO(shend): Use streams instead of ranges + // TODO(crbug.com/661854): Use streams instead of ranges const auto tokens = tokenizer.TokenizeToEOF(); const CSSParserTokenRange range(tokens); parser.ConsumeVariableValue(range, property_name, important, @@ -326,7 +326,7 @@ std::unique_ptr<Vector<double>> CSSParserImpl::ParseKeyframeKeyList( const String& key_list) { CSSTokenizer tokenizer(key_list); - // TODO(shend): Use streams instead of ranges + // TODO(crbug.com/661854): Use streams instead of ranges return ConsumeKeyframeKeyList(CSSParserTokenRange(tokenizer.TokenizeToEOF())); } @@ -864,7 +864,7 @@ stream.UncheckedConsume(); break; case kIdentToken: { - // TODO(shend): Use streams instead of ranges + // TODO(crbug.com/661854): Use streams instead of ranges const size_t decl_offset_start = stream.Offset(); const CSSParserTokenRange decl = stream.ConsumeUntilPeekedTypeIs<kSemicolonToken>();
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParserTokenStream.h b/third_party/WebKit/Source/core/css/parser/CSSParserTokenStream.h index 0c1bd6fa..da0fd24 100644 --- a/third_party/WebKit/Source/core/css/parser/CSSParserTokenStream.h +++ b/third_party/WebKit/Source/core/css/parser/CSSParserTokenStream.h
@@ -60,8 +60,8 @@ // maximum buffer size for a few top alexa websites. It should be slightly // above the expected number of tokens in the prelude of an at rule and // the number of tokens in a declaration. - // TODO(shend): Can we streamify at rule parsing so that this is only needed - // for declarations which are easier to think about? + // TODO(crbug.com/661854): Can we streamify at rule parsing so that this is + // only needed for declarations which are easier to think about? static constexpr size_t InitialBufferSize() { return 128; } explicit CSSParserTokenStream(CSSTokenizer& tokenizer)
diff --git a/third_party/WebKit/Source/core/css/resolver/CSSToStyleMap.cpp b/third_party/WebKit/Source/core/css/resolver/CSSToStyleMap.cpp index 9873293..3f023f0 100644 --- a/third_party/WebKit/Source/core/css/resolver/CSSToStyleMap.cpp +++ b/third_party/WebKit/Source/core/css/resolver/CSSToStyleMap.cpp
@@ -193,12 +193,12 @@ if (value.IsIdentifierValue() && ToCSSIdentifierValue(value).GetValueID() == CSSValueContain) - layer->SetSizeType(kContain); + layer->SetSizeType(EFillSizeType::kContain); else if (value.IsIdentifierValue() && ToCSSIdentifierValue(value).GetValueID() == CSSValueCover) - layer->SetSizeType(kCover); + layer->SetSizeType(EFillSizeType::kCover); else - layer->SetSizeType(kSizeLength); + layer->SetSizeType(EFillSizeType::kSizeLength); LengthSize b = FillLayer::InitialFillSizeLength(layer->GetType());
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp b/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp index 7f5bedb..b725fcb 100644 --- a/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp +++ b/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp
@@ -46,6 +46,7 @@ #include "core/html/HTMLTableCellElement.h" #include "core/html/forms/HTMLInputElement.h" #include "core/html/forms/HTMLTextAreaElement.h" +#include "core/html/media/HTMLMediaElement.h" #include "core/html_names.h" #include "core/layout/LayoutObject.h" #include "core/layout/LayoutTheme.h" @@ -201,7 +202,7 @@ } if (auto* image = ToHTMLImageElementOrNull(element)) { - if (image->IsCollapsed()) + if (image->IsCollapsed() || style.Display() == EDisplay::kContents) style.SetDisplay(EDisplay::kNone); return; } @@ -226,6 +227,10 @@ } if (IsHTMLFrameElementBase(element)) { + if (style.Display() == EDisplay::kContents) { + style.SetDisplay(EDisplay::kNone); + return; + } // Frames cannot overflow (they are always the size we ask them to be). // Some compositing code paths may try to draw scrollbars anyhow. style.SetOverflowX(EOverflow::kVisible); @@ -261,14 +266,30 @@ style.SetOverflowY(style.OverflowY() == EOverflow::kVisible ? EOverflow::kAuto : style.OverflowY()); + if (style.Display() == EDisplay::kContents) + style.SetDisplay(EDisplay::kNone); return; } if (IsHTMLPlugInElement(element)) { style.SetRequiresAcceleratedCompositingForExternalReasons( ToHTMLPlugInElement(element).ShouldAccelerate()); + if (style.Display() == EDisplay::kContents) + style.SetDisplay(EDisplay::kNone); return; } + + if (style.Display() == EDisplay::kContents) { + // See https://drafts.csswg.org/css-display/#unbox-html + // Some of these elements are handled with other adjustments above. + if (IsHTMLBRElement(element) || IsHTMLWBRElement(element) || + IsHTMLMeterElement(element) || IsHTMLProgressElement(element) || + IsHTMLCanvasElement(element) || IsHTMLMediaElement(element) || + IsHTMLInputElement(element) || IsHTMLTextAreaElement(element) || + IsHTMLSelectElement(element)) { + style.SetDisplay(EDisplay::kNone); + } + } } static void AdjustOverflow(ComputedStyle& style) {
diff --git a/third_party/WebKit/Source/core/dom/BlinkCloneableMessage.cpp b/third_party/WebKit/Source/core/dom/BlinkCloneableMessage.cpp index b3207916..8f3b505 100644 --- a/third_party/WebKit/Source/core/dom/BlinkCloneableMessage.cpp +++ b/third_party/WebKit/Source/core/dom/BlinkCloneableMessage.cpp
@@ -9,4 +9,8 @@ BlinkCloneableMessage::BlinkCloneableMessage() = default; BlinkCloneableMessage::~BlinkCloneableMessage() = default; +BlinkCloneableMessage::BlinkCloneableMessage(BlinkCloneableMessage&&) = default; +BlinkCloneableMessage& BlinkCloneableMessage::operator=( + BlinkCloneableMessage&&) = default; + } // namespace blink
diff --git a/third_party/WebKit/Source/core/dom/BlinkCloneableMessage.h b/third_party/WebKit/Source/core/dom/BlinkCloneableMessage.h index acac263..068a89c 100644 --- a/third_party/WebKit/Source/core/dom/BlinkCloneableMessage.h +++ b/third_party/WebKit/Source/core/dom/BlinkCloneableMessage.h
@@ -5,6 +5,7 @@ #ifndef BlinkCloneableMessage_h #define BlinkCloneableMessage_h +#include "base/macros.h" #include "bindings/core/v8/serialization/SerializedScriptValue.h" #include "core/CoreExport.h" @@ -18,7 +19,13 @@ BlinkCloneableMessage(); ~BlinkCloneableMessage(); + BlinkCloneableMessage(BlinkCloneableMessage&&); + BlinkCloneableMessage& operator=(BlinkCloneableMessage&&); + scoped_refptr<blink::SerializedScriptValue> message; + + private: + DISALLOW_COPY_AND_ASSIGN(BlinkCloneableMessage); }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/dom/BlinkTransferableMessage.cpp b/third_party/WebKit/Source/core/dom/BlinkTransferableMessage.cpp index df6eaf7d..1c310f14 100644 --- a/third_party/WebKit/Source/core/dom/BlinkTransferableMessage.cpp +++ b/third_party/WebKit/Source/core/dom/BlinkTransferableMessage.cpp
@@ -9,4 +9,9 @@ BlinkTransferableMessage::BlinkTransferableMessage() = default; BlinkTransferableMessage::~BlinkTransferableMessage() = default; +BlinkTransferableMessage::BlinkTransferableMessage(BlinkTransferableMessage&&) = + default; +BlinkTransferableMessage& BlinkTransferableMessage::operator=( + BlinkTransferableMessage&&) = default; + } // namespace blink
diff --git a/third_party/WebKit/Source/core/dom/BlinkTransferableMessage.h b/third_party/WebKit/Source/core/dom/BlinkTransferableMessage.h index 43d3024..a00c881 100644 --- a/third_party/WebKit/Source/core/dom/BlinkTransferableMessage.h +++ b/third_party/WebKit/Source/core/dom/BlinkTransferableMessage.h
@@ -5,6 +5,7 @@ #ifndef BlinkTransferableMessage_h #define BlinkTransferableMessage_h +#include "base/macros.h" #include "bindings/core/v8/serialization/SerializedScriptValue.h" #include "core/CoreExport.h" #include "core/dom/BlinkCloneableMessage.h" @@ -20,7 +21,13 @@ BlinkTransferableMessage(); ~BlinkTransferableMessage(); + BlinkTransferableMessage(BlinkTransferableMessage&&); + BlinkTransferableMessage& operator=(BlinkTransferableMessage&&); + Vector<MessagePortChannel> ports; + + private: + DISALLOW_COPY_AND_ASSIGN(BlinkTransferableMessage); }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp index 077028ad..c88b5b8 100644 --- a/third_party/WebKit/Source/core/dom/Document.cpp +++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -2212,7 +2212,7 @@ TRACE_EVENT_BEGIN0("blink,blink_style", "Document::updateStyle"); RUNTIME_CALL_TIMER_SCOPE(V8PerIsolateData::MainThreadIsolate(), RuntimeCallStats::CounterId::kUpdateStyle); - double start_time = MonotonicallyIncreasingTime(); + double start_time = CurrentTimeTicksInSeconds(); unsigned initial_element_count = GetStyleEngine().StyleForElementCount(); @@ -2293,7 +2293,7 @@ GetStyleEngine().StyleForElementCount() - initial_element_count); } - double update_duration_seconds = MonotonicallyIncreasingTime() - start_time; + double update_duration_seconds = CurrentTimeTicksInSeconds() - start_time; DEFINE_STATIC_LOCAL(CustomCountHistogram, update_histogram, ("Style.UpdateTime", 0, 10000000, 50)); update_histogram.Count(update_duration_seconds * 1000 * 1000); @@ -3369,9 +3369,9 @@ BeforeUnloadEvent* before_unload_event = BeforeUnloadEvent::Create(); before_unload_event->initEvent(EventTypeNames::beforeunload, false, true); load_event_progress_ = kBeforeUnloadEventInProgress; - const double beforeunload_event_start = MonotonicallyIncreasingTime(); + const double beforeunload_event_start = CurrentTimeTicksInSeconds(); dom_window_->DispatchEvent(before_unload_event, this); - const double beforeunload_event_end = MonotonicallyIncreasingTime(); + const double beforeunload_event_end = CurrentTimeTicksInSeconds(); load_event_progress_ = kBeforeUnloadEventCompleted; DEFINE_STATIC_LOCAL( CustomCountHistogram, beforeunload_histogram, @@ -3441,10 +3441,10 @@ if (load_event_progress_ < kPageHideInProgress) { load_event_progress_ = kPageHideInProgress; if (LocalDOMWindow* window = domWindow()) { - const double pagehide_event_start = MonotonicallyIncreasingTime(); + const double pagehide_event_start = CurrentTimeTicksInSeconds(); window->DispatchEvent( PageTransitionEvent::Create(EventTypeNames::pagehide, false), this); - const double pagehide_event_end = MonotonicallyIncreasingTime(); + const double pagehide_event_end = CurrentTimeTicksInSeconds(); DEFINE_STATIC_LOCAL( CustomCountHistogram, pagehide_histogram, ("DocumentEventTiming.PageHideDuration", 0, 10000000, 50)); @@ -3460,10 +3460,10 @@ // Dispatch visibilitychange event, but don't bother doing // other notifications as we're about to be unloaded. const double pagevisibility_hidden_event_start = - MonotonicallyIncreasingTime(); + CurrentTimeTicksInSeconds(); DispatchEvent(Event::CreateBubble(EventTypeNames::visibilitychange)); const double pagevisibility_hidden_event_end = - MonotonicallyIncreasingTime(); + CurrentTimeTicksInSeconds(); DEFINE_STATIC_LOCAL(CustomCountHistogram, pagevisibility_histogram, ("DocumentEventTiming.PageVibilityHiddenDuration", 0, 10000000, 50)); @@ -3486,10 +3486,10 @@ !document_loader->GetTiming().UnloadEventEnd()) { DocumentLoadTiming& timing = document_loader->GetTiming(); DCHECK(timing.NavigationStart()); - const double unload_event_start = MonotonicallyIncreasingTime(); + const double unload_event_start = CurrentTimeTicksInSeconds(); timing.MarkUnloadEventStart(unload_event_start); frame_->DomWindow()->DispatchEvent(unload_event, this); - const double unload_event_end = MonotonicallyIncreasingTime(); + const double unload_event_end = CurrentTimeTicksInSeconds(); DEFINE_STATIC_LOCAL( CustomCountHistogram, unload_histogram, ("DocumentEventTiming.UnloadDuration", 0, 10000000, 50)); @@ -5070,6 +5070,8 @@ else exception_state.ThrowSecurityError("Access is denied for this document."); return String(); + } else if (GetSecurityOrigin()->IsLocal()) { + UseCounter::Count(*this, WebFeature::kFileAccessedCookies); } // Suborigins are cookie-averse and thus should always return the empty @@ -5106,6 +5108,8 @@ else exception_state.ThrowSecurityError("Access is denied for this document."); return; + } else if (GetSecurityOrigin()->IsLocal()) { + UseCounter::Count(*this, WebFeature::kFileAccessedCookies); } // Suborigins are cookie-averse and thus setting should be a no-op, unless
diff --git a/third_party/WebKit/Source/core/dom/DocumentParserTiming.cpp b/third_party/WebKit/Source/core/dom/DocumentParserTiming.cpp index 284bb45..8e6eb95 100644 --- a/third_party/WebKit/Source/core/dom/DocumentParserTiming.cpp +++ b/third_party/WebKit/Source/core/dom/DocumentParserTiming.cpp
@@ -26,14 +26,14 @@ if (parser_detached_ || parser_start_ > 0.0) return; DCHECK_EQ(parser_stop_, 0.0); - parser_start_ = MonotonicallyIncreasingTime(); + parser_start_ = CurrentTimeTicksInSeconds(); NotifyDocumentParserTimingChanged(); } void DocumentParserTiming::MarkParserStop() { if (parser_detached_ || parser_start_ == 0.0 || parser_stop_ > 0.0) return; - parser_stop_ = MonotonicallyIncreasingTime(); + parser_stop_ = CurrentTimeTicksInSeconds(); NotifyDocumentParserTimingChanged(); }
diff --git a/third_party/WebKit/Source/core/dom/DocumentStatisticsCollector.cpp b/third_party/WebKit/Source/core/dom/DocumentStatisticsCollector.cpp index c5b914f3..e03ccf8 100644 --- a/third_party/WebKit/Source/core/dom/DocumentStatisticsCollector.cpp +++ b/third_party/WebKit/Source/core/dom/DocumentStatisticsCollector.cpp
@@ -209,7 +209,7 @@ features.is_mobile_friendly = IsMobileFriendly(document); - double start_time = MonotonicallyIncreasingTime(); + double start_time = CurrentTimeTicksInSeconds(); // This should be cheap since collectStatistics is only called right after // layout. @@ -219,7 +219,7 @@ CollectFeatures(*body, features); features.open_graph = HasOpenGraphArticle(*head); - double elapsed_time = MonotonicallyIncreasingTime() - start_time; + double elapsed_time = CurrentTimeTicksInSeconds() - start_time; DEFINE_STATIC_LOCAL(CustomCountHistogram, distillability_histogram, ("WebCore.DistillabilityUs", 1, 1000000, 50));
diff --git a/third_party/WebKit/Source/core/dom/DocumentTiming.cpp b/third_party/WebKit/Source/core/dom/DocumentTiming.cpp index c2364cb..5122acc 100644 --- a/third_party/WebKit/Source/core/dom/DocumentTiming.cpp +++ b/third_party/WebKit/Source/core/dom/DocumentTiming.cpp
@@ -27,7 +27,7 @@ } void DocumentTiming::MarkDomLoading() { - dom_loading_ = MonotonicallyIncreasingTime(); + dom_loading_ = CurrentTimeTicksInSeconds(); TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing,rail", "domLoading", TraceEvent::ToTraceTimestamp(dom_loading_), "frame", GetFrame()); @@ -35,7 +35,7 @@ } void DocumentTiming::MarkDomInteractive() { - dom_interactive_ = MonotonicallyIncreasingTime(); + dom_interactive_ = CurrentTimeTicksInSeconds(); TRACE_EVENT_MARK_WITH_TIMESTAMP1( "blink.user_timing,rail", "domInteractive", TraceEvent::ToTraceTimestamp(dom_interactive_), "frame", GetFrame()); @@ -43,7 +43,7 @@ } void DocumentTiming::MarkDomContentLoadedEventStart() { - dom_content_loaded_event_start_ = MonotonicallyIncreasingTime(); + dom_content_loaded_event_start_ = CurrentTimeTicksInSeconds(); TRACE_EVENT_MARK_WITH_TIMESTAMP1( "blink.user_timing,rail", "domContentLoadedEventStart", TraceEvent::ToTraceTimestamp(dom_content_loaded_event_start_), "frame", @@ -52,7 +52,7 @@ } void DocumentTiming::MarkDomContentLoadedEventEnd() { - dom_content_loaded_event_end_ = MonotonicallyIncreasingTime(); + dom_content_loaded_event_end_ = CurrentTimeTicksInSeconds(); TRACE_EVENT_MARK_WITH_TIMESTAMP1( "blink.user_timing,rail", "domContentLoadedEventEnd", TraceEvent::ToTraceTimestamp(dom_content_loaded_event_end_), "frame", @@ -66,7 +66,7 @@ } void DocumentTiming::MarkDomComplete() { - dom_complete_ = MonotonicallyIncreasingTime(); + dom_complete_ = CurrentTimeTicksInSeconds(); TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing,rail", "domComplete", TraceEvent::ToTraceTimestamp(dom_complete_), "frame", GetFrame()); @@ -74,7 +74,7 @@ } void DocumentTiming::MarkFirstLayout() { - first_layout_ = MonotonicallyIncreasingTime(); + first_layout_ = CurrentTimeTicksInSeconds(); TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing,rail", "firstLayout", TraceEvent::ToTraceTimestamp(first_layout_), "frame", GetFrame());
diff --git a/third_party/WebKit/Source/core/dom/IdleDeadline.cpp b/third_party/WebKit/Source/core/dom/IdleDeadline.cpp index 63840a87..a88911f 100644 --- a/third_party/WebKit/Source/core/dom/IdleDeadline.cpp +++ b/third_party/WebKit/Source/core/dom/IdleDeadline.cpp
@@ -15,7 +15,7 @@ : deadline_seconds_(deadline_seconds), callback_type_(callback_type) {} double IdleDeadline::timeRemaining() const { - double time_remaining = deadline_seconds_ - MonotonicallyIncreasingTime(); + double time_remaining = deadline_seconds_ - CurrentTimeTicksInSeconds(); if (time_remaining < 0) { time_remaining = 0; } else if (Platform::Current()
diff --git a/third_party/WebKit/Source/core/dom/LayoutTreeBuilder.cpp b/third_party/WebKit/Source/core/dom/LayoutTreeBuilder.cpp index 5bb1589..7beceb0 100644 --- a/third_party/WebKit/Source/core/dom/LayoutTreeBuilder.cpp +++ b/third_party/WebKit/Source/core/dom/LayoutTreeBuilder.cpp
@@ -134,9 +134,11 @@ new_layout_object->SetStyle( &style); // SetStyle() can depend on LayoutObject() already being set. - if (Fullscreen::IsFullscreenElement(*node_)) { + Document& document = node_->GetDocument(); + if (Fullscreen::IsFullscreenElement(*node_) && + node_.Get() != document.documentElement()) { new_layout_object = LayoutFullScreen::WrapLayoutObject( - new_layout_object, parent_layout_object, &node_->GetDocument()); + new_layout_object, parent_layout_object, &document); if (!new_layout_object) return; }
diff --git a/third_party/WebKit/Source/core/dom/Node.cpp b/third_party/WebKit/Source/core/dom/Node.cpp index 8c98836b..f16af36 100644 --- a/third_party/WebKit/Source/core/dom/Node.cpp +++ b/third_party/WebKit/Source/core/dom/Node.cpp
@@ -76,6 +76,7 @@ #include "core/events/TouchEvent.h" #include "core/events/UIEvent.h" #include "core/events/WheelEvent.h" +#include "core/exported/WebPluginContainerImpl.h" #include "core/frame/EventHandlerRegistry.h" #include "core/frame/LocalDOMWindow.h" #include "core/frame/LocalFrame.h" @@ -94,7 +95,6 @@ #include "core/mathml_names.h" #include "core/page/ContextMenuController.h" #include "core/page/Page.h" -#include "core/plugins/PluginView.h" #include "core/svg/SVGElement.h" #include "core/svg/graphics/SVGImage.h" #include "platform/EventDispatchForbiddenScope.h" @@ -2685,10 +2685,7 @@ LayoutObject* object = GetLayoutObject(); if (object && object->IsLayoutEmbeddedContent()) { - PluginView* plugin = ToLayoutEmbeddedContent(object)->Plugin(); - if (plugin) { - return plugin->GetWebPluginContainer(); - } + return ToLayoutEmbeddedContent(object)->Plugin(); } return nullptr;
diff --git a/third_party/WebKit/Source/core/dom/PendingScript.cpp b/third_party/WebKit/Source/core/dom/PendingScript.cpp index 38f12bd8..321bc6ec 100644 --- a/third_party/WebKit/Source/core/dom/PendingScript.cpp +++ b/third_party/WebKit/Source/core/dom/PendingScript.cpp
@@ -84,7 +84,7 @@ void PendingScript::MarkParserBlockingLoadStartTime() { DCHECK_EQ(parser_blocking_load_start_time_, 0.0); - parser_blocking_load_start_time_ = MonotonicallyIncreasingTime(); + parser_blocking_load_start_time_ = CurrentTimeTicksInSeconds(); } void PendingScript::Trace(blink::Visitor* visitor) {
diff --git a/third_party/WebKit/Source/core/dom/ScriptLoader.cpp b/third_party/WebKit/Source/core/dom/ScriptLoader.cpp index 5abc376..dfa3bbf90 100644 --- a/third_party/WebKit/Source/core/dom/ScriptLoader.cpp +++ b/third_party/WebKit/Source/core/dom/ScriptLoader.cpp
@@ -803,14 +803,14 @@ if (parser_blocking_load_start_time > 0.0) { DocumentParserTiming::From(element_->GetDocument()) .RecordParserBlockedOnScriptLoadDuration( - MonotonicallyIncreasingTime() - parser_blocking_load_start_time, + CurrentTimeTicksInSeconds() - parser_blocking_load_start_time, WasCreatedDuringDocumentWrite()); } if (was_canceled) return; - double script_exec_start_time = MonotonicallyIncreasingTime(); + double script_exec_start_time = CurrentTimeTicksInSeconds(); { CHECK_EQ(script->GetScriptType(), GetScriptType()); @@ -873,7 +873,7 @@ if (async_exec_type_ == ScriptRunner::kNone) { DocumentParserTiming::From(element_->GetDocument()) .RecordParserBlockedOnScriptExecutionDuration( - MonotonicallyIncreasingTime() - script_exec_start_time, + CurrentTimeTicksInSeconds() - script_exec_start_time, WasCreatedDuringDocumentWrite()); }
diff --git a/third_party/WebKit/Source/core/dom/ScriptedIdleTaskController.cpp b/third_party/WebKit/Source/core/dom/ScriptedIdleTaskController.cpp index c8e521c4..a0ad064 100644 --- a/third_party/WebKit/Source/core/dom/ScriptedIdleTaskController.cpp +++ b/third_party/WebKit/Source/core/dom/ScriptedIdleTaskController.cpp
@@ -58,7 +58,7 @@ if (ScriptedIdleTaskController* controller = callback_wrapper->Controller()) { controller->CallbackFired(callback_wrapper->Id(), - MonotonicallyIncreasingTime(), + CurrentTimeTicksInSeconds(), IdleDeadline::CallbackType::kCalledByTimeout); } callback_wrapper->Cancel(); @@ -214,7 +214,7 @@ return; double allotted_time_millis = - std::max((deadline_seconds - MonotonicallyIncreasingTime()) * 1000, 0.0); + std::max((deadline_seconds - CurrentTimeTicksInSeconds()) * 1000, 0.0); DEFINE_STATIC_LOCAL( CustomCountHistogram, idle_callback_deadline_histogram, @@ -249,7 +249,7 @@ Vector<CallbackId> pending_timeouts; pending_timeouts_.swap(pending_timeouts); for (auto& id : pending_timeouts) - RunCallback(id, MonotonicallyIncreasingTime(), + RunCallback(id, CurrentTimeTicksInSeconds(), IdleDeadline::CallbackType::kCalledByTimeout); // Repost idle tasks for any remaining callbacks.
diff --git a/third_party/WebKit/Source/core/dom/events/Event.cpp b/third_party/WebKit/Source/core/dom/events/Event.cpp index 670fc7b..9724a9b 100644 --- a/third_party/WebKit/Source/core/dom/events/Event.cpp +++ b/third_party/WebKit/Source/core/dom/events/Event.cpp
@@ -75,7 +75,7 @@ can_bubble_arg, cancelable_arg, composed_mode, - TimeTicks::Now()) {} + CurrentTimeTicks()) {} Event::Event(const AtomicString& event_type, bool can_bubble_arg,
diff --git a/third_party/WebKit/Source/core/dom/events/Event.h b/third_party/WebKit/Source/core/dom/events/Event.h index 47cdc11..53429cba 100644 --- a/third_party/WebKit/Source/core/dom/events/Event.h +++ b/third_party/WebKit/Source/core/dom/events/Event.h
@@ -263,7 +263,7 @@ const EventInit&, TimeTicks platform_time_stamp); Event(const AtomicString& type, const EventInit& init) - : Event(type, init, TimeTicks::Now()) {} + : Event(type, init, CurrentTimeTicks()) {} virtual void ReceivedTarget();
diff --git a/third_party/WebKit/Source/core/dom/events/EventTarget.cpp b/third_party/WebKit/Source/core/dom/events/EventTarget.cpp index b255243..1779231 100644 --- a/third_party/WebKit/Source/core/dom/events/EventTarget.cpp +++ b/third_party/WebKit/Source/core/dom/events/EventTarget.cpp
@@ -747,7 +747,7 @@ TimeTicks now; bool should_report_blocked_event = false; if (blocked_event_threshold) { - now = TimeTicks::Now(); + now = CurrentTimeTicks(); should_report_blocked_event = (now - event->PlatformTimeStamp()).InSecondsF() > blocked_event_threshold;
diff --git a/third_party/WebKit/Source/core/editing/SelectionModifier.cpp b/third_party/WebKit/Source/core/editing/SelectionModifier.cpp index ea8fe70f..a63ecfc 100644 --- a/third_party/WebKit/Source/core/editing/SelectionModifier.cpp +++ b/third_party/WebKit/Source/core/editing/SelectionModifier.cpp
@@ -62,7 +62,8 @@ return LayoutUnit::Min(); } -bool SelectionModifier::ShouldAlwaysUseDirectionalSelection(LocalFrame* frame) { +bool SelectionModifier::ShouldAlwaysUseDirectionalSelection( + const LocalFrame* frame) { return !frame || frame->GetEditor().Behavior().ShouldConsiderSelectionAsDirectional(); } @@ -71,7 +72,7 @@ const LocalFrame& frame, const SelectionInDOMTree& selection, LayoutUnit x_pos_for_vertical_arrow_navigation) - : frame_(const_cast<LocalFrame*>(&frame)), + : frame_(&frame), current_selection_(selection), x_pos_for_vertical_arrow_navigation_( x_pos_for_vertical_arrow_navigation) {}
diff --git a/third_party/WebKit/Source/core/editing/SelectionModifier.h b/third_party/WebKit/Source/core/editing/SelectionModifier.h index fd5d9e6..df372f9 100644 --- a/third_party/WebKit/Source/core/editing/SelectionModifier.h +++ b/third_party/WebKit/Source/core/editing/SelectionModifier.h
@@ -70,9 +70,9 @@ private: // TODO(editing-dev): We should make |GetFrame()| to return |LocalFrame&| // since it can not be |nullptr|. - LocalFrame* GetFrame() const { return frame_; } + const LocalFrame* GetFrame() const { return frame_; } - static bool ShouldAlwaysUseDirectionalSelection(LocalFrame*); + static bool ShouldAlwaysUseDirectionalSelection(const LocalFrame*); TextDirection DirectionOfEnclosingBlock() const; TextDirection DirectionOfSelection() const; VisiblePosition PositionForPlatform(bool is_get_start) const; @@ -103,7 +103,7 @@ static VisiblePosition RightWordPosition(const VisiblePosition&, bool skips_space_when_moving_right); - Member<LocalFrame> frame_; + Member<const LocalFrame> frame_; // TODO(editing-dev): We should get rid of |selection_| once we change // all member functions not to use |selection_|. // |selection_| is used as implicit parameter or a cache instead of pass it.
diff --git a/third_party/WebKit/Source/core/editing/spellcheck/IdleSpellCheckCallback.cpp b/third_party/WebKit/Source/core/editing/spellcheck/IdleSpellCheckCallback.cpp index f4c8727d..d471dd0e 100644 --- a/third_party/WebKit/Source/core/editing/spellcheck/IdleSpellCheckCallback.cpp +++ b/third_party/WebKit/Source/core/editing/spellcheck/IdleSpellCheckCallback.cpp
@@ -211,7 +211,7 @@ return; IdleDeadline* deadline = IdleDeadline::Create( - kForcedInvocationDeadlineSeconds + MonotonicallyIncreasingTime(), + kForcedInvocationDeadlineSeconds + CurrentTimeTicksInSeconds(), IdleDeadline::CallbackType::kCalledWhenIdle); switch (state_) {
diff --git a/third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.cpp b/third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.cpp index 9d391e41..7c88e402 100644 --- a/third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.cpp +++ b/third_party/WebKit/Source/core/editing/spellcheck/SpellCheckRequester.cpp
@@ -192,7 +192,7 @@ DEFINE_STATIC_LOCAL(CustomCountHistogram, spell_checker_request_interval_histogram, ("WebCore.SpellChecker.RequestInterval", 0, 10000, 50)); - const double current_request_time = MonotonicallyIncreasingTime(); + const double current_request_time = CurrentTimeTicksInSeconds(); if (request_num == 0 && last_request_time_ > 0) { const double interval_ms = (current_request_time - last_request_time_) * 1000.0;
diff --git a/third_party/WebKit/Source/core/events/CompositionEvent.cpp b/third_party/WebKit/Source/core/events/CompositionEvent.cpp index 9f7d0c2..74d356e3 100644 --- a/third_party/WebKit/Source/core/events/CompositionEvent.cpp +++ b/third_party/WebKit/Source/core/events/CompositionEvent.cpp
@@ -39,7 +39,7 @@ true, true, ComposedMode::kComposed, - TimeTicks::Now(), + CurrentTimeTicks(), view, 0, view ? view->GetInputDeviceCapabilities()->FiresTouchEvents(false)
diff --git a/third_party/WebKit/Source/core/events/FocusEvent.cpp b/third_party/WebKit/Source/core/events/FocusEvent.cpp index d5ec5205..c54f3cd7 100644 --- a/third_party/WebKit/Source/core/events/FocusEvent.cpp +++ b/third_party/WebKit/Source/core/events/FocusEvent.cpp
@@ -51,7 +51,7 @@ can_bubble, cancelable, ComposedMode::kComposed, - TimeTicks::Now(), + CurrentTimeTicks(), view, detail, source_capabilities),
diff --git a/third_party/WebKit/Source/core/events/MouseEvent.cpp b/third_party/WebKit/Source/core/events/MouseEvent.cpp index 38555b1c..9080e77 100644 --- a/third_party/WebKit/Source/core/events/MouseEvent.cpp +++ b/third_party/WebKit/Source/core/events/MouseEvent.cpp
@@ -127,7 +127,7 @@ } TimeTicks timestamp = underlying_event ? underlying_event->PlatformTimeStamp() - : TimeTicks::Now(); + : CurrentTimeTicks(); MouseEvent* created_event = new MouseEvent( event_type, true, true, view, 0, screen_x, screen_y, 0, 0, 0, 0, modifiers, 0, 0, nullptr, timestamp, synthetic_type, String());
diff --git a/third_party/WebKit/Source/core/events/MouseEvent.h b/third_party/WebKit/Source/core/events/MouseEvent.h index 0857e5e74..013e85c 100644 --- a/third_party/WebKit/Source/core/events/MouseEvent.h +++ b/third_party/WebKit/Source/core/events/MouseEvent.h
@@ -223,7 +223,7 @@ const MouseEventInit&, TimeTicks platform_time_stamp); MouseEvent(const AtomicString& type, const MouseEventInit& init) - : MouseEvent(type, init, TimeTicks::Now()) {} + : MouseEvent(type, init, CurrentTimeTicks()) {} MouseEvent();
diff --git a/third_party/WebKit/Source/core/events/PointerEvent.h b/third_party/WebKit/Source/core/events/PointerEvent.h index d940b68..29eafb67 100644 --- a/third_party/WebKit/Source/core/events/PointerEvent.h +++ b/third_party/WebKit/Source/core/events/PointerEvent.h
@@ -21,7 +21,7 @@ } static PointerEvent* Create(const AtomicString& type, const PointerEventInit& initializer) { - return PointerEvent::Create(type, initializer, TimeTicks::Now()); + return PointerEvent::Create(type, initializer, CurrentTimeTicks()); } int pointerId() const { return pointer_id_; }
diff --git a/third_party/WebKit/Source/core/events/TextEvent.cpp b/third_party/WebKit/Source/core/events/TextEvent.cpp index b6fb9d83..6dc6fe2 100644 --- a/third_party/WebKit/Source/core/events/TextEvent.cpp +++ b/third_party/WebKit/Source/core/events/TextEvent.cpp
@@ -70,7 +70,7 @@ true, true, ComposedMode::kComposed, - TimeTicks::Now(), + CurrentTimeTicks(), view, 0, nullptr), @@ -89,7 +89,7 @@ true, true, ComposedMode::kComposed, - TimeTicks::Now(), + CurrentTimeTicks(), view, 0, nullptr),
diff --git a/third_party/WebKit/Source/core/events/UIEvent.h b/third_party/WebKit/Source/core/events/UIEvent.h index 200fbe6..c8172a3 100644 --- a/third_party/WebKit/Source/core/events/UIEvent.h +++ b/third_party/WebKit/Source/core/events/UIEvent.h
@@ -87,7 +87,7 @@ const UIEventInit&, TimeTicks platform_time_stamp); UIEvent(const AtomicString& type, const UIEventInit& init) - : UIEvent(type, init, TimeTicks::Now()) {} + : UIEvent(type, init, CurrentTimeTicks()) {} private: Member<AbstractView> view_;
diff --git a/third_party/WebKit/Source/core/events/UIEventWithKeyState.h b/third_party/WebKit/Source/core/events/UIEventWithKeyState.h index c5bc069..60b30eed 100644 --- a/third_party/WebKit/Source/core/events/UIEventWithKeyState.h +++ b/third_party/WebKit/Source/core/events/UIEventWithKeyState.h
@@ -79,7 +79,7 @@ TimeTicks platform_time_stamp); UIEventWithKeyState(const AtomicString& type, const EventModifierInit& initializer) - : UIEventWithKeyState(type, initializer, TimeTicks::Now()) {} + : UIEventWithKeyState(type, initializer, CurrentTimeTicks()) {} void InitModifiers(bool ctrl_key, bool alt_key, bool shift_key,
diff --git a/third_party/WebKit/Source/core/events/WebInputEventConversionTest.cpp b/third_party/WebKit/Source/core/events/WebInputEventConversionTest.cpp index 97b88897..e469564 100644 --- a/third_party/WebKit/Source/core/events/WebInputEventConversionTest.cpp +++ b/third_party/WebKit/Source/core/events/WebInputEventConversionTest.cpp
@@ -840,7 +840,7 @@ FloatSize elastic_overscroll(10, -20); web_view->ApplyViewportDeltas(WebFloatSize(), WebFloatSize(), elastic_overscroll, 1.0f, 0.0f); - FrameTestHelpers::ReloadFrame(web_view_helper.WebView()->MainFrameImpl()); + FrameTestHelpers::ReloadFrame(web_view_helper.GetWebView()->MainFrameImpl()); LocalFrameView* view = ToLocalFrame(web_view->GetPage()->MainFrame())->View(); // Just elastic overscroll.
diff --git a/third_party/WebKit/Source/core/events/event_type_names.json5 b/third_party/WebKit/Source/core/events/event_type_names.json5 index 9f9f5ea..97d2b4ee 100644 --- a/third_party/WebKit/Source/core/events/event_type_names.json5 +++ b/third_party/WebKit/Source/core/events/event_type_names.json5
@@ -117,6 +117,7 @@ "focusin", "focusout", "foreignfetch", + "freeze", "fullscreenchange", "fullscreenerror", "gamepadconnected",
diff --git a/third_party/WebKit/Source/core/exported/LocalFrameClientImpl.cpp b/third_party/WebKit/Source/core/exported/LocalFrameClientImpl.cpp index a61319d..5f57800b 100644 --- a/third_party/WebKit/Source/core/exported/LocalFrameClientImpl.cpp +++ b/third_party/WebKit/Source/core/exported/LocalFrameClientImpl.cpp
@@ -841,7 +841,7 @@ return web_frame_->Client()->CanCreatePluginWithoutRenderer(mime_type); } -PluginView* LocalFrameClientImpl::CreatePlugin( +WebPluginContainerImpl* LocalFrameClientImpl::CreatePlugin( HTMLPlugInElement& element, const KURL& url, const Vector<String>& param_names,
diff --git a/third_party/WebKit/Source/core/exported/LocalFrameClientImpl.h b/third_party/WebKit/Source/core/exported/LocalFrameClientImpl.h index 8d3501af..c990cc4 100644 --- a/third_party/WebKit/Source/core/exported/LocalFrameClientImpl.h +++ b/third_party/WebKit/Source/core/exported/LocalFrameClientImpl.h
@@ -164,13 +164,13 @@ LocalFrame* CreateFrame(const WTF::AtomicString& name, HTMLFrameOwnerElement*) override; virtual bool CanCreatePluginWithoutRenderer(const String& mime_type) const; - PluginView* CreatePlugin(HTMLPlugInElement&, - const KURL&, - const Vector<WTF::String>&, - const Vector<WTF::String>&, - const WTF::String&, - bool load_manually, - DetachedPluginPolicy) override; + WebPluginContainerImpl* CreatePlugin(HTMLPlugInElement&, + const KURL&, + const Vector<WTF::String>&, + const Vector<WTF::String>&, + const WTF::String&, + bool load_manually, + DetachedPluginPolicy) override; std::unique_ptr<WebMediaPlayer> CreateWebMediaPlayer( HTMLMediaElement&, const WebMediaPlayerSource&,
diff --git a/third_party/WebKit/Source/core/exported/LocalFrameClientImplTest.cpp b/third_party/WebKit/Source/core/exported/LocalFrameClientImplTest.cpp index a540e277..c4b28c3b 100644 --- a/third_party/WebKit/Source/core/exported/LocalFrameClientImplTest.cpp +++ b/third_party/WebKit/Source/core/exported/LocalFrameClientImplTest.cpp
@@ -65,7 +65,8 @@ helper_.Initialize(&web_frame_client_); // FIXME: http://crbug.com/363843. This needs to find a better way to // not create graphics layers. - helper_.WebView()->GetSettings()->SetAcceleratedCompositingEnabled(false); + helper_.GetWebView()->GetSettings()->SetAcceleratedCompositingEnabled( + false); } void TearDown() override {
diff --git a/third_party/WebKit/Source/core/exported/PrerenderingTest.cpp b/third_party/WebKit/Source/core/exported/PrerenderingTest.cpp index dc8f71c..7f097fcb 100644 --- a/third_party/WebKit/Source/core/exported/PrerenderingTest.cpp +++ b/third_party/WebKit/Source/core/exported/PrerenderingTest.cpp
@@ -171,14 +171,14 @@ WebString::FromUTF8(base_url), blink::testing::CoreTestDataPath(), WebString::FromUTF8(file_name)); web_view_helper_.Initialize(); - web_view_helper_.WebView()->SetPrerendererClient(&prerenderer_client_); + web_view_helper_.GetWebView()->SetPrerendererClient(&prerenderer_client_); - FrameTestHelpers::LoadFrame(web_view_helper_.WebView()->MainFrameImpl(), + FrameTestHelpers::LoadFrame(web_view_helper_.GetWebView()->MainFrameImpl(), std::string(base_url) + file_name); } void NavigateAway() { - FrameTestHelpers::LoadFrame(web_view_helper_.WebView()->MainFrameImpl(), + FrameTestHelpers::LoadFrame(web_view_helper_.GetWebView()->MainFrameImpl(), "about:blank"); }
diff --git a/third_party/WebKit/Source/core/exported/WebAssociatedURLLoaderImplTest.cpp b/third_party/WebKit/Source/core/exported/WebAssociatedURLLoaderImplTest.cpp index a90dec9..0e70ed9 100644 --- a/third_party/WebKit/Source/core/exported/WebAssociatedURLLoaderImplTest.cpp +++ b/third_party/WebKit/Source/core/exported/WebAssociatedURLLoaderImplTest.cpp
@@ -247,7 +247,7 @@ } WebLocalFrameImpl* MainFrame() const { - return helper_.WebView()->MainFrameImpl(); + return helper_.GetWebView()->MainFrameImpl(); } protected:
diff --git a/third_party/WebKit/Source/core/exported/WebDevToolsAgentImpl.cpp b/third_party/WebKit/Source/core/exported/WebDevToolsAgentImpl.cpp index 20b6916..6a2f83e 100644 --- a/third_party/WebKit/Source/core/exported/WebDevToolsAgentImpl.cpp +++ b/third_party/WebKit/Source/core/exported/WebDevToolsAgentImpl.cpp
@@ -107,9 +107,9 @@ static void EnsureMainThreadDebuggerCreated(WebDevToolsAgentClient* client) { if (instance_) return; - std::unique_ptr<ClientMessageLoopAdapter> instance = - WTF::WrapUnique(new ClientMessageLoopAdapter( - WTF::WrapUnique(client->CreateClientMessageLoop()))); + std::unique_ptr<ClientMessageLoopAdapter> instance( + new ClientMessageLoopAdapter( + Platform::Current()->CreateNestedMessageLoopRunner())); instance_ = instance.get(); MainThreadDebugger::Instance()->SetClientMessageLoop(std::move(instance)); } @@ -131,8 +131,7 @@ private: ClientMessageLoopAdapter( - std::unique_ptr<WebDevToolsAgentClient::WebKitClientMessageLoop> - message_loop) + std::unique_ptr<Platform::NestedMessageLoopRunner> message_loop) : running_for_debug_break_(false), running_for_create_window_(false), message_loop_(std::move(message_loop)) { @@ -218,8 +217,7 @@ bool running_for_debug_break_; bool running_for_create_window_; - std::unique_ptr<WebDevToolsAgentClient::WebKitClientMessageLoop> - message_loop_; + std::unique_ptr<Platform::NestedMessageLoopRunner> message_loop_; static ClientMessageLoopAdapter* instance_; }; @@ -535,7 +533,7 @@ HitTestRequest request(hit_type); WebMouseEvent dummy_event(WebInputEvent::kMouseDown, WebInputEvent::kNoModifiers, - WTF::MonotonicallyIncreasingTimeMS()); + WTF::CurrentTimeTicksInMilliseconds()); dummy_event.SetPositionInWidget(point_in_root_frame.x, point_in_root_frame.y); IntPoint transformed_point = FlooredIntPoint( TransformWebMouseEvent(web_local_frame_impl_->GetFrameView(), dummy_event)
diff --git a/third_party/WebKit/Source/core/exported/WebDocumentTest.cpp b/third_party/WebKit/Source/core/exported/WebDocumentTest.cpp index fb21631..44f692c 100644 --- a/third_party/WebKit/Source/core/exported/WebDocumentTest.cpp +++ b/third_party/WebKit/Source/core/exported/WebDocumentTest.cpp
@@ -54,7 +54,7 @@ } Document* WebDocumentTest::TopDocument() const { - return ToLocalFrame(web_view_helper_.WebView()->GetPage()->MainFrame()) + return ToLocalFrame(web_view_helper_.GetWebView()->GetPage()->MainFrame()) ->GetDocument(); } @@ -249,7 +249,7 @@ } Document* WebDocumentFirstPartyTest::NestedDocument() const { - return ToLocalFrame(web_view_helper_.WebView() + return ToLocalFrame(web_view_helper_.GetWebView() ->GetPage() ->MainFrame() ->Tree() @@ -258,7 +258,7 @@ } Document* WebDocumentFirstPartyTest::NestedNestedDocument() const { - return ToLocalFrame(web_view_helper_.WebView() + return ToLocalFrame(web_view_helper_.GetWebView() ->GetPage() ->MainFrame() ->Tree()
diff --git a/third_party/WebKit/Source/core/exported/WebFrameSerializerSanitizationTest.cpp b/third_party/WebKit/Source/core/exported/WebFrameSerializerSanitizationTest.cpp index fad7933..4cb3c636 100644 --- a/third_party/WebKit/Source/core/exported/WebFrameSerializerSanitizationTest.cpp +++ b/third_party/WebKit/Source/core/exported/WebFrameSerializerSanitizationTest.cpp
@@ -191,7 +191,7 @@ url, testing::CoreTestDataPath(file_path.Utf8().data()), mime_type); } - WebViewImpl* WebView() { return helper_.WebView(); } + WebViewImpl* WebView() { return helper_.GetWebView(); } WebLocalFrameImpl* MainFrameImpl() { return helper_.LocalMainFrame(); }
diff --git a/third_party/WebKit/Source/core/exported/WebFrameTest.cpp b/third_party/WebKit/Source/core/exported/WebFrameTest.cpp index 16a97e4..7bec4104 100644 --- a/third_party/WebKit/Source/core/exported/WebFrameTest.cpp +++ b/third_party/WebKit/Source/core/exported/WebFrameTest.cpp
@@ -254,7 +254,7 @@ const std::string& url, FrameTestHelpers::WebViewHelper* web_view_helper) { web_view_helper->InitializeAndLoad(url); - web_view_helper->WebView()->GetSettings()->SetDefaultFontSize(12); + web_view_helper->GetWebView()->GetSettings()->SetDefaultFontSize(12); web_view_helper->Resize(WebSize(640, 480)); } @@ -265,7 +265,7 @@ web_view_helper->InitializeAndLoad(base_url_ + "nodeimage.html"); web_view_helper->Resize(WebSize(640, 480)); LocalFrame* frame = - ToLocalFrame(web_view_helper->WebView()->GetPage()->MainFrame()); + ToLocalFrame(web_view_helper->GetWebView()->GetPage()->MainFrame()); DCHECK(frame); Element* element = frame->GetDocument()->getElementById(testcase.c_str()); return DataTransfer::NodeImage(*frame, *element); @@ -356,9 +356,9 @@ web_view_helper.InitializeAndLoad(base_url_ + "iframes_test.html"); // Now retrieve the frames text and test it only includes visible elements. - std::string content = - WebFrameContentDumper::DumpWebViewAsText(web_view_helper.WebView(), 1024) - .Utf8(); + std::string content = WebFrameContentDumper::DumpWebViewAsText( + web_view_helper.GetWebView(), 1024) + .Utf8(); EXPECT_NE(std::string::npos, content.find(" visible paragraph")); EXPECT_NE(std::string::npos, content.find(" visible iframe")); EXPECT_EQ(std::string::npos, content.find(" invisible pararaph")); @@ -376,12 +376,12 @@ web_view_helper.InitializeAndLoad(base_url_ + "iframes_test.html"); v8::HandleScope scope(v8::Isolate::GetCurrent()); - EXPECT_EQ(web_view_helper.WebView()->MainFrame(), - WebLocalFrame::FrameForContext(web_view_helper.WebView() + EXPECT_EQ(web_view_helper.GetWebView()->MainFrame(), + WebLocalFrame::FrameForContext(web_view_helper.GetWebView() ->MainFrameImpl() ->MainWorldScriptContext())); - EXPECT_EQ(web_view_helper.WebView()->MainFrame()->FirstChild(), - WebLocalFrame::FrameForContext(web_view_helper.WebView() + EXPECT_EQ(web_view_helper.GetWebView()->MainFrame()->FirstChild(), + WebLocalFrame::FrameForContext(web_view_helper.GetWebView() ->MainFrame() ->FirstChild() ->ToWebLocalFrame() @@ -427,7 +427,7 @@ v8::HandleScope scope(v8::Isolate::GetCurrent()); ScriptExecutionCallbackHelper callback_helper( web_view_helper.LocalMainFrame()->MainWorldScriptContext()); - web_view_helper.WebView() + web_view_helper.GetWebView() ->MainFrameImpl() ->RequestExecuteScriptAndReturnValue( WebScriptSource(WebString("'hello';")), false, &callback_helper); @@ -448,12 +448,12 @@ web_view_helper.LocalMainFrame()->MainWorldScriptContext()); // Suspend scheduled tasks so the script doesn't run. - web_view_helper.WebView() + web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrame() ->GetDocument() ->PauseScheduledTasks(); - web_view_helper.WebView() + web_view_helper.GetWebView() ->MainFrameImpl() ->RequestExecuteScriptAndReturnValue( WebScriptSource(WebString("'hello';")), false, &callback_helper); @@ -462,7 +462,7 @@ // If the frame navigates, pending scripts should be removed, but the callback // should always be ran. - FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), + FrameTestHelpers::LoadFrame(web_view_helper.GetWebView()->MainFrameImpl(), base_url_ + "bar.html"); EXPECT_TRUE(callback_helper.DidComplete()); EXPECT_EQ(String(), callback_helper.StringValue()); @@ -484,7 +484,7 @@ ScriptExecutionCallbackHelper callback_helper(context); v8::Local<v8::Function> function = v8::Function::New(context, callback).ToLocalChecked(); - web_view_helper.WebView() + web_view_helper.GetWebView() ->MainFrame() ->ToWebLocalFrame() ->RequestExecuteV8Function(context, function, @@ -576,7 +576,7 @@ v8::HandleScope scope(v8::Isolate::GetCurrent()); ScriptExecutionCallbackHelper callback_helper( web_view_helper.LocalMainFrame()->MainWorldScriptContext()); - web_view_helper.WebView() + web_view_helper.GetWebView() ->MainFrame() ->FirstChild() ->ToWebLocalFrame() @@ -614,15 +614,15 @@ web_view_helper.InitializeAndLoad(chrome_url_ + "history.html"); // Try to run JS against the chrome-style URL. - FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), + FrameTestHelpers::LoadFrame(web_view_helper.GetWebView()->MainFrameImpl(), "javascript:document.body.appendChild(document." "createTextNode('Clobbered'))"); // Now retrieve the frame's text and ensure it was modified by running // javascript. - std::string content = - WebFrameContentDumper::DumpWebViewAsText(web_view_helper.WebView(), 1024) - .Utf8(); + std::string content = WebFrameContentDumper::DumpWebViewAsText( + web_view_helper.GetWebView(), 1024) + .Utf8(); EXPECT_NE(std::string::npos, content.find("Clobbered")); } @@ -634,15 +634,15 @@ // Try to run JS against the chrome-style URL after prohibiting it. WebSecurityPolicy::RegisterURLSchemeAsNotAllowingJavascriptURLs("chrome"); - FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), + FrameTestHelpers::LoadFrame(web_view_helper.GetWebView()->MainFrameImpl(), "javascript:document.body.appendChild(document." "createTextNode('Clobbered'))"); // Now retrieve the frame's text and ensure it wasn't modified by running // javascript. - std::string content = - WebFrameContentDumper::DumpWebViewAsText(web_view_helper.WebView(), 1024) - .Utf8(); + std::string content = WebFrameContentDumper::DumpWebViewAsText( + web_view_helper.GetWebView(), 1024) + .Utf8(); EXPECT_EQ(std::string::npos, content.find("Clobbered")); } @@ -656,16 +656,16 @@ // Setting host to "hostname:" should be treated as "hostname:0". FrameTestHelpers::LoadFrame( - web_view_helper.WebView()->MainFrameImpl(), + web_view_helper.GetWebView()->MainFrameImpl(), "javascript:location.host = 'internal.test:'; void 0;"); FrameTestHelpers::LoadFrame( - web_view_helper.WebView()->MainFrameImpl(), + web_view_helper.GetWebView()->MainFrameImpl(), "javascript:document.body.textContent = location.href; void 0;"); - std::string content = - WebFrameContentDumper::DumpWebViewAsText(web_view_helper.WebView(), 1024) - .Utf8(); + std::string content = WebFrameContentDumper::DumpWebViewAsText( + web_view_helper.GetWebView(), 1024) + .Utf8(); EXPECT_EQ("http://internal.test:0/" + file_name, content); } @@ -677,16 +677,16 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.InitializeAndLoad(base_url_ + file_name); - FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), + FrameTestHelpers::LoadFrame(web_view_helper.GetWebView()->MainFrameImpl(), "javascript:location.port = ''; void 0;"); FrameTestHelpers::LoadFrame( - web_view_helper.WebView()->MainFrameImpl(), + web_view_helper.GetWebView()->MainFrameImpl(), "javascript:document.body.textContent = location.href; void 0;"); - std::string content = - WebFrameContentDumper::DumpWebViewAsText(web_view_helper.WebView(), 1024) - .Utf8(); + std::string content = WebFrameContentDumper::DumpWebViewAsText( + web_view_helper.GetWebView(), 1024) + .Utf8(); EXPECT_EQ("http://internal.test:0/" + file_name, content); } @@ -1026,21 +1026,21 @@ WebDocument document = web_view_helper.LocalMainFrame()->GetDocument(); WebSerializedScriptValue data(WebSerializedScriptValue::CreateInvalid()); WebDOMMessageEvent message(data, "http://origin.com"); - web_view_helper.WebView() + web_view_helper.GetWebView() ->MainFrameImpl() ->DispatchMessageEventWithOriginCheck(correct_origin, message); // Send another message with incorrect origin. WebSecurityOrigin incorrect_origin( WebSecurityOrigin::Create(ToKURL(chrome_url_))); - web_view_helper.WebView() + web_view_helper.GetWebView() ->MainFrameImpl() ->DispatchMessageEventWithOriginCheck(incorrect_origin, message); // Verify that only the first addition is in the body of the page. - std::string content = - WebFrameContentDumper::DumpWebViewAsText(web_view_helper.WebView(), 1024) - .Utf8(); + std::string content = WebFrameContentDumper::DumpWebViewAsText( + web_view_helper.GetWebView(), 1024) + .Utf8(); EXPECT_NE(std::string::npos, content.find("Message 1.")); EXPECT_EQ(std::string::npos, content.find("Message 2.")); } @@ -1066,7 +1066,7 @@ web_view_helper.InitializeAndLoad("about:blank"); LocalFrame* frame = - ToLocalFrame(web_view_helper.WebView()->GetPage()->MainFrame()); + ToLocalFrame(web_view_helper.GetWebView()->GetPage()->MainFrame()); NonThrowableExceptionState exception_state; scoped_refptr<SerializedScriptValue> message = SerializeString("message", ToScriptStateForMainWorld(frame)); @@ -1139,7 +1139,7 @@ &client, nullptr, ConfigureAndroid); Document* document = - ToLocalFrame(web_view_helper.WebView()->GetPage()->MainFrame()) + ToLocalFrame(web_view_helper.GetWebView()->GetPage()->MainFrame()) ->GetDocument(); document->GetSettings()->SetTextAutosizingEnabled(true); EXPECT_TRUE(document->GetSettings()->TextAutosizingEnabled()); @@ -1152,7 +1152,8 @@ // document. description.min_width = Length(100, blink::kFixed); description.max_width = Length(100, blink::kFixed); - web_view_helper.WebView()->UpdatePageDefinedViewportConstraints(description); + web_view_helper.GetWebView()->UpdatePageDefinedViewportConstraints( + description); EXPECT_TRUE(CheckTextAutosizingMultiplier(document, 1)); } @@ -1169,7 +1170,7 @@ nullptr, ConfigureAndroid); Document* document = - ToLocalFrame(web_view_helper.WebView()->GetPage()->MainFrame()) + ToLocalFrame(web_view_helper.GetWebView()->GetPage()->MainFrame()) ->GetDocument(); document->GetSettings()->SetTextAutosizingEnabled(true); EXPECT_TRUE(document->GetSettings()->TextAutosizingEnabled()); @@ -1194,7 +1195,7 @@ &client, nullptr, ConfigureAndroid); LocalFrame* main_frame = - ToLocalFrame(web_view_helper.WebView()->GetPage()->MainFrame()); + ToLocalFrame(web_view_helper.GetWebView()->GetPage()->MainFrame()); Document* document = main_frame->GetDocument(); LocalFrameView* frame_view = web_view_helper.LocalMainFrame()->GetFrameView(); document->GetSettings()->SetTextAutosizingEnabled(true); @@ -1238,12 +1239,12 @@ web_view_helper.Initialize(nullptr, &client, nullptr, ConfigureAndroid); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); - EXPECT_EQ(viewport_width, web_view_helper.WebView() + EXPECT_EQ(viewport_width, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() .Width()); - EXPECT_EQ(viewport_height, web_view_helper.WebView() + EXPECT_EQ(viewport_height, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() @@ -1267,16 +1268,17 @@ web_view_helper.Resize(WebSize(viewport_width, viewport_height)); EXPECT_EQ( - 2, web_view_helper.WebView()->GetPage()->DeviceScaleFactorDeprecated()); + 2, + web_view_helper.GetWebView()->GetPage()->DeviceScaleFactorDeprecated()); // Device scale factor should be independent of page scale. - web_view_helper.WebView()->SetDefaultPageScaleLimits(1, 2); - web_view_helper.WebView()->SetPageScaleFactor(0.5); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); - EXPECT_EQ(1, web_view_helper.WebView()->PageScaleFactor()); + web_view_helper.GetWebView()->SetDefaultPageScaleLimits(1, 2); + web_view_helper.GetWebView()->SetPageScaleFactor(0.5); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); + EXPECT_EQ(1, web_view_helper.GetWebView()->PageScaleFactor()); // Force the layout to happen before leaving the test. - web_view_helper.WebView()->UpdateAllLifecyclePhases(); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); } TEST_P(ParameterizedWebFrameTest, FixedLayoutInitializeAtMinimumScale) { @@ -1291,8 +1293,8 @@ // only becomes available after the load begins. FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.Initialize(nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView()->SetDefaultPageScaleLimits(0.25f, 5); - FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), + web_view_helper.GetWebView()->SetDefaultPageScaleLimits(0.25f, 5); + FrameTestHelpers::LoadFrame(web_view_helper.GetWebView()->MainFrameImpl(), base_url_ + "fixed_layout.html"); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); @@ -1300,25 +1302,26 @@ float minimum_page_scale_factor = viewport_width / (float)default_fixed_layout_width; EXPECT_EQ(minimum_page_scale_factor, - web_view_helper.WebView()->PageScaleFactor()); + web_view_helper.GetWebView()->PageScaleFactor()); EXPECT_EQ(minimum_page_scale_factor, - web_view_helper.WebView()->MinimumPageScaleFactor()); + web_view_helper.GetWebView()->MinimumPageScaleFactor()); // Assume the user has pinch zoomed to page scale factor 2. float user_pinch_page_scale_factor = 2; - web_view_helper.WebView()->SetPageScaleFactor(user_pinch_page_scale_factor); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); + web_view_helper.GetWebView()->SetPageScaleFactor( + user_pinch_page_scale_factor); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); // Make sure we don't reset to initial scale if the page continues to load. - web_view_helper.WebView()->DidCommitLoad(false, false); - web_view_helper.WebView()->DidChangeContentsSize(); + web_view_helper.GetWebView()->DidCommitLoad(false, false); + web_view_helper.GetWebView()->DidChangeContentsSize(); EXPECT_EQ(user_pinch_page_scale_factor, - web_view_helper.WebView()->PageScaleFactor()); + web_view_helper.GetWebView()->PageScaleFactor()); // Make sure we don't reset to initial scale if the viewport size changes. web_view_helper.Resize(WebSize(viewport_width, viewport_height + 100)); EXPECT_EQ(user_pinch_page_scale_factor, - web_view_helper.WebView()->PageScaleFactor()); + web_view_helper.GetWebView()->PageScaleFactor()); } TEST_P(ParameterizedWebFrameTest, WideDocumentInitializeAtMinimumScale) { @@ -1333,33 +1336,34 @@ // only becomes available after the load begins. FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.Initialize(nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView()->SetDefaultPageScaleLimits(0.25f, 5); - FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), + web_view_helper.GetWebView()->SetDefaultPageScaleLimits(0.25f, 5); + FrameTestHelpers::LoadFrame(web_view_helper.GetWebView()->MainFrameImpl(), base_url_ + "wide_document.html"); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); int wide_document_width = 1500; float minimum_page_scale_factor = viewport_width / (float)wide_document_width; EXPECT_EQ(minimum_page_scale_factor, - web_view_helper.WebView()->PageScaleFactor()); + web_view_helper.GetWebView()->PageScaleFactor()); EXPECT_EQ(minimum_page_scale_factor, - web_view_helper.WebView()->MinimumPageScaleFactor()); + web_view_helper.GetWebView()->MinimumPageScaleFactor()); // Assume the user has pinch zoomed to page scale factor 2. float user_pinch_page_scale_factor = 2; - web_view_helper.WebView()->SetPageScaleFactor(user_pinch_page_scale_factor); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); + web_view_helper.GetWebView()->SetPageScaleFactor( + user_pinch_page_scale_factor); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); // Make sure we don't reset to initial scale if the page continues to load. - web_view_helper.WebView()->DidCommitLoad(false, false); - web_view_helper.WebView()->DidChangeContentsSize(); + web_view_helper.GetWebView()->DidCommitLoad(false, false); + web_view_helper.GetWebView()->DidChangeContentsSize(); EXPECT_EQ(user_pinch_page_scale_factor, - web_view_helper.WebView()->PageScaleFactor()); + web_view_helper.GetWebView()->PageScaleFactor()); // Make sure we don't reset to initial scale if the viewport size changes. web_view_helper.Resize(WebSize(viewport_width, viewport_height + 100)); EXPECT_EQ(user_pinch_page_scale_factor, - web_view_helper.WebView()->PageScaleFactor()); + web_view_helper.GetWebView()->PageScaleFactor()); } TEST_P(ParameterizedWebFrameTest, DelayedViewportInitialScale) { @@ -1376,16 +1380,16 @@ ConfigureAndroid); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); - EXPECT_EQ(0.25f, web_view_helper.WebView()->PageScaleFactor()); + EXPECT_EQ(0.25f, web_view_helper.GetWebView()->PageScaleFactor()); Document* document = - ToLocalFrame(web_view_helper.WebView()->GetPage()->MainFrame()) + ToLocalFrame(web_view_helper.GetWebView()->GetPage()->MainFrame()) ->GetDocument(); ViewportDescription description = document->GetViewportDescription(); description.zoom = 2; document->SetViewportDescription(description); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); - EXPECT_EQ(2, web_view_helper.WebView()->PageScaleFactor()); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); + EXPECT_EQ(2, web_view_helper.GetWebView()->PageScaleFactor()); } TEST_P(ParameterizedWebFrameTest, setLoadWithOverviewModeToFalse) { @@ -1400,12 +1404,13 @@ web_view_helper.InitializeAndLoad( base_url_ + "viewport-auto-initial-scale.html", nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); - web_view_helper.WebView()->GetSettings()->SetLoadWithOverviewMode(false); + web_view_helper.GetWebView()->GetSettings()->SetWideViewportQuirkEnabled( + true); + web_view_helper.GetWebView()->GetSettings()->SetLoadWithOverviewMode(false); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); // The page must be displayed at 100% zoom. - EXPECT_EQ(1.0f, web_view_helper.WebView()->PageScaleFactor()); + EXPECT_EQ(1.0f, web_view_helper.GetWebView()->PageScaleFactor()); } TEST_P(ParameterizedWebFrameTest, @@ -1420,14 +1425,15 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.InitializeAndLoad(base_url_ + "large-div.html", nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView()->GetSettings()->SetLoadWithOverviewMode(false); - web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); - web_view_helper.WebView()->GetSettings()->SetUseWideViewport(false); + web_view_helper.GetWebView()->GetSettings()->SetLoadWithOverviewMode(false); + web_view_helper.GetWebView()->GetSettings()->SetWideViewportQuirkEnabled( + true); + web_view_helper.GetWebView()->GetSettings()->SetUseWideViewport(false); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); // The page must be displayed at 100% zoom, despite that it hosts a wide div // element. - EXPECT_EQ(1.0f, web_view_helper.WebView()->PageScaleFactor()); + EXPECT_EQ(1.0f, web_view_helper.GetWebView()->PageScaleFactor()); } TEST_P(ParameterizedWebFrameTest, NoWideViewportIgnoresPageViewportWidth) { @@ -1442,18 +1448,19 @@ web_view_helper.InitializeAndLoad( base_url_ + "viewport-auto-initial-scale.html", nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); - web_view_helper.WebView()->GetSettings()->SetUseWideViewport(false); + web_view_helper.GetWebView()->GetSettings()->SetWideViewportQuirkEnabled( + true); + web_view_helper.GetWebView()->GetSettings()->SetUseWideViewport(false); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); // The page sets viewport width to 3000, but with UseWideViewport == false is // must be ignored. - EXPECT_EQ(viewport_width, web_view_helper.WebView() + EXPECT_EQ(viewport_width, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->ContentsSize() .Width()); - EXPECT_EQ(viewport_height, web_view_helper.WebView() + EXPECT_EQ(viewport_height, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->ContentsSize() @@ -1473,19 +1480,20 @@ web_view_helper.InitializeAndLoad( base_url_ + "viewport-wide-2x-initial-scale.html", nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); - web_view_helper.WebView()->GetSettings()->SetUseWideViewport(false); + web_view_helper.GetWebView()->GetSettings()->SetWideViewportQuirkEnabled( + true); + web_view_helper.GetWebView()->GetSettings()->SetUseWideViewport(false); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); // The page sets viewport width to 3000, but with UseWideViewport == false it // must be ignored while the initial scale specified by the page must be // accounted. - EXPECT_EQ(viewport_width / 2, web_view_helper.WebView() + EXPECT_EQ(viewport_width / 2, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->ContentsSize() .Width()); - EXPECT_EQ(viewport_height / 2, web_view_helper.WebView() + EXPECT_EQ(viewport_height / 2, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->ContentsSize() @@ -1503,18 +1511,19 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.InitializeAndLoad(base_url_ + "no_viewport_tag.html", nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); - web_view_helper.WebView()->GetSettings()->SetUseWideViewport(true); + web_view_helper.GetWebView()->GetSettings()->SetWideViewportQuirkEnabled( + true); + web_view_helper.GetWebView()->GetSettings()->SetUseWideViewport(true); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); - EXPECT_EQ(980, web_view_helper.WebView() + EXPECT_EQ(980, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->LayoutViewportScrollableArea() ->ContentsSize() .Width()); EXPECT_EQ(980.0 / viewport_width * viewport_height, - web_view_helper.WebView() + web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->LayoutViewportScrollableArea() @@ -1532,19 +1541,20 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.Initialize(nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); - web_view_helper.WebView()->GetSettings()->SetUseWideViewport(true); + web_view_helper.GetWebView()->GetSettings()->SetWideViewportQuirkEnabled( + true); + web_view_helper.GetWebView()->GetSettings()->SetUseWideViewport(true); FrameTestHelpers::LoadFrame( - web_view_helper.WebView()->MainFrameImpl(), + web_view_helper.GetWebView()->MainFrameImpl(), base_url_ + "viewport/viewport-legacy-xhtmlmp.html"); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); - EXPECT_EQ(viewport_width, web_view_helper.WebView() + EXPECT_EQ(viewport_width, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->ContentsSize() .Width()); - EXPECT_EQ(viewport_height, web_view_helper.WebView() + EXPECT_EQ(viewport_height, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->ContentsSize() @@ -1563,11 +1573,12 @@ web_view_helper.InitializeAndLoad(base_url_ + "viewport-height-1000.html", nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); - web_view_helper.WebView()->GetSettings()->SetUseWideViewport(false); + web_view_helper.GetWebView()->GetSettings()->SetWideViewportQuirkEnabled( + true); + web_view_helper.GetWebView()->GetSettings()->SetUseWideViewport(false); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); - EXPECT_EQ(viewport_width, web_view_helper.WebView() + EXPECT_EQ(viewport_width, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->ContentsSize() @@ -1586,20 +1597,22 @@ web_view_helper.InitializeAndLoad( base_url_ + "viewport-2x-initial-scale.html", nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); - web_view_helper.WebView()->GetSettings()->SetUseWideViewport(true); + web_view_helper.GetWebView()->GetSettings()->SetWideViewportQuirkEnabled( + true); + web_view_helper.GetWebView()->GetSettings()->SetUseWideViewport(true); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); - EXPECT_EQ(980, web_view_helper.WebView() + EXPECT_EQ(980, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->ContentsSize() .Width()); - EXPECT_EQ(980.0 / viewport_width * viewport_height, web_view_helper.WebView() - ->MainFrameImpl() - ->GetFrameView() - ->ContentsSize() - .Height()); + EXPECT_EQ(980.0 / viewport_width * viewport_height, + web_view_helper.GetWebView() + ->MainFrameImpl() + ->GetFrameView() + ->ContentsSize() + .Height()); } TEST_P(ParameterizedWebFrameTest, @@ -1615,12 +1628,12 @@ web_view_helper.InitializeAndLoad( base_url_ + "viewport-wide-2x-initial-scale.html", nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView()->GetSettings()->SetLoadWithOverviewMode(false); + web_view_helper.GetWebView()->GetSettings()->SetLoadWithOverviewMode(false); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); // The page must be displayed at 200% zoom, as specified in its viewport meta // tag. - EXPECT_EQ(2.0f, web_view_helper.WebView()->PageScaleFactor()); + EXPECT_EQ(2.0f, web_view_helper.GetWebView()->PageScaleFactor()); } TEST_P(ParameterizedWebFrameTest, setInitialPageScaleFactorPermanently) { @@ -1633,25 +1646,26 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.InitializeAndLoad(base_url_ + "fixed_layout.html", nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); - web_view_helper.WebView()->GetSettings()->SetLoadWithOverviewMode(false); - web_view_helper.WebView()->SetInitialPageScaleOverride( + web_view_helper.GetWebView()->GetSettings()->SetWideViewportQuirkEnabled( + true); + web_view_helper.GetWebView()->GetSettings()->SetLoadWithOverviewMode(false); + web_view_helper.GetWebView()->SetInitialPageScaleOverride( enforced_page_scale_factor); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); EXPECT_EQ(enforced_page_scale_factor, - web_view_helper.WebView()->PageScaleFactor()); + web_view_helper.GetWebView()->PageScaleFactor()); int viewport_width = 640; int viewport_height = 480; web_view_helper.Resize(WebSize(viewport_width, viewport_height)); EXPECT_EQ(enforced_page_scale_factor, - web_view_helper.WebView()->PageScaleFactor()); + web_view_helper.GetWebView()->PageScaleFactor()); - web_view_helper.WebView()->SetInitialPageScaleOverride(-1); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); - EXPECT_EQ(1.0, web_view_helper.WebView()->PageScaleFactor()); + web_view_helper.GetWebView()->SetInitialPageScaleOverride(-1); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); + EXPECT_EQ(1.0, web_view_helper.GetWebView()->PageScaleFactor()); } TEST_P(ParameterizedWebFrameTest, @@ -1668,13 +1682,13 @@ web_view_helper.InitializeAndLoad( base_url_ + "viewport-auto-initial-scale.html", nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView()->GetSettings()->SetLoadWithOverviewMode(false); - web_view_helper.WebView()->SetInitialPageScaleOverride( + web_view_helper.GetWebView()->GetSettings()->SetLoadWithOverviewMode(false); + web_view_helper.GetWebView()->SetInitialPageScaleOverride( enforced_page_scale_factor); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); EXPECT_EQ(enforced_page_scale_factor, - web_view_helper.WebView()->PageScaleFactor()); + web_view_helper.GetWebView()->PageScaleFactor()); } TEST_P(ParameterizedWebFrameTest, @@ -1691,12 +1705,12 @@ web_view_helper.InitializeAndLoad( base_url_ + "viewport-wide-2x-initial-scale.html", nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView()->SetInitialPageScaleOverride( + web_view_helper.GetWebView()->SetInitialPageScaleOverride( enforced_page_scale_factor); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); EXPECT_EQ(enforced_page_scale_factor, - web_view_helper.WebView()->PageScaleFactor()); + web_view_helper.GetWebView()->PageScaleFactor()); } TEST_P(ParameterizedWebFrameTest, @@ -1724,10 +1738,10 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.InitializeAndLoad(base_url_ + pages[i], nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView() + web_view_helper.GetWebView() ->GetSettings() ->SetClobberUserAgentInitialScaleQuirk(quirk_enabled); - web_view_helper.WebView()->SetInitialPageScaleOverride( + web_view_helper.GetWebView()->SetInitialPageScaleOverride( enforced_page_scale_factor); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); @@ -1736,7 +1750,7 @@ ? page_scale_factors[i] : enforced_page_scale_factor; EXPECT_EQ(expected_page_scale_factor, - web_view_helper.WebView()->PageScaleFactor()); + web_view_helper.GetWebView()->PageScaleFactor()); } } } @@ -1752,21 +1766,22 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.InitializeAndLoad("about:blank", nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); - web_view_helper.WebView()->GetSettings()->SetUseWideViewport(false); - web_view_helper.WebView()->GetSettings()->SetLoadWithOverviewMode(false); - web_view_helper.WebView()->SetInitialPageScaleOverride( + web_view_helper.GetWebView()->GetSettings()->SetWideViewportQuirkEnabled( + true); + web_view_helper.GetWebView()->GetSettings()->SetUseWideViewport(false); + web_view_helper.GetWebView()->GetSettings()->SetLoadWithOverviewMode(false); + web_view_helper.GetWebView()->SetInitialPageScaleOverride( enforced_page_scale_factor); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); EXPECT_EQ(viewport_width / enforced_page_scale_factor, - web_view_helper.WebView() + web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->ContentsSize() .Width()); EXPECT_EQ(enforced_page_scale_factor, - web_view_helper.WebView()->PageScaleFactor()); + web_view_helper.GetWebView()->PageScaleFactor()); } TEST_P(ParameterizedWebFrameTest, @@ -1782,7 +1797,7 @@ web_view_helper.InitializeAndLoad(base_url_ + "0-by-0.html", nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView()->GetSettings()->SetForceZeroLayoutHeight(true); + web_view_helper.GetWebView()->GetSettings()->SetForceZeroLayoutHeight(true); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); LocalFrame* frame = web_view_helper.LocalMainFrame()->GetFrame(); @@ -1804,20 +1819,20 @@ web_view_helper.InitializeAndLoad(base_url_ + "0-by-0.html", nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView()->GetSettings()->SetForceZeroLayoutHeight(true); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); + web_view_helper.GetWebView()->GetSettings()->SetForceZeroLayoutHeight(true); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); - PaintLayerCompositor* compositor = web_view_helper.WebView()->Compositor(); + PaintLayerCompositor* compositor = web_view_helper.GetWebView()->Compositor(); GraphicsLayer* scroll_container = compositor->ContainerLayer(); if (!scroll_container) scroll_container = compositor->RootGraphicsLayer(); - EXPECT_EQ(0, web_view_helper.WebView() + EXPECT_EQ(0, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() .Width()); - EXPECT_EQ(0, web_view_helper.WebView() + EXPECT_EQ(0, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() @@ -1826,12 +1841,12 @@ EXPECT_EQ(0.0, scroll_container->Size().Height()); web_view_helper.Resize(WebSize(viewport_width, 0)); - EXPECT_EQ(viewport_width, web_view_helper.WebView() + EXPECT_EQ(viewport_width, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() .Width()); - EXPECT_EQ(0, web_view_helper.WebView() + EXPECT_EQ(0, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() @@ -1844,16 +1859,16 @@ // LayerCompositor). The height of the visualViewport, however, is not // affected. web_view_helper.Resize(WebSize(viewport_width, viewport_height)); - EXPECT_FALSE(web_view_helper.WebView() + EXPECT_FALSE(web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->NeedsLayout()); - EXPECT_EQ(viewport_width, web_view_helper.WebView() + EXPECT_EQ(viewport_width, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() .Width()); - EXPECT_EQ(0, web_view_helper.WebView() + EXPECT_EQ(0, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() @@ -1883,43 +1898,43 @@ &client, nullptr, ConfigureAndroid); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); - EXPECT_LE(viewport_height, web_view_helper.WebView() + EXPECT_LE(viewport_height, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() .Height()); - web_view_helper.WebView()->GetSettings()->SetForceZeroLayoutHeight(true); - EXPECT_TRUE(web_view_helper.WebView() + web_view_helper.GetWebView()->GetSettings()->SetForceZeroLayoutHeight(true); + EXPECT_TRUE(web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->NeedsLayout()); - EXPECT_EQ(0, web_view_helper.WebView() + EXPECT_EQ(0, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() .Height()); web_view_helper.Resize(WebSize(viewport_width, viewport_height * 2)); - EXPECT_FALSE(web_view_helper.WebView() + EXPECT_FALSE(web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->NeedsLayout()); - EXPECT_EQ(0, web_view_helper.WebView() + EXPECT_EQ(0, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() .Height()); web_view_helper.Resize(WebSize(viewport_width * 2, viewport_height)); - EXPECT_EQ(0, web_view_helper.WebView() + EXPECT_EQ(0, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() .Height()); - web_view_helper.WebView()->GetSettings()->SetForceZeroLayoutHeight(false); - EXPECT_LE(viewport_height, web_view_helper.WebView() + web_view_helper.GetWebView()->GetSettings()->SetForceZeroLayoutHeight(false); + EXPECT_LE(viewport_height, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() @@ -1937,7 +1952,7 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.InitializeAndLoad(base_url_ + "viewport-device-width.html", nullptr, &client); - WebSettings* settings = web_view_helper.WebView()->GetSettings(); + WebSettings* settings = web_view_helper.GetWebView()->GetSettings(); settings->SetViewportMetaEnabled(false); settings->SetViewportEnabled(true); settings->SetMainFrameResizesAreOrientationChanges(true); @@ -1945,7 +1960,7 @@ web_view_helper.Resize(WebSize(viewport_width, viewport_height)); Document* document = - ToLocalFrame(web_view_helper.WebView()->GetPage()->MainFrame()) + ToLocalFrame(web_view_helper.GetWebView()->GetPage()->MainFrame()) ->GetDocument(); EXPECT_FALSE(document->GetViewportDescription().IsLegacyViewportType()); @@ -1980,7 +1995,7 @@ // (as in not hit content included in the view) web_view_helper.Resize(WebSize(viewport_width, 0)); - web_view_helper.WebView()->GetSettings()->SetForceZeroLayoutHeight(true); + web_view_helper.GetWebView()->GetSettings()->SetForceZeroLayoutHeight(true); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); IntPoint hit_point = IntPoint(30, 30); // button size is 100x100 @@ -1999,7 +2014,7 @@ gesture_event.x = gesture_event.global_x = hit_point.X(); gesture_event.y = gesture_event.global_y = hit_point.Y(); gesture_event.source_device = kWebGestureDeviceTouchscreen; - web_view_helper.WebView() + web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrame() ->GetEventHandler() @@ -2082,14 +2097,14 @@ web_view_helper.InitializeAndLoad(base_url_ + "200-by-300.html", nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView()->GetSettings()->SetForceZeroLayoutHeight(true); + web_view_helper.GetWebView()->GetSettings()->SetForceZeroLayoutHeight(true); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); - FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), + FrameTestHelpers::LoadFrame(web_view_helper.GetWebView()->MainFrameImpl(), base_url_ + "large-div.html"); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); - EXPECT_EQ(0, web_view_helper.WebView() + EXPECT_EQ(0, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() @@ -2109,12 +2124,13 @@ web_view_helper.InitializeAndLoad(base_url_ + "200-by-300.html", nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); - web_view_helper.WebView()->GetSettings()->SetUseWideViewport(true); - web_view_helper.WebView()->GetSettings()->SetForceZeroLayoutHeight(true); + web_view_helper.GetWebView()->GetSettings()->SetWideViewportQuirkEnabled( + true); + web_view_helper.GetWebView()->GetSettings()->SetUseWideViewport(true); + web_view_helper.GetWebView()->GetSettings()->SetForceZeroLayoutHeight(true); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); - EXPECT_EQ(0, web_view_helper.WebView() + EXPECT_EQ(0, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() @@ -2133,22 +2149,23 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.InitializeAndLoad("about:blank", nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); - web_view_helper.WebView()->GetSettings()->SetUseWideViewport(true); - web_view_helper.WebView()->GetSettings()->SetViewportMetaLayoutSizeQuirk( + web_view_helper.GetWebView()->GetSettings()->SetWideViewportQuirkEnabled( + true); + web_view_helper.GetWebView()->GetSettings()->SetUseWideViewport(true); + web_view_helper.GetWebView()->GetSettings()->SetViewportMetaLayoutSizeQuirk( true); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); - FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), + FrameTestHelpers::LoadFrame(web_view_helper.GetWebView()->MainFrameImpl(), base_url_ + "wide_document_width_viewport.html"); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); int wide_document_width = 800; float minimum_page_scale_factor = viewport_width / (float)wide_document_width; EXPECT_EQ(minimum_page_scale_factor, - web_view_helper.WebView()->PageScaleFactor()); + web_view_helper.GetWebView()->PageScaleFactor()); EXPECT_EQ(minimum_page_scale_factor, - web_view_helper.WebView()->MinimumPageScaleFactor()); + web_view_helper.GetWebView()->MinimumPageScaleFactor()); } TEST_P(ParameterizedWebFrameTest, WideViewportQuirkClobbersHeight) { @@ -2162,22 +2179,23 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.InitializeAndLoad("about:blank", nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); - web_view_helper.WebView()->GetSettings()->SetUseWideViewport(false); - web_view_helper.WebView()->GetSettings()->SetViewportMetaLayoutSizeQuirk( + web_view_helper.GetWebView()->GetSettings()->SetWideViewportQuirkEnabled( + true); + web_view_helper.GetWebView()->GetSettings()->SetUseWideViewport(false); + web_view_helper.GetWebView()->GetSettings()->SetViewportMetaLayoutSizeQuirk( true); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); - FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), + FrameTestHelpers::LoadFrame(web_view_helper.GetWebView()->MainFrameImpl(), base_url_ + "viewport-height-1000.html"); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); - EXPECT_EQ(800, web_view_helper.WebView() + EXPECT_EQ(800, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() .Height()); - EXPECT_EQ(1, web_view_helper.WebView()->PageScaleFactor()); + EXPECT_EQ(1, web_view_helper.GetWebView()->PageScaleFactor()); } TEST_P(ParameterizedWebFrameTest, LayoutSize320Quirk) { @@ -2191,39 +2209,40 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.InitializeAndLoad("about:blank", nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); - web_view_helper.WebView()->GetSettings()->SetUseWideViewport(true); - web_view_helper.WebView()->GetSettings()->SetViewportMetaLayoutSizeQuirk( + web_view_helper.GetWebView()->GetSettings()->SetWideViewportQuirkEnabled( + true); + web_view_helper.GetWebView()->GetSettings()->SetUseWideViewport(true); + web_view_helper.GetWebView()->GetSettings()->SetViewportMetaLayoutSizeQuirk( true); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); - FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), + FrameTestHelpers::LoadFrame(web_view_helper.GetWebView()->MainFrameImpl(), base_url_ + "viewport/viewport-30.html"); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); - EXPECT_EQ(600, web_view_helper.WebView() + EXPECT_EQ(600, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() .Width()); - EXPECT_EQ(800, web_view_helper.WebView() + EXPECT_EQ(800, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() .Height()); - EXPECT_EQ(1, web_view_helper.WebView()->PageScaleFactor()); + EXPECT_EQ(1, web_view_helper.GetWebView()->PageScaleFactor()); // The magic number to snap to device-width is 320, so test that 321 is // respected. Document* document = - ToLocalFrame(web_view_helper.WebView()->GetPage()->MainFrame()) + ToLocalFrame(web_view_helper.GetWebView()->GetPage()->MainFrame()) ->GetDocument(); ViewportDescription description = document->GetViewportDescription(); description.min_width = Length(321, blink::kFixed); description.max_width = Length(321, blink::kFixed); document->SetViewportDescription(description); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); - EXPECT_EQ(321, web_view_helper.WebView() + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); + EXPECT_EQ(321, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() @@ -2232,8 +2251,8 @@ description.min_width = Length(320, blink::kFixed); description.max_width = Length(320, blink::kFixed); document->SetViewportDescription(description); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); - EXPECT_EQ(600, web_view_helper.WebView() + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); + EXPECT_EQ(600, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() @@ -2242,8 +2261,8 @@ description = document->GetViewportDescription(); description.max_height = Length(1000, blink::kFixed); document->SetViewportDescription(description); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); - EXPECT_EQ(1000, web_view_helper.WebView() + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); + EXPECT_EQ(1000, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() @@ -2251,8 +2270,8 @@ description.max_height = Length(320, blink::kFixed); document->SetViewportDescription(description); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); - EXPECT_EQ(800, web_view_helper.WebView() + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); + EXPECT_EQ(800, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() @@ -2269,30 +2288,31 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.Initialize(nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView()->GetSettings()->SetViewportMetaZeroValuesQuirk( + web_view_helper.GetWebView()->GetSettings()->SetViewportMetaZeroValuesQuirk( true); - web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); - web_view_helper.WebView()->GetSettings()->SetViewportMetaLayoutSizeQuirk( + web_view_helper.GetWebView()->GetSettings()->SetWideViewportQuirkEnabled( true); - FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), + web_view_helper.GetWebView()->GetSettings()->SetViewportMetaLayoutSizeQuirk( + true); + FrameTestHelpers::LoadFrame(web_view_helper.GetWebView()->MainFrameImpl(), base_url_ + "viewport-zero-values.html"); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); - EXPECT_EQ(viewport_width, web_view_helper.WebView() + EXPECT_EQ(viewport_width, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() .Width()); - EXPECT_EQ(1.0f, web_view_helper.WebView()->PageScaleFactor()); + EXPECT_EQ(1.0f, web_view_helper.GetWebView()->PageScaleFactor()); - web_view_helper.WebView()->GetSettings()->SetUseWideViewport(true); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); - EXPECT_EQ(viewport_width, web_view_helper.WebView() + web_view_helper.GetWebView()->GetSettings()->SetUseWideViewport(true); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); + EXPECT_EQ(viewport_width, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() .Width()); - EXPECT_EQ(1.0f, web_view_helper.WebView()->PageScaleFactor()); + EXPECT_EQ(1.0f, web_view_helper.GetWebView()->PageScaleFactor()); } TEST_P(ParameterizedWebFrameTest, OverflowHiddenDisablesScrolling) { @@ -2305,7 +2325,7 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.Initialize(nullptr, &client); - FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), + FrameTestHelpers::LoadFrame(web_view_helper.GetWebView()->MainFrameImpl(), base_url_ + "body-overflow-hidden.html"); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); @@ -2325,7 +2345,7 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.Initialize(nullptr, &client); - FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), + FrameTestHelpers::LoadFrame(web_view_helper.GetWebView()->MainFrameImpl(), base_url_ + "body-overflow-hidden-short.html"); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); @@ -2348,10 +2368,10 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.Initialize(nullptr, &client); - web_view_helper.WebView() + web_view_helper.GetWebView() ->GetSettings() ->SetIgnoreMainFrameOverflowHiddenQuirk(true); - FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), + FrameTestHelpers::LoadFrame(web_view_helper.GetWebView()->MainFrameImpl(), base_url_ + "body-overflow-hidden.html"); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); @@ -2371,32 +2391,33 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.Initialize(nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView()->GetSettings()->SetViewportMetaZeroValuesQuirk( + web_view_helper.GetWebView()->GetSettings()->SetViewportMetaZeroValuesQuirk( true); - web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); - FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), + web_view_helper.GetWebView()->GetSettings()->SetWideViewportQuirkEnabled( + true); + FrameTestHelpers::LoadFrame(web_view_helper.GetWebView()->MainFrameImpl(), base_url_ + "viewport-nonzero-values.html"); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); EXPECT_EQ(viewport_width / expected_page_scale_factor, - web_view_helper.WebView() + web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() .Width()); EXPECT_EQ(expected_page_scale_factor, - web_view_helper.WebView()->PageScaleFactor()); + web_view_helper.GetWebView()->PageScaleFactor()); - web_view_helper.WebView()->GetSettings()->SetUseWideViewport(true); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); + web_view_helper.GetWebView()->GetSettings()->SetUseWideViewport(true); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); EXPECT_EQ(viewport_width / expected_page_scale_factor, - web_view_helper.WebView() + web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() .Width()); EXPECT_EQ(expected_page_scale_factor, - web_view_helper.WebView()->PageScaleFactor()); + web_view_helper.GetWebView()->PageScaleFactor()); } TEST_P(ParameterizedWebFrameTest, setPageScaleFactorDoesNotLayout) { @@ -2415,12 +2436,12 @@ int prev_layout_count = web_view_helper.LocalMainFrame()->GetFrameView()->LayoutCount(); - web_view_helper.WebView()->SetPageScaleFactor(3); - EXPECT_FALSE(web_view_helper.WebView() + web_view_helper.GetWebView()->SetPageScaleFactor(3); + EXPECT_FALSE(web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->NeedsLayout()); - EXPECT_EQ(prev_layout_count, web_view_helper.WebView() + EXPECT_EQ(prev_layout_count, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->LayoutCount()); @@ -2442,12 +2463,12 @@ int prev_layout_count = web_view_helper.LocalMainFrame()->GetFrameView()->LayoutCount(); - web_view_helper.WebView()->SetPageScaleFactor(30); - EXPECT_FALSE(web_view_helper.WebView() + web_view_helper.GetWebView()->SetPageScaleFactor(30); + EXPECT_FALSE(web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->NeedsLayout()); - EXPECT_EQ(prev_layout_count, web_view_helper.WebView() + EXPECT_EQ(prev_layout_count, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->LayoutCount()); @@ -2466,13 +2487,14 @@ &client, nullptr, ConfigureAndroid); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); - web_view_helper.WebView()->SetPageScaleFactor(3); - EXPECT_EQ(3, ToLocalFrame(web_view_helper.WebView()->GetPage()->MainFrame()) - ->Loader() - .GetDocumentLoader() - ->GetHistoryItem() - ->GetViewState() - ->page_scale_factor_); + web_view_helper.GetWebView()->SetPageScaleFactor(3); + EXPECT_EQ(3, + ToLocalFrame(web_view_helper.GetWebView()->GetPage()->MainFrame()) + ->Loader() + .GetDocumentLoader() + ->GetHistoryItem() + ->GetViewState() + ->page_scale_factor_); } TEST_P(ParameterizedWebFrameTest, initialScaleWrittenToHistoryItem) { @@ -2485,8 +2507,8 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.Initialize(nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView()->SetDefaultPageScaleLimits(0.25f, 5); - FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), + web_view_helper.GetWebView()->SetDefaultPageScaleLimits(0.25f, 5); + FrameTestHelpers::LoadFrame(web_view_helper.GetWebView()->MainFrameImpl(), base_url_ + "fixed_layout.html"); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); @@ -2494,7 +2516,7 @@ float minimum_page_scale_factor = viewport_width / (float)default_fixed_layout_width; EXPECT_EQ(minimum_page_scale_factor, - ToLocalFrame(web_view_helper.WebView()->GetPage()->MainFrame()) + ToLocalFrame(web_view_helper.GetWebView()->GetPage()->MainFrame()) ->Loader() .GetDocumentLoader() ->GetHistoryItem() @@ -2528,7 +2550,7 @@ !view->HorizontalScrollbar()->IsOverlayScrollbar()) viewport_height_minus_scrollbar -= 15; - web_view_helper.WebView()->SetPageScaleFactor(2); + web_view_helper.GetWebView()->SetPageScaleFactor(2); IntSize unscaled_size = view->VisibleContentSize(kIncludeScrollbars); EXPECT_EQ(viewport_width, unscaled_size.Width()); @@ -2559,13 +2581,14 @@ &client, nullptr, ConfigureAndroid); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); - web_view_helper.WebView()->SetPageScaleFactor(2); + web_view_helper.GetWebView()->SetPageScaleFactor(2); - EXPECT_EQ(980, ToLocalFrame(web_view_helper.WebView()->GetPage()->MainFrame()) - ->ContentLayoutItem() - .DocumentRect() - .Width()); - EXPECT_EQ(980, web_view_helper.WebView() + EXPECT_EQ(980, + ToLocalFrame(web_view_helper.GetWebView()->GetPage()->MainFrame()) + ->ContentLayoutItem() + .DocumentRect() + .Width()); + EXPECT_EQ(980, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->LayoutViewportScrollableArea() @@ -2592,8 +2615,9 @@ web_view_helper.InitializeAndLoad( base_url_ + "viewport-target-densitydpi-high.html", nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); - web_view_helper.WebView() + web_view_helper.GetWebView()->GetSettings()->SetWideViewportQuirkEnabled( + true); + web_view_helper.GetWebView() ->GetSettings() ->SetSupportDeprecatedTargetDensityDPI(true); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); @@ -2603,21 +2627,21 @@ float density_dpi_scale_ratio = device_scale_factor * target_dpi / device_dpi; EXPECT_NEAR(viewport_width * density_dpi_scale_ratio, - web_view_helper.WebView() + web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() .Width(), 1.0f); EXPECT_NEAR(viewport_height * density_dpi_scale_ratio, - web_view_helper.WebView() + web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() .Height(), 1.0f); EXPECT_NEAR(1.0f / density_dpi_scale_ratio, - web_view_helper.WebView()->PageScaleFactor(), 0.01f); + web_view_helper.GetWebView()->PageScaleFactor(), 0.01f); } } @@ -2637,28 +2661,29 @@ web_view_helper.InitializeAndLoad( base_url_ + "viewport-target-densitydpi-device.html", nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); - web_view_helper.WebView() + web_view_helper.GetWebView()->GetSettings()->SetWideViewportQuirkEnabled( + true); + web_view_helper.GetWebView() ->GetSettings() ->SetSupportDeprecatedTargetDensityDPI(true); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); EXPECT_NEAR(viewport_width * client.screen_info_.device_scale_factor, - web_view_helper.WebView() + web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() .Width(), 1.0f); EXPECT_NEAR(viewport_height * client.screen_info_.device_scale_factor, - web_view_helper.WebView() + web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() .Height(), 1.0f); EXPECT_NEAR(1.0f / client.screen_info_.device_scale_factor, - web_view_helper.WebView()->PageScaleFactor(), 0.01f); + web_view_helper.GetWebView()->PageScaleFactor(), 0.01f); } } @@ -2679,28 +2704,29 @@ web_view_helper.InitializeAndLoad( base_url_ + "viewport-target-densitydpi-device-and-fixed-width.html", nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); - web_view_helper.WebView() + web_view_helper.GetWebView()->GetSettings()->SetWideViewportQuirkEnabled( + true); + web_view_helper.GetWebView() ->GetSettings() ->SetSupportDeprecatedTargetDensityDPI(true); - web_view_helper.WebView()->GetSettings()->SetUseWideViewport(true); + web_view_helper.GetWebView()->GetSettings()->SetUseWideViewport(true); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); EXPECT_NEAR(viewport_width, - web_view_helper.WebView() + web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() .Width(), 1.0f); EXPECT_NEAR(viewport_height, - web_view_helper.WebView() + web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() .Height(), 1.0f); - EXPECT_NEAR(1.0f, web_view_helper.WebView()->PageScaleFactor(), 0.01f); + EXPECT_NEAR(1.0f, web_view_helper.GetWebView()->PageScaleFactor(), 0.01f); } } @@ -2716,29 +2742,30 @@ web_view_helper.InitializeAndLoad( base_url_ + "viewport-initial-scale-less-than-1.html", nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView() + web_view_helper.GetWebView() ->GetSettings() ->SetSupportDeprecatedTargetDensityDPI(true); - web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); - web_view_helper.WebView()->GetSettings()->SetUseWideViewport(false); + web_view_helper.GetWebView()->GetSettings()->SetWideViewportQuirkEnabled( + true); + web_view_helper.GetWebView()->GetSettings()->SetUseWideViewport(false); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); EXPECT_NEAR(viewport_width * client.screen_info_.device_scale_factor, - web_view_helper.WebView() + web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() .Width(), 1.0f); EXPECT_NEAR(viewport_height * client.screen_info_.device_scale_factor, - web_view_helper.WebView() + web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() .Height(), 1.0f); EXPECT_NEAR(1.0f / client.screen_info_.device_scale_factor, - web_view_helper.WebView()->PageScaleFactor(), 0.01f); + web_view_helper.GetWebView()->PageScaleFactor(), 0.01f); } TEST_P(ParameterizedWebFrameTest, @@ -2755,17 +2782,18 @@ web_view_helper.InitializeAndLoad( base_url_ + "viewport-initial-scale-less-than-1-device-width.html", nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView() + web_view_helper.GetWebView() ->GetSettings() ->SetSupportDeprecatedTargetDensityDPI(true); - web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); - web_view_helper.WebView()->GetSettings()->SetUseWideViewport(false); + web_view_helper.GetWebView()->GetSettings()->SetWideViewportQuirkEnabled( + true); + web_view_helper.GetWebView()->GetSettings()->SetUseWideViewport(false); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); const float kPageZoom = 0.25f; EXPECT_NEAR( viewport_width * client.screen_info_.device_scale_factor / kPageZoom, - web_view_helper.WebView() + web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() @@ -2773,14 +2801,14 @@ 1.0f); EXPECT_NEAR( viewport_height * client.screen_info_.device_scale_factor / kPageZoom, - web_view_helper.WebView() + web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() .Height(), 1.0f); EXPECT_NEAR(1.0f / client.screen_info_.device_scale_factor, - web_view_helper.WebView()->PageScaleFactor(), 0.01f); + web_view_helper.GetWebView()->PageScaleFactor(), 0.01f); } TEST_P(ParameterizedWebFrameTest, @@ -2795,29 +2823,30 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.InitializeAndLoad(base_url_ + "large-div.html", nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView()->SetDefaultPageScaleLimits(0.25f, 5); - web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); - web_view_helper.WebView()->GetSettings()->SetUseWideViewport(false); - web_view_helper.WebView()->SetInitialPageScaleOverride( + web_view_helper.GetWebView()->SetDefaultPageScaleLimits(0.25f, 5); + web_view_helper.GetWebView()->GetSettings()->SetWideViewportQuirkEnabled( + true); + web_view_helper.GetWebView()->GetSettings()->SetUseWideViewport(false); + web_view_helper.GetWebView()->SetInitialPageScaleOverride( enforced_page_scale_factor); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); EXPECT_NEAR(viewport_width / enforced_page_scale_factor, - web_view_helper.WebView() + web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() .Width(), 1.0f); EXPECT_NEAR(viewport_height / enforced_page_scale_factor, - web_view_helper.WebView() + web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() .Height(), 1.0f); EXPECT_NEAR(enforced_page_scale_factor, - web_view_helper.WebView()->PageScaleFactor(), 0.01f); + web_view_helper.GetWebView()->PageScaleFactor(), 0.01f); } TEST_P(ParameterizedWebFrameTest, NoUserScalableQuirkIgnoresViewportScale) { @@ -2831,25 +2860,26 @@ web_view_helper.InitializeAndLoad( base_url_ + "viewport-initial-scale-and-user-scalable-no.html", nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView()->GetSettings()->SetViewportMetaNonUserScalableQuirk( - true); + web_view_helper.GetWebView() + ->GetSettings() + ->SetViewportMetaNonUserScalableQuirk(true); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); EXPECT_NEAR(viewport_width, - web_view_helper.WebView() + web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() .Width(), 1.0f); EXPECT_NEAR(viewport_height, - web_view_helper.WebView() + web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() .Height(), 1.0f); - EXPECT_NEAR(1.0f, web_view_helper.WebView()->PageScaleFactor(), 0.01f); + EXPECT_NEAR(1.0f, web_view_helper.GetWebView()->PageScaleFactor(), 0.01f); } TEST_P(ParameterizedWebFrameTest, @@ -2865,31 +2895,33 @@ web_view_helper.InitializeAndLoad( base_url_ + "viewport-initial-scale-and-user-scalable-no.html", nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView() + web_view_helper.GetWebView() ->GetSettings() ->SetSupportDeprecatedTargetDensityDPI(true); - web_view_helper.WebView()->GetSettings()->SetViewportMetaNonUserScalableQuirk( + web_view_helper.GetWebView() + ->GetSettings() + ->SetViewportMetaNonUserScalableQuirk(true); + web_view_helper.GetWebView()->GetSettings()->SetWideViewportQuirkEnabled( true); - web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); - web_view_helper.WebView()->GetSettings()->SetUseWideViewport(false); + web_view_helper.GetWebView()->GetSettings()->SetUseWideViewport(false); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); EXPECT_NEAR(viewport_width * client.screen_info_.device_scale_factor, - web_view_helper.WebView() + web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() .Width(), 1.0f); EXPECT_NEAR(viewport_height * client.screen_info_.device_scale_factor, - web_view_helper.WebView() + web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() .Height(), 1.0f); EXPECT_NEAR(1.0f / client.screen_info_.device_scale_factor, - web_view_helper.WebView()->PageScaleFactor(), 0.01f); + web_view_helper.GetWebView()->PageScaleFactor(), 0.01f); } TEST_P(ParameterizedWebFrameTest, @@ -2904,27 +2936,29 @@ web_view_helper.InitializeAndLoad( base_url_ + "viewport-2x-initial-scale-non-user-scalable.html", nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView()->GetSettings()->SetViewportMetaNonUserScalableQuirk( + web_view_helper.GetWebView() + ->GetSettings() + ->SetViewportMetaNonUserScalableQuirk(true); + web_view_helper.GetWebView()->GetSettings()->SetWideViewportQuirkEnabled( true); - web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); - web_view_helper.WebView()->GetSettings()->SetUseWideViewport(true); + web_view_helper.GetWebView()->GetSettings()->SetUseWideViewport(true); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); EXPECT_NEAR(viewport_width, - web_view_helper.WebView() + web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() .Width(), 1.0f); EXPECT_NEAR(viewport_height, - web_view_helper.WebView() + web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() .Height(), 1.0f); - EXPECT_NEAR(1.0f, web_view_helper.WebView()->PageScaleFactor(), 0.01f); + EXPECT_NEAR(1.0f, web_view_helper.GetWebView()->PageScaleFactor(), 0.01f); } TEST_P(ParameterizedWebFrameTest, @@ -2938,14 +2972,17 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.InitializeAndLoad(base_url_ + "no_viewport_tag.html", nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView()->SetDefaultPageScaleLimits(0.25f, 5); - web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); - web_view_helper.WebView()->GetSettings()->SetUseWideViewport(false); + web_view_helper.GetWebView()->SetDefaultPageScaleLimits(0.25f, 5); + web_view_helper.GetWebView()->GetSettings()->SetWideViewportQuirkEnabled( + true); + web_view_helper.GetWebView()->GetSettings()->SetUseWideViewport(false); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); - EXPECT_NEAR(1.0f, web_view_helper.WebView()->PageScaleFactor(), 0.01f); - EXPECT_NEAR(1.0f, web_view_helper.WebView()->MinimumPageScaleFactor(), 0.01f); - EXPECT_NEAR(5.0f, web_view_helper.WebView()->MaximumPageScaleFactor(), 0.01f); + EXPECT_NEAR(1.0f, web_view_helper.GetWebView()->PageScaleFactor(), 0.01f); + EXPECT_NEAR(1.0f, web_view_helper.GetWebView()->MinimumPageScaleFactor(), + 0.01f); + EXPECT_NEAR(5.0f, web_view_helper.GetWebView()->MaximumPageScaleFactor(), + 0.01f); } TEST_P(ParameterizedWebFrameTest, AtViewportInsideAtMediaInitialViewport) { @@ -2958,7 +2995,7 @@ ConfigureAndroid); web_view_helper.Resize(WebSize(640, 480)); - EXPECT_EQ(2000, web_view_helper.WebView() + EXPECT_EQ(2000, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() @@ -2966,7 +3003,7 @@ web_view_helper.Resize(WebSize(1200, 480)); - EXPECT_EQ(1200, web_view_helper.WebView() + EXPECT_EQ(1200, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() @@ -2980,12 +3017,12 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.Initialize(nullptr, &client, nullptr, ConfigureAndroid); web_view_helper.Resize(WebSize(640, 480)); - FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), + FrameTestHelpers::LoadFrame(web_view_helper.GetWebView()->MainFrameImpl(), base_url_ + "viewport-and-media.html"); Document* document = web_view_helper.LocalMainFrame()->GetFrame()->GetDocument(); - EXPECT_EQ(2000, web_view_helper.WebView() + EXPECT_EQ(2000, web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutSize() @@ -3006,7 +3043,7 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.Initialize(nullptr, &client, nullptr, ConfigureAndroid); web_view_helper.Resize(WebSize(800, 600)); - FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), + FrameTestHelpers::LoadFrame(web_view_helper.GetWebView()->MainFrameImpl(), base_url_ + "viewport-lengths.html"); LocalFrameView* view = web_view_helper.LocalMainFrame()->GetFrameView(); @@ -3043,23 +3080,24 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.InitializeAndLoad(base_url_ + url, nullptr, nullptr, nullptr, ConfigureAndroid); - web_view_helper.WebView()->SetDefaultPageScaleLimits(0.25f, 5); + web_view_helper.GetWebView()->SetDefaultPageScaleLimits(0.25f, 5); // Origin scrollOffsets preserved under resize. { web_view_helper.Resize( WebSize(viewport_size.width, viewport_size.height)); - web_view_helper.WebView()->SetPageScaleFactor(initial_page_scale_factor); - ASSERT_EQ(viewport_size, web_view_helper.WebView()->Size()); + web_view_helper.GetWebView()->SetPageScaleFactor( + initial_page_scale_factor); + ASSERT_EQ(viewport_size, web_view_helper.GetWebView()->Size()); ASSERT_EQ(initial_page_scale_factor, - web_view_helper.WebView()->PageScaleFactor()); + web_view_helper.GetWebView()->PageScaleFactor()); web_view_helper.Resize( WebSize(viewport_size.height, viewport_size.width)); float expected_page_scale_factor = initial_page_scale_factor * (should_scale_relative_to_viewport_width ? 1 / aspect_ratio : 1); EXPECT_NEAR(expected_page_scale_factor, - web_view_helper.WebView()->PageScaleFactor(), 0.05f); + web_view_helper.GetWebView()->PageScaleFactor(), 0.05f); EXPECT_EQ(WebSize(), web_view_helper.LocalMainFrame()->GetScrollOffset()); } @@ -3068,21 +3106,22 @@ { web_view_helper.Resize( WebSize(viewport_size.width, viewport_size.height)); - web_view_helper.WebView()->SetPageScaleFactor(initial_page_scale_factor); + web_view_helper.GetWebView()->SetPageScaleFactor( + initial_page_scale_factor); web_view_helper.LocalMainFrame()->SetScrollOffset(scroll_offset); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); const WebSize expected_scroll_offset = web_view_helper.LocalMainFrame()->GetScrollOffset(); web_view_helper.Resize( WebSize(viewport_size.width, viewport_size.height * 0.8f)); EXPECT_EQ(initial_page_scale_factor, - web_view_helper.WebView()->PageScaleFactor()); + web_view_helper.GetWebView()->PageScaleFactor()); EXPECT_EQ(expected_scroll_offset, web_view_helper.LocalMainFrame()->GetScrollOffset()); web_view_helper.Resize( WebSize(viewport_size.width, viewport_size.height * 0.8f)); EXPECT_EQ(initial_page_scale_factor, - web_view_helper.WebView()->PageScaleFactor()); + web_view_helper.GetWebView()->PageScaleFactor()); EXPECT_EQ(expected_scroll_offset, web_view_helper.LocalMainFrame()->GetScrollOffset()); } @@ -3172,7 +3211,7 @@ scrollable_area->ContentsSize().Height() - view->VisibleContentRect().Height()); - web_view_helper.WebView()->SetPageScaleFactor(10); + web_view_helper.GetWebView()->SetPageScaleFactor(10); EXPECT_EQ(scrollable_area->ScrollSize(kHorizontalScrollbar), scrollable_area->ContentsSize().Width() - @@ -3194,23 +3233,23 @@ web_view_helper.InitializeAndLoad(base_url_ + "no_scale_for_you.html", nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView()->SetDefaultPageScaleLimits(0.25f, 5); + web_view_helper.GetWebView()->SetDefaultPageScaleLimits(0.25f, 5); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); - EXPECT_EQ(2.0f, web_view_helper.WebView()->MinimumPageScaleFactor()); - EXPECT_EQ(2.0f, web_view_helper.WebView()->MaximumPageScaleFactor()); + EXPECT_EQ(2.0f, web_view_helper.GetWebView()->MinimumPageScaleFactor()); + EXPECT_EQ(2.0f, web_view_helper.GetWebView()->MaximumPageScaleFactor()); - web_view_helper.WebView()->SetIgnoreViewportTagScaleLimits(true); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); + web_view_helper.GetWebView()->SetIgnoreViewportTagScaleLimits(true); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); - EXPECT_EQ(1.0f, web_view_helper.WebView()->MinimumPageScaleFactor()); - EXPECT_EQ(5.0f, web_view_helper.WebView()->MaximumPageScaleFactor()); + EXPECT_EQ(1.0f, web_view_helper.GetWebView()->MinimumPageScaleFactor()); + EXPECT_EQ(5.0f, web_view_helper.GetWebView()->MaximumPageScaleFactor()); - web_view_helper.WebView()->SetIgnoreViewportTagScaleLimits(false); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); + web_view_helper.GetWebView()->SetIgnoreViewportTagScaleLimits(false); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); - EXPECT_EQ(2.0f, web_view_helper.WebView()->MinimumPageScaleFactor()); - EXPECT_EQ(2.0f, web_view_helper.WebView()->MaximumPageScaleFactor()); + EXPECT_EQ(2.0f, web_view_helper.GetWebView()->MinimumPageScaleFactor()); + EXPECT_EQ(2.0f, web_view_helper.GetWebView()->MaximumPageScaleFactor()); } // Android doesn't have scrollbars on the main LocalFrameView @@ -3233,10 +3272,10 @@ nullptr, &ConfigureCompositingWebView); web_view_helper.Resize(WebSize(view_width, view_height)); - FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), + FrameTestHelpers::LoadFrame(web_view_helper.GetWebView()->MainFrameImpl(), base_url_ + "large-div.html"); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); LocalFrameView* view = web_view_helper.LocalMainFrame()->GetFrameView(); EXPECT_TRUE( view->LayoutViewportScrollableArea()->LayerForHorizontalScrollbar()); @@ -3297,9 +3336,9 @@ web_view_helper.InitializeAndLoad( base_url_ + "get_scale_for_auto_zoom_into_div_test.html", nullptr, nullptr, nullptr, ConfigureAndroid); - web_view_helper.WebView()->SetDeviceScaleFactor(kDeviceScaleFactor); - web_view_helper.WebView()->SetDefaultPageScaleLimits(0.01f, 4); - web_view_helper.WebView()->SetPageScaleFactor(0.5f); + web_view_helper.GetWebView()->SetDeviceScaleFactor(kDeviceScaleFactor); + web_view_helper.GetWebView()->SetDefaultPageScaleLimits(0.01f, 4); + web_view_helper.GetWebView()->SetPageScaleFactor(0.5f); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); WebRect wide_div(200, 100, 400, 150); @@ -3310,13 +3349,13 @@ WebPoint scroll; float double_tap_zoom_already_legible_scale = - web_view_helper.WebView()->MinimumPageScaleFactor() * + web_view_helper.GetWebView()->MinimumPageScaleFactor() * double_tap_zoom_already_legible_ratio; // Test double-tap zooming into wide div. - WebRect wide_block_bound = web_view_helper.WebView()->ComputeBlockBound( + WebRect wide_block_bound = web_view_helper.GetWebView()->ComputeBlockBound( double_tap_point_wide, false); - web_view_helper.WebView()->ComputeScaleAndScrollForBlockRect( + web_view_helper.GetWebView()->ComputeScaleAndScrollForBlockRect( WebPoint(double_tap_point_wide.x, double_tap_point_wide.y), wide_block_bound, kTouchPointPadding, double_tap_zoom_already_legible_scale, scale, scroll); @@ -3326,24 +3365,25 @@ EXPECT_NEAR(wide_div.x, scroll.x, 20); EXPECT_EQ(0, scroll.y); - SetScaleAndScrollAndLayout(web_view_helper.WebView(), scroll, scale); + SetScaleAndScrollAndLayout(web_view_helper.GetWebView(), scroll, scale); // Test zoom out back to minimum scale. - wide_block_bound = web_view_helper.WebView()->ComputeBlockBound( + wide_block_bound = web_view_helper.GetWebView()->ComputeBlockBound( double_tap_point_wide, false); - web_view_helper.WebView()->ComputeScaleAndScrollForBlockRect( + web_view_helper.GetWebView()->ComputeScaleAndScrollForBlockRect( WebPoint(double_tap_point_wide.x, double_tap_point_wide.y), wide_block_bound, kTouchPointPadding, double_tap_zoom_already_legible_scale, scale, scroll); // FIXME: Looks like we are missing EXPECTs here. - scale = web_view_helper.WebView()->MinimumPageScaleFactor(); - SetScaleAndScrollAndLayout(web_view_helper.WebView(), WebPoint(0, 0), scale); + scale = web_view_helper.GetWebView()->MinimumPageScaleFactor(); + SetScaleAndScrollAndLayout(web_view_helper.GetWebView(), WebPoint(0, 0), + scale); // Test double-tap zooming into tall div. - WebRect tall_block_bound = web_view_helper.WebView()->ComputeBlockBound( + WebRect tall_block_bound = web_view_helper.GetWebView()->ComputeBlockBound( double_tap_point_tall, false); - web_view_helper.WebView()->ComputeScaleAndScrollForBlockRect( + web_view_helper.GetWebView()->ComputeScaleAndScrollForBlockRect( WebPoint(double_tap_point_tall.x, double_tap_point_tall.y), tall_block_bound, kTouchPointPadding, double_tap_zoom_already_legible_scale, scale, scroll); @@ -3365,28 +3405,29 @@ base_url_ + "get_wide_div_for_auto_zoom_test.html", nullptr, nullptr, nullptr, ConfigureAndroid); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); - web_view_helper.WebView()->SetDeviceScaleFactor(kDeviceScaleFactor); - web_view_helper.WebView()->SetPageScaleFactor(1.0f); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); + web_view_helper.GetWebView()->SetDeviceScaleFactor(kDeviceScaleFactor); + web_view_helper.GetWebView()->SetPageScaleFactor(1.0f); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); - web_view_helper.WebView()->EnableFakePageScaleAnimationForTesting(true); + web_view_helper.GetWebView()->EnableFakePageScaleAnimationForTesting(true); float double_tap_zoom_already_legible_scale = - web_view_helper.WebView()->MinimumPageScaleFactor() * + web_view_helper.GetWebView()->MinimumPageScaleFactor() * double_tap_zoom_already_legible_ratio; WebRect div(0, 100, viewport_width, 150); WebPoint point(div.x + 50, div.y + 50); float scale; SetScaleAndScrollAndLayout( - web_view_helper.WebView(), WebPoint(0, 0), - (web_view_helper.WebView()->MinimumPageScaleFactor()) * + web_view_helper.GetWebView(), WebPoint(0, 0), + (web_view_helper.GetWebView()->MinimumPageScaleFactor()) * (1 + double_tap_zoom_already_legible_ratio) / 2); - SimulateDoubleTap(web_view_helper.WebView(), point, scale); + SimulateDoubleTap(web_view_helper.GetWebView(), point, scale); EXPECT_FLOAT_EQ(double_tap_zoom_already_legible_scale, scale); - SimulateDoubleTap(web_view_helper.WebView(), point, scale); - EXPECT_FLOAT_EQ(web_view_helper.WebView()->MinimumPageScaleFactor(), scale); + SimulateDoubleTap(web_view_helper.GetWebView(), point, scale); + EXPECT_FLOAT_EQ(web_view_helper.GetWebView()->MinimumPageScaleFactor(), + scale); } TEST_P(ParameterizedWebFrameTest, DivAutoZoomVeryTallTest) { @@ -3402,9 +3443,9 @@ web_view_helper.InitializeAndLoad(base_url_ + "very_tall_div.html", nullptr, nullptr, nullptr, ConfigureAndroid); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); - web_view_helper.WebView()->SetDeviceScaleFactor(kDeviceScaleFactor); - web_view_helper.WebView()->SetPageScaleFactor(1.0f); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); + web_view_helper.GetWebView()->SetDeviceScaleFactor(kDeviceScaleFactor); + web_view_helper.GetWebView()->SetPageScaleFactor(1.0f); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); WebRect div(200, 300, 400, 5000); WebPoint point(div.x + 50, div.y + 3000); @@ -3412,8 +3453,8 @@ WebPoint scroll; WebRect block_bound = - web_view_helper.WebView()->ComputeBlockBound(point, true); - web_view_helper.WebView()->ComputeScaleAndScrollForBlockRect( + web_view_helper.GetWebView()->ComputeBlockBound(point, true); + web_view_helper.GetWebView()->ComputeScaleAndScrollForBlockRect( point, block_bound, 0, 1.0f, scale, scroll); EXPECT_EQ(scale, 1.0f); EXPECT_EQ(scroll.y, 2660); @@ -3431,13 +3472,13 @@ base_url_ + "get_multiple_divs_for_auto_zoom_test.html", nullptr, nullptr, nullptr, ConfigureAndroid); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); - web_view_helper.WebView()->SetDefaultPageScaleLimits(0.5f, 4); - web_view_helper.WebView()->SetDeviceScaleFactor(kDeviceScaleFactor); - web_view_helper.WebView()->SetPageScaleFactor(0.5f); - web_view_helper.WebView()->SetMaximumLegibleScale(1.f); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); + web_view_helper.GetWebView()->SetDefaultPageScaleLimits(0.5f, 4); + web_view_helper.GetWebView()->SetDeviceScaleFactor(kDeviceScaleFactor); + web_view_helper.GetWebView()->SetPageScaleFactor(0.5f); + web_view_helper.GetWebView()->SetMaximumLegibleScale(1.f); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); - web_view_helper.WebView()->EnableFakePageScaleAnimationForTesting(true); + web_view_helper.GetWebView()->EnableFakePageScaleAnimationForTesting(true); WebRect top_div(200, 100, 200, 150); WebRect bottom_div(200, 300, 200, 150); @@ -3445,37 +3486,40 @@ WebPoint bottom_point(bottom_div.x + 50, bottom_div.y + 50); float scale; SetScaleAndScrollAndLayout( - web_view_helper.WebView(), WebPoint(0, 0), - (web_view_helper.WebView()->MinimumPageScaleFactor()) * + web_view_helper.GetWebView(), WebPoint(0, 0), + (web_view_helper.GetWebView()->MinimumPageScaleFactor()) * (1 + double_tap_zoom_already_legible_ratio) / 2); // Test double tap on two different divs. After first zoom, we should go back // to minimum page scale with a second double tap. - SimulateDoubleTap(web_view_helper.WebView(), top_point, scale); + SimulateDoubleTap(web_view_helper.GetWebView(), top_point, scale); EXPECT_FLOAT_EQ(1, scale); - SimulateDoubleTap(web_view_helper.WebView(), bottom_point, scale); - EXPECT_FLOAT_EQ(web_view_helper.WebView()->MinimumPageScaleFactor(), scale); + SimulateDoubleTap(web_view_helper.GetWebView(), bottom_point, scale); + EXPECT_FLOAT_EQ(web_view_helper.GetWebView()->MinimumPageScaleFactor(), + scale); // If the user pinch zooms after double tap, a second double tap should zoom // back to the div. - SimulateDoubleTap(web_view_helper.WebView(), top_point, scale); + SimulateDoubleTap(web_view_helper.GetWebView(), top_point, scale); EXPECT_FLOAT_EQ(1, scale); - web_view_helper.WebView()->ApplyViewportDeltas(WebFloatSize(), WebFloatSize(), - WebFloatSize(), 0.6f, 0); - SimulateDoubleTap(web_view_helper.WebView(), bottom_point, scale); + web_view_helper.GetWebView()->ApplyViewportDeltas( + WebFloatSize(), WebFloatSize(), WebFloatSize(), 0.6f, 0); + SimulateDoubleTap(web_view_helper.GetWebView(), bottom_point, scale); EXPECT_FLOAT_EQ(1, scale); - SimulateDoubleTap(web_view_helper.WebView(), bottom_point, scale); - EXPECT_FLOAT_EQ(web_view_helper.WebView()->MinimumPageScaleFactor(), scale); + SimulateDoubleTap(web_view_helper.GetWebView(), bottom_point, scale); + EXPECT_FLOAT_EQ(web_view_helper.GetWebView()->MinimumPageScaleFactor(), + scale); // If we didn't yet get an auto-zoom update and a second double-tap arrives, // should go back to minimum scale. - web_view_helper.WebView()->ApplyViewportDeltas(WebFloatSize(), WebFloatSize(), - WebFloatSize(), 1.1f, 0); - web_view_helper.WebView()->AnimateDoubleTapZoom(top_point); + web_view_helper.GetWebView()->ApplyViewportDeltas( + WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.1f, 0); + web_view_helper.GetWebView()->AnimateDoubleTapZoom(top_point); EXPECT_TRUE( - web_view_helper.WebView()->FakeDoubleTapAnimationPendingForTesting()); - SimulateDoubleTap(web_view_helper.WebView(), bottom_point, scale); - EXPECT_FLOAT_EQ(web_view_helper.WebView()->MinimumPageScaleFactor(), scale); + web_view_helper.GetWebView()->FakeDoubleTapAnimationPendingForTesting()); + SimulateDoubleTap(web_view_helper.GetWebView(), bottom_point, scale); + EXPECT_FLOAT_EQ(web_view_helper.GetWebView()->MinimumPageScaleFactor(), + scale); } TEST_P(ParameterizedWebFrameTest, DivAutoZoomScaleBoundsTest) { @@ -3489,11 +3533,11 @@ base_url_ + "get_scale_bounds_check_for_auto_zoom_test.html", nullptr, nullptr, nullptr, ConfigureAndroid); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); - web_view_helper.WebView()->SetDeviceScaleFactor(1.5f); - web_view_helper.WebView()->SetMaximumLegibleScale(1.f); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); + web_view_helper.GetWebView()->SetDeviceScaleFactor(1.5f); + web_view_helper.GetWebView()->SetMaximumLegibleScale(1.f); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); - web_view_helper.WebView()->EnableFakePageScaleAnimationForTesting(true); + web_view_helper.GetWebView()->EnableFakePageScaleAnimationForTesting(true); WebRect div(200, 100, 200, 150); WebPoint double_tap_point(div.x + 50, div.y + 50); @@ -3501,60 +3545,63 @@ // Test double tap scale bounds. // minimumPageScale < doubleTapZoomAlreadyLegibleScale < 1 - web_view_helper.WebView()->SetDefaultPageScaleLimits(0.5f, 4); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); + web_view_helper.GetWebView()->SetDefaultPageScaleLimits(0.5f, 4); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); float double_tap_zoom_already_legible_scale = - web_view_helper.WebView()->MinimumPageScaleFactor() * + web_view_helper.GetWebView()->MinimumPageScaleFactor() * double_tap_zoom_already_legible_ratio; SetScaleAndScrollAndLayout( - web_view_helper.WebView(), WebPoint(0, 0), - (web_view_helper.WebView()->MinimumPageScaleFactor()) * + web_view_helper.GetWebView(), WebPoint(0, 0), + (web_view_helper.GetWebView()->MinimumPageScaleFactor()) * (1 + double_tap_zoom_already_legible_ratio) / 2); - SimulateDoubleTap(web_view_helper.WebView(), double_tap_point, scale); + SimulateDoubleTap(web_view_helper.GetWebView(), double_tap_point, scale); EXPECT_FLOAT_EQ(1, scale); - SimulateDoubleTap(web_view_helper.WebView(), double_tap_point, scale); - EXPECT_FLOAT_EQ(web_view_helper.WebView()->MinimumPageScaleFactor(), scale); - SimulateDoubleTap(web_view_helper.WebView(), double_tap_point, scale); + SimulateDoubleTap(web_view_helper.GetWebView(), double_tap_point, scale); + EXPECT_FLOAT_EQ(web_view_helper.GetWebView()->MinimumPageScaleFactor(), + scale); + SimulateDoubleTap(web_view_helper.GetWebView(), double_tap_point, scale); EXPECT_FLOAT_EQ(1, scale); // Zoom in to reset double_tap_zoom_in_effect flag. - web_view_helper.WebView()->ApplyViewportDeltas(WebFloatSize(), WebFloatSize(), - WebFloatSize(), 1.1f, 0); + web_view_helper.GetWebView()->ApplyViewportDeltas( + WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.1f, 0); // 1 < minimumPageScale < doubleTapZoomAlreadyLegibleScale - web_view_helper.WebView()->SetDefaultPageScaleLimits(1.1f, 4); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); + web_view_helper.GetWebView()->SetDefaultPageScaleLimits(1.1f, 4); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); double_tap_zoom_already_legible_scale = - web_view_helper.WebView()->MinimumPageScaleFactor() * + web_view_helper.GetWebView()->MinimumPageScaleFactor() * double_tap_zoom_already_legible_ratio; SetScaleAndScrollAndLayout( - web_view_helper.WebView(), WebPoint(0, 0), - (web_view_helper.WebView()->MinimumPageScaleFactor()) * + web_view_helper.GetWebView(), WebPoint(0, 0), + (web_view_helper.GetWebView()->MinimumPageScaleFactor()) * (1 + double_tap_zoom_already_legible_ratio) / 2); - SimulateDoubleTap(web_view_helper.WebView(), double_tap_point, scale); + SimulateDoubleTap(web_view_helper.GetWebView(), double_tap_point, scale); EXPECT_FLOAT_EQ(double_tap_zoom_already_legible_scale, scale); - SimulateDoubleTap(web_view_helper.WebView(), double_tap_point, scale); - EXPECT_FLOAT_EQ(web_view_helper.WebView()->MinimumPageScaleFactor(), scale); - SimulateDoubleTap(web_view_helper.WebView(), double_tap_point, scale); + SimulateDoubleTap(web_view_helper.GetWebView(), double_tap_point, scale); + EXPECT_FLOAT_EQ(web_view_helper.GetWebView()->MinimumPageScaleFactor(), + scale); + SimulateDoubleTap(web_view_helper.GetWebView(), double_tap_point, scale); EXPECT_FLOAT_EQ(double_tap_zoom_already_legible_scale, scale); // Zoom in to reset double_tap_zoom_in_effect flag. - web_view_helper.WebView()->ApplyViewportDeltas(WebFloatSize(), WebFloatSize(), - WebFloatSize(), 1.1f, 0); + web_view_helper.GetWebView()->ApplyViewportDeltas( + WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.1f, 0); // minimumPageScale < 1 < doubleTapZoomAlreadyLegibleScale - web_view_helper.WebView()->SetDefaultPageScaleLimits(0.95f, 4); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); + web_view_helper.GetWebView()->SetDefaultPageScaleLimits(0.95f, 4); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); double_tap_zoom_already_legible_scale = - web_view_helper.WebView()->MinimumPageScaleFactor() * + web_view_helper.GetWebView()->MinimumPageScaleFactor() * double_tap_zoom_already_legible_ratio; SetScaleAndScrollAndLayout( - web_view_helper.WebView(), WebPoint(0, 0), - (web_view_helper.WebView()->MinimumPageScaleFactor()) * + web_view_helper.GetWebView(), WebPoint(0, 0), + (web_view_helper.GetWebView()->MinimumPageScaleFactor()) * (1 + double_tap_zoom_already_legible_ratio) / 2); - SimulateDoubleTap(web_view_helper.WebView(), double_tap_point, scale); + SimulateDoubleTap(web_view_helper.GetWebView(), double_tap_point, scale); EXPECT_FLOAT_EQ(double_tap_zoom_already_legible_scale, scale); - SimulateDoubleTap(web_view_helper.WebView(), double_tap_point, scale); - EXPECT_FLOAT_EQ(web_view_helper.WebView()->MinimumPageScaleFactor(), scale); - SimulateDoubleTap(web_view_helper.WebView(), double_tap_point, scale); + SimulateDoubleTap(web_view_helper.GetWebView(), double_tap_point, scale); + EXPECT_FLOAT_EQ(web_view_helper.GetWebView()->MinimumPageScaleFactor(), + scale); + SimulateDoubleTap(web_view_helper.GetWebView(), double_tap_point, scale); EXPECT_FLOAT_EQ(double_tap_zoom_already_legible_scale, scale); } @@ -3570,13 +3617,15 @@ base_url_ + "get_scale_bounds_check_for_auto_zoom_test.html", nullptr, nullptr, nullptr, ConfigureAndroid); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); - web_view_helper.WebView()->SetMaximumLegibleScale( + web_view_helper.GetWebView()->SetMaximumLegibleScale( maximum_legible_scale_factor); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); - web_view_helper.WebView()->EnableFakePageScaleAnimationForTesting(true); - web_view_helper.WebView()->GetPage()->GetSettings().SetTextAutosizingEnabled( - true); + web_view_helper.GetWebView()->EnableFakePageScaleAnimationForTesting(true); + web_view_helper.GetWebView() + ->GetPage() + ->GetSettings() + .SetTextAutosizingEnabled(true); WebRect div(200, 100, 200, 150); WebPoint double_tap_point(div.x + 50, div.y + 50); @@ -3587,82 +3636,86 @@ // maximumLegibleScaleFactor float legible_scale = maximum_legible_scale_factor; SetScaleAndScrollAndLayout( - web_view_helper.WebView(), WebPoint(0, 0), - (web_view_helper.WebView()->MinimumPageScaleFactor()) * + web_view_helper.GetWebView(), WebPoint(0, 0), + (web_view_helper.GetWebView()->MinimumPageScaleFactor()) * (1 + double_tap_zoom_already_legible_ratio) / 2); float double_tap_zoom_already_legible_scale = - web_view_helper.WebView()->MinimumPageScaleFactor() * + web_view_helper.GetWebView()->MinimumPageScaleFactor() * double_tap_zoom_already_legible_ratio; - web_view_helper.WebView()->SetDefaultPageScaleLimits(0.5f, 4); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); - SimulateDoubleTap(web_view_helper.WebView(), double_tap_point, scale); + web_view_helper.GetWebView()->SetDefaultPageScaleLimits(0.5f, 4); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); + SimulateDoubleTap(web_view_helper.GetWebView(), double_tap_point, scale); EXPECT_FLOAT_EQ(legible_scale, scale); - SimulateDoubleTap(web_view_helper.WebView(), double_tap_point, scale); - EXPECT_FLOAT_EQ(web_view_helper.WebView()->MinimumPageScaleFactor(), scale); - SimulateDoubleTap(web_view_helper.WebView(), double_tap_point, scale); + SimulateDoubleTap(web_view_helper.GetWebView(), double_tap_point, scale); + EXPECT_FLOAT_EQ(web_view_helper.GetWebView()->MinimumPageScaleFactor(), + scale); + SimulateDoubleTap(web_view_helper.GetWebView(), double_tap_point, scale); EXPECT_FLOAT_EQ(legible_scale, scale); // Zoom in to reset double_tap_zoom_in_effect flag. - web_view_helper.WebView()->ApplyViewportDeltas(WebFloatSize(), WebFloatSize(), - WebFloatSize(), 1.1f, 0); + web_view_helper.GetWebView()->ApplyViewportDeltas( + WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.1f, 0); // 1 < maximumLegibleScaleFactor < minimumPageScale < // doubleTapZoomAlreadyLegibleScale - web_view_helper.WebView()->SetDefaultPageScaleLimits(1.0f, 4); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); + web_view_helper.GetWebView()->SetDefaultPageScaleLimits(1.0f, 4); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); double_tap_zoom_already_legible_scale = - web_view_helper.WebView()->MinimumPageScaleFactor() * + web_view_helper.GetWebView()->MinimumPageScaleFactor() * double_tap_zoom_already_legible_ratio; SetScaleAndScrollAndLayout( - web_view_helper.WebView(), WebPoint(0, 0), - (web_view_helper.WebView()->MinimumPageScaleFactor()) * + web_view_helper.GetWebView(), WebPoint(0, 0), + (web_view_helper.GetWebView()->MinimumPageScaleFactor()) * (1 + double_tap_zoom_already_legible_ratio) / 2); - SimulateDoubleTap(web_view_helper.WebView(), double_tap_point, scale); + SimulateDoubleTap(web_view_helper.GetWebView(), double_tap_point, scale); EXPECT_FLOAT_EQ(double_tap_zoom_already_legible_scale, scale); - SimulateDoubleTap(web_view_helper.WebView(), double_tap_point, scale); - EXPECT_FLOAT_EQ(web_view_helper.WebView()->MinimumPageScaleFactor(), scale); - SimulateDoubleTap(web_view_helper.WebView(), double_tap_point, scale); + SimulateDoubleTap(web_view_helper.GetWebView(), double_tap_point, scale); + EXPECT_FLOAT_EQ(web_view_helper.GetWebView()->MinimumPageScaleFactor(), + scale); + SimulateDoubleTap(web_view_helper.GetWebView(), double_tap_point, scale); EXPECT_FLOAT_EQ(double_tap_zoom_already_legible_scale, scale); // Zoom in to reset double_tap_zoom_in_effect flag. - web_view_helper.WebView()->ApplyViewportDeltas(WebFloatSize(), WebFloatSize(), - WebFloatSize(), 1.1f, 0); + web_view_helper.GetWebView()->ApplyViewportDeltas( + WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.1f, 0); // minimumPageScale < 1 < maximumLegibleScaleFactor < // doubleTapZoomAlreadyLegibleScale - web_view_helper.WebView()->SetDefaultPageScaleLimits(0.95f, 4); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); + web_view_helper.GetWebView()->SetDefaultPageScaleLimits(0.95f, 4); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); double_tap_zoom_already_legible_scale = - web_view_helper.WebView()->MinimumPageScaleFactor() * + web_view_helper.GetWebView()->MinimumPageScaleFactor() * double_tap_zoom_already_legible_ratio; SetScaleAndScrollAndLayout( - web_view_helper.WebView(), WebPoint(0, 0), - (web_view_helper.WebView()->MinimumPageScaleFactor()) * + web_view_helper.GetWebView(), WebPoint(0, 0), + (web_view_helper.GetWebView()->MinimumPageScaleFactor()) * (1 + double_tap_zoom_already_legible_ratio) / 2); - SimulateDoubleTap(web_view_helper.WebView(), double_tap_point, scale); + SimulateDoubleTap(web_view_helper.GetWebView(), double_tap_point, scale); EXPECT_FLOAT_EQ(double_tap_zoom_already_legible_scale, scale); - SimulateDoubleTap(web_view_helper.WebView(), double_tap_point, scale); - EXPECT_FLOAT_EQ(web_view_helper.WebView()->MinimumPageScaleFactor(), scale); - SimulateDoubleTap(web_view_helper.WebView(), double_tap_point, scale); + SimulateDoubleTap(web_view_helper.GetWebView(), double_tap_point, scale); + EXPECT_FLOAT_EQ(web_view_helper.GetWebView()->MinimumPageScaleFactor(), + scale); + SimulateDoubleTap(web_view_helper.GetWebView(), double_tap_point, scale); EXPECT_FLOAT_EQ(double_tap_zoom_already_legible_scale, scale); // Zoom in to reset double_tap_zoom_in_effect flag. - web_view_helper.WebView()->ApplyViewportDeltas(WebFloatSize(), WebFloatSize(), - WebFloatSize(), 1.1f, 0); + web_view_helper.GetWebView()->ApplyViewportDeltas( + WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.1f, 0); // minimumPageScale < 1 < doubleTapZoomAlreadyLegibleScale < // maximumLegibleScaleFactor - web_view_helper.WebView()->SetDefaultPageScaleLimits(0.9f, 4); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); + web_view_helper.GetWebView()->SetDefaultPageScaleLimits(0.9f, 4); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); double_tap_zoom_already_legible_scale = - web_view_helper.WebView()->MinimumPageScaleFactor() * + web_view_helper.GetWebView()->MinimumPageScaleFactor() * double_tap_zoom_already_legible_ratio; SetScaleAndScrollAndLayout( - web_view_helper.WebView(), WebPoint(0, 0), - (web_view_helper.WebView()->MinimumPageScaleFactor()) * + web_view_helper.GetWebView(), WebPoint(0, 0), + (web_view_helper.GetWebView()->MinimumPageScaleFactor()) * (1 + double_tap_zoom_already_legible_ratio) / 2); - SimulateDoubleTap(web_view_helper.WebView(), double_tap_point, scale); + SimulateDoubleTap(web_view_helper.GetWebView(), double_tap_point, scale); EXPECT_FLOAT_EQ(legible_scale, scale); - SimulateDoubleTap(web_view_helper.WebView(), double_tap_point, scale); - EXPECT_FLOAT_EQ(web_view_helper.WebView()->MinimumPageScaleFactor(), scale); - SimulateDoubleTap(web_view_helper.WebView(), double_tap_point, scale); + SimulateDoubleTap(web_view_helper.GetWebView(), double_tap_point, scale); + EXPECT_FLOAT_EQ(web_view_helper.GetWebView()->MinimumPageScaleFactor(), + scale); + SimulateDoubleTap(web_view_helper.GetWebView(), double_tap_point, scale); EXPECT_FLOAT_EQ(legible_scale, scale); } @@ -3678,13 +3731,15 @@ base_url_ + "get_scale_bounds_check_for_auto_zoom_test.html", nullptr, nullptr, nullptr, ConfigureAndroid); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); - web_view_helper.WebView()->SetMaximumLegibleScale(1.f); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); + web_view_helper.GetWebView()->SetMaximumLegibleScale(1.f); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); - web_view_helper.WebView()->EnableFakePageScaleAnimationForTesting(true); - web_view_helper.WebView()->GetPage()->GetSettings().SetTextAutosizingEnabled( - true); - web_view_helper.WebView() + web_view_helper.GetWebView()->EnableFakePageScaleAnimationForTesting(true); + web_view_helper.GetWebView() + ->GetPage() + ->GetSettings() + .SetTextAutosizingEnabled(true); + web_view_helper.GetWebView() ->GetPage() ->GetSettings() .SetAccessibilityFontScaleFactor(accessibility_font_scale_factor); @@ -3698,82 +3753,86 @@ // accessibilityFontScaleFactor float legible_scale = accessibility_font_scale_factor; SetScaleAndScrollAndLayout( - web_view_helper.WebView(), WebPoint(0, 0), - (web_view_helper.WebView()->MinimumPageScaleFactor()) * + web_view_helper.GetWebView(), WebPoint(0, 0), + (web_view_helper.GetWebView()->MinimumPageScaleFactor()) * (1 + double_tap_zoom_already_legible_ratio) / 2); float double_tap_zoom_already_legible_scale = - web_view_helper.WebView()->MinimumPageScaleFactor() * + web_view_helper.GetWebView()->MinimumPageScaleFactor() * double_tap_zoom_already_legible_ratio; - web_view_helper.WebView()->SetDefaultPageScaleLimits(0.5f, 4); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); - SimulateDoubleTap(web_view_helper.WebView(), double_tap_point, scale); + web_view_helper.GetWebView()->SetDefaultPageScaleLimits(0.5f, 4); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); + SimulateDoubleTap(web_view_helper.GetWebView(), double_tap_point, scale); EXPECT_FLOAT_EQ(legible_scale, scale); - SimulateDoubleTap(web_view_helper.WebView(), double_tap_point, scale); - EXPECT_FLOAT_EQ(web_view_helper.WebView()->MinimumPageScaleFactor(), scale); - SimulateDoubleTap(web_view_helper.WebView(), double_tap_point, scale); + SimulateDoubleTap(web_view_helper.GetWebView(), double_tap_point, scale); + EXPECT_FLOAT_EQ(web_view_helper.GetWebView()->MinimumPageScaleFactor(), + scale); + SimulateDoubleTap(web_view_helper.GetWebView(), double_tap_point, scale); EXPECT_FLOAT_EQ(legible_scale, scale); // Zoom in to reset double_tap_zoom_in_effect flag. - web_view_helper.WebView()->ApplyViewportDeltas(WebFloatSize(), WebFloatSize(), - WebFloatSize(), 1.1f, 0); + web_view_helper.GetWebView()->ApplyViewportDeltas( + WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.1f, 0); // 1 < accessibilityFontScaleFactor < minimumPageScale < // doubleTapZoomAlreadyLegibleScale - web_view_helper.WebView()->SetDefaultPageScaleLimits(1.0f, 4); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); + web_view_helper.GetWebView()->SetDefaultPageScaleLimits(1.0f, 4); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); double_tap_zoom_already_legible_scale = - web_view_helper.WebView()->MinimumPageScaleFactor() * + web_view_helper.GetWebView()->MinimumPageScaleFactor() * double_tap_zoom_already_legible_ratio; SetScaleAndScrollAndLayout( - web_view_helper.WebView(), WebPoint(0, 0), - (web_view_helper.WebView()->MinimumPageScaleFactor()) * + web_view_helper.GetWebView(), WebPoint(0, 0), + (web_view_helper.GetWebView()->MinimumPageScaleFactor()) * (1 + double_tap_zoom_already_legible_ratio) / 2); - SimulateDoubleTap(web_view_helper.WebView(), double_tap_point, scale); + SimulateDoubleTap(web_view_helper.GetWebView(), double_tap_point, scale); EXPECT_FLOAT_EQ(double_tap_zoom_already_legible_scale, scale); - SimulateDoubleTap(web_view_helper.WebView(), double_tap_point, scale); - EXPECT_FLOAT_EQ(web_view_helper.WebView()->MinimumPageScaleFactor(), scale); - SimulateDoubleTap(web_view_helper.WebView(), double_tap_point, scale); + SimulateDoubleTap(web_view_helper.GetWebView(), double_tap_point, scale); + EXPECT_FLOAT_EQ(web_view_helper.GetWebView()->MinimumPageScaleFactor(), + scale); + SimulateDoubleTap(web_view_helper.GetWebView(), double_tap_point, scale); EXPECT_FLOAT_EQ(double_tap_zoom_already_legible_scale, scale); // Zoom in to reset double_tap_zoom_in_effect flag. - web_view_helper.WebView()->ApplyViewportDeltas(WebFloatSize(), WebFloatSize(), - WebFloatSize(), 1.1f, 0); + web_view_helper.GetWebView()->ApplyViewportDeltas( + WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.1f, 0); // minimumPageScale < 1 < accessibilityFontScaleFactor < // doubleTapZoomAlreadyLegibleScale - web_view_helper.WebView()->SetDefaultPageScaleLimits(0.95f, 4); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); + web_view_helper.GetWebView()->SetDefaultPageScaleLimits(0.95f, 4); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); double_tap_zoom_already_legible_scale = - web_view_helper.WebView()->MinimumPageScaleFactor() * + web_view_helper.GetWebView()->MinimumPageScaleFactor() * double_tap_zoom_already_legible_ratio; SetScaleAndScrollAndLayout( - web_view_helper.WebView(), WebPoint(0, 0), - (web_view_helper.WebView()->MinimumPageScaleFactor()) * + web_view_helper.GetWebView(), WebPoint(0, 0), + (web_view_helper.GetWebView()->MinimumPageScaleFactor()) * (1 + double_tap_zoom_already_legible_ratio) / 2); - SimulateDoubleTap(web_view_helper.WebView(), double_tap_point, scale); + SimulateDoubleTap(web_view_helper.GetWebView(), double_tap_point, scale); EXPECT_FLOAT_EQ(double_tap_zoom_already_legible_scale, scale); - SimulateDoubleTap(web_view_helper.WebView(), double_tap_point, scale); - EXPECT_FLOAT_EQ(web_view_helper.WebView()->MinimumPageScaleFactor(), scale); - SimulateDoubleTap(web_view_helper.WebView(), double_tap_point, scale); + SimulateDoubleTap(web_view_helper.GetWebView(), double_tap_point, scale); + EXPECT_FLOAT_EQ(web_view_helper.GetWebView()->MinimumPageScaleFactor(), + scale); + SimulateDoubleTap(web_view_helper.GetWebView(), double_tap_point, scale); EXPECT_FLOAT_EQ(double_tap_zoom_already_legible_scale, scale); // Zoom in to reset double_tap_zoom_in_effect flag. - web_view_helper.WebView()->ApplyViewportDeltas(WebFloatSize(), WebFloatSize(), - WebFloatSize(), 1.1f, 0); + web_view_helper.GetWebView()->ApplyViewportDeltas( + WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.1f, 0); // minimumPageScale < 1 < doubleTapZoomAlreadyLegibleScale < // accessibilityFontScaleFactor - web_view_helper.WebView()->SetDefaultPageScaleLimits(0.9f, 4); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); + web_view_helper.GetWebView()->SetDefaultPageScaleLimits(0.9f, 4); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); double_tap_zoom_already_legible_scale = - web_view_helper.WebView()->MinimumPageScaleFactor() * + web_view_helper.GetWebView()->MinimumPageScaleFactor() * double_tap_zoom_already_legible_ratio; SetScaleAndScrollAndLayout( - web_view_helper.WebView(), WebPoint(0, 0), - (web_view_helper.WebView()->MinimumPageScaleFactor()) * + web_view_helper.GetWebView(), WebPoint(0, 0), + (web_view_helper.GetWebView()->MinimumPageScaleFactor()) * (1 + double_tap_zoom_already_legible_ratio) / 2); - SimulateDoubleTap(web_view_helper.WebView(), double_tap_point, scale); + SimulateDoubleTap(web_view_helper.GetWebView(), double_tap_point, scale); EXPECT_FLOAT_EQ(legible_scale, scale); - SimulateDoubleTap(web_view_helper.WebView(), double_tap_point, scale); - EXPECT_FLOAT_EQ(web_view_helper.WebView()->MinimumPageScaleFactor(), scale); - SimulateDoubleTap(web_view_helper.WebView(), double_tap_point, scale); + SimulateDoubleTap(web_view_helper.GetWebView(), double_tap_point, scale); + EXPECT_FLOAT_EQ(web_view_helper.GetWebView()->MinimumPageScaleFactor(), + scale); + SimulateDoubleTap(web_view_helper.GetWebView(), double_tap_point, scale); EXPECT_FLOAT_EQ(legible_scale, scale); } @@ -3791,31 +3850,31 @@ IntRect block_bound; block_bound = IntRect( - web_view_helper.WebView()->ComputeBlockBound(WebPoint(9, 9), true)); + web_view_helper.GetWebView()->ComputeBlockBound(WebPoint(9, 9), true)); EXPECT_EQ(rect_back, block_bound); block_bound = IntRect( - web_view_helper.WebView()->ComputeBlockBound(WebPoint(10, 10), true)); + web_view_helper.GetWebView()->ComputeBlockBound(WebPoint(10, 10), true)); EXPECT_EQ(rect_left_top, block_bound); block_bound = IntRect( - web_view_helper.WebView()->ComputeBlockBound(WebPoint(50, 50), true)); + web_view_helper.GetWebView()->ComputeBlockBound(WebPoint(50, 50), true)); EXPECT_EQ(rect_left_top, block_bound); block_bound = IntRect( - web_view_helper.WebView()->ComputeBlockBound(WebPoint(89, 89), true)); + web_view_helper.GetWebView()->ComputeBlockBound(WebPoint(89, 89), true)); EXPECT_EQ(rect_left_top, block_bound); block_bound = IntRect( - web_view_helper.WebView()->ComputeBlockBound(WebPoint(90, 90), true)); + web_view_helper.GetWebView()->ComputeBlockBound(WebPoint(90, 90), true)); EXPECT_EQ(rect_back, block_bound); - block_bound = IntRect( - web_view_helper.WebView()->ComputeBlockBound(WebPoint(109, 109), true)); + block_bound = IntRect(web_view_helper.GetWebView()->ComputeBlockBound( + WebPoint(109, 109), true)); EXPECT_EQ(rect_back, block_bound); - block_bound = IntRect( - web_view_helper.WebView()->ComputeBlockBound(WebPoint(110, 110), true)); + block_bound = IntRect(web_view_helper.GetWebView()->ComputeBlockBound( + WebPoint(110, 110), true)); EXPECT_EQ(rect_right_bottom, block_bound); } @@ -3830,32 +3889,32 @@ web_view_helper.InitializeAndLoad( base_url_ + "get_multiple_divs_for_auto_zoom_test.html"); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); - web_view_helper.WebView()->SetDefaultPageScaleLimits(0.5f, 4); - web_view_helper.WebView()->SetDeviceScaleFactor(kDeviceScaleFactor); - web_view_helper.WebView()->SetPageScaleFactor(0.5f); - web_view_helper.WebView()->SetMaximumLegibleScale(1.f); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); + web_view_helper.GetWebView()->SetDefaultPageScaleLimits(0.5f, 4); + web_view_helper.GetWebView()->SetDeviceScaleFactor(kDeviceScaleFactor); + web_view_helper.GetWebView()->SetPageScaleFactor(0.5f); + web_view_helper.GetWebView()->SetMaximumLegibleScale(1.f); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); - web_view_helper.WebView()->EnableFakePageScaleAnimationForTesting(true); + web_view_helper.GetWebView()->EnableFakePageScaleAnimationForTesting(true); WebRect viewport_rect(0, 0, viewport_width, viewport_height); WebRect top_div(200, 100, 200, 150); WebRect bottom_div(200, 300, 200, 150); float scale; SetScaleAndScrollAndLayout( - web_view_helper.WebView(), WebPoint(0, 0), - (web_view_helper.WebView()->MinimumPageScaleFactor()) * + web_view_helper.GetWebView(), WebPoint(0, 0), + (web_view_helper.GetWebView()->MinimumPageScaleFactor()) * (1 + double_tap_zoom_already_legible_ratio) / 2); - SimulateMultiTargetZoom(web_view_helper.WebView(), top_div, scale); + SimulateMultiTargetZoom(web_view_helper.GetWebView(), top_div, scale); EXPECT_FLOAT_EQ(1, scale); - SimulateMultiTargetZoom(web_view_helper.WebView(), bottom_div, scale); + SimulateMultiTargetZoom(web_view_helper.GetWebView(), bottom_div, scale); EXPECT_FLOAT_EQ(1, scale); - SimulateMultiTargetZoom(web_view_helper.WebView(), viewport_rect, scale); + SimulateMultiTargetZoom(web_view_helper.GetWebView(), viewport_rect, scale); EXPECT_FLOAT_EQ(1, scale); - web_view_helper.WebView()->SetPageScaleFactor( - web_view_helper.WebView()->MinimumPageScaleFactor()); - SimulateMultiTargetZoom(web_view_helper.WebView(), top_div, scale); + web_view_helper.GetWebView()->SetPageScaleFactor( + web_view_helper.GetWebView()->MinimumPageScaleFactor()); + SimulateMultiTargetZoom(web_view_helper.GetWebView(), top_div, scale); EXPECT_FLOAT_EQ(1, scale); } @@ -3867,48 +3926,50 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.InitializeAndLoad(base_url_ + "textbox_in_touch_action.html"); - web_view_helper.WebView()->SetDefaultPageScaleLimits(0.25f, 4); - web_view_helper.WebView()->EnableFakePageScaleAnimationForTesting(true); - web_view_helper.WebView()->GetPage()->GetSettings().SetTextAutosizingEnabled( - false); - web_view_helper.WebView() + web_view_helper.GetWebView()->SetDefaultPageScaleLimits(0.25f, 4); + web_view_helper.GetWebView()->EnableFakePageScaleAnimationForTesting(true); + web_view_helper.GetWebView() + ->GetPage() + ->GetSettings() + .SetTextAutosizingEnabled(false); + web_view_helper.GetWebView() ->GetSettings() ->SetAutoZoomFocusedNodeToLegibleScale(true); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); - float initial_scale = web_view_helper.WebView()->PageScaleFactor(); + float initial_scale = web_view_helper.GetWebView()->PageScaleFactor(); // Focus the first textbox that's in a touch-action: pan-x ancestor, this // shouldn't cause an autozoom since pan-x disables pinch-zoom. - web_view_helper.WebView()->AdvanceFocus(false); - web_view_helper.WebView()->ScrollFocusedEditableElementIntoView(); + web_view_helper.GetWebView()->AdvanceFocus(false); + web_view_helper.GetWebView()->ScrollFocusedEditableElementIntoView(); EXPECT_EQ( - web_view_helper.WebView()->FakePageScaleAnimationPageScaleForTesting(), + web_view_helper.GetWebView()->FakePageScaleAnimationPageScaleForTesting(), 0); - SetScaleAndScrollAndLayout(web_view_helper.WebView(), WebPoint(0, 0), + SetScaleAndScrollAndLayout(web_view_helper.GetWebView(), WebPoint(0, 0), initial_scale); - ASSERT_EQ(initial_scale, web_view_helper.WebView()->PageScaleFactor()); + ASSERT_EQ(initial_scale, web_view_helper.GetWebView()->PageScaleFactor()); // Focus the second textbox that's in a touch-action: manipulation ancestor, // this should cause an autozoom since it allows pinch-zoom. - web_view_helper.WebView()->AdvanceFocus(false); - web_view_helper.WebView()->ScrollFocusedEditableElementIntoView(); + web_view_helper.GetWebView()->AdvanceFocus(false); + web_view_helper.GetWebView()->ScrollFocusedEditableElementIntoView(); EXPECT_GT( - web_view_helper.WebView()->FakePageScaleAnimationPageScaleForTesting(), + web_view_helper.GetWebView()->FakePageScaleAnimationPageScaleForTesting(), initial_scale); - SetScaleAndScrollAndLayout(web_view_helper.WebView(), WebPoint(0, 0), + SetScaleAndScrollAndLayout(web_view_helper.GetWebView(), WebPoint(0, 0), initial_scale); - ASSERT_EQ(initial_scale, web_view_helper.WebView()->PageScaleFactor()); + ASSERT_EQ(initial_scale, web_view_helper.GetWebView()->PageScaleFactor()); // Focus the third textbox that has a touch-action: pan-x ancestor, this // should cause an autozoom since it's seperated from the node with the // touch-action by an overflow:scroll element. - web_view_helper.WebView()->AdvanceFocus(false); - web_view_helper.WebView()->ScrollFocusedEditableElementIntoView(); + web_view_helper.GetWebView()->AdvanceFocus(false); + web_view_helper.GetWebView()->ScrollFocusedEditableElementIntoView(); EXPECT_GT( - web_view_helper.WebView()->FakePageScaleAnimationPageScaleForTesting(), + web_view_helper.GetWebView()->FakePageScaleAnimationPageScaleForTesting(), initial_scale); } @@ -3924,40 +3985,42 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.InitializeAndLoad( base_url_ + "get_scale_for_zoom_into_editable_test.html"); - web_view_helper.WebView()->GetPage()->GetSettings().SetTextAutosizingEnabled( - false); + web_view_helper.GetWebView() + ->GetPage() + ->GetSettings() + .SetTextAutosizingEnabled(false); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); - web_view_helper.WebView()->SetDefaultPageScaleLimits(0.25f, 4); + web_view_helper.GetWebView()->SetDefaultPageScaleLimits(0.25f, 4); - web_view_helper.WebView()->EnableFakePageScaleAnimationForTesting(true); + web_view_helper.GetWebView()->EnableFakePageScaleAnimationForTesting(true); WebRect edit_box_with_text(200, 200, 250, 20); WebRect edit_box_with_no_text(200, 250, 250, 20); // Test scrolling the focused node // The edit box is shorter and narrower than the viewport when legible. - web_view_helper.WebView()->AdvanceFocus(false); + web_view_helper.GetWebView()->AdvanceFocus(false); // Set the caret to the end of the input box. - web_view_helper.WebView() + web_view_helper.GetWebView() ->MainFrameImpl() ->GetDocument() .GetElementById("EditBoxWithText") .To<WebInputElement>() .SetSelectionRange(1000, 1000); - SetScaleAndScrollAndLayout(web_view_helper.WebView(), WebPoint(0, 0), 1); + SetScaleAndScrollAndLayout(web_view_helper.GetWebView(), WebPoint(0, 0), 1); WebRect rect, caret; - web_view_helper.WebView()->SelectionBounds(caret, rect); + web_view_helper.GetWebView()->SelectionBounds(caret, rect); // Set the page scale to be smaller than the minimal readable scale. float initial_scale = min_readable_caret_height / caret.height * 0.5f; - SetScaleAndScrollAndLayout(web_view_helper.WebView(), WebPoint(0, 0), + SetScaleAndScrollAndLayout(web_view_helper.GetWebView(), WebPoint(0, 0), initial_scale); float scale; IntPoint scroll; bool need_animation; - web_view_helper.WebView()->ComputeScaleAndScrollForFocusedNode( - web_view_helper.WebView()->FocusedElement(), kAutoZoomToLegibleScale, + web_view_helper.GetWebView()->ComputeScaleAndScrollForFocusedNode( + web_view_helper.GetWebView()->FocusedElement(), kAutoZoomToLegibleScale, scale, scroll, need_animation); EXPECT_TRUE(need_animation); // The edit box should be left aligned with a margin for possible label. @@ -3972,10 +4035,10 @@ viewport_width = 200; viewport_height = 150; web_view_helper.Resize(WebSize(viewport_width, viewport_height)); - SetScaleAndScrollAndLayout(web_view_helper.WebView(), WebPoint(0, 0), + SetScaleAndScrollAndLayout(web_view_helper.GetWebView(), WebPoint(0, 0), initial_scale); - web_view_helper.WebView()->ComputeScaleAndScrollForFocusedNode( - web_view_helper.WebView()->FocusedElement(), kAutoZoomToLegibleScale, + web_view_helper.GetWebView()->ComputeScaleAndScrollForFocusedNode( + web_view_helper.GetWebView()->FocusedElement(), kAutoZoomToLegibleScale, scale, scroll, need_animation); EXPECT_TRUE(need_animation); // The caret should be right aligned since the caret would be offscreen when @@ -3984,12 +4047,12 @@ EXPECT_NEAR(h_scroll, scroll.X(), 2); EXPECT_NEAR(min_readable_caret_height / caret.height, scale, 0.1); - SetScaleAndScrollAndLayout(web_view_helper.WebView(), WebPoint(0, 0), + SetScaleAndScrollAndLayout(web_view_helper.GetWebView(), WebPoint(0, 0), initial_scale); // Move focus to edit box with text. - web_view_helper.WebView()->AdvanceFocus(false); - web_view_helper.WebView()->ComputeScaleAndScrollForFocusedNode( - web_view_helper.WebView()->FocusedElement(), kAutoZoomToLegibleScale, + web_view_helper.GetWebView()->AdvanceFocus(false); + web_view_helper.GetWebView()->ComputeScaleAndScrollForFocusedNode( + web_view_helper.GetWebView()->FocusedElement(), kAutoZoomToLegibleScale, scale, scroll, need_animation); EXPECT_TRUE(need_animation); // The edit box should be left aligned. @@ -4001,15 +4064,15 @@ EXPECT_NEAR(min_readable_caret_height / caret.height, scale, 0.1); // Move focus back to the first edit box. - web_view_helper.WebView()->AdvanceFocus(true); + web_view_helper.GetWebView()->AdvanceFocus(true); // Zoom out slightly. const float within_tolerance_scale = scale * 0.9f; - SetScaleAndScrollAndLayout(web_view_helper.WebView(), scroll, + SetScaleAndScrollAndLayout(web_view_helper.GetWebView(), scroll, within_tolerance_scale); // Move focus back to the second edit box. - web_view_helper.WebView()->AdvanceFocus(false); - web_view_helper.WebView()->ComputeScaleAndScrollForFocusedNode( - web_view_helper.WebView()->FocusedElement(), kAutoZoomToLegibleScale, + web_view_helper.GetWebView()->AdvanceFocus(false); + web_view_helper.GetWebView()->ComputeScaleAndScrollForFocusedNode( + web_view_helper.GetWebView()->FocusedElement(), kAutoZoomToLegibleScale, scale, scroll, need_animation); // The scale should not be adjusted as the zoomed out scale was sufficiently // close to the previously focused scale. @@ -4026,35 +4089,37 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.InitializeAndLoad( base_url_ + "get_scale_for_zoom_into_editable_test.html"); - web_view_helper.WebView()->GetPage()->GetSettings().SetTextAutosizingEnabled( - false); + web_view_helper.GetWebView() + ->GetPage() + ->GetSettings() + .SetTextAutosizingEnabled(false); web_view_helper.Resize(WebSize(kViewportWidth, kViewportHeight)); - web_view_helper.WebView()->EnableFakePageScaleAnimationForTesting(true); + web_view_helper.GetWebView()->EnableFakePageScaleAnimationForTesting(true); const WebRect edit_box_with_text(200, 200, 250, 20); - web_view_helper.WebView()->AdvanceFocus(false); + web_view_helper.GetWebView()->AdvanceFocus(false); // Set the caret to the begining of the input box. - web_view_helper.WebView() + web_view_helper.GetWebView() ->MainFrameImpl() ->GetDocument() .GetElementById("EditBoxWithText") .To<WebInputElement>() .SetSelectionRange(0, 0); - SetScaleAndScrollAndLayout(web_view_helper.WebView(), WebPoint(0, 0), 1); + SetScaleAndScrollAndLayout(web_view_helper.GetWebView(), WebPoint(0, 0), 1); WebRect rect, caret; - web_view_helper.WebView()->SelectionBounds(caret, rect); + web_view_helper.GetWebView()->SelectionBounds(caret, rect); // Set the page scale to be twice as large as the minimal readable scale. float new_scale = kMinReadableCaretHeight / caret.height * 2.0; - SetScaleAndScrollAndLayout(web_view_helper.WebView(), WebPoint(0, 0), + SetScaleAndScrollAndLayout(web_view_helper.GetWebView(), WebPoint(0, 0), new_scale); float scale; IntPoint scroll; bool need_animation; - web_view_helper.WebView()->ComputeScaleAndScrollForFocusedNode( - web_view_helper.WebView()->FocusedElement(), kAutoZoomToLegibleScale, + web_view_helper.GetWebView()->ComputeScaleAndScrollForFocusedNode( + web_view_helper.GetWebView()->FocusedElement(), kAutoZoomToLegibleScale, scale, scroll, need_animation); EXPECT_TRUE(need_animation); // Edit box and caret should be left alinged @@ -4069,10 +4134,10 @@ // Set page scale and scroll such that edit box will be under the screen new_scale = 3.0; h_scroll = 200; - SetScaleAndScrollAndLayout(web_view_helper.WebView(), WebPoint(h_scroll, 0), - new_scale); - web_view_helper.WebView()->ComputeScaleAndScrollForFocusedNode( - web_view_helper.WebView()->FocusedElement(), kAutoZoomToLegibleScale, + SetScaleAndScrollAndLayout(web_view_helper.GetWebView(), + WebPoint(h_scroll, 0), new_scale); + web_view_helper.GetWebView()->ComputeScaleAndScrollForFocusedNode( + web_view_helper.GetWebView()->FocusedElement(), kAutoZoomToLegibleScale, scale, scroll, need_animation); EXPECT_TRUE(need_animation); // Horizontal scroll have to be the same @@ -4098,12 +4163,14 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.InitializeAndLoad( base_url_ + "get_scale_for_zoom_into_editable_test.html"); - web_view_helper.WebView()->GetPage()->GetSettings().SetTextAutosizingEnabled( - false); + web_view_helper.GetWebView() + ->GetPage() + ->GetSettings() + .SetTextAutosizingEnabled(false); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); - web_view_helper.WebView()->SetDefaultPageScaleLimits(0.25f, 4); + web_view_helper.GetWebView()->SetDefaultPageScaleLimits(0.25f, 4); - web_view_helper.WebView()->EnableFakePageScaleAnimationForTesting(true); + web_view_helper.GetWebView()->EnableFakePageScaleAnimationForTesting(true); WebRect edit_box_with_text(200, 200, 250, 20); WebRect edit_box_with_no_text(200, 250, 250, 20); @@ -4114,19 +4181,19 @@ // auto-zoom setting is off. // Focus the second empty textbox. - web_view_helper.WebView()->AdvanceFocus(false); - web_view_helper.WebView()->AdvanceFocus(false); + web_view_helper.GetWebView()->AdvanceFocus(false); + web_view_helper.GetWebView()->AdvanceFocus(false); // Set the page scale to be smaller than the minimal readable scale. float initial_scale = 0.25f; - SetScaleAndScrollAndLayout(web_view_helper.WebView(), WebPoint(0, 0), + SetScaleAndScrollAndLayout(web_view_helper.GetWebView(), WebPoint(0, 0), initial_scale); float scale; IntPoint scroll; bool need_animation; - web_view_helper.WebView()->ComputeScaleAndScrollForFocusedNode( - web_view_helper.WebView()->FocusedElement(), kAutoZoomToLegibleScale, + web_view_helper.GetWebView()->ComputeScaleAndScrollForFocusedNode( + web_view_helper.GetWebView()->FocusedElement(), kAutoZoomToLegibleScale, scale, scroll, need_animation); // There should be no change in page scale. @@ -4140,14 +4207,14 @@ (viewport_height / scale - edit_box_with_no_text.height) / 2; EXPECT_NEAR(v_scroll, scroll.Y(), 2); - SetScaleAndScrollAndLayout(web_view_helper.WebView(), scroll, scale); + SetScaleAndScrollAndLayout(web_view_helper.GetWebView(), scroll, scale); // Select the first textbox. - web_view_helper.WebView()->AdvanceFocus(true); + web_view_helper.GetWebView()->AdvanceFocus(true); WebRect rect, caret; - web_view_helper.WebView()->SelectionBounds(caret, rect); - web_view_helper.WebView()->ComputeScaleAndScrollForFocusedNode( - web_view_helper.WebView()->FocusedElement(), kAutoZoomToLegibleScale, + web_view_helper.GetWebView()->SelectionBounds(caret, rect); + web_view_helper.GetWebView()->ComputeScaleAndScrollForFocusedNode( + web_view_helper.GetWebView()->FocusedElement(), kAutoZoomToLegibleScale, scale, scroll, need_animation); // There should be no change at all since the textbox is fully visible @@ -4166,14 +4233,14 @@ // Move the visual viewport to the start of the target div containing the // text. - web_view_helper.WebView()->SetPageScaleFactor(2); - web_view_helper.WebView()->SetVisualViewportOffset(WebFloatPoint(100, 50)); + web_view_helper.GetWebView()->SetPageScaleFactor(2); + web_view_helper.GetWebView()->SetVisualViewportOffset(WebFloatPoint(100, 50)); WebRect base_rect; WebRect extent_rect; WebLocalFrame* main_frame = - web_view_helper.WebView()->MainFrame()->ToWebLocalFrame(); + web_view_helper.GetWebView()->MainFrame()->ToWebLocalFrame(); // Since we're zoomed in to 2X, each char of Ahem is 20px wide/tall in // viewport space. We expect to hit the fifth char on the first line. @@ -4197,8 +4264,8 @@ WebFloatPoint visual_offset(100, 130); float scale = 2; - web_view_helper.WebView()->SetPageScaleFactor(scale); - web_view_helper.WebView()->SetVisualViewportOffset(visual_offset); + web_view_helper.GetWebView()->SetPageScaleFactor(scale); + web_view_helper.GetWebView()->SetVisualViewportOffset(visual_offset); WebRect base_rect; WebRect extent_rect; @@ -4234,11 +4301,11 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.InitializeAndLoad(base_url_ + "form.html", &web_frame_client); - web_view_helper.WebView()->MainFrameImpl()->Reload( + web_view_helper.GetWebView()->MainFrameImpl()->Reload( WebFrameLoadType::kReloadBypassingCache); // start another reload before request is delivered. FrameTestHelpers::ReloadFrameBypassingCache( - web_view_helper.WebView()->MainFrameImpl()); + web_view_helper.GetWebView()->MainFrameImpl()); } class ClearScrollStateOnCommitWebFrameClient @@ -4273,34 +4340,34 @@ web_view_helper.Resize(WebSize(kPageWidth, kPageHeight)); web_view_helper.LocalMainFrame()->SetScrollOffset( WebSize(kPageWidth / 4, kPageHeight / 4)); - web_view_helper.WebView()->SetPageScaleFactor(kPageScaleFactor); + web_view_helper.GetWebView()->SetPageScaleFactor(kPageScaleFactor); // Reload the page and end up at the same url. State should not be propagated. - web_view_helper.WebView()->MainFrameImpl()->ReloadWithOverrideURL( + web_view_helper.GetWebView()->MainFrameImpl()->ReloadWithOverrideURL( ToKURL(base_url_ + first_url), WebFrameLoadType::kReload); FrameTestHelpers::PumpPendingRequestsForFrameToLoad( - web_view_helper.WebView()->MainFrame()); + web_view_helper.GetWebView()->MainFrame()); EXPECT_EQ(0, web_view_helper.LocalMainFrame()->GetScrollOffset().width); EXPECT_EQ(0, web_view_helper.LocalMainFrame()->GetScrollOffset().height); - EXPECT_EQ(1.0f, web_view_helper.WebView()->PageScaleFactor()); + EXPECT_EQ(1.0f, web_view_helper.GetWebView()->PageScaleFactor()); // Reload the page using the cache. State should not be propagated. - web_view_helper.WebView()->MainFrameImpl()->ReloadWithOverrideURL( + web_view_helper.GetWebView()->MainFrameImpl()->ReloadWithOverrideURL( ToKURL(base_url_ + second_url), WebFrameLoadType::kReload); FrameTestHelpers::PumpPendingRequestsForFrameToLoad( - web_view_helper.WebView()->MainFrame()); + web_view_helper.GetWebView()->MainFrame()); EXPECT_EQ(0, web_view_helper.LocalMainFrame()->GetScrollOffset().width); EXPECT_EQ(0, web_view_helper.LocalMainFrame()->GetScrollOffset().height); - EXPECT_EQ(1.0f, web_view_helper.WebView()->PageScaleFactor()); + EXPECT_EQ(1.0f, web_view_helper.GetWebView()->PageScaleFactor()); // Reload the page while bypassing the cache. State should not be propagated. - web_view_helper.WebView()->MainFrameImpl()->ReloadWithOverrideURL( + web_view_helper.GetWebView()->MainFrameImpl()->ReloadWithOverrideURL( ToKURL(base_url_ + third_url), WebFrameLoadType::kReloadBypassingCache); FrameTestHelpers::PumpPendingRequestsForFrameToLoad( - web_view_helper.WebView()->MainFrame()); + web_view_helper.GetWebView()->MainFrame()); EXPECT_EQ(0, web_view_helper.LocalMainFrame()->GetScrollOffset().width); EXPECT_EQ(0, web_view_helper.LocalMainFrame()->GetScrollOffset().height); - EXPECT_EQ(1.0f, web_view_helper.WebView()->PageScaleFactor()); + EXPECT_EQ(1.0f, web_view_helper.GetWebView()->PageScaleFactor()); } TEST_P(ParameterizedWebFrameTest, ReloadWhileProvisional) { @@ -4311,10 +4378,10 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.Initialize(); WebURLRequest request(ToKURL(base_url_ + "fixed_layout.html")); - web_view_helper.WebView()->MainFrameImpl()->LoadRequest(request); + web_view_helper.GetWebView()->MainFrameImpl()->LoadRequest(request); // start reload before first request is delivered. FrameTestHelpers::ReloadFrameBypassingCache( - web_view_helper.WebView()->MainFrameImpl()); + web_view_helper.GetWebView()->MainFrameImpl()); WebDocumentLoader* document_loader = web_view_helper.LocalMainFrame()->GetDocumentLoader(); @@ -4351,7 +4418,7 @@ // Pump pending requests one more time. The test page loads script that // navigates. FrameTestHelpers::PumpPendingRequestsForFrameToLoad( - web_view_helper.WebView()->MainFrame()); + web_view_helper.GetWebView()->MainFrame()); WebFrame* iframe = web_view_helper.LocalMainFrame()->FindFrameByName( WebString::FromUTF8("ifr")); @@ -4376,10 +4443,10 @@ "iframe_clear_focused_node_test.html"); // Clear the focused node. - web_view_helper.WebView()->ClearFocusedElement(); + web_view_helper.GetWebView()->ClearFocusedElement(); // Now retrieve the FocusedNode and test it should be null. - EXPECT_EQ(nullptr, web_view_helper.WebView()->FocusedElement()); + EXPECT_EQ(nullptr, web_view_helper.GetWebView()->FocusedElement()); } class ChangedSelectionCounter : public FrameTestHelpers::TestWebFrameClient { @@ -4574,7 +4641,7 @@ // Refresh, we should get two release notifications and two more create // notifications. - FrameTestHelpers::ReloadFrame(web_view_helper.WebView()->MainFrameImpl()); + FrameTestHelpers::ReloadFrame(web_view_helper.GetWebView()->MainFrameImpl()); ASSERT_EQ(4u, create_notifications.size()); ASSERT_EQ(2u, release_notifications.size()); @@ -4633,7 +4700,7 @@ ASSERT_EQ(1u, create_notifications.size()); auto& notification = create_notifications[0]; ASSERT_EQ(isolated_world_id, notification->world_id); - ASSERT_EQ(web_view_helper.WebView()->MainFrame(), notification->frame); + ASSERT_EQ(web_view_helper.GetWebView()->MainFrame(), notification->frame); // We don't have an API to enumarate isolated worlds for a frame, but we can // at least assert that the context we got is *not* the main world's context. @@ -4739,12 +4806,12 @@ // Make sure it comes out OK. const std::string expected("Foo bar\nbaz"); WebString text = WebFrameContentDumper::DumpWebViewAsText( - web_view_helper.WebView(), std::numeric_limits<size_t>::max()); + web_view_helper.GetWebView(), std::numeric_limits<size_t>::max()); EXPECT_EQ(expected, text.Utf8()); // Try reading the same one with clipping of the text. const int kLength = 5; - text = WebFrameContentDumper::DumpWebViewAsText(web_view_helper.WebView(), + text = WebFrameContentDumper::DumpWebViewAsText(web_view_helper.GetWebView(), kLength); EXPECT_EQ(expected.substr(0, kLength), text.Utf8()); @@ -4758,13 +4825,13 @@ FrameTestHelpers::LoadHTMLString(subframe, "sub<p>text", test_url); text = WebFrameContentDumper::DumpWebViewAsText( - web_view_helper.WebView(), std::numeric_limits<size_t>::max()); + web_view_helper.GetWebView(), std::numeric_limits<size_t>::max()); EXPECT_EQ("Hello world\n\nsub\n\ntext", text.Utf8()); // Get the frame text where the subframe separator falls on the boundary of // what we'll take. There used to be a crash in this case. - text = - WebFrameContentDumper::DumpWebViewAsText(web_view_helper.WebView(), 12); + text = WebFrameContentDumper::DumpWebViewAsText(web_view_helper.GetWebView(), + 12); EXPECT_EQ("Hello world", text.Utf8()); } @@ -4779,7 +4846,7 @@ FrameTestHelpers::LoadHTMLString(frame, kSimpleSource, test_url); WebString text = WebFrameContentDumper::DumpWebViewAsText( - web_view_helper.WebView(), std::numeric_limits<size_t>::max()); + web_view_helper.GetWebView(), std::numeric_limits<size_t>::max()); EXPECT_EQ("Hello\n\nWorld", text.Utf8()); const std::string html = WebFrameContentDumper::DumpAsMarkup(frame).Utf8(); @@ -4790,7 +4857,7 @@ EXPECT_EQ(html, WebFrameContentDumper::DumpAsMarkup(frame).Utf8()); text = WebFrameContentDumper::DumpWebViewAsText( - web_view_helper.WebView(), std::numeric_limits<size_t>::max()); + web_view_helper.GetWebView(), std::numeric_limits<size_t>::max()); EXPECT_EQ("Hello\n\nWorld", text.Utf8()); // Test selection check @@ -4824,7 +4891,7 @@ web_view_helper.InitializeAndLoad(base_url_ + "hello_world.html", &web_frame_client); - FrameTestHelpers::ReloadFrame(web_view_helper.WebView()->MainFrameImpl()); + FrameTestHelpers::ReloadFrame(web_view_helper.GetWebView()->MainFrameImpl()); } class FindUpdateWebFrameClient : public FrameTestHelpers::TestWebFrameClient { @@ -4864,8 +4931,8 @@ web_view_helper.InitializeAndLoad(base_url_ + "find_in_page_frame.html", &client); web_view_helper.Resize(WebSize(640, 480)); - web_view_helper.WebView()->SetMaximumLegibleScale(1.f); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); + web_view_helper.GetWebView()->SetMaximumLegibleScale(1.f); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); RunPendingTasks(); // Note that the 'result 19' in the <select> element is not expected to @@ -4934,7 +5001,7 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.InitializeAndLoad(base_url_ + "find_match_count.html", &client); - web_view_helper.WebView()->Resize(WebSize(640, 480)); + web_view_helper.GetWebView()->Resize(WebSize(640, 480)); RunPendingTasks(); const char* kFindString = "a"; @@ -5277,7 +5344,7 @@ FrameTestHelpers::LoadHTMLString(frame, html, URLTestHelpers::ToKURL(base_url_)); web_view_helper.Resize(WebSize(640, 480)); - web_view_helper.WebView()->SetFocus(true); + web_view_helper.GetWebView()->SetFocus(true); RunPendingTasks(); const int kFindIdentifier = 12345; @@ -5380,7 +5447,7 @@ &web_view_helper); frame = web_view_helper.LocalMainFrame(); EXPECT_EQ("Some test text for testing.", SelectionAsString(frame)); - web_view_helper.WebView()->SelectionBounds(start_web_rect, end_web_rect); + web_view_helper.GetWebView()->SelectionBounds(start_web_rect, end_web_rect); frame->ExecuteCommand(WebString::FromUTF8("Unselect")); EXPECT_EQ("", SelectionAsString(frame)); frame->SelectRange(TopLeft(start_web_rect), @@ -5395,7 +5462,7 @@ &web_view_helper); frame = web_view_helper.LocalMainFrame(); EXPECT_EQ("Some offscreen test text for testing.", SelectionAsString(frame)); - web_view_helper.WebView()->SelectionBounds(start_web_rect, end_web_rect); + web_view_helper.GetWebView()->SelectionBounds(start_web_rect, end_web_rect); frame->ExecuteCommand(WebString::FromUTF8("Unselect")); EXPECT_EQ("", SelectionAsString(frame)); frame->SelectRange(TopLeft(start_web_rect), @@ -5489,10 +5556,10 @@ FrameTestHelpers::WebViewHelper web_view_helper; InitializeTextSelectionWebView(base_url_ + "select_range_iframe.html", &web_view_helper); - frame = web_view_helper.WebView()->MainFrame(); + frame = web_view_helper.GetWebView()->MainFrame(); WebLocalFrame* subframe = frame->FirstChild()->ToWebLocalFrame(); EXPECT_EQ("Some test text for testing.", SelectionAsString(subframe)); - web_view_helper.WebView()->SelectionBounds(start_web_rect, end_web_rect); + web_view_helper.GetWebView()->SelectionBounds(start_web_rect, end_web_rect); subframe->ExecuteCommand(WebString::FromUTF8("Unselect")); EXPECT_EQ("", SelectionAsString(subframe)); subframe->SelectRange(TopLeft(start_web_rect), @@ -5519,7 +5586,7 @@ &web_view_helper); frame = web_view_helper.LocalMainFrame(); EXPECT_EQ("This text is initially selected.", SelectionAsString(frame)); - web_view_helper.WebView()->SelectionBounds(start_web_rect, end_web_rect); + web_view_helper.GetWebView()->SelectionBounds(start_web_rect, end_web_rect); frame->SelectRange(BottomRightMinusOne(end_web_rect), WebPoint(0, 0)); EXPECT_EQ("16-char header. This text is initially selected.", @@ -5530,13 +5597,13 @@ &web_view_helper); frame = web_view_helper.LocalMainFrame(); - web_view_helper.WebView()->SelectionBounds(start_web_rect, end_web_rect); + web_view_helper.GetWebView()->SelectionBounds(start_web_rect, end_web_rect); frame->SelectRange(TopLeft(start_web_rect), BottomRightMinusOne(end_web_rect)); EXPECT_EQ("This text is initially selected.", SelectionAsString(frame)); - web_view_helper.WebView()->SelectionBounds(start_web_rect, end_web_rect); + web_view_helper.GetWebView()->SelectionBounds(start_web_rect, end_web_rect); - web_view_helper.WebView()->SelectionBounds(start_web_rect, end_web_rect); + web_view_helper.GetWebView()->SelectionBounds(start_web_rect, end_web_rect); frame->SelectRange(TopLeft(start_web_rect), WebPoint(640, 480)); EXPECT_EQ("This text is initially selected. 16-char footer.", SelectionAsString(frame)); @@ -5560,7 +5627,7 @@ &web_view_helper); frame = web_view_helper.LocalMainFrame(); EXPECT_EQ("This text is initially selected.", SelectionAsString(frame)); - web_view_helper.WebView()->SelectionBounds(start_web_rect, end_web_rect); + web_view_helper.GetWebView()->SelectionBounds(start_web_rect, end_web_rect); frame->SelectRange(BottomRightMinusOne(end_web_rect), WebPoint(0, 0)); EXPECT_EQ("16-char header. This text is initially selected.", @@ -5571,14 +5638,14 @@ &web_view_helper); frame = web_view_helper.LocalMainFrame(); - web_view_helper.WebView()->SelectionBounds(start_web_rect, end_web_rect); + web_view_helper.GetWebView()->SelectionBounds(start_web_rect, end_web_rect); frame->SelectRange(TopLeft(start_web_rect), BottomRightMinusOne(end_web_rect)); EXPECT_EQ("This text is initially selected.", SelectionAsString(frame)); - web_view_helper.WebView()->SelectionBounds(start_web_rect, end_web_rect); + web_view_helper.GetWebView()->SelectionBounds(start_web_rect, end_web_rect); EXPECT_EQ("This text is initially selected.", SelectionAsString(frame)); - web_view_helper.WebView()->SelectionBounds(start_web_rect, end_web_rect); + web_view_helper.GetWebView()->SelectionBounds(start_web_rect, end_web_rect); frame->SelectRange(TopLeft(start_web_rect), WebPoint(640, 480)); EXPECT_EQ("This text is initially selected. 16-char footer.", SelectionAsString(frame)); @@ -5708,7 +5775,7 @@ &web_view_helper); frame = web_view_helper.LocalMainFrame(); EXPECT_EQ("This text is initially selected.", SelectionAsString(frame)); - web_view_helper.WebView()->SelectionBounds(start_web_rect, end_web_rect); + web_view_helper.GetWebView()->SelectionBounds(start_web_rect, end_web_rect); frame->MoveRangeSelectionExtent(WebPoint(640, 480)); EXPECT_EQ("This text is initially selected. 16-char footer.", @@ -5745,7 +5812,7 @@ &web_view_helper); frame = web_view_helper.LocalMainFrame(); EXPECT_EQ("This text is initially selected.", SelectionAsString(frame)); - web_view_helper.WebView()->SelectionBounds(start_web_rect, end_web_rect); + web_view_helper.GetWebView()->SelectionBounds(start_web_rect, end_web_rect); frame->MoveRangeSelectionExtent(BottomRightMinusOne(start_web_rect)); EXPECT_EQ("This text is initially selected.", SelectionAsString(frame)); @@ -5772,7 +5839,7 @@ &web_view_helper); frame = web_view_helper.LocalMainFrame(); EXPECT_EQ("Length", SelectionAsString(frame)); - web_view_helper.WebView()->SelectionBounds(start_web_rect, end_web_rect); + web_view_helper.GetWebView()->SelectionBounds(start_web_rect, end_web_rect); EXPECT_EQ(0, frame->GetFrame() ->Selection() @@ -5841,19 +5908,19 @@ WebRect end_rect; frame->ExecuteScript(WebScriptSource("selectRange();")); - web_view_helper.WebView()->SelectionBounds(initial_start_rect, - initial_end_rect); + web_view_helper.GetWebView()->SelectionBounds(initial_start_rect, + initial_end_rect); WebPoint moved_start(TopLeft(initial_start_rect)); moved_start.y += 40; frame->SelectRange(moved_start, BottomRightMinusOne(initial_end_rect)); - web_view_helper.WebView()->SelectionBounds(start_rect, end_rect); + web_view_helper.GetWebView()->SelectionBounds(start_rect, end_rect); EXPECT_EQ(start_rect, initial_start_rect); EXPECT_EQ(end_rect, initial_end_rect); moved_start.y -= 80; frame->SelectRange(moved_start, BottomRightMinusOne(initial_end_rect)); - web_view_helper.WebView()->SelectionBounds(start_rect, end_rect); + web_view_helper.GetWebView()->SelectionBounds(start_rect, end_rect); EXPECT_EQ(start_rect, initial_start_rect); EXPECT_EQ(end_rect, initial_end_rect); @@ -5861,13 +5928,13 @@ moved_end.y += 40; frame->SelectRange(TopLeft(initial_start_rect), moved_end); - web_view_helper.WebView()->SelectionBounds(start_rect, end_rect); + web_view_helper.GetWebView()->SelectionBounds(start_rect, end_rect); EXPECT_EQ(start_rect, initial_start_rect); EXPECT_EQ(end_rect, initial_end_rect); moved_end.y -= 80; frame->SelectRange(TopLeft(initial_start_rect), moved_end); - web_view_helper.WebView()->SelectionBounds(start_rect, end_rect); + web_view_helper.GetWebView()->SelectionBounds(start_rect, end_rect); EXPECT_EQ(start_rect, initial_start_rect); EXPECT_EQ(end_rect, initial_end_rect); } @@ -5879,7 +5946,7 @@ FrameTestHelpers::WebViewHelper web_view_helper; InitializeTextSelectionWebView(base_url_ + "move_caret.html", &web_view_helper); - frame = (WebLocalFrameImpl*)web_view_helper.WebView()->MainFrame(); + frame = (WebLocalFrameImpl*)web_view_helper.GetWebView()->MainFrame(); WebRect initial_start_rect; WebRect initial_end_rect; @@ -5887,19 +5954,19 @@ WebRect end_rect; frame->ExecuteScript(WebScriptSource("selectCaret();")); - web_view_helper.WebView()->SelectionBounds(initial_start_rect, - initial_end_rect); + web_view_helper.GetWebView()->SelectionBounds(initial_start_rect, + initial_end_rect); WebPoint move_to(TopLeft(initial_start_rect)); move_to.y += 40; frame->MoveCaretSelection(move_to); - web_view_helper.WebView()->SelectionBounds(start_rect, end_rect); + web_view_helper.GetWebView()->SelectionBounds(start_rect, end_rect); EXPECT_EQ(start_rect, initial_start_rect); EXPECT_EQ(end_rect, initial_end_rect); move_to.y -= 80; frame->MoveCaretSelection(move_to); - web_view_helper.WebView()->SelectionBounds(start_rect, end_rect); + web_view_helper.GetWebView()->SelectionBounds(start_rect, end_rect); EXPECT_EQ(start_rect, initial_start_rect); EXPECT_EQ(end_rect, initial_end_rect); } @@ -5965,17 +6032,17 @@ RegisterMockedHttpURLLoad("Ahem.ttf"); web_view_helper_.Initialize(nullptr, &fake_selection_web_view_client_); - web_view_helper_.WebView()->GetSettings()->SetDefaultFontSize(12); - web_view_helper_.WebView()->SetDefaultPageScaleLimits(1, 1); + web_view_helper_.GetWebView()->GetSettings()->SetDefaultFontSize(12); + web_view_helper_.GetWebView()->SetDefaultPageScaleLimits(1, 1); web_view_helper_.Resize(WebSize(640, 480)); } void RunTestWithNoSelection(const char* test_file) { RegisterMockedHttpURLLoad(test_file); - web_view_helper_.WebView()->SetFocus(true); - FrameTestHelpers::LoadFrame(web_view_helper_.WebView()->MainFrameImpl(), + web_view_helper_.GetWebView()->SetFocus(true); + FrameTestHelpers::LoadFrame(web_view_helper_.GetWebView()->MainFrameImpl(), base_url_ + test_file); - web_view_helper_.WebView()->UpdateAllLifecyclePhases(); + web_view_helper_.GetWebView()->UpdateAllLifecyclePhases(); const WebSelection* selection = fake_selection_layer_tree_view_.Selection(); const WebSelectionBound* select_start = @@ -5989,14 +6056,14 @@ void RunTest(const char* test_file) { RegisterMockedHttpURLLoad(test_file); - web_view_helper_.WebView()->SetFocus(true); - FrameTestHelpers::LoadFrame(web_view_helper_.WebView()->MainFrameImpl(), + web_view_helper_.GetWebView()->SetFocus(true); + FrameTestHelpers::LoadFrame(web_view_helper_.GetWebView()->MainFrameImpl(), base_url_ + test_file); - web_view_helper_.WebView()->UpdateAllLifecyclePhases(); + web_view_helper_.GetWebView()->UpdateAllLifecyclePhases(); v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); v8::Local<v8::Value> result = - web_view_helper_.WebView() + web_view_helper_.GetWebView() ->MainFrameImpl() ->ExecuteScriptAndReturnValue(WebScriptSource("expectedResult")); ASSERT_FALSE(result.IsEmpty() || (*result)->IsUndefined()); @@ -6072,7 +6139,7 @@ gesture_event.y = gesture_event.global_y = hit_point.Y(); gesture_event.source_device = kWebGestureDeviceTouchscreen; - web_view_helper_.WebView() + web_view_helper_.GetWebView() ->MainFrameImpl() ->GetFrame() ->GetEventHandler() @@ -6266,16 +6333,17 @@ web_view_helper.Resize(WebSize(1000, 1000)); client.ResetTriggered(); - web_view_helper.WebView()->HandleInputEvent(FatTap(0, 0, kTapDiameter)); + web_view_helper.GetWebView()->HandleInputEvent(FatTap(0, 0, kTapDiameter)); EXPECT_FALSE(client.Triggered()); client.ResetTriggered(); - web_view_helper.WebView()->HandleInputEvent(FatTap(200, 115, kTapDiameter)); + web_view_helper.GetWebView()->HandleInputEvent( + FatTap(200, 115, kTapDiameter)); EXPECT_FALSE(client.Triggered()); for (int i = 0; i <= 46; i++) { client.ResetTriggered(); - web_view_helper.WebView()->HandleInputEvent( + web_view_helper.GetWebView()->HandleInputEvent( FatTap(120, 230 + i * 5, kTapDiameter)); int j = i % 10; @@ -6287,7 +6355,7 @@ for (int i = 0; i <= 46; i++) { client.ResetTriggered(); - web_view_helper.WebView()->HandleInputEvent( + web_view_helper.GetWebView()->HandleInputEvent( FatTap(10 + i * 5, 590, kTapDiameter)); int j = i % 10; @@ -6299,13 +6367,13 @@ // The same taps shouldn't trigger didTapMultipleTargets() after disabling the // notification for multi-target-tap. - web_view_helper.WebView() + web_view_helper.GetWebView() ->GetSettings() ->SetMultiTargetTapNotificationEnabled(false); for (int i = 0; i <= 46; i++) { client.ResetTriggered(); - web_view_helper.WebView()->HandleInputEvent( + web_view_helper.GetWebView()->HandleInputEvent( FatTap(10 + i * 5, 590, kTapDiameter)); EXPECT_FALSE(client.Triggered()); } @@ -6325,7 +6393,7 @@ web_view_helper.Resize(WebSize(1000, 1000)); client.ResetTriggered(); - web_view_helper.WebView()->HandleInputEvent(FatTap(50, 50, kTapDiameter)); + web_view_helper.GetWebView()->HandleInputEvent(FatTap(50, 50, kTapDiameter)); EXPECT_FALSE(client.Triggered()); } @@ -6344,23 +6412,24 @@ web_view_helper.Resize(WebSize(1000, 1000)); client.ResetTriggered(); - web_view_helper.WebView()->HandleInputEvent(FatTap(0, 0, kTapDiameter)); + web_view_helper.GetWebView()->HandleInputEvent(FatTap(0, 0, kTapDiameter)); EXPECT_FALSE(client.Triggered()); client.ResetTriggered(); - web_view_helper.WebView()->HandleInputEvent(FatTap(200, 115, kTapDiameter)); + web_view_helper.GetWebView()->HandleInputEvent( + FatTap(200, 115, kTapDiameter)); EXPECT_FALSE(client.Triggered()); for (int i = 0; i <= 46; i++) { client.ResetTriggered(); - web_view_helper.WebView()->HandleInputEvent( + web_view_helper.GetWebView()->HandleInputEvent( FatTap(120, 230 + i * 5, kTapDiameter)); EXPECT_FALSE(client.Triggered()); } for (int i = 0; i <= 46; i++) { client.ResetTriggered(); - web_view_helper.WebView()->HandleInputEvent( + web_view_helper.GetWebView()->HandleInputEvent( FatTap(10 + i * 5, 590, kTapDiameter)); EXPECT_FALSE(client.Triggered()); } @@ -6381,23 +6450,24 @@ web_view_helper.Resize(WebSize(1000, 1000)); client.ResetTriggered(); - web_view_helper.WebView()->HandleInputEvent(FatTap(0, 0, kTapDiameter)); + web_view_helper.GetWebView()->HandleInputEvent(FatTap(0, 0, kTapDiameter)); EXPECT_FALSE(client.Triggered()); client.ResetTriggered(); - web_view_helper.WebView()->HandleInputEvent(FatTap(200, 115, kTapDiameter)); + web_view_helper.GetWebView()->HandleInputEvent( + FatTap(200, 115, kTapDiameter)); EXPECT_FALSE(client.Triggered()); for (int i = 0; i <= 46; i++) { client.ResetTriggered(); - web_view_helper.WebView()->HandleInputEvent( + web_view_helper.GetWebView()->HandleInputEvent( FatTap(120, 230 + i * 5, kTapDiameter)); EXPECT_FALSE(client.Triggered()); } for (int i = 0; i <= 46; i++) { client.ResetTriggered(); - web_view_helper.WebView()->HandleInputEvent( + web_view_helper.GetWebView()->HandleInputEvent( FatTap(10 + i * 5, 590, kTapDiameter)); EXPECT_FALSE(client.Triggered()); } @@ -6414,7 +6484,7 @@ web_view_helper.InitializeAndLoad(base_url_ + html_file, nullptr, &client, nullptr, ConfigureAndroid); - WebViewImpl* web_view_impl = web_view_helper.WebView(); + WebViewImpl* web_view_impl = web_view_helper.GetWebView(); ASSERT_TRUE(web_view_impl); LocalFrame* frame = web_view_impl->MainFrameImpl()->GetFrame(); ASSERT_TRUE(frame); @@ -6435,7 +6505,7 @@ // Tap at the top: there is nothing there. client.ResetTriggered(); - web_view_helper.WebView()->HandleInputEvent(FatTap(10, 60, kTapDiameter)); + web_view_helper.GetWebView()->HandleInputEvent(FatTap(10, 60, kTapDiameter)); EXPECT_FALSE(client.Triggered()); // Scroll visual viewport to the bottom of the main frame. @@ -6444,16 +6514,16 @@ // Now the tap with the same coordinates should hit two elements. client.ResetTriggered(); - web_view_helper.WebView()->HandleInputEvent(FatTap(10, 60, kTapDiameter)); + web_view_helper.GetWebView()->HandleInputEvent(FatTap(10, 60, kTapDiameter)); EXPECT_TRUE(client.Triggered()); // The same tap shouldn't trigger didTapMultipleTargets() after disabling the // notification for multi-target-tap. - web_view_helper.WebView() + web_view_helper.GetWebView() ->GetSettings() ->SetMultiTargetTapNotificationEnabled(false); client.ResetTriggered(); - web_view_helper.WebView()->HandleInputEvent(FatTap(10, 60, kTapDiameter)); + web_view_helper.GetWebView()->HandleInputEvent(FatTap(10, 60, kTapDiameter)); EXPECT_FALSE(client.Triggered()); } @@ -6475,21 +6545,21 @@ // Click somewhere where the popup shouldn't appear. client.ResetTriggered(); - web_view_helper.WebView()->HandleInputEvent( + web_view_helper.GetWebView()->HandleInputEvent( FatTap(kViewportWidth / 2, 0, kTapDiameter)); EXPECT_FALSE(client.Triggered()); // Click directly in between two container divs with click handlers, with // children that don't handle clicks. client.ResetTriggered(); - web_view_helper.WebView()->HandleInputEvent( + web_view_helper.GetWebView()->HandleInputEvent( FatTap(kViewportWidth / 2, kDivHeight, kTapDiameter)); EXPECT_TRUE(client.Triggered()); // The third div container should be blacklisted if you click on the link it // contains. client.ResetTriggered(); - web_view_helper.WebView()->HandleInputEvent( + web_view_helper.GetWebView()->HandleInputEvent( FatTap(kViewportWidth / 2, kDivHeight * 3.25, kTapDiameter)); EXPECT_FALSE(client.Triggered()); } @@ -6508,22 +6578,25 @@ web_view_helper.Resize(WebSize(1000, 1000)); client.ResetTriggered(); - web_view_helper.WebView()->HandleInputEvent(FatTap(80, 80, kTapDiameter)); + web_view_helper.GetWebView()->HandleInputEvent(FatTap(80, 80, kTapDiameter)); EXPECT_TRUE(client.Triggered()); client.ResetTriggered(); - web_view_helper.WebView()->HandleInputEvent(FatTap(230, 190, kTapDiameter)); + web_view_helper.GetWebView()->HandleInputEvent( + FatTap(230, 190, kTapDiameter)); EXPECT_TRUE(client.Triggered()); - web_view_helper.WebView()->SetPageScaleFactor(3.0f); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); + web_view_helper.GetWebView()->SetPageScaleFactor(3.0f); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); client.ResetTriggered(); - web_view_helper.WebView()->HandleInputEvent(FatTap(240, 240, kTapDiameter)); + web_view_helper.GetWebView()->HandleInputEvent( + FatTap(240, 240, kTapDiameter)); EXPECT_TRUE(client.Triggered()); client.ResetTriggered(); - web_view_helper.WebView()->HandleInputEvent(FatTap(690, 570, kTapDiameter)); + web_view_helper.GetWebView()->HandleInputEvent( + FatTap(690, 570, kTapDiameter)); EXPECT_FALSE(client.Triggered()); } @@ -6559,7 +6632,7 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.InitializeAndLoad("about:blank", &web_frame_client); - WebLocalFrame* frame = web_view_helper.WebView()->MainFrameImpl(); + WebLocalFrame* frame = web_view_helper.GetWebView()->MainFrameImpl(); // Load a url as a history navigation that will return an error. // TestSubstituteDataWebFrameClient will start a SubstituteData load in @@ -6583,7 +6656,7 @@ kWebHistoryDifferentDocumentLoad, mojom::FetchCacheMode::kDefault); WebString text = WebFrameContentDumper::DumpWebViewAsText( - web_view_helper.WebView(), std::numeric_limits<size_t>::max()); + web_view_helper.GetWebView(), std::numeric_limits<size_t>::max()); EXPECT_EQ("This should appear", text.Utf8()); EXPECT_TRUE(web_frame_client.CommitCalled()); } @@ -6636,7 +6709,7 @@ MoveCaretSelectionTowardsWindowPointWithNoSelection) { FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.InitializeAndLoad("about:blank"); - WebFrame* frame = web_view_helper.WebView()->MainFrame(); + WebFrame* frame = web_view_helper.GetWebView()->MainFrame(); // This test passes if this doesn't crash. frame->ToWebLocalFrame()->MoveCaretSelection(WebPoint(0, 0)); @@ -6678,7 +6751,7 @@ Document* document = frame->GetFrame()->GetDocument(); Element* element = document->getElementById("data"); - web_view_helper.WebView()->GetSettings()->SetEditingBehavior( + web_view_helper.GetWebView()->GetSettings()->SetEditingBehavior( WebSettings::kEditingBehaviorWin); element->focus(); @@ -6706,10 +6779,10 @@ DocumentMarker::kSpelling)); frame->ReplaceMisspelledRange("welcome"); - EXPECT_EQ("_welcome_.", - WebFrameContentDumper::DumpWebViewAsText( - web_view_helper.WebView(), std::numeric_limits<size_t>::max()) - .Utf8()); + EXPECT_EQ("_welcome_.", WebFrameContentDumper::DumpWebViewAsText( + web_view_helper.GetWebView(), + std::numeric_limits<size_t>::max()) + .Utf8()); } TEST_P(ParameterizedWebFrameTest, RemoveSpellingMarkers) { @@ -6724,7 +6797,7 @@ Document* document = frame->GetFrame()->GetDocument(); Element* element = document->getElementById("data"); - web_view_helper.WebView()->GetSettings()->SetEditingBehavior( + web_view_helper.GetWebView()->GetSettings()->SetEditingBehavior( WebSettings::kEditingBehaviorWin); element->focus(); @@ -6775,7 +6848,7 @@ Document* document = frame->GetDocument(); Element* element = document->getElementById("data"); - web_view_helper.WebView()->GetSettings()->SetEditingBehavior( + web_view_helper.GetWebView()->GetSettings()->SetEditingBehavior( WebSettings::kEditingBehaviorWin); element->focus(); @@ -6853,7 +6926,7 @@ Document* document = frame->GetFrame()->GetDocument(); Element* element = document->getElementById("data"); - web_view_helper.WebView()->GetSettings()->SetEditingBehavior( + web_view_helper.GetWebView()->GetSettings()->SetEditingBehavior( WebSettings::kEditingBehaviorWin); element->focus(); @@ -6887,7 +6960,7 @@ Document* document = frame->GetFrame()->GetDocument(); Element* element = document->getElementById("data"); - web_view_helper.WebView()->GetSettings()->SetEditingBehavior( + web_view_helper.GetWebView()->GetSettings()->SetEditingBehavior( WebSettings::kEditingBehaviorWin); element->focus(); @@ -6923,7 +6996,7 @@ Document* document = frame->GetFrame()->GetDocument(); Element* element = document->getElementById("data"); - web_view_helper.WebView()->GetSettings()->SetEditingBehavior( + web_view_helper.GetWebView()->GetSettings()->SetEditingBehavior( WebSettings::kEditingBehaviorWin); element->focus(); @@ -6987,7 +7060,7 @@ // Create another window that will try to access it. FrameTestHelpers::WebViewHelper new_web_view_helper; WebViewImpl* new_view = new_web_view_helper.InitializeWithOpener( - web_view_helper.WebView()->MainFrame()); + web_view_helper.GetWebView()->MainFrame()); RunPendingTasks(); EXPECT_EQ(0, web_frame_client.did_access_initial_document_); @@ -7010,7 +7083,7 @@ // Create another window that will try to access it. FrameTestHelpers::WebViewHelper new_web_view_helper; WebViewImpl* new_view = new_web_view_helper.InitializeWithOpener( - web_view_helper.WebView()->MainFrame()); + web_view_helper.GetWebView()->MainFrame()); RunPendingTasks(); EXPECT_EQ(0, web_frame_client.did_access_initial_document_); @@ -7034,7 +7107,7 @@ // Create another window that will try to access it. FrameTestHelpers::WebViewHelper new_web_view_helper; WebViewImpl* new_view = new_web_view_helper.InitializeWithOpener( - web_view_helper.WebView()->MainFrame()); + web_view_helper.GetWebView()->MainFrame()); RunPendingTasks(); EXPECT_EQ(0, web_frame_client.did_access_initial_document_); @@ -7055,7 +7128,7 @@ EXPECT_EQ(0, web_frame_client.did_access_initial_document_); // Access the initial document from a javascript: URL. - FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), + FrameTestHelpers::LoadFrame(web_view_helper.GetWebView()->MainFrameImpl(), "javascript:document.body.appendChild(document." "createTextNode('Modified'))"); EXPECT_EQ(1, web_frame_client.did_access_initial_document_); @@ -7074,7 +7147,7 @@ // Create another window that will try to access it. FrameTestHelpers::WebViewHelper new_web_view_helper; WebViewImpl* new_view = new_web_view_helper.InitializeWithOpener( - web_view_helper.WebView()->MainFrame()); + web_view_helper.GetWebView()->MainFrame()); RunPendingTasks(); EXPECT_EQ(0, web_frame_client.did_access_initial_document_); @@ -7106,7 +7179,7 @@ // Create another window that will try to access it. FrameTestHelpers::WebViewHelper new_web_view_helper; WebViewImpl* new_view = new_web_view_helper.InitializeWithOpener( - web_view_helper.WebView()->MainFrame()); + web_view_helper.GetWebView()->MainFrame()); RunPendingTasks(); EXPECT_EQ(0, web_frame_client.did_access_initial_document_); @@ -7181,8 +7254,8 @@ // Do a compositor scroll, verify that this is counted as a user scroll. scrollable_area->DidScroll(gfx::ScrollOffset(0, 1)); - web_view_helper.WebView()->ApplyViewportDeltas(WebFloatSize(), WebFloatSize(), - WebFloatSize(), 1.7f, 0); + web_view_helper.GetWebView()->ApplyViewportDeltas( + WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.7f, 0); EXPECT_TRUE(client.WasFrameScrolled()); EXPECT_TRUE(initial_scroll_state.was_scrolled_by_user); @@ -7191,8 +7264,8 @@ // The page scale 1.0f and scroll. scrollable_area->DidScroll(gfx::ScrollOffset(0, 2)); - web_view_helper.WebView()->ApplyViewportDeltas(WebFloatSize(), WebFloatSize(), - WebFloatSize(), 1.0f, 0); + web_view_helper.GetWebView()->ApplyViewportDeltas( + WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.0f, 0); EXPECT_TRUE(client.WasFrameScrolled()); EXPECT_TRUE(initial_scroll_state.was_scrolled_by_user); client.Reset(); @@ -7200,16 +7273,16 @@ // No scroll event if there is no scroll delta. scrollable_area->DidScroll(gfx::ScrollOffset(0, 2)); - web_view_helper.WebView()->ApplyViewportDeltas(WebFloatSize(), WebFloatSize(), - WebFloatSize(), 1.0f, 0); + web_view_helper.GetWebView()->ApplyViewportDeltas( + WebFloatSize(), WebFloatSize(), WebFloatSize(), 1.0f, 0); EXPECT_FALSE(client.WasFrameScrolled()); EXPECT_FALSE(initial_scroll_state.was_scrolled_by_user); client.Reset(); // Non zero page scale and scroll. scrollable_area->DidScroll(gfx::ScrollOffset(9, 15)); - web_view_helper.WebView()->ApplyViewportDeltas(WebFloatSize(), WebFloatSize(), - WebFloatSize(), 0.6f, 0); + web_view_helper.GetWebView()->ApplyViewportDeltas( + WebFloatSize(), WebFloatSize(), WebFloatSize(), 0.6f, 0); EXPECT_TRUE(client.WasFrameScrolled()); EXPECT_TRUE(initial_scroll_state.was_scrolled_by_user); client.Reset(); @@ -7248,7 +7321,7 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.InitializeAndLoad(base_url_ + "first_party_redirect.html"); - EXPECT_TRUE(web_view_helper.WebView() + EXPECT_TRUE(web_view_helper.GetWebView() ->MainFrameImpl() ->GetDocument() .SiteForCookies() == redirect_url); @@ -7276,7 +7349,7 @@ &client); Document* document = - ToLocalFrame(web_view_helper.WebView()->GetPage()->MainFrame()) + ToLocalFrame(web_view_helper.GetWebView()->GetPage()->MainFrame()) ->GetDocument(); KURL destination = document->Url(); destination.SetFragmentIdentifier("test"); @@ -7289,7 +7362,7 @@ MouseEvent::Create(nullptr, EventTypeNames::click, mouse_initializer); FrameLoadRequest frame_request(document, ResourceRequest(destination)); frame_request.SetTriggeringEvent(event); - ToLocalFrame(web_view_helper.WebView()->GetPage()->MainFrame()) + ToLocalFrame(web_view_helper.GetWebView()->GetPage()->MainFrame()) ->Loader() .Load(frame_request); } @@ -7341,7 +7414,7 @@ &web_frame_client, &web_view_client); LocalFrame* frame = - ToLocalFrame(web_view_helper.WebView()->GetPage()->MainFrame()); + ToLocalFrame(web_view_helper.GetWebView()->GetPage()->MainFrame()); Document* document = frame->GetDocument(); KURL destination = ToKURL(base_url_ + "hello_world.html"); @@ -7357,11 +7430,11 @@ frame_request.SetTriggeringEvent(event); std::unique_ptr<UserGestureIndicator> gesture = Frame::NotifyUserActivation(frame); - ToLocalFrame(web_view_helper.WebView()->GetPage()->MainFrame()) + ToLocalFrame(web_view_helper.GetWebView()->GetPage()->MainFrame()) ->Loader() .Load(frame_request); FrameTestHelpers::PumpPendingRequestsForFrameToLoad( - web_view_helper.WebView()->MainFrame()); + web_view_helper.GetWebView()->MainFrame()); // decidePolicyForNavigation should be called both for the original request // and the ctrl+click. @@ -7433,12 +7506,12 @@ web_view_helper.InitializeAndLoad(base_url_ + "reload_post.html"); WebLocalFrame* frame = web_view_helper.LocalMainFrame(); - FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), + FrameTestHelpers::LoadFrame(web_view_helper.GetWebView()->MainFrameImpl(), "javascript:document.forms[0].submit()"); // Pump requests one more time after the javascript URL has executed to // trigger the actual POST load request. FrameTestHelpers::PumpPendingRequestsForFrameToLoad( - web_view_helper.WebView()->MainFrame()); + web_view_helper.GetWebView()->MainFrame()); EXPECT_EQ(WebString::FromUTF8("POST"), frame->GetDocumentLoader()->GetRequest().HttpMethod()); @@ -7588,14 +7661,14 @@ FrameLoadRequest frame_request( nullptr, ResourceRequest( - ToLocalFrame(web_view_helper.WebView()->GetPage()->MainFrame()) + ToLocalFrame(web_view_helper.GetWebView()->GetPage()->MainFrame()) ->GetDocument() ->Url())); - ToLocalFrame(web_view_helper.WebView()->GetPage()->MainFrame()) + ToLocalFrame(web_view_helper.GetWebView()->GetPage()->MainFrame()) ->Loader() .Load(frame_request); FrameTestHelpers::PumpPendingRequestsForFrameToLoad( - web_view_helper.WebView()->MainFrame()); + web_view_helper.GetWebView()->MainFrame()); EXPECT_TRUE(client.FrameLoadTypeReloadSeen()); } @@ -7631,7 +7704,7 @@ &ConfigureLoadsImagesAutomatically); WebCache::Clear(); - FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), + FrameTestHelpers::LoadFrame(web_view_helper.GetWebView()->MainFrameImpl(), base_url_ + "foo_with_image.html"); // 2 images are requested, and each triggers 2 willSendRequest() calls, @@ -7859,11 +7932,11 @@ nullptr, &ConfigureCompositingWebView); web_view_helper.Resize(WebSize(100, 100)); - FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), + FrameTestHelpers::LoadFrame(web_view_helper.GetWebView()->MainFrameImpl(), base_url_ + "non-scrollable.html"); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); - PaintLayerCompositor* compositor = web_view_helper.WebView()->Compositor(); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); + PaintLayerCompositor* compositor = web_view_helper.GetWebView()->Compositor(); GraphicsLayer* scroll_layer = compositor->ScrollLayer(); ASSERT_TRUE(scroll_layer); WebLayer* web_scroll_layer = scroll_layer->PlatformLayer(); @@ -7875,7 +7948,7 @@ // Call javascript to make the layer scrollable, and verify it. WebLocalFrameImpl* frame = web_view_helper.LocalMainFrame(); frame->ExecuteScript(WebScriptSource("allowScroll();")); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); scroll_layer = compositor->ScrollLayer(); web_scroll_layer = scroll_layer->PlatformLayer(); @@ -7891,7 +7964,7 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.Initialize(); - WebLocalFrame* frame = web_view_helper.WebView()->MainFrameImpl(); + WebLocalFrame* frame = web_view_helper.GetWebView()->MainFrameImpl(); const FrameLoader& main_frame_loader = web_view_helper.LocalMainFrame()->GetFrame()->Loader(); WebURLRequest request(ToKURL(url)); @@ -7950,7 +8023,7 @@ base_url_ + "fixed-position-in-fixed-viewport.html", nullptr, nullptr, nullptr, ConfigureAndroid); - WebViewImpl* web_view = web_view_helper.WebView(); + WebViewImpl* web_view = web_view_helper.GetWebView(); web_view_helper.Resize(WebSize(100, 100)); Document* document = web_view->MainFrameImpl()->GetFrame()->GetDocument(); @@ -7976,7 +8049,7 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.InitializeAndLoad("about:blank"); web_view_helper.Resize(WebSize(200, 200)); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); LocalFrameView* frame_view = web_view_helper.LocalMainFrame()->GetFrameView(); EXPECT_EQ(IntRect(0, 0, 200, 200), frame_view->FrameRect()); @@ -7991,7 +8064,7 @@ web_view_helper.InitializeAndLoad(base_url_ + "long_scroll.html", nullptr, &client, nullptr, ConfigureAndroid); - WebViewImpl* web_view = web_view_helper.WebView(); + WebViewImpl* web_view = web_view_helper.GetWebView(); LocalFrameView* frame_view = web_view_helper.LocalMainFrame()->GetFrameView(); float browser_controls_height = 40; @@ -8077,12 +8150,13 @@ web_view_helper.InitializeAndLoad(base_url_ + "rtl-overview-mode.html", nullptr, &client, nullptr, ConfigureAndroid); - web_view_helper.WebView()->SetInitialPageScaleOverride(-1); - web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); - web_view_helper.WebView()->GetSettings()->SetLoadWithOverviewMode(true); - web_view_helper.WebView()->GetSettings()->SetUseWideViewport(true); + web_view_helper.GetWebView()->SetInitialPageScaleOverride(-1); + web_view_helper.GetWebView()->GetSettings()->SetWideViewportQuirkEnabled( + true); + web_view_helper.GetWebView()->GetSettings()->SetLoadWithOverviewMode(true); + web_view_helper.GetWebView()->GetSettings()->SetUseWideViewport(true); web_view_helper.Resize(WebSize(viewport_width, viewport_height)); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); LocalFrameView* frame_view = web_view_helper.LocalMainFrame()->GetFrameView(); ScrollableArea* layout_viewport = frame_view->LayoutViewportScrollableArea(); @@ -8259,7 +8333,8 @@ web_view_impl->UpdateAllLifecyclePhases(); LocalFrame* frame = - ToWebLocalFrameImpl(web_view_helper.WebView()->MainFrame()->FirstChild()) + ToWebLocalFrameImpl( + web_view_helper.GetWebView()->MainFrame()->FirstChild()) ->GetFrame(); Document* document = frame->GetDocument(); std::unique_ptr<UserGestureIndicator> gesture = @@ -8347,7 +8422,7 @@ web_view_helper.Resize(WebSize(viewport_width, viewport_height)); web_view_impl->UpdateAllLifecyclePhases(); - LayoutViewItem layout_view_item = web_view_helper.WebView() + LayoutViewItem layout_view_item = web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutViewItem(); @@ -8392,7 +8467,7 @@ web_view_helper.Resize(WebSize(viewport_width, viewport_height)); web_view_impl->UpdateAllLifecyclePhases(); - LayoutViewItem layout_view_item = web_view_helper.WebView() + LayoutViewItem layout_view_item = web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutViewItem(); @@ -8449,7 +8524,7 @@ client.screen_info_.rect.height = screen_size_minus_status_bars_minus_url_bar.height; web_view_helper.Resize(screen_size_minus_status_bars_minus_url_bar); - LayoutViewItem layout_view_item = web_view_helper.WebView() + LayoutViewItem layout_view_item = web_view_helper.GetWebView() ->MainFrameImpl() ->GetFrameView() ->GetLayoutViewItem(); @@ -8625,7 +8700,7 @@ web_view_helper.InitializeAndLoad(base_url_ + "percent-height-descendants.html"); - WebViewImpl* web_view = web_view_helper.WebView(); + WebViewImpl* web_view = web_view_helper.GetWebView(); web_view_helper.Resize(WebSize(800, 800)); web_view->UpdateAllLifecyclePhases(); @@ -8947,7 +9022,7 @@ void Reset() { web_view_helper_.Reset(); } WebLocalFrame* MainFrame() const { return web_view_helper_.LocalMainFrame(); } - WebViewImpl* WebView() const { return web_view_helper_.WebView(); } + WebViewImpl* WebView() const { return web_view_helper_.GetWebView(); } private: FrameTestHelpers::WebViewHelper web_view_helper_; @@ -9756,7 +9831,7 @@ *helper.RemoteMainFrame(), WebString(), WebFrameOwnerProperties(), nullptr, nullptr, &child_widget_client); - helper.WebView()->Resize(WebSize(1000, 1000)); + helper.GetWebView()->Resize(WebSize(1000, 1000)); WebGestureEvent event(WebInputEvent::kGestureTap, WebInputEvent::kNoModifiers, WebInputEvent::kTimeStampForTesting); @@ -9801,7 +9876,7 @@ RegisterMockedChromeURLLoad("test.pdf"); LocalFrame* frame( - ToLocalFrame(web_view_helper.WebView()->GetPage()->MainFrame())); + ToLocalFrame(web_view_helper.GetWebView()->GetPage()->MainFrame())); MockDocumentThreadableLoaderClient client; ThreadableLoaderOptions options; @@ -9861,7 +9936,7 @@ TestConsoleMessageWebFrameClient popup_web_frame_client; WebViewImpl* popup_view = popup_web_view_helper.InitializeAndLoad( chrome_url_ + "hello_world.html", &popup_web_frame_client); - popup_view->MainFrame()->SetOpener(web_view_helper.WebView()->MainFrame()); + popup_view->MainFrame()->SetOpener(web_view_helper.GetWebView()->MainFrame()); // Attempt a blocked navigation of an opener's subframe, and ensure that // the error shows up on the popup (calling) window's console, rather than @@ -9900,7 +9975,7 @@ nullptr, &client, nullptr, ConfigureAndroid); LocalFrame* frame = - ToLocalFrame(web_view_helper.WebView()->GetPage()->MainFrame()); + ToLocalFrame(web_view_helper.GetWebView()->GetPage()->MainFrame()); Element* element = frame->GetDocument()->getElementById("test"); ASSERT_TRUE(element); @@ -9962,7 +10037,7 @@ v8::HandleScope scope(v8::Isolate::GetCurrent()); ScriptExecutionCallbackHelper callback_helper( web_view_helper_.LocalMainFrame()->MainWorldScriptContext()); - web_view_helper_.WebView() + web_view_helper_.GetWebView() ->MainFrameImpl() ->RequestExecuteScriptAndReturnValue(WebScriptSource(WebString(code)), false, &callback_helper); @@ -9980,7 +10055,7 @@ TEST_P(DeviceEmulationTest, DeviceSizeInvalidatedOnResize) { WebDeviceEmulationParams params; params.screen_position = WebDeviceEmulationParams::kMobile; - web_view_helper_.WebView()->EnableDeviceEmulation(params); + web_view_helper_.GetWebView()->EnableDeviceEmulation(params); TestResize(WebSize(700, 500), "300x300"); TestResize(WebSize(710, 500), "400x300"); @@ -9991,15 +10066,15 @@ TestResize(WebSize(690, 490), "200x200"); TestResize(WebSize(800, 600), "400x400"); - web_view_helper_.WebView()->DisableDeviceEmulation(); + web_view_helper_.GetWebView()->DisableDeviceEmulation(); } TEST_P(DeviceEmulationTest, PointerAndHoverTypes) { - web_view_helper_.WebView() + web_view_helper_.GetWebView() ->GetDevToolsEmulator() ->SetTouchEventEmulationEnabled(true, 1); EXPECT_EQ("20x20", DumpSize("pointer")); - web_view_helper_.WebView() + web_view_helper_.GetWebView() ->GetDevToolsEmulator() ->SetTouchEventEmulationEnabled(false, 1); } @@ -10171,19 +10246,19 @@ void ScrollBegin(FrameTestHelpers::WebViewHelper* web_view_helper, float delta_x_hint, float delta_y_hint) { - web_view_helper->WebView()->HandleInputEvent(GenerateEvent( + web_view_helper->GetWebView()->HandleInputEvent(GenerateEvent( WebInputEvent::kGestureScrollBegin, delta_x_hint, delta_y_hint)); } void ScrollUpdate(FrameTestHelpers::WebViewHelper* web_view_helper, float delta_x, float delta_y) { - web_view_helper->WebView()->HandleInputEvent( + web_view_helper->GetWebView()->HandleInputEvent( GenerateEvent(WebInputEvent::kGestureScrollUpdate, delta_x, delta_y)); } void ScrollEnd(FrameTestHelpers::WebViewHelper* web_view_helper) { - web_view_helper->WebView()->HandleInputEvent( + web_view_helper->GetWebView()->HandleInputEvent( GenerateEvent(WebInputEvent::kGestureScrollEnd)); } }; @@ -10483,7 +10558,7 @@ web_view_helper.Resize(WebSize(200, 200)); WebLocalFrame* mainFrame = - web_view_helper.WebView()->MainFrame()->ToWebLocalFrame(); + web_view_helper.GetWebView()->MainFrame()->ToWebLocalFrame(); mainFrame->ExecuteScript( WebScriptSource(WebString("document.body.style=" "'overscroll-behavior: auto;'"))); @@ -10538,12 +10613,14 @@ web_view_helper.Resize(WebSize(200, 200)); WebLocalFrame* mainFrame = - web_view_helper.WebView()->MainFrame()->ToWebLocalFrame(); + web_view_helper.GetWebView()->MainFrame()->ToWebLocalFrame(); mainFrame->ExecuteScript( WebScriptSource(WebString("document.body.style=" "'overscroll-behavior: auto;'"))); - WebLocalFrame* subframe = - web_view_helper.WebView()->MainFrame()->FirstChild()->ToWebLocalFrame(); + WebLocalFrame* subframe = web_view_helper.GetWebView() + ->MainFrame() + ->FirstChild() + ->ToWebLocalFrame(); subframe->ExecuteScript( WebScriptSource(WebString("document.body.style=" "'overscroll-behavior: none;'"))); @@ -10604,7 +10681,7 @@ RegisterMockedHttpURLLoadWithMimeType("white-1x1.png", "image/png"); FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.InitializeAndLoad(base_url_ + "white-1x1.png"); - WebViewImpl* web_view = web_view_helper.WebView(); + WebViewImpl* web_view = web_view_helper.GetWebView(); Document* document = web_view->MainFrameImpl()->GetFrame()->GetDocument(); EXPECT_TRUE(document); @@ -10779,7 +10856,7 @@ FrameTestHelpers::WebViewHelper opener_helper; opener_helper.Initialize(); FrameTestHelpers::WebViewHelper helper; - helper.InitializeWithOpener(opener_helper.WebView()->MainFrame(), nullptr, + helper.InitializeWithOpener(opener_helper.GetWebView()->MainFrame(), nullptr, nullptr, nullptr, EnableGlobalReuseForUnownedMainFrames); @@ -11001,7 +11078,7 @@ // Normally, the result of the JS url replaces the existing contents on the // Document. However, if the JS triggers a navigation, the contents should // not be replaced. - EXPECT_EQ("", ToLocalFrame(helper.WebView()->GetPage()->MainFrame()) + EXPECT_EQ("", ToLocalFrame(helper.GetWebView()->GetPage()->MainFrame()) ->GetDocument() ->documentElement() ->innerText()); @@ -11063,11 +11140,11 @@ helper.Initialize(&client); helper.Resize(WebSize(640, 480)); FrameTestHelpers::LoadFrame( - helper.WebView()->MainFrameImpl(), + helper.GetWebView()->MainFrameImpl(), base_url_ + "promote_img_in_viewport_priority.html"); // Ensure the image in the viewport got promoted after the request was sent. - Resource* image = ToWebLocalFrameImpl(helper.WebView()->MainFrame()) + Resource* image = ToWebLocalFrameImpl(helper.GetWebView()->MainFrame()) ->GetFrame() ->GetDocument() ->Fetcher() @@ -11143,7 +11220,7 @@ Platform::Current()->GetURLLoaderMockFactory()->SetLoaderDelegate(nullptr); Document* document = - ToLocalFrame(helper.WebView()->GetPage()->MainFrame())->GetDocument(); + ToLocalFrame(helper.GetWebView()->GetPage()->MainFrame())->GetDocument(); EXPECT_TRUE(document->IsImageDocument()); EXPECT_EQ(ResourceStatus::kDecodeError, ToImageDocument(document)->CachedImage()->GetContentStatus()); @@ -11159,7 +11236,7 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.Initialize(nullptr, nullptr, nullptr, ConfigureAndroid); - WebViewImpl* web_view = web_view_helper.WebView(); + WebViewImpl* web_view = web_view_helper.GetWebView(); web_view->ResizeWithBrowserControls( WebSize(kViewportWidth, kViewportHeight - kBrowserControlsHeight), kBrowserControlsHeight, 0, true); @@ -11226,7 +11303,7 @@ RegisterMockedHttpURLLoad("display-none.html"); FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.InitializeAndLoad(base_url_ + "display-none.html"); - WebViewImpl* web_view = web_view_helper.WebView(); + WebViewImpl* web_view = web_view_helper.GetWebView(); web_view_helper.Resize(WebSize(640, 480)); Document* document = web_view->MainFrameImpl()->GetFrame()->GetDocument(); @@ -11247,17 +11324,17 @@ // Try GestureScrollEnd and GestureScrollUpdate first to make sure that not // seeing a Begin first doesn't break anything. (This currently happens). - web_view_helper.WebView()->HandleInputEvent( + web_view_helper.GetWebView()->HandleInputEvent( WebCoalescedInputEvent(end_event)); - web_view_helper.WebView()->HandleInputEvent( + web_view_helper.GetWebView()->HandleInputEvent( WebCoalescedInputEvent(update_event)); // Try a full Begin/Update/End cycle. - web_view_helper.WebView()->HandleInputEvent( + web_view_helper.GetWebView()->HandleInputEvent( WebCoalescedInputEvent(begin_event)); - web_view_helper.WebView()->HandleInputEvent( + web_view_helper.GetWebView()->HandleInputEvent( WebCoalescedInputEvent(update_event)); - web_view_helper.WebView()->HandleInputEvent( + web_view_helper.GetWebView()->HandleInputEvent( WebCoalescedInputEvent(end_event)); } @@ -11266,7 +11343,7 @@ web_view_helper.Initialize(nullptr, nullptr, nullptr, [](WebSettings* settings) {}); web_view_helper.Resize(WebSize(200, 200)); - WebViewImpl* web_view = web_view_helper.WebView(); + WebViewImpl* web_view = web_view_helper.GetWebView(); InitializeWithHTML( *web_view->MainFrameImpl()->GetFrame(), @@ -11306,7 +11383,7 @@ WebFloatPoint(div1_tag->OffsetLeft() + 5, div1_tag->OffsetTop() + 5), WebFloatPoint(div1_tag->OffsetLeft() + 5, div1_tag->OffsetTop() + 5), WebPointerProperties::Button::kNoButton, 0, WebInputEvent::kNoModifiers, - TimeTicks::Now().InSeconds()); + CurrentTimeTicks().InSeconds()); mouse_move_over_link_event.SetFrameScale(1); document->GetFrame()->GetEventHandler().HandleMouseMoveEvent( mouse_move_over_link_event, Vector<WebMouseEvent>()); @@ -11325,7 +11402,7 @@ WebFloatPoint(div2_tag->OffsetLeft() + 5, div2_tag->OffsetTop() + 5), WebFloatPoint(div2_tag->OffsetLeft() + 5, div2_tag->OffsetTop() + 5), WebPointerProperties::Button::kNoButton, 0, WebInputEvent::kNoModifiers, - TimeTicks::Now().InSeconds()); + CurrentTimeTicks().InSeconds()); mouse_move_event.SetFrameScale(1); document->GetFrame()->GetEventHandler().HandleMouseMoveEvent( mouse_move_event, Vector<WebMouseEvent>()); @@ -11646,7 +11723,7 @@ FrameTestHelpers::WebViewHelper opener_helper; opener_helper.Initialize(); FrameTestHelpers::WebViewHelper helper; - helper.InitializeWithOpener(opener_helper.WebView()->MainFrame()); + helper.InitializeWithOpener(opener_helper.GetWebView()->MainFrame()); opener_helper.Reset(); EXPECT_EQ(nullptr, helper.LocalMainFrame()->Opener()); @@ -11924,7 +12001,7 @@ const char kSource[] = "<img id='foo' src='foo' alt='foo alt' width='200' height='200'>"; FrameTestHelpers::LoadHTMLString(frame, kSource, ToKURL("about:blank")); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); RunPendingTasks(); // Check LayoutText with alt text "foo alt" @@ -11952,7 +12029,8 @@ web_view_helper.LocalMainFrame()->ExecuteScriptAndReturnValue( WebScriptSource("navigator.plugins.length")); EXPECT_NE(0, result->Int32Value()); - web_view_helper.WebView()->GetPage()->GetSettings().SetPluginsEnabled(false); + web_view_helper.GetWebView()->GetPage()->GetSettings().SetPluginsEnabled( + false); result = web_view_helper.LocalMainFrame()->ExecuteScriptAndReturnValue( WebScriptSource("navigator.plugins.length")); EXPECT_EQ(0, result->Int32Value()); @@ -11965,10 +12043,10 @@ HistogramTester tester; web_view_helper.InitializeAndLoad("about:blank"); LocalFrame* frame = - ToLocalFrame(web_view_helper.WebView()->GetPage()->MainFrame()); + ToLocalFrame(web_view_helper.GetWebView()->GetPage()->MainFrame()); FrameLoader& main_frame_loader = - web_view_helper.WebView()->MainFrameImpl()->GetFrame()->Loader(); + web_view_helper.GetWebView()->MainFrameImpl()->GetFrame()->Loader(); scoped_refptr<SerializedScriptValue> message = SerializeString("message", ToScriptStateForMainWorld(frame)); tester.ExpectTotalCount(histogramName, 0); @@ -12003,7 +12081,7 @@ FrameTestHelpers::WebViewHelper web_view_helper; web_view_helper.Initialize(); web_view_helper.Resize(WebSize(200, 200)); - WebViewImpl* web_view = web_view_helper.WebView(); + WebViewImpl* web_view = web_view_helper.GetWebView(); InitializeWithHTML(*web_view->MainFrameImpl()->GetFrame(), "<style>" @@ -12080,7 +12158,7 @@ return web_view_helper_->LocalMainFrame()->GetFrameView(); } - WebViewImpl* WebView() { return web_view_helper_->WebView(); } + WebViewImpl* WebView() { return web_view_helper_->GetWebView(); } size_t ContentLayerCount() { return paint_artifact_compositor()
diff --git a/third_party/WebKit/Source/core/exported/WebHelperPluginImpl.cpp b/third_party/WebKit/Source/core/exported/WebHelperPluginImpl.cpp index cf91ee9..8ecafe2 100644 --- a/third_party/WebKit/Source/core/exported/WebHelperPluginImpl.cpp +++ b/third_party/WebKit/Source/core/exported/WebHelperPluginImpl.cpp
@@ -61,11 +61,10 @@ Vector<String> attribute_names; Vector<String> attribute_values; DCHECK(frame->GetFrame()->GetDocument()->Url().IsValid()); - plugin_container_ = - ToWebPluginContainerImpl(frame->GetFrame()->Client()->CreatePlugin( - *object_element_, frame->GetFrame()->GetDocument()->Url(), - attribute_names, attribute_values, plugin_type, false, - LocalFrameClient::kAllowDetachedPlugin)); + plugin_container_ = frame->GetFrame()->Client()->CreatePlugin( + *object_element_, frame->GetFrame()->GetDocument()->Url(), + attribute_names, attribute_values, plugin_type, false, + LocalFrameClient::kAllowDetachedPlugin); if (!plugin_container_) return false;
diff --git a/third_party/WebKit/Source/core/exported/WebHelperPluginTest.cpp b/third_party/WebKit/Source/core/exported/WebHelperPluginTest.cpp index 0558f48..4cf1ce5 100644 --- a/third_party/WebKit/Source/core/exported/WebHelperPluginTest.cpp +++ b/third_party/WebKit/Source/core/exported/WebHelperPluginTest.cpp
@@ -61,7 +61,7 @@ TEST_F(WebHelperPluginTest, CreateAndDestroyAfterWebViewDestruction) { plugin_.reset(WebHelperPlugin::Create( - "hello", helper_.WebView()->MainFrame()->ToWebLocalFrame())); + "hello", helper_.GetWebView()->MainFrame()->ToWebLocalFrame())); EXPECT_TRUE(plugin_); EXPECT_TRUE(plugin_->GetPlugin()); @@ -70,7 +70,7 @@ TEST_F(WebHelperPluginTest, CreateAndDestroyBeforeWebViewDestruction) { plugin_.reset(WebHelperPlugin::Create( - "hello", helper_.WebView()->MainFrame()->ToWebLocalFrame())); + "hello", helper_.GetWebView()->MainFrame()->ToWebLocalFrame())); EXPECT_TRUE(plugin_); EXPECT_TRUE(plugin_->GetPlugin()); @@ -81,7 +81,7 @@ frame_client_.SetCreatePlaceholder(true); plugin_.reset(WebHelperPlugin::Create( - "hello", helper_.WebView()->MainFrame()->ToWebLocalFrame())); + "hello", helper_.GetWebView()->MainFrame()->ToWebLocalFrame())); EXPECT_EQ(nullptr, plugin_.get()); }
diff --git a/third_party/WebKit/Source/core/exported/WebPagePopupImpl.cpp b/third_party/WebKit/Source/core/exported/WebPagePopupImpl.cpp index 9b9a784..1f866a0 100644 --- a/third_party/WebKit/Source/core/exported/WebPagePopupImpl.cpp +++ b/third_party/WebKit/Source/core/exported/WebPagePopupImpl.cpp
@@ -399,7 +399,7 @@ return; // FIXME: This should use lastFrameTimeMonotonic but doing so // breaks tests. - PageWidgetDelegate::Animate(*page_, MonotonicallyIncreasingTime()); + PageWidgetDelegate::Animate(*page_, CurrentTimeTicksInSeconds()); } void WebPagePopupImpl::WillCloseLayerTreeView() {
diff --git a/third_party/WebKit/Source/core/exported/WebPluginContainerImpl.cpp b/third_party/WebKit/Source/core/exported/WebPluginContainerImpl.cpp index 6100456..8146580 100644 --- a/third_party/WebKit/Source/core/exported/WebPluginContainerImpl.cpp +++ b/third_party/WebKit/Source/core/exported/WebPluginContainerImpl.cpp
@@ -749,7 +749,6 @@ void WebPluginContainerImpl::Trace(blink::Visitor* visitor) { visitor->Trace(element_); ContextClient::Trace(visitor); - PluginView::Trace(visitor); } void WebPluginContainerImpl::HandleMouseEvent(MouseEvent* event) {
diff --git a/third_party/WebKit/Source/core/exported/WebPluginContainerImpl.h b/third_party/WebKit/Source/core/exported/WebPluginContainerImpl.h index c60b11c..cc2403d 100644 --- a/third_party/WebKit/Source/core/exported/WebPluginContainerImpl.h +++ b/third_party/WebKit/Source/core/exported/WebPluginContainerImpl.h
@@ -35,16 +35,18 @@ #include "base/memory/scoped_refptr.h" #include "core/CoreExport.h" #include "core/dom/ContextLifecycleObserver.h" -#include "core/plugins/PluginView.h" +#include "core/frame/EmbeddedContentView.h" #include "platform/heap/Handle.h" #include "platform/wtf/Compiler.h" #include "platform/wtf/text/WTFString.h" #include "public/platform/WebCoalescedInputEvent.h" +#include "public/platform/WebFocusType.h" #include "public/platform/WebTouchEvent.h" #include "public/web/WebPluginContainer.h" namespace blink { +class Event; class GestureEvent; class HTMLFrameOwnerElement; class HTMLPlugInElement; @@ -63,7 +65,7 @@ class CORE_EXPORT WebPluginContainerImpl final : public GarbageCollectedFinalized<WebPluginContainerImpl>, - public PluginView, + public EmbeddedContentView, public WebPluginContainer, public ContextClient { USING_GARBAGE_COLLECTED_MIXIN(WebPluginContainerImpl); @@ -79,27 +81,13 @@ ~WebPluginContainerImpl() override; - // PluginView methods + // EmbeddedContentView methods + bool IsPluginView() const override { return true; } void AttachToLayout() override; void DetachFromLayout() override; bool IsAttached() const override { return is_attached_; } void SetParentVisible(bool) override; - WebLayer* PlatformLayer() const override; - v8::Local<v8::Object> ScriptableObject(v8::Isolate*) override; - bool SupportsKeyboardFocus() const override; - bool SupportsInputMethod() const override; - bool CanProcessDrag() const override; - bool WantsWheelEvents() override; - void UpdateAllLifecyclePhases() override; - void InvalidateRect(const IntRect&); - void SetFocused(bool, WebFocusType) override; - void HandleEvent(Event*) override; void FrameRectsChanged() override; - bool IsPluginContainer() const override { return true; } - bool IsErrorplaceholder() override; - void EventListenersRemoved() override; - - // EmbeddedContentView methods void SetFrameRect(const IntRect&) override; const IntRect& FrameRect() const override { return frame_rect_; } void Paint(GraphicsContext&, @@ -109,6 +97,20 @@ void Show() override; void Hide() override; + WebLayer* PlatformLayer() const; + v8::Local<v8::Object> ScriptableObject(v8::Isolate*); + bool SupportsKeyboardFocus() const; + bool SupportsInputMethod() const; + bool CanProcessDrag() const; + bool WantsWheelEvents(); + void UpdateAllLifecyclePhases(); + void InvalidateRect(const IntRect&); + void SetFocused(bool, WebFocusType); + void HandleEvent(Event*); + bool IsErrorplaceholder(); + void EventListenersRemoved(); + void InvalidatePaint() {} + // WebPluginContainer methods WebElement GetElement() override; WebDocument GetDocument() override; @@ -175,15 +177,11 @@ bool ExecuteEditCommand(const WebString& name, const WebString& value); // Resource load events for the plugin's source data: - void DidReceiveResponse(const ResourceResponse&) override; - void DidReceiveData(const char* data, int data_length) override; + void DidReceiveResponse(const ResourceResponse&); + void DidReceiveData(const char* data, int data_length); void DidFinishLoading(); void DidFailLoading(const ResourceError&); - WebPluginContainerImpl* GetWebPluginContainer() const override { - return const_cast<WebPluginContainerImpl*>(this); - } - virtual void Trace(blink::Visitor*); // USING_PRE_FINALIZER does not allow for virtual dispatch from the finalizer // method. Here we call Dispose() which does the correct virtual dispatch. @@ -239,10 +237,10 @@ }; DEFINE_TYPE_CASTS(WebPluginContainerImpl, - PluginView, - plugin, - plugin->IsPluginContainer(), - plugin.IsPluginContainer()); + EmbeddedContentView, + embedded_content_view, + embedded_content_view->IsPluginView(), + embedded_content_view.IsPluginView()); // Unlike EmbeddedContentView, we need not worry about object type for // container. WebPluginContainerImpl is the only subclass of WebPluginContainer. DEFINE_TYPE_CASTS(WebPluginContainerImpl,
diff --git a/third_party/WebKit/Source/core/exported/WebPluginDocument.cpp b/third_party/WebKit/Source/core/exported/WebPluginDocument.cpp index a130738..6c47cc6 100644 --- a/third_party/WebKit/Source/core/exported/WebPluginDocument.cpp +++ b/third_party/WebKit/Source/core/exported/WebPluginDocument.cpp
@@ -41,8 +41,7 @@ if (!IsPluginDocument()) return nullptr; PluginDocument* doc = Unwrap<PluginDocument>(); - WebPluginContainerImpl* container = - ToWebPluginContainerImpl(doc->GetPluginView()); + WebPluginContainerImpl* container = doc->GetPluginView(); return container ? container->Plugin() : nullptr; }
diff --git a/third_party/WebKit/Source/core/exported/WebSharedWorkerImpl.cpp b/third_party/WebKit/Source/core/exported/WebSharedWorkerImpl.cpp index 9b94417..e83bb16 100644 --- a/third_party/WebKit/Source/core/exported/WebSharedWorkerImpl.cpp +++ b/third_party/WebKit/Source/core/exported/WebSharedWorkerImpl.cpp
@@ -161,12 +161,6 @@ } } -WebDevToolsAgentClient::WebKitClientMessageLoop* -WebSharedWorkerImpl::CreateClientMessageLoop() { - DCHECK(IsMainThread()); - return client_->CreateDevToolsMessageLoop(); -} - const WebString& WebSharedWorkerImpl::GetInstrumentationToken() { return instrumentation_token_; }
diff --git a/third_party/WebKit/Source/core/exported/WebSharedWorkerImpl.h b/third_party/WebKit/Source/core/exported/WebSharedWorkerImpl.h index c345eed..cebac41a7 100644 --- a/third_party/WebKit/Source/core/exported/WebSharedWorkerImpl.h +++ b/third_party/WebKit/Source/core/exported/WebSharedWorkerImpl.h
@@ -79,8 +79,6 @@ const WebString&, const WebString&) override; void ResumeStartup() override; - WebDevToolsAgentClient::WebKitClientMessageLoop* CreateClientMessageLoop() - override; const WebString& GetInstrumentationToken() override; // WebSharedWorker methods:
diff --git a/third_party/WebKit/Source/core/exported/WebViewImpl.cpp b/third_party/WebKit/Source/core/exported/WebViewImpl.cpp index 40955b5..23d1cd49 100644 --- a/third_party/WebKit/Source/core/exported/WebViewImpl.cpp +++ b/third_party/WebKit/Source/core/exported/WebViewImpl.cpp
@@ -957,10 +957,10 @@ void WebViewImpl::SetPageStopped(bool stopped) { if (!GetPage()) return; - GetPage()->SetLifecycleState( - stopped ? PageLifecycleState::kStopped - // TODO(fmeawad): if not stopped, fall back to visibility state. - : PageLifecycleState::kUnknown); + GetPage()->SetLifecycleState(stopped ? PageLifecycleState::kStopped + : GetPage()->IsPageVisible() + ? PageLifecycleState::kActive + : PageLifecycleState::kHidden); } WebInputEventResult WebViewImpl::HandleKeyEvent(const WebKeyboardEvent& event) { @@ -1011,13 +1011,10 @@ if (event.windows_key_code == VKEY_TAB) { // If the plugin supports keyboard focus then we should not send a tab // keypress event. - PluginView* plugin_view = + WebPluginContainerImpl* plugin_view = ToLayoutEmbeddedContent(element->GetLayoutObject())->Plugin(); - if (plugin_view && plugin_view->IsPluginContainer()) { - WebPluginContainerImpl* plugin = - ToWebPluginContainerImpl(plugin_view); - if (plugin && plugin->SupportsKeyboardFocus()) - suppress_next_keypress_event_ = true; + if (plugin_view && plugin_view->SupportsKeyboardFocus()) { + suppress_next_keypress_event_ = true; } } } else { @@ -3102,15 +3099,16 @@ LayoutObject* object = node->GetLayoutObject(); if (object && object->IsLayoutEmbeddedContent()) { - PluginView* plugin_view = ToLayoutEmbeddedContent(object)->Plugin(); - if (plugin_view && plugin_view->IsPluginContainer()) { - WebPluginContainerImpl* plugin = ToWebPluginContainerImpl(plugin_view); + WebPluginContainerImpl* plugin_view = + ToLayoutEmbeddedContent(object)->Plugin(); + if (plugin_view) { switch (action.type) { case WebPluginAction::kRotate90Clockwise: - plugin->Plugin()->RotateView(WebPlugin::kRotationType90Clockwise); + plugin_view->Plugin()->RotateView( + WebPlugin::kRotationType90Clockwise); break; case WebPluginAction::kRotate90Counterclockwise: - plugin->Plugin()->RotateView( + plugin_view->Plugin()->RotateView( WebPlugin::kRotationType90Counterclockwise); break; default: @@ -3497,7 +3495,7 @@ WebGestureEvent tap_event(WebInputEvent::kGestureTap, WebInputEvent::kNoModifiers, - WTF::MonotonicallyIncreasingTime()); + WTF::CurrentTimeTicksInSeconds()); tap_event.x = tap_point_window_pos.x; tap_event.y = tap_point_window_pos.y; // GestureTap is only ever from a touchscreen.
diff --git a/third_party/WebKit/Source/core/exported/WebViewTest.cpp b/third_party/WebKit/Source/core/exported/WebViewTest.cpp index 0aab43b..dc8057d 100644 --- a/third_party/WebKit/Source/core/exported/WebViewTest.cpp +++ b/third_party/WebKit/Source/core/exported/WebViewTest.cpp
@@ -2486,13 +2486,13 @@ if (!element || !element->GetLayoutObject()) return false; - DCHECK(web_view_helper_.WebView()); + DCHECK(web_view_helper_.GetWebView()); element->scrollIntoViewIfNeeded(); // TODO(bokan): Technically incorrect, event positions should be in viewport // space. crbug.com/371902. IntPoint center = - web_view_helper_.WebView() + web_view_helper_.GetWebView() ->MainFrameImpl() ->GetFrameView() ->ContentsToScreen( @@ -2506,14 +2506,15 @@ event.x = center.X(); event.y = center.Y(); - web_view_helper_.WebView()->HandleInputEvent(WebCoalescedInputEvent(event)); + web_view_helper_.GetWebView()->HandleInputEvent( + WebCoalescedInputEvent(event)); RunPendingTasks(); return true; } bool WebViewTest::TapElementById(WebInputEvent::Type type, const WebString& id) { - DCHECK(web_view_helper_.WebView()); + DCHECK(web_view_helper_.GetWebView()); Element* element = static_cast<Element*>( web_view_helper_.LocalMainFrame()->GetDocument().GetElementById(id)); return TapElement(type, element); @@ -3388,7 +3389,7 @@ void DidFocus() override { did_focus_called_ = true; } bool DidFocusCalled() const { return did_focus_called_; } - WebView* CreatedWebView() const { return web_view_helper_.WebView(); } + WebView* CreatedWebView() const { return web_view_helper_.GetWebView(); } private: FrameTestHelpers::WebViewHelper web_view_helper_; @@ -3766,7 +3767,7 @@ RegisterMockedHttpURLLoad("add_frame_in_unload.html"); web_view_helper_.InitializeAndLoad(base_url_ + "add_frame_in_unload.html", &frame_client); - FrameTestHelpers::LoadFrame(web_view_helper_.WebView()->MainFrameImpl(), + FrameTestHelpers::LoadFrame(web_view_helper_.GetWebView()->MainFrameImpl(), "about:blank"); EXPECT_EQ(0, frame_client.Count()); web_view_helper_.Reset(); @@ -3778,7 +3779,7 @@ RegisterMockedHttpURLLoad("add_frame_in_unload.html"); web_view_helper_.InitializeAndLoad( base_url_ + "add_frame_in_unload_wrapper.html", &frame_client); - FrameTestHelpers::LoadFrame(web_view_helper_.WebView()->MainFrameImpl(), + FrameTestHelpers::LoadFrame(web_view_helper_.GetWebView()->MainFrameImpl(), "about:blank"); EXPECT_EQ(1, frame_client.Count()); web_view_helper_.Reset(); @@ -4431,7 +4432,7 @@ FrameTestHelpers::WebViewHelper main_web_view; main_web_view.InitializeAndLoad("about:blank", nullptr, &client); - WebLocalFrame* frame = main_web_view.WebView()->MainFrameImpl(); + WebLocalFrame* frame = main_web_view.GetWebView()->MainFrameImpl(); v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::Local<v8::Value> v8_value = frame->ExecuteScriptAndReturnValue(WebScriptSource( @@ -4584,7 +4585,7 @@ WebLocalFrame* frame = web_view_helper_.LocalMainFrame(); Document* document = - ToLocalFrame(web_view_helper_.WebView()->GetPage()->MainFrame()) + ToLocalFrame(web_view_helper_.GetWebView()->GetPage()->MainFrame()) ->GetDocument(); // Add a beforeunload handler in the main frame. Make sure firing @@ -4608,7 +4609,7 @@ ->ToWebLocalFrame() ->DispatchBeforeUnloadEvent(false); - Document* child_document = ToLocalFrame(web_view_helper_.WebView() + Document* child_document = ToLocalFrame(web_view_helper_.GetWebView() ->GetPage() ->MainFrame() ->Tree() @@ -4642,7 +4643,7 @@ TEST_P(WebViewTest, ClosingPageIsPaused) { WebViewImpl* web_view = web_view_helper_.Initialize(); - Page* page = web_view_helper_.WebView()->GetPage(); + Page* page = web_view_helper_.GetWebView()->GetPage(); EXPECT_FALSE(page->Paused()); web_view->SetOpenedByDOM();
diff --git a/third_party/WebKit/Source/core/frame/BrowserControlsTest.cpp b/third_party/WebKit/Source/core/frame/BrowserControlsTest.cpp index e434bb7a..2da3960a 100644 --- a/third_party/WebKit/Source/core/frame/BrowserControlsTest.cpp +++ b/third_party/WebKit/Source/core/frame/BrowserControlsTest.cpp
@@ -130,10 +130,10 @@ GetWebView()->MainFrameImpl()->GetDocument().GetElementById(id)); } - WebViewImpl* GetWebView() const { return helper_.WebView(); } + WebViewImpl* GetWebView() const { return helper_.GetWebView(); } LocalFrame* GetFrame() const { return helper_.LocalMainFrame()->GetFrame(); } VisualViewport& GetVisualViewport() const { - return helper_.WebView()->GetPage()->GetVisualViewport(); + return helper_.GetWebView()->GetPage()->GetVisualViewport(); } private:
diff --git a/third_party/WebKit/Source/core/frame/DOMVisualViewport.cpp b/third_party/WebKit/Source/core/frame/DOMVisualViewport.cpp index e169f1d8..73621d9 100644 --- a/third_party/WebKit/Source/core/frame/DOMVisualViewport.cpp +++ b/third_party/WebKit/Source/core/frame/DOMVisualViewport.cpp
@@ -82,12 +82,18 @@ if (!frame) return 0; + Page* page = frame->GetPage(); + if (!page) + return 0; + LocalFrameView* view = frame->View(); - if (!view) + if (!view || !view->LayoutViewportScrollableArea()) return 0; frame->GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); - float viewport_x = view->GetScrollableArea()->GetScrollOffset().Width(); + float viewport_x = + page->GetVisualViewport().GetScrollOffset().Width() + + view->LayoutViewportScrollableArea()->GetScrollOffset().Width(); return AdjustForAbsoluteZoom::AdjustScroll(viewport_x, frame->PageZoomFactor()); } @@ -97,12 +103,18 @@ if (!frame) return 0; + Page* page = frame->GetPage(); + if (!page) + return 0; + LocalFrameView* view = frame->View(); - if (!view) + if (!view || !view->LayoutViewportScrollableArea()) return 0; frame->GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); - float viewport_y = view->GetScrollableArea()->GetScrollOffset().Height(); + float viewport_y = + page->GetVisualViewport().GetScrollOffset().Height() + + view->LayoutViewportScrollableArea()->GetScrollOffset().Height(); return AdjustForAbsoluteZoom::AdjustScroll(viewport_y, frame->PageZoomFactor()); }
diff --git a/third_party/WebKit/Source/core/frame/DOMWindowEventHandlers.h b/third_party/WebKit/Source/core/frame/DOMWindowEventHandlers.h index 8f38e1f..444460d3 100644 --- a/third_party/WebKit/Source/core/frame/DOMWindowEventHandlers.h +++ b/third_party/WebKit/Source/core/frame/DOMWindowEventHandlers.h
@@ -38,6 +38,7 @@ DEFINE_STATIC_WINDOW_ATTRIBUTE_EVENT_LISTENER(afterprint); DEFINE_STATIC_WINDOW_ATTRIBUTE_EVENT_LISTENER(beforeprint); DEFINE_STATIC_WINDOW_ATTRIBUTE_EVENT_LISTENER(beforeunload); +DEFINE_STATIC_WINDOW_ATTRIBUTE_EVENT_LISTENER(freeze); DEFINE_STATIC_WINDOW_ATTRIBUTE_EVENT_LISTENER(hashchange); DEFINE_STATIC_WINDOW_ATTRIBUTE_EVENT_LISTENER(languagechange); DEFINE_STATIC_WINDOW_ATTRIBUTE_EVENT_LISTENER(message); @@ -48,6 +49,7 @@ DEFINE_STATIC_WINDOW_ATTRIBUTE_EVENT_LISTENER(pageshow); DEFINE_STATIC_WINDOW_ATTRIBUTE_EVENT_LISTENER(popstate); DEFINE_STATIC_WINDOW_ATTRIBUTE_EVENT_LISTENER(rejectionhandled); +DEFINE_STATIC_WINDOW_ATTRIBUTE_EVENT_LISTENER(resume); DEFINE_STATIC_WINDOW_ATTRIBUTE_EVENT_LISTENER(storage); DEFINE_STATIC_WINDOW_ATTRIBUTE_EVENT_LISTENER(unhandledrejection); DEFINE_STATIC_WINDOW_ATTRIBUTE_EVENT_LISTENER(unload);
diff --git a/third_party/WebKit/Source/core/frame/EmbeddedContentView.h b/third_party/WebKit/Source/core/frame/EmbeddedContentView.h index aebaeb9..fb613298 100644 --- a/third_party/WebKit/Source/core/frame/EmbeddedContentView.h +++ b/third_party/WebKit/Source/core/frame/EmbeddedContentView.h
@@ -16,7 +16,7 @@ class IntRect; // EmbeddedContentView is a pure virtual class which is implemented by -// LocalFrameView, RemoteFrameView, and PluginView. +// LocalFrameView, RemoteFrameView, and WebPluginContainerImpl. class CORE_EXPORT EmbeddedContentView : public GarbageCollectedMixin { public: virtual ~EmbeddedContentView() {}
diff --git a/third_party/WebKit/Source/core/frame/Frame.h b/third_party/WebKit/Source/core/frame/Frame.h index 62d8fd3..09e4d9c 100644 --- a/third_party/WebKit/Source/core/frame/Frame.h +++ b/third_party/WebKit/Source/core/frame/Frame.h
@@ -93,6 +93,8 @@ virtual void Detach(FrameDetachType); void DisconnectOwnerElement(); virtual bool ShouldClose() = 0; + virtual void DidFreeze() = 0; + virtual void DidResume() = 0; FrameClient* Client() const;
diff --git a/third_party/WebKit/Source/core/frame/FrameSerializer.cpp b/third_party/WebKit/Source/core/frame/FrameSerializer.cpp index d3b327ac..27cf45f 100644 --- a/third_party/WebKit/Source/core/frame/FrameSerializer.cpp +++ b/third_party/WebKit/Source/core/frame/FrameSerializer.cpp
@@ -406,7 +406,7 @@ double css_start_time = 0; if (!is_serializing_css_) { is_serializing_css_ = true; - css_start_time = MonotonicallyIncreasingTime(); + css_start_time = CurrentTimeTicksInSeconds(); } // If this CSS is inlined its definition was already serialized with the frame @@ -449,7 +449,7 @@ ("PageSerialization.SerializationTime.CSSElement", 0, maxSerializationTimeUmaMicroseconds, 50)); css_histogram.Count( - static_cast<int64_t>((MonotonicallyIncreasingTime() - css_start_time) * + static_cast<int64_t>((CurrentTimeTicksInSeconds() - css_start_time) * secondsToMicroseconds)); } } @@ -534,7 +534,7 @@ TRACE_EVENT2("page-serialization", "FrameSerializer::addImageToResources", "type", "image", "url", url.ElidedString().Utf8().data()); - double image_start_time = MonotonicallyIncreasingTime(); + double image_start_time = CurrentTimeTicksInSeconds(); scoped_refptr<const SharedBuffer> data = image->GetImage()->Data(); AddToResources(image->GetResponse().MimeType(), @@ -549,9 +549,9 @@ DEFINE_STATIC_LOCAL(CustomCountHistogram, image_histogram, ("PageSerialization.SerializationTime.ImageElement", 0, maxSerializationTimeUmaMicroseconds, 50)); - image_histogram.Count(static_cast<int64_t>( - (MonotonicallyIncreasingTime() - image_start_time) * - secondsToMicroseconds)); + image_histogram.Count( + static_cast<int64_t>((CurrentTimeTicksInSeconds() - image_start_time) * + secondsToMicroseconds)); } }
diff --git a/third_party/WebKit/Source/core/frame/FrameSerializerTest.cpp b/third_party/WebKit/Source/core/frame/FrameSerializerTest.cpp index 887ab72..91d6d3d9 100644 --- a/third_party/WebKit/Source/core/frame/FrameSerializerTest.cpp +++ b/third_party/WebKit/Source/core/frame/FrameSerializerTest.cpp
@@ -112,7 +112,7 @@ } void Serialize(const char* url) { - FrameTestHelpers::LoadFrame(helper_.WebView()->MainFrameImpl(), + FrameTestHelpers::LoadFrame(helper_.GetWebView()->MainFrameImpl(), KURL(base_url_, url).GetString().Utf8().data()); FrameSerializer serializer(resources_, *this); Frame* frame = helper_.LocalMainFrame()->GetFrame();
diff --git a/third_party/WebKit/Source/core/frame/FrameTestHelpers.cpp b/third_party/WebKit/Source/core/frame/FrameTestHelpers.cpp index 33f421b..a9e0437 100644 --- a/third_party/WebKit/Source/core/frame/FrameTestHelpers.cpp +++ b/third_party/WebKit/Source/core/frame/FrameTestHelpers.cpp
@@ -297,9 +297,9 @@ Initialize(web_frame_client, web_view_client, web_widget_client, update_settings_func); - LoadFrame(WebView()->MainFrameImpl(), url); + LoadFrame(GetWebView()->MainFrameImpl(), url); - return WebView(); + return GetWebView(); } WebViewImpl* WebViewHelper::InitializeRemote( @@ -353,7 +353,7 @@ void WebViewHelper::Resize(WebSize size) { test_web_view_client_->ClearAnimationScheduled(); - WebView()->Resize(size); + GetWebView()->Resize(size); EXPECT_FALSE(test_web_view_client_->AnimationScheduled()); test_web_view_client_->ClearAnimationScheduled(); }
diff --git a/third_party/WebKit/Source/core/frame/FrameTestHelpers.h b/third_party/WebKit/Source/core/frame/FrameTestHelpers.h index 3dc6842..f813356e 100644 --- a/third_party/WebKit/Source/core/frame/FrameTestHelpers.h +++ b/third_party/WebKit/Source/core/frame/FrameTestHelpers.h
@@ -262,7 +262,7 @@ void Reset(); - WebViewImpl* WebView() const { return web_view_; } + WebViewImpl* GetWebView() const { return web_view_; } WebLocalFrameImpl* LocalMainFrame() const; WebRemoteFrameImpl* RemoteMainFrame() const;
diff --git a/third_party/WebKit/Source/core/frame/History.cpp b/third_party/WebKit/Source/core/frame/History.cpp index 274fc81a..8b1156c 100644 --- a/third_party/WebKit/Source/core/frame/History.cpp +++ b/third_party/WebKit/Source/core/frame/History.cpp
@@ -147,7 +147,7 @@ if (state_flood_guard.count > kStateUpdateLimit) { static constexpr auto kStateUpdateLimitResetInterval = TimeDelta::FromSeconds(10); - const auto now = TimeTicks::Now(); + const auto now = CurrentTimeTicks(); if (now - state_flood_guard.last_updated > kStateUpdateLimitResetInterval) { state_flood_guard.count = 0; state_flood_guard.last_updated = now;
diff --git a/third_party/WebKit/Source/core/frame/LocalFrame.cpp b/third_party/WebKit/Source/core/frame/LocalFrame.cpp index 794adfa6..5314c37 100644 --- a/third_party/WebKit/Source/core/frame/LocalFrame.cpp +++ b/third_party/WebKit/Source/core/frame/LocalFrame.cpp
@@ -49,6 +49,7 @@ #include "core/editing/serializers/Serialization.h" #include "core/editing/spellcheck/SpellChecker.h" #include "core/editing/suggestion/TextSuggestionController.h" +#include "core/exported/WebPluginContainerImpl.h" #include "core/frame/ContentSettingsClient.h" #include "core/frame/EventHandlerRegistry.h" #include "core/frame/FrameConsole.h" @@ -76,7 +77,6 @@ #include "core/paint/ObjectPainter.h" #include "core/paint/TransformRecorder.h" #include "core/paint/compositing/PaintLayerCompositor.h" -#include "core/plugins/PluginView.h" #include "core/probe/CoreProbes.h" #include "core/svg/SVGDocumentExtensions.h" #include "core/timing/DOMWindowPerformance.h" @@ -454,6 +454,32 @@ Frame::DidChangeVisibilityState(); } +void LocalFrame::DidFreeze() { + DCHECK(RuntimeEnabledFeatures::PageLifecycleEnabled()); + if (DomWindow()) { + const double freeze_event_start = CurrentTimeTicksInSeconds(); + DomWindow()->DispatchEvent(Event::Create(EventTypeNames::freeze)); + const double freeze_event_end = CurrentTimeTicksInSeconds(); + DEFINE_STATIC_LOCAL( + CustomCountHistogram, freeze_histogram, + ("DocumentEventTiming.FreezeDuration", 0, 10000000, 50)); + freeze_histogram.Count((freeze_event_end - freeze_event_start) * 1000000.0); + } +} + +void LocalFrame::DidResume() { + DCHECK(RuntimeEnabledFeatures::PageLifecycleEnabled()); + if (DomWindow()) { + const double resume_event_start = CurrentTimeTicksInSeconds(); + DomWindow()->DispatchEvent(Event::Create(EventTypeNames::resume)); + const double resume_event_end = CurrentTimeTicksInSeconds(); + DEFINE_STATIC_LOCAL( + CustomCountHistogram, resume_histogram, + ("DocumentEventTiming.ResumeDuration", 0, 10000000, 50)); + resume_histogram.Count((resume_event_end - resume_event_start) * 1000000.0); + } +} + void LocalFrame::SetIsInert(bool inert) { is_inert_ = inert; PropagateInertToChildFrames(); @@ -1115,10 +1141,7 @@ WebPluginContainerImpl* LocalFrame::GetWebPluginContainer(Node* node) const { if (GetDocument() && GetDocument()->IsPluginDocument()) { - PluginDocument* plugin_document = ToPluginDocument(GetDocument()); - if (plugin_document->GetPluginView()) { - return plugin_document->GetPluginView()->GetWebPluginContainer(); - } + return ToPluginDocument(GetDocument())->GetPluginView(); } if (!node) { DCHECK(GetDocument());
diff --git a/third_party/WebKit/Source/core/frame/LocalFrame.h b/third_party/WebKit/Source/core/frame/LocalFrame.h index a500b4d3..94398c3a 100644 --- a/third_party/WebKit/Source/core/frame/LocalFrame.h +++ b/third_party/WebKit/Source/core/frame/LocalFrame.h
@@ -123,6 +123,8 @@ void PrintNavigationWarning(const String&) override; bool PrepareForCommit() override; void DidChangeVisibilityState() override; + void DidFreeze() override; + void DidResume() override; // This sets the is_inert_ flag and also recurses through this frame's // subtree, updating the inert bit on all descendant frames. void SetIsInert(bool) override;
diff --git a/third_party/WebKit/Source/core/frame/LocalFrameClient.h b/third_party/WebKit/Source/core/frame/LocalFrameClient.h index 8575f286..3b9d725d 100644 --- a/third_party/WebKit/Source/core/frame/LocalFrameClient.h +++ b/third_party/WebKit/Source/core/frame/LocalFrameClient.h
@@ -80,7 +80,7 @@ class HistoryItem; class KURL; class LocalFrame; -class PluginView; +class WebPluginContainerImpl; class ResourceError; class ResourceRequest; class ResourceResponse; @@ -235,13 +235,13 @@ }; virtual bool CanCreatePluginWithoutRenderer( const String& mime_type) const = 0; - virtual PluginView* CreatePlugin(HTMLPlugInElement&, - const KURL&, - const Vector<String>&, - const Vector<String>&, - const String&, - bool load_manually, - DetachedPluginPolicy) = 0; + virtual WebPluginContainerImpl* CreatePlugin(HTMLPlugInElement&, + const KURL&, + const Vector<String>&, + const Vector<String>&, + const String&, + bool load_manually, + DetachedPluginPolicy) = 0; virtual std::unique_ptr<WebMediaPlayer> CreateWebMediaPlayer( HTMLMediaElement&,
diff --git a/third_party/WebKit/Source/core/frame/LocalFrameView.cpp b/third_party/WebKit/Source/core/frame/LocalFrameView.cpp index b589877..4fa49b9 100644 --- a/third_party/WebKit/Source/core/frame/LocalFrameView.cpp +++ b/third_party/WebKit/Source/core/frame/LocalFrameView.cpp
@@ -41,6 +41,7 @@ #include "core/editing/VisibleSelection.h" #include "core/editing/markers/DocumentMarkerController.h" #include "core/events/ErrorEvent.h" +#include "core/exported/WebPluginContainerImpl.h" #include "core/frame/BrowserControls.h" #include "core/frame/EventHandlerRegistry.h" #include "core/frame/LocalFrame.h" @@ -99,7 +100,6 @@ #include "core/paint/compositing/CompositedSelection.h" #include "core/paint/compositing/CompositingInputsUpdater.h" #include "core/paint/compositing/PaintLayerCompositor.h" -#include "core/plugins/PluginView.h" #include "core/probe/CoreProbes.h" #include "core/resize_observer/ResizeObserverController.h" #include "core/style/ComputedStyle.h" @@ -3150,7 +3150,7 @@ } // TODO(leviw): We don't assert lifecycle information from documents in child -// PluginViews. +// WebPluginContainerImpls. void LocalFrameView::UpdateLifecyclePhasesInternal( DocumentLifecycle::LifecycleState target_state) { if (current_update_lifecycle_phases_target_state_ != @@ -4042,7 +4042,7 @@ SetSubtreeNeedsPaintPropertyUpdate(); } -void LocalFrameView::AddPlugin(PluginView* plugin) { +void LocalFrameView::AddPlugin(WebPluginContainerImpl* plugin) { DCHECK(!plugins_.Contains(plugin)); plugins_.insert(plugin); }
diff --git a/third_party/WebKit/Source/core/frame/LocalFrameView.h b/third_party/WebKit/Source/core/frame/LocalFrameView.h index e102c0f5..204cc74 100644 --- a/third_party/WebKit/Source/core/frame/LocalFrameView.h +++ b/third_party/WebKit/Source/core/frame/LocalFrameView.h
@@ -92,11 +92,11 @@ class PaintArtifactCompositor; class PaintController; class Page; -class PluginView; class PrintContext; class ScrollingCoordinator; class TracedValue; class TransformState; +class WebPluginContainerImpl; struct AnnotatedRegionValue; struct CompositedSelection; @@ -513,9 +513,9 @@ void AttachToLayout() override; void DetachFromLayout() override; bool IsAttached() const override { return is_attached_; } - using PluginSet = HeapHashSet<Member<PluginView>>; + using PluginSet = HeapHashSet<Member<WebPluginContainerImpl>>; const PluginSet& Plugins() const { return plugins_; } - void AddPlugin(PluginView*); + void AddPlugin(WebPluginContainerImpl*); // Custom scrollbars in PaintLayerScrollableArea need to be called with // StyleChanged whenever window focus is changed. void RemoveScrollbar(Scrollbar*);
diff --git a/third_party/WebKit/Source/core/frame/MHTMLTest.cpp b/third_party/WebKit/Source/core/frame/MHTMLTest.cpp index 3f53baa..cb1fa70 100644 --- a/third_party/WebKit/Source/core/frame/MHTMLTest.cpp +++ b/third_party/WebKit/Source/core/frame/MHTMLTest.cpp
@@ -109,11 +109,11 @@ } void LoadURLInTopFrame(const WebURL& url) { - FrameTestHelpers::LoadFrame(helper_.WebView()->MainFrameImpl(), + FrameTestHelpers::LoadFrame(helper_.GetWebView()->MainFrameImpl(), url.GetString().Utf8().data()); } - Page* GetPage() const { return helper_.WebView()->GetPage(); } + Page* GetPage() const { return helper_.GetWebView()->GetPage(); } void AddResource(const char* url, const char* mime,
diff --git a/third_party/WebKit/Source/core/frame/RemoteFrame.cpp b/third_party/WebKit/Source/core/frame/RemoteFrame.cpp index cfe9dd63..1c14d43 100644 --- a/third_party/WebKit/Source/core/frame/RemoteFrame.cpp +++ b/third_party/WebKit/Source/core/frame/RemoteFrame.cpp
@@ -127,6 +127,16 @@ return true; } +void RemoteFrame::DidFreeze() { + DCHECK(RuntimeEnabledFeatures::PageLifecycleEnabled()); + // TODO(fmeawad): Add support for remote frames. +} + +void RemoteFrame::DidResume() { + DCHECK(RuntimeEnabledFeatures::PageLifecycleEnabled()); + // TODO(fmeawad): Add support for remote frames. +} + void RemoteFrame::SetIsInert(bool inert) { if (inert != is_inert_) Client()->SetIsInert(inert);
diff --git a/third_party/WebKit/Source/core/frame/RemoteFrame.h b/third_party/WebKit/Source/core/frame/RemoteFrame.h index 5720265c..3038478 100644 --- a/third_party/WebKit/Source/core/frame/RemoteFrame.h +++ b/third_party/WebKit/Source/core/frame/RemoteFrame.h
@@ -39,6 +39,8 @@ void PrintNavigationWarning(const String&) override {} bool PrepareForCommit() override; bool ShouldClose() override; + void DidFreeze() override; + void DidResume() override; void SetIsInert(bool) override; void SetWebLayer(WebLayer*);
diff --git a/third_party/WebKit/Source/core/frame/UserActivationState.cpp b/third_party/WebKit/Source/core/frame/UserActivationState.cpp index 954fed4..d6f904a 100644 --- a/third_party/WebKit/Source/core/frame/UserActivationState.cpp +++ b/third_party/WebKit/Source/core/frame/UserActivationState.cpp
@@ -17,7 +17,7 @@ void UserActivationState::Activate() { has_been_active_ = true; is_active_ = true; - activation_timestamp_ = TimeTicks::Now(); + activation_timestamp_ = CurrentTimeTicks(); } void UserActivationState::Clear() { @@ -27,7 +27,7 @@ bool UserActivationState::IsActive() { if (is_active_ && - (TimeTicks::Now() - activation_timestamp_ > kActivationLifespan)) { + (CurrentTimeTicks() - activation_timestamp_ > kActivationLifespan)) { is_active_ = false; } return is_active_;
diff --git a/third_party/WebKit/Source/core/frame/VisualViewportTest.cpp b/third_party/WebKit/Source/core/frame/VisualViewportTest.cpp index 6a81f91..96397336 100644 --- a/third_party/WebKit/Source/core/frame/VisualViewportTest.cpp +++ b/third_party/WebKit/Source/core/frame/VisualViewportTest.cpp
@@ -123,7 +123,7 @@ blink::testing::CoreTestDataPath(WebString::FromUTF8(fileName))); } - WebViewImpl* WebView() const { return helper_.WebView(); } + WebViewImpl* WebView() const { return helper_.GetWebView(); } LocalFrame* GetFrame() const { return helper_.LocalMainFrame()->GetFrame(); } static void ConfigureSettings(WebSettings* settings) {
diff --git a/third_party/WebKit/Source/core/frame/WebFrameWidgetBase.cpp b/third_party/WebKit/Source/core/frame/WebFrameWidgetBase.cpp index 1bcd9728..b862052 100644 --- a/third_party/WebKit/Source/core/frame/WebFrameWidgetBase.cpp +++ b/third_party/WebKit/Source/core/frame/WebFrameWidgetBase.cpp
@@ -165,7 +165,7 @@ WebMouseEvent fake_mouse_move( WebInputEvent::kMouseMove, point_in_root_frame, screen_point, WebPointerProperties::Button::kLeft, 0, WebInputEvent::kNoModifiers, - TimeTicks::Now().InSeconds()); + CurrentTimeTicks().InSeconds()); fake_mouse_move.SetFrameScale(1); ToCoreFrame(LocalRoot()) ->GetEventHandler() @@ -367,7 +367,7 @@ RuntimeEnabledFeatures::TouchpadAndWheelScrollLatchingEnabled(); WebMouseWheelEvent synthetic_wheel(WebInputEvent::kMouseWheel, fling_modifier_, - WTF::MonotonicallyIncreasingTime()); + WTF::CurrentTimeTicksInSeconds()); const float kTickDivisor = WheelEvent::kTickMultiplier; synthetic_wheel.delta_x = delta.width; @@ -511,7 +511,7 @@ WebInputEvent::Type type, WebGestureDevice source_device) const { WebGestureEvent gesture_event(type, fling_modifier_, - WTF::MonotonicallyIncreasingTime()); + WTF::CurrentTimeTicksInSeconds()); gesture_event.source_device = source_device; gesture_event.x = position_on_fling_start_.x; gesture_event.y = position_on_fling_start_.y;
diff --git a/third_party/WebKit/Source/core/frame/WindowEventHandlers.idl b/third_party/WebKit/Source/core/frame/WindowEventHandlers.idl index 9bd850d0..a83cb64f 100644 --- a/third_party/WebKit/Source/core/frame/WindowEventHandlers.idl +++ b/third_party/WebKit/Source/core/frame/WindowEventHandlers.idl
@@ -38,6 +38,7 @@ attribute EventHandler onbeforeprint; // FIXME: onbeforeunload should be an OnBeforeUnloadEventHandler. attribute EventHandler onbeforeunload; + [RuntimeEnabled=PageLifecycle] attribute EventHandler onfreeze; attribute EventHandler onhashchange; attribute EventHandler onlanguagechange; attribute EventHandler onmessage; @@ -48,6 +49,7 @@ attribute EventHandler onpageshow; attribute EventHandler onpopstate; attribute EventHandler onrejectionhandled; + [RuntimeEnabled=PageLifecycle] attribute EventHandler onresume; attribute EventHandler onstorage; attribute EventHandler onunhandledrejection; attribute EventHandler onunload;
diff --git a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp index fb188918..accfb7f 100644 --- a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
@@ -425,7 +425,7 @@ if (LowLatencyEnabled() && !dirty_rect_.IsEmpty()) { // Push a frame - double start_time = WTF::MonotonicallyIncreasingTime(); + double start_time = WTF::CurrentTimeTicksInSeconds(); scoped_refptr<StaticBitmapImage> image = image_buffer_->NewImageSnapshot( kPreferAcceleration, kSnapshotReasonLowLatencyFrame); FloatRect src_rect(0, 0, Size().Width(), Size().Height()); @@ -868,7 +868,7 @@ return; } - double start_time = WTF::MonotonicallyIncreasingTime(); + double start_time = WTF::CurrentTimeTicksInSeconds(); double quality = kUndefinedQualityValue; if (!quality_argument.IsEmpty()) { v8::Local<v8::Value> v8_value = quality_argument.V8Value();
diff --git a/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp b/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp index c6f4e89..a9aa8bdb 100644 --- a/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp
@@ -25,6 +25,7 @@ #include "core/dom/AXObjectCache.h" #include "core/dom/ExceptionCode.h" #include "core/dom/events/Event.h" +#include "core/exported/WebPluginContainerImpl.h" #include "core/frame/LocalFrame.h" #include "core/frame/LocalFrameClient.h" #include "core/frame/LocalFrameView.h" @@ -35,7 +36,6 @@ #include "core/loader/FrameLoadRequest.h" #include "core/loader/FrameLoader.h" #include "core/page/Page.h" -#include "core/plugins/PluginView.h" #include "platform/heap/HeapAllocator.h" #include "platform/weborigin/SecurityOrigin.h" #include "public/platform/modules/fetch/fetch_api_request.mojom-shared.h" @@ -44,7 +44,7 @@ namespace { -using PluginSet = PersistentHeapHashSet<Member<PluginView>>; +using PluginSet = PersistentHeapHashSet<Member<WebPluginContainerImpl>>; PluginSet& PluginsPendingDispose() { DEFINE_STATIC_LOCAL(PluginSet, set, ()); return set; @@ -172,7 +172,7 @@ return content_frame_ && HTMLElement::IsKeyboardFocusable(); } -void HTMLFrameOwnerElement::DisposePluginSoon(PluginView* plugin) { +void HTMLFrameOwnerElement::DisposePluginSoon(WebPluginContainerImpl* plugin) { if (PluginDisposeSuspendScope::suspend_count_) { PluginsPendingDispose().insert(plugin); PluginDisposeSuspendScope::suspend_count_ |= 1; @@ -233,7 +233,7 @@ if (embedded_content_view_->IsAttached()) { embedded_content_view_->DetachFromLayout(); if (embedded_content_view_->IsPluginView()) - DisposePluginSoon(ToPluginView(embedded_content_view_)); + DisposePluginSoon(ToWebPluginContainerImpl(embedded_content_view_)); else embedded_content_view_->Dispose(); }
diff --git a/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.h b/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.h index 83438bc..b8744cbc 100644 --- a/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.h +++ b/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.h
@@ -38,7 +38,7 @@ class ExceptionState; class Frame; class LayoutEmbeddedContent; -class PluginView; +class WebPluginContainerImpl; class CORE_EXPORT HTMLFrameOwnerElement : public HTMLElement, public FrameOwner { @@ -126,7 +126,7 @@ bool replace_current_item); bool IsKeyboardFocusable() const override; - void DisposePluginSoon(PluginView*); + void DisposePluginSoon(WebPluginContainerImpl*); void FrameOwnerPropertiesChanged(); // Return the origin which is to be used for feature policy container
diff --git a/third_party/WebKit/Source/core/html/HTMLObjectElement.cpp b/third_party/WebKit/Source/core/html/HTMLObjectElement.cpp index 325739e..94e8423 100644 --- a/third_party/WebKit/Source/core/html/HTMLObjectElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLObjectElement.cpp
@@ -32,6 +32,7 @@ #include "core/dom/SyncReattachContext.h" #include "core/dom/TagCollection.h" #include "core/dom/Text.h" +#include "core/exported/WebPluginContainerImpl.h" #include "core/frame/LocalFrame.h" #include "core/frame/LocalFrameClient.h" #include "core/frame/Settings.h" @@ -41,7 +42,6 @@ #include "core/html/parser/HTMLParserIdioms.h" #include "core/html_names.h" #include "core/layout/api/LayoutEmbeddedItem.h" -#include "core/plugins/PluginView.h" #include "platform/network/mime/MIMETypeRegistry.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp b/third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp index 0f7fb235..435d158 100644 --- a/third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp
@@ -28,6 +28,7 @@ #include "core/dom/Node.h" #include "core/dom/ShadowRoot.h" #include "core/dom/events/Event.h" +#include "core/exported/WebPluginContainerImpl.h" #include "core/frame/LocalFrame.h" #include "core/frame/LocalFrameClient.h" #include "core/frame/LocalFrameView.h" @@ -45,7 +46,6 @@ #include "core/loader/MixedContentChecker.h" #include "core/page/Page.h" #include "core/page/scrolling/ScrollingCoordinator.h" -#include "core/plugins/PluginView.h" #include "platform/Histogram.h" #include "platform/bindings/V8PerIsolateData.h" #include "platform/loader/fetch/ResourceRequest.h" @@ -101,7 +101,7 @@ return image_loader_ && image_loader_->HasPendingActivity(); } -void HTMLPlugInElement::SetPersistedPlugin(PluginView* plugin) { +void HTMLPlugInElement::SetPersistedPlugin(WebPluginContainerImpl* plugin) { if (persisted_plugin_ == plugin) return; if (persisted_plugin_) { @@ -112,7 +112,7 @@ } void HTMLPlugInElement::SetFocused(bool focused, WebFocusType focus_type) { - PluginView* plugin = OwnedPlugin(); + WebPluginContainerImpl* plugin = OwnedPlugin(); if (plugin) plugin->SetFocused(focused, focus_type); HTMLFrameOwnerElement::SetFocused(focused, focus_type); @@ -168,7 +168,7 @@ void HTMLPlugInElement::RemoveAllEventListeners() { HTMLFrameOwnerElement::RemoveAllEventListeners(); - PluginView* plugin = OwnedPlugin(); + WebPluginContainerImpl* plugin = OwnedPlugin(); if (plugin) plugin->EventListenersRemoved(); } @@ -265,7 +265,7 @@ } bool HTMLPlugInElement::ShouldAccelerate() const { - PluginView* plugin = OwnedPlugin(); + WebPluginContainerImpl* plugin = OwnedPlugin(); return plugin && plugin->PlatformLayer(); } @@ -297,9 +297,9 @@ } // Only try to persist a plugin we actually own. - PluginView* plugin = OwnedPlugin(); + WebPluginContainerImpl* plugin = OwnedPlugin(); if (plugin && context.performing_reattach) { - SetPersistedPlugin(ToPluginView(ReleaseEmbeddedContentView())); + SetPersistedPlugin(ToWebPluginContainerImpl(ReleaseEmbeddedContentView())); } else { // Clear the plugin; will trigger disposal of it with Oilpan. SetEmbeddedContentView(nullptr); @@ -352,7 +352,7 @@ // edge-case is OK. v8::Isolate* isolate = V8PerIsolateData::MainThreadIsolate(); if (plugin_wrapper_.IsEmpty()) { - PluginView* plugin; + WebPluginContainerImpl* plugin; if (persisted_plugin_) plugin = persisted_plugin_; @@ -365,17 +365,17 @@ return plugin_wrapper_.Get(isolate); } -PluginView* HTMLPlugInElement::PluginEmbeddedContentView() const { +WebPluginContainerImpl* HTMLPlugInElement::PluginEmbeddedContentView() const { if (LayoutEmbeddedContent* layout_embedded_content = LayoutEmbeddedContentForJSBindings()) return layout_embedded_content->Plugin(); return nullptr; } -PluginView* HTMLPlugInElement::OwnedPlugin() const { +WebPluginContainerImpl* HTMLPlugInElement::OwnedPlugin() const { EmbeddedContentView* view = OwnedEmbeddedContentView(); if (view && view->IsPluginView()) - return ToPluginView(view); + return ToWebPluginContainerImpl(view); return nullptr; } @@ -428,7 +428,7 @@ .ShowsUnavailablePluginIndicator()) return; } - PluginView* plugin = OwnedPlugin(); + WebPluginContainerImpl* plugin = OwnedPlugin(); if (!plugin) return; plugin->HandleEvent(event); @@ -464,7 +464,6 @@ bool HTMLPlugInElement::IsErrorplaceholder() { if (PluginEmbeddedContentView() && - PluginEmbeddedContentView()->IsPluginContainer() && PluginEmbeddedContentView()->IsErrorplaceholder()) return true; return false; @@ -588,7 +587,7 @@ LocalFrameClient::DetachedPluginPolicy policy = require_layout_object ? LocalFrameClient::kFailOnDetachedPlugin : LocalFrameClient::kAllowDetachedPlugin; - PluginView* plugin = + WebPluginContainerImpl* plugin = frame->Client()->CreatePlugin(*this, url, param_names, param_values, mime_type, load_manually, policy); if (!plugin) {
diff --git a/third_party/WebKit/Source/core/html/HTMLPlugInElement.h b/third_party/WebKit/Source/core/html/HTMLPlugInElement.h index 70d913e..8c7e42a 100644 --- a/third_party/WebKit/Source/core/html/HTMLPlugInElement.h +++ b/third_party/WebKit/Source/core/html/HTMLPlugInElement.h
@@ -35,7 +35,7 @@ class HTMLImageLoader; class LayoutEmbeddedContent; class LayoutEmbeddedItem; -class PluginView; +class WebPluginContainerImpl; enum PreferPlugInsForImagesOption { kShouldPreferPlugInsForImages, @@ -66,8 +66,8 @@ // PluginEmbeddedContentView will synchronously create the plugin if required // by calling LayoutEmbeddedContentForJSBindings. Possibly the // PluginEmbeddedContentView code can be inlined into PluginWrapper. - PluginView* PluginEmbeddedContentView() const; - PluginView* OwnedPlugin() const; + WebPluginContainerImpl* PluginEmbeddedContentView() const; + WebPluginContainerImpl* OwnedPlugin() const; bool CanProcessDrag() const; const String& Url() const { return url_; } @@ -178,7 +178,7 @@ }; ObjectContentType GetObjectContentType(); - void SetPersistedPlugin(PluginView*); + void SetPersistedPlugin(WebPluginContainerImpl*); bool RequestObjectInternal(const Vector<String>& param_names, const Vector<String>& param_values); @@ -197,7 +197,7 @@ // that OwnedEmbeddedContentView() != null means the frame is active, we save // off embedded_content_view_ here while the plugin is persisting but not // being displayed. - Member<PluginView> persisted_plugin_; + Member<WebPluginContainerImpl> persisted_plugin_; }; inline bool IsHTMLPlugInElement(const HTMLElement& element) {
diff --git a/third_party/WebKit/Source/core/html/PluginDocument.cpp b/third_party/WebKit/Source/core/html/PluginDocument.cpp index 057615b..eff3aea 100644 --- a/third_party/WebKit/Source/core/html/PluginDocument.cpp +++ b/third_party/WebKit/Source/core/html/PluginDocument.cpp
@@ -26,6 +26,7 @@ #include "bindings/core/v8/ExceptionState.h" #include "core/dom/RawDataDocumentParser.h" +#include "core/exported/WebPluginContainerImpl.h" #include "core/frame/LocalFrame.h" #include "core/frame/LocalFrameClient.h" #include "core/frame/LocalFrameView.h" @@ -38,7 +39,6 @@ #include "core/layout/LayoutEmbeddedObject.h" #include "core/loader/DocumentLoader.h" #include "core/loader/FrameLoader.h" -#include "core/plugins/PluginView.h" namespace blink { @@ -66,7 +66,7 @@ void CreateDocumentStructure(); - PluginView* GetPluginView() const; + WebPluginContainerImpl* GetPluginView() const; Member<HTMLEmbedElement> embed_element_; }; @@ -123,8 +123,9 @@ GetDocument()->UpdateStyleAndLayout(); - // We need the plugin to load synchronously so we can get the PluginView - // below so flush the layout tasks now instead of waiting on the timer. + // We need the plugin to load synchronously so we can get the + // WebPluginContainerImpl below so flush the layout tasks now instead of + // waiting on the timer. frame->View()->FlushAnyPendingPostLayoutTasks(); // Focus the plugin here, as the line above is where the plugin is created. if (frame->IsMainFrame()) { @@ -136,7 +137,7 @@ } } - if (PluginView* view = GetPluginView()) + if (WebPluginContainerImpl* view = GetPluginView()) view->DidReceiveResponse(GetDocument()->Loader()->GetResponse()); } @@ -149,7 +150,7 @@ if (!length) return; - if (PluginView* view = GetPluginView()) + if (WebPluginContainerImpl* view = GetPluginView()) view->DidReceiveData(data, length); } @@ -158,7 +159,7 @@ RawDataDocumentParser::Finish(); } -PluginView* PluginDocumentParser::GetPluginView() const { +WebPluginContainerImpl* PluginDocumentParser::GetPluginView() const { return ToPluginDocument(GetDocument())->GetPluginView(); } @@ -172,7 +173,7 @@ return PluginDocumentParser::Create(this); } -PluginView* PluginDocument::GetPluginView() { +WebPluginContainerImpl* PluginDocument::GetPluginView() { return plugin_node_ ? plugin_node_->OwnedPlugin() : nullptr; }
diff --git a/third_party/WebKit/Source/core/html/PluginDocument.h b/third_party/WebKit/Source/core/html/PluginDocument.h index d94c39f0..ddba4ccc 100644 --- a/third_party/WebKit/Source/core/html/PluginDocument.h +++ b/third_party/WebKit/Source/core/html/PluginDocument.h
@@ -31,7 +31,7 @@ namespace blink { class HTMLPlugInElement; -class PluginView; +class WebPluginContainerImpl; class CORE_EXPORT PluginDocument final : public HTMLDocument { public: @@ -44,7 +44,7 @@ } HTMLPlugInElement* PluginNode() { return plugin_node_; } - PluginView* GetPluginView(); + WebPluginContainerImpl* GetPluginView(); void Shutdown() override;
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp index 9da17848..42c31fd2 100644 --- a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp +++ b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp
@@ -50,7 +50,7 @@ bool IsDeadlineNearOrPassed(double deadline_seconds) { return (deadline_seconds - kSlackBeforeDeadline - - MonotonicallyIncreasingTime() <= + CurrentTimeTicksInSeconds() <= 0); } @@ -310,7 +310,7 @@ } void CanvasAsyncBlobCreator::ScheduleInitiateEncoding(double quality) { - schedule_idle_task_start_time_ = WTF::MonotonicallyIncreasingTime(); + schedule_idle_task_start_time_ = WTF::CurrentTimeTicksInSeconds(); Platform::Current()->CurrentThread()->Scheduler()->PostIdleTask( BLINK_FROM_HERE, WTF::Bind(&CanvasAsyncBlobCreator::InitiateEncoding, WrapPersistent(this), quality)); @@ -323,7 +323,7 @@ } RecordElapsedTimeHistogram( kInitiateEncodingDelay, mime_type_, - WTF::MonotonicallyIncreasingTime() - schedule_idle_task_start_time_); + WTF::CurrentTimeTicksInSeconds() - schedule_idle_task_start_time_); DCHECK(idle_task_status_ == kIdleTaskNotStarted); idle_task_status_ = kIdleTaskStarted; @@ -334,7 +334,7 @@ } // Re-use this time variable to collect data on complete encoding delay - schedule_idle_task_start_time_ = WTF::MonotonicallyIncreasingTime(); + schedule_idle_task_start_time_ = WTF::CurrentTimeTicksInSeconds(); IdleEncodeRows(deadline_seconds); } @@ -362,7 +362,7 @@ idle_task_status_ = kIdleTaskCompleted; double elapsed_time = - WTF::MonotonicallyIncreasingTime() - schedule_idle_task_start_time_; + WTF::CurrentTimeTicksInSeconds() - schedule_idle_task_start_time_; RecordElapsedTimeHistogram(kCompleteEncodingDelay, mime_type_, elapsed_time); if (IsDeadlineNearOrPassed(deadline_seconds)) { context_->GetTaskRunner(TaskType::kCanvasBlobSerialization) @@ -403,7 +403,7 @@ void CanvasAsyncBlobCreator::CreateBlobAndReturnResult() { RecordIdleTaskStatusHistogram(idle_task_status_); RecordElapsedTimeHistogram(kToBlobDuration, mime_type_, - WTF::MonotonicallyIncreasingTime() - start_time_); + WTF::CurrentTimeTicksInSeconds() - start_time_); Blob* result_blob = Blob::Create(encoded_image_.data(), encoded_image_.size(), ConvertMimeTypeEnumToString(mime_type_));
diff --git a/third_party/WebKit/Source/core/html/forms/ExternalPopupMenuTest.cpp b/third_party/WebKit/Source/core/html/forms/ExternalPopupMenuTest.cpp index 0b5a1a01..917bb4a 100644 --- a/third_party/WebKit/Source/core/html/forms/ExternalPopupMenuTest.cpp +++ b/third_party/WebKit/Source/core/html/forms/ExternalPopupMenuTest.cpp
@@ -118,7 +118,7 @@ WebView()->UpdateAllLifecyclePhases(); } - WebViewImpl* WebView() const { return helper_.WebView(); } + WebViewImpl* WebView() const { return helper_.GetWebView(); } const ExternalPopupMenuWebFrameClient& Client() const { return web_frame_client_; }
diff --git a/third_party/WebKit/Source/core/html/media/AutoplayUmaHelper.cpp b/third_party/WebKit/Source/core/html/media/AutoplayUmaHelper.cpp index f9e8598..2006eeb 100644 --- a/third_party/WebKit/Source/core/html/media/AutoplayUmaHelper.cpp +++ b/third_party/WebKit/Source/core/html/media/AutoplayUmaHelper.cpp
@@ -66,15 +66,15 @@ void AutoplayUmaHelper::OnLoadStarted() { if (element_->GetLoadType() == WebMediaPlayer::kLoadTypeURL) - load_start_time_ms_ = MonotonicallyIncreasingTimeMS(); + load_start_time_ms_ = CurrentTimeTicksInMilliseconds(); } void AutoplayUmaHelper::OnAutoplayInitiated(AutoplaySource source) { int32_t autoplay_wait_time_ms = -1; if (load_start_time_ms_ != 0.0) { - autoplay_wait_time_ms = static_cast<int32_t>( - std::min<int64_t>(MonotonicallyIncreasingTimeMS() - load_start_time_ms_, - std::numeric_limits<int32_t>::max())); + autoplay_wait_time_ms = static_cast<int32_t>(std::min<int64_t>( + CurrentTimeTicksInMilliseconds() - load_start_time_ms_, + std::numeric_limits<int32_t>::max())); } DEFINE_STATIC_LOCAL(EnumerationHistogram, video_histogram, ("Media.Video.Autoplay", @@ -335,11 +335,11 @@ if (is_visible) { muted_video_autoplay_offscreen_duration_ms_ += - static_cast<int64_t>(MonotonicallyIncreasingTimeMS()) - + static_cast<int64_t>(CurrentTimeTicksInMilliseconds()) - muted_video_autoplay_offscreen_start_time_ms_; } else { muted_video_autoplay_offscreen_start_time_ms_ = - static_cast<int64_t>(MonotonicallyIncreasingTimeMS()); + static_cast<int64_t>(CurrentTimeTicksInMilliseconds()); } is_visible_ = is_visible; @@ -413,7 +413,7 @@ // Start recording muted video playing offscreen duration. muted_video_autoplay_offscreen_start_time_ms_ = - static_cast<int64_t>(MonotonicallyIncreasingTimeMS()); + static_cast<int64_t>(CurrentTimeTicksInMilliseconds()); is_visible_ = false; muted_video_offscreen_duration_visibility_observer_ = new ElementVisibilityObserver( @@ -432,7 +432,7 @@ if (!is_visible_) { muted_video_autoplay_offscreen_duration_ms_ += - static_cast<int64_t>(MonotonicallyIncreasingTimeMS()) - + static_cast<int64_t>(CurrentTimeTicksInMilliseconds()) - muted_video_autoplay_offscreen_start_time_ms_; }
diff --git a/third_party/WebKit/Source/core/html/media/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/media/HTMLMediaElement.cpp index ed443da..9f72e924 100644 --- a/third_party/WebKit/Source/core/html/media/HTMLMediaElement.cpp +++ b/third_party/WebKit/Source/core/html/media/HTMLMediaElement.cpp
@@ -2613,7 +2613,7 @@ void HTMLMediaElement::ScheduleTimeupdateEvent(bool periodic_event) { // Per spec, consult current playback position to check for changing time. double media_time = CurrentPlaybackPosition(); - TimeTicks now = TimeTicks::Now(); + TimeTicks now = CurrentTimeTicks(); bool have_not_recently_fired_timeupdate = (now - last_time_update_event_wall_time_) >= kMaxTimeupdateEventFrequency;
diff --git a/third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.cpp b/third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.cpp index 48e787b..b531720 100644 --- a/third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.cpp +++ b/third_party/WebKit/Source/core/html/parser/CSSPreloadScanner.cpp
@@ -298,7 +298,7 @@ // TODO(csharrison): If this becomes an issue the CSSPreloadScanner may be // augmented to take care of this case without performing an additional // copy. - double start_time = MonotonicallyIncreasingTimeMS(); + double start_time = CurrentTimeTicksInMilliseconds(); const String& chunk = resource->SheetText(nullptr); if (chunk.IsNull()) return; @@ -318,8 +318,8 @@ resource->GetResponse().Url()); DEFINE_STATIC_LOCAL(CustomCountHistogram, css_scan_time_histogram, ("PreloadScanner.ExternalCSS.ScanTime", 1, 1000000, 50)); - css_scan_time_histogram.Count((MonotonicallyIncreasingTimeMS() - start_time) * - 1000); + css_scan_time_histogram.Count( + (CurrentTimeTicksInMilliseconds() - start_time) * 1000); FetchPreloads(preloads); }
diff --git a/third_party/WebKit/Source/core/html/parser/PreloadRequest.h b/third_party/WebKit/Source/core/html/parser/PreloadRequest.h index d577f6bd..f5b2bdb 100644 --- a/third_party/WebKit/Source/core/html/parser/PreloadRequest.h +++ b/third_party/WebKit/Source/core/html/parser/PreloadRequest.h
@@ -132,7 +132,7 @@ resource_type_(resource_type), script_type_(ScriptType::kClassic), cross_origin_(kCrossOriginAttributeNotSet), - discovery_time_(MonotonicallyIncreasingTime()), + discovery_time_(CurrentTimeTicksInSeconds()), defer_(FetchParameters::kNoDefer), resource_width_(resource_width), client_hints_preferences_(client_hints_preferences),
diff --git a/third_party/WebKit/Source/core/input/EventHandler.cpp b/third_party/WebKit/Source/core/input/EventHandler.cpp index 01b57e35..c761060 100644 --- a/third_party/WebKit/Source/core/input/EventHandler.cpp +++ b/third_party/WebKit/Source/core/input/EventHandler.cpp
@@ -1637,7 +1637,7 @@ // If the Tap is received very shortly after ShowPress, we want to // delay clearing of the active state so that it's visible to the user // for at least a couple of frames. - active_interval = TimeTicks::Now() - + active_interval = CurrentTimeTicks() - gesture_manager_->GetLastShowPressTimestamp().value(); should_keep_active_for_min_interval = active_interval < kMinimumActiveInterval; @@ -1877,7 +1877,7 @@ WebFloatPoint(location_in_root_frame.X(), location_in_root_frame.Y()), WebFloatPoint(global_position.X(), global_position.Y()), WebPointerProperties::Button::kNoButton, /* clickCount */ 0, - WebInputEvent::kNoModifiers, TimeTicks::Now().InSeconds(), source_type); + WebInputEvent::kNoModifiers, CurrentTimeTicks().InSeconds(), source_type); // TODO(dtapuska): Transition the mouseEvent to be created really in viewport // coordinates instead of root frame coordinates.
diff --git a/third_party/WebKit/Source/core/input/EventHandlerTest.cpp b/third_party/WebKit/Source/core/input/EventHandlerTest.cpp index f3dbc86..10be917 100644 --- a/third_party/WebKit/Source/core/input/EventHandlerTest.cpp +++ b/third_party/WebKit/Source/core/input/EventHandlerTest.cpp
@@ -45,7 +45,7 @@ TapEventBuilder(IntPoint position, int tap_count) : WebGestureEvent(WebInputEvent::kGestureTap, WebInputEvent::kNoModifiers, - TimeTicks::Now().InSeconds()) { + CurrentTimeTicks().InSeconds()) { x = global_x = position.X(); y = global_y = position.Y(); source_device = kWebGestureDeviceTouchscreen; @@ -76,7 +76,7 @@ WebMouseEvent::Button button_param) : WebMouseEvent(WebInputEvent::kMouseDown, WebInputEvent::kNoModifiers, - TimeTicks::Now().InSeconds()) { + CurrentTimeTicks().InSeconds()) { click_count = click_count_param; button = button_param; SetPositionInWidget(position_param.X(), position_param.Y()); @@ -146,10 +146,9 @@ GetDocument().GetFrame()->GetEventHandler().HandleMouseMoveEvent( mouse_move_event, Vector<WebMouseEvent>()); - GetPage().GetAutoscrollController().Animate( - WTF::MonotonicallyIncreasingTime()); + GetPage().GetAutoscrollController().Animate(WTF::CurrentTimeTicksInSeconds()); GetPage().Animator().ServiceScriptedAnimations( - WTF::MonotonicallyIncreasingTime()); + WTF::CurrentTimeTicksInSeconds()); WebMouseEvent mouse_up_event( WebMouseEvent::kMouseUp, WebFloatPoint(100, 50), WebFloatPoint(200, 250), @@ -536,10 +535,11 @@ SelectionInDOMTree::Builder() .Collapse(Position(GetDocument().body(), 0)) .Build()); - WebMouseEvent mouse_down_event( - WebMouseEvent::kMouseDown, WebFloatPoint(0, 0), WebFloatPoint(100, 200), - WebPointerProperties::Button::kRight, 1, - WebInputEvent::Modifiers::kRightButtonDown, TimeTicks::Now().InSeconds()); + WebMouseEvent mouse_down_event(WebMouseEvent::kMouseDown, WebFloatPoint(0, 0), + WebFloatPoint(100, 200), + WebPointerProperties::Button::kRight, 1, + WebInputEvent::Modifiers::kRightButtonDown, + CurrentTimeTicks().InSeconds()); mouse_down_event.SetFrameScale(1); EXPECT_EQ(WebInputEventResult::kHandledApplication, GetDocument().GetFrame()->GetEventHandler().SendContextMenuEvent( @@ -693,18 +693,20 @@ "<style>.box { width: 100px; height: 100px; display: block; }</style>" "<a class='box' href=''>Drag me</a>"); - WebMouseEvent mouse_down_event( - WebInputEvent::kMouseDown, WebFloatPoint(50, 50), WebFloatPoint(50, 50), - WebPointerProperties::Button::kLeft, 1, - WebInputEvent::Modifiers::kLeftButtonDown, TimeTicks::Now().InSeconds()); + WebMouseEvent mouse_down_event(WebInputEvent::kMouseDown, + WebFloatPoint(50, 50), WebFloatPoint(50, 50), + WebPointerProperties::Button::kLeft, 1, + WebInputEvent::Modifiers::kLeftButtonDown, + CurrentTimeTicks().InSeconds()); mouse_down_event.SetFrameScale(1); GetDocument().GetFrame()->GetEventHandler().HandleMousePressEvent( mouse_down_event); - WebMouseEvent mouse_move_event( - WebInputEvent::kMouseMove, WebFloatPoint(51, 50), WebFloatPoint(51, 50), - WebPointerProperties::Button::kLeft, 1, - WebInputEvent::Modifiers::kLeftButtonDown, TimeTicks::Now().InSeconds()); + WebMouseEvent mouse_move_event(WebInputEvent::kMouseMove, + WebFloatPoint(51, 50), WebFloatPoint(51, 50), + WebPointerProperties::Button::kLeft, 1, + WebInputEvent::Modifiers::kLeftButtonDown, + CurrentTimeTicks().InSeconds()); mouse_move_event.SetFrameScale(1); GetDocument().GetFrame()->GetEventHandler().HandleMouseMoveEvent( mouse_move_event, Vector<WebMouseEvent>()); @@ -718,7 +720,7 @@ WebMouseEvent mouse_up_event( WebInputEvent::kMouseUp, WebFloatPoint(100, 50), WebFloatPoint(200, 250), WebPointerProperties::Button::kLeft, 1, WebInputEvent::kNoModifiers, - TimeTicks::Now().InSeconds()); + CurrentTimeTicks().InSeconds()); mouse_up_event.SetFrameScale(1); GetDocument().GetFrame()->GetEventHandler().DragSourceEndedAt( mouse_up_event, kDragOperationNone); @@ -806,7 +808,7 @@ WebMouseEvent mouse_move_event( WebInputEvent::kMouseMove, WebFloatPoint(51, 50), WebFloatPoint(51, 50), WebPointerProperties::Button::kNoButton, 0, WebInputEvent::kNoModifiers, - TimeTicks::Now().InSeconds()); + CurrentTimeTicks().InSeconds()); mouse_move_event.SetFrameScale(1); GetDocument().GetFrame()->GetEventHandler().HandleMouseMoveEvent( mouse_move_event, Vector<WebMouseEvent>()); @@ -816,7 +818,7 @@ WebMouseEvent mouse_leave_event( WebInputEvent::kMouseLeave, WebFloatPoint(0, 0), WebFloatPoint(0, 0), WebPointerProperties::Button::kNoButton, 0, WebInputEvent::kNoModifiers, - TimeTicks::Now().InSeconds()); + CurrentTimeTicks().InSeconds()); mouse_leave_event.SetFrameScale(1); GetDocument().GetFrame()->GetEventHandler().HandleMouseLeaveEvent( mouse_leave_event); @@ -875,7 +877,7 @@ WebMouseEvent mouse_press_event( WebInputEvent::kMouseDown, WebFloatPoint(51, 50), WebFloatPoint(51, 50), WebPointerProperties::Button::kLeft, 0, WebInputEvent::kNoModifiers, - TimeTicks::Now().InSeconds()); + CurrentTimeTicks().InSeconds()); mouse_press_event.SetFrameScale(1); GetDocument().GetFrame()->GetEventHandler().HandleMousePressEvent( mouse_press_event); @@ -933,7 +935,7 @@ WebMouseEvent mouse_back_event( WebInputEvent::kMouseUp, WebFloatPoint(51, 50), WebFloatPoint(51, 50), WebPointerProperties::Button::kBack, 0, WebInputEvent::kNoModifiers, - TimeTicks::Now().InSeconds()); + CurrentTimeTicks().InSeconds()); mouse_back_event.SetFrameScale(1); GetDocument().GetFrame()->GetEventHandler().HandleMouseReleaseEvent( mouse_back_event); @@ -943,7 +945,7 @@ WebMouseEvent mouse_forward_event( WebInputEvent::kMouseUp, WebFloatPoint(51, 50), WebFloatPoint(51, 50), WebPointerProperties::Button::kForward, 0, WebInputEvent::kNoModifiers, - TimeTicks::Now().InSeconds()); + CurrentTimeTicks().InSeconds()); mouse_forward_event.SetFrameScale(1); GetDocument().GetFrame()->GetEventHandler().HandleMouseReleaseEvent( mouse_forward_event); @@ -965,7 +967,7 @@ WebMouseEvent mouse_back_event( WebInputEvent::kMouseUp, WebFloatPoint(51, 50), WebFloatPoint(51, 50), WebPointerProperties::Button::kBack, 0, WebInputEvent::kNoModifiers, - TimeTicks::Now().InSeconds()); + CurrentTimeTicks().InSeconds()); mouse_back_event.SetFrameScale(1); GetDocument().GetFrame()->GetEventHandler().HandleMouseReleaseEvent( mouse_back_event); @@ -975,7 +977,7 @@ WebMouseEvent mouse_forward_event( WebInputEvent::kMouseUp, WebFloatPoint(51, 50), WebFloatPoint(51, 50), WebPointerProperties::Button::kForward, 0, WebInputEvent::kNoModifiers, - TimeTicks::Now().InSeconds()); + CurrentTimeTicks().InSeconds()); mouse_forward_event.SetFrameScale(1); GetDocument().GetFrame()->GetEventHandler().HandleMouseReleaseEvent( mouse_forward_event);
diff --git a/third_party/WebKit/Source/core/input/GestureManager.cpp b/third_party/WebKit/Source/core/input/GestureManager.cpp index 6b8e9bc25..474a942e 100644 --- a/third_party/WebKit/Source/core/input/GestureManager.cpp +++ b/third_party/WebKit/Source/core/input/GestureManager.cpp
@@ -413,7 +413,7 @@ } WebInputEventResult GestureManager::HandleGestureShowPress() { - last_show_press_timestamp_ = TimeTicks::Now(); + last_show_press_timestamp_ = CurrentTimeTicks(); LocalFrameView* view = frame_->View(); if (!view)
diff --git a/third_party/WebKit/Source/core/input/ImeOnFocusTest.cpp b/third_party/WebKit/Source/core/input/ImeOnFocusTest.cpp index 663fdbc2..d81c882 100644 --- a/third_party/WebKit/Source/core/input/ImeOnFocusTest.cpp +++ b/third_party/WebKit/Source/core/input/ImeOnFocusTest.cpp
@@ -101,7 +101,7 @@ web_view_helper_.Initialize(nullptr, nullptr, &client); web_view->Resize(WebSize(800, 1200)); LoadFrame(web_view->MainFrameImpl(), base_url_ + file_name); - document_ = web_view_helper_.WebView() + document_ = web_view_helper_.GetWebView() ->MainFrameImpl() ->GetDocument() .Unwrap<Document>();
diff --git a/third_party/WebKit/Source/core/input/MouseEventManager.cpp b/third_party/WebKit/Source/core/input/MouseEventManager.cpp index cc4f3b1..2603c778 100644 --- a/third_party/WebKit/Source/core/input/MouseEventManager.cpp +++ b/third_party/WebKit/Source/core/input/MouseEventManager.cpp
@@ -341,7 +341,7 @@ last_known_mouse_position_.Y()), WebFloatPoint(last_known_mouse_global_position_.X(), last_known_mouse_global_position_.Y()), - button, 0, modifiers, TimeTicks::Now().InSeconds()); + button, 0, modifiers, CurrentTimeTicks().InSeconds()); // TODO(dtapuska): Update m_lastKnowMousePosition to be viewport coordinates. fake_mouse_move_event.SetFrameScale(1); Vector<WebMouseEvent> coalesced_events; @@ -728,7 +728,7 @@ WebPointerProperties::Button::kLeft, 1, modifiers | WebInputEvent::Modifiers::kLeftButtonDown | WebInputEvent::Modifiers::kIsCompatibilityEventForTouch, - TimeTicks::Now().InSeconds()); + CurrentTimeTicks().InSeconds()); mouse_down_ = mouse_down_event; WebMouseEvent mouse_drag_event( @@ -736,7 +736,7 @@ WebPointerProperties::Button::kLeft, 1, modifiers | WebInputEvent::Modifiers::kLeftButtonDown | WebInputEvent::Modifiers::kIsCompatibilityEventForTouch, - TimeTicks::Now().InSeconds()); + CurrentTimeTicks().InSeconds()); HitTestRequest request(HitTestRequest::kReadOnly); MouseEventWithHitTestResults mev = EventHandlingUtil::PerformMouseEventHitTest(frame_, request,
diff --git a/third_party/WebKit/Source/core/input/OverscrollBehaviorTest.cpp b/third_party/WebKit/Source/core/input/OverscrollBehaviorTest.cpp index 331d25e..a26b06f 100644 --- a/third_party/WebKit/Source/core/input/OverscrollBehaviorTest.cpp +++ b/third_party/WebKit/Source/core/input/OverscrollBehaviorTest.cpp
@@ -79,7 +79,7 @@ double hint_y) { WebGestureEvent event(WebInputEvent::kGestureScrollBegin, WebInputEvent::kNoModifiers, - TimeTicks::Now().InSeconds()); + CurrentTimeTicks().InSeconds()); event.x = event.global_x = 20; event.y = event.global_y = 20; event.source_device = WebGestureDevice::kWebGestureDeviceTouchscreen; @@ -94,7 +94,7 @@ double delta_y) { WebGestureEvent event(WebInputEvent::kGestureScrollUpdate, WebInputEvent::kNoModifiers, - TimeTicks::Now().InSeconds()); + CurrentTimeTicks().InSeconds()); event.x = event.global_x = 20; event.y = event.global_y = 20; event.source_device = WebGestureDevice::kWebGestureDeviceTouchscreen; @@ -107,7 +107,7 @@ WebGestureEvent OverscrollBehaviorTest::ScrollEnd() { WebGestureEvent event(WebInputEvent::kGestureScrollEnd, WebInputEvent::kNoModifiers, - TimeTicks::Now().InSeconds()); + CurrentTimeTicks().InSeconds()); event.x = event.global_x = 20; event.y = event.global_y = 20; event.source_device = WebGestureDevice::kWebGestureDeviceTouchscreen;
diff --git a/third_party/WebKit/Source/core/input/ScrollSnapTest.cpp b/third_party/WebKit/Source/core/input/ScrollSnapTest.cpp index 94c5356..398e5738 100644 --- a/third_party/WebKit/Source/core/input/ScrollSnapTest.cpp +++ b/third_party/WebKit/Source/core/input/ScrollSnapTest.cpp
@@ -71,7 +71,7 @@ double hint_y) { WebGestureEvent event(WebInputEvent::kGestureScrollBegin, WebInputEvent::kNoModifiers, - TimeTicks::Now().InSeconds()); + CurrentTimeTicks().InSeconds()); event.x = event.global_x = x; event.y = event.global_y = y; event.source_device = WebGestureDevice::kWebGestureDeviceTouchscreen; @@ -88,7 +88,7 @@ double delta_y) { WebGestureEvent event(WebInputEvent::kGestureScrollUpdate, WebInputEvent::kNoModifiers, - TimeTicks::Now().InSeconds()); + CurrentTimeTicks().InSeconds()); event.x = event.global_x = x; event.y = event.global_y = y; event.source_device = WebGestureDevice::kWebGestureDeviceTouchscreen; @@ -101,7 +101,7 @@ void ScrollSnapTest::ScrollEnd(double x, double y) { WebGestureEvent event(WebInputEvent::kGestureScrollEnd, WebInputEvent::kNoModifiers, - TimeTicks::Now().InSeconds()); + CurrentTimeTicks().InSeconds()); event.x = event.global_x = x; event.y = event.global_y = y; event.source_device = WebGestureDevice::kWebGestureDeviceTouchscreen;
diff --git a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp index d144c47..ac1ceec 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp
@@ -599,7 +599,7 @@ String request_id = IdentifiersFactory::RequestId(identifier); String protocol_reason = BuildBlockedReason(reason); GetFrontend()->loadingFailed( - request_id, MonotonicallyIncreasingTime(), + request_id, CurrentTimeTicksInSeconds(), InspectorPageAgent::ResourceTypeJson( resources_data_->GetResourceType(request_id)), String(), false, protocol_reason); @@ -611,7 +611,7 @@ String request_id = IdentifiersFactory::RequestId(identifier); GetFrontend()->resourceChangedPriority(request_id, ResourcePriorityJSON(load_priority), - MonotonicallyIncreasingTime()); + CurrentTimeTicksInSeconds()); } void InspectorNetworkAgent::WillSendRequestInternal( @@ -671,7 +671,7 @@ maybe_frame_id = frame_id; GetFrontend()->requestWillBeSent( request_id, loader_id, documentURL, std::move(request_info), - MonotonicallyIncreasingTime(), CurrentTime(), std::move(initiator_object), + CurrentTimeTicksInSeconds(), CurrentTime(), std::move(initiator_object), BuildObjectForResourceResponse(redirect_response), resource_type, std::move(maybe_frame_id)); if (pending_xhr_replay_data_ && !pending_xhr_replay_data_->Async()) @@ -802,7 +802,7 @@ if (!frame_id.IsEmpty()) maybe_frame_id = frame_id; GetFrontend()->responseReceived( - request_id, loader_id, MonotonicallyIncreasingTime(), + request_id, loader_id, CurrentTimeTicksInSeconds(), InspectorPageAgent::ResourceTypeJson(type), std::move(resource_response), std::move(maybe_frame_id)); } @@ -835,7 +835,7 @@ } GetFrontend()->dataReceived( - request_id, MonotonicallyIncreasingTime(), data_length, + request_id, CurrentTimeTicksInSeconds(), data_length, resources_data_->GetAndClearPendingEncodedDataLength(request_id)); } @@ -858,7 +858,7 @@ int pending_encoded_data_length = resources_data_->GetAndClearPendingEncodedDataLength(request_id); if (pending_encoded_data_length > 0) { - GetFrontend()->dataReceived(request_id, MonotonicallyIncreasingTime(), 0, + GetFrontend()->dataReceived(request_id, CurrentTimeTicksInSeconds(), 0, pending_encoded_data_length); } @@ -872,7 +872,7 @@ resources_data_->MaybeDecodeDataToContent(request_id); if (!monotonic_finish_time) - monotonic_finish_time = MonotonicallyIncreasingTime(); + monotonic_finish_time = CurrentTimeTicksInSeconds(); GetFrontend()->loadingFinished(request_id, monotonic_finish_time, encoded_data_length); } @@ -894,7 +894,7 @@ String request_id = IdentifiersFactory::RequestId(identifier); bool canceled = error.IsCancellation(); GetFrontend()->loadingFailed( - request_id, MonotonicallyIncreasingTime(), + request_id, CurrentTimeTicksInSeconds(), InspectorPageAgent::ResourceTypeJson( resources_data_->GetResourceType(request_id)), error.LocalizedDescription(), canceled); @@ -1052,7 +1052,7 @@ if (it == known_request_id_map_.end()) return; GetFrontend()->eventSourceMessageReceived( - IdentifiersFactory::RequestId(it->value), MonotonicallyIncreasingTime(), + IdentifiersFactory::RequestId(it->value), CurrentTimeTicksInSeconds(), event_name.GetString(), event_id.GetString(), data); } @@ -1168,7 +1168,7 @@ .setHeaders(BuildObjectForHeaders(request->HeaderFields())) .build(); GetFrontend()->webSocketWillSendHandshakeRequest( - IdentifiersFactory::RequestId(identifier), MonotonicallyIncreasingTime(), + IdentifiersFactory::RequestId(identifier), CurrentTimeTicksInSeconds(), CurrentTime(), std::move(request_object)); } @@ -1194,14 +1194,14 @@ response_object->setRequestHeadersText(request->HeadersText()); } GetFrontend()->webSocketHandshakeResponseReceived( - IdentifiersFactory::RequestId(identifier), MonotonicallyIncreasingTime(), + IdentifiersFactory::RequestId(identifier), CurrentTimeTicksInSeconds(), std::move(response_object)); } void InspectorNetworkAgent::DidCloseWebSocket(Document*, unsigned long identifier) { GetFrontend()->webSocketClosed(IdentifiersFactory::RequestId(identifier), - MonotonicallyIncreasingTime()); + CurrentTimeTicksInSeconds()); } void InspectorNetworkAgent::DidReceiveWebSocketFrame(unsigned long identifier, @@ -1217,7 +1217,7 @@ String::FromUTF8WithLatin1Fallback(payload, payload_length)) .build(); GetFrontend()->webSocketFrameReceived( - IdentifiersFactory::RequestId(identifier), MonotonicallyIncreasingTime(), + IdentifiersFactory::RequestId(identifier), CurrentTimeTicksInSeconds(), std::move(frame_object)); } @@ -1234,7 +1234,7 @@ String::FromUTF8WithLatin1Fallback(payload, payload_length)) .build(); GetFrontend()->webSocketFrameSent(IdentifiersFactory::RequestId(identifier), - MonotonicallyIncreasingTime(), + CurrentTimeTicksInSeconds(), std::move(frame_object)); } @@ -1242,7 +1242,7 @@ unsigned long identifier, const String& error_message) { GetFrontend()->webSocketFrameError(IdentifiersFactory::RequestId(identifier), - MonotonicallyIncreasingTime(), + CurrentTimeTicksInSeconds(), error_message); }
diff --git a/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp index 87e67a4..8125b524 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp
@@ -803,7 +803,7 @@ } void InspectorPageAgent::DomContentLoadedEventFired(LocalFrame* frame) { - double timestamp = MonotonicallyIncreasingTime(); + double timestamp = CurrentTimeTicksInSeconds(); if (frame == inspected_frames_->Root()) GetFrontend()->domContentEventFired(timestamp); DocumentLoader* loader = frame->Loader().GetDocumentLoader(); @@ -811,7 +811,7 @@ } void InspectorPageAgent::LoadEventFired(LocalFrame* frame) { - double timestamp = MonotonicallyIncreasingTime(); + double timestamp = CurrentTimeTicksInSeconds(); if (frame == inspected_frames_->Root()) GetFrontend()->loadEventFired(timestamp); DocumentLoader* loader = frame->Loader().GetDocumentLoader();
diff --git a/third_party/WebKit/Source/core/inspector/InspectorPerformanceAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorPerformanceAgent.cpp index a102d7db..a9d7174 100644 --- a/third_party/WebKit/Source/core/inspector/InspectorPerformanceAgent.cpp +++ b/third_party/WebKit/Source/core/inspector/InspectorPerformanceAgent.cpp
@@ -90,7 +90,7 @@ std::unique_ptr<protocol::Array<protocol::Performance::Metric>> result = protocol::Array<protocol::Performance::Metric>::create(); - double now = (TimeTicks::Now() - TimeTicks()).InSecondsF(); + double now = (CurrentTimeTicks() - TimeTicks()).InSecondsF(); AppendMetric(result.get(), "Timestamp", now); // Renderer instance counters.
diff --git a/third_party/WebKit/Source/core/inspector/browser_protocol.json b/third_party/WebKit/Source/core/inspector/browser_protocol.json index d6d5ade..f7f5323 100644 --- a/third_party/WebKit/Source/core/inspector/browser_protocol.json +++ b/third_party/WebKit/Source/core/inspector/browser_protocol.json
@@ -9875,7 +9875,7 @@ }, { "name": "scriptToEvaluateOnLoad", - "description": "If set, the script will be injected into all frames of the inspected page after reload.", + "description": "If set, the script will be injected into all frames of the inspected page after reload.\nArgument will be ignored if reloading dataURL origin.", "optional": true, "type": "string" } @@ -10628,6 +10628,11 @@ "$ref": "SecurityState" }, { + "name": "title", + "description": "Title describing the type of factor.", + "type": "string" + }, + { "name": "summary", "description": "Short phrase describing the type of factor.", "type": "string"
diff --git a/third_party/WebKit/Source/core/inspector/browser_protocol.pdl b/third_party/WebKit/Source/core/inspector/browser_protocol.pdl index 5dad507..349ee19 100644 --- a/third_party/WebKit/Source/core/inspector/browser_protocol.pdl +++ b/third_party/WebKit/Source/core/inspector/browser_protocol.pdl
@@ -4522,6 +4522,7 @@ # If true, browser cache is ignored (as if the user pressed Shift+refresh). optional boolean ignoreCache # If set, the script will be injected into all frames of the inspected page after reload. + # Argument will be ignored if reloading dataURL origin. optional string scriptToEvaluateOnLoad # Deprecated, please use removeScriptToEvaluateOnNewDocument instead. @@ -4884,6 +4885,8 @@ properties # Security state representing the severity of the factor being explained. SecurityState securityState + # Title describing the type of factor. + string title # Short phrase describing the type of factor. string summary # Full text explanation of the factor.
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp index cd99464b..235bc6fe 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -5736,10 +5736,11 @@ EFillSizeType size_type = layer.SizeType(); - if (size_type == kContain || size_type == kCover) + if (size_type == EFillSizeType::kContain || + size_type == EFillSizeType::kCover) return true; - if (size_type == kSizeLength) { + if (size_type == EFillSizeType::kSizeLength) { // TODO(alancutter): Make this work correctly for calc lengths. if (layer.SizeLength().Height().IsPercentOrCalc() && !layer.SizeLength().Height().IsZero()) @@ -5777,10 +5778,11 @@ EFillSizeType size_type = layer.SizeType(); - if (size_type == kContain || size_type == kCover) + if (size_type == EFillSizeType::kContain || + size_type == EFillSizeType::kCover) return true; - if (size_type == kSizeLength) { + if (size_type == EFillSizeType::kSizeLength) { // TODO(alancutter): Make this work correctly for calc lengths. if (layer.SizeLength().Width().IsPercentOrCalc() && !layer.SizeLength().Width().IsZero())
diff --git a/third_party/WebKit/Source/core/layout/LayoutEmbeddedContent.cpp b/third_party/WebKit/Source/core/layout/LayoutEmbeddedContent.cpp index e288550..d8016b6 100644 --- a/third_party/WebKit/Source/core/layout/LayoutEmbeddedContent.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutEmbeddedContent.cpp
@@ -25,6 +25,7 @@ #include "core/layout/LayoutEmbeddedContent.h" #include "core/dom/AXObjectCache.h" +#include "core/exported/WebPluginContainerImpl.h" #include "core/frame/EmbeddedContentView.h" #include "core/frame/LocalFrame.h" #include "core/frame/LocalFrameView.h" @@ -38,7 +39,6 @@ #include "core/layout/api/LayoutViewItem.h" #include "core/page/scrolling/RootScrollerUtil.h" #include "core/paint/EmbeddedContentPainter.h" -#include "core/plugins/PluginView.h" namespace blink { @@ -97,10 +97,10 @@ return nullptr; } -PluginView* LayoutEmbeddedContent::Plugin() const { +WebPluginContainerImpl* LayoutEmbeddedContent::Plugin() const { EmbeddedContentView* embedded_content_view = GetEmbeddedContentView(); if (embedded_content_view && embedded_content_view->IsPluginView()) - return ToPluginView(embedded_content_view); + return ToWebPluginContainerImpl(embedded_content_view); return nullptr; } @@ -123,7 +123,7 @@ // a plugin LayoutObject and the plugin has a layer, then we need a layer. // Second, if this is a LayoutObject with a contentDocument and that document // needs a layer, then we need a layer. - PluginView* plugin_view = Plugin(); + WebPluginContainerImpl* plugin_view = Plugin(); if (plugin_view && plugin_view->PlatformLayer()) return true;
diff --git a/third_party/WebKit/Source/core/layout/LayoutEmbeddedContent.h b/third_party/WebKit/Source/core/layout/LayoutEmbeddedContent.h index 2761abe..a393a54 100644 --- a/third_party/WebKit/Source/core/layout/LayoutEmbeddedContent.h +++ b/third_party/WebKit/Source/core/layout/LayoutEmbeddedContent.h
@@ -29,7 +29,7 @@ namespace blink { class EmbeddedContentView; -class PluginView; +class WebPluginContainerImpl; // LayoutObject for frames via LayoutFrame and LayoutIFrame, and plugins via // LayoutEmbeddedObject. @@ -55,7 +55,7 @@ // to LayoutObject::GetFrameView which returns the LocalFrameView associated // with the root Document Frame. LocalFrameView* ChildFrameView() const; - PluginView* Plugin() const; + WebPluginContainerImpl* Plugin() const; EmbeddedContentView* GetEmbeddedContentView() const; LayoutRect ReplacedContentRect() const final;
diff --git a/third_party/WebKit/Source/core/layout/LayoutEmbeddedObject.cpp b/third_party/WebKit/Source/core/layout/LayoutEmbeddedObject.cpp index 5977e8d..8a3c08d 100644 --- a/third_party/WebKit/Source/core/layout/LayoutEmbeddedObject.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutEmbeddedObject.cpp
@@ -25,6 +25,7 @@ #include "core/layout/LayoutEmbeddedObject.h" #include "core/CSSValueKeywords.h" +#include "core/exported/WebPluginContainerImpl.h" #include "core/frame/LocalFrame.h" #include "core/frame/LocalFrameView.h" #include "core/html/HTMLPlugInElement.h" @@ -34,7 +35,6 @@ #include "core/page/Page.h" #include "core/paint/EmbeddedObjectPaintInvalidator.h" #include "core/paint/EmbeddedObjectPainter.h" -#include "core/plugins/PluginView.h" #include "platform/text/PlatformLocale.h" namespace blink {
diff --git a/third_party/WebKit/Source/core/layout/LayoutFullScreen.cpp b/third_party/WebKit/Source/core/layout/LayoutFullScreen.cpp index ccfc132..b243ae5 100644 --- a/third_party/WebKit/Source/core/layout/LayoutFullScreen.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutFullScreen.cpp
@@ -133,6 +133,9 @@ // layout. crbug.com/370459 DeprecatedDisableModifyLayoutTreeStructureAsserts disabler; + // A fullscreen <html> element should not be wrapped (see crbug.com/676432). + DCHECK(!object || object->GetNode() != document->documentElement()); + LayoutFullScreen* fullscreen_layout_object = LayoutFullScreen::CreateAnonymous(document); fullscreen_layout_object->UpdateStyle(parent);
diff --git a/third_party/WebKit/Source/core/layout/LayoutView.cpp b/third_party/WebKit/Source/core/layout/LayoutView.cpp index 94dd502..b063cba 100644 --- a/third_party/WebKit/Source/core/layout/LayoutView.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutView.cpp
@@ -61,12 +61,12 @@ class HitTestLatencyRecorder { public: HitTestLatencyRecorder(bool allows_child_frame_content) - : start_(WTF::MonotonicallyIncreasingTime()), + : start_(WTF::CurrentTimeTicksInSeconds()), allows_child_frame_content_(allows_child_frame_content) {} ~HitTestLatencyRecorder() { - int duration = static_cast<int>( - (WTF::MonotonicallyIncreasingTime() - start_) * 1000000); + int duration = + static_cast<int>((WTF::CurrentTimeTicksInSeconds() - start_) * 1000000); if (allows_child_frame_content_) { DEFINE_STATIC_LOCAL(CustomCountHistogram, recursive_latency_histogram,
diff --git a/third_party/WebKit/Source/core/layout/ScrollbarsTest.cpp b/third_party/WebKit/Source/core/layout/ScrollbarsTest.cpp index 8eaf784..4175577 100644 --- a/third_party/WebKit/Source/core/layout/ScrollbarsTest.cpp +++ b/third_party/WebKit/Source/core/layout/ScrollbarsTest.cpp
@@ -47,7 +47,7 @@ WebMouseEvent event( WebInputEvent::kMouseMove, WebFloatPoint(x, y), WebFloatPoint(x, y), WebPointerProperties::Button::kNoButton, 0, WebInputEvent::kNoModifiers, - TimeTicks::Now().InSeconds()); + CurrentTimeTicks().InSeconds()); event.SetFrameScale(1); EventHandler().HandleMouseMoveEvent(event, Vector<WebMouseEvent>()); } @@ -57,7 +57,7 @@ WebFloatPoint(x, y), WebPointerProperties::Button::kLeft, 0, WebInputEvent::Modifiers::kLeftButtonDown, - TimeTicks::Now().InSeconds()); + CurrentTimeTicks().InSeconds()); event.SetFrameScale(1); EventHandler().HandleMousePressEvent(event); } @@ -67,7 +67,7 @@ WebFloatPoint(x, y), WebPointerProperties::Button::kLeft, 0, WebInputEvent::Modifiers::kLeftButtonDown, - TimeTicks::Now().InSeconds()); + CurrentTimeTicks().InSeconds()); event.SetFrameScale(1); EventHandler().HandleMouseReleaseEvent(event); } @@ -77,7 +77,7 @@ WebFloatPoint(1, 1), WebPointerProperties::Button::kLeft, 0, WebInputEvent::Modifiers::kLeftButtonDown, - TimeTicks::Now().InSeconds()); + CurrentTimeTicks().InSeconds()); event.SetFrameScale(1); EventHandler().HandleMouseLeaveEvent(event); } @@ -419,7 +419,7 @@ DCHECK(scrollable_area->VerticalScrollbar()); WebGestureEvent scroll_begin(WebInputEvent::kGestureScrollBegin, WebInputEvent::kNoModifiers, - TimeTicks::Now().InSeconds()); + CurrentTimeTicks().InSeconds()); scroll_begin.x = scroll_begin.global_x = scrollable->OffsetLeft() + scrollable->OffsetWidth() - 2; scroll_begin.y = scroll_begin.global_y = scrollable->OffsetTop();
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.h b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.h index 644e801..5c6c5b35 100644 --- a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.h +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.h
@@ -27,7 +27,8 @@ class NGTextFragmentBuilder; struct NGPositionedFloat; -// A class for inline layout (e.g. a <span> with no special style). +// A class for laying out an inline formatting context, i.e. a block with inline +// children. // // This class determines the position of NGInlineItem and build line boxes. //
diff --git a/third_party/WebKit/Source/core/layout/ng/legacy_layout_tree_walking.cc b/third_party/WebKit/Source/core/layout/ng/legacy_layout_tree_walking.cc index 2f7c30e..8064b52 100644 --- a/third_party/WebKit/Source/core/layout/ng/legacy_layout_tree_walking.cc +++ b/third_party/WebKit/Source/core/layout/ng/legacy_layout_tree_walking.cc
@@ -48,4 +48,15 @@ return false; } +bool IsManagedByLayoutNG(const LayoutObject& object) { + if (!object.IsLayoutNGMixin()) + return false; + const auto* containing_block = object.ContainingBlock(); + if (!containing_block) + return false; + if (containing_block->IsLayoutFlowThread()) + containing_block = containing_block->ContainingBlock(); + return containing_block && containing_block->IsLayoutNGMixin(); +} + } // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/ng/legacy_layout_tree_walking.h b/third_party/WebKit/Source/core/layout/ng/legacy_layout_tree_walking.h index 066649aa..64bc4f573 100644 --- a/third_party/WebKit/Source/core/layout/ng/legacy_layout_tree_walking.h +++ b/third_party/WebKit/Source/core/layout/ng/legacy_layout_tree_walking.h
@@ -24,6 +24,10 @@ // established by |block| will be inline; see LayoutObject::ChildrenInline(). bool AreNGBlockFlowChildrenInline(const LayoutBlockFlow*); +// Return true if the layout object is a LayoutNG object that is managed by the +// LayoutNG engine (i.e. its containing block is a LayoutNG object as well). +bool IsManagedByLayoutNG(const LayoutObject&); + } // namespace blink #endif // LegacyLayoutTreeWalking_h
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 b2db96e4..d0105db 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
@@ -1092,17 +1092,17 @@ auto left_floating_object = floating_objects.TakeFirst(); ASSERT_TRUE(left_floating_object->IsPlaced()); // 80 = float_inline_offset(25) + accumulative offset of empty blocks(35 + 20) - EXPECT_THAT(left_floating_object->X(), LayoutUnit(25)); + EXPECT_THAT(left_floating_object->X(), LayoutUnit(15)); // 10 = left float's margin - EXPECT_THAT(left_floating_object->Y(), LayoutUnit(10)); + EXPECT_THAT(left_floating_object->Y(), LayoutUnit()); auto right_floating_object = floating_objects.TakeFirst(); ASSERT_TRUE(right_floating_object->IsPlaced()); // 150 = float_inline_offset(25) + // right float offset(125) - EXPECT_THAT(right_floating_object->X(), LayoutUnit(150)); + EXPECT_THAT(right_floating_object->X(), LayoutUnit(140)); // 15 = right float's margin - EXPECT_THAT(right_floating_object->Y(), LayoutUnit(15)); + EXPECT_THAT(right_floating_object->Y(), LayoutUnit(0)); } // Verifies that left/right floating and regular blocks can be positioned @@ -1532,8 +1532,8 @@ ASSERT_EQ(1UL, floating_objects.size()); auto floating_object = floating_objects.TakeFirst(); // left-float's margin = 15. - EXPECT_THAT(floating_object->X(), LayoutUnit(15)); - EXPECT_THAT(floating_object->Y(), LayoutUnit(15)); + EXPECT_THAT(floating_object->X(), LayoutUnit()); + EXPECT_THAT(floating_object->Y(), LayoutUnit()); scoped_refptr<const NGPhysicalBoxFragment> html_fragment; std::tie(html_fragment, std::ignore) = RunBlockLayoutAlgorithmForElement(
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 bea58e8..6a75a07a 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
@@ -342,16 +342,7 @@ intrinsic_content_logical_height -= border_scrollbar_padding.BlockSum(); box_->SetLogicalHeight(logical_height); box_->SetIntrinsicContentLogicalHeight(intrinsic_content_logical_height); - - // LayoutBox::Margin*() should be used value, while we set computed value - // here. This is not entirely correct, but these values are not used for - // layout purpose. - // BaselinePosition() relies on margins set to the box, and computed value is - // good enough for it to work correctly. - // Set this only for atomic inlines, or we end up adding margins twice. - if (box_->IsAtomicInlineLevel()) { - box_->SetMargin(ComputePhysicalMargins(constraint_space, Style())); - } + box_->SetMargin(ComputePhysicalMargins(constraint_space, Style())); LayoutMultiColumnFlowThread* flow_thread = GetFlowThread(*box_); if (flow_thread) {
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_physical_box_fragment.cc b/third_party/WebKit/Source/core/layout/ng/ng_physical_box_fragment.cc index d4e4c5f8..f9b2dbf 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_physical_box_fragment.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_physical_box_fragment.cc
@@ -51,6 +51,12 @@ BoxType() != kAnonymousBox; } +bool NGPhysicalBoxFragment::ChildrenInline() const { + const LayoutObject* layout_object = GetLayoutObject(); + DCHECK(layout_object); + return layout_object->ChildrenInline(); +} + bool NGPhysicalBoxFragment::HasOverflowClip() const { const LayoutObject* layout_object = GetLayoutObject(); DCHECK(layout_object);
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_physical_box_fragment.h b/third_party/WebKit/Source/core/layout/ng/ng_physical_box_fragment.h index a34f22b..8cd7064 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_physical_box_fragment.h +++ b/third_party/WebKit/Source/core/layout/ng/ng_physical_box_fragment.h
@@ -29,6 +29,7 @@ const NGBaseline* Baseline(const NGBaselineRequest&) const; bool HasSelfPaintingLayer() const; + bool ChildrenInline() const; // True if overflow != 'visible', except for certain boxes that do not allow // overflow clip; i.e., AllowOverflowClip() returns false.
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_physical_fragment.cc b/third_party/WebKit/Source/core/layout/ng/ng_physical_fragment.cc index 5aafe91f..1014f964 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_physical_fragment.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_physical_fragment.cc
@@ -208,6 +208,14 @@ return layout_object_ ? layout_object_->GetNode() : nullptr; } +bool NGPhysicalFragment::HasLayer() const { + return layout_object_->HasLayer(); +} + +bool NGPhysicalFragment::IsBlockFlow() const { + return layout_object_ && layout_object_->IsLayoutBlockFlow(); +} + bool NGPhysicalFragment::IsPlacedByLayoutNG() const { // TODO(kojii): Move this to a flag for |LayoutNGBlockFlow::UpdateBlockLayout| // to set.
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_physical_fragment.h b/third_party/WebKit/Source/core/layout/ng/ng_physical_fragment.h index 29d1d09..2e16b103 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_physical_fragment.h +++ b/third_party/WebKit/Source/core/layout/ng/ng_physical_fragment.h
@@ -83,6 +83,8 @@ bool IsOutOfFlowPositioned() const { return BoxType() == NGBoxType::kOutOfFlowPositioned; } + bool IsBlockFlow() const; + // A box fragment that do not exist in LayoutObject tree. Its LayoutObject is // co-owned by other fragments. bool IsAnonymousBox() const { return BoxType() == NGBoxType::kAnonymousBox; } @@ -120,6 +122,9 @@ const ComputedStyle& Style() const; Node* GetNode() const; + // Whether there is a PaintLayer associated with the fragment. + bool HasLayer() const; + // GetLayoutObject should only be used when necessary for compatibility // with LegacyLayout. LayoutObject* GetLayoutObject() const { return layout_object_; }
diff --git a/third_party/WebKit/Source/core/leak_detector/BlinkLeakDetector.cpp b/third_party/WebKit/Source/core/leak_detector/BlinkLeakDetector.cpp index 5db90c9..da3218f 100644 --- a/third_party/WebKit/Source/core/leak_detector/BlinkLeakDetector.cpp +++ b/third_party/WebKit/Source/core/leak_detector/BlinkLeakDetector.cpp
@@ -7,6 +7,7 @@ #include "bindings/core/v8/V8BindingForCore.h" #include "bindings/core/v8/V8GCController.h" #include "core/CoreInitializer.h" +#include "core/css/CSSDefaultStyleSheets.h" #include "core/editing/spellcheck/SpellChecker.h" #include "core/frame/LocalFrame.h" #include "core/frame/WebLocalFrameImpl.h" @@ -61,6 +62,9 @@ // FIXME: HTML5 Notification should be closed because notification affects // the result of number of DOM objects. V8PerIsolateData::From(isolate)->ClearScriptRegexpContext(); + + // Clear lazily loaded style sheets. + CSSDefaultStyleSheets::Instance().PrepareForLeakDetection(); } void BlinkLeakDetector::CollectGarbage() {
diff --git a/third_party/WebKit/Source/core/loader/DocumentLoadTiming.cpp b/third_party/WebKit/Source/core/loader/DocumentLoadTiming.cpp index 283ab31..01d611d4 100644 --- a/third_party/WebKit/Source/core/loader/DocumentLoadTiming.cpp +++ b/third_party/WebKit/Source/core/loader/DocumentLoadTiming.cpp
@@ -67,7 +67,7 @@ if (!reference_wall_time_) reference_wall_time_ = CurrentTime(); if (!reference_monotonic_time_) - reference_monotonic_time_ = MonotonicallyIncreasingTime(); + reference_monotonic_time_ = CurrentTimeTicksInSeconds(); } double DocumentLoadTiming::MonotonicTimeToZeroBasedDocumentTime( @@ -178,7 +178,7 @@ } void DocumentLoadTiming::MarkFetchStart() { - SetFetchStart(MonotonicallyIncreasingTime()); + SetFetchStart(CurrentTimeTicksInSeconds()); } void DocumentLoadTiming::SetFetchStart(double fetch_start) { @@ -198,7 +198,7 @@ } void DocumentLoadTiming::MarkLoadEventStart() { - load_event_start_ = MonotonicallyIncreasingTime(); + load_event_start_ = CurrentTimeTicksInSeconds(); TRACE_EVENT_MARK_WITH_TIMESTAMP1( "blink.user_timing", "loadEventStart", TraceEvent::ToTraceTimestamp(load_event_start_), "frame", GetFrame()); @@ -206,7 +206,7 @@ } void DocumentLoadTiming::MarkLoadEventEnd() { - load_event_end_ = MonotonicallyIncreasingTime(); + load_event_end_ = CurrentTimeTicksInSeconds(); TRACE_EVENT_MARK_WITH_TIMESTAMP1( "blink.user_timing", "loadEventEnd", TraceEvent::ToTraceTimestamp(load_event_end_), "frame", GetFrame()); @@ -214,7 +214,7 @@ } void DocumentLoadTiming::MarkRedirectEnd() { - redirect_end_ = MonotonicallyIncreasingTime(); + redirect_end_ = CurrentTimeTicksInSeconds(); TRACE_EVENT_MARK_WITH_TIMESTAMP1("blink.user_timing", "redirectEnd", TraceEvent::ToTraceTimestamp(redirect_end_), "frame", GetFrame());
diff --git a/third_party/WebKit/Source/core/loader/DocumentLoadTimingTest.cpp b/third_party/WebKit/Source/core/loader/DocumentLoadTimingTest.cpp index daec4e64..02b4a514 100644 --- a/third_party/WebKit/Source/core/loader/DocumentLoadTimingTest.cpp +++ b/third_party/WebKit/Source/core/loader/DocumentLoadTimingTest.cpp
@@ -18,7 +18,7 @@ DocumentLoadTiming timing(*(dummy_page->GetDocument().Loader())); double delta = -1000; - double embedder_navigation_start = MonotonicallyIncreasingTime() + delta; + double embedder_navigation_start = CurrentTimeTicksInSeconds() + delta; timing.SetNavigationStart(embedder_navigation_start); double real_wall_time = CurrentTime(); @@ -33,7 +33,7 @@ DocumentLoadTiming timing(*(dummy_page->GetDocument().Loader())); double navigation_start_delta = -456; - double current_monotonic_time = MonotonicallyIncreasingTime(); + double current_monotonic_time = CurrentTimeTicksInSeconds(); double embedder_navigation_start = current_monotonic_time + navigation_start_delta;
diff --git a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp index 2ced0a8b..430299f2 100644 --- a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp +++ b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
@@ -447,7 +447,7 @@ if (!response_end_time) response_end_time = time_of_last_data_received_; if (!response_end_time) - response_end_time = MonotonicallyIncreasingTime(); + response_end_time = CurrentTimeTicksInSeconds(); GetTiming().SetResponseEnd(response_end_time); if (!MaybeCreateArchive()) { // If this is an empty document, it will not have actually been created yet. @@ -561,7 +561,7 @@ redirect_chain_.pop_back(); AppendRedirect(blocked_url); response_ = ResourceResponse(blocked_url, "text/html"); - FinishedLoading(MonotonicallyIncreasingTime()); + FinishedLoading(CurrentTimeTicksInSeconds()); return; } @@ -749,7 +749,7 @@ void DocumentLoader::ProcessData(const char* data, size_t length) { application_cache_host_->MainResourceDataReceived(data, length); - time_of_last_data_received_ = MonotonicallyIncreasingTime(); + time_of_last_data_received_ = CurrentTimeTicksInSeconds(); if (IsArchiveMIMEType(GetResponse().MimeType())) return; @@ -834,7 +834,7 @@ !GetFrameLoader().StateMachine()->CreatingInitialEmptyDocument()) request_.SetURL(BlankURL()); response_ = ResourceResponse(request_.Url(), "text/html"); - FinishedLoading(MonotonicallyIncreasingTime()); + FinishedLoading(CurrentTimeTicksInSeconds()); return true; }
diff --git a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp index f136aa0..09f845d2 100644 --- a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp +++ b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
@@ -304,7 +304,7 @@ return; } - request_started_seconds_ = MonotonicallyIncreasingTime(); + request_started_seconds_ = CurrentTimeTicksInSeconds(); // Save any headers on the request here. If this request redirects // cross-origin, we cancel the old request create a new one, and copy these @@ -560,7 +560,7 @@ // behave differently, in which case this should be re-arranged somehow. if (timeout_milliseconds) { double elapsed_time = - MonotonicallyIncreasingTime() - request_started_seconds_; + CurrentTimeTicksInSeconds() - request_started_seconds_; double next_fire = timeout_milliseconds / 1000.0; double resolved_time = std::max(next_fire - elapsed_time, 0.0); timeout_timer_.StartOneShot(resolved_time, BLINK_FROM_HERE);
diff --git a/third_party/WebKit/Source/core/loader/EmptyClients.cpp b/third_party/WebKit/Source/core/loader/EmptyClients.cpp index 727115a..7b300254 100644 --- a/third_party/WebKit/Source/core/loader/EmptyClients.cpp +++ b/third_party/WebKit/Source/core/loader/EmptyClients.cpp
@@ -172,13 +172,14 @@ return nullptr; } -PluginView* EmptyLocalFrameClient::CreatePlugin(HTMLPlugInElement&, - const KURL&, - const Vector<String>&, - const Vector<String>&, - const String&, - bool, - DetachedPluginPolicy) { +WebPluginContainerImpl* EmptyLocalFrameClient::CreatePlugin( + HTMLPlugInElement&, + const KURL&, + const Vector<String>&, + const Vector<String>&, + const String&, + bool, + DetachedPluginPolicy) { return nullptr; }
diff --git a/third_party/WebKit/Source/core/loader/EmptyClients.h b/third_party/WebKit/Source/core/loader/EmptyClients.h index 05ebc13..e911dcde 100644 --- a/third_party/WebKit/Source/core/loader/EmptyClients.h +++ b/third_party/WebKit/Source/core/loader/EmptyClients.h
@@ -318,13 +318,13 @@ void SelectorMatchChanged(const Vector<String>&, const Vector<String>&) override {} LocalFrame* CreateFrame(const AtomicString&, HTMLFrameOwnerElement*) override; - PluginView* CreatePlugin(HTMLPlugInElement&, - const KURL&, - const Vector<String>&, - const Vector<String>&, - const String&, - bool, - DetachedPluginPolicy) override; + WebPluginContainerImpl* CreatePlugin(HTMLPlugInElement&, + const KURL&, + const Vector<String>&, + const Vector<String>&, + const String&, + bool, + DetachedPluginPolicy) override; bool CanCreatePluginWithoutRenderer(const String& mime_type) const override { return false; }
diff --git a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp index 0629c10..dbc2e83 100644 --- a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp +++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
@@ -623,7 +623,7 @@ InteractiveDetector::From(*document_)); if (interactive_detector) { // We have not yet recorded load_finish_time. Pass nullopt here; we will - // call MonotonicallyIncreasingTime lazily when we need it. + // call CurrentTimeTicksInSeconds lazily when we need it. interactive_detector->OnResourceLoadEnd(WTF::nullopt); } }
diff --git a/third_party/WebKit/Source/core/loader/FrameLoader.cpp b/third_party/WebKit/Source/core/loader/FrameLoader.cpp index e6df9182..7e1582d 100644 --- a/third_party/WebKit/Source/core/loader/FrameLoader.cpp +++ b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
@@ -1547,9 +1547,8 @@ DCHECK(navigation_policy == kNavigationPolicyCurrentTab || navigation_policy == kNavigationPolicyHandledByClient); - provisional_document_loader_ = - CreateDocumentLoader(resource_request, frame_load_request, type, - navigation_type, base::UnguessableToken::Create()); + provisional_document_loader_ = CreateDocumentLoader( + resource_request, frame_load_request, type, navigation_type); // PlzNavigate: We need to ensure that script initiated navigations are // honored. @@ -1795,14 +1794,14 @@ const ResourceRequest& request, const FrameLoadRequest& frame_load_request, FrameLoadType load_type, - NavigationType navigation_type, - const base::UnguessableToken& devtools_navigation_token) { + NavigationType navigation_type) { DocumentLoader* loader = Client()->CreateDocumentLoader( frame_, request, frame_load_request.GetSubstituteData().IsValid() ? frame_load_request.GetSubstituteData() : DefaultSubstituteDataForURL(request.Url()), - frame_load_request.ClientRedirect(), devtools_navigation_token); + frame_load_request.ClientRedirect(), + frame_load_request.GetDevToolsNavigationToken()); loader->SetLoadType(load_type); loader->SetNavigationType(navigation_type); @@ -1813,7 +1812,7 @@ (!Opener() || !request.Url().IsEmpty()); loader->SetReplacesCurrentHistoryItem(replace_current_item); - probe::lifecycleEvent(frame_, loader, "init", MonotonicallyIncreasingTime()); + probe::lifecycleEvent(frame_, loader, "init", CurrentTimeTicksInSeconds()); return loader; }
diff --git a/third_party/WebKit/Source/core/loader/FrameLoader.h b/third_party/WebKit/Source/core/loader/FrameLoader.h index cfcd9fb..66d84ad 100644 --- a/third_party/WebKit/Source/core/loader/FrameLoader.h +++ b/third_party/WebKit/Source/core/loader/FrameLoader.h
@@ -265,12 +265,10 @@ std::unique_ptr<TracedValue> ToTracedValue() const; void TakeObjectSnapshot() const; - DocumentLoader* CreateDocumentLoader( - const ResourceRequest&, - const FrameLoadRequest&, - FrameLoadType, - NavigationType, - const base::UnguessableToken& devtools_navigation_token); + DocumentLoader* CreateDocumentLoader(const ResourceRequest&, + const FrameLoadRequest&, + FrameLoadType, + NavigationType); LocalFrameClient* Client() const;
diff --git a/third_party/WebKit/Source/core/loader/IdlenessDetector.cpp b/third_party/WebKit/Source/core/loader/IdlenessDetector.cpp index 60faaf3..6b205e4 100644 --- a/third_party/WebKit/Source/core/loader/IdlenessDetector.cpp +++ b/third_party/WebKit/Source/core/loader/IdlenessDetector.cpp
@@ -86,7 +86,7 @@ if (request_count > 2) return; - double timestamp = MonotonicallyIncreasingTime(); + double timestamp = CurrentTimeTicksInSeconds(); // Arriving at =2 updates the quiet_2 base timestamp. // Arriving at <2 sets the quiet_2 base timestamp only if // it was not already set.
diff --git a/third_party/WebKit/Source/core/loader/InteractiveDetector.cpp b/third_party/WebKit/Source/core/loader/InteractiveDetector.cpp index 6433339f..ddf35f7 100644 --- a/third_party/WebKit/Source/core/loader/InteractiveDetector.cpp +++ b/third_party/WebKit/Source/core/loader/InteractiveDetector.cpp
@@ -81,7 +81,7 @@ if (timer_fire_time < time_to_interactive_timer_fire_time_) return; - double delay = timer_fire_time - MonotonicallyIncreasingTime(); + double delay = timer_fire_time - CurrentTimeTicksInSeconds(); time_to_interactive_timer_fire_time_ = timer_fire_time; if (delay <= 0.0) { @@ -125,22 +125,22 @@ } // The optional opt_current_time, if provided, saves us a call to -// MonotonicallyIncreasingTime. +// CurrentTimeTicksInSeconds. void InteractiveDetector::UpdateNetworkQuietState( double request_count, WTF::Optional<double> opt_current_time) { if (request_count <= kNetworkQuietMaximumConnections && active_network_quiet_window_start_ == 0.0) { - // Not using `value_or(MonotonicallyIncreasingTime())` here because + // Not using `value_or(CurrentTimeTicksInSeconds())` here because // arguments to functions are eagerly evaluated, which always call - // MonotonicallyIncreasingTime. + // CurrentTimeTicksInSeconds. double current_time = opt_current_time ? opt_current_time.value() - : MonotonicallyIncreasingTime(); + : CurrentTimeTicksInSeconds(); BeginNetworkQuietPeriod(current_time); } else if (request_count > kNetworkQuietMaximumConnections && active_network_quiet_window_start_ != 0.0) { double current_time = opt_current_time ? opt_current_time.value() - : MonotonicallyIncreasingTime(); + : CurrentTimeTicksInSeconds(); EndNetworkQuietPeriod(current_time); } } @@ -157,7 +157,7 @@ } // The optional load_finish_time, if provided, saves us a call to -// MonotonicallyIncreasingTime. +// CurrentTimeTicksInSeconds. void InteractiveDetector::OnResourceLoadEnd( WTF::Optional<double> load_finish_time) { if (!GetSupplementable()) @@ -186,7 +186,7 @@ DCHECK(page_event_times_.first_meaningful_paint == 0.0); // Should not set FMP twice. page_event_times_.first_meaningful_paint = fmp_time; - if (MonotonicallyIncreasingTime() - fmp_time >= + if (CurrentTimeTicksInSeconds() - fmp_time >= kTimeToInteractiveWindowSeconds) { // We may have reached TTCI already. Check right away. CheckTimeToInteractiveReached(); @@ -318,7 +318,7 @@ page_event_times_.dom_content_loaded_end == 0.0) return; - const double current_time = MonotonicallyIncreasingTime(); + const double current_time = CurrentTimeTicksInSeconds(); if (current_time - page_event_times_.first_meaningful_paint < kTimeToInteractiveWindowSeconds) { // Too close to FMP to determine Time to Interactive. @@ -336,7 +336,7 @@ interactive_time_ = std::max( {interactive_candidate, page_event_times_.dom_content_loaded_end}); - interactive_detection_time_ = MonotonicallyIncreasingTime(); + interactive_detection_time_ = CurrentTimeTicksInSeconds(); OnTimeToInteractiveDetected(); }
diff --git a/third_party/WebKit/Source/core/loader/InteractiveDetector.h b/third_party/WebKit/Source/core/loader/InteractiveDetector.h index c47c6d1..9036a00 100644 --- a/third_party/WebKit/Source/core/loader/InteractiveDetector.h +++ b/third_party/WebKit/Source/core/loader/InteractiveDetector.h
@@ -48,7 +48,7 @@ static InteractiveDetector* From(Document&); virtual ~InteractiveDetector(); - // Calls to MonotonicallyIncreasingTime is expensive, so we try not to call it + // Calls to CurrentTimeTicksInSeconds is expensive, so we try not to call it // unless we really have to. If we already have the event time available, we // pass it in as an argument. void OnResourceLoadBegin(WTF::Optional<double> load_begin_time);
diff --git a/third_party/WebKit/Source/core/loader/InteractiveDetectorTest.cpp b/third_party/WebKit/Source/core/loader/InteractiveDetectorTest.cpp index 7cda6c9..564824c0 100644 --- a/third_party/WebKit/Source/core/loader/InteractiveDetectorTest.cpp +++ b/third_party/WebKit/Source/core/loader/InteractiveDetectorTest.cpp
@@ -90,7 +90,7 @@ } void RunTillTimestamp(double target_time) { - double current_time = MonotonicallyIncreasingTime(); + double current_time = CurrentTimeTicksInSeconds(); platform_->RunForPeriodSeconds(std::max(0.0, target_time - current_time)); } @@ -139,7 +139,7 @@ // The name shows the ordering of these events in the test. TEST_F(InteractiveDetectorTest, FMP_DCL_FmpDetect) { - double t0 = MonotonicallyIncreasingTime(); + double t0 = CurrentTimeTicksInSeconds(); SimulateNavigationStart(t0); // Network is forever quiet for this test. SetActiveConnections(1); @@ -152,7 +152,7 @@ } TEST_F(InteractiveDetectorTest, DCL_FMP_FmpDetect) { - double t0 = MonotonicallyIncreasingTime(); + double t0 = CurrentTimeTicksInSeconds(); SimulateNavigationStart(t0); // Network is forever quiet for this test. SetActiveConnections(1); @@ -165,7 +165,7 @@ } TEST_F(InteractiveDetectorTest, InstantDetectionAtFmpDetectIfPossible) { - double t0 = MonotonicallyIncreasingTime(); + double t0 = CurrentTimeTicksInSeconds(); SimulateNavigationStart(t0); // Network is forever quiet for this test. SetActiveConnections(1); @@ -178,7 +178,7 @@ } TEST_F(InteractiveDetectorTest, FmpDetectFiresAfterLateLongTask) { - double t0 = MonotonicallyIncreasingTime(); + double t0 = CurrentTimeTicksInSeconds(); SimulateNavigationStart(t0); // Network is forever quiet for this test. SetActiveConnections(1); @@ -191,7 +191,7 @@ } TEST_F(InteractiveDetectorTest, FMP_FmpDetect_DCL) { - double t0 = MonotonicallyIncreasingTime(); + double t0 = CurrentTimeTicksInSeconds(); SimulateNavigationStart(t0); // Network is forever quiet for this test. SetActiveConnections(1); @@ -202,7 +202,7 @@ } TEST_F(InteractiveDetectorTest, LongTaskBeforeFMPDoesNotAffectTTI) { - double t0 = MonotonicallyIncreasingTime(); + double t0 = CurrentTimeTicksInSeconds(); SimulateNavigationStart(t0); // Network is forever quiet for this test. SetActiveConnections(1); @@ -216,7 +216,7 @@ } TEST_F(InteractiveDetectorTest, DCLDoesNotResetTimer) { - double t0 = MonotonicallyIncreasingTime(); + double t0 = CurrentTimeTicksInSeconds(); SimulateNavigationStart(t0); // Network is forever quiet for this test. SetActiveConnections(1); @@ -230,7 +230,7 @@ } TEST_F(InteractiveDetectorTest, DCL_FMP_FmpDetect_LT) { - double t0 = MonotonicallyIncreasingTime(); + double t0 = CurrentTimeTicksInSeconds(); SimulateNavigationStart(t0); // Network is forever quiet for this test. SetActiveConnections(1); @@ -244,7 +244,7 @@ } TEST_F(InteractiveDetectorTest, DCL_FMP_LT_FmpDetect) { - double t0 = MonotonicallyIncreasingTime(); + double t0 = CurrentTimeTicksInSeconds(); SimulateNavigationStart(t0); // Network is forever quiet for this test. SetActiveConnections(1); @@ -258,7 +258,7 @@ } TEST_F(InteractiveDetectorTest, FMP_FmpDetect_LT_DCL) { - double t0 = MonotonicallyIncreasingTime(); + double t0 = CurrentTimeTicksInSeconds(); SimulateNavigationStart(t0); // Network is forever quiet for this test. SetActiveConnections(1); @@ -272,7 +272,7 @@ } TEST_F(InteractiveDetectorTest, DclIsMoreThan5sAfterFMP) { - double t0 = MonotonicallyIncreasingTime(); + double t0 = CurrentTimeTicksInSeconds(); SimulateNavigationStart(t0); // Network is forever quiet for this test. SetActiveConnections(1); @@ -289,7 +289,7 @@ } TEST_F(InteractiveDetectorTest, NetworkBusyBlocksTTIEvenWhenMainThreadQuiet) { - double t0 = MonotonicallyIncreasingTime(); + double t0 = CurrentTimeTicksInSeconds(); SimulateNavigationStart(t0); SetActiveConnections(1); SimulateDOMContentLoadedEnd(t0 + 2.0); @@ -307,7 +307,7 @@ } TEST_F(InteractiveDetectorTest, LongEnoughQuietWindowBetweenFMPAndFmpDetect) { - double t0 = MonotonicallyIncreasingTime(); + double t0 = CurrentTimeTicksInSeconds(); SimulateNavigationStart(t0); SetActiveConnections(1); SimulateDOMContentLoadedEnd(t0 + 2.0); @@ -323,7 +323,7 @@ } TEST_F(InteractiveDetectorTest, NetworkBusyEndIsNotTTI) { - double t0 = MonotonicallyIncreasingTime(); + double t0 = CurrentTimeTicksInSeconds(); SimulateNavigationStart(t0); SetActiveConnections(1); SimulateDOMContentLoadedEnd(t0 + 2.0); @@ -340,7 +340,7 @@ } TEST_F(InteractiveDetectorTest, LateLongTaskWithLateFMPDetection) { - double t0 = MonotonicallyIncreasingTime(); + double t0 = CurrentTimeTicksInSeconds(); SimulateNavigationStart(t0); SetActiveConnections(1); SimulateDOMContentLoadedEnd(t0 + 2.0); @@ -355,7 +355,7 @@ } TEST_F(InteractiveDetectorTest, IntermittentNetworkBusyBlocksTTI) { - double t0 = MonotonicallyIncreasingTime(); + double t0 = CurrentTimeTicksInSeconds(); SimulateNavigationStart(t0); SetActiveConnections(1); SimulateDOMContentLoadedEnd(t0 + 2.0); @@ -378,7 +378,7 @@ } TEST_F(InteractiveDetectorTest, InvalidatingUserInput) { - double t0 = MonotonicallyIncreasingTime(); + double t0 = CurrentTimeTicksInSeconds(); SimulateNavigationStart(t0); // Network is forever quiet for this test. SetActiveConnections(1); @@ -400,7 +400,7 @@ // Public because it's executed on a task queue. void DummyTaskWithDuration(double duration_seconds) { platform_->AdvanceClockSeconds(duration_seconds); - dummy_task_end_time_ = MonotonicallyIncreasingTime(); + dummy_task_end_time_ = CurrentTimeTicksInSeconds(); } protected: @@ -421,7 +421,7 @@ }; TEST_F(InteractiveDetectorTestWithDummyPage, TaskLongerThan5sBlocksTTI) { - double t0 = MonotonicallyIncreasingTime(); + double t0 = CurrentTimeTicksInSeconds(); InteractiveDetector* detector = InteractiveDetector::From(GetDocument()); detector->SetNavigationStartTime(t0); platform_->RunForPeriodSeconds(4.0); @@ -445,7 +445,7 @@ } TEST_F(InteractiveDetectorTestWithDummyPage, LongTaskAfterTTIDoesNothing) { - double t0 = MonotonicallyIncreasingTime(); + double t0 = CurrentTimeTicksInSeconds(); InteractiveDetector* detector = InteractiveDetector::From(GetDocument()); detector->SetNavigationStartTime(t0); platform_->RunForPeriodSeconds(4.0);
diff --git a/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp b/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp index 0d8685d..ee9dd98 100644 --- a/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp +++ b/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp
@@ -101,7 +101,7 @@ ->GetTiming() .NavigationStart(); if (navigation_start) { - scheduled_clobber_abort_time_histogram.Count(MonotonicallyIncreasingTime() - + scheduled_clobber_abort_time_histogram.Count(CurrentTimeTicksInSeconds() - navigation_start); } }
diff --git a/third_party/WebKit/Source/core/loader/resource/ImageResource.cpp b/third_party/WebKit/Source/core/loader/resource/ImageResource.cpp index ae5774bc..7245d0d 100644 --- a/third_party/WebKit/Source/core/loader/resource/ImageResource.cpp +++ b/third_party/WebKit/Source/core/loader/resource/ImageResource.cpp
@@ -351,7 +351,7 @@ // words, we only invalidate this image every |kFlushDelaySeconds| seconds // while loading. if (!flush_timer_.IsActive()) { - double now = WTF::MonotonicallyIncreasingTime(); + double now = WTF::CurrentTimeTicksInSeconds(); if (!last_flush_time_) last_flush_time_ = now; @@ -368,7 +368,7 @@ // We might have already loaded the image fully, in which case we don't need // to call |updateImage()|. if (IsLoading()) { - last_flush_time_ = WTF::MonotonicallyIncreasingTime(); + last_flush_time_ = WTF::CurrentTimeTicksInSeconds(); UpdateImage(Data(), ImageResourceContent::kUpdateImage, false); } } @@ -386,7 +386,7 @@ if (!all_data_received && Loader()) { // Observers are notified via ImageResource::finish(). // TODO(hiroshige): Do not call didFinishLoading() directly. - Loader()->DidFinishLoading(MonotonicallyIncreasingTime(), size, size, size); + Loader()->DidFinishLoading(CurrentTimeTicksInSeconds(), size, size, size); } else { auto result = GetContent()->UpdateImage( nullptr, GetStatus(),
diff --git a/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp b/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp index 0fd473b..ad449521 100644 --- a/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp +++ b/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp
@@ -247,15 +247,17 @@ ImageBuffer* OffscreenCanvas::GetOrCreateImageBuffer() { if (!image_buffer_) { bool is_accelerated_2d_canvas_blacklisted = true; - base::WeakPtr<WebGraphicsContext3DProviderWrapper> - context_provider_wrapper = SharedGpuContext::ContextProviderWrapper(); - if (context_provider_wrapper) { - const gpu::GpuFeatureInfo& gpu_feature_info = - context_provider_wrapper->ContextProvider()->GetGpuFeatureInfo(); - if (gpu::kGpuFeatureStatusEnabled == - gpu_feature_info - .status_values[gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS]) { - is_accelerated_2d_canvas_blacklisted = false; + if (SharedGpuContext::IsGpuCompositingEnabled()) { + base::WeakPtr<WebGraphicsContext3DProviderWrapper> + context_provider_wrapper = SharedGpuContext::ContextProviderWrapper(); + if (context_provider_wrapper) { + const gpu::GpuFeatureInfo& gpu_feature_info = + context_provider_wrapper->ContextProvider()->GetGpuFeatureInfo(); + if (gpu::kGpuFeatureStatusEnabled == + gpu_feature_info + .status_values[gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS]) { + is_accelerated_2d_canvas_blacklisted = false; + } } } @@ -334,7 +336,7 @@ void OffscreenCanvas::DoCommit() { TRACE_EVENT0("blink", "OffscreenCanvas::DoCommit"); - double commit_start_time = WTF::MonotonicallyIncreasingTime(); + double commit_start_time = WTF::CurrentTimeTicksInSeconds(); DCHECK(current_frame_); GetOrCreateFrameDispatcher()->DispatchFrame( std::move(current_frame_), commit_start_time, current_frame_damage_rect_); @@ -388,7 +390,7 @@ return exception_state.Reject(script_state); } - double start_time = WTF::MonotonicallyIncreasingTime(); + double start_time = WTF::CurrentTimeTicksInSeconds(); String encoding_mime_type = ImageEncoderUtils::ToEncodingMimeType( options.type(), ImageEncoderUtils::kEncodeReasonConvertToBlobPromise);
diff --git a/third_party/WebKit/Source/core/page/AutoscrollController.cpp b/third_party/WebKit/Source/core/page/AutoscrollController.cpp index 6a226b8..340f1c8 100644 --- a/third_party/WebKit/Source/core/page/AutoscrollController.cpp +++ b/third_party/WebKit/Source/core/page/AutoscrollController.cpp
@@ -322,7 +322,7 @@ switch (autoscroll_type_) { case kAutoscrollForDragAndDrop: ScheduleMainThreadAnimation(); - if ((TimeTicks::Now() - drag_and_drop_autoscroll_start_time_) > + if ((CurrentTimeTicks() - drag_and_drop_autoscroll_start_time_) > kAutoscrollDelay) autoscroll_layout_object_->Autoscroll( drag_and_drop_autoscroll_reference_position_);
diff --git a/third_party/WebKit/Source/core/page/AutoscrollControllerTest.cpp b/third_party/WebKit/Source/core/page/AutoscrollControllerTest.cpp index a321031e..2c40731 100644 --- a/third_party/WebKit/Source/core/page/AutoscrollControllerTest.cpp +++ b/third_party/WebKit/Source/core/page/AutoscrollControllerTest.cpp
@@ -60,7 +60,7 @@ WebMouseEvent event(WebInputEvent::kMouseDown, WebFloatPoint(5, 5), WebFloatPoint(5, 5), WebPointerProperties::Button::kLeft, 0, WebInputEvent::Modifiers::kLeftButtonDown, - TimeTicks::Now().InSeconds()); + CurrentTimeTicks().InSeconds()); event.SetFrameScale(1); GetDocument().GetFrame()->GetEventHandler().HandleMousePressEvent(event);
diff --git a/third_party/WebKit/Source/core/page/ChromeClientImpl.cpp b/third_party/WebKit/Source/core/page/ChromeClientImpl.cpp index 61a5487..a884747 100644 --- a/third_party/WebKit/Source/core/page/ChromeClientImpl.cpp +++ b/third_party/WebKit/Source/core/page/ChromeClientImpl.cpp
@@ -501,11 +501,10 @@ IsHTMLEmbedElement(*result.InnerNode()))) { LayoutObject* object = result.InnerNode()->GetLayoutObject(); if (object && object->IsLayoutEmbeddedContent()) { - PluginView* plugin_view = ToLayoutEmbeddedContent(object)->Plugin(); - if (plugin_view && plugin_view->IsPluginContainer()) { - WebPluginContainerImpl* plugin = - ToWebPluginContainerImpl(plugin_view); - url = plugin->Plugin()->LinkAtPosition( + WebPluginContainerImpl* plugin_view = + ToLayoutEmbeddedContent(object)->Plugin(); + if (plugin_view) { + url = plugin_view->Plugin()->LinkAtPosition( result.RoundedPointInInnerNodeFrame()); } }
diff --git a/third_party/WebKit/Source/core/page/ContextMenuController.cpp b/third_party/WebKit/Source/core/page/ContextMenuController.cpp index 18208ca..e68ec50e 100644 --- a/third_party/WebKit/Source/core/page/ContextMenuController.cpp +++ b/third_party/WebKit/Source/core/page/ContextMenuController.cpp
@@ -55,7 +55,6 @@ #include "core/page/ContextMenuProvider.h" #include "core/page/FocusController.h" #include "core/page/Page.h" -#include "core/plugins/PluginView.h" #include "platform/ContextMenu.h" #include "platform/ContextMenuItem.h" #include "platform/exported/WrappedResourceResponse.h" @@ -366,11 +365,12 @@ IsHTMLEmbedElement(*r.InnerNode())) { LayoutObject* object = r.InnerNode()->GetLayoutObject(); if (object && object->IsLayoutEmbeddedContent()) { - PluginView* plugin_view = ToLayoutEmbeddedContent(object)->Plugin(); - if (plugin_view && plugin_view->IsPluginContainer()) { + WebPluginContainerImpl* plugin_view = + ToLayoutEmbeddedContent(object)->Plugin(); + if (plugin_view) { data.media_type = WebContextMenuData::kMediaTypePlugin; - WebPlugin* plugin = ToWebPluginContainerImpl(plugin_view)->Plugin(); + WebPlugin* plugin = plugin_view->Plugin(); data.link_url = plugin->LinkAtPosition(data.mouse_position); HTMLPlugInElement* plugin_element = ToHTMLPlugInElement(r.InnerNode());
diff --git a/third_party/WebKit/Source/core/page/ContextMenuControllerTest.cpp b/third_party/WebKit/Source/core/page/ContextMenuControllerTest.cpp index 99e13cee..19e1f277 100644 --- a/third_party/WebKit/Source/core/page/ContextMenuControllerTest.cpp +++ b/third_party/WebKit/Source/core/page/ContextMenuControllerTest.cpp
@@ -57,7 +57,7 @@ bool ShowContextMenu(const ContextMenu* context_menu, WebMenuSourceType source) { - return web_view_helper_.WebView() + return web_view_helper_.GetWebView() ->GetPage() ->GetContextMenuController() .ShowContextMenu(context_menu, source); @@ -68,7 +68,7 @@ web_view_helper_.LocalMainFrame()->GetDocument()); } - Page* GetPage() { return web_view_helper_.WebView()->GetPage(); } + Page* GetPage() { return web_view_helper_.GetWebView()->GetPage(); } const TestWebFrameClientImpl& GetWebFrameClient() const { return web_frame_client_;
diff --git a/third_party/WebKit/Source/core/page/DragController.cpp b/third_party/WebKit/Source/core/page/DragController.cpp index 3fc8cf0..a871a07 100644 --- a/third_party/WebKit/Source/core/page/DragController.cpp +++ b/third_party/WebKit/Source/core/page/DragController.cpp
@@ -130,7 +130,7 @@ drag_data->GlobalPosition().Y()), WebPointerProperties::Button::kLeft, 0, static_cast<WebInputEvent::Modifiers>(drag_data->GetModifiers()), - TimeTicks::Now().InSeconds()); + CurrentTimeTicks().InSeconds()); // TODO(dtapuska): Really we should chnage DragData to store the viewport // coordinates and scale. result.SetFrameScale(1);
diff --git a/third_party/WebKit/Source/core/page/FocusController.cpp b/third_party/WebKit/Source/core/page/FocusController.cpp index 2005653..ffa47938 100644 --- a/third_party/WebKit/Source/core/page/FocusController.cpp +++ b/third_party/WebKit/Source/core/page/FocusController.cpp
@@ -246,7 +246,7 @@ ContainerNode& scoping_root_node, const Element* current, FocusController::OwnerMap& owner_map) - : current_(const_cast<Element*>(current)) { + : current_(current) { if (HTMLSlotElement* slot = ToHTMLSlotElementOrNull(scoping_root_node)) { if (slot->AssignedNodes().IsEmpty()) { navigation_ = new FocusNavigation(scoping_root_node, *slot, owner_map);
diff --git a/third_party/WebKit/Source/core/page/Page.cpp b/third_party/WebKit/Source/core/page/Page.cpp index 807f8f9..fcdfa68 100644 --- a/third_party/WebKit/Source/core/page/Page.cpp +++ b/third_party/WebKit/Source/core/page/Page.cpp
@@ -450,6 +450,24 @@ void Page::SetLifecycleState(PageLifecycleState state) { if (state == page_lifecycle_state_) return; + + if (RuntimeEnabledFeatures::PageLifecycleEnabled()) { + if (state == PageLifecycleState::kStopped) { + for (Frame* frame = main_frame_.Get(); frame; + frame = frame->Tree().TraverseNext()) { + frame->DidFreeze(); + } + } else if (state == PageLifecycleState::kActive || + state == PageLifecycleState::kHidden) { + // TODO(fmeawad): Only resume the page that just became visible, blocked + // on task queues per frame. + DCHECK(page_lifecycle_state_ == PageLifecycleState::kStopped); + for (Frame* frame = main_frame_.Get(); frame; + frame = frame->Tree().TraverseNext()) { + frame->DidResume(); + } + } + } page_lifecycle_state_ = state; }
diff --git a/third_party/WebKit/Source/core/page/PageLifecycleState.h b/third_party/WebKit/Source/core/page/PageLifecycleState.h index 4762e71..c10e31c 100644 --- a/third_party/WebKit/Source/core/page/PageLifecycleState.h +++ b/third_party/WebKit/Source/core/page/PageLifecycleState.h
@@ -8,8 +8,10 @@ namespace blink { enum class PageLifecycleState { - kUnknown, - kStopped, + kUnknown, // The page state is unknown. + kActive, // The page is visible and active. + kHidden, // The page is not visible but active. + kStopped, // The page is stopped. }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/page/PageOverlayTest.cpp b/third_party/WebKit/Source/core/page/PageOverlayTest.cpp index ffdfec76..3ff7454 100644 --- a/third_party/WebKit/Source/core/page/PageOverlayTest.cpp +++ b/third_party/WebKit/Source/core/page/PageOverlayTest.cpp
@@ -82,7 +82,7 @@ GetWebView()->IsAcceleratedCompositingActive()); } - WebViewImpl* GetWebView() const { return helper_.WebView(); } + WebViewImpl* GetWebView() const { return helper_.GetWebView(); } std::unique_ptr<PageOverlay> CreateSolidYellowOverlay() { return PageOverlay::Create(
diff --git a/third_party/WebKit/Source/core/page/ValidationMessageClientImpl.cpp b/third_party/WebKit/Source/core/page/ValidationMessageClientImpl.cpp index 9fcf493..562fe7ca4 100644 --- a/third_party/WebKit/Source/core/page/ValidationMessageClientImpl.cpp +++ b/third_party/WebKit/Source/core/page/ValidationMessageClientImpl.cpp
@@ -78,7 +78,7 @@ const double kMinimumSecondToShowValidationMessage = 5.0; const double kSecondPerCharacter = 0.05; finish_time_ = - MonotonicallyIncreasingTime() + + CurrentTimeTicksInSeconds() + std::max(kMinimumSecondToShowValidationMessage, (message.length() + sub_message.length()) * kSecondPerCharacter); @@ -144,7 +144,7 @@ void ValidationMessageClientImpl::CheckAnchorStatus(TimerBase*) { DCHECK(current_anchor_); if ((!LayoutTestSupport::IsRunningLayoutTest() && - MonotonicallyIncreasingTime() >= finish_time_) || + CurrentTimeTicksInSeconds() >= finish_time_) || !CurrentView()) { HideValidationMessage(*current_anchor_); return;
diff --git a/third_party/WebKit/Source/core/page/ViewportTest.cpp b/third_party/WebKit/Source/core/page/ViewportTest.cpp index e2dbef0..8337be9d 100644 --- a/third_party/WebKit/Source/core/page/ViewportTest.cpp +++ b/third_party/WebKit/Source/core/page/ViewportTest.cpp
@@ -124,7 +124,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layout_size.Width()); @@ -143,7 +143,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -162,7 +162,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layout_size.Width()); @@ -181,7 +181,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(160, constraints.layout_size.Width()); @@ -200,7 +200,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(640, constraints.layout_size.Width()); @@ -219,7 +219,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(200, constraints.layout_size.Width()); @@ -238,7 +238,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(1280, constraints.layout_size.Width()); @@ -257,7 +257,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(1280, constraints.layout_size.Width()); @@ -276,7 +276,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(1280, constraints.layout_size.Width()); @@ -295,7 +295,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(1280, constraints.layout_size.Width()); @@ -314,7 +314,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -333,7 +333,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(640, constraints.layout_size.Width()); @@ -352,7 +352,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(1280, constraints.layout_size.Width()); @@ -371,7 +371,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layout_size.Width()); @@ -390,7 +390,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -409,7 +409,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -428,7 +428,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -447,7 +447,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(64, constraints.layout_size.Width()); @@ -466,7 +466,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(160, constraints.layout_size.Width()); @@ -485,7 +485,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -504,7 +504,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -523,7 +523,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -542,7 +542,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -561,7 +561,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -580,7 +580,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -599,7 +599,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -618,7 +618,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -637,7 +637,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(352, constraints.layout_size.Width()); @@ -656,7 +656,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(700, constraints.layout_size.Width()); @@ -675,7 +675,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(200, constraints.layout_size.Width()); @@ -694,7 +694,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -713,7 +713,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -732,7 +732,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layout_size.Width()); @@ -751,7 +751,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(640, constraints.layout_size.Width()); @@ -770,7 +770,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(1280, constraints.layout_size.Width()); @@ -789,7 +789,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_NEAR(636.36, constraints.layout_size.Width(), 0.01f); @@ -808,7 +808,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layout_size.Width()); @@ -827,7 +827,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(640, constraints.layout_size.Width()); @@ -846,7 +846,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(200, constraints.layout_size.Width()); @@ -865,7 +865,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(700, constraints.layout_size.Width()); @@ -884,7 +884,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(1000, constraints.layout_size.Width()); @@ -903,7 +903,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layout_size.Width()); @@ -922,7 +922,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(64, constraints.layout_size.Width()); @@ -941,7 +941,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(10000, constraints.layout_size.Width()); @@ -960,7 +960,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(3200, constraints.layout_size.Width()); @@ -979,7 +979,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(32, constraints.layout_size.Width()); @@ -998,7 +998,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layout_size.Width()); @@ -1017,7 +1017,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(3000, constraints.layout_size.Width()); @@ -1036,7 +1036,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layout_size.Width()); @@ -1055,7 +1055,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -1074,7 +1074,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -1093,7 +1093,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -1112,7 +1112,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -1131,7 +1131,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -1150,7 +1150,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -1169,7 +1169,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -1188,7 +1188,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layout_size.Width()); @@ -1207,7 +1207,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(3200, constraints.layout_size.Width()); @@ -1226,7 +1226,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layout_size.Width()); @@ -1245,7 +1245,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(32, constraints.layout_size.Width()); @@ -1264,7 +1264,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layout_size.Width()); @@ -1283,7 +1283,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layout_size.Width()); @@ -1302,7 +1302,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layout_size.Width()); @@ -1321,7 +1321,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layout_size.Width()); @@ -1340,7 +1340,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(100, constraints.layout_size.Width()); @@ -1359,7 +1359,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(100, constraints.layout_size.Width()); @@ -1378,7 +1378,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layout_size.Width()); @@ -1397,7 +1397,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layout_size.Width()); @@ -1416,7 +1416,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(100, constraints.layout_size.Width()); @@ -1435,7 +1435,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(100, constraints.layout_size.Width()); @@ -1454,7 +1454,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layout_size.Width()); @@ -1473,7 +1473,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(100, constraints.layout_size.Width()); @@ -1492,7 +1492,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(100, constraints.layout_size.Width()); @@ -1511,7 +1511,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(100, constraints.layout_size.Width()); @@ -1530,7 +1530,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(64, constraints.layout_size.Width()); @@ -1549,7 +1549,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(32, constraints.layout_size.Width()); @@ -1568,7 +1568,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(1280, constraints.layout_size.Width()); @@ -1587,7 +1587,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(100, constraints.layout_size.Width()); @@ -1606,7 +1606,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layout_size.Width()); @@ -1625,7 +1625,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layout_size.Width()); @@ -1644,7 +1644,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(3000, constraints.layout_size.Width()); @@ -1663,7 +1663,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(400, constraints.layout_size.Width()); @@ -1682,7 +1682,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -1701,7 +1701,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -1720,7 +1720,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(540, constraints.layout_size.Width()); @@ -1739,7 +1739,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_NEAR(457.14, constraints.layout_size.Width(), 0.01f); @@ -1758,7 +1758,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -1777,7 +1777,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -1796,7 +1796,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(700, constraints.layout_size.Width()); @@ -1815,7 +1815,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(400, constraints.layout_size.Width()); @@ -1834,7 +1834,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(400, constraints.layout_size.Width()); @@ -1853,7 +1853,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(400, constraints.layout_size.Width()); @@ -1872,7 +1872,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(400, constraints.layout_size.Width()); @@ -1891,7 +1891,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -1910,7 +1910,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -1929,7 +1929,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -1948,7 +1948,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -1967,7 +1967,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -1986,7 +1986,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -2005,7 +2005,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -2024,7 +2024,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -2043,7 +2043,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(400, constraints.layout_size.Width()); @@ -2062,7 +2062,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -2081,7 +2081,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -2100,7 +2100,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(400, constraints.layout_size.Width()); @@ -2119,7 +2119,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(400, constraints.layout_size.Width()); @@ -2138,7 +2138,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -2157,7 +2157,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layout_size.Width()); @@ -2176,7 +2176,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layout_size.Width()); @@ -2195,7 +2195,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layout_size.Width()); @@ -2214,7 +2214,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -2233,7 +2233,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -2252,7 +2252,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layout_size.Width()); @@ -2271,7 +2271,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layout_size.Width()); @@ -2290,7 +2290,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -2309,7 +2309,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -2328,7 +2328,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -2347,7 +2347,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(123, constraints.layout_size.Width()); @@ -2366,7 +2366,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layout_size.Width()); @@ -2385,7 +2385,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layout_size.Width()); @@ -2404,7 +2404,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layout_size.Width()); @@ -2423,7 +2423,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -2442,7 +2442,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(160, constraints.layout_size.Width()); @@ -2461,7 +2461,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -2480,7 +2480,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layout_size.Width()); @@ -2499,7 +2499,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(980, constraints.layout_size.Width()); @@ -2518,7 +2518,7 @@ nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_NEAR(123.0f, constraints.layout_size.Width(), 0.01); @@ -2537,7 +2537,7 @@ base_url_ + "viewport/viewport-legacy-handheldfriendly.html", nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layout_size.Width()); @@ -2563,7 +2563,7 @@ base_url_ + "viewport/viewport-legacy-merge-quirk-1.html", nullptr, nullptr, nullptr, SetQuirkViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(640, constraints.layout_size.Width()); @@ -2582,7 +2582,7 @@ base_url_ + "viewport/viewport-legacy-merge-quirk-2.html", nullptr, nullptr, nullptr, SetQuirkViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); // This quirk allows content attributes of meta viewport tags to be merged. page->GetSettings().SetViewportMetaMergeContentQuirk(true); @@ -2604,7 +2604,7 @@ base_url_ + "viewport/viewport-legacy-mobileoptimized.html", nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); @@ -2624,7 +2624,7 @@ base_url_ + "viewport/viewport-legacy-mobileoptimized-2.html", nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); @@ -2644,7 +2644,7 @@ base_url_ + "viewport/viewport-legacy-mobileoptimized-2.html", nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); @@ -2664,7 +2664,7 @@ base_url_ + "viewport/viewport-legacy-ordering-2.html", nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); @@ -2684,7 +2684,7 @@ base_url_ + "viewport/viewport-legacy-ordering-3.html", nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); @@ -2704,7 +2704,7 @@ base_url_ + "viewport/viewport-legacy-ordering-4.html", nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); @@ -2724,7 +2724,7 @@ base_url_ + "viewport/viewport-legacy-ordering-5.html", nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); @@ -2744,7 +2744,7 @@ base_url_ + "viewport/viewport-legacy-ordering-6.html", nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); @@ -2764,7 +2764,7 @@ base_url_ + "viewport/viewport-legacy-ordering-7.html", nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); @@ -2784,7 +2784,7 @@ base_url_ + "viewport/viewport-legacy-ordering-8.html", nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); @@ -2804,7 +2804,7 @@ base_url_ + "viewport/viewport-legacy-ordering-10.html", nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 800, 600); EXPECT_EQ(5000, constraints.layout_size.Width()); @@ -2818,7 +2818,7 @@ base_url_ + "viewport/viewport-legacy-xhtmlmp.html", nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layout_size.Width()); @@ -2839,7 +2839,7 @@ base_url_ + "viewport/viewport-legacy-xhtmlmp-misplaced-doctype.html", nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(640, constraints.layout_size.Width()); @@ -2858,7 +2858,7 @@ base_url_ + "viewport/viewport-legacy-xhtmlmp-ordering.html", nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(640, constraints.layout_size.Width()); @@ -2877,7 +2877,7 @@ base_url_ + "viewport/viewport-legacy-xhtmlmp.html", nullptr, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(320, constraints.layout_size.Width()); @@ -2922,8 +2922,8 @@ base_url_ + "viewport/viewport-limits-adjusted-for-no-user-scale.html", nullptr, nullptr, nullptr, SetViewportSettings); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); - Page* page = web_view_helper.WebView()->GetPage(); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 10, 10); EXPECT_FALSE(page->GetViewportDescription().user_zoom); @@ -2940,8 +2940,8 @@ base_url_ + "viewport/viewport-limits-adjusted-for-user-scale.html", nullptr, nullptr, nullptr, SetViewportSettings); - web_view_helper.WebView()->UpdateAllLifecyclePhases(); - Page* page = web_view_helper.WebView()->GetPage(); + web_view_helper.GetWebView()->UpdateAllLifecyclePhases(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 10, 10); EXPECT_TRUE(page->GetViewportDescription().user_zoom); @@ -2958,24 +2958,24 @@ base_url_ + "viewport/viewport-gpu-rasterization-disabled-without-viewport.html", nullptr, nullptr, nullptr, SetViewportSettings); - web_view_helper.WebView()->Resize(WebSize(640, 480)); - EXPECT_FALSE(web_view_helper.WebView() + web_view_helper.GetWebView()->Resize(WebSize(640, 480)); + EXPECT_FALSE(web_view_helper.GetWebView() ->MatchesHeuristicsForGpuRasterizationForTesting()); // Also test that setting enableViewport to false (as on desktop Chrome) // supports GPU raster unconditionally. web_view_helper.InitializeAndLoad( base_url_ + "viewport/viewport-gpu-rasterization-disabled-without-viewport.html"); - web_view_helper.WebView()->Resize(WebSize(640, 480)); - EXPECT_TRUE(web_view_helper.WebView() + web_view_helper.GetWebView()->Resize(WebSize(640, 480)); + EXPECT_TRUE(web_view_helper.GetWebView() ->MatchesHeuristicsForGpuRasterizationForTesting()); RegisterMockedHttpURLLoad("viewport/viewport-gpu-rasterization.html"); web_view_helper.InitializeAndLoad( base_url_ + "viewport/viewport-gpu-rasterization.html", nullptr, nullptr, nullptr, SetViewportSettings); - web_view_helper.WebView()->Resize(WebSize(640, 480)); - EXPECT_TRUE(web_view_helper.WebView() + web_view_helper.GetWebView()->Resize(WebSize(640, 480)); + EXPECT_TRUE(web_view_helper.GetWebView() ->MatchesHeuristicsForGpuRasterizationForTesting()); RegisterMockedHttpURLLoad( @@ -2984,48 +2984,48 @@ base_url_ + "viewport/viewport-gpu-rasterization-expanded-heuristics.html", nullptr, nullptr, nullptr, SetViewportSettings); - web_view_helper.WebView()->Resize(WebSize(640, 480)); - EXPECT_TRUE(web_view_helper.WebView() + web_view_helper.GetWebView()->Resize(WebSize(640, 480)); + EXPECT_TRUE(web_view_helper.GetWebView() ->MatchesHeuristicsForGpuRasterizationForTesting()); RegisterMockedHttpURLLoad("viewport/viewport-1.html"); web_view_helper.InitializeAndLoad(base_url_ + "viewport/viewport-1.html", nullptr, nullptr, nullptr, SetViewportSettings); - web_view_helper.WebView()->Resize(WebSize(640, 480)); - EXPECT_TRUE(web_view_helper.WebView() + web_view_helper.GetWebView()->Resize(WebSize(640, 480)); + EXPECT_TRUE(web_view_helper.GetWebView() ->MatchesHeuristicsForGpuRasterizationForTesting()); RegisterMockedHttpURLLoad("viewport/viewport-15.html"); web_view_helper.InitializeAndLoad(base_url_ + "viewport/viewport-15.html", nullptr, nullptr, nullptr, SetViewportSettings); - web_view_helper.WebView()->Resize(WebSize(640, 480)); - EXPECT_TRUE(web_view_helper.WebView() + web_view_helper.GetWebView()->Resize(WebSize(640, 480)); + EXPECT_TRUE(web_view_helper.GetWebView() ->MatchesHeuristicsForGpuRasterizationForTesting()); RegisterMockedHttpURLLoad("viewport/viewport-130.html"); web_view_helper.InitializeAndLoad(base_url_ + "viewport/viewport-130.html", nullptr, nullptr, nullptr, SetViewportSettings); - web_view_helper.WebView()->Resize(WebSize(640, 480)); - EXPECT_TRUE(web_view_helper.WebView() + web_view_helper.GetWebView()->Resize(WebSize(640, 480)); + EXPECT_TRUE(web_view_helper.GetWebView() ->MatchesHeuristicsForGpuRasterizationForTesting()); RegisterMockedHttpURLLoad("viewport/viewport-legacy-handheldfriendly.html"); web_view_helper.InitializeAndLoad( base_url_ + "viewport/viewport-legacy-handheldfriendly.html", nullptr, nullptr, nullptr, SetViewportSettings); - web_view_helper.WebView()->Resize(WebSize(640, 480)); - EXPECT_TRUE(web_view_helper.WebView() + web_view_helper.GetWebView()->Resize(WebSize(640, 480)); + EXPECT_TRUE(web_view_helper.GetWebView() ->MatchesHeuristicsForGpuRasterizationForTesting()); RegisterMockedHttpURLLoad("viewport/viewport-legacy-mobileoptimized.html"); web_view_helper.InitializeAndLoad( base_url_ + "viewport/viewport-legacy-handheldfriendly.html", nullptr, nullptr, nullptr, SetViewportSettings); - web_view_helper.WebView()->Resize(WebSize(640, 480)); - EXPECT_TRUE(web_view_helper.WebView() + web_view_helper.GetWebView()->Resize(WebSize(640, 480)); + EXPECT_TRUE(web_view_helper.GetWebView() ->MatchesHeuristicsForGpuRasterizationForTesting()); } @@ -3052,7 +3052,7 @@ base_url_ + "viewport/viewport-warnings-1.html", &web_frame_client, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_TRUE(web_frame_client.messages.IsEmpty()); @@ -3075,7 +3075,7 @@ base_url_ + "viewport/viewport-warnings-2.html", &web_frame_client, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(1U, web_frame_client.messages.size()); @@ -3102,7 +3102,7 @@ base_url_ + "viewport/viewport-warnings-3.html", &web_frame_client, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(1U, web_frame_client.messages.size()); @@ -3131,7 +3131,7 @@ base_url_ + "viewport/viewport-warnings-4.html", &web_frame_client, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(1U, web_frame_client.messages.size()); @@ -3160,7 +3160,7 @@ base_url_ + "viewport/viewport-warnings-5.html", &web_frame_client, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(1U, web_frame_client.messages.size()); @@ -3190,7 +3190,7 @@ base_url_ + "viewport/viewport-warnings-6.html", &web_frame_client, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); PageScaleConstraints constraints = RunViewportTest(page, 320, 352); EXPECT_EQ(1U, web_frame_client.messages.size()); @@ -3218,7 +3218,7 @@ base_url_ + "viewport/viewport-warnings-7.html", &web_frame_client, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); RunViewportTest(page, 320, 352); EXPECT_EQ(0U, web_frame_client.messages.size()); @@ -3234,7 +3234,7 @@ base_url_ + "viewport/viewport-warnings-8.html", &web_frame_client, nullptr, nullptr, SetViewportSettings); - Page* page = web_view_helper.WebView()->GetPage(); + Page* page = web_view_helper.GetWebView()->GetPage(); RunViewportTest(page, 320, 352); EXPECT_EQ(0U, web_frame_client.messages.size());
diff --git a/third_party/WebKit/Source/core/page/scrolling/RootScrollerTest.cpp b/third_party/WebKit/Source/core/page/scrolling/RootScrollerTest.cpp index 929b3c9..f6777ee0 100644 --- a/third_party/WebKit/Source/core/page/scrolling/RootScrollerTest.cpp +++ b/third_party/WebKit/Source/core/page/scrolling/RootScrollerTest.cpp
@@ -5,6 +5,7 @@ #include "bindings/core/v8/node_or_string.h" #include "core/exported/WebRemoteFrameImpl.h" #include "core/frame/BrowserControls.h" +#include "core/frame/DOMVisualViewport.h" #include "core/frame/FrameTestHelpers.h" #include "core/frame/LocalFrameView.h" #include "core/frame/RootFrameViewport.h" @@ -21,6 +22,9 @@ #include "core/paint/PaintLayerScrollableArea.h" #include "core/paint/compositing/CompositedLayerMapping.h" #include "core/paint/compositing/PaintLayerCompositor.h" +#include "core/testing/sim/SimDisplayItemList.h" +#include "core/testing/sim/SimRequest.h" +#include "core/testing/sim/SimTest.h" #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" #include "platform/testing/URLTestHelpers.h" #include "platform/testing/UnitTestHelpers.h" @@ -105,9 +109,9 @@ RunPendingTasks(); } - WebViewImpl* GetWebView() const { return helper_.WebView(); } + WebViewImpl* GetWebView() const { return helper_.GetWebView(); } - Page& GetPage() const { return *helper_.WebView()->GetPage(); } + Page& GetPage() const { return *GetWebView()->GetPage(); } LocalFrame* MainFrame() const { return GetWebView()->MainFrameImpl()->GetFrame(); @@ -1171,6 +1175,74 @@ &MainFrameView()->GetRootFrameViewport()->LayoutViewport()); } +class RootScrollerSimTest : public ::testing::WithParamInterface<bool>, + private ScopedRootLayerScrollingForTest, + public SimTest { + public: + RootScrollerSimTest() : ScopedRootLayerScrollingForTest(GetParam()) {} +}; + +INSTANTIATE_TEST_CASE_P(All, RootScrollerSimTest, ::testing::Bool()); + +// Tests that the root scroller doesn't affect visualViewport pageLeft and +// pageTop. +TEST_P(RootScrollerSimTest, RootScrollerDoesntAffectVisualViewport) { + WebView().Resize(WebSize(800, 600)); + SimRequest request("https://example.com/test.html", "text/html"); + LoadURL("https://example.com/test.html"); + request.Start(); + request.Write(R"HTML( + <!DOCTYPE html> + <style> + body, html { + width: 100%; + height: 100%; + margin: 0px; + } + + #spacer { + width: 1000px; + height: 1000px; + } + + #container { + width: 100%; + height: 100%; + overflow: auto; + } + </style> + <div id="container"> + <div id="spacer"></div> + </div> + )HTML"); + + GetDocument().GetPage()->GetVisualViewport().SetScale(2); + GetDocument().GetPage()->GetVisualViewport().SetLocation( + FloatPoint(100, 120)); + + LocalFrame* frame = ToLocalFrame(GetDocument().GetPage()->MainFrame()); + EXPECT_EQ(100, frame->DomWindow()->visualViewport()->pageLeft()); + EXPECT_EQ(120, frame->DomWindow()->visualViewport()->pageTop()); + + request.Finish(); + Compositor().BeginFrame(); + + Element* container = GetDocument().getElementById("container"); + GetDocument().setRootScroller(container); + + Compositor().BeginFrame(); + + ASSERT_EQ(container, + GetDocument().GetRootScrollerController().EffectiveRootScroller()); + container->setScrollTop(50); + container->setScrollLeft(60); + + ASSERT_EQ(50, container->scrollTop()); + ASSERT_EQ(60, container->scrollLeft()); + ASSERT_EQ(100, frame->DomWindow()->visualViewport()->pageLeft()); + EXPECT_EQ(120, frame->DomWindow()->visualViewport()->pageTop()); +} + class RootScrollerHitTest : public RootScrollerTest { public: void CheckHitTestAtBottomOfScreen() {
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp index 2a2ed8d..6c8aaf75 100644 --- a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp +++ b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp
@@ -28,6 +28,7 @@ #include "build/build_config.h" #include "core/dom/Document.h" #include "core/dom/Node.h" +#include "core/exported/WebPluginContainerImpl.h" #include "core/frame/EventHandlerRegistry.h" #include "core/frame/LocalFrame.h" #include "core/frame/LocalFrameView.h" @@ -43,7 +44,6 @@ #include "core/page/Page.h" #include "core/paint/compositing/CompositedLayerMapping.h" #include "core/paint/compositing/PaintLayerCompositor.h" -#include "core/plugins/PluginView.h" #include "platform/animation/CompositorAnimationHost.h" #include "platform/animation/CompositorAnimationTimeline.h" #include "platform/exported/WebScrollbarImpl.h"
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinatorTest.cpp b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinatorTest.cpp index d23cb0b..90a085f0 100644 --- a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinatorTest.cpp +++ b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinatorTest.cpp
@@ -113,7 +113,7 @@ return layer ? layer->PlatformLayer() : nullptr; } - WebViewImpl* GetWebView() const { return helper_.WebView(); } + WebViewImpl* GetWebView() const { return helper_.GetWebView(); } LocalFrame* GetFrame() const { return helper_.LocalMainFrame()->GetFrame(); } WebLayerTreeView* GetWebLayerTreeView() const {
diff --git a/third_party/WebKit/Source/core/paint/BackgroundImageGeometry.cpp b/third_party/WebKit/Source/core/paint/BackgroundImageGeometry.cpp index c5a8f099..eeb0cc4 100644 --- a/third_party/WebKit/Source/core/paint/BackgroundImageGeometry.cpp +++ b/third_party/WebKit/Source/core/paint/BackgroundImageGeometry.cpp
@@ -66,7 +66,7 @@ LayoutSize image_intrinsic_size = image->ImageSize( obj.GetDocument(), obj.Style()->EffectiveZoom(), positioning_area_size); switch (type) { - case kSizeLength: { + case EFillSizeType::kSizeLength: { LayoutSize tile_size(positioning_area_size); Length layer_width = fill_layer.Size().size.Width(); @@ -112,7 +112,7 @@ tile_size.ClampNegativeToZero(); return tile_size; } - case kSizeNone: { + case EFillSizeType::kSizeNone: { // If both values are 'auto' then the intrinsic width and/or height of the // image should be used, if any. if (!image_intrinsic_size.IsEmpty()) @@ -120,10 +120,10 @@ // If the image has neither an intrinsic width nor an intrinsic height, // its size is determined as for 'contain'. - type = kContain; + type = EFillSizeType::kContain; } - case kContain: - case kCover: { + case EFillSizeType::kContain: + case EFillSizeType::kCover: { float horizontal_scale_factor = image_intrinsic_size.Width() ? positioning_area_size.Width().ToFloat() / @@ -138,7 +138,7 @@ // positioningAreaSize in that dimension, so that rounding of floating // point approximation to LayoutUnit do not shrink the image to smaller // than the positioningAreaSize. - if (type == kContain) { + if (type == EFillSizeType::kContain) { if (horizontal_scale_factor < vertical_scale_factor) return LayoutSize( positioning_area_size.Width(),
diff --git a/third_party/WebKit/Source/core/paint/EmbeddedObjectPaintInvalidator.cpp b/third_party/WebKit/Source/core/paint/EmbeddedObjectPaintInvalidator.cpp index 23d7173..c6da3586 100644 --- a/third_party/WebKit/Source/core/paint/EmbeddedObjectPaintInvalidator.cpp +++ b/third_party/WebKit/Source/core/paint/EmbeddedObjectPaintInvalidator.cpp
@@ -4,9 +4,9 @@ #include "core/paint/EmbeddedObjectPaintInvalidator.h" +#include "core/exported/WebPluginContainerImpl.h" #include "core/layout/LayoutEmbeddedObject.h" #include "core/paint/BoxPaintInvalidator.h" -#include "core/plugins/PluginView.h" namespace blink { @@ -14,7 +14,7 @@ PaintInvalidationReason reason = BoxPaintInvalidator(embedded_object_, context_).InvalidatePaint(); - PluginView* plugin = embedded_object_.Plugin(); + WebPluginContainerImpl* plugin = embedded_object_.Plugin(); if (plugin) plugin->InvalidatePaint();
diff --git a/third_party/WebKit/Source/core/paint/FirstMeaningfulPaintDetector.cpp b/third_party/WebKit/Source/core/paint/FirstMeaningfulPaintDetector.cpp index c93ffec..1cbc0ceb 100644 --- a/third_party/WebKit/Source/core/paint/FirstMeaningfulPaintDetector.cpp +++ b/third_party/WebKit/Source/core/paint/FirstMeaningfulPaintDetector.cpp
@@ -94,7 +94,7 @@ // Skip document background-only paints. if (paint_timing_->FirstPaintRendered() == 0.0) return; - provisional_first_meaningful_paint_ = MonotonicallyIncreasingTime(); + provisional_first_meaningful_paint_ = CurrentTimeTicksInSeconds(); next_paint_is_meaningful_ = false; if (network2_quiet_reached_) @@ -209,7 +209,7 @@ kHadNetworkQuietEnumMax }; DEFINE_STATIC_LOCAL(EnumerationHistogram, had_network_quiet_histogram, - ("PageLoad.Experimental.Renderer." + ("PageLoad.Internal.Renderer." "FirstMeaningfulPaintDetector.HadNetworkQuiet", kHadNetworkQuietEnumMax)); @@ -222,7 +222,7 @@ }; DEFINE_STATIC_LOCAL( EnumerationHistogram, first_meaningful_paint_ordering_histogram, - ("PageLoad.Experimental.Renderer.FirstMeaningfulPaintDetector." + ("PageLoad.Internal.Renderer.FirstMeaningfulPaintDetector." "FirstMeaningfulPaintOrdering", kFMPOrderingEnumMax));
diff --git a/third_party/WebKit/Source/core/paint/FirstMeaningfulPaintDetectorTest.cpp b/third_party/WebKit/Source/core/paint/FirstMeaningfulPaintDetectorTest.cpp index 93300cc..ca04b1a0 100644 --- a/third_party/WebKit/Source/core/paint/FirstMeaningfulPaintDetectorTest.cpp +++ b/third_party/WebKit/Source/core/paint/FirstMeaningfulPaintDetectorTest.cpp
@@ -23,7 +23,7 @@ double AdvanceClockAndGetTime() { platform_->AdvanceClockSeconds(1); - return MonotonicallyIncreasingTime(); + return CurrentTimeTicksInSeconds(); } PaintTiming& GetPaintTiming() { return PaintTiming::From(GetDocument()); } @@ -78,20 +78,20 @@ platform_->AdvanceClockSeconds(0.001); GetPaintTiming().ReportSwapTime(PaintEvent::kFirstPaint, WebLayerTreeView::SwapResult::kDidSwap, - MonotonicallyIncreasingTime()); + CurrentTimeTicksInSeconds()); } void ClearFirstContentfulPaintSwapPromise() { platform_->AdvanceClockSeconds(0.001); GetPaintTiming().ReportSwapTime(PaintEvent::kFirstContentfulPaint, WebLayerTreeView::SwapResult::kDidSwap, - MonotonicallyIncreasingTime()); + CurrentTimeTicksInSeconds()); } void ClearProvisionalFirstMeaningfulPaintSwapPromise() { platform_->AdvanceClockSeconds(0.001); ClearProvisionalFirstMeaningfulPaintSwapPromise( - MonotonicallyIncreasingTime()); + CurrentTimeTicksInSeconds()); } void ClearProvisionalFirstMeaningfulPaintSwapPromise(double timestamp) {
diff --git a/third_party/WebKit/Source/core/paint/LinkHighlightImpl.cpp b/third_party/WebKit/Source/core/paint/LinkHighlightImpl.cpp index d7c168b..61c58a63 100644 --- a/third_party/WebKit/Source/core/paint/LinkHighlightImpl.cpp +++ b/third_party/WebKit/Source/core/paint/LinkHighlightImpl.cpp
@@ -78,7 +78,7 @@ is_scrolling_graphics_layer_(false), geometry_needs_update_(false), is_animating_(false), - start_time_(MonotonicallyIncreasingTime()), + start_time_(CurrentTimeTicksInSeconds()), unique_id_(NewUniqueObjectId()) { DCHECK(node_); DCHECK(owning_web_view); @@ -315,7 +315,7 @@ // to fade out. float extra_duration_required = std::max( 0.f, kMinPreFadeDuration - - static_cast<float>(MonotonicallyIncreasingTime() - start_time_)); + static_cast<float>(CurrentTimeTicksInSeconds() - start_time_)); if (extra_duration_required) { curve->AddKeyframe(CompositorFloatKeyframe(extra_duration_required, kStartOpacity, timing_function));
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp index 1fa1135..104dabd 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp +++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
@@ -69,6 +69,7 @@ #include "core/layout/LayoutTheme.h" #include "core/layout/LayoutView.h" #include "core/layout/api/LayoutBoxItem.h" +#include "core/layout/ng/legacy_layout_tree_walking.h" #include "core/loader/DocumentLoader.h" #include "core/page/ChromeClient.h" #include "core/page/FocusController.h" @@ -876,10 +877,13 @@ Box().GetDocument().SetAnnotatedRegionsDirty(true); // Our proprietary overflow: overlay value doesn't trigger a layout. - if ((horizontal_scrollbar_should_change && - Box().Style()->OverflowX() != EOverflow::kOverlay) || - (vertical_scrollbar_should_change && - Box().Style()->OverflowY() != EOverflow::kOverlay)) { + // If the box is managed by LayoutNG, don't go here. We don't want to + // re-enter the NG layout algorithm for this box from here. + if (((horizontal_scrollbar_should_change && + Box().Style()->OverflowX() != EOverflow::kOverlay) || + (vertical_scrollbar_should_change && + Box().Style()->OverflowY() != EOverflow::kOverlay)) && + !IsManagedByLayoutNG(Box())) { if ((vertical_scrollbar_should_change && Box().IsHorizontalWritingMode()) || (horizontal_scrollbar_should_change &&
diff --git a/third_party/WebKit/Source/core/paint/PaintTiming.cpp b/third_party/WebKit/Source/core/paint/PaintTiming.cpp index 5b449dd3..e03fdaf 100644 --- a/third_party/WebKit/Source/core/paint/PaintTiming.cpp +++ b/third_party/WebKit/Source/core/paint/PaintTiming.cpp
@@ -58,7 +58,7 @@ // markFirstPaint(). if (first_paint_ != 0.0) return; - SetFirstPaint(MonotonicallyIncreasingTime()); + SetFirstPaint(CurrentTimeTicksInSeconds()); } void PaintTiming::MarkFirstContentfulPaint() { @@ -68,13 +68,13 @@ // markFirstContentfulPaint(). if (first_contentful_paint_ != 0.0) return; - SetFirstContentfulPaint(MonotonicallyIncreasingTime()); + SetFirstContentfulPaint(CurrentTimeTicksInSeconds()); } void PaintTiming::MarkFirstTextPaint() { if (first_text_paint_ != 0.0) return; - first_text_paint_ = MonotonicallyIncreasingTime(); + first_text_paint_ = CurrentTimeTicksInSeconds(); SetFirstContentfulPaint(first_text_paint_); RegisterNotifySwapTime(PaintEvent::kFirstTextPaint); } @@ -82,7 +82,7 @@ void PaintTiming::MarkFirstImagePaint() { if (first_image_paint_ != 0.0) return; - first_image_paint_ = MonotonicallyIncreasingTime(); + first_image_paint_ = CurrentTimeTicksInSeconds(); SetFirstContentfulPaint(first_image_paint_); RegisterNotifySwapTime(PaintEvent::kFirstImagePaint); }
diff --git a/third_party/WebKit/Source/core/paint/compositing/CompositedLayerMapping.cpp b/third_party/WebKit/Source/core/paint/compositing/CompositedLayerMapping.cpp index dc62004..f4cb1a3e 100644 --- a/third_party/WebKit/Source/core/paint/compositing/CompositedLayerMapping.cpp +++ b/third_party/WebKit/Source/core/paint/compositing/CompositedLayerMapping.cpp
@@ -28,6 +28,7 @@ #include <memory> #include "core/dom/DOMNodeIds.h" +#include "core/exported/WebPluginContainerImpl.h" #include "core/frame/LocalFrameView.h" #include "core/frame/RemoteFrame.h" #include "core/frame/Settings.h" @@ -63,7 +64,6 @@ #include "core/paint/ScrollableAreaPainter.h" #include "core/paint/TransformRecorder.h" #include "core/paint/compositing/PaintLayerCompositor.h" -#include "core/plugins/PluginView.h" #include "core/probe/CoreProbes.h" #include "platform/LengthFunctions.h" #include "platform/fonts/FontCache.h" @@ -163,7 +163,8 @@ static WebLayer* PlatformLayerForPlugin(LayoutObject& layout_object) { if (!layout_object.IsEmbeddedObject()) return nullptr; - PluginView* plugin = ToLayoutEmbeddedObject(layout_object).Plugin(); + WebPluginContainerImpl* plugin = + ToLayoutEmbeddedObject(layout_object).Plugin(); return plugin ? plugin->PlatformLayer() : nullptr; }
diff --git a/third_party/WebKit/Source/core/paint/ng/ng_box_fragment_painter.cc b/third_party/WebKit/Source/core/paint/ng/ng_box_fragment_painter.cc index 0753b006..38585f0 100644 --- a/third_party/WebKit/Source/core/paint/ng/ng_box_fragment_painter.cc +++ b/third_party/WebKit/Source/core/paint/ng/ng_box_fragment_painter.cc
@@ -484,9 +484,8 @@ paint_info.context, text_fragment, DisplayItem::PaintPhaseToDrawingType(paint_info.phase)); - const Document& document = box_fragment_.GetLayoutObject()->GetDocument(); NGTextFragmentPainter text_painter(text_fragment); - text_painter.Paint(document, paint_info, paint_offset); + text_painter.Paint(paint_info, paint_offset); } bool NGBoxFragmentPainter::
diff --git a/third_party/WebKit/Source/core/paint/ng/ng_text_fragment_painter.cc b/third_party/WebKit/Source/core/paint/ng/ng_text_fragment_painter.cc index 38731c9..c8a4734 100644 --- a/third_party/WebKit/Source/core/paint/ng/ng_text_fragment_painter.cc +++ b/third_party/WebKit/Source/core/paint/ng/ng_text_fragment_painter.cc
@@ -111,12 +111,12 @@ // This is copied from InlineTextBoxPainter::PaintSelection() but lacks of // ltr, expanding new line wrap or so which uses InlineTextBox functions. -void NGTextFragmentPainter::Paint(const Document& document, - const PaintInfo& paint_info, +void NGTextFragmentPainter::Paint(const PaintInfo& paint_info, const LayoutPoint& paint_offset) { const NGPhysicalTextFragment& text_fragment = ToNGPhysicalTextFragment(fragment_.PhysicalFragment()); const ComputedStyle& style = fragment_.Style(); + const Document& document = fragment_.GetLayoutObject()->GetDocument(); if (!ShouldPaintTextFragment(text_fragment, style)) return;
diff --git a/third_party/WebKit/Source/core/paint/ng/ng_text_fragment_painter.h b/third_party/WebKit/Source/core/paint/ng/ng_text_fragment_painter.h index 5bd63d72..ab829064 100644 --- a/third_party/WebKit/Source/core/paint/ng/ng_text_fragment_painter.h +++ b/third_party/WebKit/Source/core/paint/ng/ng_text_fragment_painter.h
@@ -12,7 +12,6 @@ namespace blink { class LayoutPoint; -class Document; class NGPaintFragment; struct PaintInfo; @@ -25,7 +24,7 @@ public: explicit NGTextFragmentPainter(const NGPaintFragment&); - void Paint(const Document&, const PaintInfo&, const LayoutPoint&); + void Paint(const PaintInfo&, const LayoutPoint&); private: const NGPaintFragment& fragment_;
diff --git a/third_party/WebKit/Source/core/plugins/BUILD.gn b/third_party/WebKit/Source/core/plugins/BUILD.gn deleted file mode 100644 index c53b41a0..0000000 --- a/third_party/WebKit/Source/core/plugins/BUILD.gn +++ /dev/null
@@ -1,14 +0,0 @@ -# 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. - -# This currently is here just to hold the header file. If this starts compiling -# source, this target should be changed to a blink_core_sources type. -source_set("plugins") { - sources = [ - "PluginView.h", - ] - deps = [ - "//v8", - ] -}
diff --git a/third_party/WebKit/Source/core/plugins/PluginView.h b/third_party/WebKit/Source/core/plugins/PluginView.h deleted file mode 100644 index 9ef6fb91..0000000 --- a/third_party/WebKit/Source/core/plugins/PluginView.h +++ /dev/null
@@ -1,88 +0,0 @@ -/* - * Copyright (C) 2010 Apple Inc. All rights reserved. - * Copyright (C) 2013 Google Inc. All rights reserved. - * Copyright (C) 2014 Opera Software ASA. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - * DAMAGE. - */ - -#ifndef PluginView_h -#define PluginView_h - -#include "core/CoreExport.h" -#include "core/frame/EmbeddedContentView.h" -#include "platform/geometry/IntRect.h" -#include "platform/scroll/ScrollTypes.h" -#include "platform/wtf/text/WTFString.h" -#include "public/platform/WebFocusType.h" -#include "v8/include/v8.h" - -namespace blink { - -class Event; -class ResourceResponse; -class WebLayer; -class WebPluginContainerImpl; - -// TODO(joelhockey): Remove this class. -// The only implementation of this class is web/WebPluginContainerImpl. -// It can be used directly. -class CORE_EXPORT PluginView : public EmbeddedContentView { - public: - virtual ~PluginView() {} - - bool IsPluginView() const override { return true; } - - virtual void SetFocused(bool, WebFocusType) = 0; - virtual void HandleEvent(Event*) = 0; - virtual void EventListenersRemoved() = 0; - virtual bool IsPluginContainer() const { return false; } - virtual bool IsErrorplaceholder() { return false; } - - virtual WebLayer* PlatformLayer() const { return nullptr; } - virtual v8::Local<v8::Object> ScriptableObject(v8::Isolate*) { - return v8::Local<v8::Object>(); - } - virtual bool WantsWheelEvents() { return false; } - virtual bool SupportsKeyboardFocus() const { return false; } - virtual bool SupportsInputMethod() const { return false; } - virtual bool CanProcessDrag() const { return false; } - - virtual void DidReceiveResponse(const ResourceResponse&) {} - virtual void DidReceiveData(const char*, int) {} - - virtual void UpdateAllLifecyclePhases() {} - virtual void InvalidatePaint() {} - virtual WebPluginContainerImpl* GetWebPluginContainer() const { - return nullptr; - } -}; - -DEFINE_TYPE_CASTS(PluginView, - EmbeddedContentView, - embedded_content_view, - embedded_content_view->IsPluginView(), - embedded_content_view.IsPluginView()); - -} // namespace blink - -#endif // PluginView_h
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.h b/third_party/WebKit/Source/core/style/ComputedStyle.h index 4ed898d..d2cb9756 100644 --- a/third_party/WebKit/Source/core/style/ComputedStyle.h +++ b/third_party/WebKit/Source/core/style/ComputedStyle.h
@@ -231,7 +231,7 @@ ALWAYS_INLINE ComputedStyle(const ComputedStyle&); static scoped_refptr<ComputedStyle> CreateInitialStyle(); - // TODO(shend): Remove this. Initial style should not be mutable. + // TODO(crbug.com/794841): Remove this. Initial style should not be mutable. CORE_EXPORT static ComputedStyle& MutableInitialStyle(); public: @@ -1046,7 +1046,7 @@ } // Comparison operators - // TODO(shend): Replace callers of operator== wth a named method instead, e.g. + // FIXME: Replace callers of operator== wth a named method instead, e.g. // inheritedEquals(). CORE_EXPORT bool operator==(const ComputedStyle& other) const; bool operator!=(const ComputedStyle& other) const {
diff --git a/third_party/WebKit/Source/core/style/ComputedStyleConstants.h b/third_party/WebKit/Source/core/style/ComputedStyleConstants.h index fbc5ef2..262126d 100644 --- a/third_party/WebKit/Source/core/style/ComputedStyleConstants.h +++ b/third_party/WebKit/Source/core/style/ComputedStyleConstants.h
@@ -132,7 +132,12 @@ enum class EFillLayerType : unsigned { kBackground, kMask }; // CSS3 Background Values -enum EFillSizeType { kContain, kCover, kSizeLength, kSizeNone }; +enum class EFillSizeType : unsigned { + kContain, + kCover, + kSizeLength, + kSizeNone +}; // CSS3 Background Position enum BackgroundEdgeOrigin { kTopEdge, kRightEdge, kBottomEdge, kLeftEdge };
diff --git a/third_party/WebKit/Source/core/style/FillLayer.cpp b/third_party/WebKit/Source/core/style/FillLayer.cpp index 913ce4f1..ee6cc8f 100644 --- a/third_party/WebKit/Source/core/style/FillLayer.cpp +++ b/third_party/WebKit/Source/core/style/FillLayer.cpp
@@ -56,8 +56,10 @@ repeat_x_(static_cast<unsigned>(FillLayer::InitialFillRepeatX(type))), repeat_y_(static_cast<unsigned>(FillLayer::InitialFillRepeatY(type))), composite_(FillLayer::InitialFillComposite(type)), - size_type_(use_initial_values ? FillLayer::InitialFillSizeType(type) - : kSizeNone), + size_type_( + use_initial_values + ? static_cast<unsigned>(FillLayer::InitialFillSizeType(type)) + : static_cast<unsigned>(EFillSizeType::kSizeNone)), blend_mode_(static_cast<unsigned>(FillLayer::InitialFillBlendMode(type))), mask_source_type_(FillLayer::InitialFillMaskSourceType(type)), background_x_origin_(kLeftEdge),
diff --git a/third_party/WebKit/Source/core/style/FillLayer.h b/third_party/WebKit/Source/core/style/FillLayer.h index d4d1ec5..ea0439a 100644 --- a/third_party/WebKit/Source/core/style/FillLayer.h +++ b/third_party/WebKit/Source/core/style/FillLayer.h
@@ -38,7 +38,7 @@ struct FillSize { DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); - FillSize() : type(kSizeLength) {} + FillSize() : type(EFillSizeType::kSizeLength) {} FillSize(EFillSizeType t, const LengthSize& l) : type(t), size(l) {} @@ -112,7 +112,9 @@ bool IsRepeatYSet() const { return repeat_y_set_; } bool IsCompositeSet() const { return composite_set_; } bool IsBlendModeSet() const { return blend_mode_set_; } - bool IsSizeSet() const { return size_type_ != kSizeNone; } + bool IsSizeSet() const { + return size_type_ != static_cast<unsigned>(EFillSizeType::kSizeNone); + } bool IsMaskSourceTypeSet() const { return mask_source_type_set_; } void SetImage(StyleImage* i) { @@ -170,10 +172,10 @@ blend_mode_ = static_cast<unsigned>(b); blend_mode_set_ = true; } - void SetSizeType(EFillSizeType b) { size_type_ = b; } + void SetSizeType(EFillSizeType b) { size_type_ = static_cast<unsigned>(b); } void SetSizeLength(const LengthSize& length) { size_length_ = length; } void SetSize(const FillSize& f) { - size_type_ = f.type; + size_type_ = static_cast<unsigned>(f.type); size_length_ = f.size; } void SetMaskSourceType(EMaskSourceType m) { @@ -201,7 +203,9 @@ void ClearRepeatY() { repeat_y_set_ = false; } void ClearComposite() { composite_set_ = false; } void ClearBlendMode() { blend_mode_set_ = false; } - void ClearSize() { size_type_ = kSizeNone; } + void ClearSize() { + size_type_ = static_cast<unsigned>(EFillSizeType::kSizeNone); + } void ClearMaskSourceType() { mask_source_type_set_ = false; } FillLayer& operator=(const FillLayer&); @@ -274,7 +278,7 @@ return WebBlendMode::kNormal; } static EFillSizeType InitialFillSizeType(EFillLayerType) { - return kSizeLength; + return EFillSizeType::kSizeLength; } static LengthSize InitialFillSizeLength(EFillLayerType) { return LengthSize();
diff --git a/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.cpp b/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.cpp index d39310544..f2bf6d9b 100644 --- a/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.cpp +++ b/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.cpp
@@ -122,7 +122,7 @@ if (!image_->GetImageObserver()) return; - image_->ServiceAnimations(MonotonicallyIncreasingTime()); + image_->ServiceAnimations(CurrentTimeTicksInSeconds()); } } // namespace blink
diff --git a/third_party/WebKit/Source/core/testing/sim/SimTest.cpp b/third_party/WebKit/Source/core/testing/sim/SimTest.cpp index 812ddeb..3006815 100644 --- a/third_party/WebKit/Source/core/testing/sim/SimTest.cpp +++ b/third_party/WebKit/Source/core/testing/sim/SimTest.cpp
@@ -63,7 +63,7 @@ } WebViewImpl& SimTest::WebView() { - return *web_view_helper_.WebView(); + return *web_view_helper_.GetWebView(); } WebLocalFrameImpl& SimTest::MainFrame() {
diff --git a/third_party/WebKit/Source/core/timing/MemoryInfo.cpp b/third_party/WebKit/Source/core/timing/MemoryInfo.cpp index 1d55f5e..ab5059f 100644 --- a/third_party/WebKit/Source/core/timing/MemoryInfo.cpp +++ b/third_party/WebKit/Source/core/timing/MemoryInfo.cpp
@@ -58,7 +58,7 @@ public: HeapSizeCache() - : last_update_time_(MonotonicallyIncreasingTime() - + : last_update_time_(CurrentTimeTicksInSeconds() - kTwentyMinutesInSeconds) {} void GetCachedHeapSize(HeapInfo& info) { @@ -77,7 +77,7 @@ // We rate-limit queries to once every twenty minutes to make it more // difficult for attackers to compare memory usage before and after some // event. - double now = MonotonicallyIncreasingTime(); + double now = CurrentTimeTicksInSeconds(); if (now - last_update_time_ >= kTwentyMinutesInSeconds) { Update(); last_update_time_ = now;
diff --git a/third_party/WebKit/Source/core/timing/PerformanceBase.cpp b/third_party/WebKit/Source/core/timing/PerformanceBase.cpp index 15820dc..62e6f17 100644 --- a/third_party/WebKit/Source/core/timing/PerformanceBase.cpp +++ b/third_party/WebKit/Source/core/timing/PerformanceBase.cpp
@@ -70,7 +70,7 @@ DEFINE_THREAD_SAFE_STATIC_LOCAL( DOMHighResTimeStamp, unix_at_zero_monotonic, {ConvertSecondsToDOMHighResTimeStamp(CurrentTime() - - MonotonicallyIncreasingTime())}); + CurrentTimeTicksInSeconds())}); return unix_at_zero_monotonic; } @@ -608,7 +608,7 @@ } DOMHighResTimeStamp PerformanceBase::now() const { - return MonotonicTimeToDOMHighResTimeStamp(MonotonicallyIncreasingTime()); + return MonotonicTimeToDOMHighResTimeStamp(CurrentTimeTicksInSeconds()); } ScriptValue PerformanceBase::toJSONForBinding(ScriptState* script_state) const {
diff --git a/third_party/WebKit/Source/core/timing/PerformanceTest.cpp b/third_party/WebKit/Source/core/timing/PerformanceTest.cpp index aea5c93..3653259 100644 --- a/third_party/WebKit/Source/core/timing/PerformanceTest.cpp +++ b/third_party/WebKit/Source/core/timing/PerformanceTest.cpp
@@ -173,8 +173,7 @@ auto* document_loader = page_holder->GetFrame().Loader().GetDocumentLoader(); ASSERT_TRUE(document_loader); - document_loader->GetTiming().SetNavigationStart( - MonotonicallyIncreasingTime()); + document_loader->GetTiming().SetNavigationStart(CurrentTimeTicksInSeconds()); EXPECT_EQ(&page_holder->GetFrame(), perf->GetFrame()); EXPECT_EQ(&page_holder->GetFrame(), timing->GetFrame());
diff --git a/third_party/WebKit/Source/core/workers/SharedWorker.cpp b/third_party/WebKit/Source/core/workers/SharedWorker.cpp index 3052220..0b9cd1217 100644 --- a/third_party/WebKit/Source/core/workers/SharedWorker.cpp +++ b/third_party/WebKit/Source/core/workers/SharedWorker.cpp
@@ -71,6 +71,8 @@ "Access to shared workers is denied to origin '" + document->GetSecurityOrigin()->ToString() + "'."); return nullptr; + } else if (document->GetSecurityOrigin()->IsLocal()) { + UseCounter::Count(document, WebFeature::kFileAccessedSharedWorker); } KURL script_url = ResolveURL(context, url, exception_state,
diff --git a/third_party/WebKit/Source/core/workers/WorkerThread.cpp b/third_party/WebKit/Source/core/workers/WorkerThread.cpp index 0f0cd2d..eee284d 100644 --- a/third_party/WebKit/Source/core/workers/WorkerThread.cpp +++ b/third_party/WebKit/Source/core/workers/WorkerThread.cpp
@@ -306,7 +306,7 @@ WorkerThread::WorkerThread(ThreadableLoadingContext* loading_context, WorkerReportingProxy& worker_reporting_proxy) - : time_origin_(MonotonicallyIncreasingTime()), + : time_origin_(CurrentTimeTicksInSeconds()), worker_thread_id_(GetNextWorkerThreadId()), forcible_termination_delay_(kForcibleTerminationDelay), inspector_task_runner_(std::make_unique<InspectorTaskRunner>()), @@ -448,7 +448,7 @@ global_scope_inspector_creation_params->stack_id); GlobalScope()->EvaluateClassicScript(script_url, std::move(source_code), std::move(cached_meta_data)); - debugger->ExternalAsyncTaskStarted( + debugger->ExternalAsyncTaskFinished( global_scope_inspector_creation_params->stack_id); }
diff --git a/third_party/WebKit/Source/core/workers/WorkerThreadTestHelper.h b/third_party/WebKit/Source/core/workers/WorkerThreadTestHelper.h index a8c75dcd..8f2c066c 100644 --- a/third_party/WebKit/Source/core/workers/WorkerThreadTestHelper.h +++ b/third_party/WebKit/Source/core/workers/WorkerThreadTestHelper.h
@@ -63,7 +63,7 @@ WorkerThread* thread) : WorkerGlobalScope(std::move(creation_params), thread, - MonotonicallyIncreasingTime()) {} + CurrentTimeTicksInSeconds()) {} ~FakeWorkerGlobalScope() override {}
diff --git a/third_party/WebKit/Source/devtools/BUILD.gn b/third_party/WebKit/Source/devtools/BUILD.gn index 7a425e7..b3c3d268 100644 --- a/third_party/WebKit/Source/devtools/BUILD.gn +++ b/third_party/WebKit/Source/devtools/BUILD.gn
@@ -435,8 +435,6 @@ "front_end/persistence/IsolatedFileSystem.js", "front_end/persistence/IsolatedFileSystemManager.js", "front_end/persistence/NetworkPersistenceManager.js", - "front_end/persistence/overridesSettingsTab.css", - "front_end/persistence/OverridesSettingsTab.js", "front_end/persistence/Persistence.js", "front_end/persistence/PersistenceActions.js", "front_end/persistence/PersistenceUtils.js", @@ -628,6 +626,7 @@ "front_end/sources/ScriptFormatterEditorAction.js", "front_end/sources/serviceWorkersSidebar.css", "front_end/sources/SimpleHistoryManager.js", + "front_end/sources/SnippetsPlugin.js", "front_end/sources/SourceFormatter.js", "front_end/sources/SourceMapNamesResolver.js", "front_end/sources/SourcesNavigator.js",
diff --git a/third_party/WebKit/Source/devtools/front_end/bindings_test_runner/IsolatedFilesystemTestRunner.js b/third_party/WebKit/Source/devtools/front_end/bindings_test_runner/IsolatedFilesystemTestRunner.js index 687c5723..e99f25c 100644 --- a/third_party/WebKit/Source/devtools/front_end/bindings_test_runner/IsolatedFilesystemTestRunner.js +++ b/third_party/WebKit/Source/devtools/front_end/bindings_test_runner/IsolatedFilesystemTestRunner.js
@@ -34,17 +34,17 @@ } }, - reportCreatedPromise: function() { - return new Promise(fulfill => this.reportCreated(fulfill)); + reportCreatedPromise: function(type) { + return new Promise(fulfill => this.reportCreated(fulfill, type)); }, - reportCreated: function(callback) { + reportCreated: function(callback, type) { var fileSystemPath = this.fileSystemPath; BindingsTestRunner.TestFileSystem._instances[this.fileSystemPath] = this; InspectorFrontendHost.events.dispatchEventToListeners( InspectorFrontendHostAPI.Events.FileSystemAdded, - {fileSystem: {fileSystemPath: this.fileSystemPath, fileSystemName: this.fileSystemPath}}); + {fileSystem: {fileSystemPath: this.fileSystemPath, fileSystemName: this.fileSystemPath, type}}); Persistence.isolatedFileSystemManager.addEventListener( Persistence.IsolatedFileSystemManager.Events.FileSystemAdded, created);
diff --git a/third_party/WebKit/Source/devtools/front_end/bindings_test_runner/OverridesTestRunner.js b/third_party/WebKit/Source/devtools/front_end/bindings_test_runner/OverridesTestRunner.js index 1e32237..a56eee8 100644 --- a/third_party/WebKit/Source/devtools/front_end/bindings_test_runner/OverridesTestRunner.js +++ b/third_party/WebKit/Source/devtools/front_end/bindings_test_runner/OverridesTestRunner.js
@@ -8,7 +8,7 @@ */ BindingsTestRunner.createOverrideProject = async function(folderPath) { var testFileSystem = new BindingsTestRunner.TestFileSystem(folderPath); - var isolatedFileSystem = await testFileSystem.reportCreatedPromise(); + var isolatedFileSystem = await testFileSystem.reportCreatedPromise('overrides'); isolatedFileSystem._type = 'overrides'; var project = Workspace.workspace.project(Persistence.FileSystemWorkspaceBinding.projectId(isolatedFileSystem.path()));
diff --git a/third_party/WebKit/Source/devtools/front_end/common/Throttler.js b/third_party/WebKit/Source/devtools/front_end/common/Throttler.js index 0dd9c59..6ab1882 100644 --- a/third_party/WebKit/Source/devtools/front_end/common/Throttler.js +++ b/third_party/WebKit/Source/devtools/front_end/common/Throttler.js
@@ -18,7 +18,7 @@ } _processCompleted() { - this._lastCompleteTime = window.performance.now(); + this._lastCompleteTime = this._getTime(); this._isRunningProcess = false; if (this._process) this._innerSchedule(false); @@ -48,7 +48,7 @@ // Run the first scheduled task instantly. var hasScheduledTasks = !!this._processTimeout || this._isRunningProcess; - var okToFire = window.performance.now() - this._lastCompleteTime > this._timeout; + var okToFire = this._getTime() - this._lastCompleteTime > this._timeout; asSoonAsPossible = !!asSoonAsPossible || (!hasScheduledTasks && okToFire); var forceTimerUpdate = asSoonAsPossible && !this._asSoonAsPossible; @@ -87,6 +87,13 @@ _setTimeout(operation, timeout) { return setTimeout(operation, timeout); } + + /** + * @return {number} + */ + _getTime() { + return window.performance.now(); + } }; /** @typedef {function(!Error=)} */
diff --git a/third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js b/third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js index ca51220..d312b96 100644 --- a/third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js +++ b/third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js
@@ -161,6 +161,7 @@ this._messagesElement.id = 'console-messages'; this._messagesElement.classList.add('monospace'); this._messagesElement.addEventListener('click', this._messagesClicked.bind(this), true); + this._messagesElement.addEventListener('paste', this._messagesPasted.bind(this), true); this._viewportThrottler = new Common.Throttler(50); @@ -860,6 +861,15 @@ this._updateMessageList(); } + /** + * @param {!Event} event + */ + _messagesPasted(event) { + if (UI.isEditing()) + return; + this._prompt.focus(); + } + _registerShortcuts() { this._shortcuts = {};
diff --git a/third_party/WebKit/Source/devtools/front_end/emulated_devices/module.json b/third_party/WebKit/Source/devtools/front_end/emulated_devices/module.json index 0319bbf..a78f194 100644 --- a/third_party/WebKit/Source/devtools/front_end/emulated_devices/module.json +++ b/third_party/WebKit/Source/devtools/front_end/emulated_devices/module.json
@@ -20,7 +20,7 @@ "touch", "mobile" ], - "user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1", + "user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D257 Safari/9537.53", "type": "phone", "modes": [ { @@ -38,9 +38,9 @@ }, { "type": "emulated-device", - "order": 40, + "order": 30, "device": { - "show-by-default": false, + "show-by-default": true, "title": "iPhone 5", "screen": { "horizontal": { @@ -65,7 +65,7 @@ "touch", "mobile" ], - "user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1", + "user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1", "type": "phone", "modes": [ { @@ -83,10 +83,10 @@ }, { "type": "emulated-device", - "order": 50, + "order": 31, "device": { - "show-by-default": false, - "title": "iPhone 6", + "show-by-default": true, + "title": "iPhone 6/7/8", "screen": { "horizontal": { "outline" : { @@ -110,7 +110,7 @@ "touch", "mobile" ], - "user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1", + "user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1", "type": "phone", "modes": [ { @@ -128,10 +128,10 @@ }, { "type": "emulated-device", - "order": 60, + "order": 32, "device": { - "show-by-default": false, - "title": "iPhone 6 Plus", + "show-by-default": true, + "title": "iPhone 6/7/8 Plus", "screen": { "horizontal": { "outline" : { @@ -155,7 +155,7 @@ "touch", "mobile" ], - "user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1", + "user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1", "type": "phone", "modes": [ { @@ -173,187 +173,7 @@ }, { "type": "emulated-device", - "order": 61, - "device": { - "show-by-default": true, - "title": "iPhone 7", - "screen": { - "horizontal": { - "outline" : { - "image": "@url(iPhone6-landscape.svg)", - "insets" : { "left": 106, "top": 28, "right": 106, "bottom": 28 } - }, - "width": 667, - "height": 375 - }, - "device-pixel-ratio": 2, - "vertical": { - "outline" : { - "image": "@url(iPhone6-portrait.svg)", - "insets" : { "left": 28, "top": 105, "right": 28, "bottom": 105 } - }, - "width": 375, - "height": 667 - } - }, - "capabilities": [ - "touch", - "mobile" - ], - "user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/56.0.2924.75 Mobile/14E5239e Safari/602.1", - "type": "phone", - "modes": [ - { - "title": "default", - "orientation": "vertical", - "insets": { "left": 0, "top": 0, "right": 0, "bottom": 0 } - }, - { - "title": "default", - "orientation": "horizontal", - "insets": { "left": 0, "top": 0, "right": 0, "bottom": 0 } - } - ] - } - }, - { - "type": "emulated-device", - "order": 62, - "device": { - "show-by-default": true, - "title": "iPhone 7 Plus", - "screen": { - "horizontal": { - "outline" : { - "image": "@url(iPhone6Plus-landscape.svg)", - "insets" : { "left": 109, "top": 29, "right": 109, "bottom": 27 } - }, - "width": 736, - "height": 414 - }, - "device-pixel-ratio": 3, - "vertical": { - "outline" : { - "image": "@url(iPhone6Plus-portrait.svg)", - "insets" : { "left": 26, "top": 107, "right": 30, "bottom": 111 } - }, - "width": 414, - "height": 736 - } - }, - "capabilities": [ - "touch", - "mobile" - ], - "user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/56.0.2924.75 Mobile/14E5239e Safari/602.1", - "type": "phone", - "modes": [ - { - "title": "default", - "orientation": "vertical", - "insets": { "left": 0, "top": 0, "right": 0, "bottom": 0 } - }, - { - "title": "default", - "orientation": "horizontal", - "insets": { "left": 0, "top": 0, "right": 0, "bottom": 0 } - } - ] - } - }, - { - "type": "emulated-device", - "order": 63, - "device": { - "show-by-default": true, - "title": "iPhone 8", - "screen": { - "horizontal": { - "outline" : { - "image": "@url(iPhone6-landscape.svg)", - "insets" : { "left": 106, "top": 28, "right": 106, "bottom": 28 } - }, - "width": 667, - "height": 375 - }, - "device-pixel-ratio": 2, - "vertical": { - "outline" : { - "image": "@url(iPhone6-portrait.svg)", - "insets" : { "left": 28, "top": 105, "right": 28, "bottom": 105 } - }, - "width": 375, - "height": 667 - } - }, - "capabilities": [ - "touch", - "mobile" - ], - "user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/56.0.2924.75 Mobile/14E5239e Safari/602.1", - "type": "phone", - "modes": [ - { - "title": "default", - "orientation": "vertical", - "insets": { "left": 0, "top": 0, "right": 0, "bottom": 0 } - }, - { - "title": "default", - "orientation": "horizontal", - "insets": { "left": 0, "top": 0, "right": 0, "bottom": 0 } - } - ] - } - }, - { - "type": "emulated-device", - "order": 64, - "device": { - "show-by-default": true, - "title": "iPhone 8 Plus", - "screen": { - "horizontal": { - "outline" : { - "image": "@url(iPhone6Plus-landscape.svg)", - "insets" : { "left": 109, "top": 29, "right": 109, "bottom": 27 } - }, - "width": 736, - "height": 414 - }, - "device-pixel-ratio": 3, - "vertical": { - "outline" : { - "image": "@url(iPhone6Plus-portrait.svg)", - "insets" : { "left": 26, "top": 107, "right": 30, "bottom": 111 } - }, - "width": 414, - "height": 736 - } - }, - "capabilities": [ - "touch", - "mobile" - ], - "user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/56.0.2924.75 Mobile/14E5239e Safari/602.1", - "type": "phone", - "modes": [ - { - "title": "default", - "orientation": "vertical", - "insets": { "left": 0, "top": 0, "right": 0, "bottom": 0 } - }, - { - "title": "default", - "orientation": "horizontal", - "insets": { "left": 0, "top": 0, "right": 0, "bottom": 0 } - } - ] - } - }, - { - "type": "emulated-device", - "order": 65, + "order": 33, "device": { "show-by-default": true, "title": "iPhone X", @@ -372,7 +192,7 @@ "touch", "mobile" ], - "user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/56.0.2924.75 Mobile/14E5239e Safari/602.1", + "user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1", "type": "phone", "modes": [ { @@ -524,16 +344,15 @@ }, { "type": "emulated-device", - "order": 20, "device": { "title": "Nexus 5X", "type": "phone", - "user-agent": "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36", + "user-agent": "Mozilla/5.0 (Linux; Android 8.0.0; Nexus 5X Build/OPR4.170623.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36", "capabilities": [ "touch", "mobile" ], - "show-by-default": true, + "show-by-default": false, "screen": { "device-pixel-ratio": 2.625, "vertical": { @@ -613,7 +432,7 @@ "touch", "mobile" ], - "user-agent": "Mozilla/5.0 (Linux; Android 5.1.1; Nexus 6 Build/LYZ28E) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36", + "user-agent": "Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F26U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36", "type": "phone", "modes": [ { @@ -631,9 +450,8 @@ }, { "type": "emulated-device", - "order": 30, "device": { - "show-by-default": true, + "show-by-default": false, "title": "Nexus 6P", "screen": { "horizontal": { @@ -658,7 +476,81 @@ "touch", "mobile" ], - "user-agent": "Mozilla/5.0 (Linux; Android 5.1.1; Nexus 6 Build/LYZ28E) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36", + "user-agent": "Mozilla/5.0 (Linux; Android 8.0.0; Nexus 6P Build/OPP3.170518.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36", + "type": "phone", + "modes": [ + { + "title": "default", + "orientation": "vertical", + "insets": { "left": 0, "top": 0, "right": 0, "bottom": 0 } + }, + { + "title": "default", + "orientation": "horizontal", + "insets": { "left": 0, "top": 0, "right": 0, "bottom": 0 } + } + ] + } + }, + { + "type": "emulated-device", + "order": 20, + "device": { + "show-by-default": true, + "title": "Pixel 2", + "screen": { + "horizontal": { + "width": 731, + "height": 411 + }, + "device-pixel-ratio": 2.625, + "vertical": { + "width": 411, + "height": 731 + } + }, + "capabilities": [ + "touch", + "mobile" + ], + "user-agent": "Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36", + "type": "phone", + "modes": [ + { + "title": "default", + "orientation": "vertical", + "insets": { "left": 0, "top": 0, "right": 0, "bottom": 0 } + }, + { + "title": "default", + "orientation": "horizontal", + "insets": { "left": 0, "top": 0, "right": 0, "bottom": 0 } + } + ] + } + }, + { + "type": "emulated-device", + "order": 21, + "device": { + "show-by-default": true, + "title": "Pixel 2 XL", + "screen": { + "horizontal": { + "width": 823, + "height": 411 + }, + "device-pixel-ratio": 3.5, + "vertical": { + "width": 411, + "height": 823 + } + }, + "capabilities": [ + "touch", + "mobile" + ], + "user-agent": "Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Mobile Safari/537.36", "type": "phone", "modes": [ { @@ -983,7 +875,7 @@ "touch", "mobile" ], - "user-agent": "Mozilla/5.0 (iPad; CPU OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1", + "user-agent": "Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1", "type": "tablet", "modes": [ { @@ -1001,7 +893,7 @@ }, { "type": "emulated-device", - "order": 70, + "order": 40, "device": { "show-by-default": true, "title": "iPad", @@ -1028,7 +920,7 @@ "touch", "mobile" ], - "user-agent": "Mozilla/5.0 (iPad; CPU OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1", + "user-agent": "Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1", "type": "tablet", "modes": [ { @@ -1046,7 +938,7 @@ }, { "type": "emulated-device", - "order": 80, + "order": 41, "device": { "show-by-default": true, "title": "iPad Pro", @@ -1065,7 +957,7 @@ "touch", "mobile" ], - "user-agent": "Mozilla/5.0 (iPad; CPU OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1", + "user-agent": "Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1", "type": "tablet", "modes": [ { @@ -1137,7 +1029,7 @@ "touch", "mobile" ], - "user-agent": "Mozilla/5.0 (Linux; Android 4.3; Nexus 10 Build/JSS15Q) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Safari/537.36", + "user-agent": "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 10 Build/MOB31T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Safari/537.36", "type": "tablet", "modes": [ { @@ -1173,7 +1065,7 @@ "touch", "mobile" ], - "user-agent": "Mozilla/5.0 (Linux; Android 4.3; Nexus 7 Build/JSS15Q) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Safari/537.36", + "user-agent": "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 7 Build/MOB30X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Safari/537.36", "type": "tablet", "modes": [ {
diff --git a/third_party/WebKit/Source/devtools/front_end/emulation/DevicesSettingsTab.js b/third_party/WebKit/Source/devtools/front_end/emulation/DevicesSettingsTab.js index 7f534d4..21556112 100644 --- a/third_party/WebKit/Source/devtools/front_end/emulation/DevicesSettingsTab.js +++ b/third_party/WebKit/Source/devtools/front_end/emulation/DevicesSettingsTab.js
@@ -14,8 +14,8 @@ var header = this.element.createChild('header'); header.createChild('h3').createTextChild(Common.UIString('Emulated Devices')); - this.containerElement = this.element.createChild('div', 'help-container-wrapper') - .createChild('div', 'settings-tab help-content help-container'); + this.containerElement = this.element.createChild('div', 'settings-container-wrapper') + .createChild('div', 'settings-tab settings-content settings-container'); var buttonsRow = this.containerElement.createChild('div', 'devices-button-row'); this._addCustomButton =
diff --git a/third_party/WebKit/Source/devtools/front_end/emulation/devicesSettingsTab.css b/third_party/WebKit/Source/devtools/front_end/emulation/devicesSettingsTab.css index fd05063..68d2e3f 100644 --- a/third_party/WebKit/Source/devtools/front_end/emulation/devicesSettingsTab.css +++ b/third_party/WebKit/Source/devtools/front_end/emulation/devicesSettingsTab.css
@@ -4,7 +4,7 @@ * found in the LICENSE file. */ -.devices-settings-tab .settings-tab.help-content { +.devices-settings-tab .settings-tab.settings-content { display: flex; flex-direction: column; align-items: flex-start;
diff --git a/third_party/WebKit/Source/devtools/front_end/network_log/HAREntry.js b/third_party/WebKit/Source/devtools/front_end/network_log/HAREntry.js index 8cf0c1b..0eeb532f 100644 --- a/third_party/WebKit/Source/devtools/front_end/network_log/HAREntry.js +++ b/third_party/WebKit/Source/devtools/front_end/network_log/HAREntry.js
@@ -331,10 +331,10 @@ /** * @param {!SDK.NetworkRequest} request * @param {number} monotonicTime - * @return {!Date} + * @return {string} */ static pseudoWallTime(request, monotonicTime) { - return new Date(request.pseudoWallTime(monotonicTime) * 1000); + return new Date(request.pseudoWallTime(monotonicTime) * 1000).toJSON(); } /**
diff --git a/third_party/WebKit/Source/devtools/front_end/persistence/NetworkPersistenceManager.js b/third_party/WebKit/Source/devtools/front_end/persistence/NetworkPersistenceManager.js index a5c4b105..f808829 100644 --- a/third_party/WebKit/Source/devtools/front_end/persistence/NetworkPersistenceManager.js +++ b/third_party/WebKit/Source/devtools/front_end/persistence/NetworkPersistenceManager.js
@@ -15,11 +15,6 @@ this._enabledSetting.addChangeListener(this._enabledChanged, this); this._workspace = workspace; - this._domainForFileSystemPathSetting = Common.settings.createSetting('domainForFileSystemPath', []); - /** @type {!Map<string, string>} */ - this._domainForFileSystemMap = new Map(this._domainForFileSystemPathSetting.get()); - /** @type {!Map<string, string>} */ - this._fileSystemForDomain = new Map(this._domainForFileSystemPathSetting.get().map(value => [value[1], value[0]])); /** @type {!Map<string, !Workspace.UISourceCode>} */ this._networkUISourceCodeForEncodedPath = new Map(); @@ -27,13 +22,19 @@ this._updateInterceptionThrottler = new Common.Throttler(50); /** @type {?Workspace.Project} */ + this._project = null; + /** @type {?Workspace.Project} */ this._activeProject = null; + this._active = false; this._enabled = false; - Persistence.isolatedFileSystemManager.addEventListener( - Persistence.IsolatedFileSystemManager.Events.FileSystemRemoved, - event => this._onFileSystemRemoved(/** @type {!Persistence.IsolatedFileSystem} */ (event.data))); + this._workspace.addEventListener( + Workspace.Workspace.Events.ProjectAdded, + event => this._onProjectAdded(/** @type {!Workspace.Project} */ (event.data))); + this._workspace.addEventListener( + Workspace.Workspace.Events.ProjectRemoved, + event => this._onProjectRemoved(/** @type {!Workspace.Project} */ (event.data))); /** @type {!Array<!Common.EventTarget.EventDescriptor>} */ this._eventDescriptors = []; @@ -41,73 +42,19 @@ } /** - * @return {?string} + * @return {boolean} */ - static inspectedPageDomain() { - var maintarget = SDK.targetManager.mainTarget(); - var inspectedURL = maintarget ? maintarget.inspectedURL() : ''; - var parsedURL = new Common.ParsedURL(inspectedURL); - var scheme = parsedURL.scheme; - if (parsedURL.isValid && (scheme === 'http' || scheme === 'https')) - return parsedURL.domain() || null; - return null; - } - - /** - * @param {string} domain - * @param {!Workspace.Project} project - */ - addFileSystemOverridesProject(domain, project) { - var fileSystemPath = Persistence.FileSystemWorkspaceBinding.fileSystemPath(project.id()); - if (!fileSystemPath || this.projectForDomain(domain)) - return; - var oldDomain = this.domainForProject(project); - if (oldDomain) { - this._onProjectRemoved(project); - this._fileSystemForDomain.delete(oldDomain); - } - this._domainForFileSystemMap.set(fileSystemPath, domain); - this._fileSystemForDomain.set(domain, fileSystemPath); - this._domainForFileSystemPathSetting.set(Array.from(this._domainForFileSystemMap.entries())); - - this._onProjectAdded(project); - for (var uiSourceCode of project.uiSourceCodes()) - this._onUISourceCodeAdded(uiSourceCode); - this.dispatchEventToListeners(Persistence.NetworkPersistenceManager.Events.ProjectDomainChanged, project); + active() { + return this._active; } /** * @return {?Workspace.Project} */ - activeProject() { - return this._activeProject; + project() { + return this._project; } - /** - * @param {!Workspace.Project} project - * @return {?string} - */ - domainForProject(project) { - if (project.type() !== Workspace.projectTypes.FileSystem) - return null; - var fileSystemPath = Persistence.FileSystemWorkspaceBinding.fileSystemPath(project.id()); - if (!fileSystemPath) - return null; - return this._domainForFileSystemMap.get(fileSystemPath) || null; - } - - /** - * @param {?string} domain - * @return {?Workspace.Project} - */ - projectForDomain(domain) { - if (!domain) - return null; - var fileSystemPath = this._fileSystemForDomain.get(domain); - if (!fileSystemPath) - return null; - return this._workspace.project(Persistence.FileSystemWorkspaceBinding.projectId(fileSystemPath)) || null; - } /** * @param {!Workspace.UISourceCode} uiSourceCode @@ -120,38 +67,12 @@ return fileSystemUISourceCode[this._originalResponseContentPromiseSymbol] || null; } - /** - * @return {?Workspace.Project} - */ - projectForActiveDomain() { - return this.projectForDomain(Persistence.NetworkPersistenceManager.inspectedPageDomain()); - } - - /** - * @param {!Persistence.IsolatedFileSystem} fileSystem - * @return {?Persistence.FileSystemWorkspaceBinding.FileSystem} - */ - projectForFileSystem(fileSystem) { - if (!this._domainForFileSystemMap.has(fileSystem.path())) - return null; - return /** @type {?Persistence.FileSystemWorkspaceBinding.FileSystem} */ ( - this._workspace.project(Persistence.FileSystemWorkspaceBinding.projectId(fileSystem.path()))); - } - _enabledChanged() { if (this._enabled === this._enabledSetting.get()) return; this._enabled = this._enabledSetting.get(); if (this._enabled) { this._eventDescriptors = [ - this._workspace.addEventListener( - Workspace.Workspace.Events.ProjectAdded, - event => this._onProjectAdded(/** @type {!Workspace.Project} */ (event.data))), - this._workspace.addEventListener( - Workspace.Workspace.Events.ProjectRemoved, - event => this._onProjectRemoved(/** @type {!Workspace.Project} */ (event.data))), - SDK.targetManager.addEventListener( - SDK.TargetManager.Events.InspectedURLChanged, this._updateActiveProject, this), Workspace.workspace.addEventListener( Workspace.Workspace.Events.UISourceCodeRenamed, event => { @@ -178,34 +99,21 @@ } _updateActiveProject() { - var mainTarget = SDK.targetManager.mainTarget(); - if (!this._enabledSetting.get() || !mainTarget) { - this._setActiveProject(null); + var wasActive = this._active; + this._active = !!(this._enabledSetting.get() && SDK.targetManager.mainTarget() && this._project); + if (this._active === wasActive) return; - } - this._setActiveProject(this.projectForDomain(Persistence.NetworkPersistenceManager.inspectedPageDomain())); - } - /** - * @param {?Workspace.Project} project - */ - _setActiveProject(project) { - if (this._activeProject === project) - return; - var oldProject = this._activeProject; - this._activeProject = project; - if (oldProject) - oldProject.uiSourceCodes().forEach(this._onUISourceCodeRemoved.bind(this)); - if (project) - project.uiSourceCodes().forEach(this._onUISourceCodeAdded.bind(this)); - if (project) { + if (this._active) { + this._project.uiSourceCodes().forEach(this._filesystemUISourceCodeAdded.bind(this)); var networkProjects = this._workspace.projectsForType(Workspace.projectTypes.Network); for (var networkProject of networkProjects) - networkProject.uiSourceCodes().forEach(this._onUISourceCodeAdded.bind(this)); - } else { + networkProject.uiSourceCodes().forEach(this._networkUISourceCodeAdded.bind(this)); + } else if (this._project) { + this._project.uiSourceCodes().forEach(this._filesystemUISourceCodeRemoved.bind(this)); this._networkUISourceCodeForEncodedPath.clear(); } - Persistence.persistence.setAutomappingEnabled(!this._activeProject); + Persistence.persistence.setAutomappingEnabled(!this._active); } /** @@ -213,13 +121,13 @@ * @return {string} */ _encodedPathFromUrl(url) { - if (!this._activeProject) + if (!this._active) return ''; var urlPath = Common.ParsedURL.urlWithoutHash(url.replace(/^https?:\/\//, '')); if (urlPath.endsWith('/') && urlPath.indexOf('?') === -1) urlPath = urlPath + 'index.html'; var encodedPathParts = encodeUrlPathToLocalPathParts(urlPath); - var projectPath = Persistence.FileSystemWorkspaceBinding.fileSystemPath(this._activeProject.id()); + var projectPath = Persistence.FileSystemWorkspaceBinding.fileSystemPath(this._project.id()); var encodedPath = encodedPathParts.join('/'); if (projectPath.length + encodedPath.length > 200) { var domain = encodedPathParts[0]; @@ -324,7 +232,7 @@ * @param {!Workspace.UISourceCode} uiSourceCode */ canSaveUISourceCodeForOverrides(uiSourceCode) { - return this._activeProject && uiSourceCode.project().type() === Workspace.projectTypes.Network && + return this._active && uiSourceCode.project().type() === Workspace.projectTypes.Network && !uiSourceCode[this._bindingSymbol]; } @@ -340,7 +248,7 @@ var lastIndexOfSlash = encodedPath.lastIndexOf('/'); var encodedFileName = encodedPath.substr(lastIndexOfSlash + 1); encodedPath = encodedPath.substr(0, lastIndexOfSlash); - await this._activeProject.createFile(encodedPath, encodedFileName, content, encoded); + await this._project.createFile(encodedPath, encodedFileName, content, encoded); this._fileCreatedForTest(encodedPath, encodedFileName); } @@ -368,22 +276,32 @@ * @param {!Workspace.UISourceCode} uiSourceCode */ _onUISourceCodeAdded(uiSourceCode) { - if (!this._activeProject) - return; - if (uiSourceCode.project().type() === Workspace.projectTypes.Network) { - var url = Common.ParsedURL.urlWithoutHash(uiSourceCode.url()); - this._networkUISourceCodeForEncodedPath.set(this._encodedPathFromUrl(url), uiSourceCode); + this._networkUISourceCodeAdded(uiSourceCode); + this._filesystemUISourceCodeAdded(uiSourceCode); + } - var fileSystemUISourceCode = this._activeProject.uiSourceCodeForURL( - this._activeProject.fileSystemPath() + '/' + this._encodedPathFromUrl(url)); - if (!fileSystemUISourceCode) - return; - this._bind(uiSourceCode, fileSystemUISourceCode); + /** + * @param {!Workspace.UISourceCode} uiSourceCode + */ + _networkUISourceCodeAdded(uiSourceCode) { + if (!this._active || uiSourceCode.project().type() !== Workspace.projectTypes.Network) return; - } - if (uiSourceCode.project() !== this._activeProject) - return; + var url = Common.ParsedURL.urlWithoutHash(uiSourceCode.url()); + this._networkUISourceCodeForEncodedPath.set(this._encodedPathFromUrl(url), uiSourceCode); + var fileSystemUISourceCode = + this._project.uiSourceCodeForURL(this._project.fileSystemPath() + '/' + this._encodedPathFromUrl(url)); + if (!fileSystemUISourceCode) + return; + this._bind(uiSourceCode, fileSystemUISourceCode); + } + + /** + * @param {!Workspace.UISourceCode} uiSourceCode + */ + _filesystemUISourceCodeAdded(uiSourceCode) { + if (!this._active || uiSourceCode.project() !== this._project) + return; this._updateInterceptionPatterns(); var relativePath = Persistence.FileSystemWorkspaceBinding.relativePath(uiSourceCode); @@ -400,11 +318,11 @@ * @return {!Promise} */ function innerUpdateInterceptionPatterns() { - if (!this._activeProject) + if (!this._active) return SDK.multitargetNetworkManager.setInterceptionHandlerForPatterns([], this._interceptionHandlerBound); var patterns = new Set(); var indexFileName = 'index.html'; - for (var uiSourceCode of this._activeProject.uiSourceCodes()) { + for (var uiSourceCode of this._project.uiSourceCodes()) { var pattern = this._patternForFileSystemUISourceCode(uiSourceCode); patterns.add(pattern); if (pattern.endsWith('/' + indexFileName)) @@ -420,31 +338,50 @@ } /** - * @param {!Persistence.IsolatedFileSystem} fileSystem + * @param {!Workspace.UISourceCode} uiSourceCode */ - _onFileSystemRemoved(fileSystem) { - var domain = this._domainForFileSystemMap.get(fileSystem.path()); - if (!domain) - return; - this._domainForFileSystemMap.delete(fileSystem.path()); - this._fileSystemForDomain.delete(domain); - this._domainForFileSystemPathSetting.set(Array.from(this._domainForFileSystemMap.entries())); + _onUISourceCodeRemoved(uiSourceCode) { + this._networkUISourceCodeRemoved(uiSourceCode); + this._filesystemUISourceCodeRemoved(uiSourceCode); } /** * @param {!Workspace.UISourceCode} uiSourceCode */ - _onUISourceCodeRemoved(uiSourceCode) { - if (uiSourceCode.project().type() === Workspace.projectTypes.Network) { - this._unbind(uiSourceCode); - this._networkUISourceCodeForEncodedPath.delete(this._encodedPathFromUrl(uiSourceCode.url())); + _networkUISourceCodeRemoved(uiSourceCode) { + if (uiSourceCode.project().type() === Workspace.projectTypes.Network) return; - } + this._unbind(uiSourceCode); + this._networkUISourceCodeForEncodedPath.delete(this._encodedPathFromUrl(uiSourceCode.url())); + } + + /** + * @param {!Workspace.UISourceCode} uiSourceCode + */ + _filesystemUISourceCodeRemoved(uiSourceCode) { + if (uiSourceCode.project() !== this._project) + return; this._updateInterceptionPatterns(); delete uiSourceCode[this._originalResponseContentPromiseSymbol]; this._unbind(uiSourceCode); } + _setProject(project) { + if (project === this._project) + return; + + if (this._project) + this._project.uiSourceCodes().forEach(this._filesystemUISourceCodeRemoved.bind(this)); + + this._project = project; + + if (this._project) + this._project.uiSourceCodes().forEach(this._filesystemUISourceCodeAdded.bind(this)); + + this._updateActiveProject(); + this.dispatchEventToListeners(Persistence.NetworkPersistenceManager.Events.ProjectChanged, this._project); + } + /** * @param {!Workspace.Project} project */ @@ -453,21 +390,21 @@ Persistence.FileSystemWorkspaceBinding.fileSystemType(project) !== 'overrides') return; var fileSystemPath = Persistence.FileSystemWorkspaceBinding.fileSystemPath(project.id()); - var domain = this._domainForFileSystemMap.get(fileSystemPath); - if (!domain) + if (!fileSystemPath) return; - this._updateActiveProject(); + if (this._project) + this._project.remove(); + + this._setProject(project); } /** * @param {!Workspace.Project} project */ _onProjectRemoved(project) { - if (project !== this._activeProject) + if (project !== this._project) return; - for (var uiSourceCode of project.uiSourceCodes()) - this._onUISourceCodeRemoved(uiSourceCode); - this._updateActiveProject(); + this._setProject(null); } /** @@ -476,10 +413,10 @@ */ async _interceptionHandler(interceptedRequest) { var method = interceptedRequest.request.method; - if (!this._activeProject || (method !== 'GET' && method !== 'POST')) + if (!this._active || (method !== 'GET' && method !== 'POST')) return; - var path = this._activeProject.fileSystemPath() + '/' + this._encodedPathFromUrl(interceptedRequest.request.url); - var fileSystemUISourceCode = this._activeProject.uiSourceCodeForURL(path); + var path = this._project.fileSystemPath() + '/' + this._encodedPathFromUrl(interceptedRequest.request.url); + var fileSystemUISourceCode = this._project.uiSourceCodeForURL(path); if (!fileSystemUISourceCode) return; @@ -515,7 +452,7 @@ ]); Persistence.NetworkPersistenceManager.Events = { - ProjectDomainChanged: Symbol('ProjectDomainChanged') + ProjectChanged: Symbol('ProjectChanged') }; /** @type {!Persistence.NetworkPersistenceManager} */
diff --git a/third_party/WebKit/Source/devtools/front_end/persistence/OverridesSettingsTab.js b/third_party/WebKit/Source/devtools/front_end/persistence/OverridesSettingsTab.js deleted file mode 100644 index 27948f8..0000000 --- a/third_party/WebKit/Source/devtools/front_end/persistence/OverridesSettingsTab.js +++ /dev/null
@@ -1,165 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -/** - * @implements {UI.ListWidget.Delegate} - */ -Persistence.OverridesSettingsTab = class extends UI.VBox { - constructor() { - super(); - this.registerRequiredCSS('persistence/overridesSettingsTab.css'); - - var header = this.element.createChild('header'); - header.createChild('h3').createTextChild(Common.UIString('Overrides')); - - this.contentElement.createChild('div', 'overrides-info-message').textContent = Common.UIString( - 'Overrides allow you to modify a resources on a page, automatically ' + - 'save them to disk and reload the page with the changed persisted.'); - this._list = new UI.ListWidget(this); - this._list.element.classList.add('overrides-list'); - this._list.registerRequiredCSS('persistence/overridesSettingsTab.css'); - - var placeholder = createElementWithClass('div', 'overrides-list-empty'); - placeholder.textContent = Common.UIString('No overrides setup'); - this._list.setEmptyPlaceholder(placeholder); - this._list.show(this.contentElement); - - Persistence.isolatedFileSystemManager.addEventListener( - Persistence.IsolatedFileSystemManager.Events.FileSystemAdded, - event => this._fileSystemAdded(/** @type {!Persistence.IsolatedFileSystem} */ (event.data)), this); - Persistence.isolatedFileSystemManager.addEventListener( - Persistence.IsolatedFileSystemManager.Events.FileSystemRemoved, - event => this._fileSystemRemoved(/** @type {!Persistence.IsolatedFileSystem} */ (event.data)), this); - Persistence.networkPersistenceManager.addEventListener( - Persistence.NetworkPersistenceManager.Events.ProjectDomainChanged, event => { - var project = /** @type {!Persistence.FileSystemWorkspaceBinding.FileSystem} */ (event.data); - var fileSystem = Persistence.isolatedFileSystemManager.fileSystem(project.fileSystemPath()); - if (!fileSystem) - return; - this._fileSystemRemoved(fileSystem); - this._fileSystemAdded(fileSystem); - }); - } - - /** - * @override - */ - wasShown() { - this._refresh(); - } - - _refresh() { - this._list.clear(); - var fileSystems = Persistence.isolatedFileSystemManager.fileSystems(); - for (var fileSystem of fileSystems) { - var project = Persistence.networkPersistenceManager.projectForFileSystem(fileSystem); - if (!project) - continue; - this._list.appendItem(project, true); - } - } - - /** - * @override - * @param {*} item - * @param {boolean} editable - * @return {!Element} - */ - renderItem(item, editable) { - var project = /** @type {!Persistence.FileSystemWorkspaceBinding.FileSystem} */ (item); - var element = createElementWithClass('div', 'overrides-list-item'); - - var pathElement = element.createChild('div', 'overrides-path'); - // substr to remove 'file://'' from path. - var fileSystemPath = project.fileSystemPath().substr(7); - pathElement.textContent = fileSystemPath; - pathElement.title = fileSystemPath; - - element.createChild('div', 'overrides-separator'); - - var domainElement = element.createChild('div', 'overrides-domain'); - var domain = Persistence.networkPersistenceManager.domainForProject(project) || ''; - domainElement.textContent = domain; - domainElement.title = domain; - return element; - } - - /** - * @override - * @param {*} item - * @param {number} index - */ - removeItemRequested(item, index) { - var project = /** @type {!Persistence.FileSystemWorkspaceBinding.FileSystem} */ (item); - var fileSystem = /** @type {!Persistence.IsolatedFileSystem} */ ( - Persistence.isolatedFileSystemManager.fileSystem(project.fileSystemPath())); - Persistence.isolatedFileSystemManager.removeFileSystem(fileSystem); - } - - /** - * @override - * @param {*} item - * @param {!UI.ListWidget.Editor} editor - * @param {boolean} isNew - */ - commitEdit(item, editor, isNew) { - var project = /** @type {!Persistence.FileSystemWorkspaceBinding.FileSystem} */ (item); - Persistence.networkPersistenceManager.addFileSystemOverridesProject(editor.control('domain').value.trim(), project); - } - - /** - * @override - * @param {*} item - * @return {!UI.ListWidget.Editor} - */ - beginEdit(item) { - var project = /** @type {!Persistence.FileSystemWorkspaceBinding.FileSystem} */ (item); - var editor = this._createEditor(project); - editor.control('domain').value = Persistence.networkPersistenceManager.domainForProject(project) || ''; - return editor; - } - - /** - * @param {!Persistence.IsolatedFileSystem} fileSystem - */ - _fileSystemAdded(fileSystem) { - this._refresh(); - } - - /** - * @param {!Persistence.IsolatedFileSystem} fileSystem - */ - _fileSystemRemoved(fileSystem) { - this._refresh(); - } - - /** - * @param {!Persistence.FileSystemWorkspaceBinding.FileSystem} project - * @return {!UI.ListWidget.Editor} - */ - _createEditor(project) { - var editor = new UI.ListWidget.Editor(); - var content = editor.contentElement(); - - var titles = content.createChild('div', 'overrides-edit-row'); - // substr to remove 'file://'' from path. - var fileSystemPath = project.fileSystemPath().substr(7); - titles.createChild('div', 'overrides-filesystem-path').textContent = fileSystemPath; - - var fields = content.createChild('div', 'overrides-edit-row'); - fields.createChild('div', 'overrides-domain-label').textContent = Common.UIString('Domain'); - fields.createChild('div', 'overrides-domain') - .appendChild(editor.createInput('domain', 'text', 'example.com', (item, index, input) => { - var domain = Persistence.networkPersistenceManager.domainForProject(project); - var value = input.value.trim(); - if (domain === value) - return true; - if (Persistence.networkPersistenceManager.projectForDomain(value)) - return false; - return /\w+(?:\.\w+)*/.test(value); - })); - - return editor; - } -};
diff --git a/third_party/WebKit/Source/devtools/front_end/persistence/PersistenceUtils.js b/third_party/WebKit/Source/devtools/front_end/persistence/PersistenceUtils.js index fda6edc..3a021fe4 100644 --- a/third_party/WebKit/Source/devtools/front_end/persistence/PersistenceUtils.js +++ b/third_party/WebKit/Source/devtools/front_end/persistence/PersistenceUtils.js
@@ -30,7 +30,7 @@ var icon = UI.Icon.create('mediumicon-file-sync'); icon.title = Persistence.PersistenceUtils.tooltipForUISourceCode(binding.fileSystem); // TODO(allada) This will not work properly with dark theme. - if (Persistence.networkPersistenceManager.activeProject() === binding.fileSystem.project()) + if (Persistence.networkPersistenceManager.project() === binding.fileSystem.project()) icon.style.filter = 'hue-rotate(160deg)'; return icon; }
diff --git a/third_party/WebKit/Source/devtools/front_end/persistence/WorkspaceSettingsTab.js b/third_party/WebKit/Source/devtools/front_end/persistence/WorkspaceSettingsTab.js index 2218dd8..ef162ad9 100644 --- a/third_party/WebKit/Source/devtools/front_end/persistence/WorkspaceSettingsTab.js +++ b/third_party/WebKit/Source/devtools/front_end/persistence/WorkspaceSettingsTab.js
@@ -10,8 +10,8 @@ var header = this.element.createChild('header'); header.createChild('h3').createTextChild(Common.UIString('Workspace')); - this.containerElement = this.element.createChild('div', 'help-container-wrapper') - .createChild('div', 'settings-tab help-content help-container'); + this.containerElement = this.element.createChild('div', 'settings-container-wrapper') + .createChild('div', 'settings-tab settings-content settings-container'); Persistence.isolatedFileSystemManager.addEventListener( Persistence.IsolatedFileSystemManager.Events.FileSystemAdded, @@ -19,11 +19,6 @@ Persistence.isolatedFileSystemManager.addEventListener( Persistence.IsolatedFileSystemManager.Events.FileSystemRemoved, event => this._fileSystemRemoved(/** @type {!Persistence.IsolatedFileSystem} */ (event.data)), this); - Persistence.networkPersistenceManager.addEventListener( - Persistence.NetworkPersistenceManager.Events.ProjectDomainChanged, - event => this._overridesProjectChanged( - /** @type {!Persistence.FileSystemWorkspaceBinding.FileSystem} */ (event.data)), - this); var folderExcludePatternInput = this._createFolderExcludePatternInput(); folderExcludePatternInput.classList.add('folder-exclude-pattern'); @@ -89,7 +84,9 @@ * @param {!Persistence.IsolatedFileSystem} fileSystem */ _addItem(fileSystem) { - if (Persistence.networkPersistenceManager.projectForFileSystem(fileSystem)) + var networkPersistenceProject = Persistence.networkPersistenceManager.project(); + if (networkPersistenceProject && + Persistence.isolatedFileSystemManager.fileSystem(networkPersistenceProject.fileSystemPath()) === fileSystem) return; var element = this._renderFileSystem(fileSystem); this._elementByPath.set(fileSystem.path(), element); @@ -162,15 +159,4 @@ element.remove(); } } - - /** - * @param {!Persistence.FileSystemWorkspaceBinding.FileSystem} project - */ - _overridesProjectChanged(project) { - var fileSystem = Persistence.isolatedFileSystemManager.fileSystem(project.fileSystemPath()); - if (!fileSystem) - return; - this._fileSystemRemoved(fileSystem); - this._fileSystemAdded(fileSystem); - } };
diff --git a/third_party/WebKit/Source/devtools/front_end/persistence/module.json b/third_party/WebKit/Source/devtools/front_end/persistence/module.json index 21ae64a6..88ec30e 100644 --- a/third_party/WebKit/Source/devtools/front_end/persistence/module.json +++ b/third_party/WebKit/Source/devtools/front_end/persistence/module.json
@@ -15,14 +15,6 @@ "className": "Persistence.WorkspaceSettingsTab" }, { - "type": "view", - "location": "settings-view", - "id": "overrides", - "title": "Overrides", - "order": 2, - "className": "Persistence.OverridesSettingsTab" - }, - { "type": "setting", "category": "Persistence", "title": "Enable Local Overrides", @@ -64,12 +56,10 @@ "PersistenceUtils.js", "FileSystemMapping.js", "EditFileSystemView.js", - "WorkspaceSettingsTab.js", - "OverridesSettingsTab.js" + "WorkspaceSettingsTab.js" ], "resources": [ "editFileSystemView.css", - "workspaceSettingsTab.css", - "overridesSettingsTab.css" + "workspaceSettingsTab.css" ] }
diff --git a/third_party/WebKit/Source/devtools/front_end/persistence/overridesSettingsTab.css b/third_party/WebKit/Source/devtools/front_end/persistence/overridesSettingsTab.css deleted file mode 100644 index dd3957b..0000000 --- a/third_party/WebKit/Source/devtools/front_end/persistence/overridesSettingsTab.css +++ /dev/null
@@ -1,77 +0,0 @@ -/* - * Copyright 2015 The Chromium Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -.overrides-info-message { - background-color: #eee; - padding: 10px; -} - -.overrides-list { - margin-top: 10px; - max-width: 500px; - flex: 0 1 auto; - min-height: 30px; -} - -.overrides-list-empty { - flex: auto; - height: 30px; - display: flex; - align-items: center; - justify-content: center; -} - -.overrides-list-item { - padding: 3px 5px 3px 5px; - height: 30px; - display: flex; - align-items: center; - position: relative; - flex: auto 1 1; -} - - .overrides-path, - .overrides-domain { - white-space: nowrap; - text-overflow: ellipsis; - -webkit-user-select: none; - color: #222; - overflow: hidden; - flex: auto; -} - -.overrides-list-item .overrides-domain { - flex: 0 0 150px; -} - -.overrides-separator { - flex: 0 0 1px; - background-color: rgb(231, 231, 231); - height: 30px; - margin: 0 4px; -} - -.overrides-edit-row { - flex: none; - display: flex; - flex-direction: row; - margin: 5px 5px; - align-items: center; -} - -.overrides-edit-row input { - width: 100%; - text-align: inherit; -} - -.overrides-domain-label { - padding-right: 20px; -} - -.overrides-filesystem-path { - padding: 3px 0px 3px 0px; - min-height: 30px; -} \ No newline at end of file
diff --git a/third_party/WebKit/Source/devtools/front_end/persistence/workspaceSettingsTab.css b/third_party/WebKit/Source/devtools/front_end/persistence/workspaceSettingsTab.css index a3a121a..ee24213 100644 --- a/third_party/WebKit/Source/devtools/front_end/persistence/workspaceSettingsTab.css +++ b/third_party/WebKit/Source/devtools/front_end/persistence/workspaceSettingsTab.css
@@ -16,7 +16,7 @@ padding-bottom: 3px; } -.help-content { +.settings-content { overflow-y: auto; overflow-x: hidden; margin: 8px 8px 8px 0; @@ -24,14 +24,13 @@ flex: auto; } -.help-container { +.settings-container { width: 100%; - -webkit-user-select: auto; -webkit-column-width: 288px; } -.settings-tab.help-container { +.settings-tab.settings-container { -webkit-column-width: 308px; } @@ -40,7 +39,7 @@ display: inline-flex; } -.help-container-wrapper { +.settings-container-wrapper { position: absolute; top: 31px; left: 0px; @@ -50,7 +49,7 @@ padding-top: 9px; } -.settings-tab.help-content { +.settings-tab.settings-content { margin: 0; padding: 0; } @@ -103,7 +102,7 @@ margin: 20px 0; } -.settings-tab.help-content.help-container { +.settings-tab.settings-content.settings-container { -webkit-column-width: initial; overflow: hidden; padding-right: 10px;
diff --git a/third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js b/third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js index a7afe90e..8a241d6 100644 --- a/third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js +++ b/third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js
@@ -597,7 +597,8 @@ this._summarySection = this.contentElement.createChild('div', 'security-summary'); // Info explanations should appear after all others. - this._securityExplanationsMain = this.contentElement.createChild('div', 'security-explanation-list'); + this._securityExplanationsMain = + this.contentElement.createChild('div', 'security-explanation-list security-explanations-main'); this._securityExplanationsExtra = this.contentElement.createChild('div', 'security-explanation-list security-explanations-extra'); @@ -629,7 +630,17 @@ explanationSection.createChild('div', 'security-property') .classList.add('security-property-' + explanation.securityState); var text = explanationSection.createChild('div', 'security-explanation-text'); - text.createChild('div', 'security-explanation-title').textContent = explanation.summary; + + var explanationHeader = text.createChild('div', 'security-explanation-title'); + + if (explanation.title) { + explanationHeader.createChild('span').textContent = explanation.title + ' - '; + explanationHeader.createChild('span', 'security-explanation-title-' + explanation.securityState).textContent = + explanation.summary; + } else { + explanationHeader.textContent = explanation.summary; + } + text.createChild('div').textContent = explanation.description; if (explanation.certificate.length) {
diff --git a/third_party/WebKit/Source/devtools/front_end/security/mainView.css b/third_party/WebKit/Source/devtools/front_end/security/mainView.css index af616ad..c0b1bae 100644 --- a/third_party/WebKit/Source/devtools/front_end/security/mainView.css +++ b/third_party/WebKit/Source/devtools/front_end/security/mainView.css
@@ -7,19 +7,15 @@ -webkit-user-select: text; overflow-x: hidden; overflow-y: auto; - background-color: #f9f9f9; + background-color: #fafafa; } .security-main-view > div { flex-shrink: 0; } -.security-summary { - background-color: #fff; -} - .security-summary-section-title { - font-size: 14px; + font-size: 15px; margin: 12px 16px; } @@ -67,8 +63,7 @@ border-style: solid; border-width: 1px 1px 0 0; - /* Defaults for dynamic properties. */ - background: rgb(243, 243, 243); + background: #fff; border-color: rgb(217, 217, 217); } @@ -85,44 +80,59 @@ } .security-summary-text { - padding: 12px 24px; + padding: 16px 24px; border-style: solid; border-width: 1px 0; + font-size: 15px; - /* Defaults for dynamic properties. */ - background: rgb(243, 243, 243); + background: #fff; border-color: rgb(217, 217, 217); - color: rgb(127, 127, 127); + color: rgba(0, 0, 0, 36); } .security-summary-secure .triangle-pointer, -.security-summary-secure .security-summary-text { - background: rgb(243, 252, 244); - border-color: rgb(137, 222, 144); - color: rgb(42, 194, 57); +.security-summary-secure .security-summary-text, +.security-explanation-title-secure { + color: #0b8043; } .security-summary-neutral .triangle-pointer, .security-summary-neutral .security-summary-text { - background: rgb(255, 251, 243); - border-color: rgb(253, 214, 129); color: rgb(253, 177, 48); } .security-summary-insecure .triangle-pointer, -.security-summary-insecure .security-summary-text { - background: rgb(253, 245, 245); - border-color: rgb(243, 157, 151); - color: rgb(216, 70, 60); +.security-summary-insecure .security-summary-text, +.security-explanation-title-neutral, +.security-explanation-title-insecure { + color: #cb3626; +} + +.security-explanation-list { + padding-bottom: 16px; +} + +.security-explanation-list:empty { + border-bottom: none; + padding: 0px; +} + +.security-explanations-main { + margin-top: -5px; + background-color: #fff; + border-bottom: 1px solid rgb(230, 230, 230); +} + +.security-explanations-extra { + background-color: transparent; } .security-explanation { - padding: 16px; - border-bottom: 1px solid rgb(230, 230, 230); - background-color: #fff; - + padding: 11px; display: flex; white-space: nowrap; + border: none; + color: #8c8c8c; } .security-explanation-text { @@ -131,14 +141,6 @@ max-width: 400px; } -.security-explanations-extra .security-explanation { - background-color: transparent; -} - -.security-explanations-extra .security-explanation:only-child { - border-bottom: none; -} - .security-certificate-button { margin-top: 8px; } @@ -159,7 +161,7 @@ .security-explanation-neutral .security-section-title, .security-explanation-warning .security-section-title { - color: rgb(253, 177, 48); + color: #cb3626; font-weight: bold; } .security-explanation-insecure .security-section-title
diff --git a/third_party/WebKit/Source/devtools/front_end/settings/SettingsScreen.js b/third_party/WebKit/Source/devtools/front_end/settings/SettingsScreen.js index c4d166c..4b83cbd 100644 --- a/third_party/WebKit/Source/devtools/front_end/settings/SettingsScreen.js +++ b/third_party/WebKit/Source/devtools/front_end/settings/SettingsScreen.js
@@ -37,7 +37,7 @@ this.registerRequiredCSS('settings/settingsScreen.css'); this.contentElement.tabIndex = 0; - this.contentElement.classList.add('help-window-main'); + this.contentElement.classList.add('settings-window-main'); this.contentElement.classList.add('vbox'); var settingsLabelElement = createElement('div'); @@ -118,8 +118,8 @@ this.element.id = id; var header = this.element.createChild('header'); header.createChild('h3').createTextChild(name); - this.containerElement = this.element.createChild('div', 'help-container-wrapper') - .createChild('div', 'settings-tab help-content help-container'); + this.containerElement = this.element.createChild('div', 'settings-container-wrapper') + .createChild('div', 'settings-tab settings-content settings-container'); } /** @@ -127,9 +127,9 @@ * @return {!Element} */ _appendSection(name) { - var block = this.containerElement.createChild('div', 'help-block'); + var block = this.containerElement.createChild('div', 'settings-block'); if (name) - block.createChild('div', 'help-section-title').textContent = name; + block.createChild('div', 'settings-section-title').textContent = name; return block; } };
diff --git a/third_party/WebKit/Source/devtools/front_end/settings/settingsScreen.css b/third_party/WebKit/Source/devtools/front_end/settings/settingsScreen.css index c37cdde..47c80a7 100644 --- a/third_party/WebKit/Source/devtools/front_end/settings/settingsScreen.css +++ b/third_party/WebKit/Source/devtools/front_end/settings/settingsScreen.css
@@ -4,13 +4,13 @@ * found in the LICENSE file. */ -.help-window-main { +.settings-window-main { color: rgb(48, 57, 66); background-color: white; padding: 11px 0 0 0; } -.help-content { +.settings-content { overflow-y: auto; overflow-x: hidden; margin: 8px 8px 8px 0; @@ -18,30 +18,29 @@ flex: auto; } -.help-footnote { +.settings-footnote { border-top: 1px solid #EEEEEE; margin: 0; padding: 12px; } -.help-container { +.settings-container { width: 100%; - -webkit-user-select: auto; -webkit-column-width: 288px; } -.help-block { +.settings-block { display: block; padding-bottom: 9px; width: 288px; -webkit-column-break-inside: avoid; } -.settings-tab.help-container { +.settings-tab.settings-container { -webkit-column-width: 308px; } -.settings-tab .help-block { +.settings-tab .settings-block { margin-left: 20px; } @@ -50,12 +49,12 @@ height: 0; /* Avoid changing element height when content is set. */ } -.help-line { +.settings-line { padding-bottom: 5px; margin-bottom: 5px; } -.help-key-cell { +.settings-key-cell { display: inline-block; width: 153px; white-space: nowrap; @@ -64,18 +63,18 @@ padding-right: 6px; } -.help-cell { +.settings-cell { display: inline-block; width: 135px; vertical-align: middle; } -.help-section-title { +.settings-section-title { font-size: 120%; text-align: left; } -.help-key { +.settings-key { padding: 0.1em 0.6em; border: 1px solid #ccc; font-size: 11px; @@ -90,16 +89,16 @@ white-space: nowrap; } -.help-combine-keys, -.help-key-delimiter { +.settings-combine-keys, +.settings-key-delimiter { font-size: 9px; } -.help-combine-keys { +.settings-combine-keys { margin: 0 0.3em; } -.help-key-delimiter { +.settings-key-delimiter { margin: 0 0.5em; display: none; } @@ -116,15 +115,15 @@ flex-shrink: 0; } -#general-tab-content .help-block fieldset legend { +#general-tab-content .settings-block fieldset legend { font-size: 14px; } -.help-block p p { +.settings-block p p { padding-left: 30px; } -.help-content p.help-section { +.settings-content p.settings-section { margin: 0 0 15px 0; } @@ -136,7 +135,7 @@ color: inherit; } -.help-content input[type=checkbox] { +.settings-content input[type=checkbox] { margin: 1px 7px 1px 2px; } @@ -146,7 +145,7 @@ padding: 0 0 5px 13px; } -.help-container-wrapper { +.settings-container-wrapper { position: absolute; top: 31px; left: 0px; @@ -156,7 +155,7 @@ padding-top: 9px; } -.settings-tab.help-content { +.settings-tab.settings-content { margin: 0; padding: 0; } @@ -175,11 +174,11 @@ border-bottom: 1px solid #EEEEEE; } -#experiments-tab-content .help-container { +#experiments-tab-content .settings-container { -webkit-column-width: 470px; } -#experiments-tab-content .help-block { +#experiments-tab-content .settings-block { width: 470px; margin-left: 0; } @@ -191,16 +190,16 @@ padding-bottom: 3px; } -.settings-tab .help-section-title { +.settings-tab .settings-section-title { margin-left: -20px; color: #222; } -.settings-tab .help-block fieldset:disabled label:hover { +.settings-tab .settings-block fieldset:disabled label:hover { color: inherit; } -.settings-tab .help-block label:hover { +.settings-tab .settings-block label:hover { color: #222; } @@ -212,7 +211,7 @@ margin-left: 10px; } -.help-indent-labels label { +.settings-indent-labels label { padding-left: 10px; }
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/CSSPlugin.js b/third_party/WebKit/Source/devtools/front_end/sources/CSSPlugin.js index 9131d26..25bb4ea3 100644 --- a/third_party/WebKit/Source/devtools/front_end/sources/CSSPlugin.js +++ b/third_party/WebKit/Source/devtools/front_end/sources/CSSPlugin.js
@@ -380,6 +380,22 @@ /** * @override + * @return {!Array<!UI.ToolbarItem>} + */ + rightToolbarItems() { + return []; + } + + /** + * @override + * @return {!Array<!UI.ToolbarItem>} + */ + leftToolbarItems() { + return []; + } + + /** + * @override */ dispose() { if (this._swatchPopoverHelper.isShowing())
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptCompilerPlugin.js b/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptCompilerPlugin.js index 6a167eb..937b73d 100644 --- a/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptCompilerPlugin.js +++ b/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptCompilerPlugin.js
@@ -100,6 +100,22 @@ /** * @override + * @return {!Array<!UI.ToolbarItem>} + */ + rightToolbarItems() { + return []; + } + + /** + * @override + * @return {!Array<!UI.ToolbarItem>} + */ + leftToolbarItems() { + return []; + } + + /** + * @override */ dispose() { this._textEditor.removeEventListener(UI.TextEditor.Events.TextChanged, this._scheduleCompile, this);
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptSourceFrame.js b/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptSourceFrame.js index bb88c36..0341c8fa 100644 --- a/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptSourceFrame.js +++ b/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptSourceFrame.js
@@ -109,13 +109,6 @@ result.push(new UI.ToolbarText(Common.UIString('(source mapped from %s)', parsedURL.displayName))); } - if (this.uiSourceCode().project().type() === Workspace.projectTypes.Snippets) { - result.push(new UI.ToolbarSeparator(true)); - var runSnippet = UI.Toolbar.createActionButtonForId('debugger.run-snippet'); - runSnippet.setText(Host.isMac() ? Common.UIString('\u2318+Enter') : Common.UIString('Ctrl+Enter')); - result.push(runSnippet); - } - return result; }
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/NavigatorView.js b/third_party/WebKit/Source/devtools/front_end/sources/NavigatorView.js index 6b0700fa..b5e5e7c3e 100644 --- a/third_party/WebKit/Source/devtools/front_end/sources/NavigatorView.js +++ b/third_party/WebKit/Source/devtools/front_end/sources/NavigatorView.js
@@ -1010,7 +1010,7 @@ var icon = UI.Icon.create('largeicon-navigator-file-sync', 'icon'); var badge = UI.Icon.create('badge-navigator-file-sync', 'icon-badge'); // TODO(allada) This does not play well with dark theme. Add an actual icon and use it. - if (Persistence.networkPersistenceManager.activeProject() === binding.fileSystem.project()) + if (Persistence.networkPersistenceManager.project() === binding.fileSystem.project()) badge.style.filter = 'hue-rotate(160deg)'; container.appendChild(icon); container.appendChild(badge);
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/SnippetsPlugin.js b/third_party/WebKit/Source/devtools/front_end/sources/SnippetsPlugin.js new file mode 100644 index 0000000..2b6e53f --- /dev/null +++ b/third_party/WebKit/Source/devtools/front_end/sources/SnippetsPlugin.js
@@ -0,0 +1,51 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +/** + * @implements {Sources.UISourceCodeFrame.Plugin} + */ +Sources.SnippetsPlugin = class { + /** + * @param {!SourceFrame.SourcesTextEditor} textEditor + * @param {!Workspace.UISourceCode} uiSourceCode + */ + constructor(textEditor, uiSourceCode) { + this._textEditor = textEditor; + this._uiSourceCode = uiSourceCode; + } + + /** + * @override + * @param {!Workspace.UISourceCode} uiSourceCode + * @return {boolean} + */ + static accepts(uiSourceCode) { + return uiSourceCode.project().type() === Workspace.projectTypes.Snippets; + } + + /** + * @override + * @return {!Array<!UI.ToolbarItem>} + */ + leftToolbarItems() { + return []; + } + + /** + * @override + * @return {!Array<!UI.ToolbarItem>} + */ + rightToolbarItems() { + var runSnippet = UI.Toolbar.createActionButtonForId('debugger.run-snippet'); + runSnippet.setText(Host.isMac() ? Common.UIString('\u2318+Enter') : Common.UIString('Ctrl+Enter')); + + return [runSnippet]; + } + + /** + * @override + */ + dispose() { + } +};
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/SourcesNavigator.js b/third_party/WebKit/Source/devtools/front_end/sources/SourcesNavigator.js index b68d859..58e5c074 100644 --- a/third_party/WebKit/Source/devtools/front_end/sources/SourcesNavigator.js +++ b/third_party/WebKit/Source/devtools/front_end/sources/SourcesNavigator.js
@@ -177,12 +177,9 @@ this._toolbar = new UI.Toolbar('navigator-toolbar'); this.contentElement.insertBefore(this._toolbar.element, this.contentElement.lastChild); - this._domainElement = this.contentElement.insertBefore( - createElementWithClass('span', 'navigator-domain-element'), this.contentElement.lastChild); - SDK.targetManager.addEventListener(SDK.TargetManager.Events.InspectedURLChanged, this._updateProjectAndUI, this); Persistence.networkPersistenceManager.addEventListener( - Persistence.NetworkPersistenceManager.Events.ProjectDomainChanged, this._updateProjectAndUI, this); + Persistence.NetworkPersistenceManager.Events.ProjectChanged, this._updateProjectAndUI, this); this.workspace().addEventListener(Workspace.Workspace.Events.ProjectAdded, this._onProjectAddOrRemoved, this); this.workspace().addEventListener(Workspace.Workspace.Events.ProjectRemoved, this._onProjectAddOrRemoved, this); this._updateProjectAndUI(); @@ -201,7 +198,7 @@ _updateProjectAndUI() { this.reset(); - var project = Persistence.networkPersistenceManager.projectForActiveDomain(); + var project = Persistence.networkPersistenceManager.project(); if (project) this.tryAddProject(project); this._updateUI(); @@ -209,48 +206,24 @@ _updateUI() { this._toolbar.removeToolbarItems(); - var inspectedPageDomain = Persistence.NetworkPersistenceManager.inspectedPageDomain(); - var project = Persistence.networkPersistenceManager.projectForDomain(inspectedPageDomain); + var project = Persistence.networkPersistenceManager.project(); if (project) { var title = Common.UIString('Enable Overrides'); var enableCheckbox = new UI.ToolbarSettingCheckbox(Common.settings.moduleSetting('persistenceNetworkOverridesEnabled')); this._toolbar.appendToolbarItem(enableCheckbox); - this._domainElement.textContent = - Common.UIString(Persistence.networkPersistenceManager.domainForProject(project) || ''); - this._domainElement.classList.remove('hidden'); return; } var title = Common.UIString('Setup Overrides'); var setupButton = new UI.ToolbarButton(title, 'largeicon-add', title); - if (!inspectedPageDomain) - setupButton.setEnabled(false); setupButton.addEventListener(UI.ToolbarButton.Events.Click, this._setupNewWorkspace, this); this._toolbar.appendToolbarItem(setupButton); - this._domainElement.classList.add('hidden'); } async _setupNewWorkspace() { var fileSystem = await Persistence.isolatedFileSystemManager.addFileSystem('overrides'); if (!fileSystem) return; - var projectId = Persistence.FileSystemWorkspaceBinding.projectId( - Persistence.FileSystemWorkspaceBinding.projectId(fileSystem.path())); - var project = Workspace.workspace.project(projectId); - if (!project) - return; - var inspectedPageDomain = Persistence.NetworkPersistenceManager.inspectedPageDomain(); - if (!inspectedPageDomain) { - Persistence.isolatedFileSystemManager.removeFileSystem(fileSystem); - return; - } - var existingProject = Persistence.networkPersistenceManager.projectForDomain(inspectedPageDomain); - if (existingProject && existingProject !== project) { - Persistence.isolatedFileSystemManager.removeFileSystem(fileSystem); - return; - } - Persistence.networkPersistenceManager.addFileSystemOverridesProject( - /** @type {string} */ (inspectedPageDomain), /** @type {!Workspace.Project} */ (project)); Common.settings.moduleSetting('persistenceNetworkOverridesEnabled').set(true); } @@ -260,8 +233,7 @@ * @return {boolean} */ acceptProject(project) { - var potentialActiveProject = Persistence.networkPersistenceManager.projectForActiveDomain(); - return project.type() === Workspace.projectTypes.FileSystem && project === potentialActiveProject; + return project === Persistence.networkPersistenceManager.project(); } };
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js b/third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js index 95a437c4..1f72719 100644 --- a/third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js +++ b/third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js
@@ -52,6 +52,9 @@ this._bottomToolbar = new UI.Toolbar('', this._toolbarContainerElement); this._bindingChangeBound = this._onBindingChanged.bind(this); + /** @type {?Common.EventTarget.EventDescriptor} */ + this._toolbarChangedListener = null; + UI.startBatchUpdate(); workspace.uiSourceCodes().forEach(this._addUISourceCode.bind(this)); UI.endBatchUpdate(); @@ -474,6 +477,7 @@ wasSelected = true; // SourcesNavigator does not need to update on EditorClosed. + this._removeToolbarChangedListener(); this._updateScriptViewToolbarItems(); this._searchableView.resetSearch(); @@ -498,11 +502,27 @@ this._searchableView.setReplaceable(!!currentSourceFrame && currentSourceFrame.canEditSource()); this._searchableView.refreshSearch(); + this._updateToolbarChangedListener(); this._updateScriptViewToolbarItems(); this.dispatchEventToListeners(Sources.SourcesView.Events.EditorSelected, this._editorContainer.currentFile()); } + _removeToolbarChangedListener() { + if (this._toolbarChangedListener) + Common.EventTarget.removeEventListeners([this._toolbarChangedListener]); + this._toolbarChangedListener = null; + } + + _updateToolbarChangedListener() { + this._removeToolbarChangedListener(); + var sourceFrame = this.currentSourceFrame(); + if (!sourceFrame) + return; + this._toolbarChangedListener = sourceFrame.addEventListener( + Sources.UISourceCodeFrame.Events.ToolbarItemsChanged, this._updateScriptViewToolbarItems, this); + } + /** * @param {!Common.Event} event */
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/UISourceCodeFrame.js b/third_party/WebKit/Source/devtools/front_end/sources/UISourceCodeFrame.js index e92f7ef..e26baf5 100644 --- a/third_party/WebKit/Source/devtools/front_end/sources/UISourceCodeFrame.js +++ b/third_party/WebKit/Source/devtools/front_end/sources/UISourceCodeFrame.js
@@ -165,12 +165,9 @@ return true; if (this._uiSourceCode.project().isServiceProject()) return false; - var networkPersistenceProject = Persistence.networkPersistenceManager.activeProject(); - if (this._uiSourceCode.project().type() === Workspace.projectTypes.Network && networkPersistenceProject) { - var projectDomain = Persistence.networkPersistenceManager.domainForProject(networkPersistenceProject); - if (projectDomain) - return true; - } + if (this._uiSourceCode.project().type() === Workspace.projectTypes.Network && + Persistence.networkPersistenceManager.active()) + return true; return this._uiSourceCode.contentType() !== Common.resourceTypes.Document; } @@ -255,10 +252,15 @@ var binding = Persistence.persistence.binding(this._uiSourceCode); var pluginUISourceCode = binding ? binding.network : this._uiSourceCode; + // The order of these plugins matters for toolbar items if (Sources.CSSPlugin.accepts(pluginUISourceCode)) this._plugins.push(new Sources.CSSPlugin(this.textEditor)); if (Sources.JavaScriptCompilerPlugin.accepts(pluginUISourceCode)) this._plugins.push(new Sources.JavaScriptCompilerPlugin(this.textEditor, pluginUISourceCode)); + if (Sources.SnippetsPlugin.accepts(pluginUISourceCode)) + this._plugins.push(new Sources.SnippetsPlugin(this.textEditor, pluginUISourceCode)); + + this.dispatchEventToListeners(Sources.UISourceCodeFrame.Events.ToolbarItemsChanged); } _disposePlugins() { @@ -497,6 +499,24 @@ this._decorateTypeThrottled(type); } } + + /** + * @override + * @return {!Array<!UI.ToolbarItem>} + */ + syncToolbarItems() { + var leftToolbarItems = super.syncToolbarItems(); + var rightToolbarItems = []; + for (var plugin of this._plugins) { + leftToolbarItems.pushAll(plugin.leftToolbarItems()); + rightToolbarItems.pushAll(plugin.rightToolbarItems()); + } + + if (!rightToolbarItems.length) + return leftToolbarItems; + + return [...leftToolbarItems, new UI.ToolbarSeparator(true), ...rightToolbarItems]; + } }; Sources.UISourceCodeFrame._iconClassPerLevel = {}; @@ -737,6 +757,23 @@ static accepts(uiSourceCode) { } + /** + * @return {!Array<!UI.ToolbarItem>} + */ + rightToolbarItems() { + } + + /** + * @return {!Array<!UI.ToolbarItem>} + */ + leftToolbarItems() { + } + dispose() { } }; + +/** @enum {symbol} */ +Sources.UISourceCodeFrame.Events = { + ToolbarItemsChanged: Symbol('ToolbarItemsChanged') +};
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/module.json b/third_party/WebKit/Source/devtools/front_end/sources/module.json index 437425e..729c1cb5 100644 --- a/third_party/WebKit/Source/devtools/front_end/sources/module.json +++ b/third_party/WebKit/Source/devtools/front_end/sources/module.json
@@ -757,6 +757,7 @@ "WorkspaceMappingTip.js", "XHRBreakpointsSidebarPane.js", "JavaScriptCompilerPlugin.js", + "SnippetsPlugin.js", "ObjectEventListenersSidebarPane.js" ], "resources": [
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/navigatorView.css b/third_party/WebKit/Source/devtools/front_end/sources/navigatorView.css index 0d25267..2db86d1 100644 --- a/third_party/WebKit/Source/devtools/front_end/sources/navigatorView.css +++ b/third_party/WebKit/Source/devtools/front_end/sources/navigatorView.css
@@ -8,9 +8,3 @@ border-bottom: 1px solid #ccc; padding-left: 8px; } - -.navigator-domain-element { - font-size: 14px; - margin: 4px 11px; - font-weight: bold; -}
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/watchExpressionsSidebarPane.css b/third_party/WebKit/Source/devtools/front_end/sources/watchExpressionsSidebarPane.css index 259c0be2..63bf691 100644 --- a/third_party/WebKit/Source/devtools/front_end/sources/watchExpressionsSidebarPane.css +++ b/third_party/WebKit/Source/devtools/front_end/sources/watchExpressionsSidebarPane.css
@@ -35,7 +35,7 @@ white-space: nowrap; text-overflow: ellipsis; overflow: hidden; - line-height: 16px; + line-height: 20px; margin-left: 11px; } @@ -45,7 +45,7 @@ .watch-expression { position: relative; - padding: 1px 6px 1px 6px; + padding: 0 6px; flex: none; min-height: 20px; }
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/PerformanceMonitor.js b/third_party/WebKit/Source/devtools/front_end/timeline/PerformanceMonitor.js index 14fef043..4f5a989e 100644 --- a/third_party/WebKit/Source/devtools/front_end/timeline/PerformanceMonitor.js +++ b/third_party/WebKit/Source/devtools/front_end/timeline/PerformanceMonitor.js
@@ -447,7 +447,7 @@ {title: Common.UIString('DOM Nodes'), metrics: [{name: 'Nodes', color: 'green'}]}, {title: Common.UIString('JS event listeners'), metrics: [{name: 'JSEventListeners', color: 'yellowgreen'}]}, {title: Common.UIString('Documents'), metrics: [{name: 'Documents', color: 'darkblue'}]}, - {title: Common.UIString('Frames'), metrics: [{name: 'Frames', color: 'darkcyan'}]}, + {title: Common.UIString('Document Frames'), metrics: [{name: 'Frames', color: 'darkcyan'}]}, {title: Common.UIString('Layouts / sec'), metrics: [{name: 'LayoutCount', color: 'hotpink'}]}, {title: Common.UIString('Style recalcs / sec'), metrics: [{name: 'RecalcStyleCount', color: 'deeppink'}]} ];
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/ShortcutsScreen.js b/third_party/WebKit/Source/devtools/front_end/ui/ShortcutsScreen.js index 8cf1d257..4495943 100644 --- a/third_party/WebKit/Source/devtools/front_end/ui/ShortcutsScreen.js +++ b/third_party/WebKit/Source/devtools/front_end/ui/ShortcutsScreen.js
@@ -220,13 +220,13 @@ widget.element.className = 'settings-tab-container'; // Override widget.element.createChild('header').createChild('h3').createTextChild(Common.UIString('Shortcuts')); - var scrollPane = widget.element.createChild('div', 'help-container-wrapper'); + var scrollPane = widget.element.createChild('div', 'settings-container-wrapper'); var container = scrollPane.createChild('div'); - container.className = 'help-content help-container'; + container.className = 'settings-content settings-container'; for (var i = 0; i < orderedSections.length; ++i) orderedSections[i].renderSection(container); - var note = scrollPane.createChild('p', 'help-footnote'); + var note = scrollPane.createChild('p', 'settings-footnote'); note.appendChild(UI.createDocumentationLink( 'iterate/inspect-styles/shortcuts', Common.UIString('Full list of DevTools keyboard shortcuts and gestures'))); @@ -289,18 +289,18 @@ * @param {!Element} container */ renderSection(container) { - var parent = container.createChild('div', 'help-block'); + var parent = container.createChild('div', 'settings-block'); - var headLine = parent.createChild('div', 'help-line'); - headLine.createChild('div', 'help-key-cell'); - headLine.createChild('div', 'help-section-title help-cell').textContent = this.name; + var headLine = parent.createChild('div', 'settings-line'); + headLine.createChild('div', 'settings-key-cell'); + headLine.createChild('div', 'settings-section-title settings-cell').textContent = this.name; for (var i = 0; i < this._lines.length; ++i) { - var line = parent.createChild('div', 'help-line'); - var keyCell = line.createChild('div', 'help-key-cell'); + var line = parent.createChild('div', 'settings-line'); + var keyCell = line.createChild('div', 'settings-key-cell'); keyCell.appendChild(this._lines[i].key); - keyCell.appendChild(this._createSpan('help-key-delimiter', ':')); - line.createChild('div', 'help-cell').textContent = this._lines[i].text; + keyCell.appendChild(this._createSpan('settings-key-delimiter', ':')); + line.createChild('div', 'settings-cell').textContent = this._lines[i].text; } } @@ -310,7 +310,7 @@ * @return {!Node} */ _renderSequence(sequence, delimiter) { - var delimiterSpan = this._createSpan('help-key-delimiter', delimiter); + var delimiterSpan = this._createSpan('settings-key-delimiter', delimiter); return this._joinNodes(sequence.map(this._renderKey.bind(this)), delimiterSpan); } @@ -320,8 +320,8 @@ */ _renderKey(key) { var keyName = key.name; - var plus = this._createSpan('help-combine-keys', '+'); - return this._joinNodes(keyName.split(' + ').map(this._createSpan.bind(this, 'help-key')), plus); + var plus = this._createSpan('settings-combine-keys', '+'); + return this._joinNodes(keyName.split(' + ').map(this._createSpan.bind(this, 'settings-key')), plus); } /**
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/View.js b/third_party/WebKit/Source/devtools/front_end/ui/View.js index 318871a..8705011c 100644 --- a/third_party/WebKit/Source/devtools/front_end/ui/View.js +++ b/third_party/WebKit/Source/devtools/front_end/ui/View.js
@@ -485,6 +485,7 @@ this.registerRequiredCSS('ui/viewContainers.css'); this._titleElement = createElementWithClass('div', 'expandable-view-title'); + UI.ARIAUtils.markAsLink(this._titleElement); this._titleExpandIcon = UI.Icon.create('smallicon-triangle-right', 'title-expand-icon'); this._titleElement.appendChild(this._titleExpandIcon); this._titleElement.createTextChild(view.title()); @@ -523,6 +524,7 @@ if (this._titleElement.classList.contains('expanded')) return this._materialize(); this._titleElement.classList.add('expanded'); + UI.ARIAUtils.setExpanded(this._titleElement, true); this._titleExpandIcon.setIconType('smallicon-triangle-down'); return this._materialize().then(() => this._widget.show(this.element)); } @@ -531,6 +533,7 @@ if (!this._titleElement.classList.contains('expanded')) return; this._titleElement.classList.remove('expanded'); + UI.ARIAUtils.setExpanded(this._titleElement, false); this._titleExpandIcon.setIconType('smallicon-triangle-right'); this._materialize().then(() => this._widget.detach()); }
diff --git a/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp b/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp index 29502e0..fc036b78 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp
@@ -1431,7 +1431,8 @@ // AXObject* AXLayoutObject::AccessibilityHitTest(const IntPoint& point) const { - if (!layout_object_ || !layout_object_->HasLayer()) + if (!layout_object_ || !layout_object_->HasLayer() || + !layout_object_->IsBox()) return nullptr; PaintLayer* layer = ToLayoutBox(layout_object_)->Layer();
diff --git a/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp b/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp index f4059d3..b3670ffb 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp
@@ -618,11 +618,10 @@ EqualIgnoringASCIICase(content_editable_value, "true"); } -// TODO(dmazzoni) Find a more appropriate name or consider returning false -// for everything but a searchbox or textfield, as a combobox and spinbox -// can contain a field but should not be considered edit controls themselves. -// Combo box text fields should return true though. bool AXNodeObject::IsTextControl() const { + if (!GetNode()) + return false; + if (HasContentEditableAttributeSet()) return true; @@ -630,9 +629,14 @@ case kTextFieldRole: case kTextFieldWithComboBoxRole: case kSearchBoxRole: - // TODO(dmazzoni): kSpinButtonRole might need to be removed. - case kSpinButtonRole: return true; + case kSpinButtonRole: + // When it's a native spin button, it behaves like a text box, i.e. users + // can type in it and navigate around using cursors. + if (const auto* input = ToHTMLInputElementOrNull(*GetNode())) { + return input->IsTextField(); + } + return false; default: return false; } @@ -1340,8 +1344,9 @@ return String(); if (IsNativeTextControl() && - (IsHTMLTextAreaElement(*node) || IsHTMLInputElement(*node))) + (IsHTMLTextAreaElement(*node) || IsHTMLInputElement(*node))) { return ToTextControlElement(*node).value(); + } if (!node->IsElementNode()) return String(); @@ -1538,7 +1543,7 @@ return true; } - if (IsNativeSlider()) { + if (IsNativeSlider() || IsNativeSpinButton()) { *out_value = ToHTMLInputElement(*GetNode()).valueAsNumber(); return true; }
diff --git a/third_party/WebKit/Source/modules/cachestorage/GlobalCacheStorage.cpp b/third_party/WebKit/Source/modules/cachestorage/GlobalCacheStorage.cpp index 638d841..ad2656a 100644 --- a/third_party/WebKit/Source/modules/cachestorage/GlobalCacheStorage.cpp +++ b/third_party/WebKit/Source/modules/cachestorage/GlobalCacheStorage.cpp
@@ -55,6 +55,8 @@ exception_state.ThrowSecurityError( "Access to cache storage is denied."); return nullptr; + } else if (context->GetSecurityOrigin()->IsLocal()) { + UseCounter::Count(context, WebFeature::kFileAccessedCache); } if (!caches_) {
diff --git a/third_party/WebKit/Source/modules/canvas/canvas2d/BaseRenderingContext2D.cpp b/third_party/WebKit/Source/modules/canvas/canvas2d/BaseRenderingContext2D.cpp index b9cbeae..ff3a2d4 100644 --- a/third_party/WebKit/Source/modules/canvas/canvas2d/BaseRenderingContext2D.cpp +++ b/third_party/WebKit/Source/modules/canvas/canvas2d/BaseRenderingContext2D.cpp
@@ -1129,7 +1129,7 @@ double start_time = 0; Optional<CustomCountHistogram> timer; if (!IsPaint2D()) { - start_time = WTF::MonotonicallyIncreasingTime(); + start_time = WTF::CurrentTimeTicksInSeconds(); if (GetImageBuffer() && GetImageBuffer()->IsAccelerated()) { if (image_source->IsVideoElement()) { DEFINE_THREAD_SAFE_STATIC_LOCAL( @@ -1296,7 +1296,7 @@ if (!IsPaint2D()) { DCHECK(start_time); - timer->Count((WTF::MonotonicallyIncreasingTime() - start_time) * + timer->Count((WTF::CurrentTimeTicksInSeconds() - start_time) * WTF::Time::kMicrosecondsPerSecond); } }
diff --git a/third_party/WebKit/Source/modules/credentialmanager/CredentialsContainer.cpp b/third_party/WebKit/Source/modules/credentialmanager/CredentialsContainer.cpp index 474bbc88..1c467a9 100644 --- a/third_party/WebKit/Source/modules/credentialmanager/CredentialsContainer.cpp +++ b/third_party/WebKit/Source/modules/credentialmanager/CredentialsContainer.cpp
@@ -155,9 +155,7 @@ ~NotificationCallbacks() override {} void OnSuccess() override { - Frame* frame = - ToDocument(ExecutionContext::From(resolver_->GetScriptState())) - ->GetFrame(); + Frame* frame = resolver_->GetFrame(); SECURITY_CHECK(!frame || same_origin_requirement_ == SameOriginRequirement::kCanBeCrossOrigin || @@ -183,16 +181,10 @@ : resolver_(resolver) {} ~RequestCallbacks() override {} - void OnSuccess(std::unique_ptr<WebCredential> web_credential) override { - ExecutionContext* context = - ExecutionContext::From(resolver_->GetScriptState()); - if (!context) - return; - Frame* frame = ToDocument(context)->GetFrame(); + void OnSuccess(std::unique_ptr<WebCredential> credential) override { + Frame* frame = resolver_->GetFrame(); SECURITY_CHECK(!frame || IsSameOriginWithAncestors(frame)); - std::unique_ptr<WebCredential> credential = - WTF::WrapUnique(web_credential.release()); if (!frame) { resolver_->Resolve(); return; @@ -235,11 +227,7 @@ void OnSuccess( webauth::mojom::blink::PublicKeyCredentialInfoPtr credential) override { - ExecutionContext* context = - ExecutionContext::From(resolver_->GetScriptState()); - if (!context) - return; - Frame* frame = ToDocument(context)->GetFrame(); + Frame* frame = resolver_->GetFrame(); SECURITY_CHECK(!frame || frame == frame->Tree().Top()); if (!frame) {
diff --git a/third_party/WebKit/Source/modules/credentialmanager/CredentialsContainerTest.cpp b/third_party/WebKit/Source/modules/credentialmanager/CredentialsContainerTest.cpp index 63512e0..0baae06f 100644 --- a/third_party/WebKit/Source/modules/credentialmanager/CredentialsContainerTest.cpp +++ b/third_party/WebKit/Source/modules/credentialmanager/CredentialsContainerTest.cpp
@@ -45,8 +45,9 @@ CredentialsContainer* credential_container = CredentialsContainer::Create(); std::unique_ptr<WebCredentialManagerClient::RequestCallbacks> get_callback; - V8TestingScope scope; { + V8TestingScope scope; + // Set up. scope.GetDocument().SetSecurityOrigin( SecurityOrigin::CreateFromString("https://example.test"));
diff --git a/third_party/WebKit/Source/modules/document_metadata/CopylessPasteExtractor.cpp b/third_party/WebKit/Source/modules/document_metadata/CopylessPasteExtractor.cpp index bcbb5008..ee808cd 100644 --- a/third_party/WebKit/Source/modules/document_metadata/CopylessPasteExtractor.cpp +++ b/third_party/WebKit/Source/modules/document_metadata/CopylessPasteExtractor.cpp
@@ -294,9 +294,9 @@ WebPagePtr page = WebPage::New(); // Traverse the DOM tree and extract the metadata. - double start_time = MonotonicallyIncreasingTime(); + double start_time = CurrentTimeTicksInSeconds(); ExtractionStatus status = extractMetadata(*html, page->entities); - double elapsed_time = MonotonicallyIncreasingTime() - start_time; + double elapsed_time = CurrentTimeTicksInSeconds() - start_time; DEFINE_STATIC_LOCAL(EnumerationHistogram, status_histogram, ("CopylessPaste.ExtractionStatus", kCount));
diff --git a/third_party/WebKit/Source/modules/exported/WebEmbeddedWorkerImpl.cpp b/third_party/WebKit/Source/modules/exported/WebEmbeddedWorkerImpl.cpp index f8a05f3..e62903c 100644 --- a/third_party/WebKit/Source/modules/exported/WebEmbeddedWorkerImpl.cpp +++ b/third_party/WebKit/Source/modules/exported/WebEmbeddedWorkerImpl.cpp
@@ -324,11 +324,6 @@ shadow_page_->Initialize(worker_start_data_.script_url); } -WebDevToolsAgentClient::WebKitClientMessageLoop* -WebEmbeddedWorkerImpl::CreateClientMessageLoop() { - return worker_context_client_->CreateDevToolsMessageLoop(); -} - const WebString& WebEmbeddedWorkerImpl::GetInstrumentationToken() { return instrumentation_token_; }
diff --git a/third_party/WebKit/Source/modules/exported/WebEmbeddedWorkerImpl.h b/third_party/WebKit/Source/modules/exported/WebEmbeddedWorkerImpl.h index c42bf21d..befbf04 100644 --- a/third_party/WebKit/Source/modules/exported/WebEmbeddedWorkerImpl.h +++ b/third_party/WebKit/Source/modules/exported/WebEmbeddedWorkerImpl.h
@@ -100,8 +100,6 @@ const WebString&, const WebString&) override; void ResumeStartup() override; - WebDevToolsAgentClient::WebKitClientMessageLoop* CreateClientMessageLoop() - override; const WebString& GetInstrumentationToken() override; void OnScriptLoaderFinished();
diff --git a/third_party/WebKit/Source/modules/fetch/BytesConsumer.h b/third_party/WebKit/Source/modules/fetch/BytesConsumer.h index 25f7aab900..ce9ac8b 100644 --- a/third_party/WebKit/Source/modules/fetch/BytesConsumer.h +++ b/third_party/WebKit/Source/modules/fetch/BytesConsumer.h
@@ -85,11 +85,11 @@ // Returns ShouldWait when it's waiting. // Returns Done when it's closed. // Returns Error when errored. - // When not readable, the caller don't have to (and must not) call - // endRead, because the read session implicitly ends in that case. + // When not readable, the caller doesn't have to (and must not) call + // EndRead, because the read session implicitly ends in that case. // // |*buffer| will become invalid when this object becomes unreachable, - // even if endRead is not called. + // even if EndRead is not called. // // |*buffer| will be set to null and |*available| will be set to 0 if not // readable. @@ -105,8 +105,8 @@ // Drains the data as a BlobDataHandle. // When this function returns a non-null value, the returned blob handle - // contains bytes that would be read through beginRead and - // endRead functions without calling this function. In such a case, this + // contains bytes that would be read through the BeginRead and + // EndRead functions without calling this function. In such a case, this // object becomes closed. // When this function returns null value, this function does nothing. // When |policy| is DisallowBlobWithInvalidSize, this function doesn't @@ -119,8 +119,8 @@ // Drains the data as an EncodedFormData. // When this function returns a non-null value, the returned form data - // contains bytes that would be read through beginRead and - // endRead functions without calling this function. In such a case, this + // contains bytes that would be read through the BeginRead and + // EndRead functions without calling this function. In such a case, this // object becomes closed. // When this function returns null value, this function does nothing. // This function returns a non-null form data when the handle is made
diff --git a/third_party/WebKit/Source/modules/fetch/BytesConsumerForDataConsumerHandle.cpp b/third_party/WebKit/Source/modules/fetch/BytesConsumerForDataConsumerHandle.cpp index 7cce0c4..18fbea7c 100644 --- a/third_party/WebKit/Source/modules/fetch/BytesConsumerForDataConsumerHandle.cpp +++ b/third_party/WebKit/Source/modules/fetch/BytesConsumerForDataConsumerHandle.cpp
@@ -4,15 +4,15 @@ #include "modules/fetch/BytesConsumerForDataConsumerHandle.h" +#include <algorithm> +#include <string> + #include "core/dom/ExecutionContext.h" #include "platform/WebTaskRunner.h" #include "platform/wtf/Functional.h" #include "public/platform/TaskType.h" #include "public/platform/WebTraceLocation.h" -#include <algorithm> -#include <string.h> - namespace blink { BytesConsumerForDataConsumerHandle::BytesConsumerForDataConsumerHandle( @@ -49,7 +49,7 @@ case WebDataConsumerHandle::kBusy: case WebDataConsumerHandle::kResourceExhausted: case WebDataConsumerHandle::kUnexpectedError: - GetError(); + SetError(); return Result::kError; } NOTREACHED(); @@ -64,7 +64,7 @@ WebDataConsumerHandle::Result r = reader_->EndRead(read); if (r != WebDataConsumerHandle::kOk) { has_pending_notification_ = false; - GetError(); + SetError(); return Result::kError; } if (has_pending_notification_) { @@ -131,7 +131,7 @@ case WebDataConsumerHandle::kBusy: case WebDataConsumerHandle::kResourceExhausted: case WebDataConsumerHandle::kUnexpectedError: - GetError(); + SetError(); if (client) client->OnStateChange(); return; @@ -156,7 +156,7 @@ ClearClient(); } -void BytesConsumerForDataConsumerHandle::GetError() { +void BytesConsumerForDataConsumerHandle::SetError() { DCHECK(!is_in_two_phase_read_); if (state_ == InternalState::kErrored) return;
diff --git a/third_party/WebKit/Source/modules/fetch/BytesConsumerForDataConsumerHandle.h b/third_party/WebKit/Source/modules/fetch/BytesConsumerForDataConsumerHandle.h index 2ad4e0c8..2d3756a 100644 --- a/third_party/WebKit/Source/modules/fetch/BytesConsumerForDataConsumerHandle.h +++ b/third_party/WebKit/Source/modules/fetch/BytesConsumerForDataConsumerHandle.h
@@ -5,6 +5,8 @@ #ifndef BytesConsumerForDataConsumerHandle_h #define BytesConsumerForDataConsumerHandle_h +#include <memory> + #include "base/memory/scoped_refptr.h" #include "modules/ModulesExport.h" #include "modules/fetch/BytesConsumer.h" @@ -12,8 +14,6 @@ #include "platform/wtf/text/WTFString.h" #include "public/platform/WebDataConsumerHandle.h" -#include <memory> - namespace blink { class ExecutionContext; @@ -51,7 +51,7 @@ private: void Close(); - void GetError(); + void SetError(); void Notify(); Member<ExecutionContext> execution_context_;
diff --git a/third_party/WebKit/Source/modules/fetch/DEPS b/third_party/WebKit/Source/modules/fetch/DEPS index a7cc136..94ed0b5 100644 --- a/third_party/WebKit/Source/modules/fetch/DEPS +++ b/third_party/WebKit/Source/modules/fetch/DEPS
@@ -3,6 +3,8 @@ "-modules", "+modules/ModulesExport.h", "+modules/fetch", + "+mojo/common/data_pipe_utils.h", + "+mojo/public/cpp/bindings/binding_set.h", "+mojo/public/cpp/system/data_pipe.h", "+mojo/public/cpp/system/simple_watcher.h", "+services/network/public/interfaces",
diff --git a/third_party/WebKit/Source/modules/fetch/FormDataBytesConsumer.cpp b/third_party/WebKit/Source/modules/fetch/FormDataBytesConsumer.cpp index 39b06c56..f012341c 100644 --- a/third_party/WebKit/Source/modules/fetch/FormDataBytesConsumer.cpp +++ b/third_party/WebKit/Source/modules/fetch/FormDataBytesConsumer.cpp
@@ -7,23 +7,47 @@ #include "core/typed_arrays/DOMArrayBuffer.h" #include "core/typed_arrays/DOMArrayBufferView.h" #include "modules/fetch/BlobBytesConsumer.h" +#include "modules/fetch/BytesConsumerForDataConsumerHandle.h" #include "platform/blob/BlobData.h" #include "platform/network/EncodedFormData.h" +#include "platform/network/FormDataEncoder.h" #include "platform/wtf/Vector.h" #include "platform/wtf/text/TextCodec.h" #include "platform/wtf/text/TextEncoding.h" #include "platform/wtf/text/WTFString.h" +#include "public/platform/Platform.h" namespace blink { namespace { -bool IsSimple(const EncodedFormData* form_data) { +enum class FormDataType { + // Has only data elements. + kSimple, + // Can have data, file, and blob elements (no data pipes). + kComplex, + // Can have data and data pipe elements (no files and blobs). + kDataPipeAndDataOnly +}; + +FormDataType GetType(const EncodedFormData* form_data) { + FormDataType type = FormDataType::kSimple; for (const auto& element : form_data->Elements()) { - if (element.type_ != FormDataElement::kData) - return false; + switch (element.type_) { + case FormDataElement::kData: + break; + case FormDataElement::kEncodedFile: + case FormDataElement::kEncodedBlob: + DCHECK_NE(type, FormDataType::kDataPipeAndDataOnly); + type = FormDataType::kComplex; + break; + case FormDataElement::kDataPipe: + DCHECK_NE(type, FormDataType::kComplex); + type = FormDataType::kDataPipeAndDataOnly; + break; + } } - return true; + return type; } class SimpleFormDataBytesConsumer : public BytesConsumer { @@ -93,22 +117,265 @@ String DebugName() const override { return "SimpleFormDataBytesConsumer"; } private: - // either one of |m_formData| and |m_flattenFormData| is usable at a time. + // Either one of |form_data_| and |flatten_form_data_| is usable at a time. scoped_refptr<EncodedFormData> form_data_; Vector<char> flatten_form_data_; size_t flatten_form_data_offset_ = 0; PublicState state_ = PublicState::kReadableOrWaiting; }; +class DataPipeAndDataBytesConsumer final : public BytesConsumer { + public: + DataPipeAndDataBytesConsumer(ExecutionContext* execution_context, + EncodedFormData* form_data) + : execution_context_(execution_context) { + // Make a copy in case |form_data| will mutate while we read it. Copy() + // works fine; we don't need to DeepCopy() the data and data pipe getter: + // data is just a Vector<char> and data pipe getter can be shared. + form_data_ = form_data->Copy(); + form_data_->SetBoundary(FormDataEncoder::GenerateUniqueBoundaryString()); + iter_ = form_data_->MutableElements().begin(); + } + + Result BeginRead(const char** buffer, size_t* available) override { + *buffer = nullptr; + *available = 0; + if (state_ == PublicState::kClosed) + return Result::kDone; + if (state_ == PublicState::kErrored) + return Result::kError; + + if (iter_ == form_data_->MutableElements().end()) { + Close(); + return Result::kDone; + } + + // Currently reading bytes. + if (iter_->type_ == FormDataElement::kData) { + // Create the bytes consumer if there isn't one yet. + if (!simple_consumer_) { + scoped_refptr<EncodedFormData> simple_data = + EncodedFormData::Create(iter_->data_); + simple_consumer_ = + new SimpleFormDataBytesConsumer(std::move(simple_data)); + if (client_) + simple_consumer_->SetClient(client_); + } + // Read from the bytes consumer. + Result result = simple_consumer_->BeginRead(buffer, available); + if (result == Result::kError) { + SetError(); + return Result::kError; + } + // If done, continue to the next element. + if (result == Result::kDone) { + simple_consumer_ = nullptr; + ++iter_; + return BeginRead(buffer, available); + } + return result; + } + + // Currently reading a data pipe. + if (iter_->type_ == FormDataElement::kDataPipe) { + // Create the data pipe consumer if there isn't one yet. + if (!data_pipe_consumer_) { + network::mojom::blink::DataPipeGetterPtr* data_pipe_getter = + iter_->data_pipe_getter_->GetPtr(); + mojo::DataPipe data_pipe; + (*data_pipe_getter) + ->Read( + std::move(data_pipe.producer_handle), + WTF::Bind(&DataPipeAndDataBytesConsumer::DataPipeGetterCallback, + WrapWeakPersistent(this))); + std::unique_ptr<WebDataConsumerHandle> consumer_handle = + Platform::Current()->CreateDataConsumerHandle( + std::move(data_pipe.consumer_handle)); + data_pipe_consumer_ = new BytesConsumerForDataConsumerHandle( + execution_context_, std::move(consumer_handle)); + if (client_) + data_pipe_consumer_->SetClient(client_); + } + + // Read from the data pipe consumer. + Result result = data_pipe_consumer_->BeginRead(buffer, available); + if (result == Result::kError) { + SetError(); + return Result::kError; + } + + if (result == Result::kDone) { + // We've finished reading from the data pipe, but we're not done + // until we get the DataPipeGetterCallback signalling success. + if (!was_data_pipe_getter_callback_called_) + return Result::kShouldWait; + + // We're done. Move on to the next element. + was_data_pipe_getter_callback_called_ = false; + data_pipe_consumer_ = nullptr; + ++iter_; + return BeginRead(buffer, available); + } + return result; + } + + NOTREACHED() << "Invalid type: " << iter_->type_; + return Result::kError; + } + + Result EndRead(size_t read_size) override { + if (state_ == PublicState::kClosed) + return Result::kDone; + if (state_ == PublicState::kErrored) + return Result::kError; + + if (simple_consumer_) { + Result result = simple_consumer_->EndRead(read_size); + if (result == Result::kError) { + SetError(); + return Result::kError; + } + // Even if this consumer is done, there may still be more elements, so + // return Ok. + DCHECK(result == Result::kOk || result == Result::kDone); + return Result::kOk; + } + if (data_pipe_consumer_) { + Result result = data_pipe_consumer_->EndRead(read_size); + if (result == Result::kError) { + SetError(); + return Result::kError; + } + // Even if this consumer is done, there may still be more elements, so + // return Ok. + DCHECK(result == Result::kOk || result == Result::kDone); + return Result::kOk; + } + + NOTREACHED() << "No consumer. BeginRead() was not called?"; + return Result::kError; + } + + scoped_refptr<EncodedFormData> DrainAsFormData() override { + if (state_ == PublicState::kClosed || state_ == PublicState::kErrored) + return nullptr; + // According to the DrainAsFormData() contract, we can only return bytes + // that haven't already been read. So if reading has already started, + // give up and return null. + if (simple_consumer_ || data_pipe_consumer_) + return nullptr; + Close(); + return std::move(form_data_); + } + + void SetClient(Client* client) override { + DCHECK(!client_); + DCHECK(client); + client_ = client; + if (simple_consumer_) + simple_consumer_->SetClient(client_); + else if (data_pipe_consumer_) + data_pipe_consumer_->SetClient(client_); + } + + void ClearClient() override { + client_ = nullptr; + if (simple_consumer_) + simple_consumer_->ClearClient(); + else if (data_pipe_consumer_) + data_pipe_consumer_->ClearClient(); + } + + void Cancel() override { + if (state_ == PublicState::kClosed || state_ == PublicState::kErrored) + return; + if (simple_consumer_) + simple_consumer_->Cancel(); + else if (data_pipe_consumer_) + data_pipe_consumer_->Cancel(); + Close(); + } + + PublicState GetPublicState() const override { return state_; } + + Error GetError() const override { + DCHECK_EQ(state_, PublicState::kErrored); + return error_; + } + + String DebugName() const override { return "DataPipeAndDataBytesConsumer"; } + + void Trace(blink::Visitor* visitor) override { + visitor->Trace(execution_context_); + visitor->Trace(client_); + visitor->Trace(simple_consumer_); + visitor->Trace(data_pipe_consumer_); + BytesConsumer::Trace(visitor); + } + + private: + void DataPipeGetterCallback(int32_t status, uint64_t size) { + switch (state_) { + case PublicState::kErrored: + return; + case PublicState::kClosed: + NOTREACHED(); + return; + case PublicState::kReadableOrWaiting: + break; + } + + DCHECK(data_pipe_consumer_); + auto client = client_; + if (status != 0) // 0 is net::OK. + SetError(); + else + was_data_pipe_getter_callback_called_ = true; + + if (client) + client->OnStateChange(); + } + + void Close() { + if (state_ == PublicState::kClosed) + return; + DCHECK_EQ(state_, PublicState::kReadableOrWaiting); + state_ = PublicState::kClosed; + ClearClient(); + simple_consumer_ = nullptr; + data_pipe_consumer_ = nullptr; + } + + void SetError() { + if (state_ == PublicState::kErrored) + return; + DCHECK_EQ(state_, PublicState::kReadableOrWaiting); + state_ = PublicState::kErrored; + error_ = Error("error"); + ClearClient(); + simple_consumer_ = nullptr; + data_pipe_consumer_ = nullptr; + } + + Member<ExecutionContext> execution_context_; + PublicState state_ = PublicState::kReadableOrWaiting; + scoped_refptr<EncodedFormData> form_data_; + Vector<FormDataElement>::iterator iter_; + Error error_; + Member<BytesConsumer::Client> client_; + Member<SimpleFormDataBytesConsumer> simple_consumer_; + Member<BytesConsumerForDataConsumerHandle> data_pipe_consumer_; + bool was_data_pipe_getter_callback_called_ = false; +}; + class ComplexFormDataBytesConsumer final : public BytesConsumer { public: ComplexFormDataBytesConsumer(ExecutionContext* execution_context, scoped_refptr<EncodedFormData> form_data, - BytesConsumer* consumer) + BytesConsumer* consumer_for_testing) : form_data_(std::move(form_data)) { - if (consumer) { - // For testing. - blob_bytes_consumer_ = consumer; + if (consumer_for_testing) { + blob_bytes_consumer_ = consumer_for_testing; return; } @@ -139,6 +406,9 @@ element.optional_blob_data_handle_->size()); } break; + case FormDataElement::kDataPipe: + NOTREACHED() << "This consumer can't handle data pipes."; + break; } } // Here we handle m_formData->boundary() as a C-style string. See @@ -223,13 +493,28 @@ FormDataBytesConsumer::FormDataBytesConsumer( ExecutionContext* execution_context, scoped_refptr<EncodedFormData> form_data, - BytesConsumer* consumer) - : impl_(IsSimple(form_data.get()) - ? static_cast<BytesConsumer*>( - new SimpleFormDataBytesConsumer(std::move(form_data))) - : static_cast<BytesConsumer*>( - new ComplexFormDataBytesConsumer(execution_context, - std::move(form_data), - consumer))) {} + BytesConsumer* consumer_for_testing) + : impl_(GetImpl(execution_context, + std::move(form_data), + consumer_for_testing)) {} + +// static +BytesConsumer* FormDataBytesConsumer::GetImpl( + ExecutionContext* execution_context, + scoped_refptr<EncodedFormData> form_data, + BytesConsumer* consumer_for_testing) { + DCHECK(form_data); + switch (GetType(form_data.get())) { + case FormDataType::kSimple: + return new SimpleFormDataBytesConsumer(std::move(form_data)); + case FormDataType::kComplex: + return new ComplexFormDataBytesConsumer( + execution_context, std::move(form_data), consumer_for_testing); + case FormDataType::kDataPipeAndDataOnly: + return new DataPipeAndDataBytesConsumer(execution_context, + form_data.get()); + } + return nullptr; +} } // namespace blink
diff --git a/third_party/WebKit/Source/modules/fetch/FormDataBytesConsumer.h b/third_party/WebKit/Source/modules/fetch/FormDataBytesConsumer.h index ad7d4350..b3be754 100644 --- a/third_party/WebKit/Source/modules/fetch/FormDataBytesConsumer.h +++ b/third_party/WebKit/Source/modules/fetch/FormDataBytesConsumer.h
@@ -64,9 +64,12 @@ } private: + static BytesConsumer* GetImpl(ExecutionContext*, + scoped_refptr<EncodedFormData>, + BytesConsumer* consumer_for_testing); MODULES_EXPORT FormDataBytesConsumer(ExecutionContext*, scoped_refptr<EncodedFormData>, - BytesConsumer*); + BytesConsumer* consumer_for_testing); const Member<BytesConsumer> impl_; };
diff --git a/third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp b/third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp index 4f573d1a..fdbe024 100644 --- a/third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp +++ b/third_party/WebKit/Source/modules/fetch/FormDataBytesConsumerTest.cpp
@@ -10,10 +10,14 @@ #include "core/typed_arrays/DOMArrayBuffer.h" #include "core/typed_arrays/DOMTypedArray.h" #include "modules/fetch/BytesConsumerTestUtil.h" +#include "mojo/common/data_pipe_utils.h" +#include "mojo/public/cpp/bindings/binding_set.h" #include "platform/blob/BlobData.h" #include "platform/network/EncodedFormData.h" #include "platform/wtf/Vector.h" #include "platform/wtf/text/WTFString.h" +#include "public/platform/WebHTTPBody.h" +#include "public/platform/WebString.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -28,6 +32,42 @@ using Checkpoint = ::testing::StrictMock<::testing::MockFunction<void(int)>>; using MockBytesConsumer = BytesConsumerTestUtil::MockBytesConsumer; +class SimpleDataPipeGetter : public network::mojom::blink::DataPipeGetter { + public: + SimpleDataPipeGetter(const String& str, + network::mojom::blink::DataPipeGetterRequest request) + : str_(str) { + bindings_.set_connection_error_handler(WTF::BindRepeating( + &SimpleDataPipeGetter::OnConnectionError, WTF::Unretained(this))); + bindings_.AddBinding(this, std::move(request)); + } + ~SimpleDataPipeGetter() override = default; + + // network::mojom::DataPipeGetter implementation: + void Read(mojo::ScopedDataPipeProducerHandle handle, + ReadCallback callback) override { + bool result = + mojo::common::BlockingCopyFromString(WebString(str_).Utf8(), handle); + ASSERT_TRUE(result); + std::move(callback).Run(0 /* OK */, str_.length()); + } + + void Clone(network::mojom::blink::DataPipeGetterRequest request) override { + bindings_.AddBinding(this, std::move(request)); + } + + void OnConnectionError() { + if (bindings_.empty()) + delete this; + } + + private: + String str_; + mojo::BindingSet<network::mojom::blink::DataPipeGetter> bindings_; + + DISALLOW_COPY_AND_ASSIGN(SimpleDataPipeGetter); +}; + scoped_refptr<EncodedFormData> ComplexFormData() { scoped_refptr<EncodedFormData> data = EncodedFormData::Create(); @@ -45,6 +85,33 @@ return data; } +scoped_refptr<EncodedFormData> DataPipeFormData() { + WebHTTPBody body; + body.Initialize(); + // Add data. + body.AppendData(WebData("foo", 3)); + + // Add data pipe. + network::mojom::blink::DataPipeGetterPtr data_pipe_getter_ptr; + // Object deletes itself. + new SimpleDataPipeGetter(String(" hello world"), + mojo::MakeRequest(&data_pipe_getter_ptr)); + body.AppendDataPipe(data_pipe_getter_ptr.PassInterface().PassHandle()); + + // Add another data pipe. + network::mojom::blink::DataPipeGetterPtr data_pipe_getter_ptr2; + // Object deletes itself. + new SimpleDataPipeGetter(String(" here's another data pipe "), + mojo::MakeRequest(&data_pipe_getter_ptr2)); + body.AppendDataPipe(data_pipe_getter_ptr2.PassInterface().PassHandle()); + + // Add some more data. + body.AppendData(WebData("bar baz", 7)); + + body.SetUniqueBoundary(); + return body; +} + class NoopClient final : public GarbageCollectedFinalized<NoopClient>, public BytesConsumer::Client { USING_GARBAGE_COLLECTED_MIXIN(NoopClient); @@ -385,5 +452,55 @@ checkpoint.Call(2); } +// Tests consuming an EncodedFormData with data pipe elements. +TEST_F(FormDataBytesConsumerTest, DataPipeFormData) { + scoped_refptr<EncodedFormData> input_form_data = DataPipeFormData(); + auto* consumer = new FormDataBytesConsumer(GetDocument(), input_form_data); + auto* reader = new BytesConsumerTestUtil::TwoPhaseReader(consumer); + std::pair<BytesConsumer::Result, Vector<char>> result = reader->Run(); + EXPECT_EQ(Result::kDone, result.first); + EXPECT_EQ("foo hello world here's another data pipe bar baz", + BytesConsumerTestUtil::CharVectorToString(result.second)); +} + +// Tests DrainAsFormData() on an EncodedFormData with data pipe elements. +TEST_F(FormDataBytesConsumerTest, DataPipeFormData_DrainAsFormData) { + scoped_refptr<EncodedFormData> input_form_data = DataPipeFormData(); + auto* consumer = new FormDataBytesConsumer(GetDocument(), input_form_data); + scoped_refptr<EncodedFormData> drained_form_data = + consumer->DrainAsFormData(); + EXPECT_EQ(*input_form_data, *drained_form_data); + EXPECT_EQ(BytesConsumer::PublicState::kClosed, consumer->GetPublicState()); +} + +// Tests DrainAsFormData() on an EncodedFormData with data pipe elements after +// starting to read. +TEST_F(FormDataBytesConsumerTest, + DataPipeFormData_DrainAsFormDataWhileReading) { + // Create the consumer and start reading. + scoped_refptr<EncodedFormData> input_form_data = DataPipeFormData(); + auto* consumer = new FormDataBytesConsumer(GetDocument(), input_form_data); + const char* buffer = nullptr; + size_t available = 0; + EXPECT_EQ(BytesConsumer::Result::kOk, + consumer->BeginRead(&buffer, &available)); + EXPECT_EQ("foo", String(buffer, available)); + + // Try to drain form data. It should return null since we started reading. + scoped_refptr<EncodedFormData> drained_form_data = + consumer->DrainAsFormData(); + EXPECT_FALSE(drained_form_data); + EXPECT_EQ(BytesConsumer::PublicState::kReadableOrWaiting, + consumer->GetPublicState()); + EXPECT_EQ(BytesConsumer::Result::kOk, consumer->EndRead(available)); + + // The consumer should still be readable. Finish reading. + auto* reader = new BytesConsumerTestUtil::TwoPhaseReader(consumer); + std::pair<BytesConsumer::Result, Vector<char>> result = reader->Run(); + EXPECT_EQ(Result::kDone, result.first); + EXPECT_EQ(" hello world here's another data pipe bar baz", + BytesConsumerTestUtil::CharVectorToString(result.second)); +} + } // namespace } // namespace blink
diff --git a/third_party/WebKit/Source/modules/filesystem/DOMWindowFileSystem.cpp b/third_party/WebKit/Source/modules/filesystem/DOMWindowFileSystem.cpp index 9017813..773674e 100644 --- a/third_party/WebKit/Source/modules/filesystem/DOMWindowFileSystem.cpp +++ b/third_party/WebKit/Source/modules/filesystem/DOMWindowFileSystem.cpp
@@ -63,6 +63,8 @@ ScriptErrorCallback::Wrap(error_callback), FileError::kSecurityErr); return; + } else if (document->GetSecurityOrigin()->IsLocal()) { + UseCounter::Count(document, WebFeature::kFileAccessedFileSystem); } FileSystemType file_system_type = static_cast<FileSystemType>(type); @@ -100,6 +102,8 @@ ScriptErrorCallback::Wrap(error_callback), FileError::kSecurityErr); return; + } else if (document->GetSecurityOrigin()->IsLocal()) { + UseCounter::Count(document, WebFeature::kFileAccessedFileSystem); } if (!completed_url.IsValid()) {
diff --git a/third_party/WebKit/Source/modules/filesystem/WorkerGlobalScopeFileSystem.cpp b/third_party/WebKit/Source/modules/filesystem/WorkerGlobalScopeFileSystem.cpp index 7c28403..c6f21d2 100644 --- a/third_party/WebKit/Source/modules/filesystem/WorkerGlobalScopeFileSystem.cpp +++ b/third_party/WebKit/Source/modules/filesystem/WorkerGlobalScopeFileSystem.cpp
@@ -27,9 +27,11 @@ #include "modules/filesystem/WorkerGlobalScopeFileSystem.h" +#include <memory> #include "bindings/core/v8/ExceptionState.h" #include "core/dom/ExceptionCode.h" #include "core/fileapi/FileError.h" +#include "core/frame/UseCounter.h" #include "core/workers/WorkerGlobalScope.h" #include "modules/filesystem/DOMFileSystemBase.h" #include "modules/filesystem/DirectoryEntrySync.h" @@ -41,7 +43,6 @@ #include "modules/filesystem/SyncCallbackHelper.h" #include "platform/FileSystemType.h" #include "platform/weborigin/SecurityOrigin.h" -#include <memory> namespace blink { @@ -57,6 +58,8 @@ ScriptErrorCallback::Wrap(error_callback), FileError::kSecurityErr); return; + } else if (secure_context->GetSecurityOrigin()->IsLocal()) { + UseCounter::Count(secure_context, WebFeature::kFileAccessedFileSystem); } FileSystemType file_system_type = static_cast<FileSystemType>(type); @@ -83,6 +86,8 @@ if (!secure_context->GetSecurityOrigin()->CanAccessFileSystem()) { exception_state.ThrowSecurityError(FileError::kSecurityErrorMessage); return nullptr; + } else if (secure_context->GetSecurityOrigin()->IsLocal()) { + UseCounter::Count(secure_context, WebFeature::kFileAccessedFileSystem); } FileSystemType file_system_type = static_cast<FileSystemType>(type); @@ -118,6 +123,8 @@ ScriptErrorCallback::Wrap(error_callback), FileError::kSecurityErr); return; + } else if (secure_context->GetSecurityOrigin()->IsLocal()) { + UseCounter::Count(secure_context, WebFeature::kFileAccessedFileSystem); } if (!completed_url.IsValid()) { @@ -144,6 +151,8 @@ !secure_context->GetSecurityOrigin()->CanRequest(completed_url)) { exception_state.ThrowSecurityError(FileError::kSecurityErrorMessage); return nullptr; + } else if (secure_context->GetSecurityOrigin()->IsLocal()) { + UseCounter::Count(secure_context, WebFeature::kFileAccessedFileSystem); } if (!completed_url.IsValid()) {
diff --git a/third_party/WebKit/Source/modules/gamepad/NavigatorGamepad.cpp b/third_party/WebKit/Source/modules/gamepad/NavigatorGamepad.cpp index f9cef526..5c57a16 100644 --- a/third_party/WebKit/Source/modules/gamepad/NavigatorGamepad.cpp +++ b/third_party/WebKit/Source/modules/gamepad/NavigatorGamepad.cpp
@@ -33,6 +33,7 @@ #include "modules/gamepad/GamepadDispatcher.h" #include "modules/gamepad/GamepadEvent.h" #include "modules/gamepad/GamepadList.h" +#include "public/platform/TaskType.h" namespace { @@ -173,8 +174,10 @@ DomWindow()->DispatchEvent( GamepadEvent::Create(event_name, false, true, gamepad)); - if (!pending_events_.IsEmpty()) + if (!pending_events_.IsEmpty()) { + DCHECK(dispatch_one_event_runner_); dispatch_one_event_runner_->RunAsync(); + } } NavigatorGamepad::NavigatorGamepad(Navigator& navigator) @@ -182,9 +185,13 @@ DOMWindowClient(navigator.DomWindow()), PlatformEventController( navigator.GetFrame() ? navigator.GetFrame()->GetDocument() : nullptr), - dispatch_one_event_runner_(AsyncMethodRunner<NavigatorGamepad>::Create( - this, - &NavigatorGamepad::DispatchOneEvent)) { + dispatch_one_event_runner_( + navigator.GetFrame() ? AsyncMethodRunner<NavigatorGamepad>::Create( + this, + &NavigatorGamepad::DispatchOneEvent, + navigator.GetFrame()->GetTaskRunner( + TaskType::kMiscPlatformAPI)) + : nullptr) { if (navigator.DomWindow()) navigator.DomWindow()->RegisterEventListenerObserver(this); } @@ -197,11 +204,13 @@ void NavigatorGamepad::RegisterWithDispatcher() { GamepadDispatcher::Instance().AddController(this); - dispatch_one_event_runner_->Unpause(); + if (dispatch_one_event_runner_) + dispatch_one_event_runner_->Unpause(); } void NavigatorGamepad::UnregisterWithDispatcher() { - dispatch_one_event_runner_->Pause(); + if (dispatch_one_event_runner_) + dispatch_one_event_runner_->Pause(); GamepadDispatcher::Instance().RemoveController(this); } @@ -245,7 +254,8 @@ void NavigatorGamepad::DidRemoveGamepadEventListeners() { has_event_listener_ = false; - dispatch_one_event_runner_->Stop(); + if (dispatch_one_event_runner_) + dispatch_one_event_runner_->Stop(); pending_events_.clear(); StopUpdating(); } @@ -268,8 +278,10 @@ // recreate the buffer. gamepads_ = GamepadList::Create(); } - if (!pending_events_.IsEmpty()) + if (!pending_events_.IsEmpty()) { + DCHECK(dispatch_one_event_runner_); dispatch_one_event_runner_->RunAsync(); + } } SampleGamepads<Gamepad>(gamepads_.Get()); }
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBFactory.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBFactory.cpp index ee7c4ed..5a08c8b 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBFactory.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBFactory.cpp
@@ -35,6 +35,7 @@ #include "core/dom/Document.h" #include "core/dom/ExceptionCode.h" #include "core/dom/ExecutionContext.h" +#include "core/frame/UseCounter.h" #include "modules/indexeddb/IDBDatabase.h" #include "modules/indexeddb/IDBDatabaseCallbacks.h" #include "modules/indexeddb/IDBKey.h" @@ -80,6 +81,11 @@ return nullptr; } + if (ExecutionContext::From(script_state)->GetSecurityOrigin()->IsLocal()) { + UseCounter::Count(ExecutionContext::From(script_state), + WebFeature::kFileAccessedDatabase); + } + if (!IndexedDBClient::From(ExecutionContext::From(script_state)) ->AllowIndexedDB(ExecutionContext::From(script_state), "Database Listing")) { @@ -124,6 +130,11 @@ return nullptr; } + if (ExecutionContext::From(script_state)->GetSecurityOrigin()->IsLocal()) { + UseCounter::Count(ExecutionContext::From(script_state), + WebFeature::kFileAccessedDatabase); + } + IDBDatabaseCallbacks* database_callbacks = IDBDatabaseCallbacks::Create(); int64_t transaction_id = IDBDatabase::NextTransactionId(); IDBOpenDBRequest* request = @@ -186,6 +197,11 @@ return nullptr; } + if (ExecutionContext::From(script_state)->GetSecurityOrigin()->IsLocal()) { + UseCounter::Count(ExecutionContext::From(script_state), + WebFeature::kFileAccessedDatabase); + } + IDBOpenDBRequest* request = IDBOpenDBRequest::Create( script_state, nullptr, 0, IDBDatabaseMetadata::kDefaultVersion, std::move(metrics));
diff --git a/third_party/WebKit/Source/modules/locks/LockManager.cpp b/third_party/WebKit/Source/modules/locks/LockManager.cpp index d5b38f91..eb58f8bc 100644 --- a/third_party/WebKit/Source/modules/locks/LockManager.cpp +++ b/third_party/WebKit/Source/modules/locks/LockManager.cpp
@@ -9,6 +9,7 @@ #include "bindings/modules/v8/v8_lock_granted_callback.h" #include "core/dom/DOMException.h" #include "core/dom/ExceptionCode.h" +#include "core/frame/UseCounter.h" #include "modules/locks/Lock.h" #include "modules/locks/LockOptions.h" #include "mojo/public/cpp/bindings/binding.h" @@ -161,6 +162,8 @@ exception_state.ThrowSecurityError( "Access to the Locks API is denied in this context."); return ScriptPromise(); + } else if (context->GetSecurityOrigin()->IsLocal()) { + UseCounter::Count(context, WebFeature::kFileAccessedLocks); } if (!service_.get()) {
diff --git a/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegateTest.cpp b/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegateTest.cpp index 8c07a1c9..ecacad9 100644 --- a/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegateTest.cpp +++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegateTest.cpp
@@ -69,13 +69,13 @@ void DidEnterFullscreen(Document* document) { DCHECK(document); Fullscreen::From(*document).DidEnterFullscreen(); - document->ServiceScriptedAnimations(WTF::MonotonicallyIncreasingTime()); + document->ServiceScriptedAnimations(WTF::CurrentTimeTicksInSeconds()); } void DidExitFullscreen(Document* document) { DCHECK(document); Fullscreen::From(*document).DidExitFullscreen(); - document->ServiceScriptedAnimations(WTF::MonotonicallyIncreasingTime()); + document->ServiceScriptedAnimations(WTF::CurrentTimeTicksInSeconds()); } class MockChromeClientForOrientationLockDelegate final
diff --git a/third_party/WebKit/Source/modules/media_controls/elements/MediaControlOverflowMenuListElement.cpp b/third_party/WebKit/Source/modules/media_controls/elements/MediaControlOverflowMenuListElement.cpp index 0ab8627..a2c96f7f 100644 --- a/third_party/WebKit/Source/modules/media_controls/elements/MediaControlOverflowMenuListElement.cpp +++ b/third_party/WebKit/Source/modules/media_controls/elements/MediaControlOverflowMenuListElement.cpp
@@ -31,7 +31,7 @@ : "Media.Controls.Overflow.TimeToDismiss", 1, 100, 100); histogram.Count(static_cast<int32_t>( - (TimeTicks::Now() - time_shown_.value()).InSeconds())); + (CurrentTimeTicks() - time_shown_.value()).InSeconds())); time_shown_.reset(); } @@ -49,7 +49,7 @@ // Record the time the overflow menu was shown to a histogram. if (wanted) { DCHECK(!time_shown_); - time_shown_ = TimeTicks::Now(); + time_shown_ = CurrentTimeTicks(); } else if (time_shown_) { // Records the time taken to dismiss using a task runner. This ensures the // time to dismiss is always called after the time to action (if there is
diff --git a/third_party/WebKit/Source/modules/media_controls/elements/MediaControlTimelineMetrics.cpp b/third_party/WebKit/Source/modules/media_controls/elements/MediaControlTimelineMetrics.cpp index 7d22c8eb..2adb364 100644 --- a/third_party/WebKit/Source/modules/media_controls/elements/MediaControlTimelineMetrics.cpp +++ b/third_party/WebKit/Source/modules/media_controls/elements/MediaControlTimelineMetrics.cpp
@@ -208,7 +208,7 @@ void MediaControlTimelineMetrics::StartGesture(bool from_thumb) { // Initialize gesture tracking. state_ = from_thumb ? State::kGestureFromThumb : State::kGestureFromElsewhere; - drag_start_time_ticks_ = TimeTicks::Now(); + drag_start_time_ticks_ = CurrentTimeTicks(); drag_delta_media_seconds_ = 0; drag_sum_abs_delta_media_seconds_ = 0; } @@ -245,7 +245,7 @@ return; // Metrics below are only for drags. RecordDragGestureDurationByWidth(timeline_width, - TimeTicks::Now() - drag_start_time_ticks_); + CurrentTimeTicks() - drag_start_time_ticks_); if (std::isfinite(media_duration_seconds)) { RecordDragPercentByWidth(timeline_width, 100.0 * drag_delta_media_seconds_ / media_duration_seconds);
diff --git a/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp b/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp index ff765700..1e4ef4de 100644 --- a/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp +++ b/third_party/WebKit/Source/modules/mediarecorder/MediaRecorder.cpp
@@ -17,6 +17,7 @@ #include "platform/wtf/PtrUtil.h" #include "platform/wtf/Time.h" #include "public/platform/Platform.h" +#include "public/platform/TaskType.h" #include "public/platform/WebMediaStream.h" namespace blink { @@ -168,9 +169,12 @@ audio_bits_per_second_(0), video_bits_per_second_(0), state_(State::kInactive), + // MediaStream recording should use DOM manipulation task source. + // https://www.w3.org/TR/mediastream-recording/ dispatch_scheduled_event_runner_(AsyncMethodRunner<MediaRecorder>::Create( this, - &MediaRecorder::DispatchScheduledEvent)) { + &MediaRecorder::DispatchScheduledEvent, + context->GetTaskRunner(TaskType::kDOMManipulation))) { DCHECK(stream_->getTracks().size()); recorder_handler_ = Platform::Current()->CreateMediaRecorderHandler();
diff --git a/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp b/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp index 63e0b7b..72056c63 100644 --- a/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp +++ b/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp
@@ -54,6 +54,7 @@ #include "platform/instrumentation/tracing/TraceEvent.h" #include "platform/runtime_enabled_features.h" #include "platform/wtf/MathExtras.h" +#include "public/platform/TaskType.h" #include "public/platform/WebSourceBuffer.h" #ifndef BLINK_SBLOG @@ -129,12 +130,14 @@ pending_append_data_offset_(0), append_buffer_async_part_runner_(AsyncMethodRunner<SourceBuffer>::Create( this, - &SourceBuffer::AppendBufferAsyncPart)), + &SourceBuffer::AppendBufferAsyncPart, + GetExecutionContext()->GetTaskRunner(TaskType::kMediaElementEvent))), pending_remove_start_(-1), pending_remove_end_(-1), remove_async_part_runner_(AsyncMethodRunner<SourceBuffer>::Create( this, - &SourceBuffer::RemoveAsyncPart)) { + &SourceBuffer::RemoveAsyncPart, + GetExecutionContext()->GetTaskRunner(TaskType::kMediaElementEvent))) { BLINK_SBLOG << __func__ << " this=" << this; DCHECK(web_source_buffer_);
diff --git a/third_party/WebKit/Source/modules/mediastream/MediaDevices.cpp b/third_party/WebKit/Source/modules/mediastream/MediaDevices.cpp index 2aaa72d..e78f7f6 100644 --- a/third_party/WebKit/Source/modules/mediastream/MediaDevices.cpp +++ b/third_party/WebKit/Source/modules/mediastream/MediaDevices.cpp
@@ -20,6 +20,7 @@ #include "modules/mediastream/UserMediaRequest.h" #include "platform/bindings/ScriptState.h" #include "platform/wtf/Functional.h" +#include "public/platform/TaskType.h" #include "services/service_manager/public/cpp/interface_provider.h" using blink::mojom::blink::MediaDeviceType; @@ -69,9 +70,12 @@ : PausableObject(context), observing_(false), stopped_(false), - dispatch_scheduled_event_runner_(AsyncMethodRunner<MediaDevices>::Create( - this, - &MediaDevices::DispatchScheduledEvent)) {} + dispatch_scheduled_event_runner_( + context ? AsyncMethodRunner<MediaDevices>::Create( + this, + &MediaDevices::DispatchScheduledEvent, + context->GetTaskRunner(TaskType::kMediaElementEvent)) + : nullptr) {} MediaDevices::~MediaDevices() {} @@ -191,15 +195,18 @@ } void MediaDevices::Pause() { + DCHECK(dispatch_scheduled_event_runner_); dispatch_scheduled_event_runner_->Pause(); } void MediaDevices::Unpause() { + DCHECK(dispatch_scheduled_event_runner_); dispatch_scheduled_event_runner_->Unpause(); } void MediaDevices::ScheduleDispatchEvent(Event* event) { scheduled_events_.push_back(event); + DCHECK(dispatch_scheduled_event_runner_); dispatch_scheduled_event_runner_->RunAsync(); }
diff --git a/third_party/WebKit/Source/modules/mediastream/MediaDevices.h b/third_party/WebKit/Source/modules/mediastream/MediaDevices.h index ae6a06bd..24e4770 100644 --- a/third_party/WebKit/Source/modules/mediastream/MediaDevices.h +++ b/third_party/WebKit/Source/modules/mediastream/MediaDevices.h
@@ -100,6 +100,8 @@ bool observing_; bool stopped_; + // Async runner may be null when there is no valid execution context. + // No async work may be posted in this scenario. Member<AsyncMethodRunner<MediaDevices>> dispatch_scheduled_event_runner_; HeapVector<Member<Event>> scheduled_events_; mojom::blink::MediaDevicesDispatcherHostPtr dispatcher_host_;
diff --git a/third_party/WebKit/Source/modules/notifications/Notification.cpp b/third_party/WebKit/Source/modules/notifications/Notification.cpp index e5721d5..0ae347df 100644 --- a/third_party/WebKit/Source/modules/notifications/Notification.cpp +++ b/third_party/WebKit/Source/modules/notifications/Notification.cpp
@@ -164,8 +164,9 @@ DCHECK_EQ(state_, State::kLoading); DCHECK(!prepare_show_method_runner_); - prepare_show_method_runner_ = - AsyncMethodRunner<Notification>::Create(this, &Notification::PrepareShow); + prepare_show_method_runner_ = AsyncMethodRunner<Notification>::Create( + this, &Notification::PrepareShow, + GetExecutionContext()->GetTaskRunner(TaskType::kMiscPlatformAPI)); prepare_show_method_runner_->RunAsync(); }
diff --git a/third_party/WebKit/Source/modules/notifications/NotificationImageLoader.cpp b/third_party/WebKit/Source/modules/notifications/NotificationImageLoader.cpp index 5efdb88e..84fdd1d9 100644 --- a/third_party/WebKit/Source/modules/notifications/NotificationImageLoader.cpp +++ b/third_party/WebKit/Source/modules/notifications/NotificationImageLoader.cpp
@@ -81,14 +81,14 @@ double scale = std::min(static_cast<double>(max_width_px) / image.width(), static_cast<double>(max_height_px) / image.height()); - double start_time = MonotonicallyIncreasingTimeMS(); + double start_time = CurrentTimeTicksInMilliseconds(); // TODO(peter): Try using RESIZE_BETTER for large images. SkBitmap scaled_image = skia::ImageOperations::Resize(image, skia::ImageOperations::RESIZE_BEST, std::lround(scale * image.width()), std::lround(scale * image.height())); NOTIFICATION_HISTOGRAM_COUNTS(LoadScaleDownTime, type, - MonotonicallyIncreasingTimeMS() - start_time, + CurrentTimeTicksInMilliseconds() - start_time, 1000 * 10 /* 10 seconds max */); return scaled_image; } @@ -100,7 +100,7 @@ ImageCallback image_callback) { DCHECK(!stopped_); - start_time_ = MonotonicallyIncreasingTimeMS(); + start_time_ = CurrentTimeTicksInMilliseconds(); image_callback_ = std::move(image_callback); ThreadableLoaderOptions threadable_loader_options; @@ -150,7 +150,7 @@ return; NOTIFICATION_HISTOGRAM_COUNTS(LoadFinishTime, type_, - MonotonicallyIncreasingTimeMS() - start_time_, + CurrentTimeTicksInMilliseconds() - start_time_, 1000 * 60 * 60 /* 1 hour max */); if (data_) { @@ -174,7 +174,7 @@ void NotificationImageLoader::DidFail(const ResourceError& error) { NOTIFICATION_HISTOGRAM_COUNTS(LoadFailTime, type_, - MonotonicallyIncreasingTimeMS() - start_time_, + CurrentTimeTicksInMilliseconds() - start_time_, 1000 * 60 * 60 /* 1 hour max */); RunCallbackWithEmptyBitmap();
diff --git a/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnection.cpp b/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnection.cpp index 823a0cb..584d735b 100644 --- a/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnection.cpp +++ b/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnection.cpp
@@ -91,6 +91,7 @@ #include "platform/wtf/PtrUtil.h" #include "platform/wtf/Time.h" #include "public/platform/Platform.h" +#include "public/platform/TaskType.h" #include "public/platform/WebCryptoAlgorithmParams.h" #include "public/platform/WebMediaStream.h" #include "public/platform/WebRTCAnswerOptions.h" @@ -492,10 +493,13 @@ signaling_state_(kSignalingStateStable), ice_gathering_state_(kICEGatheringStateNew), ice_connection_state_(kICEConnectionStateNew), + // WebRTC spec specifies kNetworking as task source. + // https://www.w3.org/TR/webrtc/#operation dispatch_scheduled_event_runner_( AsyncMethodRunner<RTCPeerConnection>::Create( this, - &RTCPeerConnection::DispatchScheduledEvent)), + &RTCPeerConnection::DispatchScheduledEvent, + context->GetTaskRunner(TaskType::kNetworking))), stopped_(false), closed_(false), has_data_channels_(false) {
diff --git a/third_party/WebKit/Source/modules/serviceworkers/NavigatorServiceWorker.cpp b/third_party/WebKit/Source/modules/serviceworkers/NavigatorServiceWorker.cpp index 3573502..b2eff50e 100644 --- a/third_party/WebKit/Source/modules/serviceworkers/NavigatorServiceWorker.cpp +++ b/third_party/WebKit/Source/modules/serviceworkers/NavigatorServiceWorker.cpp
@@ -9,6 +9,7 @@ #include "core/frame/LocalDOMWindow.h" #include "core/frame/LocalFrame.h" #include "core/frame/Navigator.h" +#include "core/frame/UseCounter.h" #include "modules/serviceworkers/ServiceWorkerContainer.h" #include "platform/bindings/ScriptState.h" @@ -107,6 +108,9 @@ "Access to service workers is denied in this document origin."; } return nullptr; + } else if (frame && + frame->GetSecurityContext()->GetSecurityOrigin()->IsLocal()) { + UseCounter::Count(frame, WebFeature::kFileAccessedServiceWorker); } if (!service_worker_ && frame) { // We need to create a new ServiceWorkerContainer when the frame
diff --git a/third_party/WebKit/Source/modules/speech/SpeechSynthesis.cpp b/third_party/WebKit/Source/modules/speech/SpeechSynthesis.cpp index 6a7fb30..9372a95 100644 --- a/third_party/WebKit/Source/modules/speech/SpeechSynthesis.cpp +++ b/third_party/WebKit/Source/modules/speech/SpeechSynthesis.cpp
@@ -88,7 +88,7 @@ SpeechSynthesisUtterance* utterance = CurrentSpeechUtterance(); DCHECK(utterance); - utterance->SetStartTime(MonotonicallyIncreasingTime()); + utterance->SetStartTime(CurrentTimeTicksInSeconds()); is_paused_ = false; platform_speech_synthesizer_->Speak(utterance->PlatformUtterance()); } @@ -130,7 +130,7 @@ return; double elapsed_time_millis = - (MonotonicallyIncreasingTime() - utterance->StartTime()) * 1000.0; + (CurrentTimeTicksInSeconds() - utterance->StartTime()) * 1000.0; utterance->DispatchEvent(SpeechSynthesisEvent::Create( type, utterance, char_index, elapsed_time_millis, name)); }
diff --git a/third_party/WebKit/Source/modules/storage/DOMWindowStorage.cpp b/third_party/WebKit/Source/modules/storage/DOMWindowStorage.cpp index 67bd1a9..80fad2c7a 100644 --- a/third_party/WebKit/Source/modules/storage/DOMWindowStorage.cpp +++ b/third_party/WebKit/Source/modules/storage/DOMWindowStorage.cpp
@@ -9,6 +9,7 @@ #include "core/frame/LocalDOMWindow.h" #include "core/frame/LocalFrame.h" #include "core/frame/Settings.h" +#include "core/frame/UseCounter.h" #include "core/page/Page.h" #include "modules/storage/Storage.h" #include "modules/storage/StorageNamespace.h" @@ -61,7 +62,7 @@ Document* document = GetSupplementable()->GetFrame()->GetDocument(); DCHECK(document); String access_denied_message = "Access is denied for this document."; - if (!document->GetSecurityOrigin()->CanAccessLocalStorage()) { + if (!document->GetSecurityOrigin()->CanAccessSessionStorage()) { if (document->IsSandboxed(kSandboxOrigin)) exception_state.ThrowSecurityError( "The document is sandboxed and lacks the 'allow-same-origin' flag."); @@ -73,6 +74,10 @@ return nullptr; } + if (document->GetSecurityOrigin()->IsLocal()) { + UseCounter::Count(document, WebFeature::kFileAccessedSessionStorage); + } + if (session_storage_) { if (!session_storage_->Area()->CanAccessStorage(document->GetFrame())) { exception_state.ThrowSecurityError(access_denied_message); @@ -115,6 +120,11 @@ exception_state.ThrowSecurityError(access_denied_message); return nullptr; } + + if (document->GetSecurityOrigin()->IsLocal()) { + UseCounter::Count(document, WebFeature::kFileAccessedLocalStorage); + } + if (local_storage_) { if (!local_storage_->Area()->CanAccessStorage(document->GetFrame())) { exception_state.ThrowSecurityError(access_denied_message);
diff --git a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp index f9986d60..9af75b5e 100644 --- a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp +++ b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
@@ -64,7 +64,7 @@ void Invoke(double high_res_time_ms) override { double monotonic_time; if (!vr_display_->GetDocument() || !vr_display_->GetDocument()->Loader()) { - monotonic_time = WTF::MonotonicallyIncreasingTime(); + monotonic_time = WTF::CurrentTimeTicksInSeconds(); } else { // Convert document-zero time back to monotonic time. double reference_monotonic_time = vr_display_->GetDocument() @@ -595,7 +595,7 @@ // Run window.rAF once manually so that applications get a chance to // schedule a VRDisplay.rAF in case they do so only while presenting. if (!pending_vrdisplay_raf_ && !capabilities_->hasExternalDisplay()) { - double timestamp = WTF::MonotonicallyIncreasingTime(); + double timestamp = WTF::CurrentTimeTicksInSeconds(); Platform::Current()->CurrentThread()->GetWebTaskRunner()->PostTask( BLINK_FROM_HERE, WTF::Bind(&VRDisplay::ProcessScheduledWindowAnimations, WrapWeakPersistent(this), timestamp)); @@ -771,7 +771,7 @@ StaticBitmapImage* static_image = static_cast<StaticBitmapImage*>(image_ref.get()); TRACE_EVENT_BEGIN0("gpu", "VRDisplay::EnsureMailbox"); - static_image->EnsureMailbox(kVerifiedSyncToken); + static_image->EnsureMailbox(kVerifiedSyncToken, GL_NEAREST); TRACE_EVENT_END0("gpu", "VRDisplay::EnsureMailbox"); // Conditionally wait for the previous render to finish. A late wait here @@ -842,14 +842,14 @@ WTF::TimeDelta VRDisplay::WaitForPreviousRenderToFinish() { TRACE_EVENT0("gpu", "waitForPreviousRenderToFinish"); - WTF::TimeTicks start = WTF::TimeTicks::Now(); + WTF::TimeTicks start = WTF::CurrentTimeTicks(); while (pending_previous_frame_render_) { if (!submit_frame_client_binding_.WaitForIncomingMethodCall()) { DLOG(ERROR) << "Failed to receive SubmitFrame response"; break; } } - return WTF::TimeTicks::Now() - start; + return WTF::CurrentTimeTicks() - start; } Document* VRDisplay::GetDocument() {
diff --git a/third_party/WebKit/Source/modules/wake_lock/ScreenWakeLockTest.cpp b/third_party/WebKit/Source/modules/wake_lock/ScreenWakeLockTest.cpp index c45551b..44bb25e16 100644 --- a/third_party/WebKit/Source/modules/wake_lock/ScreenWakeLockTest.cpp +++ b/third_party/WebKit/Source/modules/wake_lock/ScreenWakeLockTest.cpp
@@ -75,15 +75,15 @@ } void LoadFrame() { - FrameTestHelpers::LoadFrame(web_view_helper_.WebView()->MainFrameImpl(), + FrameTestHelpers::LoadFrame(web_view_helper_.GetWebView()->MainFrameImpl(), "http://example.com/foo.html"); - web_view_helper_.WebView()->UpdateAllLifecyclePhases(); + web_view_helper_.GetWebView()->UpdateAllLifecyclePhases(); } LocalFrame* GetFrame() { - DCHECK(web_view_helper_.WebView()); - DCHECK(web_view_helper_.WebView()->MainFrameImpl()); - return web_view_helper_.WebView()->MainFrameImpl()->GetFrame(); + DCHECK(web_view_helper_.GetWebView()); + DCHECK(web_view_helper_.GetWebView()->MainFrameImpl()); + return web_view_helper_.GetWebView()->MainFrameImpl()->GetFrame(); } Screen* GetScreen() { @@ -107,16 +107,16 @@ } void Show() { - DCHECK(web_view_helper_.WebView()); - web_view_helper_.WebView()->SetVisibilityState( + DCHECK(web_view_helper_.GetWebView()); + web_view_helper_.GetWebView()->SetVisibilityState( mojom::blink::PageVisibilityState::kVisible, false); // Let the notification sink through the mojo pipes. testing::RunPendingTasks(); } void Hide() { - DCHECK(web_view_helper_.WebView()); - web_view_helper_.WebView()->SetVisibilityState( + DCHECK(web_view_helper_.GetWebView()); + web_view_helper_.GetWebView()->SetVisibilityState( mojom::blink::PageVisibilityState::kHidden, false); // Let the notification sink through the mojo pipes. testing::RunPendingTasks();
diff --git a/third_party/WebKit/Source/modules/webdatabase/DOMWindowWebDatabase.cpp b/third_party/WebKit/Source/modules/webdatabase/DOMWindowWebDatabase.cpp index 0870ea6e..2be8c61 100644 --- a/third_party/WebKit/Source/modules/webdatabase/DOMWindowWebDatabase.cpp +++ b/third_party/WebKit/Source/modules/webdatabase/DOMWindowWebDatabase.cpp
@@ -30,6 +30,7 @@ #include "bindings/modules/v8/v8_database_callback.h" #include "core/dom/Document.h" #include "core/frame/LocalDOMWindow.h" +#include "core/frame/UseCounter.h" #include "modules/webdatabase/Database.h" #include "modules/webdatabase/DatabaseManager.h" #include "platform/runtime_enabled_features.h" @@ -63,6 +64,9 @@ DatabaseError error = DatabaseError::kNone; if (RuntimeEnabledFeatures::DatabaseEnabled() && window.document()->GetSecurityOrigin()->CanAccessDatabase()) { + if (window.document()->GetSecurityOrigin()->IsLocal()) + UseCounter::Count(window.document(), WebFeature::kFileAccessedDatabase); + String error_message; database = db_manager.OpenDatabase(window.document(), name, version, display_name, estimated_size,
diff --git a/third_party/WebKit/Source/modules/webdatabase/Database.cpp b/third_party/WebKit/Source/modules/webdatabase/Database.cpp index 29c63dd5..67224dd 100644 --- a/third_party/WebKit/Source/modules/webdatabase/Database.cpp +++ b/third_party/WebKit/Source/modules/webdatabase/Database.cpp
@@ -469,7 +469,7 @@ bool Database::PerformOpenAndVerify(bool should_set_version_in_new_database, DatabaseError& error, String& error_message) { - double call_start_time = WTF::MonotonicallyIncreasingTime(); + double call_start_time = WTF::CurrentTimeTicksInSeconds(); DoneCreatingDatabaseOnExitCaller on_exit_caller(this); DCHECK(error_message.IsEmpty()); DCHECK_EQ(error, @@ -482,7 +482,7 @@ if (!sqlite_database_.Open(filename_)) { ReportOpenDatabaseResult( 1, kInvalidStateError, sqlite_database_.LastError(), - WTF::MonotonicallyIncreasingTime() - call_start_time); + WTF::CurrentTimeTicksInSeconds() - call_start_time); error_message = FormatErrorMessage("unable to open database", sqlite_database_.LastError(), sqlite_database_.LastErrorMsg()); @@ -530,7 +530,7 @@ if (!transaction.InProgress()) { ReportOpenDatabaseResult( 2, kInvalidStateError, sqlite_database_.LastError(), - WTF::MonotonicallyIncreasingTime() - call_start_time); + WTF::CurrentTimeTicksInSeconds() - call_start_time); error_message = FormatErrorMessage( "unable to open database, failed to start transaction", sqlite_database_.LastError(), sqlite_database_.LastErrorMsg()); @@ -548,7 +548,7 @@ "REPLACE,value TEXT NOT NULL ON CONFLICT FAIL);")) { ReportOpenDatabaseResult( 3, kInvalidStateError, sqlite_database_.LastError(), - WTF::MonotonicallyIncreasingTime() - call_start_time); + WTF::CurrentTimeTicksInSeconds() - call_start_time); error_message = FormatErrorMessage( "unable to open database, failed to create 'info' table", sqlite_database_.LastError(), sqlite_database_.LastErrorMsg()); @@ -559,7 +559,7 @@ } else if (!GetVersionFromDatabase(current_version, false)) { ReportOpenDatabaseResult( 4, kInvalidStateError, sqlite_database_.LastError(), - WTF::MonotonicallyIncreasingTime() - call_start_time); + WTF::CurrentTimeTicksInSeconds() - call_start_time); error_message = FormatErrorMessage( "unable to open database, failed to read current version", sqlite_database_.LastError(), sqlite_database_.LastErrorMsg()); @@ -578,7 +578,7 @@ if (!SetVersionInDatabase(expected_version_, false)) { ReportOpenDatabaseResult( 5, kInvalidStateError, sqlite_database_.LastError(), - WTF::MonotonicallyIncreasingTime() - call_start_time); + WTF::CurrentTimeTicksInSeconds() - call_start_time); error_message = FormatErrorMessage( "unable to open database, failed to write current version", sqlite_database_.LastError(), sqlite_database_.LastErrorMsg()); @@ -608,7 +608,7 @@ expected_version_.length() && expected_version_ != current_version) { ReportOpenDatabaseResult( 6, kInvalidStateError, 0, - WTF::MonotonicallyIncreasingTime() - call_start_time); + WTF::CurrentTimeTicksInSeconds() - call_start_time); error_message = "unable to open database, version mismatch, '" + expected_version_ + "' does not match the currentVersion of '" + current_version + "'"; @@ -634,7 +634,7 @@ } ReportOpenDatabaseResult( - 0, -1, 0, WTF::MonotonicallyIncreasingTime() - call_start_time); // OK + 0, -1, 0, WTF::CurrentTimeTicksInSeconds() - call_start_time); // OK if (GetDatabaseContext()->GetDatabaseThread()) GetDatabaseContext()->GetDatabaseThread()->RecordDatabaseOpen(this);
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLQuery.cpp b/third_party/WebKit/Source/modules/webgl/WebGLQuery.cpp index f2d1db3..5fb3450 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGLQuery.cpp +++ b/third_party/WebKit/Source/modules/webgl/WebGLQuery.cpp
@@ -20,9 +20,14 @@ target_(0), can_update_availability_(false), query_result_available_(false), - query_result_(0), - task_runner_( - ctx->canvas()->GetDocument().GetTaskRunner(TaskType::kUnthrottled)) { + query_result_(0) { + if (ctx->canvas()) { + task_runner_ = + ctx->canvas()->GetDocument().GetTaskRunner(TaskType::kUnthrottled); + } else { + // Fallback for OffscreenCanvas (no frame scheduler) + task_runner_ = Platform::Current()->CurrentThread()->GetWebTaskRunner(); + } GLuint query; ctx->ContextGL()->GenQueriesEXT(1, &query); SetObject(query);
diff --git a/third_party/WebKit/Source/platform/AsyncMethodRunner.h b/third_party/WebKit/Source/platform/AsyncMethodRunner.h index 243d881..d4f5536 100644 --- a/third_party/WebKit/Source/platform/AsyncMethodRunner.h +++ b/third_party/WebKit/Source/platform/AsyncMethodRunner.h
@@ -45,8 +45,10 @@ public: typedef void (TargetClass::*TargetMethod)(); - static AsyncMethodRunner* Create(TargetClass* object, TargetMethod method) { - return new AsyncMethodRunner(object, method); + static AsyncMethodRunner* Create(TargetClass* object, + TargetMethod method, + scoped_refptr<WebTaskRunner> task_runner) { + return new AsyncMethodRunner(object, method, std::move(task_runner)); } ~AsyncMethodRunner() {} @@ -112,8 +114,12 @@ void Trace(blink::Visitor* visitor) { visitor->Trace(object_); } private: - AsyncMethodRunner(TargetClass* object, TargetMethod method) - : timer_(this, &AsyncMethodRunner<TargetClass>::Fired), + AsyncMethodRunner(TargetClass* object, + TargetMethod method, + scoped_refptr<WebTaskRunner> task_runner) + : timer_(std::move(task_runner), + this, + &AsyncMethodRunner<TargetClass>::Fired), object_(object), method_(method), paused_(false), @@ -121,7 +127,7 @@ void Fired(TimerBase*) { (object_->*method_)(); } - Timer<AsyncMethodRunner<TargetClass>> timer_; + TaskRunnerTimer<AsyncMethodRunner<TargetClass>> timer_; Member<TargetClass> object_; TargetMethod method_;
diff --git a/third_party/WebKit/Source/platform/BUILD.gn b/third_party/WebKit/Source/platform/BUILD.gn index 59e5f41a..534c0de 100644 --- a/third_party/WebKit/Source/platform/BUILD.gn +++ b/third_party/WebKit/Source/platform/BUILD.gn
@@ -1683,6 +1683,8 @@ "testing/weburl_loader_mock.h", "testing/weburl_loader_mock_factory_impl.cc", "testing/weburl_loader_mock_factory_impl.h", + "testing/wtf/ScopedMockClock.cpp", + "testing/wtf/ScopedMockClock.h", ] configs += [
diff --git a/third_party/WebKit/Source/platform/DEPS b/third_party/WebKit/Source/platform/DEPS index e98e6245..2635809a 100644 --- a/third_party/WebKit/Source/platform/DEPS +++ b/third_party/WebKit/Source/platform/DEPS
@@ -45,6 +45,7 @@ "+public/platform", #TODO(nverne): remove this "+public/web/WebKit.h", + "+services/network/public/interfaces/data_pipe_getter.mojom-blink.h", "+services/viz/public/interfaces/compositing/compositor_frame_sink.mojom-blink.h", "+skia/ext", "+third_party/ced/src/compact_enc_det/compact_enc_det.h",
diff --git a/third_party/WebKit/Source/platform/Histogram.h b/third_party/WebKit/Source/platform/Histogram.h index f720edad..3ae4dea 100644 --- a/third_party/WebKit/Source/platform/Histogram.h +++ b/third_party/WebKit/Source/platform/Histogram.h
@@ -65,21 +65,14 @@ class PLATFORM_EXPORT ScopedUsHistogramTimer { public: - explicit ScopedUsHistogramTimer(CustomCountHistogram& counter, - base::TickClock* clock = nullptr) - : clock_for_testing_(clock), start_time_(Now()), counter_(counter) {} + explicit ScopedUsHistogramTimer(CustomCountHistogram& counter) + : start_time_(CurrentTimeTicks()), counter_(counter) {} ~ScopedUsHistogramTimer() { - counter_.Count((Now() - start_time_).InMicroseconds()); + counter_.Count((CurrentTimeTicks() - start_time_).InMicroseconds()); } private: - TimeTicks Now() const { - return clock_for_testing_ ? TimeTicks(clock_for_testing_->NowTicks()) - : TimeTicks::Now(); - } - - base::TickClock* clock_for_testing_; TimeTicks start_time_; CustomCountHistogram& counter_; };
diff --git a/third_party/WebKit/Source/platform/HistogramTest.cpp b/third_party/WebKit/Source/platform/HistogramTest.cpp index 22d4747..87c500a 100644 --- a/third_party/WebKit/Source/platform/HistogramTest.cpp +++ b/third_party/WebKit/Source/platform/HistogramTest.cpp
@@ -5,7 +5,8 @@ #include "platform/Histogram.h" #include "base/metrics/histogram_samples.h" -#include "base/test/simple_test_tick_clock.h" +#include "platform/testing/wtf/ScopedMockClock.h" +#include "platform/wtf/Time.h" #include "testing/gtest/include/gtest/gtest.h" namespace blink { @@ -24,8 +25,8 @@ TEST(ScopedUsHistogramTimerTest, Basic) { TestCustomCountHistogram scoped_us_counter("test", 0, 10000000, 50); { - base::SimpleTestTickClock clock; - ScopedUsHistogramTimer timer(scoped_us_counter, &clock); + WTF::ScopedMockClock clock; + ScopedUsHistogramTimer timer(scoped_us_counter); clock.Advance(TimeDelta::FromMilliseconds(500)); } // 500ms == 500000us
diff --git a/third_party/WebKit/Source/platform/LongTaskDetectorTest.cpp b/third_party/WebKit/Source/platform/LongTaskDetectorTest.cpp index d384034..4cd653c9 100644 --- a/third_party/WebKit/Source/platform/LongTaskDetectorTest.cpp +++ b/third_party/WebKit/Source/platform/LongTaskDetectorTest.cpp
@@ -36,9 +36,9 @@ public: // Public because it's executed on a task queue. void DummyTaskWithDuration(double duration_seconds) { - dummy_task_start_time_ = MonotonicallyIncreasingTime(); + dummy_task_start_time_ = CurrentTimeTicksInSeconds(); platform_->AdvanceClockSeconds(duration_seconds); - dummy_task_end_time_ = MonotonicallyIncreasingTime(); + dummy_task_end_time_ = CurrentTimeTicksInSeconds(); } protected:
diff --git a/third_party/WebKit/Source/platform/Timer.cpp b/third_party/WebKit/Source/platform/Timer.cpp index 1a74be8..4aaacd2 100644 --- a/third_party/WebKit/Source/platform/Timer.cpp +++ b/third_party/WebKit/Source/platform/Timer.cpp
@@ -46,7 +46,6 @@ thread_(CurrentThread()), #endif weak_ptr_factory_(this) { - DCHECK(web_task_runner_); } TimerBase::~TimerBase() { @@ -62,7 +61,7 @@ location_ = caller; repeat_interval_ = repeat_interval; - SetNextFireTime(TimerMonotonicallyIncreasingTime(), next_fire_interval); + SetNextFireTime(TimerCurrentTimeTicksInSeconds(), next_fire_interval); } void TimerBase::Stop() { @@ -77,7 +76,7 @@ TimeDelta TimerBase::NextFireIntervalDelta() const { DCHECK(IsActive()); - TimeTicks current = TimerMonotonicallyIncreasingTime(); + TimeTicks current = TimerCurrentTimeTicksInSeconds(); if (next_fire_time_ < current) return TimeDelta(); return next_fire_time_ - current; @@ -100,7 +99,7 @@ if (!active) return; - TimeTicks now = TimerMonotonicallyIncreasingTime(); + TimeTicks now = TimerCurrentTimeTicksInSeconds(); TimeTicks next_fire_time = std::max(next_fire_time_, now); next_fire_time_ = TimeTicks(); @@ -151,7 +150,7 @@ #endif if (!repeat_interval_.is_zero()) { - TimeTicks now = TimerMonotonicallyIncreasingTime(); + TimeTicks now = TimerCurrentTimeTicksInSeconds(); // This computation should be drift free, and it will cope if we miss a // beat, which can easily happen if the thread is busy. It will also cope // if we get called slightly before m_unalignedNextFireTime, which can @@ -171,7 +170,7 @@ } // static -TimeTicks TimerBase::TimerMonotonicallyIncreasingTime() const { +TimeTicks TimerBase::TimerCurrentTimeTicksInSeconds() const { return TimeTicks::FromSeconds( TimerTaskRunner()->MonotonicallyIncreasingVirtualTimeSeconds()); }
diff --git a/third_party/WebKit/Source/platform/Timer.h b/third_party/WebKit/Source/platform/Timer.h index 85204772..04c0d941 100644 --- a/third_party/WebKit/Source/platform/Timer.h +++ b/third_party/WebKit/Source/platform/Timer.h
@@ -86,7 +86,7 @@ double RepeatInterval() const { return RepeatIntervalDelta().InSecondsF(); } void AugmentRepeatInterval(TimeDelta delta) { - TimeTicks now = TimerMonotonicallyIncreasingTime(); + TimeTicks now = TimerCurrentTimeTicksInSeconds(); SetNextFireTime(now, std::max(next_fire_time_ - now + delta, TimeDelta())); repeat_interval_ += delta; } @@ -111,7 +111,7 @@ NO_SANITIZE_ADDRESS virtual bool CanFire() const { return true; } - TimeTicks TimerMonotonicallyIncreasingTime() const; + TimeTicks TimerCurrentTimeTicksInSeconds() const; void SetNextFireTime(TimeTicks now, TimeDelta delay);
diff --git a/third_party/WebKit/Source/platform/TimerTest.cpp b/third_party/WebKit/Source/platform/TimerTest.cpp index 3ea92a4..679f22e 100644 --- a/third_party/WebKit/Source/platform/TimerTest.cpp +++ b/third_party/WebKit/Source/platform/TimerTest.cpp
@@ -32,20 +32,20 @@ void SetUp() override { run_times_.clear(); platform_->AdvanceClockSeconds(10.0); - start_time_ = MonotonicallyIncreasingTime(); + start_time_ = CurrentTimeTicksInSeconds(); } void CountingTask(TimerBase*) { - run_times_.push_back(MonotonicallyIncreasingTime()); + run_times_.push_back(CurrentTimeTicksInSeconds()); } void RecordNextFireTimeTask(TimerBase* timer) { - next_fire_times_.push_back(MonotonicallyIncreasingTime() + + next_fire_times_.push_back(CurrentTimeTicksInSeconds() + timer->NextFireInterval()); } void RunUntilDeadline(double deadline) { - double period = deadline - MonotonicallyIncreasingTime(); + double period = deadline - CurrentTimeTicksInSeconds(); EXPECT_GE(period, 0.0); platform_->RunForPeriodSeconds(period); } @@ -228,7 +228,7 @@ platform_->RunUntilIdle(); EXPECT_FALSE(run_times_.size()); - double second_post_time = MonotonicallyIncreasingTime(); + double second_post_time = CurrentTimeTicksInSeconds(); timer.StartOneShot(TimeDelta::FromSeconds(10), BLINK_FROM_HERE); EXPECT_TRUE(TimeTillNextDelayedTask(&run_time)); @@ -495,7 +495,7 @@ // Simulate timer firing early. Next scheduled task to run at // m_startTime + 4.0 platform_->AdvanceClockSeconds(1.9); - RunUntilDeadline(MonotonicallyIncreasingTime() + 0.2); + RunUntilDeadline(CurrentTimeTicksInSeconds() + 0.2); // Next scheduled task to run at m_startTime + 6.0 platform_->RunForPeriodSeconds(2.0); @@ -647,7 +647,7 @@ TimerForTest<TimerTest> timer(web_task_runner1, this, &TimerTest::CountingTask); - double start_time = MonotonicallyIncreasingTime(); + double start_time = CurrentTimeTicksInSeconds(); timer.StartOneShot(TimeDelta::FromSeconds(1), BLINK_FROM_HERE); @@ -687,7 +687,7 @@ TimerForTest<TimerTest> timer(web_task_runner1, this, &TimerTest::CountingTask); - double start_time = MonotonicallyIncreasingTime(); + double start_time = CurrentTimeTicksInSeconds(); timer.StartRepeating(TimeDelta::FromSeconds(1), BLINK_FROM_HERE);
diff --git a/third_party/WebKit/Source/platform/bindings/ScriptWrappableVisitor.cpp b/third_party/WebKit/Source/platform/bindings/ScriptWrappableVisitor.cpp index ee6d77d3c..1229c5e7 100644 --- a/third_party/WebKit/Source/platform/bindings/ScriptWrappableVisitor.cpp +++ b/third_party/WebKit/Source/platform/bindings/ScriptWrappableVisitor.cpp
@@ -121,7 +121,7 @@ TRACE_EVENT1("blink_gc,devtools.timeline", "ScriptWrappableVisitor::performLazyCleanup", "idleDeltaInSeconds", - deadline_seconds - MonotonicallyIncreasingTime()); + deadline_seconds - CurrentTimeTicksInSeconds()); const int kDeadlineCheckInterval = 2500; int processed_wrapper_count = 0; @@ -139,7 +139,7 @@ processed_wrapper_count++; if (processed_wrapper_count % kDeadlineCheckInterval == 0) { - if (deadline_seconds <= MonotonicallyIncreasingTime()) { + if (deadline_seconds <= CurrentTimeTicksInSeconds()) { ScheduleIdleLazyCleanup(); return; } @@ -197,7 +197,7 @@ WTF::AutoReset<bool>(&advancing_tracing_, true); while (actions.force_completion == v8::EmbedderHeapTracer::ForceCompletionAction::FORCE_COMPLETION || - WTF::MonotonicallyIncreasingTimeMS() < deadline_in_ms) { + WTF::CurrentTimeTicksInMilliseconds() < deadline_in_ms) { if (marking_deque_.IsEmpty()) { return false; }
diff --git a/third_party/WebKit/Source/platform/bindings/V8PerIsolateData.cpp b/third_party/WebKit/Source/platform/bindings/V8PerIsolateData.cpp index d3344cf..58e59e1 100644 --- a/third_party/WebKit/Source/platform/bindings/V8PerIsolateData.cpp +++ b/third_party/WebKit/Source/platform/bindings/V8PerIsolateData.cpp
@@ -62,10 +62,14 @@ WebTaskRunner* task_runner, V8ContextSnapshotMode v8_context_snapshot_mode) : v8_context_snapshot_mode_(v8_context_snapshot_mode), - isolate_holder_(task_runner, - gin::IsolateHolder::kSingleThread, - IsMainThread() ? gin::IsolateHolder::kDisallowAtomicsWait - : gin::IsolateHolder::kAllowAtomicsWait), + isolate_holder_( + task_runner, + gin::IsolateHolder::kSingleThread, + IsMainThread() ? gin::IsolateHolder::kDisallowAtomicsWait + : gin::IsolateHolder::kAllowAtomicsWait, + v8_context_snapshot_mode_ == V8ContextSnapshotMode::kUseSnapshot + ? &startup_data_ + : nullptr), interface_template_map_for_v8_context_snapshot_(GetIsolate()), string_cache_(WTF::WrapUnique(new StringCache(GetIsolate()))), private_property_(V8PrivateProperty::Create()), @@ -74,6 +78,13 @@ is_handling_recursion_level_error_(false), is_reporting_exception_(false), runtime_call_stats_(base::DefaultTickClock::GetInstance()) { + // If it fails to load the snapshot file, falls back to kDontUseSnapshot mode. + // TODO(peria): Remove this fallback routine. + if (v8_context_snapshot_mode_ == V8ContextSnapshotMode::kUseSnapshot && + !startup_data_.data) { + v8_context_snapshot_mode_ = V8ContextSnapshotMode::kDontUseSnapshot; + } + // FIXME: Remove once all v8::Isolate::GetCurrent() calls are gone. GetIsolate()->Enter(); GetIsolate()->AddBeforeCallEnteredCallback(&BeforeCallEnteredCallback);
diff --git a/third_party/WebKit/Source/platform/exported/WebClipboardImpl.cpp b/third_party/WebKit/Source/platform/exported/WebClipboardImpl.cpp index b7af57c..7532f73 100644 --- a/third_party/WebKit/Source/platform/exported/WebClipboardImpl.cpp +++ b/third_party/WebKit/Source/platform/exported/WebClipboardImpl.cpp
@@ -37,7 +37,7 @@ for (size_t i = 0; i < item_list.size(); ++i) { const WebDragData::Item& item = item_list[i]; if (item.storage_type == WebDragData::Item::kStorageTypeString) { - if (item.string_type == blink::kMimeTypeText) { + if (item.string_type == blink::kMimeTypeTextPlain) { result.text = item.string_data; } else if (item.string_type == blink::kMimeTypeTextHTML) { result.html = item.string_data; @@ -69,6 +69,14 @@ } #endif +String EnsureNotNullWTFString(const WebString& string) { + String result = string; + if (result.IsNull()) { + return g_empty_string16_bit; + } + return result; +} + } // namespace WebClipboardImpl::WebClipboardImpl() { @@ -160,7 +168,7 @@ return WebString(); WTF::String data; - clipboard_->ReadCustomData(buffer, type, &data); + clipboard_->ReadCustomData(buffer, EnsureNotNullWTFString(type), &data); return data; } @@ -192,7 +200,7 @@ if (url.IsValid() && !url.IsEmpty()) { clipboard_->WriteBookmark(mojom::ClipboardBuffer::kStandard, - url.GetString(), title); + url.GetString(), EnsureNotNullWTFString(title)); #if !defined(OS_MACOSX) // When writing the image, we also write the image markup so that pasting // into rich text editors, such as Gmail, reveals the image. We also don't
diff --git a/third_party/WebKit/Source/platform/exported/WebHTTPBody.cpp b/third_party/WebKit/Source/platform/exported/WebHTTPBody.cpp index a2cb5a2..cb84d912 100644 --- a/third_party/WebKit/Source/platform/exported/WebHTTPBody.cpp +++ b/third_party/WebKit/Source/platform/exported/WebHTTPBody.cpp
@@ -30,10 +30,12 @@ #include "public/platform/WebHTTPBody.h" +#include "mojo/public/cpp/system/data_pipe.h" #include "platform/FileMetadata.h" #include "platform/SharedBuffer.h" #include "platform/network/EncodedFormData.h" #include "platform/network/FormDataEncoder.h" +#include "services/network/public/interfaces/data_pipe_getter.mojom-blink.h" namespace blink { @@ -85,9 +87,13 @@ result.type = Element::kTypeBlob; result.blob_uuid = element.blob_uuid_; break; - default: - NOTREACHED(); - return false; + case FormDataElement::kDataPipe: + result.type = Element::kTypeDataPipe; + network::mojom::blink::DataPipeGetterPtr data_pipe_getter; + (*element.data_pipe_getter_->GetPtr()) + ->Clone(mojo::MakeRequest(&data_pipe_getter)); + result.data_pipe_getter = data_pipe_getter.PassInterface().PassHandle(); + break; } return true; @@ -123,6 +129,19 @@ private_->AppendBlob(uuid, nullptr); } +void WebHTTPBody::AppendDataPipe(mojo::ScopedMessagePipeHandle message_pipe) { + EnsureMutable(); + + // Convert the raw message pipe to network::mojom::blink::DataPipeGetter. + network::mojom::blink::DataPipeGetterPtr data_pipe_getter; + data_pipe_getter.Bind(network::mojom::blink::DataPipeGetterPtrInfo( + std::move(message_pipe), 0u)); + + auto wrapped = + base::MakeRefCounted<WrappedDataPipeGetter>(std::move(data_pipe_getter)); + private_->AppendDataPipe(std::move(wrapped)); +} + long long WebHTTPBody::Identifier() const { DCHECK(!IsNull()); return private_->Identifier();
diff --git a/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.cpp b/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.cpp index 1957834..955ed8e 100644 --- a/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.cpp +++ b/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.cpp
@@ -156,11 +156,12 @@ // TODO(junov) : could reduce overhead by using kOrderingBarrier when we know // that the source and destination context or on the same stream. - EnsureMailbox(kUnverifiedSyncToken); + EnsureMailbox(kUnverifiedSyncToken, GL_NEAREST); // Get a texture id that |destProvider| knows about and copy from it. gpu::gles2::GLES2Interface* dest_gl = dest_provider->ContextGL(); - dest_gl->WaitSyncTokenCHROMIUM(texture_holder_->GetSyncToken().GetData()); + dest_gl->WaitSyncTokenCHROMIUM( + texture_holder_->GetSyncToken().GetConstData()); GLuint source_texture_id = dest_gl->CreateAndConsumeTextureCHROMIUM( texture_holder_->GetMailbox().name); dest_gl->CopySubTextureCHROMIUM( @@ -232,7 +233,8 @@ WTF::WrapUnique(new SkiaTextureHolder(std::move(texture_holder_))); } -void AcceleratedStaticBitmapImage::EnsureMailbox(MailboxSyncMode mode) { +void AcceleratedStaticBitmapImage::EnsureMailbox(MailboxSyncMode mode, + GLenum filter) { if (!texture_holder_->IsMailboxTextureHolder()) { if (!original_skia_image_) { // To ensure that the texture resource stays alive we only really need @@ -241,15 +243,15 @@ RetainOriginalSkImageForCopyOnWrite(); } - texture_holder_ = - WTF::WrapUnique(new MailboxTextureHolder(std::move(texture_holder_))); + texture_holder_ = WTF::WrapUnique( + new MailboxTextureHolder(std::move(texture_holder_), filter)); } texture_holder_->Sync(mode); } void AcceleratedStaticBitmapImage::Transfer() { CheckThread(); - EnsureMailbox(kUnverifiedSyncToken); + EnsureMailbox(kUnverifiedSyncToken, GL_NEAREST); detach_thread_at_next_check_ = true; }
diff --git a/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.h b/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.h index 629ffaa0..3f3b035 100644 --- a/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.h +++ b/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.h
@@ -74,10 +74,12 @@ // To be called on sender thread before performing a transfer void Transfer() final; - void EnsureMailbox(MailboxSyncMode) final; + void EnsureMailbox(MailboxSyncMode, GLenum filter) final; - gpu::Mailbox GetMailbox() final { return texture_holder_->GetMailbox(); } - gpu::SyncToken GetSyncToken() final { + const gpu::Mailbox& GetMailbox() const final { + return texture_holder_->GetMailbox(); + } + const gpu::SyncToken& GetSyncToken() const final { return texture_holder_->GetSyncToken(); } void UpdateSyncToken(gpu::SyncToken) final;
diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp index 63b7772..3c1c7db 100644 --- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp +++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
@@ -653,11 +653,13 @@ FlushRecording(); scoped_refptr<CanvasResource> frame = resource_provider_->ProduceFrame(); - if (frame) { + if (frame && frame->IsValid()) { // Note frame is kept alive via a reference kept in out_release_callback. - frame->PrepareTransferableResource(out_resource, out_release_callback); - out_resource->color_space = color_params_.GetSamplerGfxColorSpace(); - return true; + bool success = + frame->PrepareTransferableResource(out_resource, out_release_callback); + if (success) + out_resource->color_space = color_params_.GetSamplerGfxColorSpace(); + return success; } return false; }
diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp index a82ce4d..dbe49dd 100644 --- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp
@@ -108,6 +108,10 @@ MOCK_METHOD1(DestroyImageCHROMIUM, void(GLuint)); MOCK_METHOD2(GenTextures, void(GLsizei, GLuint*)); MOCK_METHOD2(DeleteTextures, void(GLsizei, const GLuint*)); + // Fake + void GenMailboxCHROMIUM(GLbyte* name) { + name[0] = 1; // Make non-zero mailbox names + } }; class FakePlatformSupport : public TestingPlatformSupport { @@ -1103,7 +1107,6 @@ EXPECT_CALL(gl_, GenTextures(1, _)).WillOnce(SetArgPointee<1>(texture_id1)); EXPECT_CALL(gl_, CreateImageCHROMIUM(_, _, _, _)).WillOnce(Return(image_id1)); DrawSomething(bridge); - bridge->FinalizeFrame(); bridge->PrepareTransferableResource(&resource1, &release_callback1); ::testing::Mock::VerifyAndClearExpectations(&gl_); @@ -1111,7 +1114,6 @@ EXPECT_CALL(gl_, GenTextures(1, _)).WillOnce(SetArgPointee<1>(texture_id2)); EXPECT_CALL(gl_, CreateImageCHROMIUM(_, _, _, _)).WillOnce(Return(image_id2)); DrawSomething(bridge); - bridge->FinalizeFrame(); bridge->PrepareTransferableResource(&resource2, &release_callback2); ::testing::Mock::VerifyAndClearExpectations(&gl_); @@ -1169,7 +1171,6 @@ EXPECT_CALL(gl_, GenTextures(1, _)).WillOnce(SetArgPointee<1>(texture_id1)); EXPECT_CALL(gl_, CreateImageCHROMIUM(_, _, _, _)).WillOnce(Return(image_id1)); DrawSomething(bridge); - bridge->FinalizeFrame(); bridge->PrepareTransferableResource(&resource1, &release_callback1); ::testing::Mock::VerifyAndClearExpectations(&gl_); @@ -1177,7 +1178,6 @@ EXPECT_CALL(gl_, GenTextures(1, _)).WillOnce(SetArgPointee<1>(texture_id2)); EXPECT_CALL(gl_, CreateImageCHROMIUM(_, _, _, _)).WillOnce(Return(image_id2)); DrawSomething(bridge); - bridge->FinalizeFrame(); bridge->PrepareTransferableResource(&resource2, &release_callback2); ::testing::Mock::VerifyAndClearExpectations(&gl_); @@ -1230,7 +1230,6 @@ EXPECT_CALL(gl_, GenTextures(1, _)).WillOnce(SetArgPointee<1>(texture_id)); EXPECT_CALL(gl_, CreateImageCHROMIUM(_, _, _, _)).WillOnce(Return(image_id)); DrawSomething(bridge); - bridge->FinalizeFrame(); bridge->PrepareTransferableResource(&resource, &release_callback); ::testing::Mock::VerifyAndClearExpectations(&gl_);
diff --git a/third_party/WebKit/Source/platform/graphics/CanvasResource.cpp b/third_party/WebKit/Source/platform/graphics/CanvasResource.cpp index 2c7d34b..fabae61a 100644 --- a/third_party/WebKit/Source/platform/graphics/CanvasResource.cpp +++ b/third_party/WebKit/Source/platform/graphics/CanvasResource.cpp
@@ -9,6 +9,7 @@ #include "gpu/GLES2/gl2extchromium.h" #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" #include "platform/graphics/CanvasResourceProvider.h" +#include "platform/graphics/StaticBitmapImage.h" #include "platform/graphics/gpu/SharedGpuContext.h" #include "public/platform/Platform.h" #include "skia/ext/texture_handle.h" @@ -17,13 +18,9 @@ namespace blink { -CanvasResource::CanvasResource( - base::WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper, - base::WeakPtr<CanvasResourceProvider> provider, - SkFilterQuality filter_quality) - : context_provider_wrapper_(std::move(context_provider_wrapper)), - provider_(std::move(provider)), - filter_quality_(filter_quality) {} +CanvasResource::CanvasResource(base::WeakPtr<CanvasResourceProvider> provider, + SkFilterQuality filter_quality) + : provider_(std::move(provider)), filter_quality_(filter_quality) {} CanvasResource::~CanvasResource() { // Sync token should have been waited on in sub-class implementation of @@ -32,24 +29,9 @@ } gpu::gles2::GLES2Interface* CanvasResource::ContextGL() const { - if (!context_provider_wrapper_) + if (!ContextProviderWrapper()) return nullptr; - return context_provider_wrapper_->ContextProvider()->ContextGL(); -} - -const gpu::Mailbox& CanvasResource::GetOrCreateGpuMailbox() { - if (gpu_mailbox_.IsZero()) { - auto gl = ContextGL(); - DCHECK(gl); // caller should already have early exited if !gl. - if (gl) { - gl->GenMailboxCHROMIUM(gpu_mailbox_.name); - } - } - return gpu_mailbox_; -} - -bool CanvasResource::HasGpuMailbox() const { - return !gpu_mailbox_.IsZero(); + return ContextProviderWrapper()->ContextProvider()->ContextGL(); } void CanvasResource::SetSyncTokenForRelease(const gpu::SyncToken& token) { @@ -78,11 +60,12 @@ } } -void CanvasResource::PrepareTransferableResource( +bool CanvasResource::PrepareTransferableResource( viz::TransferableResource* out_resource, std::unique_ptr<viz::SingleReleaseCallback>* out_callback) { + DCHECK(IsValid()); + // This should never be called on unaccelerated canvases (for now). - DCHECK(TextureId()); // Gpu compositing is a prerequisite for accelerated 2D canvas // TODO: For WebGL to use this, we must add software composing support. @@ -90,115 +73,101 @@ auto gl = ContextGL(); DCHECK(gl); - GLuint filter = - filter_quality_ == kNone_SkFilterQuality ? GL_NEAREST : GL_LINEAR; - GLenum target = TextureTarget(); - GLint texture_id = TextureId(); - - gl->BindTexture(target, texture_id); - gl->TexParameteri(target, GL_TEXTURE_MAG_FILTER, filter); - gl->TexParameteri(target, GL_TEXTURE_MIN_FILTER, filter); - gl->TexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - gl->TexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - - gl->ProduceTextureDirectCHROMIUM(texture_id, GetOrCreateGpuMailbox().name); - const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM(); - gl->ShallowFlushCHROMIUM(); - gpu::SyncToken sync_token; - gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); + const gpu::Mailbox& mailbox = GetOrCreateGpuMailbox(); + if (mailbox.IsZero()) + return false; *out_resource = viz::TransferableResource::MakeGLOverlay( - GetOrCreateGpuMailbox(), filter, target, sync_token, gfx::Size(Size()), + mailbox, GLFilter(), TextureTarget(), GetSyncToken(), gfx::Size(Size()), IsOverlayCandidate()); - gl->BindTexture(target, 0); - - // Because we are changing the texture binding without going through skia, - // we must dirty the context. - GrContext* gr = GetGrContext(); - if (gr) - gr->resetContext(kTextureBinding_GrGLBackendState); - scoped_refptr<CanvasResource> this_ref(this); auto func = WTF::Bind(&ReleaseFrameResources, provider_, WTF::Passed(std::move(this_ref))); *out_callback = viz::SingleReleaseCallback::Create(std::move(func)); + return true; } GrContext* CanvasResource::GetGrContext() const { - if (!context_provider_wrapper_) + if (!ContextProviderWrapper()) return nullptr; - return context_provider_wrapper_->ContextProvider()->GetGrContext(); + return ContextProviderWrapper()->ContextProvider()->GetGrContext(); } -// CanvasResource_Skia +GLenum CanvasResource::GLFilter() const { + return filter_quality_ == kNone_SkFilterQuality ? GL_NEAREST : GL_LINEAR; +} + +// CanvasResource_Bitmap //============================================================================== -CanvasResource_Skia::CanvasResource_Skia( - sk_sp<SkImage> image, - base::WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper, +CanvasResource_Bitmap::CanvasResource_Bitmap( + scoped_refptr<StaticBitmapImage> image, base::WeakPtr<CanvasResourceProvider> provider, SkFilterQuality filter_quality) - : CanvasResource(std::move(context_provider_wrapper), - std::move(provider), - filter_quality), + : CanvasResource(std::move(provider), filter_quality), image_(std::move(image)) {} -scoped_refptr<CanvasResource_Skia> CanvasResource_Skia::Create( - sk_sp<SkImage> image, - base::WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper, +scoped_refptr<CanvasResource_Bitmap> CanvasResource_Bitmap::Create( + scoped_refptr<StaticBitmapImage> image, base::WeakPtr<CanvasResourceProvider> provider, SkFilterQuality filter_quality) { - scoped_refptr<CanvasResource_Skia> resource = - AdoptRef(new CanvasResource_Skia(std::move(image), - std::move(context_provider_wrapper), - std::move(provider), filter_quality)); + scoped_refptr<CanvasResource_Bitmap> resource = + AdoptRef(new CanvasResource_Bitmap(std::move(image), std::move(provider), + filter_quality)); if (resource->IsValid()) return resource; return nullptr; } -bool CanvasResource_Skia::IsValid() const { +bool CanvasResource_Bitmap::IsValid() const { if (!image_) return false; - if (!image_->isTextureBacked()) - return true; - return !!context_provider_wrapper_; + return image_->IsValid(); } -void CanvasResource_Skia::TearDown() { +void CanvasResource_Bitmap::TearDown() { WaitSyncTokenBeforeRelease(); auto gl = ContextGL(); if (gl && HasGpuMailbox()) { - DCHECK(image_->isTextureBacked()); + DCHECK(image_->IsTextureBacked()); // To avoid leaking Mailbox records, we must disassociate the mailbox // before image_ goes out of scope because skia might recycle the texture. - gl->ProduceTextureDirectCHROMIUM(0, GpuMailbox().name); + gl->ProduceTextureDirectCHROMIUM(0, GetOrCreateGpuMailbox().name); } image_ = nullptr; - context_provider_wrapper_ = nullptr; } -IntSize CanvasResource_Skia::Size() const { +IntSize CanvasResource_Bitmap::Size() const { + if (!image_) + return IntSize(0, 0); return IntSize(image_->width(), image_->height()); } -GLuint CanvasResource_Skia::TextureId() const { - DCHECK(image_->isTextureBacked()); - return skia::GrBackendObjectToGrGLTextureInfo(image_->getTextureHandle(true)) - ->fID; -} - -GLenum CanvasResource_Skia::TextureTarget() const { +GLenum CanvasResource_Bitmap::TextureTarget() const { return GL_TEXTURE_2D; } -void CanvasResource_Skia::PrepareTransferableResource( - viz::TransferableResource* out_resource, - std::unique_ptr<viz::SingleReleaseCallback>* out_callback) { - DCHECK(image_->isTextureBacked()); - CanvasResource::PrepareTransferableResource(out_resource, out_callback); - image_->getTexture()->textureParamsModified(); +const gpu::Mailbox& CanvasResource_Bitmap::GetOrCreateGpuMailbox() { + DCHECK(image_); // Calling code should check IsValid() before calling this. + image_->EnsureMailbox(kUnverifiedSyncToken, GLFilter()); + return image_->GetMailbox(); +} + +bool CanvasResource_Bitmap::HasGpuMailbox() const { + return image_ && image_->HasMailbox(); +} + +const gpu::SyncToken& CanvasResource_Bitmap::GetSyncToken() const { + DCHECK(image_); // Calling code should check IsValid() before calling this. + return image_->GetSyncToken(); +} + +base::WeakPtr<WebGraphicsContext3DProviderWrapper> +CanvasResource_Bitmap::ContextProviderWrapper() const { + if (!image_) + return nullptr; + return image_->ContextProviderWrapper(); } // CanvasResource_GpuMemoryBuffer @@ -210,9 +179,8 @@ base::WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper, base::WeakPtr<CanvasResourceProvider> provider, SkFilterQuality filter_quality) - : CanvasResource(std::move(context_provider_wrapper), - provider, - filter_quality), + : CanvasResource(provider, filter_quality), + context_provider_wrapper_(std::move(context_provider_wrapper)), color_params_(color_params) { if (!context_provider_wrapper_) return; @@ -268,9 +236,9 @@ base::WeakPtr<CanvasResourceProvider> provider, SkFilterQuality filter_quality) { scoped_refptr<CanvasResource_GpuMemoryBuffer> resource = - AdoptRef(new CanvasResource_GpuMemoryBuffer(size, color_params, - context_provider_wrapper, - provider, filter_quality)); + AdoptRef(new CanvasResource_GpuMemoryBuffer( + size, color_params, std::move(context_provider_wrapper), provider, + filter_quality)); if (resource->IsValid()) return resource; return nullptr; @@ -283,7 +251,7 @@ auto gl = context_provider_wrapper_->ContextProvider()->ContextGL(); auto gr = context_provider_wrapper_->ContextProvider()->GetGrContext(); if (gl && texture_id_) { - GLenum target = GL_TEXTURE_RECTANGLE_ARB; + GLenum target = TextureTarget(); gl->BindTexture(target, texture_id_); gl->ReleaseTexImage2DCHROMIUM(target, image_id_); gl->DestroyImageCHROMIUM(image_id_); @@ -298,4 +266,42 @@ gpu_memory_buffer_ = nullptr; } +const gpu::Mailbox& CanvasResource_GpuMemoryBuffer::GetOrCreateGpuMailbox() { + auto gl = ContextGL(); + DCHECK(gl); // caller should already have early exited if !gl. + if (gpu_mailbox_.IsZero() && gl) { + gl->GenMailboxCHROMIUM(gpu_mailbox_.name); + gl->ProduceTextureDirectCHROMIUM(texture_id_, gpu_mailbox_.name); + const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM(); + gl->ShallowFlushCHROMIUM(); + gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token_.GetData()); + } + return gpu_mailbox_; +} + +bool CanvasResource_GpuMemoryBuffer::HasGpuMailbox() const { + return !gpu_mailbox_.IsZero(); +} + +const gpu::SyncToken& CanvasResource_GpuMemoryBuffer::GetSyncToken() const { + return sync_token_; +} + +void CanvasResource_GpuMemoryBuffer::CopyFromTexture(GLuint source_texture, + GLenum format, + GLenum type) { + if (!IsValid()) + return; + + ContextGL()->CopyTextureCHROMIUM( + source_texture, 0 /*sourceLevel*/, TextureTarget(), texture_id_, + 0 /*destLevel*/, format, type, false /*unpackFlipY*/, + false /*unpackPremultiplyAlpha*/, false /*unpackUnmultiplyAlpha*/); +} + +base::WeakPtr<WebGraphicsContext3DProviderWrapper> +CanvasResource_GpuMemoryBuffer::ContextProviderWrapper() const { + return context_provider_wrapper_; +} + } // namespace blink
diff --git a/third_party/WebKit/Source/platform/graphics/CanvasResource.h b/third_party/WebKit/Source/platform/graphics/CanvasResource.h index ba8a8a5..64963f7 100644 --- a/third_party/WebKit/Source/platform/graphics/CanvasResource.h +++ b/third_party/WebKit/Source/platform/graphics/CanvasResource.h
@@ -30,6 +30,7 @@ namespace blink { class CanvasResourceProvider; +class StaticBitmapImage; // Generic resource interface, used for locking (RAII) and recycling pixel // buffers of any type. @@ -39,65 +40,71 @@ virtual void Abandon() = 0; virtual bool IsRecycleable() const = 0; virtual bool IsValid() const = 0; - virtual GLuint TextureId() const = 0; virtual IntSize Size() const = 0; - virtual void PrepareTransferableResource( + virtual const gpu::Mailbox& GetOrCreateGpuMailbox() = 0; + bool PrepareTransferableResource( viz::TransferableResource* out_resource, std::unique_ptr<viz::SingleReleaseCallback>* out_callback); - const gpu::Mailbox& GpuMailbox() { return gpu_mailbox_; } - const gpu::Mailbox& GetOrCreateGpuMailbox(); - bool HasGpuMailbox() const; void SetSyncTokenForRelease(const gpu::SyncToken&); void WaitSyncTokenBeforeRelease(); + virtual void CopyFromTexture(GLuint source_texture, + GLenum format, + GLenum type) { + NOTREACHED(); + } protected: - CanvasResource(base::WeakPtr<WebGraphicsContext3DProviderWrapper>, - base::WeakPtr<CanvasResourceProvider>, - SkFilterQuality); + CanvasResource(base::WeakPtr<CanvasResourceProvider>, SkFilterQuality); virtual GLenum TextureTarget() const = 0; virtual bool IsOverlayCandidate() const { return false; } + virtual const gpu::SyncToken& GetSyncToken() const = 0; + virtual bool HasGpuMailbox() const = 0; gpu::gles2::GLES2Interface* ContextGL() const; + GLenum GLFilter() const; GrContext* GetGrContext() const; + virtual base::WeakPtr<WebGraphicsContext3DProviderWrapper> + ContextProviderWrapper() const = 0; + void PrepareTransferableResourceCommon( + viz::TransferableResource* out_resource, + std::unique_ptr<viz::SingleReleaseCallback>* out_callback); - gpu::Mailbox gpu_mailbox_; + private: // Sync token that was provided when resource was released gpu::SyncToken sync_token_for_release_; - base::WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper_; base::WeakPtr<CanvasResourceProvider> provider_; SkFilterQuality filter_quality_; }; // Resource type for skia Bitmaps (RAM and texture backed) -class PLATFORM_EXPORT CanvasResource_Skia final : public CanvasResource { +class PLATFORM_EXPORT CanvasResource_Bitmap final : public CanvasResource { public: - static scoped_refptr<CanvasResource_Skia> Create( - sk_sp<SkImage>, - base::WeakPtr<WebGraphicsContext3DProviderWrapper>, + static scoped_refptr<CanvasResource_Bitmap> Create( + scoped_refptr<StaticBitmapImage>, base::WeakPtr<CanvasResourceProvider>, SkFilterQuality); - virtual ~CanvasResource_Skia() { Abandon(); } + virtual ~CanvasResource_Bitmap() { Abandon(); } // Not recyclable: Skia handles texture recycling internally and bitmaps are // cheap to allocate. bool IsRecycleable() const final { return false; } bool IsValid() const final; void Abandon() final { TearDown(); } - GLuint TextureId() const final; IntSize Size() const final; - void PrepareTransferableResource( - viz::TransferableResource* out_resource, - std::unique_ptr<viz::SingleReleaseCallback>* out_callback) final; private: void TearDown(); GLenum TextureTarget() const final; + base::WeakPtr<WebGraphicsContext3DProviderWrapper> ContextProviderWrapper() + const override; + const gpu::Mailbox& GetOrCreateGpuMailbox() override; + bool HasGpuMailbox() const override; + const gpu::SyncToken& GetSyncToken() const; - CanvasResource_Skia(sk_sp<SkImage>, - base::WeakPtr<WebGraphicsContext3DProviderWrapper>, - base::WeakPtr<CanvasResourceProvider>, - SkFilterQuality); + CanvasResource_Bitmap(scoped_refptr<StaticBitmapImage>, + base::WeakPtr<CanvasResourceProvider>, + SkFilterQuality); - sk_sp<SkImage> image_; + scoped_refptr<StaticBitmapImage> image_; }; // Resource type for GpuMemoryBuffers @@ -114,13 +121,20 @@ bool IsRecycleable() const final { return IsValid(); } bool IsValid() const { return context_provider_wrapper_ && image_id_; } void Abandon() final { TearDown(); } - GLuint TextureId() const final { return texture_id_; } IntSize Size() const final; private: void TearDown(); GLenum TextureTarget() const final; bool IsOverlayCandidate() const final { return true; } + const gpu::Mailbox& GetOrCreateGpuMailbox() override; + bool HasGpuMailbox() const override; + const gpu::SyncToken& GetSyncToken() const; + base::WeakPtr<WebGraphicsContext3DProviderWrapper> ContextProviderWrapper() + const override; + void CopyFromTexture(GLuint source_texture, + GLenum format, + GLenum type) override; CanvasResource_GpuMemoryBuffer( const IntSize&, @@ -129,6 +143,9 @@ base::WeakPtr<CanvasResourceProvider>, SkFilterQuality); + gpu::Mailbox gpu_mailbox_; + gpu::SyncToken sync_token_; + base::WeakPtr<WebGraphicsContext3DProviderWrapper> context_provider_wrapper_; std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer_; GLuint image_id_ = 0; GLuint texture_id_ = 0;
diff --git a/third_party/WebKit/Source/platform/graphics/CanvasResourceProvider.cpp b/third_party/WebKit/Source/platform/graphics/CanvasResourceProvider.cpp index 7012ba0a..87c9cbf 100644 --- a/third_party/WebKit/Source/platform/graphics/CanvasResourceProvider.cpp +++ b/third_party/WebKit/Source/platform/graphics/CanvasResourceProvider.cpp
@@ -63,13 +63,16 @@ SkSurface::kRetain_ContentChangeMode); } - sk_sp<SkImage> image = GetSkSurface()->makeImageSnapshot(); - if (!image) + sk_sp<SkImage> skia_image = GetSkSurface()->makeImageSnapshot(); + if (!skia_image) return nullptr; - DCHECK(image->isTextureBacked()); + DCHECK(skia_image->isTextureBacked()); - scoped_refptr<CanvasResource> resource = CanvasResource_Skia::Create( - image, ContextProviderWrapper(), CreateWeakPtr(), FilterQuality()); + scoped_refptr<StaticBitmapImage> image = + StaticBitmapImage::Create(skia_image, ContextProviderWrapper()); + + scoped_refptr<CanvasResource> resource = + CanvasResource_Bitmap::Create(image, CreateWeakPtr(), FilterQuality()); if (!resource) return nullptr; @@ -135,10 +138,6 @@ return CanvasResourceProvider_Texture::ProduceFrame(); } - auto gl = ContextGL(); - auto gr = GetGrContext(); - DCHECK(gl && gr); - sk_sp<SkImage> image = GetSkSurface()->makeImageSnapshot(); if (!image) return nullptr; @@ -148,14 +147,9 @@ skia::GrBackendObjectToGrGLTextureInfo(image->getTextureHandle(true)) ->fID; - GLenum target = GL_TEXTURE_RECTANGLE_ARB; - - gl->CopyTextureCHROMIUM(skia_texture_id, 0 /*sourceLevel*/, target, - output_resource->TextureId(), 0 /*destLevel*/, - ColorParams().GLInternalFormat(), - ColorParams().GLType(), false /*unpackFlipY*/, - false /*unpackPremultiplyAlpha*/, - false /*unpackUnmultiplyAlpha*/); + output_resource->CopyFromTexture(skia_texture_id, + ColorParams().GLInternalFormat(), + ColorParams().GLType()); return output_resource; }
diff --git a/third_party/WebKit/Source/platform/graphics/CanvasResourceTest.cpp b/third_party/WebKit/Source/platform/graphics/CanvasResourceTest.cpp index b596bc0d..adffd0f 100644 --- a/third_party/WebKit/Source/platform/graphics/CanvasResourceTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/CanvasResourceTest.cpp
@@ -4,6 +4,7 @@ #include "platform/graphics/CanvasResource.h" +#include "platform/graphics/StaticBitmapImage.h" #include "platform/graphics/gpu/SharedGpuContext.h" #include "platform/graphics/test/FakeGLES2Interface.h" #include "platform/graphics/test/FakeWebGraphicsContext3DProvider.h" @@ -59,9 +60,10 @@ ::testing::Mock::VerifyAndClearExpectations(&gl_); EXPECT_TRUE(!!context_provider_wrapper_); - scoped_refptr<CanvasResource> resource = CanvasResource_Skia::Create( - surface->makeImageSnapshot(), context_provider_wrapper_, nullptr, - kLow_SkFilterQuality); + scoped_refptr<CanvasResource> resource = CanvasResource_Bitmap::Create( + StaticBitmapImage::Create(surface->makeImageSnapshot(), + context_provider_wrapper_), + nullptr, kLow_SkFilterQuality); ::testing::Mock::VerifyAndClearExpectations(&gl_);
diff --git a/third_party/WebKit/Source/platform/graphics/GpuMemoryBufferImageCopy.cpp b/third_party/WebKit/Source/platform/graphics/GpuMemoryBufferImageCopy.cpp index 5a492af..c1ac5011 100644 --- a/third_party/WebKit/Source/platform/graphics/GpuMemoryBufferImageCopy.cpp +++ b/third_party/WebKit/Source/platform/graphics/GpuMemoryBufferImageCopy.cpp
@@ -78,7 +78,7 @@ // Bind the read framebuffer to our image. StaticBitmapImage* static_image = static_cast<StaticBitmapImage*>(image); - static_image->EnsureMailbox(kOrderingBarrier); + static_image->EnsureMailbox(kOrderingBarrier, GL_NEAREST); auto mailbox = static_image->GetMailbox(); auto sync_token = static_image->GetSyncToken(); // Not strictly necessary since we are on the same context, but keeping
diff --git a/third_party/WebKit/Source/platform/graphics/MailboxTextureHolder.cpp b/third_party/WebKit/Source/platform/graphics/MailboxTextureHolder.cpp index 82aa9fab..f601bf7fb 100644 --- a/third_party/WebKit/Source/platform/graphics/MailboxTextureHolder.cpp +++ b/third_party/WebKit/Source/platform/graphics/MailboxTextureHolder.cpp
@@ -51,7 +51,8 @@ } MailboxTextureHolder::MailboxTextureHolder( - std::unique_ptr<TextureHolder> texture_holder) + std::unique_ptr<TextureHolder> texture_holder, + GLenum filter) : TextureHolder(texture_holder->ContextProviderWrapper()), texture_id_(0), is_converted_from_skia_texture_(true), @@ -64,7 +65,8 @@ if (!ContextProviderWrapper()) return; - ContextProviderWrapper()->Utils()->GetMailboxForSkImage(mailbox_, image); + ContextProviderWrapper()->Utils()->GetMailboxForSkImage(mailbox_, image, + filter); InitCommon(); }
diff --git a/third_party/WebKit/Source/platform/graphics/MailboxTextureHolder.h b/third_party/WebKit/Source/platform/graphics/MailboxTextureHolder.h index b42c2615..8319494 100644 --- a/third_party/WebKit/Source/platform/graphics/MailboxTextureHolder.h +++ b/third_party/WebKit/Source/platform/graphics/MailboxTextureHolder.h
@@ -25,8 +25,8 @@ bool CurrentFrameKnownToBeOpaque(Image::MetadataMode) final { return false; } bool IsValid() const final; - gpu::Mailbox GetMailbox() final { return mailbox_; } - gpu::SyncToken GetSyncToken() final { return sync_token_; } + const gpu::Mailbox& GetMailbox() const final { return mailbox_; } + const gpu::SyncToken& GetSyncToken() const final { return sync_token_; } void UpdateSyncToken(gpu::SyncToken sync_token) final { sync_token_ = sync_token; } @@ -42,7 +42,7 @@ IntSize mailbox_size); // This function turns a texture-backed SkImage into a mailbox and a // syncToken. - MailboxTextureHolder(std::unique_ptr<TextureHolder>); + MailboxTextureHolder(std::unique_ptr<TextureHolder>, GLenum filter); private: void InitCommon();
diff --git a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp index 9bbd5559..ad918e6a 100644 --- a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp +++ b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp
@@ -253,7 +253,7 @@ frame.render_pass_list.push_back(std::move(pass)); - double elapsed_time = WTF::MonotonicallyIncreasingTime() - commit_start_time; + double elapsed_time = WTF::CurrentTimeTicksInSeconds() - commit_start_time; switch (commit_type) { case kCommitGPUCanvasGPUCompositing:
diff --git a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasResourceProvider.cpp b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasResourceProvider.cpp index 57821c2..aec9057 100644 --- a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasResourceProvider.cpp +++ b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasResourceProvider.cpp
@@ -92,7 +92,7 @@ scoped_refptr<StaticBitmapImage> image) { DCHECK(image->IsTextureBacked()); DCHECK(image->IsValid()); - image->EnsureMailbox(kVerifiedSyncToken); + image->EnsureMailbox(kVerifiedSyncToken, GL_LINEAR); resource.mailbox_holder = gpu::MailboxHolder( image->GetMailbox(), image->GetSyncToken(), GL_TEXTURE_2D); resource.read_lock_fences_enabled = false;
diff --git a/third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp b/third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp index 8ce62bb..81c09912 100644 --- a/third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp +++ b/third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp
@@ -45,41 +45,14 @@ #include "platform/wtf/Time.h" #include "platform/wtf/text/Base64.h" #include "platform/wtf/text/TextEncoding.h" -#include "third_party/skia/include/core/SkData.h" #include "third_party/skia/include/core/SkImage.h" -#include "third_party/skia/include/core/SkImageDeserializer.h" #include "third_party/skia/include/core/SkPictureRecorder.h" -#include "third_party/skia/include/core/SkStream.h" namespace blink { PictureSnapshot::PictureSnapshot(sk_sp<const SkPicture> picture) : picture_(std::move(picture)) {} -class SkiaImageDecoder final : public SkImageDeserializer { - public: - sk_sp<SkImage> makeFromMemory(const void* data, - size_t length, - const SkIRect* subset) override { - // No need to copy the data; this decodes immediately. - scoped_refptr<SegmentReader> segment_reader = - SegmentReader::CreateFromSkData(SkData::MakeWithoutCopy(data, length)); - std::unique_ptr<ImageDecoder> image_decoder = ImageDecoder::Create( - std::move(segment_reader), true, ImageDecoder::kAlphaPremultiplied, - ColorBehavior::Ignore()); - if (!image_decoder) - return nullptr; - - ImageFrame* frame = image_decoder->DecodeFrameBufferAtIndex(0); - return (frame && !image_decoder->Failed()) - ? frame->FinalizePixelsAndGetImage() - : nullptr; - } - sk_sp<SkImage> makeFromData(SkData* data, const SkIRect* subset) override { - return this->makeFromMemory(data->data(), data->size(), subset); - } -}; - scoped_refptr<PictureSnapshot> PictureSnapshot::Load( const Vector<scoped_refptr<TilePictureStream>>& tiles) { DCHECK(!tiles.IsEmpty()); @@ -87,9 +60,8 @@ pictures.ReserveCapacity(tiles.size()); FloatRect union_rect; for (const auto& tile_stream : tiles) { - SkMemoryStream stream(tile_stream->data.begin(), tile_stream->data.size()); - SkiaImageDecoder factory; - sk_sp<SkPicture> picture = SkPicture::MakeFromStream(&stream, &factory); + sk_sp<SkPicture> picture = SkPicture::MakeFromData( + tile_stream->data.begin(), tile_stream->data.size()); if (!picture) return nullptr; FloatRect cull_rect(picture->cullRect()); @@ -176,7 +148,7 @@ SkImageInfo::MakeN32Premul(bounds.width(), bounds.height())); bitmap.eraseARGB(0, 0, 0, 0); - double now = WTF::MonotonicallyIncreasingTime(); + double now = WTF::CurrentTimeTicksInSeconds(); double stop_time = now + min_duration; for (unsigned step = 0; step < min_repeat_count || now < stop_time; ++step) { timings->push_back(Vector<double>()); @@ -192,7 +164,7 @@ } canvas.SetTimings(current_timings); picture_->playback(&canvas); - now = WTF::MonotonicallyIncreasingTime(); + now = WTF::CurrentTimeTicksInSeconds(); } return timings; }
diff --git a/third_party/WebKit/Source/platform/graphics/ProfilingCanvas.cpp b/third_party/WebKit/Source/platform/graphics/ProfilingCanvas.cpp index 8bb4f6b..0c78fa1 100644 --- a/third_party/WebKit/Source/platform/graphics/ProfilingCanvas.cpp +++ b/third_party/WebKit/Source/platform/graphics/ProfilingCanvas.cpp
@@ -37,12 +37,12 @@ CanvasInterceptor<ProfilingCanvas>::CanvasInterceptor( InterceptingCanvasBase* canvas) : CanvasInterceptorBase(canvas), - start_time_(WTF::MonotonicallyIncreasingTime()) {} + start_time_(WTF::CurrentTimeTicksInSeconds()) {} CanvasInterceptor<ProfilingCanvas>::~CanvasInterceptor() { if (!TopLevelCall()) return; - double delta = WTF::MonotonicallyIncreasingTime() - start_time_; + double delta = WTF::CurrentTimeTicksInSeconds() - start_time_; if (auto timings = Canvas()->timings_) { DCHECK_EQ(timings->size(), Canvas()->CallCount()); timings->push_back(delta);
diff --git a/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp b/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp index a985eb5..d43e33d 100644 --- a/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp +++ b/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp
@@ -152,8 +152,9 @@ return true; } -gpu::SyncToken StaticBitmapImage::GetSyncToken() { - return gpu::SyncToken(); +const gpu::SyncToken& StaticBitmapImage::GetSyncToken() const { + static const gpu::SyncToken sync_token; + return sync_token; } } // namespace blink
diff --git a/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.h b/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.h index 61486e5..8fa1a4c3 100644 --- a/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.h +++ b/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.h
@@ -61,6 +61,7 @@ virtual bool IsValid() const { return true; } virtual void Transfer() {} virtual void Abandon() {} + // Creates a non-gpu copy of the image, or returns this if image is already // non-gpu. virtual scoped_refptr<StaticBitmapImage> MakeUnaccelerated() { return this; } @@ -91,12 +92,13 @@ // Use kUnverifiedSyncToken // Case 3: Passing to a gpu context on the same stream. // Use kOrderingBarrier - virtual void EnsureMailbox(MailboxSyncMode) { NOTREACHED(); } - virtual gpu::Mailbox GetMailbox() { + virtual void EnsureMailbox(MailboxSyncMode, GLenum filter) { NOTREACHED(); } + virtual const gpu::Mailbox& GetMailbox() const { NOTREACHED(); - return gpu::Mailbox(); + static const gpu::Mailbox mailbox; + return mailbox; } - virtual gpu::SyncToken GetSyncToken(); + virtual const gpu::SyncToken& GetSyncToken() const; virtual void UpdateSyncToken(gpu::SyncToken) { NOTREACHED(); } virtual bool IsPremultiplied() const { return true; }
diff --git a/third_party/WebKit/Source/platform/graphics/TextureHolder.h b/third_party/WebKit/Source/platform/graphics/TextureHolder.h index 74a9c57..2c59031 100644 --- a/third_party/WebKit/Source/platform/graphics/TextureHolder.h +++ b/third_party/WebKit/Source/platform/graphics/TextureHolder.h
@@ -30,12 +30,14 @@ virtual bool IsValid() const = 0; // Methods overrided by MailboxTextureHolder - virtual gpu::Mailbox GetMailbox() { + virtual const gpu::Mailbox& GetMailbox() const { NOTREACHED(); - return gpu::Mailbox(); + static const gpu::Mailbox mailbox; + return mailbox; } - virtual gpu::SyncToken GetSyncToken() { - return gpu::SyncToken(); + virtual const gpu::SyncToken& GetSyncToken() const { + static const gpu::SyncToken sync_token; + return sync_token; } virtual void UpdateSyncToken(gpu::SyncToken) { NOTREACHED(); } virtual void Sync(MailboxSyncMode) { NOTREACHED(); }
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/GraphicsContext3DUtils.cpp b/third_party/WebKit/Source/platform/graphics/gpu/GraphicsContext3DUtils.cpp index 0de4ace..011b9296 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/GraphicsContext3DUtils.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/GraphicsContext3DUtils.cpp
@@ -35,7 +35,8 @@ namespace blink { void GraphicsContext3DUtils::GetMailboxForSkImage(gpu::Mailbox& out_mailbox, - const sk_sp<SkImage>& image) { + const sk_sp<SkImage>& image, + GLenum filter) { // This object is owned by context_provider_wrapper_, so that weak ref // should never be null. DCHECK(context_provider_wrapper_); @@ -65,7 +66,14 @@ GLuint texture_id = skia::GrBackendObjectToGrGLTextureInfo(image->getTextureHandle(true)) ->fID; + gl->BindTexture(GL_TEXTURE_2D, texture_id); + gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter); + gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter); + gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + gl->BindTexture(GL_TEXTURE_2D, 0); gl->ProduceTextureDirectCHROMIUM(texture_id, out_mailbox.name); + image->getTexture()->textureParamsModified(); // We changed bound textures in ProduceTextureDirectCHROMIUM, so reset the // GrContext.
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/GraphicsContext3DUtils.h b/third_party/WebKit/Source/platform/graphics/gpu/GraphicsContext3DUtils.h index 82d03d7..6e9b68b3 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/GraphicsContext3DUtils.h +++ b/third_party/WebKit/Source/platform/graphics/gpu/GraphicsContext3DUtils.h
@@ -13,6 +13,8 @@ #include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/gpu/GrTexture.h" +typedef unsigned int GLenum; + namespace blink { class WebGraphicsContext3DProviderWrapper; @@ -29,7 +31,9 @@ // mailbox for a given texture. The caching of pre-existing mailboxes survives // when the texture gets recycled by skia for creating a new SkSurface or // SkImage with a pre-existing GrTexture backing. - void GetMailboxForSkImage(gpu::Mailbox&, const sk_sp<SkImage>&); + void GetMailboxForSkImage(gpu::Mailbox&, + const sk_sp<SkImage>&, + GLenum filter); void RemoveCachedMailbox(GrTexture*); private:
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/ImageLayerBridge.cpp b/third_party/WebKit/Source/platform/graphics/gpu/ImageLayerBridge.cpp index 21604d2a..63d586c3 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/ImageLayerBridge.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/ImageLayerBridge.cpp
@@ -105,9 +105,9 @@ DCHECK_EQ(image_for_compositor->IsTextureBacked(), gpu_compositing); if (gpu_compositing) { - image_for_compositor->EnsureMailbox(kUnverifiedSyncToken); uint32_t filter = filter_quality_ == kNone_SkFilterQuality ? GL_NEAREST : GL_LINEAR; + image_for_compositor->EnsureMailbox(kUnverifiedSyncToken, filter); *out_resource = viz::TransferableResource::MakeGL( image_for_compositor->GetMailbox(), filter, GL_TEXTURE_2D, image_for_compositor->GetSyncToken());
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContextTest.cpp b/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContextTest.cpp index 8091f78..99ad653 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContextTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContextTest.cpp
@@ -192,7 +192,7 @@ &FakeMailboxGenerator::GenMailbox)); SharedGpuContext::ContextProviderWrapper()->Utils()->GetMailboxForSkImage( - mailbox, image->PaintImageForCurrentFrame().GetSkImage()); + mailbox, image->PaintImageForCurrentFrame().GetSkImage(), GL_NEAREST); EXPECT_EQ(mailbox.name[0], 1); @@ -203,7 +203,7 @@ mailbox.name[0] = 0; SharedGpuContext::ContextProviderWrapper()->Utils()->GetMailboxForSkImage( - mailbox, image->PaintImageForCurrentFrame().GetSkImage()); + mailbox, image->PaintImageForCurrentFrame().GetSkImage(), GL_NEAREST); EXPECT_EQ(mailbox.name[0], 1); ::testing::Mock::VerifyAndClearExpectations(&gl_); @@ -228,7 +228,7 @@ &FakeMailboxGenerator::GenMailbox)); SharedGpuContext::ContextProviderWrapper()->Utils()->GetMailboxForSkImage( - mailbox, image->PaintImageForCurrentFrame().GetSkImage()); + mailbox, image->PaintImageForCurrentFrame().GetSkImage(), GL_NEAREST); EXPECT_EQ(mailbox.name[0], 1); ::testing::Mock::VerifyAndClearExpectations(&gl_); @@ -252,7 +252,7 @@ mailbox.name[0] = 0; SharedGpuContext::ContextProviderWrapper()->Utils()->GetMailboxForSkImage( - mailbox, image->PaintImageForCurrentFrame().GetSkImage()); + mailbox, image->PaintImageForCurrentFrame().GetSkImage(), GL_NEAREST); EXPECT_EQ(mailbox.name[0], 1); ::testing::Mock::VerifyAndClearExpectations(&gl_);
diff --git a/third_party/WebKit/Source/platform/heap/Heap.cpp b/third_party/WebKit/Source/platform/heap/Heap.cpp index dc7960b..a38ec52 100644 --- a/third_party/WebKit/Source/platform/heap/Heap.cpp +++ b/third_party/WebKit/Source/platform/heap/Heap.cpp
@@ -346,7 +346,7 @@ while (PopAndInvokeTraceCallback(visitor)) { processed_callback_count++; if (processed_callback_count % kDeadlineCheckInterval == 0) { - if (deadline_seconds <= MonotonicallyIncreasingTime()) { + if (deadline_seconds <= CurrentTimeTicksInSeconds()) { return false; } } @@ -383,7 +383,7 @@ void ThreadHeap::WeakProcessing(Visitor* visitor) { TRACE_EVENT0("blink_gc", "ThreadHeap::weakProcessing"); - double start_time = WTF::MonotonicallyIncreasingTimeMS(); + double start_time = WTF::CurrentTimeTicksInMilliseconds(); // Weak processing may access unmarked objects but are forbidden from // ressurecting them. @@ -399,7 +399,7 @@ DCHECK(marking_stack_->IsEmpty()); double time_for_weak_processing = - WTF::MonotonicallyIncreasingTimeMS() - start_time; + WTF::CurrentTimeTicksInMilliseconds() - start_time; DEFINE_THREAD_SAFE_STATIC_LOCAL( CustomCountHistogram, weak_processing_time_histogram, ("BlinkGC.TimeForGlobalWeakProcessing", 1, 10 * 1000, 50)); @@ -788,7 +788,7 @@ // 10 pages. So we give a small slack for safety. double slack = 0.001; double remaining_budget = - deadline_seconds - slack - MonotonicallyIncreasingTime(); + deadline_seconds - slack - CurrentTimeTicksInSeconds(); if (remaining_budget <= 0 || !arenas_[i]->LazySweepWithDeadline(deadline_seconds)) { return false;
diff --git a/third_party/WebKit/Source/platform/heap/HeapCompact.cpp b/third_party/WebKit/Source/platform/heap/HeapCompact.cpp index f556d9bf..936a528c 100644 --- a/third_party/WebKit/Source/platform/heap/HeapCompact.cpp +++ b/third_party/WebKit/Source/platform/heap/HeapCompact.cpp
@@ -412,7 +412,7 @@ return; if (!start_compaction_time_ms_) - start_compaction_time_ms_ = WTF::MonotonicallyIncreasingTimeMS(); + start_compaction_time_ms_ = WTF::CurrentTimeTicksInMilliseconds(); } void HeapCompact::FinishThreadCompaction() { @@ -427,7 +427,7 @@ do_compact_ = false; double time_for_heap_compaction = - WTF::MonotonicallyIncreasingTimeMS() - start_compaction_time_ms_; + WTF::CurrentTimeTicksInMilliseconds() - start_compaction_time_ms_; DEFINE_THREAD_SAFE_STATIC_LOCAL( CustomCountHistogram, time_for_heap_compaction_histogram, ("BlinkGC.TimeForHeapCompaction", 1, 10 * 1000, 50));
diff --git a/third_party/WebKit/Source/platform/heap/HeapPage.cpp b/third_party/WebKit/Source/platform/heap/HeapPage.cpp index 6cd755a..5ceef5a4 100644 --- a/third_party/WebKit/Source/platform/heap/HeapPage.cpp +++ b/third_party/WebKit/Source/platform/heap/HeapPage.cpp
@@ -266,10 +266,10 @@ ThreadState::SweepForbiddenScope sweep_forbidden(GetThreadState()); ScriptForbiddenScope script_forbidden; - double start_time = WTF::MonotonicallyIncreasingTimeMS(); + double start_time = WTF::CurrentTimeTicksInMilliseconds(); Address result = LazySweepPages(allocation_size, gc_info_index); GetThreadState()->AccumulateSweepingTime( - WTF::MonotonicallyIncreasingTimeMS() - start_time); + WTF::CurrentTimeTicksInMilliseconds() - start_time); ThreadHeap::ReportMemoryUsageForTracing(); return result; @@ -313,7 +313,7 @@ while (!SweepingCompleted()) { SweepUnsweptPage(); if (page_count % kDeadlineCheckInterval == 0) { - if (deadline_seconds <= MonotonicallyIncreasingTime()) { + if (deadline_seconds <= CurrentTimeTicksInSeconds()) { // Deadline has come. ThreadHeap::ReportMemoryUsageForTracing(); if (normal_arena)
diff --git a/third_party/WebKit/Source/platform/heap/ThreadState.cpp b/third_party/WebKit/Source/platform/heap/ThreadState.cpp index 2ae99da6..7704e28 100644 --- a/third_party/WebKit/Source/platform/heap/ThreadState.cpp +++ b/third_party/WebKit/Source/platform/heap/ThreadState.cpp
@@ -578,8 +578,7 @@ return; } - double idle_delta_in_seconds = - deadline_seconds - MonotonicallyIncreasingTime(); + double idle_delta_in_seconds = deadline_seconds - CurrentTimeTicksInSeconds(); if (idle_delta_in_seconds <= heap_->HeapStats().EstimatedMarkingTime() && !Platform::Current() ->CurrentThread() @@ -616,18 +615,18 @@ TRACE_EVENT1("blink_gc,devtools.timeline", "ThreadState::performIdleLazySweep", "idleDeltaInSeconds", - deadline_seconds - MonotonicallyIncreasingTime()); + deadline_seconds - CurrentTimeTicksInSeconds()); SweepForbiddenScope scope(this); ScriptForbiddenScope script_forbidden_scope; - double start_time = WTF::MonotonicallyIncreasingTimeMS(); + double start_time = WTF::CurrentTimeTicksInMilliseconds(); bool sweep_completed = Heap().AdvanceLazySweep(deadline_seconds); // We couldn't finish the sweeping within the deadline. // We request another idle task for the remaining sweeping. if (!sweep_completed) ScheduleIdleLazySweep(); - AccumulateSweepingTime(WTF::MonotonicallyIncreasingTimeMS() - start_time); + AccumulateSweepingTime(WTF::CurrentTimeTicksInMilliseconds() - start_time); if (sweep_completed) PostSweep(); @@ -895,9 +894,9 @@ SweepForbiddenScope scope(this); ScriptForbiddenScope script_forbidden_scope; - double start_time = WTF::MonotonicallyIncreasingTimeMS(); + double start_time = WTF::CurrentTimeTicksInMilliseconds(); Heap().Arena(BlinkGC::kEagerSweepArenaIndex)->CompleteSweep(); - AccumulateSweepingTime(WTF::MonotonicallyIncreasingTimeMS() - start_time); + AccumulateSweepingTime(WTF::CurrentTimeTicksInMilliseconds() - start_time); } void ThreadState::CompleteSweep() { @@ -916,12 +915,12 @@ ScriptForbiddenScope script_forbidden_scope; TRACE_EVENT0("blink_gc,devtools.timeline", "ThreadState::completeSweep"); - double start_time = WTF::MonotonicallyIncreasingTimeMS(); + double start_time = WTF::CurrentTimeTicksInMilliseconds(); Heap().CompleteSweep(); double time_for_complete_sweep = - WTF::MonotonicallyIncreasingTimeMS() - start_time; + WTF::CurrentTimeTicksInMilliseconds() - start_time; AccumulateSweepingTime(time_for_complete_sweep); if (IsMainThread()) { @@ -1191,7 +1190,7 @@ // ressurecting them. ObjectResurrectionForbiddenScope object_resurrection_forbidden(this); - double start_time = WTF::MonotonicallyIncreasingTimeMS(); + double start_time = WTF::CurrentTimeTicksInMilliseconds(); if (!ordered_pre_finalizers_.IsEmpty()) { // Call the prefinalizers in the opposite order to their registration. // @@ -1212,7 +1211,7 @@ } if (IsMainThread()) { double time_for_invoking_pre_finalizers = - WTF::MonotonicallyIncreasingTimeMS() - start_time; + WTF::CurrentTimeTicksInMilliseconds() - start_time; DEFINE_STATIC_LOCAL( CustomCountHistogram, pre_finalizers_histogram, ("BlinkGC.TimeForInvokingPreFinalizers", 1, 10 * 1000, 50)); @@ -1329,7 +1328,7 @@ } void ThreadState::MarkPhaseVisitRoots() { - double start_time = WTF::MonotonicallyIncreasingTimeMS(); + double start_time = WTF::CurrentTimeTicksInMilliseconds(); ScriptForbiddenScope script_forbidden; // Disallow allocation during garbage collection (but not during the @@ -1346,11 +1345,11 @@ Heap().VisitStackRoots(current_gc_data_.visitor.get()); } current_gc_data_.marking_time_in_milliseconds += - WTF::MonotonicallyIncreasingTimeMS() - start_time; + WTF::CurrentTimeTicksInMilliseconds() - start_time; } bool ThreadState::MarkPhaseAdvanceMarking(double deadline_seconds) { - double start_time = WTF::MonotonicallyIncreasingTimeMS(); + double start_time = WTF::CurrentTimeTicksInMilliseconds(); ScriptForbiddenScope script_forbidden; // Disallow allocation during garbage collection (but not during the @@ -1363,7 +1362,7 @@ current_gc_data_.visitor.get(), deadline_seconds); current_gc_data_.marking_time_in_milliseconds += - WTF::MonotonicallyIncreasingTimeMS() - start_time; + WTF::CurrentTimeTicksInMilliseconds() - start_time; return complete; }
diff --git a/third_party/WebKit/Source/platform/loader/fetch/Resource.cpp b/third_party/WebKit/Source/platform/loader/fetch/Resource.cpp index db24f1d4..7128d1b 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/Resource.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/Resource.cpp
@@ -582,7 +582,7 @@ response_timestamp_ = CurrentTime(); if (preload_discovery_time_) { int time_since_discovery = static_cast<int>( - 1000 * (MonotonicallyIncreasingTime() - preload_discovery_time_)); + 1000 * (CurrentTimeTicksInSeconds() - preload_discovery_time_)); DEFINE_STATIC_LOCAL(CustomCountHistogram, preload_discovery_to_first_byte_histogram, ("PreloadScanner.TTFB", 0, 10000, 50)); @@ -1087,7 +1087,7 @@ if (preload_discovery_time_) { int time_since_discovery = static_cast<int>( - 1000 * (MonotonicallyIncreasingTime() - preload_discovery_time_)); + 1000 * (CurrentTimeTicksInSeconds() - preload_discovery_time_)); DEFINE_STATIC_LOCAL(CustomCountHistogram, preload_discovery_histogram, ("PreloadScanner.ReferenceTime", 0, 10000, 50)); preload_discovery_histogram.Count(time_since_discovery);
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp index 7f79565..c495ae3f 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
@@ -347,7 +347,7 @@ // Resources loaded from memory cache should be reported the first time // they're used. scoped_refptr<ResourceTimingInfo> info = ResourceTimingInfo::Create( - params.Options().initiator_info.name, MonotonicallyIncreasingTime(), + params.Options().initiator_info.name, CurrentTimeTicksInSeconds(), resource->GetType() == Resource::kMainResource); PopulateTimingInfo(info.get(), resource); info->ClearLoadTimings(); @@ -892,7 +892,7 @@ // startTime must be set accordingly. double start_time = resource->GetResourceRequest().NavigationStartTime() ? resource->GetResourceRequest().NavigationStartTime() - : MonotonicallyIncreasingTime(); + : CurrentTimeTicksInSeconds(); // This buffer is created and populated for providing transferSize // and redirect timing opt-in information.
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceLoader.cpp b/third_party/WebKit/Source/platform/loader/fetch/ResourceLoader.cpp index 3a8dac9..25d9185d 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/ResourceLoader.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceLoader.cpp
@@ -722,7 +722,7 @@ }); resource_->SetResourceBuffer(data_out); } - DidFinishLoading(MonotonicallyIncreasingTime(), encoded_data_length, + DidFinishLoading(CurrentTimeTicksInSeconds(), encoded_data_length, encoded_body_length, decoded_body_length); }
diff --git a/third_party/WebKit/Source/platform/network/EncodedFormData.cpp b/third_party/WebKit/Source/platform/network/EncodedFormData.cpp index 5ce1b795..0b6e3eb8 100644 --- a/third_party/WebKit/Source/platform/network/EncodedFormData.cpp +++ b/third_party/WebKit/Source/platform/network/EncodedFormData.cpp
@@ -96,6 +96,15 @@ form_data->elements_.UncheckedAppend(FormDataElement( e.blob_uuid_.IsolatedCopy(), e.optional_blob_data_handle_)); break; + case FormDataElement::kDataPipe: + network::mojom::blink::DataPipeGetterPtr data_pipe_getter; + (*e.data_pipe_getter_->GetPtr()) + ->Clone(mojo::MakeRequest(&data_pipe_getter)); + auto wrapped = base::MakeRefCounted<WrappedDataPipeGetter>( + std::move(data_pipe_getter)); + form_data->elements_.UncheckedAppend( + FormDataElement(std::move(wrapped))); + break; } } return form_data; @@ -129,8 +138,13 @@ elements_.push_back(FormDataElement(uuid, std::move(optional_handle))); } +void EncodedFormData::AppendDataPipe( + scoped_refptr<WrappedDataPipeGetter> handle) { + elements_.emplace_back(std::move(handle)); +} + void EncodedFormData::Flatten(Vector<char>& data) const { - // Concatenate all the byte arrays, but omit any files. + // Concatenate all the byte arrays, but omit everything else. data.clear(); size_t n = elements_.size(); for (size_t i = 0; i < n; ++i) { @@ -163,6 +177,14 @@ if (e.optional_blob_data_handle_) size += e.optional_blob_data_handle_->size(); break; + case FormDataElement::kDataPipe: + // We can get the size but it'd be async. Data pipe elements only exist + // for requests intercepted by service workers (and possibly + // subsequently redirected). But this function is only called for + // requests initiated by PingLoader, assume this function isn't needed + // in that case. + NOTREACHED(); + break; } } return size;
diff --git a/third_party/WebKit/Source/platform/network/EncodedFormData.h b/third_party/WebKit/Source/platform/network/EncodedFormData.h index d7b866de..7fc5fbbf 100644 --- a/third_party/WebKit/Source/platform/network/EncodedFormData.h +++ b/third_party/WebKit/Source/platform/network/EncodedFormData.h
@@ -28,10 +28,31 @@ #include "platform/wtf/Vector.h" #include "platform/wtf/text/WTFString.h" +#include "services/network/public/interfaces/data_pipe_getter.mojom-blink.h" + namespace blink { class BlobDataHandle; +// Refcounted wrapper around a DataPipeGetter to allow sharing the move-only +// type. This is only needed so EncodedFormData/FormDataElement have a copy +// constructor. +class PLATFORM_EXPORT WrappedDataPipeGetter final + : public RefCounted<WrappedDataPipeGetter> { + public: + explicit WrappedDataPipeGetter( + network::mojom::blink::DataPipeGetterPtr data_pipe_getter) + : data_pipe_getter_(std::move(data_pipe_getter)) {} + ~WrappedDataPipeGetter() = default; + + network::mojom::blink::DataPipeGetterPtr* GetPtr() { + return &data_pipe_getter_; + } + + private: + network::mojom::blink::DataPipeGetterPtr data_pipe_getter_; +}; + class PLATFORM_EXPORT FormDataElement final { DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); @@ -39,7 +60,6 @@ FormDataElement() : type_(kData) {} explicit FormDataElement(const Vector<char>& array) : type_(kData), data_(array) {} - FormDataElement(const String& filename, long long file_start, long long file_length, @@ -49,15 +69,18 @@ file_start_(file_start), file_length_(file_length), expected_file_modification_time_(expected_file_modification_time) {} - explicit FormDataElement(const String& blob_uuid, - scoped_refptr<BlobDataHandle> optional_handle) + FormDataElement(const String& blob_uuid, + scoped_refptr<BlobDataHandle> optional_handle) : type_(kEncodedBlob), blob_uuid_(blob_uuid), optional_blob_data_handle_(std::move(optional_handle)) {} + explicit FormDataElement( + scoped_refptr<WrappedDataPipeGetter> data_pipe_getter) + : type_(kDataPipe), data_pipe_getter_(std::move(data_pipe_getter)) {} bool IsSafeToSendToAnotherThread() const; - enum Type { kData, kEncodedFile, kEncodedBlob } type_; + enum Type { kData, kEncodedFile, kEncodedBlob, kDataPipe } type_; Vector<char> data_; String filename_; String blob_uuid_; @@ -65,6 +88,7 @@ long long file_start_; long long file_length_; double expected_file_modification_time_; + scoped_refptr<WrappedDataPipeGetter> data_pipe_getter_; }; inline bool operator==(const FormDataElement& a, const FormDataElement& b) { @@ -82,6 +106,8 @@ b.expected_file_modification_time_; if (a.type_ == FormDataElement::kEncodedBlob) return a.blob_uuid_ == b.blob_uuid_; + if (a.type_ == FormDataElement::kDataPipe) + return a.data_pipe_getter_ == b.data_pipe_getter_; return true; } @@ -114,12 +140,14 @@ double expected_modification_time); void AppendBlob(const String& blob_uuid, scoped_refptr<BlobDataHandle> optional_handle); + void AppendDataPipe(scoped_refptr<WrappedDataPipeGetter> handle); void Flatten(Vector<char>&) const; // omits files String FlattenToString() const; // omits files bool IsEmpty() const { return elements_.IsEmpty(); } const Vector<FormDataElement>& Elements() const { return elements_; } + Vector<FormDataElement>& MutableElements() { return elements_; } const Vector<char>& Boundary() const { return boundary_; } void SetBoundary(Vector<char> boundary) { boundary_ = boundary; }
diff --git a/third_party/WebKit/Source/platform/probe/PlatformProbes.cpp b/third_party/WebKit/Source/platform/probe/PlatformProbes.cpp index 428e096..1229c29 100644 --- a/third_party/WebKit/Source/platform/probe/PlatformProbes.cpp +++ b/third_party/WebKit/Source/platform/probe/PlatformProbes.cpp
@@ -9,13 +9,13 @@ double ProbeBase::CaptureStartTime() const { if (!start_time_) - start_time_ = MonotonicallyIncreasingTime(); + start_time_ = CurrentTimeTicksInSeconds(); return start_time_; } double ProbeBase::CaptureEndTime() const { if (!end_time_) - end_time_ = MonotonicallyIncreasingTime(); + end_time_ = CurrentTimeTicksInSeconds(); return end_time_; }
diff --git a/third_party/WebKit/Source/platform/runtime_enabled_features.json5 b/third_party/WebKit/Source/platform/runtime_enabled_features.json5 index 3c1f602..ad8a005 100644 --- a/third_party/WebKit/Source/platform/runtime_enabled_features.json5 +++ b/third_party/WebKit/Source/platform/runtime_enabled_features.json5
@@ -484,7 +484,7 @@ }, { name: "ImageDecodingAttribute", - status: "test", + status: "stable", }, { name: "ImageOrientation", @@ -753,6 +753,10 @@ settable_from_internals: true, }, { + name: "PageLifecycle", + status: "test", + }, + { name: "PagePopup", status: "stable", },
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollAnimator.h b/third_party/WebKit/Source/platform/scroll/ScrollAnimator.h index e6f9e7db..e9ca2479 100644 --- a/third_party/WebKit/Source/platform/scroll/ScrollAnimator.h +++ b/third_party/WebKit/Source/platform/scroll/ScrollAnimator.h
@@ -100,7 +100,7 @@ class PLATFORM_EXPORT ScrollAnimator : public ScrollAnimatorBase { public: explicit ScrollAnimator(ScrollableArea*, - WTF::TimeFunction = WTF::MonotonicallyIncreasingTime); + WTF::TimeFunction = WTF::CurrentTimeTicksInSeconds); ~ScrollAnimator() override; bool HasRunningAnimation() const override;
diff --git a/third_party/WebKit/Source/platform/testing/wtf/ScopedMockClock.cpp b/third_party/WebKit/Source/platform/testing/wtf/ScopedMockClock.cpp new file mode 100644 index 0000000..4b1e18e5 --- /dev/null +++ b/third_party/WebKit/Source/platform/testing/wtf/ScopedMockClock.cpp
@@ -0,0 +1,32 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "platform/testing/wtf/ScopedMockClock.h" + +namespace WTF { + +ScopedMockClock* ScopedMockClock::top_ = nullptr; + +ScopedMockClock::ScopedMockClock() + : next_(top_), next_time_function_(GetTimeFunctionForTesting()) { + top_ = this; + SetTimeFunctionsForTesting(&Now); +} + +ScopedMockClock::~ScopedMockClock() { + top_ = next_; + SetTimeFunctionsForTesting(next_time_function_); +} + +double ScopedMockClock::Now() { + return top_->now_.since_origin().InSecondsF(); +} + +void ScopedMockClock::Advance(TimeDelta delta) { + DCHECK_GT(delta, base::TimeDelta()) + << "Monotonically increasing time may not go backwards"; + now_ += delta; +} + +} // namespace WTF
diff --git a/third_party/WebKit/Source/platform/testing/wtf/ScopedMockClock.h b/third_party/WebKit/Source/platform/testing/wtf/ScopedMockClock.h new file mode 100644 index 0000000..118d6dbb --- /dev/null +++ b/third_party/WebKit/Source/platform/testing/wtf/ScopedMockClock.h
@@ -0,0 +1,33 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ScopedMockClock_h +#define ScopedMockClock_h + +#include "platform/wtf/Time.h" + +namespace WTF { + +// Scoped helper to override WTF time functions for testing. Creating one on the +// stack resets mock time to the zero point for WTF::Time and WTF::TimeTicks. +// Mock time may only flow forwards, not backwards. +class ScopedMockClock { + public: + ScopedMockClock(); + ~ScopedMockClock(); + + static double Now(); + + void Advance(TimeDelta); + + private: + static ScopedMockClock* top_; + ScopedMockClock* next_; + TimeFunction next_time_function_; + base::TimeTicks now_; +}; + +} // namespace WTF + +#endif
diff --git a/third_party/WebKit/Source/platform/wtf/Time.cpp b/third_party/WebKit/Source/platform/wtf/Time.cpp index e0405e48..d405bf4 100644 --- a/third_party/WebKit/Source/platform/wtf/Time.cpp +++ b/third_party/WebKit/Source/platform/wtf/Time.cpp
@@ -42,13 +42,6 @@ return base::Time::Now().ToDoubleT(); } -double MonotonicallyIncreasingTime() { - if (g_mock_time_function_for_testing) - return g_mock_time_function_for_testing(); - return base::TimeTicks::Now().ToInternalValue() / - static_cast<double>(base::Time::kMicrosecondsPerSecond); -} - TimeFunction SetTimeFunctionsForTesting(TimeFunction new_function) { TimeFunction old_function = g_mock_time_function_for_testing; g_mock_time_function_for_testing = new_function; @@ -59,4 +52,20 @@ return g_mock_time_function_for_testing; } +TimeTicks CurrentTimeTicks() { + if (g_mock_time_function_for_testing) { + return base::TimeTicks() + + base::TimeDelta::FromSecondsD(g_mock_time_function_for_testing()); + } + return base::TimeTicks::Now(); +} + +double CurrentTimeTicksInSeconds() { + return CurrentTimeTicks().since_origin().InSecondsF(); +} + +double CurrentTimeTicksInMilliseconds() { + return CurrentTimeTicks().since_origin().InMillisecondsF(); +} + } // namespace WTF
diff --git a/third_party/WebKit/Source/platform/wtf/Time.h b/third_party/WebKit/Source/platform/wtf/Time.h index 74d0cd6..1543519 100644 --- a/third_party/WebKit/Source/platform/wtf/Time.h +++ b/third_party/WebKit/Source/platform/wtf/Time.h
@@ -33,16 +33,6 @@ return CurrentTime() * 1000.0; } -// Provides a monotonically increasing time in seconds since an arbitrary point -// in the past. On unsupported platforms, this function only guarantees the -// result will be non-decreasing. -WTF_EXPORT double MonotonicallyIncreasingTime(); - -// Same thing, in milliseconds. -inline double MonotonicallyIncreasingTimeMS() { - return MonotonicallyIncreasingTime() * 1000.0; -} - using TimeFunction = double (*)(); // Make all the time functions (currentTime(), monotonicallyIncreasingTime(), @@ -59,14 +49,6 @@ TimeTicks() {} TimeTicks(base::TimeTicks value) : value_(value) {} - static TimeTicks Now() { - if (WTF::GetTimeFunctionForTesting()) { - double seconds = (WTF::GetTimeFunctionForTesting())(); - return TimeTicks() + TimeDelta::FromSecondsD(seconds); - } - return TimeTicks(base::TimeTicks::Now()); - } - static TimeTicks UnixEpoch() { return TimeTicks(base::TimeTicks::UnixEpoch()); } @@ -82,6 +64,8 @@ return TimeTicks() + TimeDelta::FromSecondsD(seconds); } + TimeDelta since_origin() const { return value_.since_origin(); } + bool is_null() const { return value_.is_null(); } operator base::TimeTicks() const { return value_; } @@ -120,12 +104,22 @@ base::TimeTicks value_; }; +// Monotonically increasing clock time since an arbitrary and unspecified origin +// time. Mockable using SetTimeFunctionsForTesting(). +WTF_EXPORT TimeTicks CurrentTimeTicks(); +// Convenience functions that return seconds and milliseconds since the origin +// time. Prefer CurrentTimeTicks() where possible to avoid potential unit +// confusion errors. +WTF_EXPORT double CurrentTimeTicksInSeconds(); +WTF_EXPORT double CurrentTimeTicksInMilliseconds(); + } // namespace WTF using WTF::CurrentTime; using WTF::CurrentTimeMS; -using WTF::MonotonicallyIncreasingTime; -using WTF::MonotonicallyIncreasingTimeMS; +using WTF::CurrentTimeTicks; +using WTF::CurrentTimeTicksInMilliseconds; +using WTF::CurrentTimeTicksInSeconds; using WTF::SetTimeFunctionsForTesting; using WTF::Time; using WTF::TimeDelta;
diff --git a/third_party/WebKit/Tools/OWNERS b/third_party/WebKit/Tools/OWNERS index 5c5aa17..1b4442b 100644 --- a/third_party/WebKit/Tools/OWNERS +++ b/third_party/WebKit/Tools/OWNERS
@@ -1,6 +1,7 @@ dpranke@chromium.org jeffcarp@chromium.org qyearsley@chromium.org +robertma@chromium.org tansell@chromium.org tkent@chromium.org wangxianzhu@chromium.org
diff --git a/third_party/WebKit/Tools/Scripts/audit-non-blink-usage.py b/third_party/WebKit/Tools/Scripts/audit-non-blink-usage.py index 008535e..0de8fe2 100755 --- a/third_party/WebKit/Tools/Scripts/audit-non-blink-usage.py +++ b/third_party/WebKit/Tools/Scripts/audit-non-blink-usage.py
@@ -31,6 +31,7 @@ # //base constructs that are allowed everywhere 'base::AdoptRef', + 'base::Location', 'base::MakeRefCounted', 'base::Optional', 'base::SingleThreadTaskRunner',
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/git_cl_mock.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/git_cl_mock.py index d737ac7..e3e3fd7 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/git_cl_mock.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/git_cl_mock.py
@@ -2,16 +2,29 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -from webkitpy.common.net.git_cl import GitCL +from webkitpy.common.net.git_cl import CLStatus, GitCL # pylint: disable=unused-argument class MockGitCL(object): - def __init__(self, host, results=None, issue_number='1234'): - self._host = host - self._results = results + def __init__( + self, host, try_job_results=None, status='closed', + issue_number='1234', time_out=False): + """Constructs a fake GitCL with canned return values. + + Args: + host: Host object, used for builder names. + try_job_results: A dict of Build to TryJobStatus. + status: CL status string. + issue_number: CL issue number as a string. + time_out: Whether to simulate timing out while waiting. + """ + self._builders = host.builders.all_try_builder_names() + self._status = status + self._try_job_results = try_job_results self._issue_number = issue_number + self._time_out = time_out self.calls = [] def run(self, args): @@ -19,7 +32,7 @@ return 'mock output' def trigger_try_jobs(self, builders=None, master=None): - builders = builders or self._host.builders.all_try_builder_names() + builders = builders or self._builders if not master: master = 'tryserver.blink' command = ['try', '-m', master] @@ -31,16 +44,20 @@ return self._issue_number def try_job_results(self, **_): - return self._results + return self._try_job_results def wait_for_try_jobs(self, **_): - return self._results + if self._time_out: + return None + return CLStatus(self._status, self._try_job_results) def wait_for_closed_status(self, **_): + if self._time_out: + return None return 'closed' def latest_try_jobs(self, builder_names=None): - return self.filter_latest(self._results) + return self.filter_latest(self._try_job_results) @staticmethod def filter_latest(try_results):
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/monorail.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/monorail.py index cb271ea9..57046cd 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/monorail.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/monorail.py
@@ -114,12 +114,13 @@ self._oauth2_client = oauth2client.client if service_account_key_json: - credentials = self._oauth2_client.GoogleCredentials(service_account_key_json) + credentials = self._oauth2_client.GoogleCredentials.from_stream(service_account_key_json) else: credentials = self._oauth2_client.GoogleCredentials.get_application_default() + # cache_discovery needs to be disabled because of https://github.com/google/google-api-python-client/issues/299 self.api = self._api_discovery.build( - 'monorail', 'v1', discoveryServiceUrl=self._DISCOVERY_URL, credentials=credentials) + 'monorail', 'v1', discoveryServiceUrl=self._DISCOVERY_URL, credentials=credentials, cache_discovery=False) def insert_issue(self, issue): return self.api.issues().insert(projectId=issue.project_id, body=issue.body).execute()
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer.py index 895190d..c74d50f 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer.py
@@ -183,21 +183,21 @@ """ _log.info('Triggering try jobs for updating expectations.') self.git_cl.trigger_try_jobs(self.blink_try_bots()) - try_results = self.git_cl.wait_for_try_jobs( + cl_status = self.git_cl.wait_for_try_jobs( poll_delay_seconds=POLL_DELAY_SECONDS, timeout_seconds=TIMEOUT_SECONDS) - if not try_results: + if not cl_status: _log.error('No initial try job results, aborting.') self.git_cl.run(['set-close']) return False - if try_results.status == 'closed': + if cl_status.status == 'closed': _log.error('The CL was closed, aborting.') return False _log.info('All jobs finished.') - try_results = try_results.try_job_results + try_results = cl_status.try_job_results if try_results and self.git_cl.some_failed(try_results): self.fetch_new_expectations_and_baselines() @@ -212,21 +212,21 @@ """Triggers CQ and either commits or aborts; returns True on success.""" _log.info('Triggering CQ try jobs.') self.git_cl.run(['try']) - try_results = self.git_cl.wait_for_try_jobs( + cl_status = self.git_cl.wait_for_try_jobs( poll_delay_seconds=POLL_DELAY_SECONDS, timeout_seconds=TIMEOUT_SECONDS) - if not try_results: + if not cl_status: self.git_cl.run(['set-close']) _log.error('Timed out waiting for CQ; aborting.') return False - if try_results.status == 'closed': + if cl_status.status == 'closed': _log.error('The CL was closed; aborting.') return False _log.info('All jobs finished.') - try_results = self.git_cl.filter_latest(try_results.try_job_results) + try_results = self.git_cl.filter_latest(cl_status.try_job_results) # We only want to check the status of CQ bots. The set of CQ bots is # determined by //infra/config/cq.cfg, but since in import jobs we only
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer_unittest.py index 3c5a478..11eac69 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer_unittest.py
@@ -29,7 +29,7 @@ host.filesystem.write_text_file( '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations', '') importer = TestImporter(host) - importer.git_cl = MockGitCL(host, results=None) + importer.git_cl = MockGitCL(host, time_out=True) success = importer.update_expectations_for_cl() self.assertFalse(success) self.assertLog([ @@ -43,12 +43,9 @@ host.filesystem.write_text_file( '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations', '') importer = TestImporter(host) - importer.git_cl = MockGitCL(host, results=CLStatus( - status='closed', - try_job_results={ - Build('builder-a', 123): TryJobStatus('COMPLETED', 'SUCCESS'), - }, - )) + importer.git_cl = MockGitCL(host, status='closed', try_job_results={ + Build('builder-a', 123): TryJobStatus('COMPLETED', 'SUCCESS'), + }) success = importer.update_expectations_for_cl() self.assertFalse(success) self.assertLog([ @@ -61,12 +58,9 @@ host.filesystem.write_text_file( '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations', '') importer = TestImporter(host) - importer.git_cl = MockGitCL(host, results=CLStatus( - status='lgtm', - try_job_results={ - Build('builder-a', 123): TryJobStatus('COMPLETED', 'SUCCESS'), - }, - )) + importer.git_cl = MockGitCL(host, status='lgtm', try_job_results={ + Build('builder-a', 123): TryJobStatus('COMPLETED', 'SUCCESS'), + }) success = importer.update_expectations_for_cl() self.assertLog([ 'INFO: Triggering try jobs for updating expectations.\n', @@ -79,12 +73,9 @@ host.filesystem.write_text_file( '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations', '') importer = TestImporter(host) - importer.git_cl = MockGitCL(host, results=CLStatus( - status='lgtm', - try_job_results={ - Build('builder-a', 123): TryJobStatus('COMPLETED', 'FAILURE'), - }, - )) + importer.git_cl = MockGitCL(host, status='lgtm', try_job_results={ + Build('builder-a', 123): TryJobStatus('COMPLETED', 'FAILURE'), + }) importer.fetch_new_expectations_and_baselines = lambda: None success = importer.update_expectations_for_cl() self.assertTrue(success) @@ -99,13 +90,10 @@ '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations', '') importer = TestImporter(host) # Only the latest job for each builder is counted. - importer.git_cl = MockGitCL(host, results=CLStatus( - status='lgtm', - try_job_results={ - Build('cq-builder-a', 120): TryJobStatus('COMPLETED', 'FAILURE'), - Build('cq-builder-a', 123): TryJobStatus('COMPLETED', 'SUCCESS'), - }, - )) + importer.git_cl = MockGitCL(host, status='lgtm', try_job_results={ + Build('cq-builder-a', 120): TryJobStatus('COMPLETED', 'FAILURE'), + Build('cq-builder-a', 123): TryJobStatus('COMPLETED', 'SUCCESS'), + }) success = importer.run_commit_queue_for_cl() self.assertTrue(success) self.assertLog([ @@ -125,14 +113,11 @@ host.filesystem.write_text_file( '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations', '') importer = TestImporter(host) - importer.git_cl = MockGitCL(host, results=CLStatus( - status='lgtm', - try_job_results={ - Build('cq-builder-a', 120): TryJobStatus('COMPLETED', 'SUCCESS'), - Build('cq-builder-a', 123): TryJobStatus('COMPLETED', 'FAILURE'), - Build('cq-builder-b', 200): TryJobStatus('COMPLETED', 'SUCCESS'), - }, - )) + importer.git_cl = MockGitCL(host, status='lgtm', try_job_results={ + Build('cq-builder-a', 120): TryJobStatus('COMPLETED', 'SUCCESS'), + Build('cq-builder-a', 123): TryJobStatus('COMPLETED', 'FAILURE'), + Build('cq-builder-b', 200): TryJobStatus('COMPLETED', 'SUCCESS'), + }) importer.fetch_new_expectations_and_baselines = lambda: None success = importer.run_commit_queue_for_cl() self.assertFalse(success) @@ -151,13 +136,10 @@ host.filesystem.write_text_file( '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations', '') importer = TestImporter(host) - importer.git_cl = MockGitCL(host, results=CLStatus( - status='closed', - try_job_results={ - Build('cq-builder-a', 120): TryJobStatus('COMPLETED', 'SUCCESS'), - Build('cq-builder-b', 200): TryJobStatus('COMPLETED', 'SUCCESS'), - }, - )) + importer.git_cl = MockGitCL(host, status='closed', try_job_results={ + Build('cq-builder-a', 120): TryJobStatus('COMPLETED', 'SUCCESS'), + Build('cq-builder-b', 200): TryJobStatus('COMPLETED', 'SUCCESS'), + }) success = importer.run_commit_queue_for_cl() self.assertFalse(success) self.assertLog([ @@ -180,13 +162,10 @@ } }) importer = TestImporter(host) - importer.git_cl = MockGitCL(host, results=CLStatus( - status='lgtm', - try_job_results={ - Build('fakeos_blink_rel', 123): TryJobStatus('COMPLETED', 'FAILURE'), - Build('cq-builder-b', 200): TryJobStatus('COMPLETED', 'SUCCESS'), - }, - )) + importer.git_cl = MockGitCL(host, status='lgtm', try_job_results={ + Build('fakeos_blink_rel', 123): TryJobStatus('COMPLETED', 'FAILURE'), + Build('cq-builder-b', 200): TryJobStatus('COMPLETED', 'SUCCESS'), + }) importer.fetch_new_expectations_and_baselines = lambda: None success = importer.run_commit_queue_for_cl() self.assertTrue(success) @@ -203,11 +182,10 @@ ]) def test_run_commit_queue_for_cl_timeout(self): + # This simulates the case where we time out while waiting for try jobs. host = MockHost() importer = TestImporter(host) - # The simulates the case where importer.git_cl.wait_for_try_jobs returns - # None, which would normally happen if we time out waiting for results. - importer.git_cl = MockGitCL(host, results=None) + importer.git_cl = MockGitCL(host, time_out=True) success = importer.run_commit_queue_for_cl() self.assertFalse(success) self.assertLog([
diff --git a/third_party/WebKit/Tools/gdb/webkit.py b/third_party/WebKit/Tools/gdb/webkit.py index dbb6bb1f..303bc56 100644 --- a/third_party/WebKit/Tools/gdb/webkit.py +++ b/third_party/WebKit/Tools/gdb/webkit.py
@@ -374,8 +374,7 @@ self.val = val def to_string(self): - return 'DataRef(%s)' % ( - WTFRefOrOwnPtrPrinter(self.val['data_']).to_string()) + return 'DataRef(%s)' % (str(self.val['data_'])) def add_pretty_printers():
diff --git a/third_party/WebKit/common/BUILD.gn b/third_party/WebKit/common/BUILD.gn index 894030f..1c6996a 100644 --- a/third_party/WebKit/common/BUILD.gn +++ b/third_party/WebKit/common/BUILD.gn
@@ -17,6 +17,7 @@ "//content/*", "//third_party/WebKit/*", "//components/*", + "//storage/*", ":*", ] @@ -52,6 +53,7 @@ "origin_trials/trial_token.h", "origin_trials/trial_token_validator.cc", "origin_trials/trial_token_validator.h", + "quota/quota_status_code.h", "sandbox_flags.h", ]
diff --git a/third_party/WebKit/common/message_port/cloneable_message.h b/third_party/WebKit/common/message_port/cloneable_message.h index 76a298bb..28e4431 100644 --- a/third_party/WebKit/common/message_port/cloneable_message.h +++ b/third_party/WebKit/common/message_port/cloneable_message.h
@@ -8,6 +8,7 @@ #include <vector> #include "base/containers/span.h" +#include "base/macros.h" #include "mojo/public/cpp/bindings/struct_ptr.h" #include "third_party/WebKit/common/common_export.h" @@ -38,6 +39,9 @@ // Blob handles for any blobs being sent in this message. std::vector<mojo::StructPtr<mojom::SerializedBlob>> blobs; + + private: + DISALLOW_COPY_AND_ASSIGN(CloneableMessage); }; } // namespace blink
diff --git a/third_party/WebKit/common/message_port/transferable_message.h b/third_party/WebKit/common/message_port/transferable_message.h index 0c2f9f29b..ef01eb4 100644 --- a/third_party/WebKit/common/message_port/transferable_message.h +++ b/third_party/WebKit/common/message_port/transferable_message.h
@@ -8,6 +8,7 @@ #include <vector> #include "base/containers/span.h" +#include "base/macros.h" #include "third_party/WebKit/common/common_export.h" #include "third_party/WebKit/common/message_port/cloneable_message.h" #include "third_party/WebKit/common/message_port/message_port_channel.h" @@ -24,6 +25,9 @@ // Any ports being transfered as part of this message. std::vector<MessagePortChannel> ports; + + private: + DISALLOW_COPY_AND_ASSIGN(TransferableMessage); }; } // namespace blink
diff --git a/third_party/WebKit/common/quota/quota_status_code.h b/third_party/WebKit/common/quota/quota_status_code.h new file mode 100644 index 0000000..efef901 --- /dev/null +++ b/third_party/WebKit/common/quota/quota_status_code.h
@@ -0,0 +1,24 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_WEBKIT_COMMON_QUOTA_QUOTA_STATUS_CODE_H_ +#define THIRD_PARTY_WEBKIT_COMMON_QUOTA_QUOTA_STATUS_CODE_H_ + +namespace blink { + +// These values are used by WebStorageQuotaError and need to match +// dom/ExceptionState.h. +// TODO(sashab): Remove this and use mojom::storage::QuotaStatusCode instead. +enum class QuotaStatusCode { + kOk = 0, + kErrorNotSupported = 7, + kErrorInvalidModification = 11, + kErrorInvalidAccess = 13, + kErrorAbort = 17, + kUnknown = -1, +}; + +} // namespace blink + +#endif // THIRD_PARTY_WEBKIT_COMMON_QUOTA_QUOTA_STATUS_CODE_H_
diff --git a/third_party/WebKit/public/README.md b/third_party/WebKit/public/README.md index 2621b7a..b9c21cd1 100644 --- a/third_party/WebKit/public/README.md +++ b/third_party/WebKit/public/README.md
@@ -31,15 +31,31 @@ Blink is designed to run in a sandbox and interacts with the operating system via the platform API. The central interface in this part of the API is Platform, which is a pure virtual interface from which Blink obtains many other -interfaces. +interfaces. public/platform/ is implemented by WebKit/Source/platform/exported/. The public/web directory defines an interface to Blink's implementation of the web platform, including the Document Object Model (DOM). The central interface in this part of the API is WebView, which is a good starting point for -exploring the API. +exploring the API. public/web/ is implemented by +WebKit/Source/{core,modules,controller}/exported/. Note that public/platform should not depend on public/web. +Notes +----- + +As mentioned above, conceptually public/platform/ and public/web/ should be +used as follows: + + - public/platform/ is implemented by the underlying functionalities and used by Blink + - public/web/ is implemented by Blink and used by Chromium + +In reality, however, they are sometimes abused. Due to the dependency constraint +(public/web/ => controller/ => modules/ => core/ => platform/ => public/platform/), +people sometimes define classes in public/platform/ or public/web/ just because +that place is more convenient. This is already happening in many places but keep +the concept in mind. + Basic Types -----------
diff --git a/third_party/WebKit/public/platform/Platform.h b/third_party/WebKit/public/platform/Platform.h index 38a47e0e..342eb3c 100644 --- a/third_party/WebKit/public/platform/Platform.h +++ b/third_party/WebKit/public/platform/Platform.h
@@ -343,7 +343,7 @@ return nullptr; } - // Returns a WebDataConsumerHandle for given a mojo data pipe endpoint. + // Returns a WebDataConsumerHandle for a given mojo data pipe endpoint. virtual std::unique_ptr<WebDataConsumerHandle> CreateDataConsumerHandle( mojo::ScopedDataPipeConsumerHandle handle) { return nullptr; @@ -477,6 +477,18 @@ return nullptr; } + // Returns an interface to run nested message loop. Used for debugging. + class NestedMessageLoopRunner { + public: + virtual ~NestedMessageLoopRunner() {} + virtual void Run() = 0; + virtual void QuitNow() = 0; + }; + virtual std::unique_ptr<NestedMessageLoopRunner> + CreateNestedMessageLoopRunner() const { + return nullptr; + } + // Testing ------------------------------------------------------------- // Gets a pointer to URLLoaderMockFactory for testing. Will not be available
diff --git a/third_party/WebKit/public/platform/WebHTTPBody.h b/third_party/WebKit/public/platform/WebHTTPBody.h index 1606a57..774abc5b 100644 --- a/third_party/WebKit/public/platform/WebHTTPBody.h +++ b/third_party/WebKit/public/platform/WebHTTPBody.h
@@ -35,6 +35,7 @@ #include "WebData.h" #include "WebString.h" #include "WebURL.h" +#include "mojo/public/cpp/system/message_pipe.h" #if INSIDE_BLINK #include "base/memory/scoped_refptr.h" @@ -47,7 +48,13 @@ class WebHTTPBody { public: struct Element { - enum Type { kTypeData, kTypeFile, kTypeBlob, kTypeFileSystemURL } type; + enum Type { + kTypeData, + kTypeFile, + kTypeBlob, + kTypeFileSystemURL, + kTypeDataPipe, + } type; WebData data; WebString file_path; long long file_start; @@ -55,6 +62,10 @@ double modification_time; WebURL file_system_url; WebString blob_uuid; + // |data_pipe_getter| is a network::mojom::DataPipeGetterPtr. It's declared + // as a generic ScopedMessagePipeHandle so it can be "cast" between Blink + // and non-Blink variant types. + mojo::ScopedMessagePipeHandle data_pipe_getter; }; ~WebHTTPBody() { Reset(); } @@ -88,6 +99,11 @@ long long file_length, double modification_time); BLINK_PLATFORM_EXPORT void AppendBlob(const WebString& uuid); + // |data_pipe_getter| is a network::mojom::DataPipeGetterPtr. It's declared + // as a generic ScopedMessagePipeHandle so it can be "cast" between Blink + // and non-Blink variant types. + BLINK_PLATFORM_EXPORT void AppendDataPipe( + mojo::ScopedMessagePipeHandle data_pipe_getter); BLINK_PLATFORM_EXPORT void SetUniqueBoundary();
diff --git a/third_party/WebKit/public/platform/WebStorageQuotaError.h b/third_party/WebKit/public/platform/WebStorageQuotaError.h index e1873c5..47080799 100644 --- a/third_party/WebKit/public/platform/WebStorageQuotaError.h +++ b/third_party/WebKit/public/platform/WebStorageQuotaError.h
@@ -31,9 +31,13 @@ #ifndef WebStorageQuotaError_h #define WebStorageQuotaError_h +#include "third_party/WebKit/common/quota/quota_status_code.h" + namespace blink { -// The error code used for WebStorageQuota. +// The error code used for WebStorageQuota. Values must match QuotaStatusCode. +// TODO(sashab): Remove this class and update callers to use +// blink::QuotaStatusCode instead. enum WebStorageQuotaError { kWebStorageQuotaErrorNotSupported = 7, kWebStorageQuotaErrorInvalidModification = 11, @@ -41,6 +45,23 @@ kWebStorageQuotaErrorAbort = 17, }; +static_assert( + static_cast<int>(kWebStorageQuotaErrorNotSupported) == + static_cast<int>(QuotaStatusCode::kErrorNotSupported), + "WebStorageQuotaError and QuotaStatusCode enum values must match"); +static_assert( + static_cast<int>(kWebStorageQuotaErrorInvalidModification) == + static_cast<int>(QuotaStatusCode::kErrorInvalidModification), + "WebStorageQuotaError and QuotaStatusCode enum values must match"); +static_assert( + static_cast<int>(kWebStorageQuotaErrorInvalidAccess) == + static_cast<int>(QuotaStatusCode::kErrorInvalidAccess), + "WebStorageQuotaError and QuotaStatusCode enum values must match"); +static_assert( + static_cast<int>(kWebStorageQuotaErrorAbort) == + static_cast<int>(QuotaStatusCode::kErrorAbort), + "WebStorageQuotaError and QuotaStatusCode enum values must match"); + } // namespace blink #endif // WebStorageQuotaError_h
diff --git a/third_party/WebKit/public/platform/scheduler/DEPS b/third_party/WebKit/public/platform/scheduler/DEPS index 5039db6..ce505c7 100644 --- a/third_party/WebKit/public/platform/scheduler/DEPS +++ b/third_party/WebKit/public/platform/scheduler/DEPS
@@ -1,6 +1,7 @@ include_rules = [ "+base/bind.h", "+base/callback.h", + "+base/location.h", "+base/macros.h", "+base/memory/ptr_util.h", "+base/memory/ref_counted.h",
diff --git a/third_party/WebKit/public/platform/web_feature.mojom b/third_party/WebKit/public/platform/web_feature.mojom index e12a515..6e99125a 100644 --- a/third_party/WebKit/public/platform/web_feature.mojom +++ b/third_party/WebKit/public/platform/web_feature.mojom
@@ -1773,6 +1773,15 @@ kHTMLMediaElementEmptyLoadWithFutureData = 2264, kCSSValueDisplayContents = 2265, kCSSSelectorPseudoAnyLink = 2266, + kFileAccessedCache = 2267, + kFileAccessedCookies = 2268, + kFileAccessedDatabase = 2269, + kFileAccessedFileSystem = 2270, + kFileAccessedLocalStorage = 2271, + kFileAccessedLocks = 2272, + kFileAccessedServiceWorker = 2273, + kFileAccessedSessionStorage = 2274, + kFileAccessedSharedWorker = 2275, // Add new features immediately above this line. Don't change assigned // numbers of any item, and don't reuse removed slots.
diff --git a/third_party/WebKit/public/web/WebDevToolsAgentClient.h b/third_party/WebKit/public/web/WebDevToolsAgentClient.h index b26905f..3dade51 100644 --- a/third_party/WebKit/public/web/WebDevToolsAgentClient.h +++ b/third_party/WebKit/public/web/WebDevToolsAgentClient.h
@@ -59,13 +59,6 @@ // initialize its state. virtual void ResumeStartup() {} - class WebKitClientMessageLoop { - public: - virtual ~WebKitClientMessageLoop() {} - virtual void Run() = 0; - virtual void QuitNow() = 0; - }; - virtual WebKitClientMessageLoop* CreateClientMessageLoop() { return 0; } virtual void WillEnterDebugLoop() {} virtual void DidExitDebugLoop() {}
diff --git a/third_party/WebKit/public/web/WebSharedWorkerClient.h b/third_party/WebKit/public/web/WebSharedWorkerClient.h index a137fefb..cac4aad 100644 --- a/third_party/WebKit/public/web/WebSharedWorkerClient.h +++ b/third_party/WebKit/public/web/WebSharedWorkerClient.h
@@ -77,10 +77,6 @@ int call_id, const WebString& message, const WebString& state) {} - virtual WebDevToolsAgentClient::WebKitClientMessageLoop* - CreateDevToolsMessageLoop() { - return nullptr; - } // Returns a new WebWorkerFetchContext for the shared worker. Ownership of the // returned object is transferred to the caller. This is used only when
diff --git a/third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerContextClient.h b/third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerContextClient.h index 2fffffe..c735edb 100644 --- a/third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerContextClient.h +++ b/third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerContextClient.h
@@ -158,12 +158,6 @@ const WebString& message, const WebString& state) {} - // Message loop for debugging. - virtual WebDevToolsAgentClient::WebKitClientMessageLoop* - CreateDevToolsMessageLoop() { - return nullptr; - } - // Called after an 'activate' event completed. virtual void DidHandleActivateEvent(int event_id, mojom::ServiceWorkerEventStatus,
diff --git a/third_party/closure_compiler/externs/developer_private.js b/third_party/closure_compiler/externs/developer_private.js index ef75e71..ab53fc0a 100644 --- a/third_party/closure_compiler/externs/developer_private.js +++ b/third_party/closure_compiler/externs/developer_private.js
@@ -303,6 +303,7 @@ * location: !chrome.developerPrivate.Location, * locationText: (string|undefined), * manifestErrors: !Array<!chrome.developerPrivate.ManifestError>, + * manifestHomePageUrl: string, * mustRemainInstalled: boolean, * name: string, * offlineEnabled: boolean, @@ -318,7 +319,8 @@ * updateUrl: string, * userMayModify: boolean, * version: string, - * views: !Array<!chrome.developerPrivate.ExtensionView> + * views: !Array<!chrome.developerPrivate.ExtensionView>, + * webStoreUrl: string * }} * @see https://developer.chrome.com/extensions/developerPrivate#type-ExtensionInfo */ @@ -424,7 +426,8 @@ * @typedef {{ * failQuietly: (boolean|undefined), * populateError: (boolean|undefined), - * retryGuid: (string|undefined) + * retryGuid: (string|undefined), + * useDraggedPath: (boolean|undefined) * }} * @see https://developer.chrome.com/extensions/developerPrivate#type-LoadUnpackedOptions */ @@ -670,6 +673,13 @@ chrome.developerPrivate.loadUnpacked = function(options, callback) {}; /** + * Notifies the browser that a user began a drag in order to install an + * extension. + * @see https://developer.chrome.com/extensions/developerPrivate#method-notifyDragInstallInProgress + */ +chrome.developerPrivate.notifyDragInstallInProgress = function() {}; + +/** * Loads an extension / app. * @param {Object} directory The directory to load the extension from. * @param {function(string):void} callback @@ -726,7 +736,7 @@ chrome.developerPrivate.openDevTools = function(properties, callback) {}; /** - * Delete reported extension erors. + * Delete reported extension errors. * @param {!chrome.developerPrivate.DeleteExtensionErrorsProperties} properties * The properties specifying the errors to remove. * @param {function():void=} callback
diff --git a/third_party/instrumented_libraries/BUILD.gn b/third_party/instrumented_libraries/BUILD.gn index 0130392..8c1668f9 100644 --- a/third_party/instrumented_libraries/BUILD.gn +++ b/third_party/instrumented_libraries/BUILD.gn
@@ -111,11 +111,9 @@ ":libdbus-glib-1-2", ":libdbusmenu", ":libdbusmenu-glib4", - ":libdconf1", ":libexpat1", ":libffi6", ":libfontconfig1", - ":libgconf-2-4", ":libgcrypt11", ":libgdk-pixbuf2.0-0", ":libglib2.0-0", @@ -462,13 +460,6 @@ pre_build = "scripts/pre-build/autogen.sh" } - instrumented_library("libdconf1") { - extra_configure_flags = [ - "--disable-static", - "--disable-introspection", - ] - } - instrumented_library("libexpat1") { extra_configure_flags = [ "--disable-static" ] } @@ -489,19 +480,6 @@ patch = "patches/libfontconfig.${instrumented_libraries_platform}.diff" } - instrumented_library("libgconf-2-4") { - extra_configure_flags = [ - "--disable-static", - - # From debian/rules. (Even though --with-gtk=3.0 doesn't make sense.) - "--with-gtk=3.0", - "--disable-orbit", - - # See above. - "--disable-introspection", - ] - } - instrumented_library("libgcrypt11") { package_ldflags = [ "-Wl,-z,muldefs" ] extra_configure_flags = [
diff --git a/third_party/instrumented_libraries/scripts/install-build-deps.sh b/third_party/instrumented_libraries/scripts/install-build-deps.sh index 975193b3..f2c3b2d 100755 --- a/third_party/instrumented_libraries/scripts/install-build-deps.sh +++ b/third_party/instrumented_libraries/scripts/install-build-deps.sh
@@ -28,11 +28,9 @@ libdbus-glib-1-2 \ libdbusmenu \ libdbusmenu-glib4 \ -libdconf1 \ libexpat1 \ libffi6 \ libfontconfig1 \ -libgconf-2-4 \ libgcrypt11 \ libgdk-pixbuf2.0-0 \ libglib2.0-0 \
diff --git a/third_party/libjingle_xmpp/BUILD.gn b/third_party/libjingle_xmpp/BUILD.gn index 7738d03..40a4b70 100644 --- a/third_party/libjingle_xmpp/BUILD.gn +++ b/third_party/libjingle_xmpp/BUILD.gn
@@ -17,6 +17,7 @@ } rtc_static_library("rtc_task_runner") { + visibility = [ "*" ] sources = [ "task_runner/task.cc", "task_runner/task.h", @@ -28,6 +29,7 @@ } rtc_static_library("rtc_xmllite") { + visibility = [ "*" ] sources = [ "xmllite/qname.cc", "xmllite/qname.h", @@ -64,6 +66,7 @@ } rtc_static_library("rtc_xmpp") { + visibility = [ "*" ] cflags = [] sources = [ "xmpp/asyncsocket.h",
diff --git a/third_party/libvpx/README.chromium b/third_party/libvpx/README.chromium index ae7207d..ed641ea4 100644 --- a/third_party/libvpx/README.chromium +++ b/third_party/libvpx/README.chromium
@@ -5,9 +5,9 @@ License File: source/libvpx/LICENSE Security Critical: yes -Date: Wednesday December 06 2017 +Date: Sunday November 26 2017 Branch: master -Commit: 14dbdd95e686eafbe556c154c9e0bd76fe1d2d1a +Commit: cbe62b9c2d2b006aba52c8eebe7d842e59166fe4 Description: Contains the sources used to compile libvpx binaries used by Google Chrome and
diff --git a/third_party/libvpx/libvpx_srcs.gni b/third_party/libvpx/libvpx_srcs.gni index cc0da46..3aa57fb 100644 --- a/third_party/libvpx/libvpx_srcs.gni +++ b/third_party/libvpx/libvpx_srcs.gni
@@ -332,7 +332,6 @@ "//third_party/libvpx/source/libvpx/vpx_dsp/x86/inv_txfm_sse2.h", "//third_party/libvpx/source/libvpx/vpx_dsp/x86/inv_txfm_ssse3.h", "//third_party/libvpx/source/libvpx/vpx_dsp/x86/mem_sse2.h", - "//third_party/libvpx/source/libvpx/vpx_dsp/x86/quantize_x86.h", "//third_party/libvpx/source/libvpx/vpx_dsp/x86/transpose_sse2.h", "//third_party/libvpx/source/libvpx/vpx_dsp/x86/txfm_common_sse2.h", "//third_party/libvpx/source/libvpx/vpx_dsp/x86/vpx_asm_stubs.c", @@ -800,7 +799,6 @@ "//third_party/libvpx/source/libvpx/vpx_dsp/x86/inv_txfm_sse2.h", "//third_party/libvpx/source/libvpx/vpx_dsp/x86/inv_txfm_ssse3.h", "//third_party/libvpx/source/libvpx/vpx_dsp/x86/mem_sse2.h", - "//third_party/libvpx/source/libvpx/vpx_dsp/x86/quantize_x86.h", "//third_party/libvpx/source/libvpx/vpx_dsp/x86/transpose_sse2.h", "//third_party/libvpx/source/libvpx/vpx_dsp/x86/txfm_common_sse2.h", "//third_party/libvpx/source/libvpx/vpx_dsp/x86/vpx_asm_stubs.c",
diff --git a/third_party/libvpx/source/config/vpx_version.h b/third_party/libvpx/source/config/vpx_version.h index eb88e42..245bbc2 100644 --- a/third_party/libvpx/source/config/vpx_version.h +++ b/third_party/libvpx/source/config/vpx_version.h
@@ -1,7 +1,7 @@ #define VERSION_MAJOR 1 #define VERSION_MINOR 6 #define VERSION_PATCH 1 -#define VERSION_EXTRA "1441-g14dbdd95e" +#define VERSION_EXTRA "1403-gcbe62b9c2" #define VERSION_PACKED ((VERSION_MAJOR<<16)|(VERSION_MINOR<<8)|(VERSION_PATCH)) -#define VERSION_STRING_NOSP "v1.6.1-1441-g14dbdd95e" -#define VERSION_STRING " v1.6.1-1441-g14dbdd95e" +#define VERSION_STRING_NOSP "v1.6.1-1403-gcbe62b9c2" +#define VERSION_STRING " v1.6.1-1403-gcbe62b9c2"
diff --git a/third_party/usrsctp/BUILD.gn b/third_party/usrsctp/BUILD.gn index 5285f08..94f2678 100644 --- a/third_party/usrsctp/BUILD.gn +++ b/third_party/usrsctp/BUILD.gn
@@ -137,6 +137,9 @@ defines += [ "NON_WINDOWS_DEFINE" ] } + if (is_fuchsia) { + defines += [ "__Userspace_os_Fuchsia" ] + } deps = [ "//third_party/boringssl", ]
diff --git a/tools/cfi/blacklist.txt b/tools/cfi/blacklist.txt index 80704203..8e86ab00 100644 --- a/tools/cfi/blacklist.txt +++ b/tools/cfi/blacklist.txt
@@ -154,9 +154,6 @@ src:*device/udev_linux/udev1_loader.cc src:*net/proxy/proxy_config_service_linux.cc -# Calls to auto-generated stubs by ui/gl/generate_bindings.py -src:*ui/gl/gl_bindings_autogen_* - src:*components/os_crypt/* src:*chrome/browser/password_manager/native_backend_libsecret*
diff --git a/tools/clang/scripts/download_lld_mac.py b/tools/clang/scripts/download_lld_mac.py index 95acd65..50c0e81 100755 --- a/tools/clang/scripts/download_lld_mac.py +++ b/tools/clang/scripts/download_lld_mac.py
@@ -13,17 +13,13 @@ import update LLVM_BUILD_DIR = update.LLVM_BUILD_DIR -LLD_PATH = os.path.join(LLVM_BUILD_DIR, 'bin', 'lld') -LD_LLD_PATH = os.path.join(LLVM_BUILD_DIR, 'bin', 'ld.lld') LLD_LINK_PATH = os.path.join(LLVM_BUILD_DIR, 'bin', 'lld-link') def AlreadyUpToDate(): - if not os.path.exists(LLD_PATH): + if not os.path.exists(LLD_LINK_PATH): return False - # lld-link seems to have no flag to query the version; go to ld.lld instead. - # TODO(thakis): Remove ld.lld workaround if https://llvm.org/PR34955 is fixed. - lld_rev = subprocess.check_output([LD_LLD_PATH, '--version']) + lld_rev = subprocess.check_output([LLD_LINK_PATH, '--version']) return (re.match(r'LLD.*\(trunk (\d+)\)', lld_rev).group(1) == update.CLANG_REVISION) @@ -31,17 +27,10 @@ def main(): if AlreadyUpToDate(): return 0 - remote_path = '%s/Mac/lld-%s.tgz' % (update.CDS_URL, update.PACKAGE_VERSION) update.DownloadAndUnpack(remote_path, update.LLVM_BUILD_DIR) - - # TODO(thakis): Remove this once the lld tgz includes the symlink. - if os.path.exists(LLD_LINK_PATH): - os.remove(LLD_LINK_PATH) - os.remove(LD_LLD_PATH) - os.symlink('lld', LLD_LINK_PATH) - os.symlink('lld', LD_LLD_PATH) return 0 + if __name__ == '__main__': sys.exit(main())
diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py index f7aeb44a..78542c9 100755 --- a/tools/clang/scripts/update.py +++ b/tools/clang/scripts/update.py
@@ -51,7 +51,7 @@ CHROME_TOOLS_SHIM_DIR = os.path.join(LLVM_DIR, 'tools', 'chrometools') LLVM_BUILD_DIR = os.path.join(CHROMIUM_DIR, 'third_party', 'llvm-build', 'Release+Asserts') -LLD_BUILD_DIR = os.path.join(LLVM_BUILD_DIR, 'lld') +THREADS_ENABLED_BUILD_DIR = os.path.join(LLVM_BUILD_DIR, 'threads_enabled') COMPILER_RT_BUILD_DIR = os.path.join(LLVM_BUILD_DIR, 'compiler-rt') CLANG_DIR = os.path.join(LLVM_DIR, 'tools', 'clang') LLD_DIR = os.path.join(LLVM_DIR, 'tools', 'lld') @@ -614,22 +614,27 @@ deployment_env = os.environ.copy() deployment_env['MACOSX_DEPLOYMENT_TARGET'] = deployment_target - # Build lld. This is done separately from the rest of the build because lld - # requires threading support. - print 'Building lld' - if os.path.exists(LLD_BUILD_DIR): - RmTree(LLD_BUILD_DIR) - EnsureDirExists(LLD_BUILD_DIR) - os.chdir(LLD_BUILD_DIR) + # Build lld and code coverage tools. This is done separately from the rest of + # the build because these tools require threading support. + tools_with_threading = [ 'lld', 'llvm-cov', 'llvm-profdata' ] + print 'Building the following tools with threading support: %s' % ( + str(tools_with_threading)) - lld_cmake_args = base_cmake_args + [ + if os.path.exists(THREADS_ENABLED_BUILD_DIR): + RmTree(THREADS_ENABLED_BUILD_DIR) + EnsureDirExists(THREADS_ENABLED_BUILD_DIR) + os.chdir(THREADS_ENABLED_BUILD_DIR) + + threads_enabled_cmake_args = base_cmake_args + [ '-DCMAKE_C_FLAGS=' + ' '.join(cflags), '-DCMAKE_CXX_FLAGS=' + ' '.join(cxxflags), '-DCMAKE_EXE_LINKER_FLAGS=' + ' '.join(ldflags), '-DCMAKE_SHARED_LINKER_FLAGS=' + ' '.join(ldflags), '-DCMAKE_MODULE_LINKER_FLAGS=' + ' '.join(ldflags)] - if cc is not None: lld_cmake_args.append('-DCMAKE_C_COMPILER=' + cc) - if cxx is not None: lld_cmake_args.append('-DCMAKE_CXX_COMPILER=' + cxx) + if cc is not None: + threads_enabled_cmake_args.append('-DCMAKE_C_COMPILER=' + cc) + if cxx is not None: + threads_enabled_cmake_args.append('-DCMAKE_CXX_COMPILER=' + cxx) if args.lto_lld: # Build lld with LTO. That speeds up the linker by ~10%. @@ -641,16 +646,16 @@ # llvm-ranlib do, so use them. ar = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'llvm-ar') ranlib = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'llvm-ranlib') - lld_cmake_args += [ + threads_enabled_cmake_args += [ '-DCMAKE_AR=' + ar, '-DCMAKE_RANLIB=' + ranlib, '-DLLVM_ENABLE_LTO=thin', '-DLLVM_USE_LINKER=lld'] RmCmakeCache('.') - RunCommand(['cmake'] + lld_cmake_args + [LLVM_DIR], msvc_arch='x64', - env=deployment_env) - RunCommand(['ninja', 'lld'], msvc_arch='x64') + RunCommand(['cmake'] + threads_enabled_cmake_args + [LLVM_DIR], + msvc_arch='x64', env=deployment_env) + RunCommand(['ninja'] + tools_with_threading, msvc_arch='x64') # Build clang and other tools. CreateChromeToolsShim() @@ -681,15 +686,16 @@ msvc_arch='x64', env=deployment_env) RunCommand(['ninja'], msvc_arch='x64') - # Copy in the threaded version of lld. + # Copy in the threaded versions of lld and other tools. if sys.platform == 'win32': - CopyFile(os.path.join(LLD_BUILD_DIR, 'bin', 'lld-link.exe'), + CopyFile(os.path.join(THREADS_ENABLED_BUILD_DIR, 'bin', 'lld-link.exe'), os.path.join(LLVM_BUILD_DIR, 'bin')) - CopyFile(os.path.join(LLD_BUILD_DIR, 'bin', 'lld.pdb'), + CopyFile(os.path.join(THREADS_ENABLED_BUILD_DIR, 'bin', 'lld.pdb'), os.path.join(LLVM_BUILD_DIR, 'bin')) else: - CopyFile(os.path.join(LLD_BUILD_DIR, 'bin', 'lld'), - os.path.join(LLVM_BUILD_DIR, 'bin')) + for tool in tools_with_threading: + CopyFile(os.path.join(THREADS_ENABLED_BUILD_DIR, 'bin', tool), + os.path.join(LLVM_BUILD_DIR, 'bin')) if chrome_tools: # If any Chromium tools were built, install those now.
diff --git a/tools/cygprofile/lightweight_cygprofile.cc b/tools/cygprofile/lightweight_cygprofile.cc index 502e8235..d57a5fa 100644 --- a/tools/cygprofile/lightweight_cygprofile.cc +++ b/tools/cygprofile/lightweight_cygprofile.cc
@@ -193,14 +193,14 @@ // be inside __cyg_profile_func_enter(). To prevent that, force inlining. // We cannot use ALWAYS_INLINE from src/base/compiler_specific.h, as it doesn't // always map to always_inline, for instance when NDEBUG is not defined. -__attribute__((__always_inline__)) void mcount() { +__attribute__((__always_inline__)) void __cyg_profile_func_enter_bare() { cygprofile::RecordAddress<false>( reinterpret_cast<size_t>(__builtin_return_address(0))); } void __cyg_profile_func_enter(void* unused1, void* unused2) { - // Requires __always_inline__ on mcount(), see above. - mcount(); + // Requires __always_inline__ on __cyg_profile_func_enter_bare(), see above. + __cyg_profile_func_enter_bare(); } void __cyg_profile_func_exit(void* unused1, void* unused2) {}
diff --git a/tools/gn/bootstrap/bootstrap.py b/tools/gn/bootstrap/bootstrap.py index c4dd5d2..5030a549 100755 --- a/tools/gn/bootstrap/bootstrap.py +++ b/tools/gn/bootstrap/bootstrap.py
@@ -189,6 +189,10 @@ 'UNSAFE_DEVELOPER_BUILD': 'false' }) + write_buildflag_header_manually(root_gen_dir, + 'base/memory/protected_memory_flags.h', + { 'USE_LLD': 'false' }) + write_buildflag_header_manually(root_gen_dir, 'base/cfi_flags.h', { 'CFI_CAST_CHECK': 'false',
diff --git a/tools/luci-go/linux64/isolate.sha1 b/tools/luci-go/linux64/isolate.sha1 index 52ed59a4..0e231eb5 100644 --- a/tools/luci-go/linux64/isolate.sha1 +++ b/tools/luci-go/linux64/isolate.sha1
@@ -1 +1 @@ -ccdea1387f9f26c2572bf5f2b8d24e8d66a69cf6 +fbb12d5338ec1619386f956ed1c7e7d656e1c348
diff --git a/tools/luci-go/mac64/isolate.sha1 b/tools/luci-go/mac64/isolate.sha1 index 85e622d4..07539bad 100644 --- a/tools/luci-go/mac64/isolate.sha1 +++ b/tools/luci-go/mac64/isolate.sha1
@@ -1 +1 @@ -71329e82d274b847525f2b6345cb9fb6ddd0fff3 +994c46065313ad5dd350e8db03815f9d157cb58c
diff --git a/tools/luci-go/win64/isolate.exe.sha1 b/tools/luci-go/win64/isolate.exe.sha1 index 76cc09d..c0212ec3 100644 --- a/tools/luci-go/win64/isolate.exe.sha1 +++ b/tools/luci-go/win64/isolate.exe.sha1
@@ -1 +1 @@ -ded0dc9247e06fa42b653cce43f461f243ebea8b +a90cee60aa807bb3a5c2b15cb9bd343c4d077df1
diff --git a/tools/mb/mb_config.pyl b/tools/mb/mb_config.pyl index b65033e..dc363bf 100644 --- a/tools/mb/mb_config.pyl +++ b/tools/mb/mb_config.pyl
@@ -239,6 +239,7 @@ 'Linux deterministic (dbg)': 'debug_bot', 'Linux remote_run Builder': 'release_bot', 'Linux remote_run Tester': 'release_bot', + 'Linux Viz': 'release_trybot', 'Mac deterministic': 'release_bot_mac_strip', 'Mac deterministic (dbg)': 'debug_bot', 'Mojo ChromiumOS': 'chromeos_with_codecs_release_trybot',
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 849d3ab..1a33a16 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -537,6 +537,24 @@ <int value="4" label="Not QUIC, destination different from origin"/> </enum> +<enum name="Android.DownloadManager.List.View.Actions"> + <int value="0" label="OPEN"/> + <int value="1" label="RESUME"/> + <int value="2" label="PAUSE"/> + <int value="3" label="CANCEL"/> + <int value="4" label="MENU_SHARE"/> + <int value="5" label="MENU_DELETE"/> +</enum> + +<enum name="Android.DownloadManager.Menu.Actions"> + <int value="0" label="CLOSE"/> + <int value="1" label="MULTI_DELETE"/> + <int value="2" label="MULTI_SHARE"/> + <int value="3" label="SHOW_INFO"/> + <int value="4" label="HIDE_INFO"/> + <int value="5" label="SEARCH"/> +</enum> + <enum name="AndroidActivityId"> <int value="1" label="Unknown"/> <int value="2" label="Main"/> @@ -12127,6 +12145,8 @@ <int value="402" label="SecurityKeyPermitAttestation"/> <int value="403" label="DeviceHostnameTemplate"/> <int value="404" label="AbusiveExperienceInterventionEnforce"/> + <int value="405" label="SpellcheckLanguage"/> + <int value="406" label="SecondaryGoogleAccountSigninAllowed"/> </enum> <enum name="EnterprisePolicyInvalidations"> @@ -14246,6 +14266,7 @@ <int value="1203" label="VIRTUALKEYBOARDPRIVATE_SETDRAGGABLEAREA"/> <int value="1204" label="METRICSPRIVATE_RECORDBOOLEAN"/> <int value="1205" label="METRICSPRIVATE_RECORDENUMERATIONVALUE"/> + <int value="1206" label="DEVELOPERPRIVATE_NOTIFYDRAGINSTALLINPROGRESS"/> </enum> <enum name="ExtensionIconState"> @@ -17240,6 +17261,15 @@ <int value="2264" label="HTMLMediaElementEmptyLoadWithFutureData"/> <int value="2265" label="CSSValueDisplayContents"/> <int value="2266" label="CSSSelectorPseudoAnyLink"/> + <int value="2267" label="FileAccessedCache"/> + <int value="2268" label="FileAccessedCookies"/> + <int value="2269" label="FileAccessedDatabase"/> + <int value="2270" label="FileAccessedFileSystem"/> + <int value="2271" label="FileAccessedLocalStorage"/> + <int value="2272" label="FileAccessedLocks"/> + <int value="2273" label="FileAccessedServiceWorker"/> + <int value="2274" label="FileAccessedSessionStorage"/> + <int value="2275" label="FileAccessedSharedWorker"/> </enum> <enum name="FeedbackSource"> @@ -25109,6 +25139,7 @@ label="AutofillToolkitViewsCreditCardDialogsMac:disabled"/> <int value="-802348444" label="disable-site-engagement-service"/> <int value="-798187384" label="try-supported-channel-layouts"/> + <int value="-795854288" label="enable-draw-occlusion"/> <int value="-795600188" label="disable-async-dns"/> <int value="-793921836" label="ShowAllDialogsWithViewsToolkit:disabled"/> <int value="-790036192" label="overscroll-start-threshold"/> @@ -26056,6 +26087,7 @@ <int value="1825940786" label="ChromeHomePromo:disabled"/> <int value="1827369558" label="AndroidPayIntegrationV1:disabled"/> <int value="1828660283" label="enable-webfonts-intervention-trigger"/> + <int value="1830460973" label="disable-network-settings-config"/> <int value="1831835753" label="MaterialDesignIncognitoNTP:enabled"/> <int value="1835523483" label="OmniboxUIExperimentSwapTitleAndUrl:enabled"/> <int value="1838990777" label="V8Future:enabled"/> @@ -26452,6 +26484,12 @@ </int> </enum> +<enum name="MalformedResponseResult"> + <int value="0" label="Success"/> + <int value="1" label="Malformed"/> + <int value="2" label="Other failure"/> +</enum> + <enum name="ManagedUserPasswordChange"> <int value="0" label="OK_MANAGER">Changed in manager session</int> <int value="1" label="OK_MANGED">Changed in supervised user session</int> @@ -27594,6 +27632,17 @@ <int value="8" label="Seek forward"/> </enum> +<enum name="MediaSinkType"> + <int value="0" label="Cast"/> + <int value="1" label="Cast Audio Group"/> + <int value="2" label="Cast Audio"/> + <int value="3" label="Meeting"/> + <int value="4" label="Hangout"/> + <int value="5" label="Cast for Education"/> + <int value="6" label="Wired Display"/> + <int value="7" label="Generic"/> +</enum> + <enum name="MediaStreamRequestResult"> <int value="0" label="Ok"/> <int value="1" label="Permission Denied"/> @@ -43481,6 +43530,8 @@ label="Failed to load assets from disk (component version 0.1)."/> <int value="1002" label="Assets have an invalid content (component version 0.1)."/> + <int value="1000003" + label="Assets file(s) not found (component version 1.0)."/> </enum> <enum name="VRComponentStatus">
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 1efde27..57ca6e87 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -925,6 +925,32 @@ <summary>Recorded when a download is opened.</summary> </histogram> +<histogram name="Android.DownloadManager.List.View.Action" + enum="Android.DownloadManager.List.View.Actions"> + <owner>dtrainor@chromium.org</owner> + <summary>The count of Download Home list entry actions taken.</summary> +</histogram> + +<histogram name="Android.DownloadManager.Menu.Action" + enum="Android.DownloadManager.Menu.Actions"> + <owner>dtrainor@chromium.org</owner> + <summary>The count of Download Home top level menu actions taken.</summary> +</histogram> + +<histogram name="Android.DownloadManager.Menu.Delete.SelectedCount"> + <owner>dtrainor@chromium.org</owner> + <summary> + The number of items selected when performing a multi-delete action. + </summary> +</histogram> + +<histogram name="Android.DownloadManager.Menu.Share.SelectedCount"> + <owner>dtrainor@chromium.org</owner> + <summary> + The number of items selected when performing a multi-share action. + </summary> +</histogram> + <histogram name="Android.DownloadManager.NotificationInteraction" enum="DownloadNotificationInteractions"> <owner>jming@chromium.org</owner> @@ -16197,6 +16223,12 @@ <summary>Microseconds spent in beforeunload.</summary> </histogram> +<histogram name="DocumentEventTiming.FreezeDuration" units="microseconds"> + <owner>panicker@chromium.org</owner> + <owner>fmeawad@chromium.org</owner> + <summary>Microseconds spent in onfreeze.</summary> +</histogram> + <histogram name="DocumentEventTiming.PageHideDuration" units="microseconds"> <owner>panicker@chromium.org</owner> <summary>Microseconds spent in pagehide.</summary> @@ -16208,6 +16240,12 @@ <summary>Microseconds spent in vibilitychange (hidden).</summary> </histogram> +<histogram name="DocumentEventTiming.ResumeDuration" units="microseconds"> + <owner>panicker@chromium.org</owner> + <owner>fmeawad@chromium.org</owner> + <summary>Microseconds spent in onresume.</summary> +</histogram> + <histogram name="DocumentEventTiming.UnloadDuration" units="microseconds"> <owner>panicker@chromium.org</owner> <summary>Microseconds spent in unload.</summary> @@ -36209,6 +36247,14 @@ </summary> </histogram> +<histogram name="MediaRouter.Sink.SelectedType" enum="MediaSinkType"> + <owner>takumif@chromium.org</owner> + <summary> + The type of the Media Sink that media is being Cast to. Recorded each time + the user selects a Media Sink to start Casting. + </summary> +</histogram> + <histogram name="MediaRouter.Source.CastingSource" enum="MediaRouterSourceTypes"> <owner>paezagon@chromium.org</owner> @@ -42359,6 +42405,17 @@ </summary> </histogram> +<histogram name="Net.DNS.ResultAfterMalformedResponse" + enum="MalformedResponseResult"> + <owner>mgersh@chromium.org</owner> + <summary> + When DnsUDPAttempt gets a malformed response, it returns an error but + continues running. This histogram records all attempt outcomes that are + returned to the transaction once a malformed response has been received, + including the original malformed response. + </summary> +</histogram> + <histogram name="Net.DNS.TotalTime" units="ms"> <owner>mgersh@chromium.org</owner> <summary> @@ -57768,6 +57825,10 @@ <histogram name="PageLoad.Experimental.Renderer.FirstMeaningfulPaintDetector.FirstMeaningfulPaintOrdering" enum="FirstMeaningfulPaintOrdering"> + <obsolete> + Renamed to + PageLoad.Internal.Renderer.FirstMeaningfulPaintDetector.FirstMeaningfulPaintOrdering + </obsolete> <owner>ksakamoto@chromium.org</owner> <summary> Whether the two variants of First Meaningful Paint reported different @@ -57778,6 +57839,10 @@ <histogram name="PageLoad.Experimental.Renderer.FirstMeaningfulPaintDetector.HadNetworkQuiet" enum="NetworkQuietStatus"> + <obsolete> + Renamed to + PageLoad.Internal.Renderer.FirstMeaningfulPaintDetector.HadNetworkQuiet + </obsolete> <owner>ksakamoto@chromium.org</owner> <summary> Recorded when the page load reached network 0-quiet (no active network @@ -58019,6 +58084,30 @@ </summary> </histogram> +<histogram + name="PageLoad.Internal.Renderer.FirstMeaningfulPaintDetector.FirstMeaningfulPaintOrdering" + enum="FirstMeaningfulPaintOrdering"> + <owner>ksakamoto@chromium.org</owner> + <summary> + Whether the two variants of First Meaningful Paint reported different + values, and if so, which one was reported first. + </summary> +</histogram> + +<histogram + name="PageLoad.Internal.Renderer.FirstMeaningfulPaintDetector.HadNetworkQuiet" + enum="NetworkQuietStatus"> + <owner>ksakamoto@chromium.org</owner> + <summary> + Recorded when the page load reached network 0-quiet (no active network + connection for 0.5 seconds), or network 2-quiet (no more than 2 active + network connections for 2 seconds). + PageLoad.Experimental.PaintTiming.FirstMeaningfulPaintSignalStatus2 + histogram gives the fraction of page loads that had network 2-quiet, so it + can be used as a baseline. + </summary> +</histogram> + <histogram name="PageLoad.Internal.Renderer.PaintTiming.SwapResult" enum="SwapResult"> <owner>panicker@chromium.org</owner> @@ -94504,6 +94593,15 @@ </summary> </histogram> +<histogram name="WebApk.Launch.NetworkError" enum="NetErrorCodes"> + <owner>hanxi@chromium.org</owner> + <owner>pkotwicz@chromium.org</owner> + <owner>yfriedman@chromium.org</owner> + <summary> + Records the error codes when a WebAPK is launched with network failures. + </summary> +</histogram> + <histogram name="WebApk.LaunchInterval" units="ms"> <owner>hanxi@chromium.org</owner> <owner>pkotwicz@chromium.org</owner> @@ -106631,6 +106729,12 @@ <suffix name="Clients.MultiTabLoading" label="PageLoadMetrics for page loads that started while there are other loading tabs."/> + <suffix name="Clients.MultiTabLoading.2OrMore" + label="PageLoadMetrics for page loads that started while there are 2 or + more other loading tabs."/> + <suffix name="Clients.MultiTabLoading.5OrMore" + label="PageLoadMetrics for page loads that started while there are 5 or + more other loading tabs."/> <affected-histogram name="PageLoad.DocumentTiming.NavigationToDOMContentLoadedEventFired"/> <affected-histogram
diff --git a/tools/metrics/ukm/ukm.xml b/tools/metrics/ukm/ukm.xml index f27277e..e6cabd23 100644 --- a/tools/metrics/ukm/ukm.xml +++ b/tools/metrics/ukm/ukm.xml
@@ -816,14 +816,51 @@ <metric name="AudioVideo.SRC"/> </event> +<event name="Media.WebMediaPlayerState"> + <owner>dalecurtis@chromium.org</owner> + <owner>media-dev@chromium.org</owner> + <summary> + Final state of WebMediaPlayerImpl instance. Records only immutable playback + properties. Contains a PlaybackID which links to Media.BasicPlayback events. + </summary> + <metric name="FinalPipelineStatus"> + <summary> + media::PipelineStatus enum value. Always 0 if the playback succeeded; all + other values indicate the playback ended in an error. + </summary> + </metric> + <metric name="IsMSE"> + <summary> + Boolean value indicating if this event is for an MSE playback. If false it + means this was a SRC playback. + </summary> + </metric> + <metric name="IsTopFrame"> + <summary> + Flag indicating whether the report comes from the top frame or some inner + frame. For privacy, metrics from inner frames are recorded with the top + frame's origin, so this flag helps separate top frame vs. embedded + playbacks. + </summary> + </metric> + <metric name="PlayerID"> + <summary> + ID which corresponds to a given WebMediaPlayerImpl instance. May be linked + with Media.BasicPlayback events to understand a playback more deeply. + </summary> + </metric> +</event> + <event name="Media.BasicPlayback"> <owner>dalecurtis@chromium.org</owner> <owner>media-dev@chromium.org</owner> <summary> - Core metrics associated with a media playback. Only recorded if a playback - qualifies for WatchTime recording (see Media.WatchTime metrics). Reported at - the time of WebMediaPlayer destruction or render process termination; - whichever comes first. + Core metrics associated with a media playback through WebMediaPlayerImpl. + Reported at the time of WatchTimeRecorder destruction or render process + termination; whichever comes first. There will be multiple entries for a + given playback; one for every PlaybackProperties change as well as one for + foreground and background. Records may be aggregated based on PlayerID and + correlated with the Media.WebMediaPlayerState event. </summary> <metric name="AudioCodec"> <summary> @@ -878,6 +915,12 @@ the number of rebuffering events. </summary> </metric> + <metric name="PlayerID"> + <summary> + ID which corresponds to a given WebMediaPlayerImpl instance. May be linked + with Media.WebMediaPlayerState events to understand playback more deeply. + </summary> + </metric> <metric name="RebuffersCount"> <summary> Integer count of the number of times playback experienced rebuffering. @@ -1050,6 +1093,12 @@ Integer representing width of video natural size. </summary> </metric> + <metric name="Video.PlayerID"> + <summary> + ID which corresponds to a given WebMediaPlayerImpl instance. May be linked + with Media.WebMediaPlayerState events to understand playback more deeply. + </summary> + </metric> </event> <event name="Memory.Experimental">
diff --git a/tools/perf/benchmarks/blink_perf.py b/tools/perf/benchmarks/blink_perf.py index c366653d..5f9bcbe 100644 --- a/tools/perf/benchmarks/blink_perf.py +++ b/tools/perf/benchmarks/blink_perf.py
@@ -267,15 +267,7 @@ tab.EvaluateJavaScript('testRunner.scheduleTestRun()') tab.WaitForJavaScriptCondition('testRunner.isDone') - trace_data = tab.browser.platform.tracing_controller.StopTracing() - - # TODO(charliea): This is part of a three-sided Chromium/Telemetry patch - # where we're changing the return type of StopTracing from a TraceValue to a - # (TraceValue, nonfatal_exception_list) tuple. Once the tuple return value - # lands in Chromium, the non-tuple logic should be deleted. - if isinstance(trace_data, tuple): - trace_data = trace_data[0] - + trace_data = tab.browser.platform.tracing_controller.StopTracing()[0] return trace_data
diff --git a/tools/perf/benchmarks/smoothness.py b/tools/perf/benchmarks/smoothness.py index f6482b6..cb013755 100644 --- a/tools/perf/benchmarks/smoothness.py +++ b/tools/perf/benchmarks/smoothness.py
@@ -56,9 +56,6 @@ self.DisableStory('http://www.amazon.com', [story_module.expectations.ALL], 'crbug.com/667432') - self.DisableStory('https://mail.google.com/mail/', - [story_module.expectations.ALL_WIN], - 'crbug.com/750147') self.DisableStory('Docs (1 open document tab)', [story_module.expectations.ALL_WIN], 'crbug.com/762165') @@ -772,7 +769,10 @@ def GetExpectations(self): class StoryExpectations(story_module.expectations.StoryExpectations): - pass # Nothing. + def SetExpectations(self): + self.DisableStory('extra_large_texture_uploads.html', + [story_module.expectations.ANDROID_ONE], + 'crbug.com/795060') return StoryExpectations()
diff --git a/tools/perf/chromium.perf.fyi.extras.json b/tools/perf/chromium.perf.fyi.extras.json index 5111204..500614ddd 100644 --- a/tools/perf/chromium.perf.fyi.extras.json +++ b/tools/perf/chromium.perf.fyi.extras.json
@@ -371,6 +371,78 @@ "ignore_task_failure": false, "io_timeout": 360 } + }, + { + "args": [ + "heap_profiling.mobile.disabled", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=android-chromium" + ], + "isolate_name": "telemetry_perf_tests", + "name": "heap_profiling.mobile.disabled", + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "id": "build46-b1--device2", + "pool": "Chrome-perf-fyi" + } + ], + "expiration": 3600, + "hard_timeout": 1080, + "ignore_task_failure": false, + "io_timeout": 360 + } + }, + { + "args": [ + "heap_profiling.mobile.native", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=android-chromium" + ], + "isolate_name": "telemetry_perf_tests", + "name": "heap_profiling.mobile.native", + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "id": "build46-b1--device2", + "pool": "Chrome-perf-fyi" + } + ], + "expiration": 3600, + "hard_timeout": 1080, + "ignore_task_failure": false, + "io_timeout": 360 + } + }, + { + "args": [ + "heap_profiling.mobile.pseudo", + "-v", + "--upload-results", + "--output-format=chartjson", + "--browser=android-chromium" + ], + "isolate_name": "telemetry_perf_tests", + "name": "heap_profiling.mobile.pseudo", + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "id": "build46-b1--device2", + "pool": "Chrome-perf-fyi" + } + ], + "expiration": 3600, + "hard_timeout": 1080, + "ignore_task_failure": false, + "io_timeout": 360 + } } ] },
diff --git a/tools/perf/contrib/oilpan/oilpan_gc_times.py b/tools/perf/contrib/oilpan/oilpan_gc_times.py index 4da631c..1f345f8d 100644 --- a/tools/perf/contrib/oilpan/oilpan_gc_times.py +++ b/tools/perf/contrib/oilpan/oilpan_gc_times.py
@@ -146,15 +146,7 @@ def ValidateAndMeasurePage(self, page, tab, results): del page # unused - timeline_data = tab.browser.platform.tracing_controller.StopTracing() - - # TODO(charliea): This is part of a three-sided Chromium/Telemetry patch - # where we're changing the return type of StopTracing from a TraceValue to a - # (TraceValue, nonfatal_exception_list) tuple. Once the tuple return value - # lands in Chromium, the non-tuple logic should be deleted. - if isinstance(timeline_data, tuple): - timeline_data = timeline_data[0] - + timeline_data = tab.browser.platform.tracing_controller.StopTracing()[0] timeline_model = TimelineModel(timeline_data) threads = timeline_model.GetAllThreads() for thread in threads:
diff --git a/tools/perf/core/perf_data_generator.py b/tools/perf/core/perf_data_generator.py index d2667491..57c9d58 100755 --- a/tools/perf/core/perf_data_generator.py +++ b/tools/perf/core/perf_data_generator.py
@@ -844,7 +844,7 @@ BENCHMARK_SWARMING_TIMEOUTS = { 'loading.desktop': 14400, # 4 hours (crbug.com/753798) 'loading.mobile': 16200, # 4.5 hours - 'system_health.memory_mobile': 10800, # 3 hours + 'system_health.memory_mobile': 14400, # 4 hours (crbug.com/775242) 'system_health.memory_desktop': 10800, # 3 hours }
diff --git a/tools/perf/core/story_expectation_validator.py b/tools/perf/core/story_expectation_validator.py index 0d95d9eb..91afa73 100755 --- a/tools/perf/core/story_expectation_validator.py +++ b/tools/perf/core/story_expectation_validator.py
@@ -4,6 +4,7 @@ # found in the LICENSE file. """Script to check validity of StoryExpectations.""" +import optparse import argparse import json import os @@ -38,24 +39,30 @@ 'information. \nBenchmark: %s' % benchmark.Name()) -def validate_story_names(benchmarks): +def validate_story_names(benchmarks, raw_expectations_data): for benchmark in benchmarks: if benchmark.Name() in CLUSTER_TELEMETRY_BENCHMARKS: continue b = benchmark() + b.AugmentExpectationsWithParser(raw_expectations_data) options = browser_options.BrowserFinderOptions() - # tabset_repeat is needed for tab_switcher benchmarks. - options.tabset_repeat = 1 - # test_path required for blink_perf benchmark in contrib/. - options.test_path = '' - # shared_prefs_file required for benchmarks in contrib/vr_benchmarks/ - options.shared_prefs_file = '' + + # Add default values for any extra commandline options + # provided by the benchmark. + parser = optparse.OptionParser() + before, _ = parser.parse_args([]) + benchmark.AddBenchmarkCommandLineArgs(parser) + after, _ = parser.parse_args([]) + for extra_option in dir(after): + if extra_option not in dir(before): + setattr(options, extra_option, getattr(after, extra_option)) + story_set = b.CreateStorySet(options) failed_stories = b.GetBrokenExpectations(story_set) assert not failed_stories, 'Incorrect story names: %s' % str(failed_stories) -def GetDisabledStories(benchmarks): +def GetDisabledStories(benchmarks, raw_expectations_data): # Creates a dictionary of the format: # { # 'benchmark_name1' : { @@ -71,7 +78,9 @@ for benchmark in benchmarks: name = benchmark.Name() disables[name] = {} - expectations = benchmark().GetExpectations().AsDict()['stories'] + b = benchmark() + b.AugmentExpectationsWithParser(raw_expectations_data) + expectations = b.expectations.AsDict()['stories'] for story in expectations: for conditions, reason in expectations[story]: if not disables[name].get(story): @@ -89,11 +98,12 @@ help=('Prints list of disabled stories.')) options = parser.parse_args(args) benchmarks = benchmark_finders.GetAllBenchmarks() - + with open(path_util.GetExpectationsPath()) as fp: + raw_expectations_data = fp.read() if options.list: - stories = GetDisabledStories(benchmarks) + stories = GetDisabledStories(benchmarks, raw_expectations_data) print json.dumps(stories, sort_keys=True, indent=4, separators=(',', ': ')) else: - validate_story_names(benchmarks) + validate_story_names(benchmarks, raw_expectations_data) check_decorators(benchmarks) return 0
diff --git a/tools/perf/core/story_expectation_validator_unittest.py b/tools/perf/core/story_expectation_validator_unittest.py new file mode 100644 index 0000000..702a3b9 --- /dev/null +++ b/tools/perf/core/story_expectation_validator_unittest.py
@@ -0,0 +1,71 @@ +# Copyright 2017 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +import unittest + +from core import story_expectation_validator + +from telemetry import benchmark +from telemetry import story + +class FakePage(object): + def __init__(self, name): + self._name = name + + @property + def name(self): + return self._name + + +class FakeStorySetOne(story.StorySet): + def __init__(self): # pylint: disable=super-init-not-called + self._stories = [ + FakePage('One'), + FakePage('Two') + ] + + @property + def stories(self): + return self._stories + + +class FakeBenchmark(benchmark.Benchmark): + @classmethod + def Name(cls): + return 'b1' + + def CreateStorySet(self, options): + return FakeStorySetOne() + + +class StoryExpectationValidatorTest(unittest.TestCase): + def testValidateStoryInValidName(self): + raw_expectations = '# tags: Mac\ncrbug.com/123 [ Mac ] b1/s1 [ Skip ]' + benchmarks = [FakeBenchmark] + with self.assertRaises(AssertionError): + story_expectation_validator.validate_story_names( + benchmarks, raw_expectations) + + def testValidateStoryValidName(self): + raw_expectations = '# tags: Mac\ncrbug.com/123 [ Mac ] b1/One [ Skip ]' + benchmarks = [FakeBenchmark] + # If a name is invalid, an exception is thrown. If no exception is thrown + # all story names are valid. That is why there is no assert here. + story_expectation_validator.validate_story_names( + benchmarks, raw_expectations) + + def testGetDisabledStoriesWithExpectationsData(self): + raw_expectations = '# tags: Mac\ncrbug.com/123 [ Mac ] b1/One [ Skip ]' + benchmarks = [FakeBenchmark] + results = story_expectation_validator.GetDisabledStories( + benchmarks, raw_expectations) + expected = {'b1': {'One': [(['Mac'], 'crbug.com/123')]}} + self.assertEqual(expected, results) + + def testGetDisabledStoriesWithoutMatchingExpectationsData(self): + raw_expectations = '# tags: Mac\ncrbug.com/123 [ Mac ] b2/One [ Skip ]' + benchmarks = [FakeBenchmark] + results = story_expectation_validator.GetDisabledStories( + benchmarks, raw_expectations) + expected = { 'b1': {}} + self.assertEqual(expected, results)
diff --git a/tools/perf/measurements/clock_domain_test.py b/tools/perf/measurements/clock_domain_test.py index 783f33e..46c1919 100644 --- a/tools/perf/measurements/clock_domain_test.py +++ b/tools/perf/measurements/clock_domain_test.py
@@ -25,14 +25,7 @@ options.enable_chrome_trace = True tracing_controller.StartTracing(options) - full_trace = tracing_controller.StopTracing() - - # TODO(charliea): This is part of a three-sided Chromium/Telemetry patch - # where we're changing the return type of StopTracing from a TraceValue to a - # (TraceValue, nonfatal_exception_list) tuple. Once the tuple return value - # lands in Chromium, the non-tuple logic should be deleted. - if isinstance(full_trace, tuple): - full_trace = full_trace[0] + full_trace = tracing_controller.StopTracing()[0] chrome_sync = GetSyncEvents( full_trace.GetTraceFor(trace_data.CHROME_TRACE_PART)['traceEvents'])
diff --git a/tools/perf/measurements/draw_properties.py b/tools/perf/measurements/draw_properties.py index 0bbe7c2..ba84406 100644 --- a/tools/perf/measurements/draw_properties.py +++ b/tools/perf/measurements/draw_properties.py
@@ -38,15 +38,7 @@ def ValidateAndMeasurePage(self, page, tab, results): del page # unused - timeline_data = tab.browser.platform.tracing_controller.StopTracing() - - # TODO(charliea): This is part of a three-sided Chromium/Telemetry patch - # where we're changing the return type of StopTracing from a TraceValue to a - # (TraceValue, nonfatal_exception_list) tuple. Once the tuple return value - # lands in Chromium, the non-tuple logic should be deleted. - if isinstance(timeline_data, tuple): - timeline_data = timeline_data[0] - + timeline_data = tab.browser.platform.tracing_controller.StopTracing()[0] timeline_model = model.TimelineModel(timeline_data) pt_avg = self.ComputeAverageOfDurations(
diff --git a/tools/perf/measurements/image_decoding.py b/tools/perf/measurements/image_decoding.py index c7e8a1a..27bc37b 100644 --- a/tools/perf/measurements/image_decoding.py +++ b/tools/perf/measurements/image_decoding.py
@@ -48,15 +48,7 @@ tab.browser.platform.tracing_controller.StartTracing(config) def ValidateAndMeasurePage(self, page, tab, results): - timeline_data = tab.browser.platform.tracing_controller.StopTracing() - - # TODO(charliea): This is part of a three-sided Chromium/Telemetry patch - # where we're changing the return type of StopTracing from a TraceValue to a - # (TraceValue, nonfatal_exception_list) tuple. Once the tuple return value - # lands in Chromium, the non-tuple logic should be deleted. - if isinstance(timeline_data, tuple): - timeline_data = timeline_data[0] - + timeline_data = tab.browser.platform.tracing_controller.StopTracing()[0] timeline_model = model.TimelineModel(timeline_data) self._power_metric.Stop(page, tab) self._power_metric.AddResults(tab, results)
diff --git a/tools/perf/measurements/smoothness.py b/tools/perf/measurements/smoothness.py index 15d28e9..d96c716 100644 --- a/tools/perf/measurements/smoothness.py +++ b/tools/perf/measurements/smoothness.py
@@ -58,15 +58,7 @@ def ValidateAndMeasurePage(self, _, tab, results): self._results = results - trace_result = tab.browser.platform.tracing_controller.StopTracing() - - # TODO(charliea): This is part of a three-sided Chromium/Telemetry patch - # where we're changing the return type of StopTracing from a TraceValue to a - # (TraceValue, nonfatal_exception_list) tuple. Once the tuple return value - # lands in Chromium, the non-tuple logic should be deleted. - if isinstance(trace_result, tuple): - trace_result = trace_result[0] - + trace_result = tab.browser.platform.tracing_controller.StopTracing()[0] trace_value = trace.TraceValue( results.current_page, trace_result, file_path=results.telemetry_info.trace_local_path, @@ -83,16 +75,8 @@ def DidRunPage(self, platform): if platform.tracing_controller.is_tracing_running: - trace_result = platform.tracing_controller.StopTracing() + trace_result = platform.tracing_controller.StopTracing()[0] if self._results: - - # TODO(charliea): This is part of a three-sided Chromium/Telemetry patch - # where we're changing the return type of StopTracing from a TraceValue - # to a (TraceValue, nonfatal_exception_list) tuple. Once the tuple - # return value lands in Chromium, the non-tuple logic should be deleted. - if isinstance(trace_result, tuple): - trace_result = trace_result[0] - trace_value = trace.TraceValue( self._results.current_page, trace_result, file_path=self._results.telemetry_info.trace_local_path,
diff --git a/tools/perf/measurements/task_execution_time.py b/tools/perf/measurements/task_execution_time.py index dd4ba57..b8a9fc4a 100644 --- a/tools/perf/measurements/task_execution_time.py +++ b/tools/perf/measurements/task_execution_time.py
@@ -53,15 +53,7 @@ def ValidateAndMeasurePage(self, page, tab, results): del page # unused - trace_data = tab.browser.platform.tracing_controller.StopTracing() - - # TODO(charliea): This is part of a three-sided Chromium/Telemetry patch - # where we're changing the return type of StopTracing from a TraceValue to a - # (TraceValue, nonfatal_exception_list) tuple. Once the tuple return value - # lands in Chromium, the non-tuple logic should be deleted. - if isinstance(trace_data, tuple): - trace_data = trace_data[0] - + trace_data = tab.browser.platform.tracing_controller.StopTracing()[0] timeline_model = TimelineModel(trace_data) self._renderer_process = timeline_model.GetRendererProcessFromTabId(tab.id)
diff --git a/tools/perf/measurements/timeline_controller.py b/tools/perf/measurements/timeline_controller.py index efc5da72..6b25d2340 100644 --- a/tools/perf/measurements/timeline_controller.py +++ b/tools/perf/measurements/timeline_controller.py
@@ -52,14 +52,7 @@ if self._enable_auto_issuing_record: self._interaction.End() # Stop tracing. - timeline_data = tab.browser.platform.tracing_controller.StopTracing() - - # TODO(charliea): This is part of a three-sided Chromium/Telemetry patch - # where we're changing the return type of StopTracing from a TraceValue to a - # (TraceValue, nonfatal_exception_list) tuple. Once the tuple return value - # lands in Chromium, the non-tuple logic should be deleted. - if isinstance(timeline_data, tuple): - timeline_data = timeline_data[0] + timeline_data = tab.browser.platform.tracing_controller.StopTracing()[0] # TODO(#763375): Rely on results.telemetry_info.trace_local_path/etc. kwargs = {}
diff --git a/tools/perf/measurements/v8_gc_times.py b/tools/perf/measurements/v8_gc_times.py index f1e33658..3658eb2 100644 --- a/tools/perf/measurements/v8_gc_times.py +++ b/tools/perf/measurements/v8_gc_times.py
@@ -34,15 +34,7 @@ def ValidateAndMeasurePage(self, page, tab, results): del page # unused - trace_data = tab.browser.platform.tracing_controller.StopTracing() - - # TODO(charliea): This is part of a three-sided Chromium/Telemetry patch - # where we're changing the return type of StopTracing from a TraceValue to a - # (TraceValue, nonfatal_exception_list) tuple. Once the tuple return value - # lands in Chromium, the non-tuple logic should be deleted. - if isinstance(trace_data, tuple): - trace_data = trace_data[0] - + trace_data = tab.browser.platform.tracing_controller.StopTracing()[0] timeline_model = TimelineModel(trace_data) renderer_process = timeline_model.GetRendererProcessFromTabId(tab.id)
diff --git a/tools/perf/page_sets/data/key_desktop_move_cases.json b/tools/perf/page_sets/data/key_desktop_move_cases.json index ad5c0328..8863b32 100644 --- a/tools/perf/page_sets/data/key_desktop_move_cases.json +++ b/tools/perf/page_sets/data/key_desktop_move_cases.json
@@ -4,7 +4,7 @@ "DEFAULT": "key_desktop_move_cases_000.wprgo" }, "https://mail.google.com/mail/": { - "DEFAULT": "key_desktop_move_cases_002.wprgo" + "DEFAULT": "key_desktop_move_cases_003.wprgo" } }, "description": "Describes the Web Page Replay archives for a story set. Don't edit by hand! Use record_wpr for updating.",
diff --git a/tools/perf/page_sets/data/key_desktop_move_cases_002.wprgo.sha1 b/tools/perf/page_sets/data/key_desktop_move_cases_002.wprgo.sha1 deleted file mode 100644 index 3fa537cb..0000000 --- a/tools/perf/page_sets/data/key_desktop_move_cases_002.wprgo.sha1 +++ /dev/null
@@ -1 +0,0 @@ -ef581f08a71089465e81b6fe4bc72e6ddde33766 \ No newline at end of file
diff --git a/tools/perf/page_sets/data/key_desktop_move_cases_003.wprgo.sha1 b/tools/perf/page_sets/data/key_desktop_move_cases_003.wprgo.sha1 new file mode 100644 index 0000000..a0dcbd2 --- /dev/null +++ b/tools/perf/page_sets/data/key_desktop_move_cases_003.wprgo.sha1
@@ -0,0 +1 @@ +06c5f3ca6c64cb49b196a5e474809863ff885669 \ No newline at end of file
diff --git a/tools/perf/page_sets/data/top_25_013.wprgo.sha1 b/tools/perf/page_sets/data/top_25_013.wprgo.sha1 new file mode 100644 index 0000000..5e460596 --- /dev/null +++ b/tools/perf/page_sets/data/top_25_013.wprgo.sha1
@@ -0,0 +1 @@ +306b98519ae8358a05df451793f59e6827db1166 \ No newline at end of file
diff --git a/tools/perf/page_sets/data/top_25_smooth.json b/tools/perf/page_sets/data/top_25_smooth.json index 941cecb..ec21775 100644 --- a/tools/perf/page_sets/data/top_25_smooth.json +++ b/tools/perf/page_sets/data/top_25_smooth.json
@@ -70,7 +70,7 @@ "DEFAULT": "top_25_000.wprgo" }, "https://mail.google.com/mail/": { - "DEFAULT": "top_25_006.wprgo" + "DEFAULT": "top_25_013.wprgo" }, "https://plus.google.com/110031535020051778989/posts": { "DEFAULT": "top_25_010.wprgo"
diff --git a/ui/accelerated_widget_mac/ca_layer_tree_coordinator.mm b/ui/accelerated_widget_mac/ca_layer_tree_coordinator.mm index 8efd427..9bc48ec 100644 --- a/ui/accelerated_widget_mac/ca_layer_tree_coordinator.mm +++ b/ui/accelerated_widget_mac/ca_layer_tree_coordinator.mm
@@ -52,6 +52,7 @@ current_ca_renderer_layer_tree_.swap(pending_ca_renderer_layer_tree_); } else { TRACE_EVENT0("gpu", "Blank frame: No overlays or CALayers"); + DLOG(WARNING) << "Blank frame: No overlays or CALayers"; [root_ca_layer_ setSublayers:nil]; current_ca_renderer_layer_tree_.reset(); }
diff --git a/ui/accessibility/platform/ax_platform_node_win.cc b/ui/accessibility/platform/ax_platform_node_win.cc index af33b00..85a012a8 100644 --- a/ui/accessibility/platform/ax_platform_node_win.cc +++ b/ui/accessibility/platform/ax_platform_node_win.cc
@@ -1052,14 +1052,11 @@ return S_OK; } - // After this point, the role based special cases should test for an empty - // result. - + // For range controls, e.g. sliders and spin buttons, |ax_attr_value| holds + // the aria-valuetext if present but not the inner text. The actual value, + // provided either via aria-valuenow or the actual control's value is held in + // |AX_ATTR_VALUE_FOR_RANGE|. result = target->GetString16Attribute(AX_ATTR_VALUE); - - // - // RangeValue (Use AX_ATTR_VALUE_FOR_RANGE) - // if (result.empty() && target->IsRangeValueSupported()) { float fval; if (target->GetFloatAttribute(AX_ATTR_VALUE_FOR_RANGE, &fval)) { @@ -1070,7 +1067,6 @@ } } - // Last resort (Use innerText) if (result.empty() && target->IsRichTextField()) result = target->GetInnerText(); @@ -2914,7 +2910,11 @@ return ROLE_SYSTEM_GROUPING; case AX_ROLE_WINDOW: - return ROLE_SYSTEM_WINDOW; + // Do not return ROLE_SYSTEM_WINDOW as that is a special MSAA system role + // used to indicate a real native window object. It is automatically + // created by oleacc.dll as a parent of the root of our hierarchy, + // matching the HWND. + return ROLE_SYSTEM_APPLICATION; // TODO(dmazzoni): figure out the proper MSAA role for roles listed below. case AX_ROLE_BLOCKQUOTE:
diff --git a/ui/base/clipboard/clipboard_aurax11.cc b/ui/base/clipboard/clipboard_aurax11.cc index eaa2dd1..3745f43 100644 --- a/ui/base/clipboard/clipboard_aurax11.cc +++ b/ui/base/clipboard/clipboard_aurax11.cc
@@ -42,8 +42,6 @@ const char kClipboard[] = "CLIPBOARD"; const char kClipboardManager[] = "CLIPBOARD_MANAGER"; const char kMimeTypeFilename[] = "chromium/filename"; -const char kSaveTargets[] = "SAVE_TARGETS"; -const char kTargets[] = "TARGETS"; ///////////////////////////////////////////////////////////////////////////////
diff --git a/ui/base/x/selection_owner.cc b/ui/base/x/selection_owner.cc index 7a3f881..cefa609 100644 --- a/ui/base/x/selection_owner.cc +++ b/ui/base/x/selection_owner.cc
@@ -16,24 +16,25 @@ namespace ui { +const char kIncr[] = "INCR"; +const char kSaveTargets[] = "SAVE_TARGETS"; +const char kTargets[] = "TARGETS"; + namespace { const char kAtomPair[] = "ATOM_PAIR"; -const char kIncr[] = "INCR"; const char kMultiple[] = "MULTIPLE"; -const char kSaveTargets[] = "SAVE_TARGETS"; -const char kTargets[] = "TARGETS"; const char kTimestamp[] = "TIMESTAMP"; // The period of |incremental_transfer_abort_timer_|. Arbitrary but must be <= // than kIncrementalTransferTimeoutMs. -const int kTimerPeriodMs = 1000; +const int KSelectionOwnerTimerPeriodMs = 1000; // The amount of time to wait for the selection requestor to process the data // sent by the selection owner before aborting an incremental data transfer. const int kIncrementalTransferTimeoutMs = 10000; -static_assert(kTimerPeriodMs <= kIncrementalTransferTimeoutMs, +static_assert(KSelectionOwnerTimerPeriodMs <= kIncrementalTransferTimeoutMs, "timer period must be <= transfer timeout"); // Returns a conservative max size of the data we can pass into @@ -261,9 +262,8 @@ if (!incremental_transfer_abort_timer_.IsRunning()) { incremental_transfer_abort_timer_.Start( FROM_HERE, - base::TimeDelta::FromMilliseconds(kTimerPeriodMs), - this, - &SelectionOwner::AbortStaleIncrementalTransfers); + base::TimeDelta::FromMilliseconds(KSelectionOwnerTimerPeriodMs), + this, &SelectionOwner::AbortStaleIncrementalTransfers); } } else { XChangeProperty(
diff --git a/ui/base/x/selection_owner.h b/ui/base/x/selection_owner.h index d995dc4..e1c5a95 100644 --- a/ui/base/x/selection_owner.h +++ b/ui/base/x/selection_owner.h
@@ -22,6 +22,10 @@ class XScopedEventSelector; +extern const char kIncr[]; +extern const char kSaveTargets[]; +extern const char kTargets[]; + // Owns a specific X11 selection on an X window. // // The selection owner object keeps track of which xwindow is the current
diff --git a/ui/base/x/selection_requestor.cc b/ui/base/x/selection_requestor.cc index 0f84a12d..ccd65a4d 100644 --- a/ui/base/x/selection_requestor.cc +++ b/ui/base/x/selection_requestor.cc
@@ -7,6 +7,7 @@ #include <algorithm> #include "base/run_loop.h" +#include "ui/base/x/selection_owner.h" #include "ui/base/x/selection_utils.h" #include "ui/base/x/x11_util.h" #include "ui/events/platform/platform_event_dispatcher.h" @@ -20,16 +21,15 @@ namespace { const char kChromeSelection[] = "CHROME_SELECTION"; -const char kIncr[] = "INCR"; // The period of |abort_timer_|. Arbitrary but must be <= than // kRequestTimeoutMs. -const int kTimerPeriodMs = 100; +const int KSelectionRequestorTimerPeriodMs = 100; // The amount of time to wait for a request to complete before aborting it. const int kRequestTimeoutMs = 10000; -static_assert(kTimerPeriodMs <= kRequestTimeoutMs, +static_assert(KSelectionRequestorTimerPeriodMs <= kRequestTimeoutMs, "timer period must be <= request timeout"); // Combines |data| into a single RefCountedMemory object. @@ -256,10 +256,10 @@ void SelectionRequestor::BlockTillSelectionNotifyForRequest(Request* request) { if (PlatformEventSource::GetInstance()) { if (!abort_timer_.IsRunning()) { - abort_timer_.Start(FROM_HERE, - base::TimeDelta::FromMilliseconds(kTimerPeriodMs), - this, - &SelectionRequestor::AbortStaleRequests); + abort_timer_.Start( + FROM_HERE, + base::TimeDelta::FromMilliseconds(KSelectionRequestorTimerPeriodMs), + this, &SelectionRequestor::AbortStaleRequests); } base::RunLoop run_loop(base::RunLoop::Type::kNestableTasksAllowed);
diff --git a/ui/compositor/BUILD.gn b/ui/compositor/BUILD.gn index de6c1b76..0382921 100644 --- a/ui/compositor/BUILD.gn +++ b/ui/compositor/BUILD.gn
@@ -100,11 +100,7 @@ if (is_win && use_aura) { # TODO(sky): before we make this real need to remove # IDR_BITMAP_BRUSH_IMAGE. - deps += [ - "//third_party/angle:libEGL", - "//third_party/angle:libGLESv2", - "//ui/resources", - ] + deps += [ "//ui/resources" ] } }
diff --git a/ui/compositor/test/in_process_context_factory.cc b/ui/compositor/test/in_process_context_factory.cc index 4e67c9d..6fb94ea 100644 --- a/ui/compositor/test/in_process_context_factory.cc +++ b/ui/compositor/test/in_process_context_factory.cc
@@ -270,9 +270,10 @@ auto* display = per_compositor_data_[compositor.get()]->display.get(); auto layer_tree_frame_sink = std::make_unique<viz::DirectLayerTreeFrameSink>( compositor->frame_sink_id(), GetHostFrameSinkManager(), - GetFrameSinkManager(), display, context_provider, - shared_worker_context_provider_, compositor->task_runner(), - &gpu_memory_buffer_manager_, &shared_bitmap_manager_); + GetFrameSinkManager(), display, nullptr /* display_client */, + context_provider, shared_worker_context_provider_, + compositor->task_runner(), &gpu_memory_buffer_manager_, + &shared_bitmap_manager_); compositor->SetLayerTreeFrameSink(std::move(layer_tree_frame_sink)); data->display->Resize(compositor->size());
diff --git a/ui/gfx/color_transform.cc b/ui/gfx/color_transform.cc index f100238..548a963 100644 --- a/ui/gfx/color_transform.cc +++ b/ui/gfx/color_transform.cc
@@ -969,6 +969,12 @@ if (!src_.IsValid()) return; + // SMPTEST2084_NON_HDR is not a valid destination. + if (dst.transfer_ == ColorSpace::TransferID::SMPTEST2084_NON_HDR) { + DLOG(ERROR) << "Invalid dst transfer function, returning identity."; + return; + } + // If the target color space is not defined, just apply the adjust and // tranfer matrices. This path is used by YUV to RGB color conversion // when full color conversion is not enabled.
diff --git a/ui/gfx/color_transform_unittest.cc b/ui/gfx/color_transform_unittest.cc index 906aded..34cd62a 100644 --- a/ui/gfx/color_transform_unittest.cc +++ b/ui/gfx/color_transform_unittest.cc
@@ -23,7 +23,7 @@ ColorSpace::PrimaryID::SMPTEST431_2, ColorSpace::PrimaryID::SMPTEST432_1, }; -ColorSpace::TransferID all_transfers[] = { +ColorSpace::TransferID simple_transfers[] = { ColorSpace::TransferID::BT709, ColorSpace::TransferID::GAMMA22, ColorSpace::TransferID::GAMMA28, @@ -40,9 +40,12 @@ ColorSpace::TransferID::SMPTEST2084, ColorSpace::TransferID::ARIB_STD_B67, ColorSpace::TransferID::IEC61966_2_1_HDR, - // This one is weird as the non-linear numbers are not between 0 and 1. - // TODO(hubbe): Test this separately. - // ColorSpace::TransferID::SMPTEST428_1, +}; + +// This one is weird as the non-linear numbers are not between 0 and 1. +ColorSpace::TransferID noninvertible_transfers[] = { + ColorSpace::TransferID::SMPTEST428_1, + ColorSpace::TransferID::SMPTEST2084_NON_HDR, }; ColorSpace::TransferID extended_transfers[] = { @@ -494,7 +497,7 @@ space_linear, space_with_transfer, ColorTransform::Intent::INTENT_ABSOLUTE)); - // The transforms will ahve 1 or 0 steps (0 for linear). + // The transforms will have 1 or 0 steps (0 for linear). size_t expected_steps = 1u; if (GetParam() == ColorSpace::TransferID::LINEAR) expected_steps = 0u; @@ -511,7 +514,37 @@ INSTANTIATE_TEST_CASE_P(ColorSpace, TransferTest, - testing::ValuesIn(all_transfers)); + testing::ValuesIn(simple_transfers)); + +class NonInvertibleTransferTest + : public testing::TestWithParam<ColorSpace::TransferID> {}; + +TEST_P(NonInvertibleTransferTest, basicTest) { + gfx::ColorSpace space_with_transfer(ColorSpace::PrimaryID::BT709, GetParam(), + ColorSpace::MatrixID::RGB, + ColorSpace::RangeID::FULL); + gfx::ColorSpace space_linear( + ColorSpace::PrimaryID::BT709, ColorSpace::TransferID::LINEAR, + ColorSpace::MatrixID::RGB, ColorSpace::RangeID::FULL); + + std::unique_ptr<ColorTransform> to_linear(ColorTransform::NewColorTransform( + space_with_transfer, space_linear, + ColorTransform::Intent::INTENT_ABSOLUTE)); + + std::unique_ptr<ColorTransform> from_linear(ColorTransform::NewColorTransform( + space_linear, space_with_transfer, + ColorTransform::Intent::INTENT_ABSOLUTE)); + + // These transforms should not crash when created or applied. + float x = 0.5; + ColorTransform::TriStim tristim(x, x, x); + to_linear->Transform(&tristim, 1); + from_linear->Transform(&tristim, 1); +} + +INSTANTIATE_TEST_CASE_P(ColorSpace, + NonInvertibleTransferTest, + testing::ValuesIn(noninvertible_transfers)); class ExtendedTransferTest : public testing::TestWithParam<ColorSpace::TransferID> {}; @@ -592,7 +625,7 @@ A, ColorSpaceTest, testing::Combine(testing::ValuesIn(all_primaries), - testing::ValuesIn(all_transfers), + testing::ValuesIn(simple_transfers), testing::Values(ColorSpace::MatrixID::BT709), testing::Values(ColorSpace::RangeID::LIMITED), testing::ValuesIn(intents))); @@ -601,7 +634,7 @@ B, ColorSpaceTest, testing::Combine(testing::Values(ColorSpace::PrimaryID::BT709), - testing::ValuesIn(all_transfers), + testing::ValuesIn(simple_transfers), testing::ValuesIn(all_matrices), testing::ValuesIn(all_ranges), testing::ValuesIn(intents)));
diff --git a/ui/gfx/render_text_harfbuzz.cc b/ui/gfx/render_text_harfbuzz.cc index ca1c8788..91b533d 100644 --- a/ui/gfx/render_text_harfbuzz.cc +++ b/ui/gfx/render_text_harfbuzz.cc
@@ -137,6 +137,16 @@ return scripts_size != 0; } +// When a string of "unusual" characters ends, the run usually breaks. However, +// variation selectors should still attach to the run of unusual characters. +// Detect this situation so that FindRunBreakingCharacter() can continue +// tracking the unusual block. Otherwise, just returns |current|. +UBlockCode MaybeCombineUnusualBlock(UBlockCode preceding, UBlockCode current) { + return IsUnusualBlockCode(preceding) && current == UBLOCK_VARIATION_SELECTORS + ? preceding + : current; +} + // Returns the boundary between a special and a regular character. Special // characters are brackets or characters that satisfy |IsUnusualBlockCode|. size_t FindRunBreakingCharacter(const base::string16& text, @@ -156,7 +166,8 @@ while (iter.Advance() && iter.array_pos() < run_length) { const UChar32 current_char = iter.get(); - const UBlockCode current_block = ublock_getCode(current_char); + const UBlockCode current_block = + MaybeCombineUnusualBlock(first_block, ublock_getCode(current_char)); const bool block_break = current_block != first_block && (first_block_unusual || IsUnusualBlockCode(current_block)); if (block_break || current_char == '\n' || @@ -1126,8 +1137,13 @@ pos = std::min(selection.caret_pos() + 1, text().length()); while (iter.Advance()) { pos = iter.pos(); - if (iter.IsWord() && pos > selection.caret_pos()) + if (iter.IsWord() && pos > selection.caret_pos()) { + // In Windows, word move advances past any characters separating the + // end of the current word from the next word. + while (iter.Advance() && !iter.IsWord()) + pos = iter.pos(); break; + } } } else { // direction == CURSOR_LEFT // Notes: We always iterate words from the beginning.
diff --git a/ui/gfx/render_text_unittest.cc b/ui/gfx/render_text_unittest.cc index a376b95..9985ce3 100644 --- a/ui/gfx/render_text_unittest.cc +++ b/ui/gfx/render_text_unittest.cc
@@ -50,6 +50,7 @@ #if defined(OS_MACOSX) #include <ApplicationServices/ApplicationServices.h> +#include "base/mac/mac_util.h" #include "ui/gfx/render_text_mac.h" #endif @@ -541,6 +542,50 @@ return GetSubstringBoundsUnion(render_text_->selection()); } + // Checks left-to-right text, ensuring that the caret moves to the right as + // the cursor position increments through the logical text. Also ensures that + // each glyph is to the right of the prior glyph. RenderText automatically + // updates invalid cursor positions (eg. between a surrogate pair) to a valid + // neighbor, so the positions may be unchanged for some iterations. Invoking + // this in a test gives coverage of the sanity checks in functions such as + // TextRunHarfBuzz::GetGraphemeBounds() which rely on sensible glyph positions + // being provided by installed typefaces. + void CheckBoundsForCursorPositions() { + ASSERT_FALSE(render_text_->text().empty()); + + // Use a wide display rect to avoid scrolling. + render_text_->SetDisplayRect(gfx::Rect(0, 0, 1000, 50)); + test_api()->EnsureLayout(); + EXPECT_LT(render_text_->GetContentWidthF(), + render_text_->display_rect().width()); + + // Assume LTR for now. + int max_cursor_x = 0; + int max_glyph_x = 0, max_glyph_right = 0; + + for (size_t i = 0; i <= render_text_->text().size(); ++i) { + render_text_->SetCursorPosition(i); + + SCOPED_TRACE(testing::Message() + << "Cursor position: " << i + << " selection: " << render_text_->selection().ToString()); + + const gfx::Rect cursor_bounds = render_text_->GetUpdatedCursorBounds(); + + // The cursor should always be one pixel wide. + EXPECT_EQ(1, cursor_bounds.width()); + EXPECT_LE(max_cursor_x, cursor_bounds.x()); + max_cursor_x = cursor_bounds.x(); + + const gfx::Rect glyph_bounds = + render_text_->GetCursorBounds(render_text_->selection_model(), false); + EXPECT_LE(max_glyph_x, glyph_bounds.x()); + EXPECT_LE(max_glyph_right, glyph_bounds.right()); + max_glyph_x = glyph_bounds.x(); + max_glyph_right = glyph_bounds.right(); + } + } + Canvas* canvas() { return &canvas_; } TestSkiaTextRenderer* renderer() { return &renderer_; } test::RenderTextTestApi* test_api() { return test_api_.get(); }; @@ -1354,8 +1399,13 @@ SELECTION_NONE, &expected); // Move right twice. +#if defined(OS_WIN) // Move word right includes space/punctuation. + expected.push_back(Range(4)); + expected.push_back(Range(8)); +#else // Non-Windows: move word right does NOT include space/punctuation. expected.push_back(Range(3)); expected.push_back(Range(7)); +#endif RunMoveCursorTestAndClearExpectations(render_text, WORD_BREAK, CURSOR_RIGHT, SELECTION_NONE, &expected); @@ -1369,7 +1419,11 @@ // Move right twice. expected.push_back(Range(6)); +#if defined(OS_WIN) // Select word right includes space/punctuation. + expected.push_back(Range(6, 8)); +#else // Non-Windows: select word right does NOT include space/punctuation. expected.push_back(Range(6, 7)); +#endif RunMoveCursorTestAndClearExpectations(render_text, WORD_BREAK, CURSOR_RIGHT, SELECTION_CARET, &expected); @@ -1387,7 +1441,11 @@ SELECTION_RETAIN, &expected); // Move right twice. +#if defined(OS_WIN) // Select word right includes space/punctuation. + expected.push_back(Range(6, 8)); +#else // Non-Windows: select word right does NOT include space/punctuation. expected.push_back(Range(6, 7)); +#endif expected.push_back(Range(6, 11)); RunMoveCursorTestAndClearExpectations(render_text, WORD_BREAK, CURSOR_RIGHT, SELECTION_RETAIN, &expected); @@ -1406,7 +1464,11 @@ SELECTION_EXTEND, &expected); // Move right twice. +#if defined(OS_WIN) // Select word right includes space/punctuation. + expected.push_back(Range(4, 8)); +#else // Non-Windows: select word right does NOT include space/punctuation. expected.push_back(Range(4, 7)); +#endif expected.push_back(Range(4, 11)); RunMoveCursorTestAndClearExpectations(render_text, WORD_BREAK, CURSOR_RIGHT, SELECTION_EXTEND, &expected); @@ -3928,6 +3990,112 @@ EXPECT_EQ("[0][1->2][3][4]", GetRunListStructureString()); } +TEST_P(RenderTextHarfBuzzTest, HarfBuzz_BreakRunsByEmojiVariationSelectors) { + constexpr int kGlyphWidth = 30; + SetGlyphWidth(30); + RenderTextHarfBuzz* render_text = GetRenderTextHarfBuzz(); + + // ☎ (U+260E BLACK TELEPHONE) and U+FE0F (a variation selector) combine to + // form (on some platforms), ☎️, a red (or blue) telephone. The run can + // not break between the codepoints, or the incorrect glyph will be chosen. + render_text->SetText(WideToUTF16(L"z\u260E\uFE0Fy")); + render_text->SetDisplayRect(Rect(1000, 50)); + test_api()->EnsureLayout(); + EXPECT_EQ(ToString16Vec({"z", "☎\uFE0F", "y"}), GetRunListStrings()); + EXPECT_EQ("[0][1->2][3]", GetRunListStructureString()); + + // Also test moving the cursor across the telephone. + EXPECT_EQ(gfx::Range(0, 0), render_text->selection()); + EXPECT_EQ(0, render_text->GetUpdatedCursorBounds().x()); + render_text->MoveCursor(CHARACTER_BREAK, CURSOR_RIGHT, SELECTION_NONE); + EXPECT_EQ(gfx::Range(1, 1), render_text->selection()); + EXPECT_EQ(1 * kGlyphWidth, render_text->GetUpdatedCursorBounds().x()); + +#if defined(OS_MACOSX) + // Early versions of macOS provide a tofu glyph for the variation selector. + // Bail out early except on 10.12 and above. + if (base::mac::IsAtMostOS10_11()) + return; +#endif + + // Jump over the telephone: two codepoints, but a single glyph. + render_text->MoveCursor(CHARACTER_BREAK, CURSOR_RIGHT, SELECTION_NONE); + EXPECT_EQ(gfx::Range(3, 3), render_text->selection()); + EXPECT_EQ(2 * kGlyphWidth, render_text->GetUpdatedCursorBounds().x()); + + render_text->MoveCursor(CHARACTER_BREAK, CURSOR_RIGHT, SELECTION_NONE); + EXPECT_EQ(gfx::Range(4, 4), render_text->selection()); + EXPECT_EQ(3 * kGlyphWidth, render_text->GetUpdatedCursorBounds().x()); + + // Nothing else. + render_text->MoveCursor(CHARACTER_BREAK, CURSOR_RIGHT, SELECTION_NONE); + EXPECT_EQ(gfx::Range(4, 4), render_text->selection()); + EXPECT_EQ(3 * kGlyphWidth, render_text->GetUpdatedCursorBounds().x()); +} + +TEST_P(RenderTextHarfBuzzTest, HarfBuzz_OrphanedVariationSelector) { + RenderTextHarfBuzz* render_text = GetRenderTextHarfBuzz(); + + // It should never happen in normal usage, but a variation selector can appear + // by itself. In this case, it can form its own text run, with no glyphs. + render_text->SetText(WideToUTF16(L"\uFE0F")); + test_api()->EnsureLayout(); + EXPECT_EQ(ToString16Vec({"\uFE0F"}), GetRunListStrings()); + EXPECT_EQ("[0]", GetRunListStructureString()); + CheckBoundsForCursorPositions(); +} + +TEST_P(RenderTextHarfBuzzTest, HarfBuzz_AsciiVariationSelector) { + RenderTextHarfBuzz* render_text = GetRenderTextHarfBuzz(); + + // A variation selector doesn't have to appear with Emoji. It will probably + // cause the typesetter to render tofu in this case, but it should not break + // a text run. + render_text->SetText(WideToUTF16(L"z\uFE0Fy")); + test_api()->EnsureLayout(); + EXPECT_EQ(ToString16Vec({"z\uFE0Fy"}), GetRunListStrings()); + EXPECT_EQ("[0->2]", GetRunListStructureString()); + CheckBoundsForCursorPositions(); +} + +TEST_P(RenderTextHarfBuzzTest, HarfBuzz_LeadingVariationSelector) { + RenderTextHarfBuzz* render_text = GetRenderTextHarfBuzz(); + + // When a variation selector appears either side of an emoji, ensure the one + // after is in the same run. + render_text->SetText(WideToUTF16(L"\uFE0F\u260E\uFE0Fy")); + test_api()->EnsureLayout(); + EXPECT_EQ(ToString16Vec({"\uFE0F", "☎\uFE0F", "y"}), GetRunListStrings()); + EXPECT_EQ("[0][1->2][3]", GetRunListStructureString()); + CheckBoundsForCursorPositions(); +} + +TEST_P(RenderTextHarfBuzzTest, HarfBuzz_TrailingVariationSelector) { + RenderTextHarfBuzz* render_text = GetRenderTextHarfBuzz(); + + // If a redundant variation selector appears in an emoji run, it also gets + // merged into the emoji run. Usually there should be no effect. That's + // ultimately up to the typeface but, however it choses, cursor and glyph + // positions should behave. + render_text->SetText(WideToUTF16(L"z\u260E\uFE0F\uFE0Fy")); + test_api()->EnsureLayout(); + EXPECT_EQ(ToString16Vec({"z", "☎\uFE0F\uFE0F", "y"}), GetRunListStrings()); + EXPECT_EQ("[0][1->3][4]", GetRunListStructureString()); + CheckBoundsForCursorPositions(); +} + +TEST_P(RenderTextHarfBuzzTest, HarfBuzz_MultipleVariationSelectorEmoji) { + RenderTextHarfBuzz* render_text = GetRenderTextHarfBuzz(); + + // Two emoji with variation selectors appearing in a correct sequence should + // be in the same run. + render_text->SetText(WideToUTF16(L"z\u260E\uFE0F\u260E\uFE0Fy")); + test_api()->EnsureLayout(); + EXPECT_EQ(ToString16Vec({"z", "☎\uFE0F☎\uFE0F", "y"}), GetRunListStrings()); + EXPECT_EQ("[0][1->4][5]", GetRunListStructureString()); + CheckBoundsForCursorPositions(); +} + TEST_P(RenderTextHarfBuzzTest, HarfBuzz_BreakRunsByAscii) { RenderTextHarfBuzz* render_text = GetRenderTextHarfBuzz();
diff --git a/ui/gfx/selection_bound.cc b/ui/gfx/selection_bound.cc index 9be1c60..ac5e9eb 100644 --- a/ui/gfx/selection_bound.cc +++ b/ui/gfx/selection_bound.cc
@@ -5,6 +5,7 @@ #include <algorithm> #include "base/macros.h" +#include "base/strings/stringprintf.h" #include "ui/gfx/geometry/point_conversions.h" #include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect_f.h" @@ -38,6 +39,13 @@ return edge_bottom_rounded_.y() - edge_top_rounded_.y(); } +std::string SelectionBound::ToString() const { + return base::StringPrintf( + "SelectionBound(%s, %s, %s, %s, %d)", edge_top_.ToString().c_str(), + edge_bottom_.ToString().c_str(), edge_top_rounded_.ToString().c_str(), + edge_bottom_rounded_.ToString().c_str(), visible_); +} + bool operator==(const SelectionBound& lhs, const SelectionBound& rhs) { return lhs.type() == rhs.type() && lhs.visible() == rhs.visible() && lhs.edge_top() == rhs.edge_top() &&
diff --git a/ui/gfx/selection_bound.h b/ui/gfx/selection_bound.h index ac66466..d1b0e7b7 100644 --- a/ui/gfx/selection_bound.h +++ b/ui/gfx/selection_bound.h
@@ -42,6 +42,8 @@ // Returns the vertical difference between rounded top and bottom. int GetHeight() const; + std::string ToString() const; + private: Type type_; gfx::PointF edge_top_;
diff --git a/ui/gl/BUILD.gn b/ui/gl/BUILD.gn index 04c0777..4df23df92 100644 --- a/ui/gl/BUILD.gn +++ b/ui/gl/BUILD.gn
@@ -6,6 +6,7 @@ import("//build/config/chrome_build.gni") import("//build/config/linux/pkg_config.gni") import("//build/config/ui.gni") +import("//ui/gl/features.gni") import("//ui/ozone/ozone.gni") import("//testing/test.gni") @@ -25,7 +26,10 @@ buildflag_header("gl_features") { header = "gl_features.h" - flags = [ "ENABLE_SWIFTSHADER=$enable_swiftshader" ] + flags = [ + "ENABLE_SWIFTSHADER=$enable_swiftshader", + "USE_STATIC_ANGLE=$use_static_angle", + ] } config("gl_config") { @@ -118,6 +122,8 @@ "gl_surface_stub.h", "gl_switches.cc", "gl_switches.h", + "gl_switches_util.cc", + "gl_switches_util.h", "gl_utils.cc", "gl_utils.h", "gl_version_info.cc", @@ -196,6 +202,10 @@ "gl_image_ahardwarebuffer.cc", "gl_image_ahardwarebuffer.h", ] + + if (use_static_angle) { + deps += [ "//third_party/angle:libEGL_static" ] + } } if (is_posix) {
diff --git a/ui/gl/egl_api_unittest.cc b/ui/gl/egl_api_unittest.cc index 1d8babc..b535fdb 100644 --- a/ui/gl/egl_api_unittest.cc +++ b/ui/gl/egl_api_unittest.cc
@@ -18,13 +18,14 @@ fake_extension_string_ = ""; // TODO(dyen): Add a way to bind mock drivers for testing. - g_driver_egl.ClearBindings(); - g_driver_egl.fn.eglInitializeFn = &FakeInitialize; - g_driver_egl.fn.eglQueryStringFn = &FakeQueryString; - g_driver_egl.fn.eglGetCurrentDisplayFn = &FakeGetCurrentDisplay; - g_driver_egl.fn.eglGetDisplayFn = &FakeGetDisplay; - g_driver_egl.fn.eglGetErrorFn = &FakeGetError; - g_driver_egl.fn.eglGetProcAddressFn = &FakeGetProcAddress; + auto writer = base::AutoWritableMemory::Create(g_driver_egl); + g_driver_egl->ClearBindings(); + g_driver_egl->fn.eglInitializeFn = &FakeInitialize; + g_driver_egl->fn.eglQueryStringFn = &FakeQueryString; + g_driver_egl->fn.eglGetCurrentDisplayFn = &FakeGetCurrentDisplay; + g_driver_egl->fn.eglGetDisplayFn = &FakeGetDisplay; + g_driver_egl->fn.eglGetErrorFn = &FakeGetError; + g_driver_egl->fn.eglGetProcAddressFn = &FakeGetProcAddress; SetGLImplementation(kGLImplementationEGLGLES2); } @@ -32,7 +33,8 @@ void TearDown() override { g_current_egl_context = nullptr; api_.reset(nullptr); - g_driver_egl.ClearBindings(); + auto writer = base::AutoWritableMemory::Create(g_driver_egl); + g_driver_egl->ClearBindings(); fake_client_extension_string_ = ""; fake_extension_string_ = ""; @@ -41,13 +43,14 @@ void InitializeAPI(const char* disabled_extensions) { api_.reset(new RealEGLApi()); g_current_egl_context = api_.get(); - api_->Initialize(&g_driver_egl); + api_->Initialize(&*g_driver_egl); if (disabled_extensions) { SetDisabledExtensionsEGL(disabled_extensions); } - g_driver_egl.InitializeClientExtensionBindings(); + auto writer = base::AutoWritableMemory::Create(g_driver_egl); + g_driver_egl->InitializeClientExtensionBindings(); GLSurfaceEGL::InitializeDisplay(EGL_DEFAULT_DISPLAY); - g_driver_egl.InitializeExtensionBindings(); + g_driver_egl->InitializeExtensionBindings(); } void SetFakeExtensionString(const char* fake_string, @@ -113,11 +116,11 @@ SetFakeExtensionString(kFakeExtensions, kFakeClientExtensions); InitializeAPI(nullptr); - EXPECT_TRUE(g_driver_egl.ext.b_EGL_KHR_fence_sync); + EXPECT_TRUE(g_driver_egl->ext.b_EGL_KHR_fence_sync); InitializeAPI(kFakeDisabledExtensions); - EXPECT_FALSE(g_driver_egl.ext.b_EGL_KHR_fence_sync); + EXPECT_FALSE(g_driver_egl->ext.b_EGL_KHR_fence_sync); } TEST_F(EGLApiTest, DisabledExtensionStringTest) {
diff --git a/ui/gl/features.gni b/ui/gl/features.gni new file mode 100644 index 0000000..7e948472f --- /dev/null +++ b/ui/gl/features.gni
@@ -0,0 +1,9 @@ +# Copyright 2017 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +declare_args() { + # Whether ANGLE should be linked statically + # False by default, enabling currently supported only on Android + use_static_angle = false +}
diff --git a/ui/gl/generate_bindings.py b/ui/gl/generate_bindings.py index f5c2c990..a559a5d 100755 --- a/ui/gl/generate_bindings.py +++ b/ui/gl/generate_bindings.py
@@ -2661,7 +2661,9 @@ """Generates gl_bindings_autogen_x.cc""" set_header_name = "ui/gl/gl_" + set_name.lower() + "_api_implementation.h" - include_list = [ 'base/trace_event/trace_event.h', + include_list = [ 'base/compiler_specific.h', + 'base/memory/protected_memory.h', + 'base/trace_event/trace_event.h', 'ui/gl/gl_enums.h', 'ui/gl/gl_bindings.h', 'ui/gl/gl_context.h', @@ -2685,8 +2687,12 @@ file.write('\n') if set_name != 'gl': - file.write('Driver%s g_driver_%s; // Exists in .bss\n' % ( - set_name.upper(), set_name.lower())) + file.write('// Place the driver in protected memory so that it is set\n') + file.write('// read-only after it is initialized, preventing it from\n') + file.write('// being tampered with. See http://crbug.com/771365.\n') + file.write('PROTECTED_MEMORY_SECTION base::ProtectedMemory<Driver%s>\n' % + set_name.upper()) + file.write(' g_driver_%s;\n' % set_name.lower()) file.write('\n') # Write stub functions that take the place of some functions before a context @@ -2858,6 +2864,7 @@ return_type = func['return_type'] arguments = func['arguments'] file.write('\n') + file.write('DISABLE_CFI_ICALL\n') file.write('%s %sApiBase::%sFn(%s) {\n' % (return_type, set_name.upper(), function_name, arguments)) argument_names = MakeArgNames(arguments) @@ -2875,6 +2882,7 @@ return_type = func['return_type'] arguments = func['arguments'] file.write('\n') + file.write('DISABLE_CFI_ICALL\n') file.write('%s Trace%sApi::%sFn(%s) {\n' % (return_type, set_name.upper(), function_name, arguments)) argument_names = MakeArgNames(arguments) @@ -2893,6 +2901,7 @@ return_type = func['return_type'] arguments = func['arguments'] file.write('\n') + file.write('DISABLE_CFI_ICALL\n') file.write('%s Debug%sApi::%sFn(%s) {\n' % (return_type, set_name.upper(), func['known_as'], arguments)) argument_names = re.sub(
diff --git a/ui/gl/gl_bindings.h b/ui/gl/gl_bindings.h index 2fc96618..52ecce7f 100644 --- a/ui/gl/gl_bindings.h +++ b/ui/gl/gl_bindings.h
@@ -37,6 +37,7 @@ #include <string> #include "base/logging.h" +#include "base/memory/protected_memory.h" #include "base/threading/thread_local.h" #include "build/build_config.h" #include "ui/gl/extension_set.h" @@ -529,21 +530,21 @@ GL_EXPORT extern base::ThreadLocalPointer<CurrentGL>* g_current_gl_context_tls; GL_EXPORT extern OSMESAApi* g_current_osmesa_context; -GL_EXPORT extern DriverOSMESA g_driver_osmesa; +GL_EXPORT extern base::ProtectedMemory<DriverOSMESA> g_driver_osmesa; #if defined(USE_EGL) GL_EXPORT extern EGLApi* g_current_egl_context; -GL_EXPORT extern DriverEGL g_driver_egl; +GL_EXPORT extern base::ProtectedMemory<DriverEGL> g_driver_egl; #endif #if defined(OS_WIN) GL_EXPORT extern WGLApi* g_current_wgl_context; -GL_EXPORT extern DriverWGL g_driver_wgl; +GL_EXPORT extern base::ProtectedMemory<DriverWGL> g_driver_wgl; #endif #if defined(USE_GLX) GL_EXPORT extern GLXApi* g_current_glx_context; -GL_EXPORT extern DriverGLX g_driver_glx; +GL_EXPORT extern base::ProtectedMemory<DriverGLX> g_driver_glx; #endif } // namespace gl
diff --git a/ui/gl/gl_bindings_autogen_egl.cc b/ui/gl/gl_bindings_autogen_egl.cc index 4a1c1ed..6007320a 100644 --- a/ui/gl/gl_bindings_autogen_egl.cc +++ b/ui/gl/gl_bindings_autogen_egl.cc
@@ -10,6 +10,8 @@ #include <string> +#include "base/compiler_specific.h" +#include "base/memory/protected_memory.h" #include "base/trace_event/trace_event.h" #include "ui/gl/gl_bindings.h" #include "ui/gl/gl_context.h" @@ -20,7 +22,10 @@ namespace gl { -DriverEGL g_driver_egl; // Exists in .bss +// Place the driver in protected memory so that it is set +// read-only after it is initialized, preventing it from +// being tampered with. See http://crbug.com/771365. +PROTECTED_MEMORY_SECTION base::ProtectedMemory<DriverEGL> g_driver_egl; void DriverEGL::InitializeStaticBindings() { // Ensure struct has been zero-initialized. @@ -355,16 +360,19 @@ memset(this, 0, sizeof(*this)); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglBindAPIFn(EGLenum api) { return driver_->fn.eglBindAPIFn(api); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglBindTexImageFn(EGLDisplay dpy, EGLSurface surface, EGLint buffer) { return driver_->fn.eglBindTexImageFn(dpy, surface, buffer); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglChooseConfigFn(EGLDisplay dpy, const EGLint* attrib_list, EGLConfig* configs, @@ -374,6 +382,7 @@ num_config); } +DISABLE_CFI_ICALL EGLint EGLApiBase::eglClientWaitSyncKHRFn(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, @@ -381,12 +390,14 @@ return driver_->fn.eglClientWaitSyncKHRFn(dpy, sync, flags, timeout); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglCopyBuffersFn(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target) { return driver_->fn.eglCopyBuffersFn(dpy, surface, target); } +DISABLE_CFI_ICALL EGLContext EGLApiBase::eglCreateContextFn(EGLDisplay dpy, EGLConfig config, EGLContext share_context, @@ -395,6 +406,7 @@ attrib_list); } +DISABLE_CFI_ICALL EGLImageKHR EGLApiBase::eglCreateImageKHRFn(EGLDisplay dpy, EGLContext ctx, EGLenum target, @@ -403,6 +415,7 @@ return driver_->fn.eglCreateImageKHRFn(dpy, ctx, target, buffer, attrib_list); } +DISABLE_CFI_ICALL EGLSurface EGLApiBase::eglCreatePbufferFromClientBufferFn( EGLDisplay dpy, EGLenum buftype, @@ -413,12 +426,14 @@ config, attrib_list); } +DISABLE_CFI_ICALL EGLSurface EGLApiBase::eglCreatePbufferSurfaceFn(EGLDisplay dpy, EGLConfig config, const EGLint* attrib_list) { return driver_->fn.eglCreatePbufferSurfaceFn(dpy, config, attrib_list); } +DISABLE_CFI_ICALL EGLSurface EGLApiBase::eglCreatePixmapSurfaceFn(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, @@ -426,11 +441,13 @@ return driver_->fn.eglCreatePixmapSurfaceFn(dpy, config, pixmap, attrib_list); } +DISABLE_CFI_ICALL EGLStreamKHR EGLApiBase::eglCreateStreamKHRFn(EGLDisplay dpy, const EGLint* attrib_list) { return driver_->fn.eglCreateStreamKHRFn(dpy, attrib_list); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglCreateStreamProducerD3DTextureANGLEFn( EGLDisplay dpy, EGLStreamKHR stream, @@ -439,12 +456,14 @@ attrib_list); } +DISABLE_CFI_ICALL EGLSyncKHR EGLApiBase::eglCreateSyncKHRFn(EGLDisplay dpy, EGLenum type, const EGLint* attrib_list) { return driver_->fn.eglCreateSyncKHRFn(dpy, type, attrib_list); } +DISABLE_CFI_ICALL EGLSurface EGLApiBase::eglCreateWindowSurfaceFn(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, @@ -452,32 +471,39 @@ return driver_->fn.eglCreateWindowSurfaceFn(dpy, config, win, attrib_list); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglDestroyContextFn(EGLDisplay dpy, EGLContext ctx) { return driver_->fn.eglDestroyContextFn(dpy, ctx); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglDestroyImageKHRFn(EGLDisplay dpy, EGLImageKHR image) { return driver_->fn.eglDestroyImageKHRFn(dpy, image); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglDestroyStreamKHRFn(EGLDisplay dpy, EGLStreamKHR stream) { return driver_->fn.eglDestroyStreamKHRFn(dpy, stream); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglDestroySurfaceFn(EGLDisplay dpy, EGLSurface surface) { return driver_->fn.eglDestroySurfaceFn(dpy, surface); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglDestroySyncKHRFn(EGLDisplay dpy, EGLSyncKHR sync) { return driver_->fn.eglDestroySyncKHRFn(dpy, sync); } +DISABLE_CFI_ICALL EGLint EGLApiBase::eglDupNativeFenceFDANDROIDFn(EGLDisplay dpy, EGLSyncKHR sync) { return driver_->fn.eglDupNativeFenceFDANDROIDFn(dpy, sync); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglExportDMABUFImageMESAFn(EGLDisplay dpy, EGLImageKHR image, int* fds, @@ -487,6 +513,7 @@ offsets); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglExportDMABUFImageQueryMESAFn( EGLDisplay dpy, EGLImageKHR image, @@ -497,6 +524,7 @@ num_planes, modifiers); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglGetCompositorTimingANDROIDFn( EGLDisplay dpy, EGLSurface surface, @@ -507,6 +535,7 @@ dpy, surface, numTimestamps, names, values); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglGetCompositorTimingSupportedANDROIDFn( EGLDisplay dpy, EGLSurface surface, @@ -515,6 +544,7 @@ timestamp); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglGetConfigAttribFn(EGLDisplay dpy, EGLConfig config, EGLint attribute, @@ -522,6 +552,7 @@ return driver_->fn.eglGetConfigAttribFn(dpy, config, attribute, value); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglGetConfigsFn(EGLDisplay dpy, EGLConfig* configs, EGLint config_size, @@ -529,26 +560,32 @@ return driver_->fn.eglGetConfigsFn(dpy, configs, config_size, num_config); } +DISABLE_CFI_ICALL EGLContext EGLApiBase::eglGetCurrentContextFn(void) { return driver_->fn.eglGetCurrentContextFn(); } +DISABLE_CFI_ICALL EGLDisplay EGLApiBase::eglGetCurrentDisplayFn(void) { return driver_->fn.eglGetCurrentDisplayFn(); } +DISABLE_CFI_ICALL EGLSurface EGLApiBase::eglGetCurrentSurfaceFn(EGLint readdraw) { return driver_->fn.eglGetCurrentSurfaceFn(readdraw); } +DISABLE_CFI_ICALL EGLDisplay EGLApiBase::eglGetDisplayFn(EGLNativeDisplayType display_id) { return driver_->fn.eglGetDisplayFn(display_id); } +DISABLE_CFI_ICALL EGLint EGLApiBase::eglGetErrorFn(void) { return driver_->fn.eglGetErrorFn(); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglGetFrameTimestampsANDROIDFn(EGLDisplay dpy, EGLSurface surface, EGLuint64KHR frameId, @@ -559,6 +596,7 @@ dpy, surface, frameId, numTimestamps, timestamps, values); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglGetFrameTimestampSupportedANDROIDFn( EGLDisplay dpy, EGLSurface surface, @@ -567,17 +605,20 @@ timestamp); } +DISABLE_CFI_ICALL EGLClientBuffer EGLApiBase::eglGetNativeClientBufferANDROIDFn( const struct AHardwareBuffer* ahardwarebuffer) { return driver_->fn.eglGetNativeClientBufferANDROIDFn(ahardwarebuffer); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglGetNextFrameIdANDROIDFn(EGLDisplay dpy, EGLSurface surface, EGLuint64KHR* frameId) { return driver_->fn.eglGetNextFrameIdANDROIDFn(dpy, surface, frameId); } +DISABLE_CFI_ICALL EGLDisplay EGLApiBase::eglGetPlatformDisplayEXTFn(EGLenum platform, void* native_display, const EGLint* attrib_list) { @@ -585,11 +626,13 @@ attrib_list); } +DISABLE_CFI_ICALL __eglMustCastToProperFunctionPointerType EGLApiBase::eglGetProcAddressFn( const char* procname) { return driver_->fn.eglGetProcAddressFn(procname); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglGetSyncAttribKHRFn(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, @@ -597,6 +640,7 @@ return driver_->fn.eglGetSyncAttribKHRFn(dpy, sync, attribute, value); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglGetSyncValuesCHROMIUMFn(EGLDisplay dpy, EGLSurface surface, EGLuint64CHROMIUM* ust, @@ -605,6 +649,7 @@ return driver_->fn.eglGetSyncValuesCHROMIUMFn(dpy, surface, ust, msc, sbc); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglImageFlushExternalEXTFn( EGLDisplay dpy, EGLImageKHR image, @@ -612,12 +657,14 @@ return driver_->fn.eglImageFlushExternalEXTFn(dpy, image, attrib_list); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglInitializeFn(EGLDisplay dpy, EGLint* major, EGLint* minor) { return driver_->fn.eglInitializeFn(dpy, major, minor); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglMakeCurrentFn(EGLDisplay dpy, EGLSurface draw, EGLSurface read, @@ -625,6 +672,7 @@ return driver_->fn.eglMakeCurrentFn(dpy, draw, read, ctx); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglPostSubBufferNVFn(EGLDisplay dpy, EGLSurface surface, EGLint x, @@ -634,11 +682,13 @@ return driver_->fn.eglPostSubBufferNVFn(dpy, surface, x, y, width, height); } +DISABLE_CFI_ICALL EGLint EGLApiBase::eglProgramCacheGetAttribANGLEFn(EGLDisplay dpy, EGLenum attrib) { return driver_->fn.eglProgramCacheGetAttribANGLEFn(dpy, attrib); } +DISABLE_CFI_ICALL void EGLApiBase::eglProgramCachePopulateANGLEFn(EGLDisplay dpy, const void* key, EGLint keysize, @@ -648,6 +698,7 @@ binarysize); } +DISABLE_CFI_ICALL void EGLApiBase::eglProgramCacheQueryANGLEFn(EGLDisplay dpy, EGLint index, void* key, @@ -658,16 +709,19 @@ binarysize); } +DISABLE_CFI_ICALL EGLint EGLApiBase::eglProgramCacheResizeANGLEFn(EGLDisplay dpy, EGLint limit, EGLenum mode) { return driver_->fn.eglProgramCacheResizeANGLEFn(dpy, limit, mode); } +DISABLE_CFI_ICALL EGLenum EGLApiBase::eglQueryAPIFn(void) { return driver_->fn.eglQueryAPIFn(); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglQueryContextFn(EGLDisplay dpy, EGLContext ctx, EGLint attribute, @@ -675,6 +729,7 @@ return driver_->fn.eglQueryContextFn(dpy, ctx, attribute, value); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglQueryStreamKHRFn(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, @@ -682,6 +737,7 @@ return driver_->fn.eglQueryStreamKHRFn(dpy, stream, attribute, value); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglQueryStreamu64KHRFn(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, @@ -689,10 +745,12 @@ return driver_->fn.eglQueryStreamu64KHRFn(dpy, stream, attribute, value); } +DISABLE_CFI_ICALL const char* EGLApiBase::eglQueryStringFn(EGLDisplay dpy, EGLint name) { return driver_->fn.eglQueryStringFn(dpy, name); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglQuerySurfaceFn(EGLDisplay dpy, EGLSurface surface, EGLint attribute, @@ -700,6 +758,7 @@ return driver_->fn.eglQuerySurfaceFn(dpy, surface, attribute, value); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglQuerySurfacePointerANGLEFn(EGLDisplay dpy, EGLSurface surface, EGLint attribute, @@ -708,16 +767,19 @@ value); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglReleaseTexImageFn(EGLDisplay dpy, EGLSurface surface, EGLint buffer) { return driver_->fn.eglReleaseTexImageFn(dpy, surface, buffer); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglReleaseThreadFn(void) { return driver_->fn.eglReleaseThreadFn(); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglStreamAttribKHRFn(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, @@ -725,11 +787,13 @@ return driver_->fn.eglStreamAttribKHRFn(dpy, stream, attribute, value); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglStreamConsumerAcquireKHRFn(EGLDisplay dpy, EGLStreamKHR stream) { return driver_->fn.eglStreamConsumerAcquireKHRFn(dpy, stream); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglStreamConsumerGLTextureExternalAttribsNVFn( EGLDisplay dpy, EGLStreamKHR stream, @@ -738,17 +802,20 @@ attrib_list); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglStreamConsumerGLTextureExternalKHRFn( EGLDisplay dpy, EGLStreamKHR stream) { return driver_->fn.eglStreamConsumerGLTextureExternalKHRFn(dpy, stream); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglStreamConsumerReleaseKHRFn(EGLDisplay dpy, EGLStreamKHR stream) { return driver_->fn.eglStreamConsumerReleaseKHRFn(dpy, stream); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglStreamPostD3DTextureANGLEFn( EGLDisplay dpy, EGLStreamKHR stream, @@ -758,6 +825,7 @@ attrib_list); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglSurfaceAttribFn(EGLDisplay dpy, EGLSurface surface, EGLint attribute, @@ -765,10 +833,12 @@ return driver_->fn.eglSurfaceAttribFn(dpy, surface, attribute, value); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglSwapBuffersFn(EGLDisplay dpy, EGLSurface surface) { return driver_->fn.eglSwapBuffersFn(dpy, surface); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglSwapBuffersWithDamageKHRFn(EGLDisplay dpy, EGLSurface surface, EGLint* rects, @@ -777,37 +847,45 @@ n_rects); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglSwapIntervalFn(EGLDisplay dpy, EGLint interval) { return driver_->fn.eglSwapIntervalFn(dpy, interval); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglTerminateFn(EGLDisplay dpy) { return driver_->fn.eglTerminateFn(dpy); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglWaitClientFn(void) { return driver_->fn.eglWaitClientFn(); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglWaitGLFn(void) { return driver_->fn.eglWaitGLFn(); } +DISABLE_CFI_ICALL EGLBoolean EGLApiBase::eglWaitNativeFn(EGLint engine) { return driver_->fn.eglWaitNativeFn(engine); } +DISABLE_CFI_ICALL EGLint EGLApiBase::eglWaitSyncKHRFn(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags) { return driver_->fn.eglWaitSyncKHRFn(dpy, sync, flags); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglBindAPIFn(EGLenum api) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::eglBindAPI") return egl_api_->eglBindAPIFn(api); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglBindTexImageFn(EGLDisplay dpy, EGLSurface surface, EGLint buffer) { @@ -815,6 +893,7 @@ return egl_api_->eglBindTexImageFn(dpy, surface, buffer); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglChooseConfigFn(EGLDisplay dpy, const EGLint* attrib_list, EGLConfig* configs, @@ -825,6 +904,7 @@ num_config); } +DISABLE_CFI_ICALL EGLint TraceEGLApi::eglClientWaitSyncKHRFn(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, @@ -833,6 +913,7 @@ return egl_api_->eglClientWaitSyncKHRFn(dpy, sync, flags, timeout); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglCopyBuffersFn(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target) { @@ -840,6 +921,7 @@ return egl_api_->eglCopyBuffersFn(dpy, surface, target); } +DISABLE_CFI_ICALL EGLContext TraceEGLApi::eglCreateContextFn(EGLDisplay dpy, EGLConfig config, EGLContext share_context, @@ -848,6 +930,7 @@ return egl_api_->eglCreateContextFn(dpy, config, share_context, attrib_list); } +DISABLE_CFI_ICALL EGLImageKHR TraceEGLApi::eglCreateImageKHRFn(EGLDisplay dpy, EGLContext ctx, EGLenum target, @@ -857,6 +940,7 @@ return egl_api_->eglCreateImageKHRFn(dpy, ctx, target, buffer, attrib_list); } +DISABLE_CFI_ICALL EGLSurface TraceEGLApi::eglCreatePbufferFromClientBufferFn( EGLDisplay dpy, EGLenum buftype, @@ -869,6 +953,7 @@ config, attrib_list); } +DISABLE_CFI_ICALL EGLSurface TraceEGLApi::eglCreatePbufferSurfaceFn(EGLDisplay dpy, EGLConfig config, const EGLint* attrib_list) { @@ -876,6 +961,7 @@ return egl_api_->eglCreatePbufferSurfaceFn(dpy, config, attrib_list); } +DISABLE_CFI_ICALL EGLSurface TraceEGLApi::eglCreatePixmapSurfaceFn(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, @@ -884,12 +970,14 @@ return egl_api_->eglCreatePixmapSurfaceFn(dpy, config, pixmap, attrib_list); } +DISABLE_CFI_ICALL EGLStreamKHR TraceEGLApi::eglCreateStreamKHRFn(EGLDisplay dpy, const EGLint* attrib_list) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::eglCreateStreamKHR") return egl_api_->eglCreateStreamKHRFn(dpy, attrib_list); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglCreateStreamProducerD3DTextureANGLEFn( EGLDisplay dpy, EGLStreamKHR stream, @@ -900,6 +988,7 @@ attrib_list); } +DISABLE_CFI_ICALL EGLSyncKHR TraceEGLApi::eglCreateSyncKHRFn(EGLDisplay dpy, EGLenum type, const EGLint* attrib_list) { @@ -907,6 +996,7 @@ return egl_api_->eglCreateSyncKHRFn(dpy, type, attrib_list); } +DISABLE_CFI_ICALL EGLSurface TraceEGLApi::eglCreateWindowSurfaceFn(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, @@ -915,40 +1005,47 @@ return egl_api_->eglCreateWindowSurfaceFn(dpy, config, win, attrib_list); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglDestroyContextFn(EGLDisplay dpy, EGLContext ctx) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::eglDestroyContext") return egl_api_->eglDestroyContextFn(dpy, ctx); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglDestroyImageKHRFn(EGLDisplay dpy, EGLImageKHR image) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::eglDestroyImageKHR") return egl_api_->eglDestroyImageKHRFn(dpy, image); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglDestroyStreamKHRFn(EGLDisplay dpy, EGLStreamKHR stream) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::eglDestroyStreamKHR") return egl_api_->eglDestroyStreamKHRFn(dpy, stream); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglDestroySurfaceFn(EGLDisplay dpy, EGLSurface surface) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::eglDestroySurface") return egl_api_->eglDestroySurfaceFn(dpy, surface); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglDestroySyncKHRFn(EGLDisplay dpy, EGLSyncKHR sync) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::eglDestroySyncKHR") return egl_api_->eglDestroySyncKHRFn(dpy, sync); } +DISABLE_CFI_ICALL EGLint TraceEGLApi::eglDupNativeFenceFDANDROIDFn(EGLDisplay dpy, EGLSyncKHR sync) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::eglDupNativeFenceFDANDROID") return egl_api_->eglDupNativeFenceFDANDROIDFn(dpy, sync); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglExportDMABUFImageMESAFn(EGLDisplay dpy, EGLImageKHR image, int* fds, @@ -959,6 +1056,7 @@ offsets); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglExportDMABUFImageQueryMESAFn( EGLDisplay dpy, EGLImageKHR image, @@ -971,6 +1069,7 @@ num_planes, modifiers); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglGetCompositorTimingANDROIDFn( EGLDisplay dpy, EGLSurface surface, @@ -983,6 +1082,7 @@ names, values); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglGetCompositorTimingSupportedANDROIDFn( EGLDisplay dpy, EGLSurface surface, @@ -993,6 +1093,7 @@ timestamp); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglGetConfigAttribFn(EGLDisplay dpy, EGLConfig config, EGLint attribute, @@ -1001,6 +1102,7 @@ return egl_api_->eglGetConfigAttribFn(dpy, config, attribute, value); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglGetConfigsFn(EGLDisplay dpy, EGLConfig* configs, EGLint config_size, @@ -1009,31 +1111,37 @@ return egl_api_->eglGetConfigsFn(dpy, configs, config_size, num_config); } +DISABLE_CFI_ICALL EGLContext TraceEGLApi::eglGetCurrentContextFn(void) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::eglGetCurrentContext") return egl_api_->eglGetCurrentContextFn(); } +DISABLE_CFI_ICALL EGLDisplay TraceEGLApi::eglGetCurrentDisplayFn(void) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::eglGetCurrentDisplay") return egl_api_->eglGetCurrentDisplayFn(); } +DISABLE_CFI_ICALL EGLSurface TraceEGLApi::eglGetCurrentSurfaceFn(EGLint readdraw) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::eglGetCurrentSurface") return egl_api_->eglGetCurrentSurfaceFn(readdraw); } +DISABLE_CFI_ICALL EGLDisplay TraceEGLApi::eglGetDisplayFn(EGLNativeDisplayType display_id) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::eglGetDisplay") return egl_api_->eglGetDisplayFn(display_id); } +DISABLE_CFI_ICALL EGLint TraceEGLApi::eglGetErrorFn(void) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::eglGetError") return egl_api_->eglGetErrorFn(); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglGetFrameTimestampsANDROIDFn( EGLDisplay dpy, EGLSurface surface, @@ -1047,6 +1155,7 @@ dpy, surface, frameId, numTimestamps, timestamps, values); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglGetFrameTimestampSupportedANDROIDFn( EGLDisplay dpy, EGLSurface surface, @@ -1057,6 +1166,7 @@ timestamp); } +DISABLE_CFI_ICALL EGLClientBuffer TraceEGLApi::eglGetNativeClientBufferANDROIDFn( const struct AHardwareBuffer* ahardwarebuffer) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", @@ -1064,6 +1174,7 @@ return egl_api_->eglGetNativeClientBufferANDROIDFn(ahardwarebuffer); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglGetNextFrameIdANDROIDFn(EGLDisplay dpy, EGLSurface surface, EGLuint64KHR* frameId) { @@ -1071,6 +1182,7 @@ return egl_api_->eglGetNextFrameIdANDROIDFn(dpy, surface, frameId); } +DISABLE_CFI_ICALL EGLDisplay TraceEGLApi::eglGetPlatformDisplayEXTFn(EGLenum platform, void* native_display, const EGLint* attrib_list) { @@ -1079,12 +1191,14 @@ attrib_list); } +DISABLE_CFI_ICALL __eglMustCastToProperFunctionPointerType TraceEGLApi::eglGetProcAddressFn( const char* procname) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::eglGetProcAddress") return egl_api_->eglGetProcAddressFn(procname); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglGetSyncAttribKHRFn(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, @@ -1093,6 +1207,7 @@ return egl_api_->eglGetSyncAttribKHRFn(dpy, sync, attribute, value); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglGetSyncValuesCHROMIUMFn(EGLDisplay dpy, EGLSurface surface, EGLuint64CHROMIUM* ust, @@ -1102,6 +1217,7 @@ return egl_api_->eglGetSyncValuesCHROMIUMFn(dpy, surface, ust, msc, sbc); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglImageFlushExternalEXTFn( EGLDisplay dpy, EGLImageKHR image, @@ -1110,6 +1226,7 @@ return egl_api_->eglImageFlushExternalEXTFn(dpy, image, attrib_list); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglInitializeFn(EGLDisplay dpy, EGLint* major, EGLint* minor) { @@ -1117,6 +1234,7 @@ return egl_api_->eglInitializeFn(dpy, major, minor); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglMakeCurrentFn(EGLDisplay dpy, EGLSurface draw, EGLSurface read, @@ -1125,6 +1243,7 @@ return egl_api_->eglMakeCurrentFn(dpy, draw, read, ctx); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglPostSubBufferNVFn(EGLDisplay dpy, EGLSurface surface, EGLint x, @@ -1135,6 +1254,7 @@ return egl_api_->eglPostSubBufferNVFn(dpy, surface, x, y, width, height); } +DISABLE_CFI_ICALL EGLint TraceEGLApi::eglProgramCacheGetAttribANGLEFn(EGLDisplay dpy, EGLenum attrib) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", @@ -1142,6 +1262,7 @@ return egl_api_->eglProgramCacheGetAttribANGLEFn(dpy, attrib); } +DISABLE_CFI_ICALL void TraceEGLApi::eglProgramCachePopulateANGLEFn(EGLDisplay dpy, const void* key, EGLint keysize, @@ -1153,6 +1274,7 @@ binarysize); } +DISABLE_CFI_ICALL void TraceEGLApi::eglProgramCacheQueryANGLEFn(EGLDisplay dpy, EGLint index, void* key, @@ -1164,6 +1286,7 @@ binarysize); } +DISABLE_CFI_ICALL EGLint TraceEGLApi::eglProgramCacheResizeANGLEFn(EGLDisplay dpy, EGLint limit, EGLenum mode) { @@ -1171,11 +1294,13 @@ return egl_api_->eglProgramCacheResizeANGLEFn(dpy, limit, mode); } +DISABLE_CFI_ICALL EGLenum TraceEGLApi::eglQueryAPIFn(void) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::eglQueryAPI") return egl_api_->eglQueryAPIFn(); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglQueryContextFn(EGLDisplay dpy, EGLContext ctx, EGLint attribute, @@ -1184,6 +1309,7 @@ return egl_api_->eglQueryContextFn(dpy, ctx, attribute, value); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglQueryStreamKHRFn(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, @@ -1192,6 +1318,7 @@ return egl_api_->eglQueryStreamKHRFn(dpy, stream, attribute, value); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglQueryStreamu64KHRFn(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, @@ -1200,11 +1327,13 @@ return egl_api_->eglQueryStreamu64KHRFn(dpy, stream, attribute, value); } +DISABLE_CFI_ICALL const char* TraceEGLApi::eglQueryStringFn(EGLDisplay dpy, EGLint name) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::eglQueryString") return egl_api_->eglQueryStringFn(dpy, name); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglQuerySurfaceFn(EGLDisplay dpy, EGLSurface surface, EGLint attribute, @@ -1213,6 +1342,7 @@ return egl_api_->eglQuerySurfaceFn(dpy, surface, attribute, value); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglQuerySurfacePointerANGLEFn(EGLDisplay dpy, EGLSurface surface, EGLint attribute, @@ -1223,6 +1353,7 @@ value); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglReleaseTexImageFn(EGLDisplay dpy, EGLSurface surface, EGLint buffer) { @@ -1230,11 +1361,13 @@ return egl_api_->eglReleaseTexImageFn(dpy, surface, buffer); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglReleaseThreadFn(void) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::eglReleaseThread") return egl_api_->eglReleaseThreadFn(); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglStreamAttribKHRFn(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, @@ -1243,6 +1376,7 @@ return egl_api_->eglStreamAttribKHRFn(dpy, stream, attribute, value); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglStreamConsumerAcquireKHRFn(EGLDisplay dpy, EGLStreamKHR stream) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", @@ -1250,6 +1384,7 @@ return egl_api_->eglStreamConsumerAcquireKHRFn(dpy, stream); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglStreamConsumerGLTextureExternalAttribsNVFn( EGLDisplay dpy, EGLStreamKHR stream, @@ -1260,6 +1395,7 @@ attrib_list); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglStreamConsumerGLTextureExternalKHRFn( EGLDisplay dpy, EGLStreamKHR stream) { @@ -1268,6 +1404,7 @@ return egl_api_->eglStreamConsumerGLTextureExternalKHRFn(dpy, stream); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglStreamConsumerReleaseKHRFn(EGLDisplay dpy, EGLStreamKHR stream) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", @@ -1275,6 +1412,7 @@ return egl_api_->eglStreamConsumerReleaseKHRFn(dpy, stream); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglStreamPostD3DTextureANGLEFn( EGLDisplay dpy, EGLStreamKHR stream, @@ -1286,6 +1424,7 @@ attrib_list); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglSurfaceAttribFn(EGLDisplay dpy, EGLSurface surface, EGLint attribute, @@ -1294,11 +1433,13 @@ return egl_api_->eglSurfaceAttribFn(dpy, surface, attribute, value); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglSwapBuffersFn(EGLDisplay dpy, EGLSurface surface) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::eglSwapBuffers") return egl_api_->eglSwapBuffersFn(dpy, surface); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglSwapBuffersWithDamageKHRFn(EGLDisplay dpy, EGLSurface surface, EGLint* rects, @@ -1308,31 +1449,37 @@ return egl_api_->eglSwapBuffersWithDamageKHRFn(dpy, surface, rects, n_rects); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglSwapIntervalFn(EGLDisplay dpy, EGLint interval) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::eglSwapInterval") return egl_api_->eglSwapIntervalFn(dpy, interval); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglTerminateFn(EGLDisplay dpy) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::eglTerminate") return egl_api_->eglTerminateFn(dpy); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglWaitClientFn(void) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::eglWaitClient") return egl_api_->eglWaitClientFn(); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglWaitGLFn(void) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::eglWaitGL") return egl_api_->eglWaitGLFn(); } +DISABLE_CFI_ICALL EGLBoolean TraceEGLApi::eglWaitNativeFn(EGLint engine) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::eglWaitNative") return egl_api_->eglWaitNativeFn(engine); } +DISABLE_CFI_ICALL EGLint TraceEGLApi::eglWaitSyncKHRFn(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags) { @@ -1340,6 +1487,7 @@ return egl_api_->eglWaitSyncKHRFn(dpy, sync, flags); } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglBindAPIFn(EGLenum api) { GL_SERVICE_LOG("eglBindAPI" << "(" << api << ")"); @@ -1348,6 +1496,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglBindTexImageFn(EGLDisplay dpy, EGLSurface surface, EGLint buffer) { @@ -1358,6 +1507,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglChooseConfigFn(EGLDisplay dpy, const EGLint* attrib_list, EGLConfig* configs, @@ -1374,6 +1524,7 @@ return result; } +DISABLE_CFI_ICALL EGLint DebugEGLApi::eglClientWaitSyncKHRFn(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, @@ -1386,6 +1537,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglCopyBuffersFn(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target) { @@ -1396,6 +1548,7 @@ return result; } +DISABLE_CFI_ICALL EGLContext DebugEGLApi::eglCreateContextFn(EGLDisplay dpy, EGLConfig config, EGLContext share_context, @@ -1409,6 +1562,7 @@ return result; } +DISABLE_CFI_ICALL EGLImageKHR DebugEGLApi::eglCreateImageKHRFn(EGLDisplay dpy, EGLContext ctx, EGLenum target, @@ -1424,6 +1578,7 @@ return result; } +DISABLE_CFI_ICALL EGLSurface DebugEGLApi::eglCreatePbufferFromClientBufferFn( EGLDisplay dpy, EGLenum buftype, @@ -1440,6 +1595,7 @@ return result; } +DISABLE_CFI_ICALL EGLSurface DebugEGLApi::eglCreatePbufferSurfaceFn(EGLDisplay dpy, EGLConfig config, const EGLint* attrib_list) { @@ -1452,6 +1608,7 @@ return result; } +DISABLE_CFI_ICALL EGLSurface DebugEGLApi::eglCreatePixmapSurfaceFn(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, @@ -1465,6 +1622,7 @@ return result; } +DISABLE_CFI_ICALL EGLStreamKHR DebugEGLApi::eglCreateStreamKHRFn(EGLDisplay dpy, const EGLint* attrib_list) { GL_SERVICE_LOG("eglCreateStreamKHR" @@ -1475,6 +1633,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglCreateStreamProducerD3DTextureANGLEFn( EGLDisplay dpy, EGLStreamKHR stream, @@ -1488,6 +1647,7 @@ return result; } +DISABLE_CFI_ICALL EGLSyncKHR DebugEGLApi::eglCreateSyncKHRFn(EGLDisplay dpy, EGLenum type, const EGLint* attrib_list) { @@ -1499,6 +1659,7 @@ return result; } +DISABLE_CFI_ICALL EGLSurface DebugEGLApi::eglCreateWindowSurfaceFn(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, @@ -1512,6 +1673,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglDestroyContextFn(EGLDisplay dpy, EGLContext ctx) { GL_SERVICE_LOG("eglDestroyContext" << "(" << dpy << ", " << ctx << ")"); @@ -1520,6 +1682,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglDestroyImageKHRFn(EGLDisplay dpy, EGLImageKHR image) { GL_SERVICE_LOG("eglDestroyImageKHR" @@ -1529,6 +1692,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglDestroyStreamKHRFn(EGLDisplay dpy, EGLStreamKHR stream) { GL_SERVICE_LOG("eglDestroyStreamKHR" @@ -1538,6 +1702,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglDestroySurfaceFn(EGLDisplay dpy, EGLSurface surface) { GL_SERVICE_LOG("eglDestroySurface" @@ -1547,6 +1712,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglDestroySyncKHRFn(EGLDisplay dpy, EGLSyncKHR sync) { GL_SERVICE_LOG("eglDestroySyncKHR" << "(" << dpy << ", " << sync << ")"); @@ -1555,6 +1721,7 @@ return result; } +DISABLE_CFI_ICALL EGLint DebugEGLApi::eglDupNativeFenceFDANDROIDFn(EGLDisplay dpy, EGLSyncKHR sync) { GL_SERVICE_LOG("eglDupNativeFenceFDANDROID" @@ -1564,6 +1731,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglExportDMABUFImageMESAFn(EGLDisplay dpy, EGLImageKHR image, int* fds, @@ -1580,6 +1748,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglExportDMABUFImageQueryMESAFn( EGLDisplay dpy, EGLImageKHR image, @@ -1597,6 +1766,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglGetCompositorTimingANDROIDFn( EGLDisplay dpy, EGLSurface surface, @@ -1613,6 +1783,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglGetCompositorTimingSupportedANDROIDFn( EGLDisplay dpy, EGLSurface surface, @@ -1625,6 +1796,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglGetConfigAttribFn(EGLDisplay dpy, EGLConfig config, EGLint attribute, @@ -1638,6 +1810,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglGetConfigsFn(EGLDisplay dpy, EGLConfig* configs, EGLint config_size, @@ -1652,6 +1825,7 @@ return result; } +DISABLE_CFI_ICALL EGLContext DebugEGLApi::eglGetCurrentContextFn(void) { GL_SERVICE_LOG("eglGetCurrentContext" << "(" @@ -1661,6 +1835,7 @@ return result; } +DISABLE_CFI_ICALL EGLDisplay DebugEGLApi::eglGetCurrentDisplayFn(void) { GL_SERVICE_LOG("eglGetCurrentDisplay" << "(" @@ -1670,6 +1845,7 @@ return result; } +DISABLE_CFI_ICALL EGLSurface DebugEGLApi::eglGetCurrentSurfaceFn(EGLint readdraw) { GL_SERVICE_LOG("eglGetCurrentSurface" << "(" << readdraw << ")"); @@ -1678,6 +1854,7 @@ return result; } +DISABLE_CFI_ICALL EGLDisplay DebugEGLApi::eglGetDisplayFn(EGLNativeDisplayType display_id) { GL_SERVICE_LOG("eglGetDisplay" << "(" << display_id << ")"); @@ -1686,6 +1863,7 @@ return result; } +DISABLE_CFI_ICALL EGLint DebugEGLApi::eglGetErrorFn(void) { GL_SERVICE_LOG("eglGetError" << "(" @@ -1695,6 +1873,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglGetFrameTimestampsANDROIDFn( EGLDisplay dpy, EGLSurface surface, @@ -1713,6 +1892,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglGetFrameTimestampSupportedANDROIDFn( EGLDisplay dpy, EGLSurface surface, @@ -1725,6 +1905,7 @@ return result; } +DISABLE_CFI_ICALL EGLClientBuffer DebugEGLApi::eglGetNativeClientBufferANDROIDFn( const struct AHardwareBuffer* ahardwarebuffer) { GL_SERVICE_LOG("eglGetNativeClientBufferANDROID" @@ -1735,6 +1916,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglGetNextFrameIdANDROIDFn(EGLDisplay dpy, EGLSurface surface, EGLuint64KHR* frameId) { @@ -1747,6 +1929,7 @@ return result; } +DISABLE_CFI_ICALL EGLDisplay DebugEGLApi::eglGetPlatformDisplayEXTFn(EGLenum platform, void* native_display, const EGLint* attrib_list) { @@ -1760,6 +1943,7 @@ return result; } +DISABLE_CFI_ICALL __eglMustCastToProperFunctionPointerType DebugEGLApi::eglGetProcAddressFn( const char* procname) { GL_SERVICE_LOG("eglGetProcAddress" @@ -1770,6 +1954,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglGetSyncAttribKHRFn(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, @@ -1783,6 +1968,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglGetSyncValuesCHROMIUMFn(EGLDisplay dpy, EGLSurface surface, EGLuint64CHROMIUM* ust, @@ -1799,6 +1985,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglImageFlushExternalEXTFn( EGLDisplay dpy, EGLImageKHR image, @@ -1812,6 +1999,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglInitializeFn(EGLDisplay dpy, EGLint* major, EGLint* minor) { @@ -1823,6 +2011,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglMakeCurrentFn(EGLDisplay dpy, EGLSurface draw, EGLSurface read, @@ -1835,6 +2024,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglPostSubBufferNVFn(EGLDisplay dpy, EGLSurface surface, EGLint x, @@ -1850,6 +2040,7 @@ return result; } +DISABLE_CFI_ICALL EGLint DebugEGLApi::eglProgramCacheGetAttribANGLEFn(EGLDisplay dpy, EGLenum attrib) { GL_SERVICE_LOG("eglProgramCacheGetAttribANGLE" @@ -1859,6 +2050,7 @@ return result; } +DISABLE_CFI_ICALL void DebugEGLApi::eglProgramCachePopulateANGLEFn(EGLDisplay dpy, const void* key, EGLint keysize, @@ -1872,6 +2064,7 @@ binarysize); } +DISABLE_CFI_ICALL void DebugEGLApi::eglProgramCacheQueryANGLEFn(EGLDisplay dpy, EGLint index, void* key, @@ -1888,6 +2081,7 @@ binarysize); } +DISABLE_CFI_ICALL EGLint DebugEGLApi::eglProgramCacheResizeANGLEFn(EGLDisplay dpy, EGLint limit, EGLenum mode) { @@ -1898,6 +2092,7 @@ return result; } +DISABLE_CFI_ICALL EGLenum DebugEGLApi::eglQueryAPIFn(void) { GL_SERVICE_LOG("eglQueryAPI" << "(" @@ -1907,6 +2102,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglQueryContextFn(EGLDisplay dpy, EGLContext ctx, EGLint attribute, @@ -1919,6 +2115,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglQueryStreamKHRFn(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, @@ -1932,6 +2129,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglQueryStreamu64KHRFn(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, @@ -1945,6 +2143,7 @@ return result; } +DISABLE_CFI_ICALL const char* DebugEGLApi::eglQueryStringFn(EGLDisplay dpy, EGLint name) { GL_SERVICE_LOG("eglQueryString" << "(" << dpy << ", " << name << ")"); @@ -1953,6 +2152,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglQuerySurfaceFn(EGLDisplay dpy, EGLSurface surface, EGLint attribute, @@ -1966,6 +2166,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglQuerySurfacePointerANGLEFn(EGLDisplay dpy, EGLSurface surface, EGLint attribute, @@ -1979,6 +2180,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglReleaseTexImageFn(EGLDisplay dpy, EGLSurface surface, EGLint buffer) { @@ -1989,6 +2191,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglReleaseThreadFn(void) { GL_SERVICE_LOG("eglReleaseThread" << "(" @@ -1998,6 +2201,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglStreamAttribKHRFn(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, @@ -2011,6 +2215,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglStreamConsumerAcquireKHRFn(EGLDisplay dpy, EGLStreamKHR stream) { GL_SERVICE_LOG("eglStreamConsumerAcquireKHR" @@ -2020,6 +2225,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglStreamConsumerGLTextureExternalAttribsNVFn( EGLDisplay dpy, EGLStreamKHR stream, @@ -2033,6 +2239,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglStreamConsumerGLTextureExternalKHRFn( EGLDisplay dpy, EGLStreamKHR stream) { @@ -2044,6 +2251,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglStreamConsumerReleaseKHRFn(EGLDisplay dpy, EGLStreamKHR stream) { GL_SERVICE_LOG("eglStreamConsumerReleaseKHR" @@ -2053,6 +2261,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglStreamPostD3DTextureANGLEFn( EGLDisplay dpy, EGLStreamKHR stream, @@ -2068,6 +2277,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglSurfaceAttribFn(EGLDisplay dpy, EGLSurface surface, EGLint attribute, @@ -2081,6 +2291,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglSwapBuffersFn(EGLDisplay dpy, EGLSurface surface) { GL_SERVICE_LOG("eglSwapBuffers" << "(" << dpy << ", " << surface << ")"); @@ -2089,6 +2300,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglSwapBuffersWithDamageKHRFn(EGLDisplay dpy, EGLSurface surface, EGLint* rects, @@ -2102,6 +2314,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglSwapIntervalFn(EGLDisplay dpy, EGLint interval) { GL_SERVICE_LOG("eglSwapInterval" << "(" << dpy << ", " << interval << ")"); @@ -2110,6 +2323,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglTerminateFn(EGLDisplay dpy) { GL_SERVICE_LOG("eglTerminate" << "(" << dpy << ")"); @@ -2118,6 +2332,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglWaitClientFn(void) { GL_SERVICE_LOG("eglWaitClient" << "(" @@ -2127,6 +2342,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglWaitGLFn(void) { GL_SERVICE_LOG("eglWaitGL" << "(" @@ -2136,6 +2352,7 @@ return result; } +DISABLE_CFI_ICALL EGLBoolean DebugEGLApi::eglWaitNativeFn(EGLint engine) { GL_SERVICE_LOG("eglWaitNative" << "(" << engine << ")"); @@ -2144,6 +2361,7 @@ return result; } +DISABLE_CFI_ICALL EGLint DebugEGLApi::eglWaitSyncKHRFn(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags) {
diff --git a/ui/gl/gl_bindings_autogen_gl.cc b/ui/gl/gl_bindings_autogen_gl.cc index 5897a33..40bc9c65 100644 --- a/ui/gl/gl_bindings_autogen_gl.cc +++ b/ui/gl/gl_bindings_autogen_gl.cc
@@ -10,6 +10,8 @@ #include <string> +#include "base/compiler_specific.h" +#include "base/memory/protected_memory.h" #include "base/trace_event/trace_event.h" #include "ui/gl/gl_bindings.h" #include "ui/gl/gl_context.h" @@ -2251,40 +2253,49 @@ memset(this, 0, sizeof(*this)); } +DISABLE_CFI_ICALL void GLApiBase::glActiveTextureFn(GLenum texture) { driver_->fn.glActiveTextureFn(texture); } +DISABLE_CFI_ICALL void GLApiBase::glApplyFramebufferAttachmentCMAAINTELFn(void) { driver_->fn.glApplyFramebufferAttachmentCMAAINTELFn(); } +DISABLE_CFI_ICALL void GLApiBase::glAttachShaderFn(GLuint program, GLuint shader) { driver_->fn.glAttachShaderFn(program, shader); } +DISABLE_CFI_ICALL void GLApiBase::glBeginQueryFn(GLenum target, GLuint id) { driver_->fn.glBeginQueryFn(target, id); } +DISABLE_CFI_ICALL void GLApiBase::glBeginTransformFeedbackFn(GLenum primitiveMode) { driver_->fn.glBeginTransformFeedbackFn(primitiveMode); } +DISABLE_CFI_ICALL void GLApiBase::glBindAttribLocationFn(GLuint program, GLuint index, const char* name) { driver_->fn.glBindAttribLocationFn(program, index, name); } +DISABLE_CFI_ICALL void GLApiBase::glBindBufferFn(GLenum target, GLuint buffer) { driver_->fn.glBindBufferFn(target, buffer); } +DISABLE_CFI_ICALL void GLApiBase::glBindBufferBaseFn(GLenum target, GLuint index, GLuint buffer) { driver_->fn.glBindBufferBaseFn(target, index, buffer); } +DISABLE_CFI_ICALL void GLApiBase::glBindBufferRangeFn(GLenum target, GLuint index, GLuint buffer, @@ -2293,12 +2304,14 @@ driver_->fn.glBindBufferRangeFn(target, index, buffer, offset, size); } +DISABLE_CFI_ICALL void GLApiBase::glBindFragDataLocationFn(GLuint program, GLuint colorNumber, const char* name) { driver_->fn.glBindFragDataLocationFn(program, colorNumber, name); } +DISABLE_CFI_ICALL void GLApiBase::glBindFragDataLocationIndexedFn(GLuint program, GLuint colorNumber, GLuint index, @@ -2307,10 +2320,12 @@ name); } +DISABLE_CFI_ICALL void GLApiBase::glBindFramebufferEXTFn(GLenum target, GLuint framebuffer) { driver_->fn.glBindFramebufferEXTFn(target, framebuffer); } +DISABLE_CFI_ICALL void GLApiBase::glBindImageTextureEXTFn(GLuint index, GLuint texture, GLint level, @@ -2322,36 +2337,44 @@ access, format); } +DISABLE_CFI_ICALL void GLApiBase::glBindRenderbufferEXTFn(GLenum target, GLuint renderbuffer) { driver_->fn.glBindRenderbufferEXTFn(target, renderbuffer); } +DISABLE_CFI_ICALL void GLApiBase::glBindSamplerFn(GLuint unit, GLuint sampler) { driver_->fn.glBindSamplerFn(unit, sampler); } +DISABLE_CFI_ICALL void GLApiBase::glBindTextureFn(GLenum target, GLuint texture) { driver_->fn.glBindTextureFn(target, texture); } +DISABLE_CFI_ICALL void GLApiBase::glBindTransformFeedbackFn(GLenum target, GLuint id) { driver_->fn.glBindTransformFeedbackFn(target, id); } +DISABLE_CFI_ICALL void GLApiBase::glBindUniformLocationCHROMIUMFn(GLuint program, GLint location, const char* name) { driver_->fn.glBindUniformLocationCHROMIUMFn(program, location, name); } +DISABLE_CFI_ICALL void GLApiBase::glBindVertexArrayOESFn(GLuint array) { driver_->fn.glBindVertexArrayOESFn(array); } +DISABLE_CFI_ICALL void GLApiBase::glBlendBarrierKHRFn(void) { driver_->fn.glBlendBarrierKHRFn(); } +DISABLE_CFI_ICALL void GLApiBase::glBlendColorFn(GLclampf red, GLclampf green, GLclampf blue, @@ -2359,18 +2382,22 @@ driver_->fn.glBlendColorFn(red, green, blue, alpha); } +DISABLE_CFI_ICALL void GLApiBase::glBlendEquationFn(GLenum mode) { driver_->fn.glBlendEquationFn(mode); } +DISABLE_CFI_ICALL void GLApiBase::glBlendEquationSeparateFn(GLenum modeRGB, GLenum modeAlpha) { driver_->fn.glBlendEquationSeparateFn(modeRGB, modeAlpha); } +DISABLE_CFI_ICALL void GLApiBase::glBlendFuncFn(GLenum sfactor, GLenum dfactor) { driver_->fn.glBlendFuncFn(sfactor, dfactor); } +DISABLE_CFI_ICALL void GLApiBase::glBlendFuncSeparateFn(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, @@ -2378,6 +2405,7 @@ driver_->fn.glBlendFuncSeparateFn(srcRGB, dstRGB, srcAlpha, dstAlpha); } +DISABLE_CFI_ICALL void GLApiBase::glBlitFramebufferFn(GLint srcX0, GLint srcY0, GLint srcX1, @@ -2392,6 +2420,7 @@ dstX1, dstY1, mask, filter); } +DISABLE_CFI_ICALL void GLApiBase::glBufferDataFn(GLenum target, GLsizeiptr size, const void* data, @@ -2399,6 +2428,7 @@ driver_->fn.glBufferDataFn(target, size, data, usage); } +DISABLE_CFI_ICALL void GLApiBase::glBufferSubDataFn(GLenum target, GLintptr offset, GLsizeiptr size, @@ -2406,14 +2436,17 @@ driver_->fn.glBufferSubDataFn(target, offset, size, data); } +DISABLE_CFI_ICALL GLenum GLApiBase::glCheckFramebufferStatusEXTFn(GLenum target) { return driver_->fn.glCheckFramebufferStatusEXTFn(target); } +DISABLE_CFI_ICALL void GLApiBase::glClearFn(GLbitfield mask) { driver_->fn.glClearFn(mask); } +DISABLE_CFI_ICALL void GLApiBase::glClearBufferfiFn(GLenum buffer, GLint drawbuffer, const GLfloat depth, @@ -2421,24 +2454,28 @@ driver_->fn.glClearBufferfiFn(buffer, drawbuffer, depth, stencil); } +DISABLE_CFI_ICALL void GLApiBase::glClearBufferfvFn(GLenum buffer, GLint drawbuffer, const GLfloat* value) { driver_->fn.glClearBufferfvFn(buffer, drawbuffer, value); } +DISABLE_CFI_ICALL void GLApiBase::glClearBufferivFn(GLenum buffer, GLint drawbuffer, const GLint* value) { driver_->fn.glClearBufferivFn(buffer, drawbuffer, value); } +DISABLE_CFI_ICALL void GLApiBase::glClearBufferuivFn(GLenum buffer, GLint drawbuffer, const GLuint* value) { driver_->fn.glClearBufferuivFn(buffer, drawbuffer, value); } +DISABLE_CFI_ICALL void GLApiBase::glClearColorFn(GLclampf red, GLclampf green, GLclampf blue, @@ -2446,24 +2483,29 @@ driver_->fn.glClearColorFn(red, green, blue, alpha); } +DISABLE_CFI_ICALL void GLApiBase::glClearDepthFn(GLclampd depth) { driver_->fn.glClearDepthFn(depth); } +DISABLE_CFI_ICALL void GLApiBase::glClearDepthfFn(GLclampf depth) { driver_->fn.glClearDepthfFn(depth); } +DISABLE_CFI_ICALL void GLApiBase::glClearStencilFn(GLint s) { driver_->fn.glClearStencilFn(s); } +DISABLE_CFI_ICALL GLenum GLApiBase::glClientWaitSyncFn(GLsync sync, GLbitfield flags, GLuint64 timeout) { return driver_->fn.glClientWaitSyncFn(sync, flags, timeout); } +DISABLE_CFI_ICALL void GLApiBase::glColorMaskFn(GLboolean red, GLboolean green, GLboolean blue, @@ -2471,15 +2513,18 @@ driver_->fn.glColorMaskFn(red, green, blue, alpha); } +DISABLE_CFI_ICALL void GLApiBase::glCompileShaderFn(GLuint shader) { driver_->fn.glCompileShaderFn(shader); } +DISABLE_CFI_ICALL void GLApiBase::glCompressedCopyTextureCHROMIUMFn(GLuint sourceId, GLuint destId) { driver_->fn.glCompressedCopyTextureCHROMIUMFn(sourceId, destId); } +DISABLE_CFI_ICALL void GLApiBase::glCompressedTexImage2DFn(GLenum target, GLint level, GLenum internalformat, @@ -2492,6 +2537,7 @@ height, border, imageSize, data); } +DISABLE_CFI_ICALL void GLApiBase::glCompressedTexImage2DRobustANGLEFn(GLenum target, GLint level, GLenum internalformat, @@ -2506,6 +2552,7 @@ imageSize, dataSize, data); } +DISABLE_CFI_ICALL void GLApiBase::glCompressedTexImage3DFn(GLenum target, GLint level, GLenum internalformat, @@ -2519,6 +2566,7 @@ height, depth, border, imageSize, data); } +DISABLE_CFI_ICALL void GLApiBase::glCompressedTexImage3DRobustANGLEFn(GLenum target, GLint level, GLenum internalformat, @@ -2534,6 +2582,7 @@ imageSize, dataSize, data); } +DISABLE_CFI_ICALL void GLApiBase::glCompressedTexSubImage2DFn(GLenum target, GLint level, GLint xoffset, @@ -2547,6 +2596,7 @@ target, level, xoffset, yoffset, width, height, format, imageSize, data); } +DISABLE_CFI_ICALL void GLApiBase::glCompressedTexSubImage2DRobustANGLEFn(GLenum target, GLint level, GLint xoffset, @@ -2562,6 +2612,7 @@ dataSize, data); } +DISABLE_CFI_ICALL void GLApiBase::glCompressedTexSubImage3DFn(GLenum target, GLint level, GLint xoffset, @@ -2578,6 +2629,7 @@ imageSize, data); } +DISABLE_CFI_ICALL void GLApiBase::glCompressedTexSubImage3DRobustANGLEFn(GLenum target, GLint level, GLint xoffset, @@ -2595,6 +2647,7 @@ imageSize, dataSize, data); } +DISABLE_CFI_ICALL void GLApiBase::glCopyBufferSubDataFn(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, @@ -2604,6 +2657,7 @@ writeOffset, size); } +DISABLE_CFI_ICALL void GLApiBase::glCopySubTextureCHROMIUMFn(GLuint sourceId, GLint sourceLevel, GLenum destTarget, @@ -2624,6 +2678,7 @@ unpackUnmultiplyAlpha); } +DISABLE_CFI_ICALL void GLApiBase::glCopyTexImage2DFn(GLenum target, GLint level, GLenum internalformat, @@ -2636,6 +2691,7 @@ height, border); } +DISABLE_CFI_ICALL void GLApiBase::glCopyTexSubImage2DFn(GLenum target, GLint level, GLint xoffset, @@ -2648,6 +2704,7 @@ width, height); } +DISABLE_CFI_ICALL void GLApiBase::glCopyTexSubImage3DFn(GLenum target, GLint level, GLint xoffset, @@ -2661,6 +2718,7 @@ y, width, height); } +DISABLE_CFI_ICALL void GLApiBase::glCopyTextureCHROMIUMFn(GLuint sourceId, GLint sourceLevel, GLenum destTarget, @@ -2676,10 +2734,12 @@ destType, unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha); } +DISABLE_CFI_ICALL void GLApiBase::glCoverageModulationNVFn(GLenum components) { driver_->fn.glCoverageModulationNVFn(components); } +DISABLE_CFI_ICALL void GLApiBase::glCoverFillPathInstancedNVFn(GLsizei numPaths, GLenum pathNameType, const void* paths, @@ -2692,10 +2752,12 @@ transformValues); } +DISABLE_CFI_ICALL void GLApiBase::glCoverFillPathNVFn(GLuint path, GLenum coverMode) { driver_->fn.glCoverFillPathNVFn(path, coverMode); } +DISABLE_CFI_ICALL void GLApiBase::glCoverStrokePathInstancedNVFn(GLsizei numPaths, GLenum pathNameType, const void* paths, @@ -2708,27 +2770,33 @@ transformValues); } +DISABLE_CFI_ICALL void GLApiBase::glCoverStrokePathNVFn(GLuint name, GLenum coverMode) { driver_->fn.glCoverStrokePathNVFn(name, coverMode); } +DISABLE_CFI_ICALL GLuint GLApiBase::glCreateProgramFn(void) { return driver_->fn.glCreateProgramFn(); } +DISABLE_CFI_ICALL GLuint GLApiBase::glCreateShaderFn(GLenum type) { return driver_->fn.glCreateShaderFn(type); } +DISABLE_CFI_ICALL void GLApiBase::glCullFaceFn(GLenum mode) { driver_->fn.glCullFaceFn(mode); } +DISABLE_CFI_ICALL void GLApiBase::glDebugMessageCallbackFn(GLDEBUGPROC callback, const void* userParam) { driver_->fn.glDebugMessageCallbackFn(callback, userParam); } +DISABLE_CFI_ICALL void GLApiBase::glDebugMessageControlFn(GLenum source, GLenum type, GLenum severity, @@ -2739,6 +2807,7 @@ enabled); } +DISABLE_CFI_ICALL void GLApiBase::glDebugMessageInsertFn(GLenum source, GLenum type, GLuint id, @@ -2748,102 +2817,126 @@ driver_->fn.glDebugMessageInsertFn(source, type, id, severity, length, buf); } +DISABLE_CFI_ICALL void GLApiBase::glDeleteBuffersARBFn(GLsizei n, const GLuint* buffers) { driver_->fn.glDeleteBuffersARBFn(n, buffers); } +DISABLE_CFI_ICALL void GLApiBase::glDeleteFencesAPPLEFn(GLsizei n, const GLuint* fences) { driver_->fn.glDeleteFencesAPPLEFn(n, fences); } +DISABLE_CFI_ICALL void GLApiBase::glDeleteFencesNVFn(GLsizei n, const GLuint* fences) { driver_->fn.glDeleteFencesNVFn(n, fences); } +DISABLE_CFI_ICALL void GLApiBase::glDeleteFramebuffersEXTFn(GLsizei n, const GLuint* framebuffers) { driver_->fn.glDeleteFramebuffersEXTFn(n, framebuffers); } +DISABLE_CFI_ICALL void GLApiBase::glDeletePathsNVFn(GLuint path, GLsizei range) { driver_->fn.glDeletePathsNVFn(path, range); } +DISABLE_CFI_ICALL void GLApiBase::glDeleteProgramFn(GLuint program) { driver_->fn.glDeleteProgramFn(program); } +DISABLE_CFI_ICALL void GLApiBase::glDeleteQueriesFn(GLsizei n, const GLuint* ids) { driver_->fn.glDeleteQueriesFn(n, ids); } +DISABLE_CFI_ICALL void GLApiBase::glDeleteRenderbuffersEXTFn(GLsizei n, const GLuint* renderbuffers) { driver_->fn.glDeleteRenderbuffersEXTFn(n, renderbuffers); } +DISABLE_CFI_ICALL void GLApiBase::glDeleteSamplersFn(GLsizei n, const GLuint* samplers) { driver_->fn.glDeleteSamplersFn(n, samplers); } +DISABLE_CFI_ICALL void GLApiBase::glDeleteShaderFn(GLuint shader) { driver_->fn.glDeleteShaderFn(shader); } +DISABLE_CFI_ICALL void GLApiBase::glDeleteSyncFn(GLsync sync) { driver_->fn.glDeleteSyncFn(sync); } +DISABLE_CFI_ICALL void GLApiBase::glDeleteTexturesFn(GLsizei n, const GLuint* textures) { driver_->fn.glDeleteTexturesFn(n, textures); } +DISABLE_CFI_ICALL void GLApiBase::glDeleteTransformFeedbacksFn(GLsizei n, const GLuint* ids) { driver_->fn.glDeleteTransformFeedbacksFn(n, ids); } +DISABLE_CFI_ICALL void GLApiBase::glDeleteVertexArraysOESFn(GLsizei n, const GLuint* arrays) { driver_->fn.glDeleteVertexArraysOESFn(n, arrays); } +DISABLE_CFI_ICALL void GLApiBase::glDepthFuncFn(GLenum func) { driver_->fn.glDepthFuncFn(func); } +DISABLE_CFI_ICALL void GLApiBase::glDepthMaskFn(GLboolean flag) { driver_->fn.glDepthMaskFn(flag); } +DISABLE_CFI_ICALL void GLApiBase::glDepthRangeFn(GLclampd zNear, GLclampd zFar) { driver_->fn.glDepthRangeFn(zNear, zFar); } +DISABLE_CFI_ICALL void GLApiBase::glDepthRangefFn(GLclampf zNear, GLclampf zFar) { driver_->fn.glDepthRangefFn(zNear, zFar); } +DISABLE_CFI_ICALL void GLApiBase::glDetachShaderFn(GLuint program, GLuint shader) { driver_->fn.glDetachShaderFn(program, shader); } +DISABLE_CFI_ICALL void GLApiBase::glDisableFn(GLenum cap) { driver_->fn.glDisableFn(cap); } +DISABLE_CFI_ICALL void GLApiBase::glDisableVertexAttribArrayFn(GLuint index) { driver_->fn.glDisableVertexAttribArrayFn(index); } +DISABLE_CFI_ICALL void GLApiBase::glDiscardFramebufferEXTFn(GLenum target, GLsizei numAttachments, const GLenum* attachments) { driver_->fn.glDiscardFramebufferEXTFn(target, numAttachments, attachments); } +DISABLE_CFI_ICALL void GLApiBase::glDrawArraysFn(GLenum mode, GLint first, GLsizei count) { driver_->fn.glDrawArraysFn(mode, first, count); } +DISABLE_CFI_ICALL void GLApiBase::glDrawArraysInstancedANGLEFn(GLenum mode, GLint first, GLsizei count, @@ -2851,14 +2944,17 @@ driver_->fn.glDrawArraysInstancedANGLEFn(mode, first, count, primcount); } +DISABLE_CFI_ICALL void GLApiBase::glDrawBufferFn(GLenum mode) { driver_->fn.glDrawBufferFn(mode); } +DISABLE_CFI_ICALL void GLApiBase::glDrawBuffersARBFn(GLsizei n, const GLenum* bufs) { driver_->fn.glDrawBuffersARBFn(n, bufs); } +DISABLE_CFI_ICALL void GLApiBase::glDrawElementsFn(GLenum mode, GLsizei count, GLenum type, @@ -2866,6 +2962,7 @@ driver_->fn.glDrawElementsFn(mode, count, type, indices); } +DISABLE_CFI_ICALL void GLApiBase::glDrawElementsInstancedANGLEFn(GLenum mode, GLsizei count, GLenum type, @@ -2875,6 +2972,7 @@ primcount); } +DISABLE_CFI_ICALL void GLApiBase::glDrawRangeElementsFn(GLenum mode, GLuint start, GLuint end, @@ -2884,58 +2982,71 @@ driver_->fn.glDrawRangeElementsFn(mode, start, end, count, type, indices); } +DISABLE_CFI_ICALL void GLApiBase::glEGLImageTargetRenderbufferStorageOESFn(GLenum target, GLeglImageOES image) { driver_->fn.glEGLImageTargetRenderbufferStorageOESFn(target, image); } +DISABLE_CFI_ICALL void GLApiBase::glEGLImageTargetTexture2DOESFn(GLenum target, GLeglImageOES image) { driver_->fn.glEGLImageTargetTexture2DOESFn(target, image); } +DISABLE_CFI_ICALL void GLApiBase::glEnableFn(GLenum cap) { driver_->fn.glEnableFn(cap); } +DISABLE_CFI_ICALL void GLApiBase::glEnableVertexAttribArrayFn(GLuint index) { driver_->fn.glEnableVertexAttribArrayFn(index); } +DISABLE_CFI_ICALL void GLApiBase::glEndQueryFn(GLenum target) { driver_->fn.glEndQueryFn(target); } +DISABLE_CFI_ICALL void GLApiBase::glEndTransformFeedbackFn(void) { driver_->fn.glEndTransformFeedbackFn(); } +DISABLE_CFI_ICALL GLsync GLApiBase::glFenceSyncFn(GLenum condition, GLbitfield flags) { return driver_->fn.glFenceSyncFn(condition, flags); } +DISABLE_CFI_ICALL void GLApiBase::glFinishFn(void) { driver_->fn.glFinishFn(); } +DISABLE_CFI_ICALL void GLApiBase::glFinishFenceAPPLEFn(GLuint fence) { driver_->fn.glFinishFenceAPPLEFn(fence); } +DISABLE_CFI_ICALL void GLApiBase::glFinishFenceNVFn(GLuint fence) { driver_->fn.glFinishFenceNVFn(fence); } +DISABLE_CFI_ICALL void GLApiBase::glFlushFn(void) { driver_->fn.glFlushFn(); } +DISABLE_CFI_ICALL void GLApiBase::glFlushMappedBufferRangeFn(GLenum target, GLintptr offset, GLsizeiptr length) { driver_->fn.glFlushMappedBufferRangeFn(target, offset, length); } +DISABLE_CFI_ICALL void GLApiBase::glFramebufferRenderbufferEXTFn(GLenum target, GLenum attachment, GLenum renderbuffertarget, @@ -2944,6 +3055,7 @@ renderbuffertarget, renderbuffer); } +DISABLE_CFI_ICALL void GLApiBase::glFramebufferTexture2DEXTFn(GLenum target, GLenum attachment, GLenum textarget, @@ -2953,6 +3065,7 @@ texture, level); } +DISABLE_CFI_ICALL void GLApiBase::glFramebufferTexture2DMultisampleEXTFn(GLenum target, GLenum attachment, GLenum textarget, @@ -2963,6 +3076,7 @@ target, attachment, textarget, texture, level, samples); } +DISABLE_CFI_ICALL void GLApiBase::glFramebufferTextureLayerFn(GLenum target, GLenum attachment, GLuint texture, @@ -2972,58 +3086,72 @@ layer); } +DISABLE_CFI_ICALL void GLApiBase::glFrontFaceFn(GLenum mode) { driver_->fn.glFrontFaceFn(mode); } +DISABLE_CFI_ICALL void GLApiBase::glGenBuffersARBFn(GLsizei n, GLuint* buffers) { driver_->fn.glGenBuffersARBFn(n, buffers); } +DISABLE_CFI_ICALL void GLApiBase::glGenerateMipmapEXTFn(GLenum target) { driver_->fn.glGenerateMipmapEXTFn(target); } +DISABLE_CFI_ICALL void GLApiBase::glGenFencesAPPLEFn(GLsizei n, GLuint* fences) { driver_->fn.glGenFencesAPPLEFn(n, fences); } +DISABLE_CFI_ICALL void GLApiBase::glGenFencesNVFn(GLsizei n, GLuint* fences) { driver_->fn.glGenFencesNVFn(n, fences); } +DISABLE_CFI_ICALL void GLApiBase::glGenFramebuffersEXTFn(GLsizei n, GLuint* framebuffers) { driver_->fn.glGenFramebuffersEXTFn(n, framebuffers); } +DISABLE_CFI_ICALL GLuint GLApiBase::glGenPathsNVFn(GLsizei range) { return driver_->fn.glGenPathsNVFn(range); } +DISABLE_CFI_ICALL void GLApiBase::glGenQueriesFn(GLsizei n, GLuint* ids) { driver_->fn.glGenQueriesFn(n, ids); } +DISABLE_CFI_ICALL void GLApiBase::glGenRenderbuffersEXTFn(GLsizei n, GLuint* renderbuffers) { driver_->fn.glGenRenderbuffersEXTFn(n, renderbuffers); } +DISABLE_CFI_ICALL void GLApiBase::glGenSamplersFn(GLsizei n, GLuint* samplers) { driver_->fn.glGenSamplersFn(n, samplers); } +DISABLE_CFI_ICALL void GLApiBase::glGenTexturesFn(GLsizei n, GLuint* textures) { driver_->fn.glGenTexturesFn(n, textures); } +DISABLE_CFI_ICALL void GLApiBase::glGenTransformFeedbacksFn(GLsizei n, GLuint* ids) { driver_->fn.glGenTransformFeedbacksFn(n, ids); } +DISABLE_CFI_ICALL void GLApiBase::glGenVertexArraysOESFn(GLsizei n, GLuint* arrays) { driver_->fn.glGenVertexArraysOESFn(n, arrays); } +DISABLE_CFI_ICALL void GLApiBase::glGetActiveAttribFn(GLuint program, GLuint index, GLsizei bufsize, @@ -3035,6 +3163,7 @@ name); } +DISABLE_CFI_ICALL void GLApiBase::glGetActiveUniformFn(GLuint program, GLuint index, GLsizei bufsize, @@ -3046,6 +3175,7 @@ name); } +DISABLE_CFI_ICALL void GLApiBase::glGetActiveUniformBlockivFn(GLuint program, GLuint uniformBlockIndex, GLenum pname, @@ -3054,6 +3184,7 @@ params); } +DISABLE_CFI_ICALL void GLApiBase::glGetActiveUniformBlockivRobustANGLEFn(GLuint program, GLuint uniformBlockIndex, GLenum pname, @@ -3064,6 +3195,7 @@ program, uniformBlockIndex, pname, bufSize, length, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetActiveUniformBlockNameFn(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, @@ -3073,6 +3205,7 @@ length, uniformBlockName); } +DISABLE_CFI_ICALL void GLApiBase::glGetActiveUniformsivFn(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, @@ -3082,6 +3215,7 @@ pname, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetAttachedShadersFn(GLuint program, GLsizei maxcount, GLsizei* count, @@ -3089,10 +3223,12 @@ driver_->fn.glGetAttachedShadersFn(program, maxcount, count, shaders); } +DISABLE_CFI_ICALL GLint GLApiBase::glGetAttribLocationFn(GLuint program, const char* name) { return driver_->fn.glGetAttribLocationFn(program, name); } +DISABLE_CFI_ICALL void GLApiBase::glGetBooleani_vRobustANGLEFn(GLenum target, GLuint index, GLsizei bufSize, @@ -3102,10 +3238,12 @@ data); } +DISABLE_CFI_ICALL void GLApiBase::glGetBooleanvFn(GLenum pname, GLboolean* params) { driver_->fn.glGetBooleanvFn(pname, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetBooleanvRobustANGLEFn(GLenum pname, GLsizei bufSize, GLsizei* length, @@ -3113,6 +3251,7 @@ driver_->fn.glGetBooleanvRobustANGLEFn(pname, bufSize, length, data); } +DISABLE_CFI_ICALL void GLApiBase::glGetBufferParameteri64vRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -3122,12 +3261,14 @@ length, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetBufferParameterivFn(GLenum target, GLenum pname, GLint* params) { driver_->fn.glGetBufferParameterivFn(target, pname, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetBufferParameterivRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -3137,6 +3278,7 @@ length, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetBufferPointervRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -3146,6 +3288,7 @@ params); } +DISABLE_CFI_ICALL void GLApiBase::glGetDebugMessageLogFn(GLuint count, GLsizei bufSize, GLenum* sources, @@ -3158,18 +3301,22 @@ severities, lengths, messageLog); } +DISABLE_CFI_ICALL GLenum GLApiBase::glGetErrorFn(void) { return driver_->fn.glGetErrorFn(); } +DISABLE_CFI_ICALL void GLApiBase::glGetFenceivNVFn(GLuint fence, GLenum pname, GLint* params) { driver_->fn.glGetFenceivNVFn(fence, pname, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetFloatvFn(GLenum pname, GLfloat* params) { driver_->fn.glGetFloatvFn(pname, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetFloatvRobustANGLEFn(GLenum pname, GLsizei bufSize, GLsizei* length, @@ -3177,14 +3324,17 @@ driver_->fn.glGetFloatvRobustANGLEFn(pname, bufSize, length, data); } +DISABLE_CFI_ICALL GLint GLApiBase::glGetFragDataIndexFn(GLuint program, const char* name) { return driver_->fn.glGetFragDataIndexFn(program, name); } +DISABLE_CFI_ICALL GLint GLApiBase::glGetFragDataLocationFn(GLuint program, const char* name) { return driver_->fn.glGetFragDataLocationFn(program, name); } +DISABLE_CFI_ICALL void GLApiBase::glGetFramebufferAttachmentParameterivEXTFn(GLenum target, GLenum attachment, GLenum pname, @@ -3193,6 +3343,7 @@ pname, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetFramebufferAttachmentParameterivRobustANGLEFn( GLenum target, GLenum attachment, @@ -3204,6 +3355,7 @@ target, attachment, pname, bufSize, length, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetFramebufferParameterivRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -3213,16 +3365,19 @@ length, params); } +DISABLE_CFI_ICALL GLenum GLApiBase::glGetGraphicsResetStatusARBFn(void) { return driver_->fn.glGetGraphicsResetStatusARBFn(); } +DISABLE_CFI_ICALL void GLApiBase::glGetInteger64i_vFn(GLenum target, GLuint index, GLint64* data) { driver_->fn.glGetInteger64i_vFn(target, index, data); } +DISABLE_CFI_ICALL void GLApiBase::glGetInteger64i_vRobustANGLEFn(GLenum target, GLuint index, GLsizei bufSize, @@ -3232,10 +3387,12 @@ data); } +DISABLE_CFI_ICALL void GLApiBase::glGetInteger64vFn(GLenum pname, GLint64* params) { driver_->fn.glGetInteger64vFn(pname, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetInteger64vRobustANGLEFn(GLenum pname, GLsizei bufSize, GLsizei* length, @@ -3243,10 +3400,12 @@ driver_->fn.glGetInteger64vRobustANGLEFn(pname, bufSize, length, data); } +DISABLE_CFI_ICALL void GLApiBase::glGetIntegeri_vFn(GLenum target, GLuint index, GLint* data) { driver_->fn.glGetIntegeri_vFn(target, index, data); } +DISABLE_CFI_ICALL void GLApiBase::glGetIntegeri_vRobustANGLEFn(GLenum target, GLuint index, GLsizei bufSize, @@ -3256,10 +3415,12 @@ data); } +DISABLE_CFI_ICALL void GLApiBase::glGetIntegervFn(GLenum pname, GLint* params) { driver_->fn.glGetIntegervFn(pname, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetIntegervRobustANGLEFn(GLenum pname, GLsizei bufSize, GLsizei* length, @@ -3267,6 +3428,7 @@ driver_->fn.glGetIntegervRobustANGLEFn(pname, bufSize, length, data); } +DISABLE_CFI_ICALL void GLApiBase::glGetInternalformativFn(GLenum target, GLenum internalformat, GLenum pname, @@ -3276,6 +3438,7 @@ params); } +DISABLE_CFI_ICALL void GLApiBase::glGetInternalformativRobustANGLEFn(GLenum target, GLenum internalformat, GLenum pname, @@ -3286,10 +3449,12 @@ bufSize, length, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetMultisamplefvFn(GLenum pname, GLuint index, GLfloat* val) { driver_->fn.glGetMultisamplefvFn(pname, index, val); } +DISABLE_CFI_ICALL void GLApiBase::glGetMultisamplefvRobustANGLEFn(GLenum pname, GLuint index, GLsizei bufSize, @@ -3299,6 +3464,7 @@ val); } +DISABLE_CFI_ICALL void GLApiBase::glGetnUniformfvRobustANGLEFn(GLuint program, GLint location, GLsizei bufSize, @@ -3308,6 +3474,7 @@ params); } +DISABLE_CFI_ICALL void GLApiBase::glGetnUniformivRobustANGLEFn(GLuint program, GLint location, GLsizei bufSize, @@ -3317,6 +3484,7 @@ params); } +DISABLE_CFI_ICALL void GLApiBase::glGetnUniformuivRobustANGLEFn(GLuint program, GLint location, GLsizei bufSize, @@ -3326,6 +3494,7 @@ params); } +DISABLE_CFI_ICALL void GLApiBase::glGetObjectLabelFn(GLenum identifier, GLuint name, GLsizei bufSize, @@ -3334,6 +3503,7 @@ driver_->fn.glGetObjectLabelFn(identifier, name, bufSize, length, label); } +DISABLE_CFI_ICALL void GLApiBase::glGetObjectPtrLabelFn(void* ptr, GLsizei bufSize, GLsizei* length, @@ -3341,10 +3511,12 @@ driver_->fn.glGetObjectPtrLabelFn(ptr, bufSize, length, label); } +DISABLE_CFI_ICALL void GLApiBase::glGetPointervFn(GLenum pname, void** params) { driver_->fn.glGetPointervFn(pname, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetPointervRobustANGLERobustANGLEFn(GLenum pname, GLsizei bufSize, GLsizei* length, @@ -3353,6 +3525,7 @@ params); } +DISABLE_CFI_ICALL void GLApiBase::glGetProgramBinaryFn(GLuint program, GLsizei bufSize, GLsizei* length, @@ -3362,6 +3535,7 @@ binary); } +DISABLE_CFI_ICALL void GLApiBase::glGetProgramInfoLogFn(GLuint program, GLsizei bufsize, GLsizei* length, @@ -3369,6 +3543,7 @@ driver_->fn.glGetProgramInfoLogFn(program, bufsize, length, infolog); } +DISABLE_CFI_ICALL void GLApiBase::glGetProgramInterfaceivFn(GLuint program, GLenum programInterface, GLenum pname, @@ -3377,6 +3552,7 @@ params); } +DISABLE_CFI_ICALL void GLApiBase::glGetProgramInterfaceivRobustANGLEFn(GLuint program, GLenum programInterface, GLenum pname, @@ -3387,10 +3563,12 @@ program, programInterface, pname, bufSize, length, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetProgramivFn(GLuint program, GLenum pname, GLint* params) { driver_->fn.glGetProgramivFn(program, pname, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetProgramivRobustANGLEFn(GLuint program, GLenum pname, GLsizei bufSize, @@ -3400,6 +3578,7 @@ params); } +DISABLE_CFI_ICALL void GLApiBase::glGetProgramResourceivFn(GLuint program, GLenum programInterface, GLuint index, @@ -3413,6 +3592,7 @@ params); } +DISABLE_CFI_ICALL GLint GLApiBase::glGetProgramResourceLocationFn(GLuint program, GLenum programInterface, const char* name) { @@ -3420,6 +3600,7 @@ name); } +DISABLE_CFI_ICALL void GLApiBase::glGetProgramResourceNameFn(GLuint program, GLenum programInterface, GLuint index, @@ -3430,10 +3611,12 @@ bufSize, length, name); } +DISABLE_CFI_ICALL void GLApiBase::glGetQueryivFn(GLenum target, GLenum pname, GLint* params) { driver_->fn.glGetQueryivFn(target, pname, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetQueryivRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -3442,12 +3625,14 @@ driver_->fn.glGetQueryivRobustANGLEFn(target, pname, bufSize, length, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetQueryObjecti64vFn(GLuint id, GLenum pname, GLint64* params) { driver_->fn.glGetQueryObjecti64vFn(id, pname, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetQueryObjecti64vRobustANGLEFn(GLuint id, GLenum pname, GLsizei bufSize, @@ -3457,10 +3642,12 @@ params); } +DISABLE_CFI_ICALL void GLApiBase::glGetQueryObjectivFn(GLuint id, GLenum pname, GLint* params) { driver_->fn.glGetQueryObjectivFn(id, pname, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetQueryObjectivRobustANGLEFn(GLuint id, GLenum pname, GLsizei bufSize, @@ -3470,12 +3657,14 @@ params); } +DISABLE_CFI_ICALL void GLApiBase::glGetQueryObjectui64vFn(GLuint id, GLenum pname, GLuint64* params) { driver_->fn.glGetQueryObjectui64vFn(id, pname, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetQueryObjectui64vRobustANGLEFn(GLuint id, GLenum pname, GLsizei bufSize, @@ -3485,10 +3674,12 @@ params); } +DISABLE_CFI_ICALL void GLApiBase::glGetQueryObjectuivFn(GLuint id, GLenum pname, GLuint* params) { driver_->fn.glGetQueryObjectuivFn(id, pname, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetQueryObjectuivRobustANGLEFn(GLuint id, GLenum pname, GLsizei bufSize, @@ -3498,12 +3689,14 @@ params); } +DISABLE_CFI_ICALL void GLApiBase::glGetRenderbufferParameterivEXTFn(GLenum target, GLenum pname, GLint* params) { driver_->fn.glGetRenderbufferParameterivEXTFn(target, pname, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetRenderbufferParameterivRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -3513,12 +3706,14 @@ length, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetSamplerParameterfvFn(GLuint sampler, GLenum pname, GLfloat* params) { driver_->fn.glGetSamplerParameterfvFn(sampler, pname, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetSamplerParameterfvRobustANGLEFn(GLuint sampler, GLenum pname, GLsizei bufSize, @@ -3528,6 +3723,7 @@ length, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetSamplerParameterIivRobustANGLEFn(GLuint sampler, GLenum pname, GLsizei bufSize, @@ -3537,6 +3733,7 @@ length, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetSamplerParameterIuivRobustANGLEFn(GLuint sampler, GLenum pname, GLsizei bufSize, @@ -3546,12 +3743,14 @@ length, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetSamplerParameterivFn(GLuint sampler, GLenum pname, GLint* params) { driver_->fn.glGetSamplerParameterivFn(sampler, pname, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetSamplerParameterivRobustANGLEFn(GLuint sampler, GLenum pname, GLsizei bufSize, @@ -3561,6 +3760,7 @@ length, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetShaderInfoLogFn(GLuint shader, GLsizei bufsize, GLsizei* length, @@ -3568,10 +3768,12 @@ driver_->fn.glGetShaderInfoLogFn(shader, bufsize, length, infolog); } +DISABLE_CFI_ICALL void GLApiBase::glGetShaderivFn(GLuint shader, GLenum pname, GLint* params) { driver_->fn.glGetShaderivFn(shader, pname, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetShaderivRobustANGLEFn(GLuint shader, GLenum pname, GLsizei bufSize, @@ -3581,6 +3783,7 @@ params); } +DISABLE_CFI_ICALL void GLApiBase::glGetShaderPrecisionFormatFn(GLenum shadertype, GLenum precisiontype, GLint* range, @@ -3589,6 +3792,7 @@ precision); } +DISABLE_CFI_ICALL void GLApiBase::glGetShaderSourceFn(GLuint shader, GLsizei bufsize, GLsizei* length, @@ -3596,14 +3800,17 @@ driver_->fn.glGetShaderSourceFn(shader, bufsize, length, source); } +DISABLE_CFI_ICALL const GLubyte* GLApiBase::glGetStringFn(GLenum name) { return driver_->fn.glGetStringFn(name); } +DISABLE_CFI_ICALL const GLubyte* GLApiBase::glGetStringiFn(GLenum name, GLuint index) { return driver_->fn.glGetStringiFn(name, index); } +DISABLE_CFI_ICALL void GLApiBase::glGetSyncivFn(GLsync sync, GLenum pname, GLsizei bufSize, @@ -3612,6 +3819,7 @@ driver_->fn.glGetSyncivFn(sync, pname, bufSize, length, values); } +DISABLE_CFI_ICALL void GLApiBase::glGetTexLevelParameterfvFn(GLenum target, GLint level, GLenum pname, @@ -3619,6 +3827,7 @@ driver_->fn.glGetTexLevelParameterfvFn(target, level, pname, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetTexLevelParameterfvRobustANGLEFn(GLenum target, GLint level, GLenum pname, @@ -3629,6 +3838,7 @@ bufSize, length, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetTexLevelParameterivFn(GLenum target, GLint level, GLenum pname, @@ -3636,6 +3846,7 @@ driver_->fn.glGetTexLevelParameterivFn(target, level, pname, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetTexLevelParameterivRobustANGLEFn(GLenum target, GLint level, GLenum pname, @@ -3646,12 +3857,14 @@ bufSize, length, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetTexParameterfvFn(GLenum target, GLenum pname, GLfloat* params) { driver_->fn.glGetTexParameterfvFn(target, pname, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetTexParameterfvRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -3661,6 +3874,7 @@ params); } +DISABLE_CFI_ICALL void GLApiBase::glGetTexParameterIivRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -3670,6 +3884,7 @@ params); } +DISABLE_CFI_ICALL void GLApiBase::glGetTexParameterIuivRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -3679,12 +3894,14 @@ params); } +DISABLE_CFI_ICALL void GLApiBase::glGetTexParameterivFn(GLenum target, GLenum pname, GLint* params) { driver_->fn.glGetTexParameterivFn(target, pname, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetTexParameterivRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -3694,6 +3911,7 @@ params); } +DISABLE_CFI_ICALL void GLApiBase::glGetTransformFeedbackVaryingFn(GLuint program, GLuint index, GLsizei bufSize, @@ -3705,6 +3923,7 @@ size, type, name); } +DISABLE_CFI_ICALL void GLApiBase::glGetTranslatedShaderSourceANGLEFn(GLuint shader, GLsizei bufsize, GLsizei* length, @@ -3713,17 +3932,20 @@ source); } +DISABLE_CFI_ICALL GLuint GLApiBase::glGetUniformBlockIndexFn(GLuint program, const char* uniformBlockName) { return driver_->fn.glGetUniformBlockIndexFn(program, uniformBlockName); } +DISABLE_CFI_ICALL void GLApiBase::glGetUniformfvFn(GLuint program, GLint location, GLfloat* params) { driver_->fn.glGetUniformfvFn(program, location, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetUniformfvRobustANGLEFn(GLuint program, GLint location, GLsizei bufSize, @@ -3733,6 +3955,7 @@ params); } +DISABLE_CFI_ICALL void GLApiBase::glGetUniformIndicesFn(GLuint program, GLsizei uniformCount, const char* const* uniformNames, @@ -3741,12 +3964,14 @@ uniformIndices); } +DISABLE_CFI_ICALL void GLApiBase::glGetUniformivFn(GLuint program, GLint location, GLint* params) { driver_->fn.glGetUniformivFn(program, location, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetUniformivRobustANGLEFn(GLuint program, GLint location, GLsizei bufSize, @@ -3756,16 +3981,19 @@ params); } +DISABLE_CFI_ICALL GLint GLApiBase::glGetUniformLocationFn(GLuint program, const char* name) { return driver_->fn.glGetUniformLocationFn(program, name); } +DISABLE_CFI_ICALL void GLApiBase::glGetUniformuivFn(GLuint program, GLint location, GLuint* params) { driver_->fn.glGetUniformuivFn(program, location, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetUniformuivRobustANGLEFn(GLuint program, GLint location, GLsizei bufSize, @@ -3775,12 +4003,14 @@ params); } +DISABLE_CFI_ICALL void GLApiBase::glGetVertexAttribfvFn(GLuint index, GLenum pname, GLfloat* params) { driver_->fn.glGetVertexAttribfvFn(index, pname, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetVertexAttribfvRobustANGLEFn(GLuint index, GLenum pname, GLsizei bufSize, @@ -3790,6 +4020,7 @@ params); } +DISABLE_CFI_ICALL void GLApiBase::glGetVertexAttribIivRobustANGLEFn(GLuint index, GLenum pname, GLsizei bufSize, @@ -3799,6 +4030,7 @@ params); } +DISABLE_CFI_ICALL void GLApiBase::glGetVertexAttribIuivRobustANGLEFn(GLuint index, GLenum pname, GLsizei bufSize, @@ -3808,12 +4040,14 @@ params); } +DISABLE_CFI_ICALL void GLApiBase::glGetVertexAttribivFn(GLuint index, GLenum pname, GLint* params) { driver_->fn.glGetVertexAttribivFn(index, pname, params); } +DISABLE_CFI_ICALL void GLApiBase::glGetVertexAttribivRobustANGLEFn(GLuint index, GLenum pname, GLsizei bufSize, @@ -3823,12 +4057,14 @@ params); } +DISABLE_CFI_ICALL void GLApiBase::glGetVertexAttribPointervFn(GLuint index, GLenum pname, void** pointer) { driver_->fn.glGetVertexAttribPointervFn(index, pname, pointer); } +DISABLE_CFI_ICALL void GLApiBase::glGetVertexAttribPointervRobustANGLEFn(GLuint index, GLenum pname, GLsizei bufSize, @@ -3838,20 +4074,24 @@ length, pointer); } +DISABLE_CFI_ICALL void GLApiBase::glHintFn(GLenum target, GLenum mode) { driver_->fn.glHintFn(target, mode); } +DISABLE_CFI_ICALL void GLApiBase::glInsertEventMarkerEXTFn(GLsizei length, const char* marker) { driver_->fn.glInsertEventMarkerEXTFn(length, marker); } +DISABLE_CFI_ICALL void GLApiBase::glInvalidateFramebufferFn(GLenum target, GLsizei numAttachments, const GLenum* attachments) { driver_->fn.glInvalidateFramebufferFn(target, numAttachments, attachments); } +DISABLE_CFI_ICALL void GLApiBase::glInvalidateSubFramebufferFn(GLenum target, GLsizei numAttachments, const GLenum* attachments, @@ -3863,78 +4103,97 @@ x, y, width, height); } +DISABLE_CFI_ICALL GLboolean GLApiBase::glIsBufferFn(GLuint buffer) { return driver_->fn.glIsBufferFn(buffer); } +DISABLE_CFI_ICALL GLboolean GLApiBase::glIsEnabledFn(GLenum cap) { return driver_->fn.glIsEnabledFn(cap); } +DISABLE_CFI_ICALL GLboolean GLApiBase::glIsFenceAPPLEFn(GLuint fence) { return driver_->fn.glIsFenceAPPLEFn(fence); } +DISABLE_CFI_ICALL GLboolean GLApiBase::glIsFenceNVFn(GLuint fence) { return driver_->fn.glIsFenceNVFn(fence); } +DISABLE_CFI_ICALL GLboolean GLApiBase::glIsFramebufferEXTFn(GLuint framebuffer) { return driver_->fn.glIsFramebufferEXTFn(framebuffer); } +DISABLE_CFI_ICALL GLboolean GLApiBase::glIsPathNVFn(GLuint path) { return driver_->fn.glIsPathNVFn(path); } +DISABLE_CFI_ICALL GLboolean GLApiBase::glIsProgramFn(GLuint program) { return driver_->fn.glIsProgramFn(program); } +DISABLE_CFI_ICALL GLboolean GLApiBase::glIsQueryFn(GLuint query) { return driver_->fn.glIsQueryFn(query); } +DISABLE_CFI_ICALL GLboolean GLApiBase::glIsRenderbufferEXTFn(GLuint renderbuffer) { return driver_->fn.glIsRenderbufferEXTFn(renderbuffer); } +DISABLE_CFI_ICALL GLboolean GLApiBase::glIsSamplerFn(GLuint sampler) { return driver_->fn.glIsSamplerFn(sampler); } +DISABLE_CFI_ICALL GLboolean GLApiBase::glIsShaderFn(GLuint shader) { return driver_->fn.glIsShaderFn(shader); } +DISABLE_CFI_ICALL GLboolean GLApiBase::glIsSyncFn(GLsync sync) { return driver_->fn.glIsSyncFn(sync); } +DISABLE_CFI_ICALL GLboolean GLApiBase::glIsTextureFn(GLuint texture) { return driver_->fn.glIsTextureFn(texture); } +DISABLE_CFI_ICALL GLboolean GLApiBase::glIsTransformFeedbackFn(GLuint id) { return driver_->fn.glIsTransformFeedbackFn(id); } +DISABLE_CFI_ICALL GLboolean GLApiBase::glIsVertexArrayOESFn(GLuint array) { return driver_->fn.glIsVertexArrayOESFn(array); } +DISABLE_CFI_ICALL void GLApiBase::glLineWidthFn(GLfloat width) { driver_->fn.glLineWidthFn(width); } +DISABLE_CFI_ICALL void GLApiBase::glLinkProgramFn(GLuint program) { driver_->fn.glLinkProgramFn(program); } +DISABLE_CFI_ICALL void* GLApiBase::glMapBufferFn(GLenum target, GLenum access) { return driver_->fn.glMapBufferFn(target, access); } +DISABLE_CFI_ICALL void* GLApiBase::glMapBufferRangeFn(GLenum target, GLintptr offset, GLsizeiptr length, @@ -3942,18 +4201,22 @@ return driver_->fn.glMapBufferRangeFn(target, offset, length, access); } +DISABLE_CFI_ICALL void GLApiBase::glMatrixLoadfEXTFn(GLenum matrixMode, const GLfloat* m) { driver_->fn.glMatrixLoadfEXTFn(matrixMode, m); } +DISABLE_CFI_ICALL void GLApiBase::glMatrixLoadIdentityEXTFn(GLenum matrixMode) { driver_->fn.glMatrixLoadIdentityEXTFn(matrixMode); } +DISABLE_CFI_ICALL void GLApiBase::glMemoryBarrierEXTFn(GLbitfield barriers) { driver_->fn.glMemoryBarrierEXTFn(barriers); } +DISABLE_CFI_ICALL void GLApiBase::glObjectLabelFn(GLenum identifier, GLuint name, GLsizei length, @@ -3961,12 +4224,14 @@ driver_->fn.glObjectLabelFn(identifier, name, length, label); } +DISABLE_CFI_ICALL void GLApiBase::glObjectPtrLabelFn(void* ptr, GLsizei length, const char* label) { driver_->fn.glObjectPtrLabelFn(ptr, length, label); } +DISABLE_CFI_ICALL void GLApiBase::glPathCommandsNVFn(GLuint path, GLsizei numCommands, const GLubyte* commands, @@ -3977,50 +4242,62 @@ coordType, coords); } +DISABLE_CFI_ICALL void GLApiBase::glPathParameterfNVFn(GLuint path, GLenum pname, GLfloat value) { driver_->fn.glPathParameterfNVFn(path, pname, value); } +DISABLE_CFI_ICALL void GLApiBase::glPathParameteriNVFn(GLuint path, GLenum pname, GLint value) { driver_->fn.glPathParameteriNVFn(path, pname, value); } +DISABLE_CFI_ICALL void GLApiBase::glPathStencilFuncNVFn(GLenum func, GLint ref, GLuint mask) { driver_->fn.glPathStencilFuncNVFn(func, ref, mask); } +DISABLE_CFI_ICALL void GLApiBase::glPauseTransformFeedbackFn(void) { driver_->fn.glPauseTransformFeedbackFn(); } +DISABLE_CFI_ICALL void GLApiBase::glPixelStoreiFn(GLenum pname, GLint param) { driver_->fn.glPixelStoreiFn(pname, param); } +DISABLE_CFI_ICALL void GLApiBase::glPointParameteriFn(GLenum pname, GLint param) { driver_->fn.glPointParameteriFn(pname, param); } +DISABLE_CFI_ICALL void GLApiBase::glPolygonModeFn(GLenum face, GLenum mode) { driver_->fn.glPolygonModeFn(face, mode); } +DISABLE_CFI_ICALL void GLApiBase::glPolygonOffsetFn(GLfloat factor, GLfloat units) { driver_->fn.glPolygonOffsetFn(factor, units); } +DISABLE_CFI_ICALL void GLApiBase::glPopDebugGroupFn() { driver_->fn.glPopDebugGroupFn(); } +DISABLE_CFI_ICALL void GLApiBase::glPopGroupMarkerEXTFn(void) { driver_->fn.glPopGroupMarkerEXTFn(); } +DISABLE_CFI_ICALL void GLApiBase::glPrimitiveRestartIndexFn(GLuint index) { driver_->fn.glPrimitiveRestartIndexFn(index); } +DISABLE_CFI_ICALL void GLApiBase::glProgramBinaryFn(GLuint program, GLenum binaryFormat, const GLvoid* binary, @@ -4028,12 +4305,14 @@ driver_->fn.glProgramBinaryFn(program, binaryFormat, binary, length); } +DISABLE_CFI_ICALL void GLApiBase::glProgramParameteriFn(GLuint program, GLenum pname, GLint value) { driver_->fn.glProgramParameteriFn(program, pname, value); } +DISABLE_CFI_ICALL void GLApiBase::glProgramPathFragmentInputGenNVFn(GLuint program, GLint location, GLenum genMode, @@ -4043,6 +4322,7 @@ components, coeffs); } +DISABLE_CFI_ICALL void GLApiBase::glPushDebugGroupFn(GLenum source, GLuint id, GLsizei length, @@ -4050,18 +4330,22 @@ driver_->fn.glPushDebugGroupFn(source, id, length, message); } +DISABLE_CFI_ICALL void GLApiBase::glPushGroupMarkerEXTFn(GLsizei length, const char* marker) { driver_->fn.glPushGroupMarkerEXTFn(length, marker); } +DISABLE_CFI_ICALL void GLApiBase::glQueryCounterFn(GLuint id, GLenum target) { driver_->fn.glQueryCounterFn(id, target); } +DISABLE_CFI_ICALL void GLApiBase::glReadBufferFn(GLenum src) { driver_->fn.glReadBufferFn(src); } +DISABLE_CFI_ICALL void GLApiBase::glReadnPixelsRobustANGLEFn(GLint x, GLint y, GLsizei width, @@ -4077,6 +4361,7 @@ bufSize, length, columns, rows, data); } +DISABLE_CFI_ICALL void GLApiBase::glReadPixelsFn(GLint x, GLint y, GLsizei width, @@ -4087,6 +4372,7 @@ driver_->fn.glReadPixelsFn(x, y, width, height, format, type, pixels); } +DISABLE_CFI_ICALL void GLApiBase::glReadPixelsRobustANGLEFn(GLint x, GLint y, GLsizei width, @@ -4102,10 +4388,12 @@ bufSize, length, columns, rows, pixels); } +DISABLE_CFI_ICALL void GLApiBase::glReleaseShaderCompilerFn(void) { driver_->fn.glReleaseShaderCompilerFn(); } +DISABLE_CFI_ICALL void GLApiBase::glRenderbufferStorageEXTFn(GLenum target, GLenum internalformat, GLsizei width, @@ -4113,6 +4401,7 @@ driver_->fn.glRenderbufferStorageEXTFn(target, internalformat, width, height); } +DISABLE_CFI_ICALL void GLApiBase::glRenderbufferStorageMultisampleFn(GLenum target, GLsizei samples, GLenum internalformat, @@ -4122,6 +4411,7 @@ internalformat, width, height); } +DISABLE_CFI_ICALL void GLApiBase::glRenderbufferStorageMultisampleEXTFn(GLenum target, GLsizei samples, GLenum internalformat, @@ -4131,30 +4421,36 @@ target, samples, internalformat, width, height); } +DISABLE_CFI_ICALL void GLApiBase::glRequestExtensionANGLEFn(const char* name) { driver_->fn.glRequestExtensionANGLEFn(name); } +DISABLE_CFI_ICALL void GLApiBase::glResumeTransformFeedbackFn(void) { driver_->fn.glResumeTransformFeedbackFn(); } +DISABLE_CFI_ICALL void GLApiBase::glSampleCoverageFn(GLclampf value, GLboolean invert) { driver_->fn.glSampleCoverageFn(value, invert); } +DISABLE_CFI_ICALL void GLApiBase::glSamplerParameterfFn(GLuint sampler, GLenum pname, GLfloat param) { driver_->fn.glSamplerParameterfFn(sampler, pname, param); } +DISABLE_CFI_ICALL void GLApiBase::glSamplerParameterfvFn(GLuint sampler, GLenum pname, const GLfloat* params) { driver_->fn.glSamplerParameterfvFn(sampler, pname, params); } +DISABLE_CFI_ICALL void GLApiBase::glSamplerParameterfvRobustANGLEFn(GLuint sampler, GLenum pname, GLsizei bufSize, @@ -4162,12 +4458,14 @@ driver_->fn.glSamplerParameterfvRobustANGLEFn(sampler, pname, bufSize, param); } +DISABLE_CFI_ICALL void GLApiBase::glSamplerParameteriFn(GLuint sampler, GLenum pname, GLint param) { driver_->fn.glSamplerParameteriFn(sampler, pname, param); } +DISABLE_CFI_ICALL void GLApiBase::glSamplerParameterIivRobustANGLEFn(GLuint sampler, GLenum pname, GLsizei bufSize, @@ -4176,6 +4474,7 @@ param); } +DISABLE_CFI_ICALL void GLApiBase::glSamplerParameterIuivRobustANGLEFn(GLuint sampler, GLenum pname, GLsizei bufSize, @@ -4184,12 +4483,14 @@ param); } +DISABLE_CFI_ICALL void GLApiBase::glSamplerParameterivFn(GLuint sampler, GLenum pname, const GLint* params) { driver_->fn.glSamplerParameterivFn(sampler, pname, params); } +DISABLE_CFI_ICALL void GLApiBase::glSamplerParameterivRobustANGLEFn(GLuint sampler, GLenum pname, GLsizei bufSize, @@ -4197,18 +4498,22 @@ driver_->fn.glSamplerParameterivRobustANGLEFn(sampler, pname, bufSize, param); } +DISABLE_CFI_ICALL void GLApiBase::glScissorFn(GLint x, GLint y, GLsizei width, GLsizei height) { driver_->fn.glScissorFn(x, y, width, height); } +DISABLE_CFI_ICALL void GLApiBase::glSetFenceAPPLEFn(GLuint fence) { driver_->fn.glSetFenceAPPLEFn(fence); } +DISABLE_CFI_ICALL void GLApiBase::glSetFenceNVFn(GLuint fence, GLenum condition) { driver_->fn.glSetFenceNVFn(fence, condition); } +DISABLE_CFI_ICALL void GLApiBase::glShaderBinaryFn(GLsizei n, const GLuint* shaders, GLenum binaryformat, @@ -4217,6 +4522,7 @@ driver_->fn.glShaderBinaryFn(n, shaders, binaryformat, binary, length); } +DISABLE_CFI_ICALL void GLApiBase::glShaderSourceFn(GLuint shader, GLsizei count, const char* const* str, @@ -4224,6 +4530,7 @@ driver_->fn.glShaderSourceFn(shader, count, str, length); } +DISABLE_CFI_ICALL void GLApiBase::glStencilFillPathInstancedNVFn(GLsizei numPaths, GLenum pathNameType, const void* paths, @@ -4237,16 +4544,19 @@ transformType, transformValues); } +DISABLE_CFI_ICALL void GLApiBase::glStencilFillPathNVFn(GLuint path, GLenum fillMode, GLuint mask) { driver_->fn.glStencilFillPathNVFn(path, fillMode, mask); } +DISABLE_CFI_ICALL void GLApiBase::glStencilFuncFn(GLenum func, GLint ref, GLuint mask) { driver_->fn.glStencilFuncFn(func, ref, mask); } +DISABLE_CFI_ICALL void GLApiBase::glStencilFuncSeparateFn(GLenum face, GLenum func, GLint ref, @@ -4254,18 +4564,22 @@ driver_->fn.glStencilFuncSeparateFn(face, func, ref, mask); } +DISABLE_CFI_ICALL void GLApiBase::glStencilMaskFn(GLuint mask) { driver_->fn.glStencilMaskFn(mask); } +DISABLE_CFI_ICALL void GLApiBase::glStencilMaskSeparateFn(GLenum face, GLuint mask) { driver_->fn.glStencilMaskSeparateFn(face, mask); } +DISABLE_CFI_ICALL void GLApiBase::glStencilOpFn(GLenum fail, GLenum zfail, GLenum zpass) { driver_->fn.glStencilOpFn(fail, zfail, zpass); } +DISABLE_CFI_ICALL void GLApiBase::glStencilOpSeparateFn(GLenum face, GLenum fail, GLenum zfail, @@ -4273,6 +4587,7 @@ driver_->fn.glStencilOpSeparateFn(face, fail, zfail, zpass); } +DISABLE_CFI_ICALL void GLApiBase::glStencilStrokePathInstancedNVFn( GLsizei numPaths, GLenum pathNameType, @@ -4287,12 +4602,14 @@ transformType, transformValues); } +DISABLE_CFI_ICALL void GLApiBase::glStencilStrokePathNVFn(GLuint path, GLint reference, GLuint mask) { driver_->fn.glStencilStrokePathNVFn(path, reference, mask); } +DISABLE_CFI_ICALL void GLApiBase::glStencilThenCoverFillPathInstancedNVFn( GLsizei numPaths, GLenum pathNameType, @@ -4308,6 +4625,7 @@ transformType, transformValues); } +DISABLE_CFI_ICALL void GLApiBase::glStencilThenCoverFillPathNVFn(GLuint path, GLenum fillMode, GLuint mask, @@ -4315,6 +4633,7 @@ driver_->fn.glStencilThenCoverFillPathNVFn(path, fillMode, mask, coverMode); } +DISABLE_CFI_ICALL void GLApiBase::glStencilThenCoverStrokePathInstancedNVFn( GLsizei numPaths, GLenum pathNameType, @@ -4330,6 +4649,7 @@ transformType, transformValues); } +DISABLE_CFI_ICALL void GLApiBase::glStencilThenCoverStrokePathNVFn(GLuint path, GLint reference, GLuint mask, @@ -4338,20 +4658,24 @@ coverMode); } +DISABLE_CFI_ICALL GLboolean GLApiBase::glTestFenceAPPLEFn(GLuint fence) { return driver_->fn.glTestFenceAPPLEFn(fence); } +DISABLE_CFI_ICALL GLboolean GLApiBase::glTestFenceNVFn(GLuint fence) { return driver_->fn.glTestFenceNVFn(fence); } +DISABLE_CFI_ICALL void GLApiBase::glTexBufferFn(GLenum target, GLenum internalformat, GLuint buffer) { driver_->fn.glTexBufferFn(target, internalformat, buffer); } +DISABLE_CFI_ICALL void GLApiBase::glTexBufferRangeFn(GLenum target, GLenum internalformat, GLuint buffer, @@ -4360,6 +4684,7 @@ driver_->fn.glTexBufferRangeFn(target, internalformat, buffer, offset, size); } +DISABLE_CFI_ICALL void GLApiBase::glTexImage2DFn(GLenum target, GLint level, GLint internalformat, @@ -4373,6 +4698,7 @@ border, format, type, pixels); } +DISABLE_CFI_ICALL void GLApiBase::glTexImage2DRobustANGLEFn(GLenum target, GLint level, GLint internalformat, @@ -4388,6 +4714,7 @@ pixels); } +DISABLE_CFI_ICALL void GLApiBase::glTexImage3DFn(GLenum target, GLint level, GLint internalformat, @@ -4402,6 +4729,7 @@ depth, border, format, type, pixels); } +DISABLE_CFI_ICALL void GLApiBase::glTexImage3DRobustANGLEFn(GLenum target, GLint level, GLint internalformat, @@ -4418,16 +4746,19 @@ bufSize, pixels); } +DISABLE_CFI_ICALL void GLApiBase::glTexParameterfFn(GLenum target, GLenum pname, GLfloat param) { driver_->fn.glTexParameterfFn(target, pname, param); } +DISABLE_CFI_ICALL void GLApiBase::glTexParameterfvFn(GLenum target, GLenum pname, const GLfloat* params) { driver_->fn.glTexParameterfvFn(target, pname, params); } +DISABLE_CFI_ICALL void GLApiBase::glTexParameterfvRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -4435,10 +4766,12 @@ driver_->fn.glTexParameterfvRobustANGLEFn(target, pname, bufSize, params); } +DISABLE_CFI_ICALL void GLApiBase::glTexParameteriFn(GLenum target, GLenum pname, GLint param) { driver_->fn.glTexParameteriFn(target, pname, param); } +DISABLE_CFI_ICALL void GLApiBase::glTexParameterIivRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -4446,6 +4779,7 @@ driver_->fn.glTexParameterIivRobustANGLEFn(target, pname, bufSize, params); } +DISABLE_CFI_ICALL void GLApiBase::glTexParameterIuivRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -4453,12 +4787,14 @@ driver_->fn.glTexParameterIuivRobustANGLEFn(target, pname, bufSize, params); } +DISABLE_CFI_ICALL void GLApiBase::glTexParameterivFn(GLenum target, GLenum pname, const GLint* params) { driver_->fn.glTexParameterivFn(target, pname, params); } +DISABLE_CFI_ICALL void GLApiBase::glTexParameterivRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -4466,6 +4802,7 @@ driver_->fn.glTexParameterivRobustANGLEFn(target, pname, bufSize, params); } +DISABLE_CFI_ICALL void GLApiBase::glTexStorage2DEXTFn(GLenum target, GLsizei levels, GLenum internalformat, @@ -4475,6 +4812,7 @@ height); } +DISABLE_CFI_ICALL void GLApiBase::glTexStorage3DFn(GLenum target, GLsizei levels, GLenum internalformat, @@ -4485,6 +4823,7 @@ depth); } +DISABLE_CFI_ICALL void GLApiBase::glTexSubImage2DFn(GLenum target, GLint level, GLint xoffset, @@ -4498,6 +4837,7 @@ format, type, pixels); } +DISABLE_CFI_ICALL void GLApiBase::glTexSubImage2DRobustANGLEFn(GLenum target, GLint level, GLint xoffset, @@ -4513,6 +4853,7 @@ pixels); } +DISABLE_CFI_ICALL void GLApiBase::glTexSubImage3DFn(GLenum target, GLint level, GLint xoffset, @@ -4528,6 +4869,7 @@ height, depth, format, type, pixels); } +DISABLE_CFI_ICALL void GLApiBase::glTexSubImage3DRobustANGLEFn(GLenum target, GLint level, GLint xoffset, @@ -4545,6 +4887,7 @@ format, type, bufSize, pixels); } +DISABLE_CFI_ICALL void GLApiBase::glTransformFeedbackVaryingsFn(GLuint program, GLsizei count, const char* const* varyings, @@ -4553,80 +4896,97 @@ bufferMode); } +DISABLE_CFI_ICALL void GLApiBase::glUniform1fFn(GLint location, GLfloat x) { driver_->fn.glUniform1fFn(location, x); } +DISABLE_CFI_ICALL void GLApiBase::glUniform1fvFn(GLint location, GLsizei count, const GLfloat* v) { driver_->fn.glUniform1fvFn(location, count, v); } +DISABLE_CFI_ICALL void GLApiBase::glUniform1iFn(GLint location, GLint x) { driver_->fn.glUniform1iFn(location, x); } +DISABLE_CFI_ICALL void GLApiBase::glUniform1ivFn(GLint location, GLsizei count, const GLint* v) { driver_->fn.glUniform1ivFn(location, count, v); } +DISABLE_CFI_ICALL void GLApiBase::glUniform1uiFn(GLint location, GLuint v0) { driver_->fn.glUniform1uiFn(location, v0); } +DISABLE_CFI_ICALL void GLApiBase::glUniform1uivFn(GLint location, GLsizei count, const GLuint* v) { driver_->fn.glUniform1uivFn(location, count, v); } +DISABLE_CFI_ICALL void GLApiBase::glUniform2fFn(GLint location, GLfloat x, GLfloat y) { driver_->fn.glUniform2fFn(location, x, y); } +DISABLE_CFI_ICALL void GLApiBase::glUniform2fvFn(GLint location, GLsizei count, const GLfloat* v) { driver_->fn.glUniform2fvFn(location, count, v); } +DISABLE_CFI_ICALL void GLApiBase::glUniform2iFn(GLint location, GLint x, GLint y) { driver_->fn.glUniform2iFn(location, x, y); } +DISABLE_CFI_ICALL void GLApiBase::glUniform2ivFn(GLint location, GLsizei count, const GLint* v) { driver_->fn.glUniform2ivFn(location, count, v); } +DISABLE_CFI_ICALL void GLApiBase::glUniform2uiFn(GLint location, GLuint v0, GLuint v1) { driver_->fn.glUniform2uiFn(location, v0, v1); } +DISABLE_CFI_ICALL void GLApiBase::glUniform2uivFn(GLint location, GLsizei count, const GLuint* v) { driver_->fn.glUniform2uivFn(location, count, v); } +DISABLE_CFI_ICALL void GLApiBase::glUniform3fFn(GLint location, GLfloat x, GLfloat y, GLfloat z) { driver_->fn.glUniform3fFn(location, x, y, z); } +DISABLE_CFI_ICALL void GLApiBase::glUniform3fvFn(GLint location, GLsizei count, const GLfloat* v) { driver_->fn.glUniform3fvFn(location, count, v); } +DISABLE_CFI_ICALL void GLApiBase::glUniform3iFn(GLint location, GLint x, GLint y, GLint z) { driver_->fn.glUniform3iFn(location, x, y, z); } +DISABLE_CFI_ICALL void GLApiBase::glUniform3ivFn(GLint location, GLsizei count, const GLint* v) { driver_->fn.glUniform3ivFn(location, count, v); } +DISABLE_CFI_ICALL void GLApiBase::glUniform3uiFn(GLint location, GLuint v0, GLuint v1, @@ -4634,12 +4994,14 @@ driver_->fn.glUniform3uiFn(location, v0, v1, v2); } +DISABLE_CFI_ICALL void GLApiBase::glUniform3uivFn(GLint location, GLsizei count, const GLuint* v) { driver_->fn.glUniform3uivFn(location, count, v); } +DISABLE_CFI_ICALL void GLApiBase::glUniform4fFn(GLint location, GLfloat x, GLfloat y, @@ -4648,12 +5010,14 @@ driver_->fn.glUniform4fFn(location, x, y, z, w); } +DISABLE_CFI_ICALL void GLApiBase::glUniform4fvFn(GLint location, GLsizei count, const GLfloat* v) { driver_->fn.glUniform4fvFn(location, count, v); } +DISABLE_CFI_ICALL void GLApiBase::glUniform4iFn(GLint location, GLint x, GLint y, @@ -4662,10 +5026,12 @@ driver_->fn.glUniform4iFn(location, x, y, z, w); } +DISABLE_CFI_ICALL void GLApiBase::glUniform4ivFn(GLint location, GLsizei count, const GLint* v) { driver_->fn.glUniform4ivFn(location, count, v); } +DISABLE_CFI_ICALL void GLApiBase::glUniform4uiFn(GLint location, GLuint v0, GLuint v1, @@ -4674,12 +5040,14 @@ driver_->fn.glUniform4uiFn(location, v0, v1, v2, v3); } +DISABLE_CFI_ICALL void GLApiBase::glUniform4uivFn(GLint location, GLsizei count, const GLuint* v) { driver_->fn.glUniform4uivFn(location, count, v); } +DISABLE_CFI_ICALL void GLApiBase::glUniformBlockBindingFn(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding) { @@ -4687,6 +5055,7 @@ uniformBlockBinding); } +DISABLE_CFI_ICALL void GLApiBase::glUniformMatrix2fvFn(GLint location, GLsizei count, GLboolean transpose, @@ -4694,6 +5063,7 @@ driver_->fn.glUniformMatrix2fvFn(location, count, transpose, value); } +DISABLE_CFI_ICALL void GLApiBase::glUniformMatrix2x3fvFn(GLint location, GLsizei count, GLboolean transpose, @@ -4701,6 +5071,7 @@ driver_->fn.glUniformMatrix2x3fvFn(location, count, transpose, value); } +DISABLE_CFI_ICALL void GLApiBase::glUniformMatrix2x4fvFn(GLint location, GLsizei count, GLboolean transpose, @@ -4708,6 +5079,7 @@ driver_->fn.glUniformMatrix2x4fvFn(location, count, transpose, value); } +DISABLE_CFI_ICALL void GLApiBase::glUniformMatrix3fvFn(GLint location, GLsizei count, GLboolean transpose, @@ -4715,6 +5087,7 @@ driver_->fn.glUniformMatrix3fvFn(location, count, transpose, value); } +DISABLE_CFI_ICALL void GLApiBase::glUniformMatrix3x2fvFn(GLint location, GLsizei count, GLboolean transpose, @@ -4722,6 +5095,7 @@ driver_->fn.glUniformMatrix3x2fvFn(location, count, transpose, value); } +DISABLE_CFI_ICALL void GLApiBase::glUniformMatrix3x4fvFn(GLint location, GLsizei count, GLboolean transpose, @@ -4729,6 +5103,7 @@ driver_->fn.glUniformMatrix3x4fvFn(location, count, transpose, value); } +DISABLE_CFI_ICALL void GLApiBase::glUniformMatrix4fvFn(GLint location, GLsizei count, GLboolean transpose, @@ -4736,6 +5111,7 @@ driver_->fn.glUniformMatrix4fvFn(location, count, transpose, value); } +DISABLE_CFI_ICALL void GLApiBase::glUniformMatrix4x2fvFn(GLint location, GLsizei count, GLboolean transpose, @@ -4743,6 +5119,7 @@ driver_->fn.glUniformMatrix4x2fvFn(location, count, transpose, value); } +DISABLE_CFI_ICALL void GLApiBase::glUniformMatrix4x3fvFn(GLint location, GLsizei count, GLboolean transpose, @@ -4750,34 +5127,42 @@ driver_->fn.glUniformMatrix4x3fvFn(location, count, transpose, value); } +DISABLE_CFI_ICALL GLboolean GLApiBase::glUnmapBufferFn(GLenum target) { return driver_->fn.glUnmapBufferFn(target); } +DISABLE_CFI_ICALL void GLApiBase::glUseProgramFn(GLuint program) { driver_->fn.glUseProgramFn(program); } +DISABLE_CFI_ICALL void GLApiBase::glValidateProgramFn(GLuint program) { driver_->fn.glValidateProgramFn(program); } +DISABLE_CFI_ICALL void GLApiBase::glVertexAttrib1fFn(GLuint indx, GLfloat x) { driver_->fn.glVertexAttrib1fFn(indx, x); } +DISABLE_CFI_ICALL void GLApiBase::glVertexAttrib1fvFn(GLuint indx, const GLfloat* values) { driver_->fn.glVertexAttrib1fvFn(indx, values); } +DISABLE_CFI_ICALL void GLApiBase::glVertexAttrib2fFn(GLuint indx, GLfloat x, GLfloat y) { driver_->fn.glVertexAttrib2fFn(indx, x, y); } +DISABLE_CFI_ICALL void GLApiBase::glVertexAttrib2fvFn(GLuint indx, const GLfloat* values) { driver_->fn.glVertexAttrib2fvFn(indx, values); } +DISABLE_CFI_ICALL void GLApiBase::glVertexAttrib3fFn(GLuint indx, GLfloat x, GLfloat y, @@ -4785,10 +5170,12 @@ driver_->fn.glVertexAttrib3fFn(indx, x, y, z); } +DISABLE_CFI_ICALL void GLApiBase::glVertexAttrib3fvFn(GLuint indx, const GLfloat* values) { driver_->fn.glVertexAttrib3fvFn(indx, values); } +DISABLE_CFI_ICALL void GLApiBase::glVertexAttrib4fFn(GLuint indx, GLfloat x, GLfloat y, @@ -4797,14 +5184,17 @@ driver_->fn.glVertexAttrib4fFn(indx, x, y, z, w); } +DISABLE_CFI_ICALL void GLApiBase::glVertexAttrib4fvFn(GLuint indx, const GLfloat* values) { driver_->fn.glVertexAttrib4fvFn(indx, values); } +DISABLE_CFI_ICALL void GLApiBase::glVertexAttribDivisorANGLEFn(GLuint index, GLuint divisor) { driver_->fn.glVertexAttribDivisorANGLEFn(index, divisor); } +DISABLE_CFI_ICALL void GLApiBase::glVertexAttribI4iFn(GLuint indx, GLint x, GLint y, @@ -4813,10 +5203,12 @@ driver_->fn.glVertexAttribI4iFn(indx, x, y, z, w); } +DISABLE_CFI_ICALL void GLApiBase::glVertexAttribI4ivFn(GLuint indx, const GLint* values) { driver_->fn.glVertexAttribI4ivFn(indx, values); } +DISABLE_CFI_ICALL void GLApiBase::glVertexAttribI4uiFn(GLuint indx, GLuint x, GLuint y, @@ -4825,10 +5217,12 @@ driver_->fn.glVertexAttribI4uiFn(indx, x, y, z, w); } +DISABLE_CFI_ICALL void GLApiBase::glVertexAttribI4uivFn(GLuint indx, const GLuint* values) { driver_->fn.glVertexAttribI4uivFn(indx, values); } +DISABLE_CFI_ICALL void GLApiBase::glVertexAttribIPointerFn(GLuint indx, GLint size, GLenum type, @@ -4837,6 +5231,7 @@ driver_->fn.glVertexAttribIPointerFn(indx, size, type, stride, ptr); } +DISABLE_CFI_ICALL void GLApiBase::glVertexAttribPointerFn(GLuint indx, GLint size, GLenum type, @@ -4847,46 +5242,55 @@ ptr); } +DISABLE_CFI_ICALL void GLApiBase::glViewportFn(GLint x, GLint y, GLsizei width, GLsizei height) { driver_->fn.glViewportFn(x, y, width, height); } +DISABLE_CFI_ICALL void GLApiBase::glWaitSyncFn(GLsync sync, GLbitfield flags, GLuint64 timeout) { driver_->fn.glWaitSyncFn(sync, flags, timeout); } +DISABLE_CFI_ICALL void GLApiBase::glWindowRectanglesEXTFn(GLenum mode, GLsizei n, const GLint* box) { driver_->fn.glWindowRectanglesEXTFn(mode, n, box); } +DISABLE_CFI_ICALL void TraceGLApi::glActiveTextureFn(GLenum texture) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glActiveTexture") gl_api_->glActiveTextureFn(texture); } +DISABLE_CFI_ICALL void TraceGLApi::glApplyFramebufferAttachmentCMAAINTELFn(void) { TRACE_EVENT_BINARY_EFFICIENT0( "gpu", "TraceGLAPI::glApplyFramebufferAttachmentCMAAINTEL") gl_api_->glApplyFramebufferAttachmentCMAAINTELFn(); } +DISABLE_CFI_ICALL void TraceGLApi::glAttachShaderFn(GLuint program, GLuint shader) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glAttachShader") gl_api_->glAttachShaderFn(program, shader); } +DISABLE_CFI_ICALL void TraceGLApi::glBeginQueryFn(GLenum target, GLuint id) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glBeginQuery") gl_api_->glBeginQueryFn(target, id); } +DISABLE_CFI_ICALL void TraceGLApi::glBeginTransformFeedbackFn(GLenum primitiveMode) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glBeginTransformFeedback") gl_api_->glBeginTransformFeedbackFn(primitiveMode); } +DISABLE_CFI_ICALL void TraceGLApi::glBindAttribLocationFn(GLuint program, GLuint index, const char* name) { @@ -4894,11 +5298,13 @@ gl_api_->glBindAttribLocationFn(program, index, name); } +DISABLE_CFI_ICALL void TraceGLApi::glBindBufferFn(GLenum target, GLuint buffer) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glBindBuffer") gl_api_->glBindBufferFn(target, buffer); } +DISABLE_CFI_ICALL void TraceGLApi::glBindBufferBaseFn(GLenum target, GLuint index, GLuint buffer) { @@ -4906,6 +5312,7 @@ gl_api_->glBindBufferBaseFn(target, index, buffer); } +DISABLE_CFI_ICALL void TraceGLApi::glBindBufferRangeFn(GLenum target, GLuint index, GLuint buffer, @@ -4915,6 +5322,7 @@ gl_api_->glBindBufferRangeFn(target, index, buffer, offset, size); } +DISABLE_CFI_ICALL void TraceGLApi::glBindFragDataLocationFn(GLuint program, GLuint colorNumber, const char* name) { @@ -4922,6 +5330,7 @@ gl_api_->glBindFragDataLocationFn(program, colorNumber, name); } +DISABLE_CFI_ICALL void TraceGLApi::glBindFragDataLocationIndexedFn(GLuint program, GLuint colorNumber, GLuint index, @@ -4931,11 +5340,13 @@ gl_api_->glBindFragDataLocationIndexedFn(program, colorNumber, index, name); } +DISABLE_CFI_ICALL void TraceGLApi::glBindFramebufferEXTFn(GLenum target, GLuint framebuffer) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glBindFramebufferEXT") gl_api_->glBindFramebufferEXTFn(target, framebuffer); } +DISABLE_CFI_ICALL void TraceGLApi::glBindImageTextureEXTFn(GLuint index, GLuint texture, GLint level, @@ -4948,26 +5359,31 @@ access, format); } +DISABLE_CFI_ICALL void TraceGLApi::glBindRenderbufferEXTFn(GLenum target, GLuint renderbuffer) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glBindRenderbufferEXT") gl_api_->glBindRenderbufferEXTFn(target, renderbuffer); } +DISABLE_CFI_ICALL void TraceGLApi::glBindSamplerFn(GLuint unit, GLuint sampler) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glBindSampler") gl_api_->glBindSamplerFn(unit, sampler); } +DISABLE_CFI_ICALL void TraceGLApi::glBindTextureFn(GLenum target, GLuint texture) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glBindTexture") gl_api_->glBindTextureFn(target, texture); } +DISABLE_CFI_ICALL void TraceGLApi::glBindTransformFeedbackFn(GLenum target, GLuint id) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glBindTransformFeedback") gl_api_->glBindTransformFeedbackFn(target, id); } +DISABLE_CFI_ICALL void TraceGLApi::glBindUniformLocationCHROMIUMFn(GLuint program, GLint location, const char* name) { @@ -4976,16 +5392,19 @@ gl_api_->glBindUniformLocationCHROMIUMFn(program, location, name); } +DISABLE_CFI_ICALL void TraceGLApi::glBindVertexArrayOESFn(GLuint array) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glBindVertexArrayOES") gl_api_->glBindVertexArrayOESFn(array); } +DISABLE_CFI_ICALL void TraceGLApi::glBlendBarrierKHRFn(void) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glBlendBarrierKHR") gl_api_->glBlendBarrierKHRFn(); } +DISABLE_CFI_ICALL void TraceGLApi::glBlendColorFn(GLclampf red, GLclampf green, GLclampf blue, @@ -4994,21 +5413,25 @@ gl_api_->glBlendColorFn(red, green, blue, alpha); } +DISABLE_CFI_ICALL void TraceGLApi::glBlendEquationFn(GLenum mode) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glBlendEquation") gl_api_->glBlendEquationFn(mode); } +DISABLE_CFI_ICALL void TraceGLApi::glBlendEquationSeparateFn(GLenum modeRGB, GLenum modeAlpha) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glBlendEquationSeparate") gl_api_->glBlendEquationSeparateFn(modeRGB, modeAlpha); } +DISABLE_CFI_ICALL void TraceGLApi::glBlendFuncFn(GLenum sfactor, GLenum dfactor) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glBlendFunc") gl_api_->glBlendFuncFn(sfactor, dfactor); } +DISABLE_CFI_ICALL void TraceGLApi::glBlendFuncSeparateFn(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, @@ -5017,6 +5440,7 @@ gl_api_->glBlendFuncSeparateFn(srcRGB, dstRGB, srcAlpha, dstAlpha); } +DISABLE_CFI_ICALL void TraceGLApi::glBlitFramebufferFn(GLint srcX0, GLint srcY0, GLint srcX1, @@ -5032,6 +5456,7 @@ dstY1, mask, filter); } +DISABLE_CFI_ICALL void TraceGLApi::glBufferDataFn(GLenum target, GLsizeiptr size, const void* data, @@ -5040,6 +5465,7 @@ gl_api_->glBufferDataFn(target, size, data, usage); } +DISABLE_CFI_ICALL void TraceGLApi::glBufferSubDataFn(GLenum target, GLintptr offset, GLsizeiptr size, @@ -5048,17 +5474,20 @@ gl_api_->glBufferSubDataFn(target, offset, size, data); } +DISABLE_CFI_ICALL GLenum TraceGLApi::glCheckFramebufferStatusEXTFn(GLenum target) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glCheckFramebufferStatusEXT") return gl_api_->glCheckFramebufferStatusEXTFn(target); } +DISABLE_CFI_ICALL void TraceGLApi::glClearFn(GLbitfield mask) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glClear") gl_api_->glClearFn(mask); } +DISABLE_CFI_ICALL void TraceGLApi::glClearBufferfiFn(GLenum buffer, GLint drawbuffer, const GLfloat depth, @@ -5067,6 +5496,7 @@ gl_api_->glClearBufferfiFn(buffer, drawbuffer, depth, stencil); } +DISABLE_CFI_ICALL void TraceGLApi::glClearBufferfvFn(GLenum buffer, GLint drawbuffer, const GLfloat* value) { @@ -5074,6 +5504,7 @@ gl_api_->glClearBufferfvFn(buffer, drawbuffer, value); } +DISABLE_CFI_ICALL void TraceGLApi::glClearBufferivFn(GLenum buffer, GLint drawbuffer, const GLint* value) { @@ -5081,6 +5512,7 @@ gl_api_->glClearBufferivFn(buffer, drawbuffer, value); } +DISABLE_CFI_ICALL void TraceGLApi::glClearBufferuivFn(GLenum buffer, GLint drawbuffer, const GLuint* value) { @@ -5088,6 +5520,7 @@ gl_api_->glClearBufferuivFn(buffer, drawbuffer, value); } +DISABLE_CFI_ICALL void TraceGLApi::glClearColorFn(GLclampf red, GLclampf green, GLclampf blue, @@ -5096,21 +5529,25 @@ gl_api_->glClearColorFn(red, green, blue, alpha); } +DISABLE_CFI_ICALL void TraceGLApi::glClearDepthFn(GLclampd depth) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glClearDepth") gl_api_->glClearDepthFn(depth); } +DISABLE_CFI_ICALL void TraceGLApi::glClearDepthfFn(GLclampf depth) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glClearDepthf") gl_api_->glClearDepthfFn(depth); } +DISABLE_CFI_ICALL void TraceGLApi::glClearStencilFn(GLint s) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glClearStencil") gl_api_->glClearStencilFn(s); } +DISABLE_CFI_ICALL GLenum TraceGLApi::glClientWaitSyncFn(GLsync sync, GLbitfield flags, GLuint64 timeout) { @@ -5118,6 +5555,7 @@ return gl_api_->glClientWaitSyncFn(sync, flags, timeout); } +DISABLE_CFI_ICALL void TraceGLApi::glColorMaskFn(GLboolean red, GLboolean green, GLboolean blue, @@ -5126,11 +5564,13 @@ gl_api_->glColorMaskFn(red, green, blue, alpha); } +DISABLE_CFI_ICALL void TraceGLApi::glCompileShaderFn(GLuint shader) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glCompileShader") gl_api_->glCompileShaderFn(shader); } +DISABLE_CFI_ICALL void TraceGLApi::glCompressedCopyTextureCHROMIUMFn(GLuint sourceId, GLuint destId) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", @@ -5138,6 +5578,7 @@ gl_api_->glCompressedCopyTextureCHROMIUMFn(sourceId, destId); } +DISABLE_CFI_ICALL void TraceGLApi::glCompressedTexImage2DFn(GLenum target, GLint level, GLenum internalformat, @@ -5151,6 +5592,7 @@ height, border, imageSize, data); } +DISABLE_CFI_ICALL void TraceGLApi::glCompressedTexImage2DRobustANGLEFn(GLenum target, GLint level, GLenum internalformat, @@ -5167,6 +5609,7 @@ dataSize, data); } +DISABLE_CFI_ICALL void TraceGLApi::glCompressedTexImage3DFn(GLenum target, GLint level, GLenum internalformat, @@ -5181,6 +5624,7 @@ height, depth, border, imageSize, data); } +DISABLE_CFI_ICALL void TraceGLApi::glCompressedTexImage3DRobustANGLEFn(GLenum target, GLint level, GLenum internalformat, @@ -5198,6 +5642,7 @@ imageSize, dataSize, data); } +DISABLE_CFI_ICALL void TraceGLApi::glCompressedTexSubImage2DFn(GLenum target, GLint level, GLint xoffset, @@ -5212,6 +5657,7 @@ height, format, imageSize, data); } +DISABLE_CFI_ICALL void TraceGLApi::glCompressedTexSubImage2DRobustANGLEFn(GLenum target, GLint level, GLint xoffset, @@ -5229,6 +5675,7 @@ dataSize, data); } +DISABLE_CFI_ICALL void TraceGLApi::glCompressedTexSubImage3DFn(GLenum target, GLint level, GLint xoffset, @@ -5246,6 +5693,7 @@ data); } +DISABLE_CFI_ICALL void TraceGLApi::glCompressedTexSubImage3DRobustANGLEFn(GLenum target, GLint level, GLint xoffset, @@ -5265,6 +5713,7 @@ imageSize, dataSize, data); } +DISABLE_CFI_ICALL void TraceGLApi::glCopyBufferSubDataFn(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, @@ -5275,6 +5724,7 @@ writeOffset, size); } +DISABLE_CFI_ICALL void TraceGLApi::glCopySubTextureCHROMIUMFn(GLuint sourceId, GLint sourceLevel, GLenum destTarget, @@ -5296,6 +5746,7 @@ unpackUnmultiplyAlpha); } +DISABLE_CFI_ICALL void TraceGLApi::glCopyTexImage2DFn(GLenum target, GLint level, GLenum internalformat, @@ -5309,6 +5760,7 @@ height, border); } +DISABLE_CFI_ICALL void TraceGLApi::glCopyTexSubImage2DFn(GLenum target, GLint level, GLint xoffset, @@ -5322,6 +5774,7 @@ height); } +DISABLE_CFI_ICALL void TraceGLApi::glCopyTexSubImage3DFn(GLenum target, GLint level, GLint xoffset, @@ -5336,6 +5789,7 @@ width, height); } +DISABLE_CFI_ICALL void TraceGLApi::glCopyTextureCHROMIUMFn(GLuint sourceId, GLint sourceLevel, GLenum destTarget, @@ -5352,11 +5806,13 @@ destType, unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha); } +DISABLE_CFI_ICALL void TraceGLApi::glCoverageModulationNVFn(GLenum components) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glCoverageModulationNV") gl_api_->glCoverageModulationNVFn(components); } +DISABLE_CFI_ICALL void TraceGLApi::glCoverFillPathInstancedNVFn(GLsizei numPaths, GLenum pathNameType, const void* paths, @@ -5370,11 +5826,13 @@ transformValues); } +DISABLE_CFI_ICALL void TraceGLApi::glCoverFillPathNVFn(GLuint path, GLenum coverMode) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glCoverFillPathNV") gl_api_->glCoverFillPathNVFn(path, coverMode); } +DISABLE_CFI_ICALL void TraceGLApi::glCoverStrokePathInstancedNVFn( GLsizei numPaths, GLenum pathNameType, @@ -5390,32 +5848,38 @@ transformValues); } +DISABLE_CFI_ICALL void TraceGLApi::glCoverStrokePathNVFn(GLuint name, GLenum coverMode) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glCoverStrokePathNV") gl_api_->glCoverStrokePathNVFn(name, coverMode); } +DISABLE_CFI_ICALL GLuint TraceGLApi::glCreateProgramFn(void) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glCreateProgram") return gl_api_->glCreateProgramFn(); } +DISABLE_CFI_ICALL GLuint TraceGLApi::glCreateShaderFn(GLenum type) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glCreateShader") return gl_api_->glCreateShaderFn(type); } +DISABLE_CFI_ICALL void TraceGLApi::glCullFaceFn(GLenum mode) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glCullFace") gl_api_->glCullFaceFn(mode); } +DISABLE_CFI_ICALL void TraceGLApi::glDebugMessageCallbackFn(GLDEBUGPROC callback, const void* userParam) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glDebugMessageCallback") gl_api_->glDebugMessageCallbackFn(callback, userParam); } +DISABLE_CFI_ICALL void TraceGLApi::glDebugMessageControlFn(GLenum source, GLenum type, GLenum severity, @@ -5426,6 +5890,7 @@ gl_api_->glDebugMessageControlFn(source, type, severity, count, ids, enabled); } +DISABLE_CFI_ICALL void TraceGLApi::glDebugMessageInsertFn(GLenum source, GLenum type, GLuint id, @@ -5436,113 +5901,135 @@ gl_api_->glDebugMessageInsertFn(source, type, id, severity, length, buf); } +DISABLE_CFI_ICALL void TraceGLApi::glDeleteBuffersARBFn(GLsizei n, const GLuint* buffers) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glDeleteBuffersARB") gl_api_->glDeleteBuffersARBFn(n, buffers); } +DISABLE_CFI_ICALL void TraceGLApi::glDeleteFencesAPPLEFn(GLsizei n, const GLuint* fences) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glDeleteFencesAPPLE") gl_api_->glDeleteFencesAPPLEFn(n, fences); } +DISABLE_CFI_ICALL void TraceGLApi::glDeleteFencesNVFn(GLsizei n, const GLuint* fences) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glDeleteFencesNV") gl_api_->glDeleteFencesNVFn(n, fences); } +DISABLE_CFI_ICALL void TraceGLApi::glDeleteFramebuffersEXTFn(GLsizei n, const GLuint* framebuffers) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glDeleteFramebuffersEXT") gl_api_->glDeleteFramebuffersEXTFn(n, framebuffers); } +DISABLE_CFI_ICALL void TraceGLApi::glDeletePathsNVFn(GLuint path, GLsizei range) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glDeletePathsNV") gl_api_->glDeletePathsNVFn(path, range); } +DISABLE_CFI_ICALL void TraceGLApi::glDeleteProgramFn(GLuint program) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glDeleteProgram") gl_api_->glDeleteProgramFn(program); } +DISABLE_CFI_ICALL void TraceGLApi::glDeleteQueriesFn(GLsizei n, const GLuint* ids) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glDeleteQueries") gl_api_->glDeleteQueriesFn(n, ids); } +DISABLE_CFI_ICALL void TraceGLApi::glDeleteRenderbuffersEXTFn(GLsizei n, const GLuint* renderbuffers) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glDeleteRenderbuffersEXT") gl_api_->glDeleteRenderbuffersEXTFn(n, renderbuffers); } +DISABLE_CFI_ICALL void TraceGLApi::glDeleteSamplersFn(GLsizei n, const GLuint* samplers) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glDeleteSamplers") gl_api_->glDeleteSamplersFn(n, samplers); } +DISABLE_CFI_ICALL void TraceGLApi::glDeleteShaderFn(GLuint shader) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glDeleteShader") gl_api_->glDeleteShaderFn(shader); } +DISABLE_CFI_ICALL void TraceGLApi::glDeleteSyncFn(GLsync sync) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glDeleteSync") gl_api_->glDeleteSyncFn(sync); } +DISABLE_CFI_ICALL void TraceGLApi::glDeleteTexturesFn(GLsizei n, const GLuint* textures) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glDeleteTextures") gl_api_->glDeleteTexturesFn(n, textures); } +DISABLE_CFI_ICALL void TraceGLApi::glDeleteTransformFeedbacksFn(GLsizei n, const GLuint* ids) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glDeleteTransformFeedbacks") gl_api_->glDeleteTransformFeedbacksFn(n, ids); } +DISABLE_CFI_ICALL void TraceGLApi::glDeleteVertexArraysOESFn(GLsizei n, const GLuint* arrays) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glDeleteVertexArraysOES") gl_api_->glDeleteVertexArraysOESFn(n, arrays); } +DISABLE_CFI_ICALL void TraceGLApi::glDepthFuncFn(GLenum func) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glDepthFunc") gl_api_->glDepthFuncFn(func); } +DISABLE_CFI_ICALL void TraceGLApi::glDepthMaskFn(GLboolean flag) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glDepthMask") gl_api_->glDepthMaskFn(flag); } +DISABLE_CFI_ICALL void TraceGLApi::glDepthRangeFn(GLclampd zNear, GLclampd zFar) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glDepthRange") gl_api_->glDepthRangeFn(zNear, zFar); } +DISABLE_CFI_ICALL void TraceGLApi::glDepthRangefFn(GLclampf zNear, GLclampf zFar) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glDepthRangef") gl_api_->glDepthRangefFn(zNear, zFar); } +DISABLE_CFI_ICALL void TraceGLApi::glDetachShaderFn(GLuint program, GLuint shader) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glDetachShader") gl_api_->glDetachShaderFn(program, shader); } +DISABLE_CFI_ICALL void TraceGLApi::glDisableFn(GLenum cap) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glDisable") gl_api_->glDisableFn(cap); } +DISABLE_CFI_ICALL void TraceGLApi::glDisableVertexAttribArrayFn(GLuint index) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glDisableVertexAttribArray") gl_api_->glDisableVertexAttribArrayFn(index); } +DISABLE_CFI_ICALL void TraceGLApi::glDiscardFramebufferEXTFn(GLenum target, GLsizei numAttachments, const GLenum* attachments) { @@ -5550,11 +6037,13 @@ gl_api_->glDiscardFramebufferEXTFn(target, numAttachments, attachments); } +DISABLE_CFI_ICALL void TraceGLApi::glDrawArraysFn(GLenum mode, GLint first, GLsizei count) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glDrawArrays") gl_api_->glDrawArraysFn(mode, first, count); } +DISABLE_CFI_ICALL void TraceGLApi::glDrawArraysInstancedANGLEFn(GLenum mode, GLint first, GLsizei count, @@ -5563,16 +6052,19 @@ gl_api_->glDrawArraysInstancedANGLEFn(mode, first, count, primcount); } +DISABLE_CFI_ICALL void TraceGLApi::glDrawBufferFn(GLenum mode) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glDrawBuffer") gl_api_->glDrawBufferFn(mode); } +DISABLE_CFI_ICALL void TraceGLApi::glDrawBuffersARBFn(GLsizei n, const GLenum* bufs) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glDrawBuffersARB") gl_api_->glDrawBuffersARBFn(n, bufs); } +DISABLE_CFI_ICALL void TraceGLApi::glDrawElementsFn(GLenum mode, GLsizei count, GLenum type, @@ -5581,6 +6073,7 @@ gl_api_->glDrawElementsFn(mode, count, type, indices); } +DISABLE_CFI_ICALL void TraceGLApi::glDrawElementsInstancedANGLEFn(GLenum mode, GLsizei count, GLenum type, @@ -5592,6 +6085,7 @@ primcount); } +DISABLE_CFI_ICALL void TraceGLApi::glDrawRangeElementsFn(GLenum mode, GLuint start, GLuint end, @@ -5602,6 +6096,7 @@ gl_api_->glDrawRangeElementsFn(mode, start, end, count, type, indices); } +DISABLE_CFI_ICALL void TraceGLApi::glEGLImageTargetRenderbufferStorageOESFn(GLenum target, GLeglImageOES image) { TRACE_EVENT_BINARY_EFFICIENT0( @@ -5609,6 +6104,7 @@ gl_api_->glEGLImageTargetRenderbufferStorageOESFn(target, image); } +DISABLE_CFI_ICALL void TraceGLApi::glEGLImageTargetTexture2DOESFn(GLenum target, GLeglImageOES image) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", @@ -5616,51 +6112,61 @@ gl_api_->glEGLImageTargetTexture2DOESFn(target, image); } +DISABLE_CFI_ICALL void TraceGLApi::glEnableFn(GLenum cap) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glEnable") gl_api_->glEnableFn(cap); } +DISABLE_CFI_ICALL void TraceGLApi::glEnableVertexAttribArrayFn(GLuint index) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glEnableVertexAttribArray") gl_api_->glEnableVertexAttribArrayFn(index); } +DISABLE_CFI_ICALL void TraceGLApi::glEndQueryFn(GLenum target) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glEndQuery") gl_api_->glEndQueryFn(target); } +DISABLE_CFI_ICALL void TraceGLApi::glEndTransformFeedbackFn(void) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glEndTransformFeedback") gl_api_->glEndTransformFeedbackFn(); } +DISABLE_CFI_ICALL GLsync TraceGLApi::glFenceSyncFn(GLenum condition, GLbitfield flags) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glFenceSync") return gl_api_->glFenceSyncFn(condition, flags); } +DISABLE_CFI_ICALL void TraceGLApi::glFinishFn(void) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glFinish") gl_api_->glFinishFn(); } +DISABLE_CFI_ICALL void TraceGLApi::glFinishFenceAPPLEFn(GLuint fence) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glFinishFenceAPPLE") gl_api_->glFinishFenceAPPLEFn(fence); } +DISABLE_CFI_ICALL void TraceGLApi::glFinishFenceNVFn(GLuint fence) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glFinishFenceNV") gl_api_->glFinishFenceNVFn(fence); } +DISABLE_CFI_ICALL void TraceGLApi::glFlushFn(void) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glFlush") gl_api_->glFlushFn(); } +DISABLE_CFI_ICALL void TraceGLApi::glFlushMappedBufferRangeFn(GLenum target, GLintptr offset, GLsizeiptr length) { @@ -5668,6 +6174,7 @@ gl_api_->glFlushMappedBufferRangeFn(target, offset, length); } +DISABLE_CFI_ICALL void TraceGLApi::glFramebufferRenderbufferEXTFn(GLenum target, GLenum attachment, GLenum renderbuffertarget, @@ -5678,6 +6185,7 @@ renderbuffertarget, renderbuffer); } +DISABLE_CFI_ICALL void TraceGLApi::glFramebufferTexture2DEXTFn(GLenum target, GLenum attachment, GLenum textarget, @@ -5688,6 +6196,7 @@ level); } +DISABLE_CFI_ICALL void TraceGLApi::glFramebufferTexture2DMultisampleEXTFn(GLenum target, GLenum attachment, GLenum textarget, @@ -5700,6 +6209,7 @@ texture, level, samples); } +DISABLE_CFI_ICALL void TraceGLApi::glFramebufferTextureLayerFn(GLenum target, GLenum attachment, GLuint texture, @@ -5710,71 +6220,85 @@ layer); } +DISABLE_CFI_ICALL void TraceGLApi::glFrontFaceFn(GLenum mode) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glFrontFace") gl_api_->glFrontFaceFn(mode); } +DISABLE_CFI_ICALL void TraceGLApi::glGenBuffersARBFn(GLsizei n, GLuint* buffers) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glGenBuffersARB") gl_api_->glGenBuffersARBFn(n, buffers); } +DISABLE_CFI_ICALL void TraceGLApi::glGenerateMipmapEXTFn(GLenum target) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glGenerateMipmapEXT") gl_api_->glGenerateMipmapEXTFn(target); } +DISABLE_CFI_ICALL void TraceGLApi::glGenFencesAPPLEFn(GLsizei n, GLuint* fences) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glGenFencesAPPLE") gl_api_->glGenFencesAPPLEFn(n, fences); } +DISABLE_CFI_ICALL void TraceGLApi::glGenFencesNVFn(GLsizei n, GLuint* fences) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glGenFencesNV") gl_api_->glGenFencesNVFn(n, fences); } +DISABLE_CFI_ICALL void TraceGLApi::glGenFramebuffersEXTFn(GLsizei n, GLuint* framebuffers) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glGenFramebuffersEXT") gl_api_->glGenFramebuffersEXTFn(n, framebuffers); } +DISABLE_CFI_ICALL GLuint TraceGLApi::glGenPathsNVFn(GLsizei range) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glGenPathsNV") return gl_api_->glGenPathsNVFn(range); } +DISABLE_CFI_ICALL void TraceGLApi::glGenQueriesFn(GLsizei n, GLuint* ids) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glGenQueries") gl_api_->glGenQueriesFn(n, ids); } +DISABLE_CFI_ICALL void TraceGLApi::glGenRenderbuffersEXTFn(GLsizei n, GLuint* renderbuffers) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glGenRenderbuffersEXT") gl_api_->glGenRenderbuffersEXTFn(n, renderbuffers); } +DISABLE_CFI_ICALL void TraceGLApi::glGenSamplersFn(GLsizei n, GLuint* samplers) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glGenSamplers") gl_api_->glGenSamplersFn(n, samplers); } +DISABLE_CFI_ICALL void TraceGLApi::glGenTexturesFn(GLsizei n, GLuint* textures) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glGenTextures") gl_api_->glGenTexturesFn(n, textures); } +DISABLE_CFI_ICALL void TraceGLApi::glGenTransformFeedbacksFn(GLsizei n, GLuint* ids) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glGenTransformFeedbacks") gl_api_->glGenTransformFeedbacksFn(n, ids); } +DISABLE_CFI_ICALL void TraceGLApi::glGenVertexArraysOESFn(GLsizei n, GLuint* arrays) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glGenVertexArraysOES") gl_api_->glGenVertexArraysOESFn(n, arrays); } +DISABLE_CFI_ICALL void TraceGLApi::glGetActiveAttribFn(GLuint program, GLuint index, GLsizei bufsize, @@ -5787,6 +6311,7 @@ name); } +DISABLE_CFI_ICALL void TraceGLApi::glGetActiveUniformFn(GLuint program, GLuint index, GLsizei bufsize, @@ -5799,6 +6324,7 @@ name); } +DISABLE_CFI_ICALL void TraceGLApi::glGetActiveUniformBlockivFn(GLuint program, GLuint uniformBlockIndex, GLenum pname, @@ -5808,6 +6334,7 @@ params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetActiveUniformBlockivRobustANGLEFn( GLuint program, GLuint uniformBlockIndex, @@ -5821,6 +6348,7 @@ program, uniformBlockIndex, pname, bufSize, length, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetActiveUniformBlockNameFn(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, @@ -5832,6 +6360,7 @@ length, uniformBlockName); } +DISABLE_CFI_ICALL void TraceGLApi::glGetActiveUniformsivFn(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, @@ -5842,6 +6371,7 @@ params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetAttachedShadersFn(GLuint program, GLsizei maxcount, GLsizei* count, @@ -5850,11 +6380,13 @@ gl_api_->glGetAttachedShadersFn(program, maxcount, count, shaders); } +DISABLE_CFI_ICALL GLint TraceGLApi::glGetAttribLocationFn(GLuint program, const char* name) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glGetAttribLocation") return gl_api_->glGetAttribLocationFn(program, name); } +DISABLE_CFI_ICALL void TraceGLApi::glGetBooleani_vRobustANGLEFn(GLenum target, GLuint index, GLsizei bufSize, @@ -5864,11 +6396,13 @@ gl_api_->glGetBooleani_vRobustANGLEFn(target, index, bufSize, length, data); } +DISABLE_CFI_ICALL void TraceGLApi::glGetBooleanvFn(GLenum pname, GLboolean* params) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glGetBooleanv") gl_api_->glGetBooleanvFn(pname, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetBooleanvRobustANGLEFn(GLenum pname, GLsizei bufSize, GLsizei* length, @@ -5877,6 +6411,7 @@ gl_api_->glGetBooleanvRobustANGLEFn(pname, bufSize, length, data); } +DISABLE_CFI_ICALL void TraceGLApi::glGetBufferParameteri64vRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -5888,6 +6423,7 @@ params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetBufferParameterivFn(GLenum target, GLenum pname, GLint* params) { @@ -5895,6 +6431,7 @@ gl_api_->glGetBufferParameterivFn(target, pname, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetBufferParameterivRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -5906,6 +6443,7 @@ params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetBufferPointervRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -5917,6 +6455,7 @@ params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetDebugMessageLogFn(GLuint count, GLsizei bufSize, GLenum* sources, @@ -5930,21 +6469,25 @@ severities, lengths, messageLog); } +DISABLE_CFI_ICALL GLenum TraceGLApi::glGetErrorFn(void) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glGetError") return gl_api_->glGetErrorFn(); } +DISABLE_CFI_ICALL void TraceGLApi::glGetFenceivNVFn(GLuint fence, GLenum pname, GLint* params) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glGetFenceivNV") gl_api_->glGetFenceivNVFn(fence, pname, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetFloatvFn(GLenum pname, GLfloat* params) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glGetFloatv") gl_api_->glGetFloatvFn(pname, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetFloatvRobustANGLEFn(GLenum pname, GLsizei bufSize, GLsizei* length, @@ -5953,16 +6496,19 @@ gl_api_->glGetFloatvRobustANGLEFn(pname, bufSize, length, data); } +DISABLE_CFI_ICALL GLint TraceGLApi::glGetFragDataIndexFn(GLuint program, const char* name) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glGetFragDataIndex") return gl_api_->glGetFragDataIndexFn(program, name); } +DISABLE_CFI_ICALL GLint TraceGLApi::glGetFragDataLocationFn(GLuint program, const char* name) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glGetFragDataLocation") return gl_api_->glGetFragDataLocationFn(program, name); } +DISABLE_CFI_ICALL void TraceGLApi::glGetFramebufferAttachmentParameterivEXTFn(GLenum target, GLenum attachment, GLenum pname, @@ -5973,6 +6519,7 @@ params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetFramebufferAttachmentParameterivRobustANGLEFn( GLenum target, GLenum attachment, @@ -5986,6 +6533,7 @@ target, attachment, pname, bufSize, length, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetFramebufferParameterivRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -5997,12 +6545,14 @@ length, params); } +DISABLE_CFI_ICALL GLenum TraceGLApi::glGetGraphicsResetStatusARBFn(void) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glGetGraphicsResetStatusARB") return gl_api_->glGetGraphicsResetStatusARBFn(); } +DISABLE_CFI_ICALL void TraceGLApi::glGetInteger64i_vFn(GLenum target, GLuint index, GLint64* data) { @@ -6010,6 +6560,7 @@ gl_api_->glGetInteger64i_vFn(target, index, data); } +DISABLE_CFI_ICALL void TraceGLApi::glGetInteger64i_vRobustANGLEFn(GLenum target, GLuint index, GLsizei bufSize, @@ -6020,11 +6571,13 @@ gl_api_->glGetInteger64i_vRobustANGLEFn(target, index, bufSize, length, data); } +DISABLE_CFI_ICALL void TraceGLApi::glGetInteger64vFn(GLenum pname, GLint64* params) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glGetInteger64v") gl_api_->glGetInteger64vFn(pname, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetInteger64vRobustANGLEFn(GLenum pname, GLsizei bufSize, GLsizei* length, @@ -6033,11 +6586,13 @@ gl_api_->glGetInteger64vRobustANGLEFn(pname, bufSize, length, data); } +DISABLE_CFI_ICALL void TraceGLApi::glGetIntegeri_vFn(GLenum target, GLuint index, GLint* data) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glGetIntegeri_v") gl_api_->glGetIntegeri_vFn(target, index, data); } +DISABLE_CFI_ICALL void TraceGLApi::glGetIntegeri_vRobustANGLEFn(GLenum target, GLuint index, GLsizei bufSize, @@ -6047,11 +6602,13 @@ gl_api_->glGetIntegeri_vRobustANGLEFn(target, index, bufSize, length, data); } +DISABLE_CFI_ICALL void TraceGLApi::glGetIntegervFn(GLenum pname, GLint* params) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glGetIntegerv") gl_api_->glGetIntegervFn(pname, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetIntegervRobustANGLEFn(GLenum pname, GLsizei bufSize, GLsizei* length, @@ -6060,6 +6617,7 @@ gl_api_->glGetIntegervRobustANGLEFn(pname, bufSize, length, data); } +DISABLE_CFI_ICALL void TraceGLApi::glGetInternalformativFn(GLenum target, GLenum internalformat, GLenum pname, @@ -6070,6 +6628,7 @@ params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetInternalformativRobustANGLEFn(GLenum target, GLenum internalformat, GLenum pname, @@ -6082,6 +6641,7 @@ bufSize, length, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetMultisamplefvFn(GLenum pname, GLuint index, GLfloat* val) { @@ -6089,6 +6649,7 @@ gl_api_->glGetMultisamplefvFn(pname, index, val); } +DISABLE_CFI_ICALL void TraceGLApi::glGetMultisamplefvRobustANGLEFn(GLenum pname, GLuint index, GLsizei bufSize, @@ -6099,6 +6660,7 @@ gl_api_->glGetMultisamplefvRobustANGLEFn(pname, index, bufSize, length, val); } +DISABLE_CFI_ICALL void TraceGLApi::glGetnUniformfvRobustANGLEFn(GLuint program, GLint location, GLsizei bufSize, @@ -6109,6 +6671,7 @@ params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetnUniformivRobustANGLEFn(GLuint program, GLint location, GLsizei bufSize, @@ -6119,6 +6682,7 @@ params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetnUniformuivRobustANGLEFn(GLuint program, GLint location, GLsizei bufSize, @@ -6130,6 +6694,7 @@ params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetObjectLabelFn(GLenum identifier, GLuint name, GLsizei bufSize, @@ -6139,6 +6704,7 @@ gl_api_->glGetObjectLabelFn(identifier, name, bufSize, length, label); } +DISABLE_CFI_ICALL void TraceGLApi::glGetObjectPtrLabelFn(void* ptr, GLsizei bufSize, GLsizei* length, @@ -6147,11 +6713,13 @@ gl_api_->glGetObjectPtrLabelFn(ptr, bufSize, length, label); } +DISABLE_CFI_ICALL void TraceGLApi::glGetPointervFn(GLenum pname, void** params) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glGetPointerv") gl_api_->glGetPointervFn(pname, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetPointervRobustANGLERobustANGLEFn(GLenum pname, GLsizei bufSize, GLsizei* length, @@ -6162,6 +6730,7 @@ params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetProgramBinaryFn(GLuint program, GLsizei bufSize, GLsizei* length, @@ -6171,6 +6740,7 @@ gl_api_->glGetProgramBinaryFn(program, bufSize, length, binaryFormat, binary); } +DISABLE_CFI_ICALL void TraceGLApi::glGetProgramInfoLogFn(GLuint program, GLsizei bufsize, GLsizei* length, @@ -6179,6 +6749,7 @@ gl_api_->glGetProgramInfoLogFn(program, bufsize, length, infolog); } +DISABLE_CFI_ICALL void TraceGLApi::glGetProgramInterfaceivFn(GLuint program, GLenum programInterface, GLenum pname, @@ -6187,6 +6758,7 @@ gl_api_->glGetProgramInterfaceivFn(program, programInterface, pname, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetProgramInterfaceivRobustANGLEFn(GLuint program, GLenum programInterface, GLenum pname, @@ -6199,11 +6771,13 @@ pname, bufSize, length, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetProgramivFn(GLuint program, GLenum pname, GLint* params) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glGetProgramiv") gl_api_->glGetProgramivFn(program, pname, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetProgramivRobustANGLEFn(GLuint program, GLenum pname, GLsizei bufSize, @@ -6213,6 +6787,7 @@ gl_api_->glGetProgramivRobustANGLEFn(program, pname, bufSize, length, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetProgramResourceivFn(GLuint program, GLenum programInterface, GLuint index, @@ -6226,6 +6801,7 @@ props, bufSize, length, params); } +DISABLE_CFI_ICALL GLint TraceGLApi::glGetProgramResourceLocationFn(GLuint program, GLenum programInterface, const char* name) { @@ -6235,6 +6811,7 @@ name); } +DISABLE_CFI_ICALL void TraceGLApi::glGetProgramResourceNameFn(GLuint program, GLenum programInterface, GLuint index, @@ -6246,11 +6823,13 @@ length, name); } +DISABLE_CFI_ICALL void TraceGLApi::glGetQueryivFn(GLenum target, GLenum pname, GLint* params) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glGetQueryiv") gl_api_->glGetQueryivFn(target, pname, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetQueryivRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -6260,6 +6839,7 @@ gl_api_->glGetQueryivRobustANGLEFn(target, pname, bufSize, length, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetQueryObjecti64vFn(GLuint id, GLenum pname, GLint64* params) { @@ -6267,6 +6847,7 @@ gl_api_->glGetQueryObjecti64vFn(id, pname, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetQueryObjecti64vRobustANGLEFn(GLuint id, GLenum pname, GLsizei bufSize, @@ -6278,11 +6859,13 @@ params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetQueryObjectivFn(GLuint id, GLenum pname, GLint* params) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glGetQueryObjectiv") gl_api_->glGetQueryObjectivFn(id, pname, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetQueryObjectivRobustANGLEFn(GLuint id, GLenum pname, GLsizei bufSize, @@ -6293,6 +6876,7 @@ gl_api_->glGetQueryObjectivRobustANGLEFn(id, pname, bufSize, length, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetQueryObjectui64vFn(GLuint id, GLenum pname, GLuint64* params) { @@ -6300,6 +6884,7 @@ gl_api_->glGetQueryObjectui64vFn(id, pname, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetQueryObjectui64vRobustANGLEFn(GLuint id, GLenum pname, GLsizei bufSize, @@ -6311,6 +6896,7 @@ params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetQueryObjectuivFn(GLuint id, GLenum pname, GLuint* params) { @@ -6318,6 +6904,7 @@ gl_api_->glGetQueryObjectuivFn(id, pname, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetQueryObjectuivRobustANGLEFn(GLuint id, GLenum pname, GLsizei bufSize, @@ -6328,6 +6915,7 @@ gl_api_->glGetQueryObjectuivRobustANGLEFn(id, pname, bufSize, length, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetRenderbufferParameterivEXTFn(GLenum target, GLenum pname, GLint* params) { @@ -6336,6 +6924,7 @@ gl_api_->glGetRenderbufferParameterivEXTFn(target, pname, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetRenderbufferParameterivRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -6347,6 +6936,7 @@ length, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetSamplerParameterfvFn(GLuint sampler, GLenum pname, GLfloat* params) { @@ -6354,6 +6944,7 @@ gl_api_->glGetSamplerParameterfvFn(sampler, pname, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetSamplerParameterfvRobustANGLEFn(GLuint sampler, GLenum pname, GLsizei bufSize, @@ -6365,6 +6956,7 @@ params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetSamplerParameterIivRobustANGLEFn(GLuint sampler, GLenum pname, GLsizei bufSize, @@ -6376,6 +6968,7 @@ length, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetSamplerParameterIuivRobustANGLEFn(GLuint sampler, GLenum pname, GLsizei bufSize, @@ -6387,6 +6980,7 @@ length, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetSamplerParameterivFn(GLuint sampler, GLenum pname, GLint* params) { @@ -6394,6 +6988,7 @@ gl_api_->glGetSamplerParameterivFn(sampler, pname, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetSamplerParameterivRobustANGLEFn(GLuint sampler, GLenum pname, GLsizei bufSize, @@ -6405,6 +7000,7 @@ params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetShaderInfoLogFn(GLuint shader, GLsizei bufsize, GLsizei* length, @@ -6413,11 +7009,13 @@ gl_api_->glGetShaderInfoLogFn(shader, bufsize, length, infolog); } +DISABLE_CFI_ICALL void TraceGLApi::glGetShaderivFn(GLuint shader, GLenum pname, GLint* params) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glGetShaderiv") gl_api_->glGetShaderivFn(shader, pname, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetShaderivRobustANGLEFn(GLuint shader, GLenum pname, GLsizei bufSize, @@ -6427,6 +7025,7 @@ gl_api_->glGetShaderivRobustANGLEFn(shader, pname, bufSize, length, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetShaderPrecisionFormatFn(GLenum shadertype, GLenum precisiontype, GLint* range, @@ -6436,6 +7035,7 @@ precision); } +DISABLE_CFI_ICALL void TraceGLApi::glGetShaderSourceFn(GLuint shader, GLsizei bufsize, GLsizei* length, @@ -6444,16 +7044,19 @@ gl_api_->glGetShaderSourceFn(shader, bufsize, length, source); } +DISABLE_CFI_ICALL const GLubyte* TraceGLApi::glGetStringFn(GLenum name) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glGetString") return gl_api_->glGetStringFn(name); } +DISABLE_CFI_ICALL const GLubyte* TraceGLApi::glGetStringiFn(GLenum name, GLuint index) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glGetStringi") return gl_api_->glGetStringiFn(name, index); } +DISABLE_CFI_ICALL void TraceGLApi::glGetSyncivFn(GLsync sync, GLenum pname, GLsizei bufSize, @@ -6463,6 +7066,7 @@ gl_api_->glGetSyncivFn(sync, pname, bufSize, length, values); } +DISABLE_CFI_ICALL void TraceGLApi::glGetTexLevelParameterfvFn(GLenum target, GLint level, GLenum pname, @@ -6471,6 +7075,7 @@ gl_api_->glGetTexLevelParameterfvFn(target, level, pname, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetTexLevelParameterfvRobustANGLEFn(GLenum target, GLint level, GLenum pname, @@ -6483,6 +7088,7 @@ length, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetTexLevelParameterivFn(GLenum target, GLint level, GLenum pname, @@ -6491,6 +7097,7 @@ gl_api_->glGetTexLevelParameterivFn(target, level, pname, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetTexLevelParameterivRobustANGLEFn(GLenum target, GLint level, GLenum pname, @@ -6503,6 +7110,7 @@ length, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetTexParameterfvFn(GLenum target, GLenum pname, GLfloat* params) { @@ -6510,6 +7118,7 @@ gl_api_->glGetTexParameterfvFn(target, pname, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetTexParameterfvRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -6521,6 +7130,7 @@ params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetTexParameterIivRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -6532,6 +7142,7 @@ params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetTexParameterIuivRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -6543,6 +7154,7 @@ params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetTexParameterivFn(GLenum target, GLenum pname, GLint* params) { @@ -6550,6 +7162,7 @@ gl_api_->glGetTexParameterivFn(target, pname, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetTexParameterivRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -6561,6 +7174,7 @@ params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetTransformFeedbackVaryingFn(GLuint program, GLuint index, GLsizei bufSize, @@ -6574,6 +7188,7 @@ size, type, name); } +DISABLE_CFI_ICALL void TraceGLApi::glGetTranslatedShaderSourceANGLEFn(GLuint shader, GLsizei bufsize, GLsizei* length, @@ -6583,12 +7198,14 @@ gl_api_->glGetTranslatedShaderSourceANGLEFn(shader, bufsize, length, source); } +DISABLE_CFI_ICALL GLuint TraceGLApi::glGetUniformBlockIndexFn(GLuint program, const char* uniformBlockName) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glGetUniformBlockIndex") return gl_api_->glGetUniformBlockIndexFn(program, uniformBlockName); } +DISABLE_CFI_ICALL void TraceGLApi::glGetUniformfvFn(GLuint program, GLint location, GLfloat* params) { @@ -6596,6 +7213,7 @@ gl_api_->glGetUniformfvFn(program, location, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetUniformfvRobustANGLEFn(GLuint program, GLint location, GLsizei bufSize, @@ -6606,6 +7224,7 @@ params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetUniformIndicesFn(GLuint program, GLsizei uniformCount, const char* const* uniformNames, @@ -6615,6 +7234,7 @@ uniformIndices); } +DISABLE_CFI_ICALL void TraceGLApi::glGetUniformivFn(GLuint program, GLint location, GLint* params) { @@ -6622,6 +7242,7 @@ gl_api_->glGetUniformivFn(program, location, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetUniformivRobustANGLEFn(GLuint program, GLint location, GLsizei bufSize, @@ -6632,11 +7253,13 @@ params); } +DISABLE_CFI_ICALL GLint TraceGLApi::glGetUniformLocationFn(GLuint program, const char* name) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glGetUniformLocation") return gl_api_->glGetUniformLocationFn(program, name); } +DISABLE_CFI_ICALL void TraceGLApi::glGetUniformuivFn(GLuint program, GLint location, GLuint* params) { @@ -6644,6 +7267,7 @@ gl_api_->glGetUniformuivFn(program, location, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetUniformuivRobustANGLEFn(GLuint program, GLint location, GLsizei bufSize, @@ -6654,6 +7278,7 @@ params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetVertexAttribfvFn(GLuint index, GLenum pname, GLfloat* params) { @@ -6661,6 +7286,7 @@ gl_api_->glGetVertexAttribfvFn(index, pname, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetVertexAttribfvRobustANGLEFn(GLuint index, GLenum pname, GLsizei bufSize, @@ -6672,6 +7298,7 @@ params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetVertexAttribIivRobustANGLEFn(GLuint index, GLenum pname, GLsizei bufSize, @@ -6683,6 +7310,7 @@ params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetVertexAttribIuivRobustANGLEFn(GLuint index, GLenum pname, GLsizei bufSize, @@ -6694,6 +7322,7 @@ params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetVertexAttribivFn(GLuint index, GLenum pname, GLint* params) { @@ -6701,6 +7330,7 @@ gl_api_->glGetVertexAttribivFn(index, pname, params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetVertexAttribivRobustANGLEFn(GLuint index, GLenum pname, GLsizei bufSize, @@ -6712,6 +7342,7 @@ params); } +DISABLE_CFI_ICALL void TraceGLApi::glGetVertexAttribPointervFn(GLuint index, GLenum pname, void** pointer) { @@ -6719,6 +7350,7 @@ gl_api_->glGetVertexAttribPointervFn(index, pname, pointer); } +DISABLE_CFI_ICALL void TraceGLApi::glGetVertexAttribPointervRobustANGLEFn(GLuint index, GLenum pname, GLsizei bufSize, @@ -6730,16 +7362,19 @@ pointer); } +DISABLE_CFI_ICALL void TraceGLApi::glHintFn(GLenum target, GLenum mode) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glHint") gl_api_->glHintFn(target, mode); } +DISABLE_CFI_ICALL void TraceGLApi::glInsertEventMarkerEXTFn(GLsizei length, const char* marker) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glInsertEventMarkerEXT") gl_api_->glInsertEventMarkerEXTFn(length, marker); } +DISABLE_CFI_ICALL void TraceGLApi::glInvalidateFramebufferFn(GLenum target, GLsizei numAttachments, const GLenum* attachments) { @@ -6747,6 +7382,7 @@ gl_api_->glInvalidateFramebufferFn(target, numAttachments, attachments); } +DISABLE_CFI_ICALL void TraceGLApi::glInvalidateSubFramebufferFn(GLenum target, GLsizei numAttachments, const GLenum* attachments, @@ -6759,96 +7395,115 @@ y, width, height); } +DISABLE_CFI_ICALL GLboolean TraceGLApi::glIsBufferFn(GLuint buffer) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glIsBuffer") return gl_api_->glIsBufferFn(buffer); } +DISABLE_CFI_ICALL GLboolean TraceGLApi::glIsEnabledFn(GLenum cap) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glIsEnabled") return gl_api_->glIsEnabledFn(cap); } +DISABLE_CFI_ICALL GLboolean TraceGLApi::glIsFenceAPPLEFn(GLuint fence) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glIsFenceAPPLE") return gl_api_->glIsFenceAPPLEFn(fence); } +DISABLE_CFI_ICALL GLboolean TraceGLApi::glIsFenceNVFn(GLuint fence) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glIsFenceNV") return gl_api_->glIsFenceNVFn(fence); } +DISABLE_CFI_ICALL GLboolean TraceGLApi::glIsFramebufferEXTFn(GLuint framebuffer) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glIsFramebufferEXT") return gl_api_->glIsFramebufferEXTFn(framebuffer); } +DISABLE_CFI_ICALL GLboolean TraceGLApi::glIsPathNVFn(GLuint path) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glIsPathNV") return gl_api_->glIsPathNVFn(path); } +DISABLE_CFI_ICALL GLboolean TraceGLApi::glIsProgramFn(GLuint program) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glIsProgram") return gl_api_->glIsProgramFn(program); } +DISABLE_CFI_ICALL GLboolean TraceGLApi::glIsQueryFn(GLuint query) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glIsQuery") return gl_api_->glIsQueryFn(query); } +DISABLE_CFI_ICALL GLboolean TraceGLApi::glIsRenderbufferEXTFn(GLuint renderbuffer) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glIsRenderbufferEXT") return gl_api_->glIsRenderbufferEXTFn(renderbuffer); } +DISABLE_CFI_ICALL GLboolean TraceGLApi::glIsSamplerFn(GLuint sampler) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glIsSampler") return gl_api_->glIsSamplerFn(sampler); } +DISABLE_CFI_ICALL GLboolean TraceGLApi::glIsShaderFn(GLuint shader) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glIsShader") return gl_api_->glIsShaderFn(shader); } +DISABLE_CFI_ICALL GLboolean TraceGLApi::glIsSyncFn(GLsync sync) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glIsSync") return gl_api_->glIsSyncFn(sync); } +DISABLE_CFI_ICALL GLboolean TraceGLApi::glIsTextureFn(GLuint texture) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glIsTexture") return gl_api_->glIsTextureFn(texture); } +DISABLE_CFI_ICALL GLboolean TraceGLApi::glIsTransformFeedbackFn(GLuint id) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glIsTransformFeedback") return gl_api_->glIsTransformFeedbackFn(id); } +DISABLE_CFI_ICALL GLboolean TraceGLApi::glIsVertexArrayOESFn(GLuint array) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glIsVertexArrayOES") return gl_api_->glIsVertexArrayOESFn(array); } +DISABLE_CFI_ICALL void TraceGLApi::glLineWidthFn(GLfloat width) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glLineWidth") gl_api_->glLineWidthFn(width); } +DISABLE_CFI_ICALL void TraceGLApi::glLinkProgramFn(GLuint program) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glLinkProgram") gl_api_->glLinkProgramFn(program); } +DISABLE_CFI_ICALL void* TraceGLApi::glMapBufferFn(GLenum target, GLenum access) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glMapBuffer") return gl_api_->glMapBufferFn(target, access); } +DISABLE_CFI_ICALL void* TraceGLApi::glMapBufferRangeFn(GLenum target, GLintptr offset, GLsizeiptr length, @@ -6857,21 +7512,25 @@ return gl_api_->glMapBufferRangeFn(target, offset, length, access); } +DISABLE_CFI_ICALL void TraceGLApi::glMatrixLoadfEXTFn(GLenum matrixMode, const GLfloat* m) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glMatrixLoadfEXT") gl_api_->glMatrixLoadfEXTFn(matrixMode, m); } +DISABLE_CFI_ICALL void TraceGLApi::glMatrixLoadIdentityEXTFn(GLenum matrixMode) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glMatrixLoadIdentityEXT") gl_api_->glMatrixLoadIdentityEXTFn(matrixMode); } +DISABLE_CFI_ICALL void TraceGLApi::glMemoryBarrierEXTFn(GLbitfield barriers) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glMemoryBarrierEXT") gl_api_->glMemoryBarrierEXTFn(barriers); } +DISABLE_CFI_ICALL void TraceGLApi::glObjectLabelFn(GLenum identifier, GLuint name, GLsizei length, @@ -6880,6 +7539,7 @@ gl_api_->glObjectLabelFn(identifier, name, length, label); } +DISABLE_CFI_ICALL void TraceGLApi::glObjectPtrLabelFn(void* ptr, GLsizei length, const char* label) { @@ -6887,6 +7547,7 @@ gl_api_->glObjectPtrLabelFn(ptr, length, label); } +DISABLE_CFI_ICALL void TraceGLApi::glPathCommandsNVFn(GLuint path, GLsizei numCommands, const GLubyte* commands, @@ -6898,6 +7559,7 @@ coords); } +DISABLE_CFI_ICALL void TraceGLApi::glPathParameterfNVFn(GLuint path, GLenum pname, GLfloat value) { @@ -6905,56 +7567,67 @@ gl_api_->glPathParameterfNVFn(path, pname, value); } +DISABLE_CFI_ICALL void TraceGLApi::glPathParameteriNVFn(GLuint path, GLenum pname, GLint value) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glPathParameteriNV") gl_api_->glPathParameteriNVFn(path, pname, value); } +DISABLE_CFI_ICALL void TraceGLApi::glPathStencilFuncNVFn(GLenum func, GLint ref, GLuint mask) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glPathStencilFuncNV") gl_api_->glPathStencilFuncNVFn(func, ref, mask); } +DISABLE_CFI_ICALL void TraceGLApi::glPauseTransformFeedbackFn(void) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glPauseTransformFeedback") gl_api_->glPauseTransformFeedbackFn(); } +DISABLE_CFI_ICALL void TraceGLApi::glPixelStoreiFn(GLenum pname, GLint param) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glPixelStorei") gl_api_->glPixelStoreiFn(pname, param); } +DISABLE_CFI_ICALL void TraceGLApi::glPointParameteriFn(GLenum pname, GLint param) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glPointParameteri") gl_api_->glPointParameteriFn(pname, param); } +DISABLE_CFI_ICALL void TraceGLApi::glPolygonModeFn(GLenum face, GLenum mode) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glPolygonMode") gl_api_->glPolygonModeFn(face, mode); } +DISABLE_CFI_ICALL void TraceGLApi::glPolygonOffsetFn(GLfloat factor, GLfloat units) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glPolygonOffset") gl_api_->glPolygonOffsetFn(factor, units); } +DISABLE_CFI_ICALL void TraceGLApi::glPopDebugGroupFn() { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glPopDebugGroup") gl_api_->glPopDebugGroupFn(); } +DISABLE_CFI_ICALL void TraceGLApi::glPopGroupMarkerEXTFn(void) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glPopGroupMarkerEXT") gl_api_->glPopGroupMarkerEXTFn(); } +DISABLE_CFI_ICALL void TraceGLApi::glPrimitiveRestartIndexFn(GLuint index) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glPrimitiveRestartIndex") gl_api_->glPrimitiveRestartIndexFn(index); } +DISABLE_CFI_ICALL void TraceGLApi::glProgramBinaryFn(GLuint program, GLenum binaryFormat, const GLvoid* binary, @@ -6963,6 +7636,7 @@ gl_api_->glProgramBinaryFn(program, binaryFormat, binary, length); } +DISABLE_CFI_ICALL void TraceGLApi::glProgramParameteriFn(GLuint program, GLenum pname, GLint value) { @@ -6970,6 +7644,7 @@ gl_api_->glProgramParameteriFn(program, pname, value); } +DISABLE_CFI_ICALL void TraceGLApi::glProgramPathFragmentInputGenNVFn(GLuint program, GLint location, GLenum genMode, @@ -6981,6 +7656,7 @@ components, coeffs); } +DISABLE_CFI_ICALL void TraceGLApi::glPushDebugGroupFn(GLenum source, GLuint id, GLsizei length, @@ -6989,21 +7665,25 @@ gl_api_->glPushDebugGroupFn(source, id, length, message); } +DISABLE_CFI_ICALL void TraceGLApi::glPushGroupMarkerEXTFn(GLsizei length, const char* marker) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glPushGroupMarkerEXT") gl_api_->glPushGroupMarkerEXTFn(length, marker); } +DISABLE_CFI_ICALL void TraceGLApi::glQueryCounterFn(GLuint id, GLenum target) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glQueryCounter") gl_api_->glQueryCounterFn(id, target); } +DISABLE_CFI_ICALL void TraceGLApi::glReadBufferFn(GLenum src) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glReadBuffer") gl_api_->glReadBufferFn(src); } +DISABLE_CFI_ICALL void TraceGLApi::glReadnPixelsRobustANGLEFn(GLint x, GLint y, GLsizei width, @@ -7020,6 +7700,7 @@ bufSize, length, columns, rows, data); } +DISABLE_CFI_ICALL void TraceGLApi::glReadPixelsFn(GLint x, GLint y, GLsizei width, @@ -7031,6 +7712,7 @@ gl_api_->glReadPixelsFn(x, y, width, height, format, type, pixels); } +DISABLE_CFI_ICALL void TraceGLApi::glReadPixelsRobustANGLEFn(GLint x, GLint y, GLsizei width, @@ -7047,11 +7729,13 @@ length, columns, rows, pixels); } +DISABLE_CFI_ICALL void TraceGLApi::glReleaseShaderCompilerFn(void) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glReleaseShaderCompiler") gl_api_->glReleaseShaderCompilerFn(); } +DISABLE_CFI_ICALL void TraceGLApi::glRenderbufferStorageEXTFn(GLenum target, GLenum internalformat, GLsizei width, @@ -7060,6 +7744,7 @@ gl_api_->glRenderbufferStorageEXTFn(target, internalformat, width, height); } +DISABLE_CFI_ICALL void TraceGLApi::glRenderbufferStorageMultisampleFn(GLenum target, GLsizei samples, GLenum internalformat, @@ -7071,6 +7756,7 @@ width, height); } +DISABLE_CFI_ICALL void TraceGLApi::glRenderbufferStorageMultisampleEXTFn(GLenum target, GLsizei samples, GLenum internalformat, @@ -7082,21 +7768,25 @@ internalformat, width, height); } +DISABLE_CFI_ICALL void TraceGLApi::glRequestExtensionANGLEFn(const char* name) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glRequestExtensionANGLE") gl_api_->glRequestExtensionANGLEFn(name); } +DISABLE_CFI_ICALL void TraceGLApi::glResumeTransformFeedbackFn(void) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glResumeTransformFeedback") gl_api_->glResumeTransformFeedbackFn(); } +DISABLE_CFI_ICALL void TraceGLApi::glSampleCoverageFn(GLclampf value, GLboolean invert) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glSampleCoverage") gl_api_->glSampleCoverageFn(value, invert); } +DISABLE_CFI_ICALL void TraceGLApi::glSamplerParameterfFn(GLuint sampler, GLenum pname, GLfloat param) { @@ -7104,6 +7794,7 @@ gl_api_->glSamplerParameterfFn(sampler, pname, param); } +DISABLE_CFI_ICALL void TraceGLApi::glSamplerParameterfvFn(GLuint sampler, GLenum pname, const GLfloat* params) { @@ -7111,6 +7802,7 @@ gl_api_->glSamplerParameterfvFn(sampler, pname, params); } +DISABLE_CFI_ICALL void TraceGLApi::glSamplerParameterfvRobustANGLEFn(GLuint sampler, GLenum pname, GLsizei bufSize, @@ -7120,6 +7812,7 @@ gl_api_->glSamplerParameterfvRobustANGLEFn(sampler, pname, bufSize, param); } +DISABLE_CFI_ICALL void TraceGLApi::glSamplerParameteriFn(GLuint sampler, GLenum pname, GLint param) { @@ -7127,6 +7820,7 @@ gl_api_->glSamplerParameteriFn(sampler, pname, param); } +DISABLE_CFI_ICALL void TraceGLApi::glSamplerParameterIivRobustANGLEFn(GLuint sampler, GLenum pname, GLsizei bufSize, @@ -7136,6 +7830,7 @@ gl_api_->glSamplerParameterIivRobustANGLEFn(sampler, pname, bufSize, param); } +DISABLE_CFI_ICALL void TraceGLApi::glSamplerParameterIuivRobustANGLEFn(GLuint sampler, GLenum pname, GLsizei bufSize, @@ -7145,6 +7840,7 @@ gl_api_->glSamplerParameterIuivRobustANGLEFn(sampler, pname, bufSize, param); } +DISABLE_CFI_ICALL void TraceGLApi::glSamplerParameterivFn(GLuint sampler, GLenum pname, const GLint* params) { @@ -7152,6 +7848,7 @@ gl_api_->glSamplerParameterivFn(sampler, pname, params); } +DISABLE_CFI_ICALL void TraceGLApi::glSamplerParameterivRobustANGLEFn(GLuint sampler, GLenum pname, GLsizei bufSize, @@ -7161,21 +7858,25 @@ gl_api_->glSamplerParameterivRobustANGLEFn(sampler, pname, bufSize, param); } +DISABLE_CFI_ICALL void TraceGLApi::glScissorFn(GLint x, GLint y, GLsizei width, GLsizei height) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glScissor") gl_api_->glScissorFn(x, y, width, height); } +DISABLE_CFI_ICALL void TraceGLApi::glSetFenceAPPLEFn(GLuint fence) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glSetFenceAPPLE") gl_api_->glSetFenceAPPLEFn(fence); } +DISABLE_CFI_ICALL void TraceGLApi::glSetFenceNVFn(GLuint fence, GLenum condition) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glSetFenceNV") gl_api_->glSetFenceNVFn(fence, condition); } +DISABLE_CFI_ICALL void TraceGLApi::glShaderBinaryFn(GLsizei n, const GLuint* shaders, GLenum binaryformat, @@ -7185,6 +7886,7 @@ gl_api_->glShaderBinaryFn(n, shaders, binaryformat, binary, length); } +DISABLE_CFI_ICALL void TraceGLApi::glShaderSourceFn(GLuint shader, GLsizei count, const char* const* str, @@ -7193,6 +7895,7 @@ gl_api_->glShaderSourceFn(shader, count, str, length); } +DISABLE_CFI_ICALL void TraceGLApi::glStencilFillPathInstancedNVFn( GLsizei numPaths, GLenum pathNameType, @@ -7209,6 +7912,7 @@ transformType, transformValues); } +DISABLE_CFI_ICALL void TraceGLApi::glStencilFillPathNVFn(GLuint path, GLenum fillMode, GLuint mask) { @@ -7216,11 +7920,13 @@ gl_api_->glStencilFillPathNVFn(path, fillMode, mask); } +DISABLE_CFI_ICALL void TraceGLApi::glStencilFuncFn(GLenum func, GLint ref, GLuint mask) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glStencilFunc") gl_api_->glStencilFuncFn(func, ref, mask); } +DISABLE_CFI_ICALL void TraceGLApi::glStencilFuncSeparateFn(GLenum face, GLenum func, GLint ref, @@ -7229,21 +7935,25 @@ gl_api_->glStencilFuncSeparateFn(face, func, ref, mask); } +DISABLE_CFI_ICALL void TraceGLApi::glStencilMaskFn(GLuint mask) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glStencilMask") gl_api_->glStencilMaskFn(mask); } +DISABLE_CFI_ICALL void TraceGLApi::glStencilMaskSeparateFn(GLenum face, GLuint mask) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glStencilMaskSeparate") gl_api_->glStencilMaskSeparateFn(face, mask); } +DISABLE_CFI_ICALL void TraceGLApi::glStencilOpFn(GLenum fail, GLenum zfail, GLenum zpass) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glStencilOp") gl_api_->glStencilOpFn(fail, zfail, zpass); } +DISABLE_CFI_ICALL void TraceGLApi::glStencilOpSeparateFn(GLenum face, GLenum fail, GLenum zfail, @@ -7252,6 +7962,7 @@ gl_api_->glStencilOpSeparateFn(face, fail, zfail, zpass); } +DISABLE_CFI_ICALL void TraceGLApi::glStencilStrokePathInstancedNVFn( GLsizei numPaths, GLenum pathNameType, @@ -7268,6 +7979,7 @@ transformValues); } +DISABLE_CFI_ICALL void TraceGLApi::glStencilStrokePathNVFn(GLuint path, GLint reference, GLuint mask) { @@ -7275,6 +7987,7 @@ gl_api_->glStencilStrokePathNVFn(path, reference, mask); } +DISABLE_CFI_ICALL void TraceGLApi::glStencilThenCoverFillPathInstancedNVFn( GLsizei numPaths, GLenum pathNameType, @@ -7292,6 +8005,7 @@ transformType, transformValues); } +DISABLE_CFI_ICALL void TraceGLApi::glStencilThenCoverFillPathNVFn(GLuint path, GLenum fillMode, GLuint mask, @@ -7301,6 +8015,7 @@ gl_api_->glStencilThenCoverFillPathNVFn(path, fillMode, mask, coverMode); } +DISABLE_CFI_ICALL void TraceGLApi::glStencilThenCoverStrokePathInstancedNVFn( GLsizei numPaths, GLenum pathNameType, @@ -7318,6 +8033,7 @@ transformType, transformValues); } +DISABLE_CFI_ICALL void TraceGLApi::glStencilThenCoverStrokePathNVFn(GLuint path, GLint reference, GLuint mask, @@ -7327,16 +8043,19 @@ gl_api_->glStencilThenCoverStrokePathNVFn(path, reference, mask, coverMode); } +DISABLE_CFI_ICALL GLboolean TraceGLApi::glTestFenceAPPLEFn(GLuint fence) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glTestFenceAPPLE") return gl_api_->glTestFenceAPPLEFn(fence); } +DISABLE_CFI_ICALL GLboolean TraceGLApi::glTestFenceNVFn(GLuint fence) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glTestFenceNV") return gl_api_->glTestFenceNVFn(fence); } +DISABLE_CFI_ICALL void TraceGLApi::glTexBufferFn(GLenum target, GLenum internalformat, GLuint buffer) { @@ -7344,6 +8063,7 @@ gl_api_->glTexBufferFn(target, internalformat, buffer); } +DISABLE_CFI_ICALL void TraceGLApi::glTexBufferRangeFn(GLenum target, GLenum internalformat, GLuint buffer, @@ -7353,6 +8073,7 @@ gl_api_->glTexBufferRangeFn(target, internalformat, buffer, offset, size); } +DISABLE_CFI_ICALL void TraceGLApi::glTexImage2DFn(GLenum target, GLint level, GLint internalformat, @@ -7367,6 +8088,7 @@ format, type, pixels); } +DISABLE_CFI_ICALL void TraceGLApi::glTexImage2DRobustANGLEFn(GLenum target, GLint level, GLint internalformat, @@ -7383,6 +8105,7 @@ pixels); } +DISABLE_CFI_ICALL void TraceGLApi::glTexImage3DFn(GLenum target, GLint level, GLint internalformat, @@ -7398,6 +8121,7 @@ border, format, type, pixels); } +DISABLE_CFI_ICALL void TraceGLApi::glTexImage3DRobustANGLEFn(GLenum target, GLint level, GLint internalformat, @@ -7415,11 +8139,13 @@ bufSize, pixels); } +DISABLE_CFI_ICALL void TraceGLApi::glTexParameterfFn(GLenum target, GLenum pname, GLfloat param) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glTexParameterf") gl_api_->glTexParameterfFn(target, pname, param); } +DISABLE_CFI_ICALL void TraceGLApi::glTexParameterfvFn(GLenum target, GLenum pname, const GLfloat* params) { @@ -7427,6 +8153,7 @@ gl_api_->glTexParameterfvFn(target, pname, params); } +DISABLE_CFI_ICALL void TraceGLApi::glTexParameterfvRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -7436,11 +8163,13 @@ gl_api_->glTexParameterfvRobustANGLEFn(target, pname, bufSize, params); } +DISABLE_CFI_ICALL void TraceGLApi::glTexParameteriFn(GLenum target, GLenum pname, GLint param) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glTexParameteri") gl_api_->glTexParameteriFn(target, pname, param); } +DISABLE_CFI_ICALL void TraceGLApi::glTexParameterIivRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -7450,6 +8179,7 @@ gl_api_->glTexParameterIivRobustANGLEFn(target, pname, bufSize, params); } +DISABLE_CFI_ICALL void TraceGLApi::glTexParameterIuivRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -7459,6 +8189,7 @@ gl_api_->glTexParameterIuivRobustANGLEFn(target, pname, bufSize, params); } +DISABLE_CFI_ICALL void TraceGLApi::glTexParameterivFn(GLenum target, GLenum pname, const GLint* params) { @@ -7466,6 +8197,7 @@ gl_api_->glTexParameterivFn(target, pname, params); } +DISABLE_CFI_ICALL void TraceGLApi::glTexParameterivRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -7475,6 +8207,7 @@ gl_api_->glTexParameterivRobustANGLEFn(target, pname, bufSize, params); } +DISABLE_CFI_ICALL void TraceGLApi::glTexStorage2DEXTFn(GLenum target, GLsizei levels, GLenum internalformat, @@ -7484,6 +8217,7 @@ gl_api_->glTexStorage2DEXTFn(target, levels, internalformat, width, height); } +DISABLE_CFI_ICALL void TraceGLApi::glTexStorage3DFn(GLenum target, GLsizei levels, GLenum internalformat, @@ -7495,6 +8229,7 @@ depth); } +DISABLE_CFI_ICALL void TraceGLApi::glTexSubImage2DFn(GLenum target, GLint level, GLint xoffset, @@ -7509,6 +8244,7 @@ format, type, pixels); } +DISABLE_CFI_ICALL void TraceGLApi::glTexSubImage2DRobustANGLEFn(GLenum target, GLint level, GLint xoffset, @@ -7524,6 +8260,7 @@ height, format, type, bufSize, pixels); } +DISABLE_CFI_ICALL void TraceGLApi::glTexSubImage3DFn(GLenum target, GLint level, GLint xoffset, @@ -7540,6 +8277,7 @@ height, depth, format, type, pixels); } +DISABLE_CFI_ICALL void TraceGLApi::glTexSubImage3DRobustANGLEFn(GLenum target, GLint level, GLint xoffset, @@ -7558,6 +8296,7 @@ type, bufSize, pixels); } +DISABLE_CFI_ICALL void TraceGLApi::glTransformFeedbackVaryingsFn(GLuint program, GLsizei count, const char* const* varyings, @@ -7567,11 +8306,13 @@ gl_api_->glTransformFeedbackVaryingsFn(program, count, varyings, bufferMode); } +DISABLE_CFI_ICALL void TraceGLApi::glUniform1fFn(GLint location, GLfloat x) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glUniform1f") gl_api_->glUniform1fFn(location, x); } +DISABLE_CFI_ICALL void TraceGLApi::glUniform1fvFn(GLint location, GLsizei count, const GLfloat* v) { @@ -7579,21 +8320,25 @@ gl_api_->glUniform1fvFn(location, count, v); } +DISABLE_CFI_ICALL void TraceGLApi::glUniform1iFn(GLint location, GLint x) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glUniform1i") gl_api_->glUniform1iFn(location, x); } +DISABLE_CFI_ICALL void TraceGLApi::glUniform1ivFn(GLint location, GLsizei count, const GLint* v) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glUniform1iv") gl_api_->glUniform1ivFn(location, count, v); } +DISABLE_CFI_ICALL void TraceGLApi::glUniform1uiFn(GLint location, GLuint v0) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glUniform1ui") gl_api_->glUniform1uiFn(location, v0); } +DISABLE_CFI_ICALL void TraceGLApi::glUniform1uivFn(GLint location, GLsizei count, const GLuint* v) { @@ -7601,11 +8346,13 @@ gl_api_->glUniform1uivFn(location, count, v); } +DISABLE_CFI_ICALL void TraceGLApi::glUniform2fFn(GLint location, GLfloat x, GLfloat y) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glUniform2f") gl_api_->glUniform2fFn(location, x, y); } +DISABLE_CFI_ICALL void TraceGLApi::glUniform2fvFn(GLint location, GLsizei count, const GLfloat* v) { @@ -7613,21 +8360,25 @@ gl_api_->glUniform2fvFn(location, count, v); } +DISABLE_CFI_ICALL void TraceGLApi::glUniform2iFn(GLint location, GLint x, GLint y) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glUniform2i") gl_api_->glUniform2iFn(location, x, y); } +DISABLE_CFI_ICALL void TraceGLApi::glUniform2ivFn(GLint location, GLsizei count, const GLint* v) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glUniform2iv") gl_api_->glUniform2ivFn(location, count, v); } +DISABLE_CFI_ICALL void TraceGLApi::glUniform2uiFn(GLint location, GLuint v0, GLuint v1) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glUniform2ui") gl_api_->glUniform2uiFn(location, v0, v1); } +DISABLE_CFI_ICALL void TraceGLApi::glUniform2uivFn(GLint location, GLsizei count, const GLuint* v) { @@ -7635,6 +8386,7 @@ gl_api_->glUniform2uivFn(location, count, v); } +DISABLE_CFI_ICALL void TraceGLApi::glUniform3fFn(GLint location, GLfloat x, GLfloat y, @@ -7643,6 +8395,7 @@ gl_api_->glUniform3fFn(location, x, y, z); } +DISABLE_CFI_ICALL void TraceGLApi::glUniform3fvFn(GLint location, GLsizei count, const GLfloat* v) { @@ -7650,16 +8403,19 @@ gl_api_->glUniform3fvFn(location, count, v); } +DISABLE_CFI_ICALL void TraceGLApi::glUniform3iFn(GLint location, GLint x, GLint y, GLint z) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glUniform3i") gl_api_->glUniform3iFn(location, x, y, z); } +DISABLE_CFI_ICALL void TraceGLApi::glUniform3ivFn(GLint location, GLsizei count, const GLint* v) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glUniform3iv") gl_api_->glUniform3ivFn(location, count, v); } +DISABLE_CFI_ICALL void TraceGLApi::glUniform3uiFn(GLint location, GLuint v0, GLuint v1, @@ -7668,6 +8424,7 @@ gl_api_->glUniform3uiFn(location, v0, v1, v2); } +DISABLE_CFI_ICALL void TraceGLApi::glUniform3uivFn(GLint location, GLsizei count, const GLuint* v) { @@ -7675,6 +8432,7 @@ gl_api_->glUniform3uivFn(location, count, v); } +DISABLE_CFI_ICALL void TraceGLApi::glUniform4fFn(GLint location, GLfloat x, GLfloat y, @@ -7684,6 +8442,7 @@ gl_api_->glUniform4fFn(location, x, y, z, w); } +DISABLE_CFI_ICALL void TraceGLApi::glUniform4fvFn(GLint location, GLsizei count, const GLfloat* v) { @@ -7691,6 +8450,7 @@ gl_api_->glUniform4fvFn(location, count, v); } +DISABLE_CFI_ICALL void TraceGLApi::glUniform4iFn(GLint location, GLint x, GLint y, @@ -7700,11 +8460,13 @@ gl_api_->glUniform4iFn(location, x, y, z, w); } +DISABLE_CFI_ICALL void TraceGLApi::glUniform4ivFn(GLint location, GLsizei count, const GLint* v) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glUniform4iv") gl_api_->glUniform4ivFn(location, count, v); } +DISABLE_CFI_ICALL void TraceGLApi::glUniform4uiFn(GLint location, GLuint v0, GLuint v1, @@ -7714,6 +8476,7 @@ gl_api_->glUniform4uiFn(location, v0, v1, v2, v3); } +DISABLE_CFI_ICALL void TraceGLApi::glUniform4uivFn(GLint location, GLsizei count, const GLuint* v) { @@ -7721,6 +8484,7 @@ gl_api_->glUniform4uivFn(location, count, v); } +DISABLE_CFI_ICALL void TraceGLApi::glUniformBlockBindingFn(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding) { @@ -7729,6 +8493,7 @@ uniformBlockBinding); } +DISABLE_CFI_ICALL void TraceGLApi::glUniformMatrix2fvFn(GLint location, GLsizei count, GLboolean transpose, @@ -7737,6 +8502,7 @@ gl_api_->glUniformMatrix2fvFn(location, count, transpose, value); } +DISABLE_CFI_ICALL void TraceGLApi::glUniformMatrix2x3fvFn(GLint location, GLsizei count, GLboolean transpose, @@ -7745,6 +8511,7 @@ gl_api_->glUniformMatrix2x3fvFn(location, count, transpose, value); } +DISABLE_CFI_ICALL void TraceGLApi::glUniformMatrix2x4fvFn(GLint location, GLsizei count, GLboolean transpose, @@ -7753,6 +8520,7 @@ gl_api_->glUniformMatrix2x4fvFn(location, count, transpose, value); } +DISABLE_CFI_ICALL void TraceGLApi::glUniformMatrix3fvFn(GLint location, GLsizei count, GLboolean transpose, @@ -7761,6 +8529,7 @@ gl_api_->glUniformMatrix3fvFn(location, count, transpose, value); } +DISABLE_CFI_ICALL void TraceGLApi::glUniformMatrix3x2fvFn(GLint location, GLsizei count, GLboolean transpose, @@ -7769,6 +8538,7 @@ gl_api_->glUniformMatrix3x2fvFn(location, count, transpose, value); } +DISABLE_CFI_ICALL void TraceGLApi::glUniformMatrix3x4fvFn(GLint location, GLsizei count, GLboolean transpose, @@ -7777,6 +8547,7 @@ gl_api_->glUniformMatrix3x4fvFn(location, count, transpose, value); } +DISABLE_CFI_ICALL void TraceGLApi::glUniformMatrix4fvFn(GLint location, GLsizei count, GLboolean transpose, @@ -7785,6 +8556,7 @@ gl_api_->glUniformMatrix4fvFn(location, count, transpose, value); } +DISABLE_CFI_ICALL void TraceGLApi::glUniformMatrix4x2fvFn(GLint location, GLsizei count, GLboolean transpose, @@ -7793,6 +8565,7 @@ gl_api_->glUniformMatrix4x2fvFn(location, count, transpose, value); } +DISABLE_CFI_ICALL void TraceGLApi::glUniformMatrix4x3fvFn(GLint location, GLsizei count, GLboolean transpose, @@ -7801,41 +8574,49 @@ gl_api_->glUniformMatrix4x3fvFn(location, count, transpose, value); } +DISABLE_CFI_ICALL GLboolean TraceGLApi::glUnmapBufferFn(GLenum target) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glUnmapBuffer") return gl_api_->glUnmapBufferFn(target); } +DISABLE_CFI_ICALL void TraceGLApi::glUseProgramFn(GLuint program) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glUseProgram") gl_api_->glUseProgramFn(program); } +DISABLE_CFI_ICALL void TraceGLApi::glValidateProgramFn(GLuint program) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glValidateProgram") gl_api_->glValidateProgramFn(program); } +DISABLE_CFI_ICALL void TraceGLApi::glVertexAttrib1fFn(GLuint indx, GLfloat x) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glVertexAttrib1f") gl_api_->glVertexAttrib1fFn(indx, x); } +DISABLE_CFI_ICALL void TraceGLApi::glVertexAttrib1fvFn(GLuint indx, const GLfloat* values) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glVertexAttrib1fv") gl_api_->glVertexAttrib1fvFn(indx, values); } +DISABLE_CFI_ICALL void TraceGLApi::glVertexAttrib2fFn(GLuint indx, GLfloat x, GLfloat y) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glVertexAttrib2f") gl_api_->glVertexAttrib2fFn(indx, x, y); } +DISABLE_CFI_ICALL void TraceGLApi::glVertexAttrib2fvFn(GLuint indx, const GLfloat* values) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glVertexAttrib2fv") gl_api_->glVertexAttrib2fvFn(indx, values); } +DISABLE_CFI_ICALL void TraceGLApi::glVertexAttrib3fFn(GLuint indx, GLfloat x, GLfloat y, @@ -7844,11 +8625,13 @@ gl_api_->glVertexAttrib3fFn(indx, x, y, z); } +DISABLE_CFI_ICALL void TraceGLApi::glVertexAttrib3fvFn(GLuint indx, const GLfloat* values) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glVertexAttrib3fv") gl_api_->glVertexAttrib3fvFn(indx, values); } +DISABLE_CFI_ICALL void TraceGLApi::glVertexAttrib4fFn(GLuint indx, GLfloat x, GLfloat y, @@ -7858,16 +8641,19 @@ gl_api_->glVertexAttrib4fFn(indx, x, y, z, w); } +DISABLE_CFI_ICALL void TraceGLApi::glVertexAttrib4fvFn(GLuint indx, const GLfloat* values) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glVertexAttrib4fv") gl_api_->glVertexAttrib4fvFn(indx, values); } +DISABLE_CFI_ICALL void TraceGLApi::glVertexAttribDivisorANGLEFn(GLuint index, GLuint divisor) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glVertexAttribDivisorANGLE") gl_api_->glVertexAttribDivisorANGLEFn(index, divisor); } +DISABLE_CFI_ICALL void TraceGLApi::glVertexAttribI4iFn(GLuint indx, GLint x, GLint y, @@ -7877,11 +8663,13 @@ gl_api_->glVertexAttribI4iFn(indx, x, y, z, w); } +DISABLE_CFI_ICALL void TraceGLApi::glVertexAttribI4ivFn(GLuint indx, const GLint* values) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glVertexAttribI4iv") gl_api_->glVertexAttribI4ivFn(indx, values); } +DISABLE_CFI_ICALL void TraceGLApi::glVertexAttribI4uiFn(GLuint indx, GLuint x, GLuint y, @@ -7891,11 +8679,13 @@ gl_api_->glVertexAttribI4uiFn(indx, x, y, z, w); } +DISABLE_CFI_ICALL void TraceGLApi::glVertexAttribI4uivFn(GLuint indx, const GLuint* values) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glVertexAttribI4uiv") gl_api_->glVertexAttribI4uivFn(indx, values); } +DISABLE_CFI_ICALL void TraceGLApi::glVertexAttribIPointerFn(GLuint indx, GLint size, GLenum type, @@ -7905,6 +8695,7 @@ gl_api_->glVertexAttribIPointerFn(indx, size, type, stride, ptr); } +DISABLE_CFI_ICALL void TraceGLApi::glVertexAttribPointerFn(GLuint indx, GLint size, GLenum type, @@ -7915,16 +8706,19 @@ gl_api_->glVertexAttribPointerFn(indx, size, type, normalized, stride, ptr); } +DISABLE_CFI_ICALL void TraceGLApi::glViewportFn(GLint x, GLint y, GLsizei width, GLsizei height) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glViewport") gl_api_->glViewportFn(x, y, width, height); } +DISABLE_CFI_ICALL void TraceGLApi::glWaitSyncFn(GLsync sync, GLbitfield flags, GLuint64 timeout) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glWaitSync") gl_api_->glWaitSyncFn(sync, flags, timeout); } +DISABLE_CFI_ICALL void TraceGLApi::glWindowRectanglesEXTFn(GLenum mode, GLsizei n, const GLint* box) { @@ -7932,12 +8726,14 @@ gl_api_->glWindowRectanglesEXTFn(mode, n, box); } +DISABLE_CFI_ICALL void DebugGLApi::glActiveTextureFn(GLenum texture) { GL_SERVICE_LOG("glActiveTexture" << "(" << GLEnums::GetStringEnum(texture) << ")"); gl_api_->glActiveTextureFn(texture); } +DISABLE_CFI_ICALL void DebugGLApi::glApplyFramebufferAttachmentCMAAINTELFn(void) { GL_SERVICE_LOG("glApplyFramebufferAttachmentCMAAINTEL" << "(" @@ -7945,24 +8741,28 @@ gl_api_->glApplyFramebufferAttachmentCMAAINTELFn(); } +DISABLE_CFI_ICALL void DebugGLApi::glAttachShaderFn(GLuint program, GLuint shader) { GL_SERVICE_LOG("glAttachShader" << "(" << program << ", " << shader << ")"); gl_api_->glAttachShaderFn(program, shader); } +DISABLE_CFI_ICALL void DebugGLApi::glBeginQueryFn(GLenum target, GLuint id) { GL_SERVICE_LOG("glBeginQuery" << "(" << GLEnums::GetStringEnum(target) << ", " << id << ")"); gl_api_->glBeginQueryFn(target, id); } +DISABLE_CFI_ICALL void DebugGLApi::glBeginTransformFeedbackFn(GLenum primitiveMode) { GL_SERVICE_LOG("glBeginTransformFeedback" << "(" << GLEnums::GetStringEnum(primitiveMode) << ")"); gl_api_->glBeginTransformFeedbackFn(primitiveMode); } +DISABLE_CFI_ICALL void DebugGLApi::glBindAttribLocationFn(GLuint program, GLuint index, const char* name) { @@ -7971,6 +8771,7 @@ gl_api_->glBindAttribLocationFn(program, index, name); } +DISABLE_CFI_ICALL void DebugGLApi::glBindBufferFn(GLenum target, GLuint buffer) { GL_SERVICE_LOG("glBindBuffer" << "(" << GLEnums::GetStringEnum(target) << ", " << buffer @@ -7978,6 +8779,7 @@ gl_api_->glBindBufferFn(target, buffer); } +DISABLE_CFI_ICALL void DebugGLApi::glBindBufferBaseFn(GLenum target, GLuint index, GLuint buffer) { @@ -7987,6 +8789,7 @@ gl_api_->glBindBufferBaseFn(target, index, buffer); } +DISABLE_CFI_ICALL void DebugGLApi::glBindBufferRangeFn(GLenum target, GLuint index, GLuint buffer, @@ -7998,6 +8801,7 @@ gl_api_->glBindBufferRangeFn(target, index, buffer, offset, size); } +DISABLE_CFI_ICALL void DebugGLApi::glBindFragDataLocationFn(GLuint program, GLuint colorNumber, const char* name) { @@ -8007,6 +8811,7 @@ gl_api_->glBindFragDataLocationFn(program, colorNumber, name); } +DISABLE_CFI_ICALL void DebugGLApi::glBindFragDataLocationIndexedFn(GLuint program, GLuint colorNumber, GLuint index, @@ -8017,6 +8822,7 @@ gl_api_->glBindFragDataLocationIndexedFn(program, colorNumber, index, name); } +DISABLE_CFI_ICALL void DebugGLApi::glBindFramebufferEXTFn(GLenum target, GLuint framebuffer) { GL_SERVICE_LOG("glBindFramebufferEXT" << "(" << GLEnums::GetStringEnum(target) << ", " << framebuffer @@ -8024,6 +8830,7 @@ gl_api_->glBindFramebufferEXTFn(target, framebuffer); } +DISABLE_CFI_ICALL void DebugGLApi::glBindImageTextureEXTFn(GLuint index, GLuint texture, GLint level, @@ -8039,6 +8846,7 @@ access, format); } +DISABLE_CFI_ICALL void DebugGLApi::glBindRenderbufferEXTFn(GLenum target, GLuint renderbuffer) { GL_SERVICE_LOG("glBindRenderbufferEXT" << "(" << GLEnums::GetStringEnum(target) << ", " @@ -8046,12 +8854,14 @@ gl_api_->glBindRenderbufferEXTFn(target, renderbuffer); } +DISABLE_CFI_ICALL void DebugGLApi::glBindSamplerFn(GLuint unit, GLuint sampler) { GL_SERVICE_LOG("glBindSampler" << "(" << unit << ", " << sampler << ")"); gl_api_->glBindSamplerFn(unit, sampler); } +DISABLE_CFI_ICALL void DebugGLApi::glBindTextureFn(GLenum target, GLuint texture) { GL_SERVICE_LOG("glBindTexture" << "(" << GLEnums::GetStringEnum(target) << ", " << texture @@ -8059,12 +8869,14 @@ gl_api_->glBindTextureFn(target, texture); } +DISABLE_CFI_ICALL void DebugGLApi::glBindTransformFeedbackFn(GLenum target, GLuint id) { GL_SERVICE_LOG("glBindTransformFeedback" << "(" << GLEnums::GetStringEnum(target) << ", " << id << ")"); gl_api_->glBindTransformFeedbackFn(target, id); } +DISABLE_CFI_ICALL void DebugGLApi::glBindUniformLocationCHROMIUMFn(GLuint program, GLint location, const char* name) { @@ -8073,12 +8885,14 @@ gl_api_->glBindUniformLocationCHROMIUMFn(program, location, name); } +DISABLE_CFI_ICALL void DebugGLApi::glBindVertexArrayOESFn(GLuint array) { GL_SERVICE_LOG("glBindVertexArrayOES" << "(" << array << ")"); gl_api_->glBindVertexArrayOESFn(array); } +DISABLE_CFI_ICALL void DebugGLApi::glBlendBarrierKHRFn(void) { GL_SERVICE_LOG("glBlendBarrierKHR" << "(" @@ -8086,6 +8900,7 @@ gl_api_->glBlendBarrierKHRFn(); } +DISABLE_CFI_ICALL void DebugGLApi::glBlendColorFn(GLclampf red, GLclampf green, GLclampf blue, @@ -8096,12 +8911,14 @@ gl_api_->glBlendColorFn(red, green, blue, alpha); } +DISABLE_CFI_ICALL void DebugGLApi::glBlendEquationFn(GLenum mode) { GL_SERVICE_LOG("glBlendEquation" << "(" << GLEnums::GetStringEnum(mode) << ")"); gl_api_->glBlendEquationFn(mode); } +DISABLE_CFI_ICALL void DebugGLApi::glBlendEquationSeparateFn(GLenum modeRGB, GLenum modeAlpha) { GL_SERVICE_LOG("glBlendEquationSeparate" << "(" << GLEnums::GetStringEnum(modeRGB) << ", " @@ -8109,6 +8926,7 @@ gl_api_->glBlendEquationSeparateFn(modeRGB, modeAlpha); } +DISABLE_CFI_ICALL void DebugGLApi::glBlendFuncFn(GLenum sfactor, GLenum dfactor) { GL_SERVICE_LOG("glBlendFunc" << "(" << GLEnums::GetStringEnum(sfactor) << ", " @@ -8116,6 +8934,7 @@ gl_api_->glBlendFuncFn(sfactor, dfactor); } +DISABLE_CFI_ICALL void DebugGLApi::glBlendFuncSeparateFn(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, @@ -8128,6 +8947,7 @@ gl_api_->glBlendFuncSeparateFn(srcRGB, dstRGB, srcAlpha, dstAlpha); } +DISABLE_CFI_ICALL void DebugGLApi::glBlitFramebufferFn(GLint srcX0, GLint srcY0, GLint srcX1, @@ -8147,6 +8967,7 @@ dstY1, mask, filter); } +DISABLE_CFI_ICALL void DebugGLApi::glBufferDataFn(GLenum target, GLsizeiptr size, const void* data, @@ -8158,6 +8979,7 @@ gl_api_->glBufferDataFn(target, size, data, usage); } +DISABLE_CFI_ICALL void DebugGLApi::glBufferSubDataFn(GLenum target, GLintptr offset, GLsizeiptr size, @@ -8169,6 +8991,7 @@ gl_api_->glBufferSubDataFn(target, offset, size, data); } +DISABLE_CFI_ICALL GLenum DebugGLApi::glCheckFramebufferStatusEXTFn(GLenum target) { GL_SERVICE_LOG("glCheckFramebufferStatusEXT" << "(" << GLEnums::GetStringEnum(target) << ")"); @@ -8179,12 +9002,14 @@ return result; } +DISABLE_CFI_ICALL void DebugGLApi::glClearFn(GLbitfield mask) { GL_SERVICE_LOG("glClear" << "(" << mask << ")"); gl_api_->glClearFn(mask); } +DISABLE_CFI_ICALL void DebugGLApi::glClearBufferfiFn(GLenum buffer, GLint drawbuffer, const GLfloat depth, @@ -8195,6 +9020,7 @@ gl_api_->glClearBufferfiFn(buffer, drawbuffer, depth, stencil); } +DISABLE_CFI_ICALL void DebugGLApi::glClearBufferfvFn(GLenum buffer, GLint drawbuffer, const GLfloat* value) { @@ -8204,6 +9030,7 @@ gl_api_->glClearBufferfvFn(buffer, drawbuffer, value); } +DISABLE_CFI_ICALL void DebugGLApi::glClearBufferivFn(GLenum buffer, GLint drawbuffer, const GLint* value) { @@ -8213,6 +9040,7 @@ gl_api_->glClearBufferivFn(buffer, drawbuffer, value); } +DISABLE_CFI_ICALL void DebugGLApi::glClearBufferuivFn(GLenum buffer, GLint drawbuffer, const GLuint* value) { @@ -8222,6 +9050,7 @@ gl_api_->glClearBufferuivFn(buffer, drawbuffer, value); } +DISABLE_CFI_ICALL void DebugGLApi::glClearColorFn(GLclampf red, GLclampf green, GLclampf blue, @@ -8232,24 +9061,28 @@ gl_api_->glClearColorFn(red, green, blue, alpha); } +DISABLE_CFI_ICALL void DebugGLApi::glClearDepthFn(GLclampd depth) { GL_SERVICE_LOG("glClearDepth" << "(" << depth << ")"); gl_api_->glClearDepthFn(depth); } +DISABLE_CFI_ICALL void DebugGLApi::glClearDepthfFn(GLclampf depth) { GL_SERVICE_LOG("glClearDepthf" << "(" << depth << ")"); gl_api_->glClearDepthfFn(depth); } +DISABLE_CFI_ICALL void DebugGLApi::glClearStencilFn(GLint s) { GL_SERVICE_LOG("glClearStencil" << "(" << s << ")"); gl_api_->glClearStencilFn(s); } +DISABLE_CFI_ICALL GLenum DebugGLApi::glClientWaitSyncFn(GLsync sync, GLbitfield flags, GLuint64 timeout) { @@ -8260,6 +9093,7 @@ return result; } +DISABLE_CFI_ICALL void DebugGLApi::glColorMaskFn(GLboolean red, GLboolean green, GLboolean blue, @@ -8272,12 +9106,14 @@ gl_api_->glColorMaskFn(red, green, blue, alpha); } +DISABLE_CFI_ICALL void DebugGLApi::glCompileShaderFn(GLuint shader) { GL_SERVICE_LOG("glCompileShader" << "(" << shader << ")"); gl_api_->glCompileShaderFn(shader); } +DISABLE_CFI_ICALL void DebugGLApi::glCompressedCopyTextureCHROMIUMFn(GLuint sourceId, GLuint destId) { GL_SERVICE_LOG("glCompressedCopyTextureCHROMIUM" @@ -8285,6 +9121,7 @@ gl_api_->glCompressedCopyTextureCHROMIUMFn(sourceId, destId); } +DISABLE_CFI_ICALL void DebugGLApi::glCompressedTexImage2DFn(GLenum target, GLint level, GLenum internalformat, @@ -8302,6 +9139,7 @@ height, border, imageSize, data); } +DISABLE_CFI_ICALL void DebugGLApi::glCompressedTexImage2DRobustANGLEFn(GLenum target, GLint level, GLenum internalformat, @@ -8322,6 +9160,7 @@ dataSize, data); } +DISABLE_CFI_ICALL void DebugGLApi::glCompressedTexImage3DFn(GLenum target, GLint level, GLenum internalformat, @@ -8341,6 +9180,7 @@ height, depth, border, imageSize, data); } +DISABLE_CFI_ICALL void DebugGLApi::glCompressedTexImage3DRobustANGLEFn(GLenum target, GLint level, GLenum internalformat, @@ -8362,6 +9202,7 @@ imageSize, dataSize, data); } +DISABLE_CFI_ICALL void DebugGLApi::glCompressedTexSubImage2DFn(GLenum target, GLint level, GLint xoffset, @@ -8380,6 +9221,7 @@ height, format, imageSize, data); } +DISABLE_CFI_ICALL void DebugGLApi::glCompressedTexSubImage2DRobustANGLEFn(GLenum target, GLint level, GLint xoffset, @@ -8401,6 +9243,7 @@ dataSize, data); } +DISABLE_CFI_ICALL void DebugGLApi::glCompressedTexSubImage3DFn(GLenum target, GLint level, GLint xoffset, @@ -8423,6 +9266,7 @@ data); } +DISABLE_CFI_ICALL void DebugGLApi::glCompressedTexSubImage3DRobustANGLEFn(GLenum target, GLint level, GLint xoffset, @@ -8446,6 +9290,7 @@ imageSize, dataSize, data); } +DISABLE_CFI_ICALL void DebugGLApi::glCopyBufferSubDataFn(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, @@ -8459,6 +9304,7 @@ writeOffset, size); } +DISABLE_CFI_ICALL void DebugGLApi::glCopySubTextureCHROMIUMFn(GLuint sourceId, GLint sourceLevel, GLenum destTarget, @@ -8487,6 +9333,7 @@ unpackUnmultiplyAlpha); } +DISABLE_CFI_ICALL void DebugGLApi::glCopyTexImage2DFn(GLenum target, GLint level, GLenum internalformat, @@ -8504,6 +9351,7 @@ height, border); } +DISABLE_CFI_ICALL void DebugGLApi::glCopyTexSubImage2DFn(GLenum target, GLint level, GLint xoffset, @@ -8520,6 +9368,7 @@ height); } +DISABLE_CFI_ICALL void DebugGLApi::glCopyTexSubImage3DFn(GLenum target, GLint level, GLint xoffset, @@ -8538,6 +9387,7 @@ width, height); } +DISABLE_CFI_ICALL void DebugGLApi::glCopyTextureCHROMIUMFn(GLuint sourceId, GLint sourceLevel, GLenum destTarget, @@ -8561,12 +9411,14 @@ destType, unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha); } +DISABLE_CFI_ICALL void DebugGLApi::glCoverageModulationNVFn(GLenum components) { GL_SERVICE_LOG("glCoverageModulationNV" << "(" << GLEnums::GetStringEnum(components) << ")"); gl_api_->glCoverageModulationNVFn(components); } +DISABLE_CFI_ICALL void DebugGLApi::glCoverFillPathInstancedNVFn(GLsizei numPaths, GLenum pathNameType, const void* paths, @@ -8586,6 +9438,7 @@ transformValues); } +DISABLE_CFI_ICALL void DebugGLApi::glCoverFillPathNVFn(GLuint path, GLenum coverMode) { GL_SERVICE_LOG("glCoverFillPathNV" << "(" << path << ", " << GLEnums::GetStringEnum(coverMode) @@ -8593,6 +9446,7 @@ gl_api_->glCoverFillPathNVFn(path, coverMode); } +DISABLE_CFI_ICALL void DebugGLApi::glCoverStrokePathInstancedNVFn( GLsizei numPaths, GLenum pathNameType, @@ -8613,6 +9467,7 @@ transformValues); } +DISABLE_CFI_ICALL void DebugGLApi::glCoverStrokePathNVFn(GLuint name, GLenum coverMode) { GL_SERVICE_LOG("glCoverStrokePathNV" << "(" << name << ", " << GLEnums::GetStringEnum(coverMode) @@ -8620,6 +9475,7 @@ gl_api_->glCoverStrokePathNVFn(name, coverMode); } +DISABLE_CFI_ICALL GLuint DebugGLApi::glCreateProgramFn(void) { GL_SERVICE_LOG("glCreateProgram" << "(" @@ -8629,6 +9485,7 @@ return result; } +DISABLE_CFI_ICALL GLuint DebugGLApi::glCreateShaderFn(GLenum type) { GL_SERVICE_LOG("glCreateShader" << "(" << GLEnums::GetStringEnum(type) << ")"); @@ -8637,12 +9494,14 @@ return result; } +DISABLE_CFI_ICALL void DebugGLApi::glCullFaceFn(GLenum mode) { GL_SERVICE_LOG("glCullFace" << "(" << GLEnums::GetStringEnum(mode) << ")"); gl_api_->glCullFaceFn(mode); } +DISABLE_CFI_ICALL void DebugGLApi::glDebugMessageCallbackFn(GLDEBUGPROC callback, const void* userParam) { GL_SERVICE_LOG("glDebugMessageCallback" @@ -8651,6 +9510,7 @@ gl_api_->glDebugMessageCallbackFn(callback, userParam); } +DISABLE_CFI_ICALL void DebugGLApi::glDebugMessageControlFn(GLenum source, GLenum type, GLenum severity, @@ -8666,6 +9526,7 @@ gl_api_->glDebugMessageControlFn(source, type, severity, count, ids, enabled); } +DISABLE_CFI_ICALL void DebugGLApi::glDebugMessageInsertFn(GLenum source, GLenum type, GLuint id, @@ -8680,6 +9541,7 @@ gl_api_->glDebugMessageInsertFn(source, type, id, severity, length, buf); } +DISABLE_CFI_ICALL void DebugGLApi::glDeleteBuffersARBFn(GLsizei n, const GLuint* buffers) { GL_SERVICE_LOG("glDeleteBuffersARB" << "(" << n << ", " << static_cast<const void*>(buffers) @@ -8687,6 +9549,7 @@ gl_api_->glDeleteBuffersARBFn(n, buffers); } +DISABLE_CFI_ICALL void DebugGLApi::glDeleteFencesAPPLEFn(GLsizei n, const GLuint* fences) { GL_SERVICE_LOG("glDeleteFencesAPPLE" << "(" << n << ", " << static_cast<const void*>(fences) @@ -8694,6 +9557,7 @@ gl_api_->glDeleteFencesAPPLEFn(n, fences); } +DISABLE_CFI_ICALL void DebugGLApi::glDeleteFencesNVFn(GLsizei n, const GLuint* fences) { GL_SERVICE_LOG("glDeleteFencesNV" << "(" << n << ", " << static_cast<const void*>(fences) @@ -8701,6 +9565,7 @@ gl_api_->glDeleteFencesNVFn(n, fences); } +DISABLE_CFI_ICALL void DebugGLApi::glDeleteFramebuffersEXTFn(GLsizei n, const GLuint* framebuffers) { GL_SERVICE_LOG("glDeleteFramebuffersEXT" @@ -8709,24 +9574,28 @@ gl_api_->glDeleteFramebuffersEXTFn(n, framebuffers); } +DISABLE_CFI_ICALL void DebugGLApi::glDeletePathsNVFn(GLuint path, GLsizei range) { GL_SERVICE_LOG("glDeletePathsNV" << "(" << path << ", " << range << ")"); gl_api_->glDeletePathsNVFn(path, range); } +DISABLE_CFI_ICALL void DebugGLApi::glDeleteProgramFn(GLuint program) { GL_SERVICE_LOG("glDeleteProgram" << "(" << program << ")"); gl_api_->glDeleteProgramFn(program); } +DISABLE_CFI_ICALL void DebugGLApi::glDeleteQueriesFn(GLsizei n, const GLuint* ids) { GL_SERVICE_LOG("glDeleteQueries" << "(" << n << ", " << static_cast<const void*>(ids) << ")"); gl_api_->glDeleteQueriesFn(n, ids); } +DISABLE_CFI_ICALL void DebugGLApi::glDeleteRenderbuffersEXTFn(GLsizei n, const GLuint* renderbuffers) { GL_SERVICE_LOG("glDeleteRenderbuffersEXT" @@ -8735,6 +9604,7 @@ gl_api_->glDeleteRenderbuffersEXTFn(n, renderbuffers); } +DISABLE_CFI_ICALL void DebugGLApi::glDeleteSamplersFn(GLsizei n, const GLuint* samplers) { GL_SERVICE_LOG("glDeleteSamplers" << "(" << n << ", " << static_cast<const void*>(samplers) @@ -8742,18 +9612,21 @@ gl_api_->glDeleteSamplersFn(n, samplers); } +DISABLE_CFI_ICALL void DebugGLApi::glDeleteShaderFn(GLuint shader) { GL_SERVICE_LOG("glDeleteShader" << "(" << shader << ")"); gl_api_->glDeleteShaderFn(shader); } +DISABLE_CFI_ICALL void DebugGLApi::glDeleteSyncFn(GLsync sync) { GL_SERVICE_LOG("glDeleteSync" << "(" << sync << ")"); gl_api_->glDeleteSyncFn(sync); } +DISABLE_CFI_ICALL void DebugGLApi::glDeleteTexturesFn(GLsizei n, const GLuint* textures) { GL_SERVICE_LOG("glDeleteTextures" << "(" << n << ", " << static_cast<const void*>(textures) @@ -8761,12 +9634,14 @@ gl_api_->glDeleteTexturesFn(n, textures); } +DISABLE_CFI_ICALL void DebugGLApi::glDeleteTransformFeedbacksFn(GLsizei n, const GLuint* ids) { GL_SERVICE_LOG("glDeleteTransformFeedbacks" << "(" << n << ", " << static_cast<const void*>(ids) << ")"); gl_api_->glDeleteTransformFeedbacksFn(n, ids); } +DISABLE_CFI_ICALL void DebugGLApi::glDeleteVertexArraysOESFn(GLsizei n, const GLuint* arrays) { GL_SERVICE_LOG("glDeleteVertexArraysOES" << "(" << n << ", " << static_cast<const void*>(arrays) @@ -8774,48 +9649,56 @@ gl_api_->glDeleteVertexArraysOESFn(n, arrays); } +DISABLE_CFI_ICALL void DebugGLApi::glDepthFuncFn(GLenum func) { GL_SERVICE_LOG("glDepthFunc" << "(" << GLEnums::GetStringEnum(func) << ")"); gl_api_->glDepthFuncFn(func); } +DISABLE_CFI_ICALL void DebugGLApi::glDepthMaskFn(GLboolean flag) { GL_SERVICE_LOG("glDepthMask" << "(" << GLEnums::GetStringBool(flag) << ")"); gl_api_->glDepthMaskFn(flag); } +DISABLE_CFI_ICALL void DebugGLApi::glDepthRangeFn(GLclampd zNear, GLclampd zFar) { GL_SERVICE_LOG("glDepthRange" << "(" << zNear << ", " << zFar << ")"); gl_api_->glDepthRangeFn(zNear, zFar); } +DISABLE_CFI_ICALL void DebugGLApi::glDepthRangefFn(GLclampf zNear, GLclampf zFar) { GL_SERVICE_LOG("glDepthRangef" << "(" << zNear << ", " << zFar << ")"); gl_api_->glDepthRangefFn(zNear, zFar); } +DISABLE_CFI_ICALL void DebugGLApi::glDetachShaderFn(GLuint program, GLuint shader) { GL_SERVICE_LOG("glDetachShader" << "(" << program << ", " << shader << ")"); gl_api_->glDetachShaderFn(program, shader); } +DISABLE_CFI_ICALL void DebugGLApi::glDisableFn(GLenum cap) { GL_SERVICE_LOG("glDisable" << "(" << GLEnums::GetStringEnum(cap) << ")"); gl_api_->glDisableFn(cap); } +DISABLE_CFI_ICALL void DebugGLApi::glDisableVertexAttribArrayFn(GLuint index) { GL_SERVICE_LOG("glDisableVertexAttribArray" << "(" << index << ")"); gl_api_->glDisableVertexAttribArrayFn(index); } +DISABLE_CFI_ICALL void DebugGLApi::glDiscardFramebufferEXTFn(GLenum target, GLsizei numAttachments, const GLenum* attachments) { @@ -8826,6 +9709,7 @@ gl_api_->glDiscardFramebufferEXTFn(target, numAttachments, attachments); } +DISABLE_CFI_ICALL void DebugGLApi::glDrawArraysFn(GLenum mode, GLint first, GLsizei count) { GL_SERVICE_LOG("glDrawArrays" << "(" << GLEnums::GetStringEnum(mode) << ", " << first << ", " @@ -8833,6 +9717,7 @@ gl_api_->glDrawArraysFn(mode, first, count); } +DISABLE_CFI_ICALL void DebugGLApi::glDrawArraysInstancedANGLEFn(GLenum mode, GLint first, GLsizei count, @@ -8843,18 +9728,21 @@ gl_api_->glDrawArraysInstancedANGLEFn(mode, first, count, primcount); } +DISABLE_CFI_ICALL void DebugGLApi::glDrawBufferFn(GLenum mode) { GL_SERVICE_LOG("glDrawBuffer" << "(" << GLEnums::GetStringEnum(mode) << ")"); gl_api_->glDrawBufferFn(mode); } +DISABLE_CFI_ICALL void DebugGLApi::glDrawBuffersARBFn(GLsizei n, const GLenum* bufs) { GL_SERVICE_LOG("glDrawBuffersARB" << "(" << n << ", " << static_cast<const void*>(bufs) << ")"); gl_api_->glDrawBuffersARBFn(n, bufs); } +DISABLE_CFI_ICALL void DebugGLApi::glDrawElementsFn(GLenum mode, GLsizei count, GLenum type, @@ -8866,6 +9754,7 @@ gl_api_->glDrawElementsFn(mode, count, type, indices); } +DISABLE_CFI_ICALL void DebugGLApi::glDrawElementsInstancedANGLEFn(GLenum mode, GLsizei count, GLenum type, @@ -8880,6 +9769,7 @@ primcount); } +DISABLE_CFI_ICALL void DebugGLApi::glDrawRangeElementsFn(GLenum mode, GLuint start, GLuint end, @@ -8893,6 +9783,7 @@ gl_api_->glDrawRangeElementsFn(mode, start, end, count, type, indices); } +DISABLE_CFI_ICALL void DebugGLApi::glEGLImageTargetRenderbufferStorageOESFn(GLenum target, GLeglImageOES image) { GL_SERVICE_LOG("glEGLImageTargetRenderbufferStorageOES" @@ -8901,6 +9792,7 @@ gl_api_->glEGLImageTargetRenderbufferStorageOESFn(target, image); } +DISABLE_CFI_ICALL void DebugGLApi::glEGLImageTargetTexture2DOESFn(GLenum target, GLeglImageOES image) { GL_SERVICE_LOG("glEGLImageTargetTexture2DOES" @@ -8909,24 +9801,28 @@ gl_api_->glEGLImageTargetTexture2DOESFn(target, image); } +DISABLE_CFI_ICALL void DebugGLApi::glEnableFn(GLenum cap) { GL_SERVICE_LOG("glEnable" << "(" << GLEnums::GetStringEnum(cap) << ")"); gl_api_->glEnableFn(cap); } +DISABLE_CFI_ICALL void DebugGLApi::glEnableVertexAttribArrayFn(GLuint index) { GL_SERVICE_LOG("glEnableVertexAttribArray" << "(" << index << ")"); gl_api_->glEnableVertexAttribArrayFn(index); } +DISABLE_CFI_ICALL void DebugGLApi::glEndQueryFn(GLenum target) { GL_SERVICE_LOG("glEndQuery" << "(" << GLEnums::GetStringEnum(target) << ")"); gl_api_->glEndQueryFn(target); } +DISABLE_CFI_ICALL void DebugGLApi::glEndTransformFeedbackFn(void) { GL_SERVICE_LOG("glEndTransformFeedback" << "(" @@ -8934,6 +9830,7 @@ gl_api_->glEndTransformFeedbackFn(); } +DISABLE_CFI_ICALL GLsync DebugGLApi::glFenceSyncFn(GLenum condition, GLbitfield flags) { GL_SERVICE_LOG("glFenceSync" << "(" << GLEnums::GetStringEnum(condition) << ", " << flags @@ -8943,6 +9840,7 @@ return result; } +DISABLE_CFI_ICALL void DebugGLApi::glFinishFn(void) { GL_SERVICE_LOG("glFinish" << "(" @@ -8950,18 +9848,21 @@ gl_api_->glFinishFn(); } +DISABLE_CFI_ICALL void DebugGLApi::glFinishFenceAPPLEFn(GLuint fence) { GL_SERVICE_LOG("glFinishFenceAPPLE" << "(" << fence << ")"); gl_api_->glFinishFenceAPPLEFn(fence); } +DISABLE_CFI_ICALL void DebugGLApi::glFinishFenceNVFn(GLuint fence) { GL_SERVICE_LOG("glFinishFenceNV" << "(" << fence << ")"); gl_api_->glFinishFenceNVFn(fence); } +DISABLE_CFI_ICALL void DebugGLApi::glFlushFn(void) { GL_SERVICE_LOG("glFlush" << "(" @@ -8969,6 +9870,7 @@ gl_api_->glFlushFn(); } +DISABLE_CFI_ICALL void DebugGLApi::glFlushMappedBufferRangeFn(GLenum target, GLintptr offset, GLsizeiptr length) { @@ -8978,6 +9880,7 @@ gl_api_->glFlushMappedBufferRangeFn(target, offset, length); } +DISABLE_CFI_ICALL void DebugGLApi::glFramebufferRenderbufferEXTFn(GLenum target, GLenum attachment, GLenum renderbuffertarget, @@ -8991,6 +9894,7 @@ renderbuffertarget, renderbuffer); } +DISABLE_CFI_ICALL void DebugGLApi::glFramebufferTexture2DEXTFn(GLenum target, GLenum attachment, GLenum textarget, @@ -9005,6 +9909,7 @@ level); } +DISABLE_CFI_ICALL void DebugGLApi::glFramebufferTexture2DMultisampleEXTFn(GLenum target, GLenum attachment, GLenum textarget, @@ -9020,6 +9925,7 @@ texture, level, samples); } +DISABLE_CFI_ICALL void DebugGLApi::glFramebufferTextureLayerFn(GLenum target, GLenum attachment, GLuint texture, @@ -9033,12 +9939,14 @@ layer); } +DISABLE_CFI_ICALL void DebugGLApi::glFrontFaceFn(GLenum mode) { GL_SERVICE_LOG("glFrontFace" << "(" << GLEnums::GetStringEnum(mode) << ")"); gl_api_->glFrontFaceFn(mode); } +DISABLE_CFI_ICALL void DebugGLApi::glGenBuffersARBFn(GLsizei n, GLuint* buffers) { GL_SERVICE_LOG("glGenBuffersARB" << "(" << n << ", " << static_cast<const void*>(buffers) @@ -9046,12 +9954,14 @@ gl_api_->glGenBuffersARBFn(n, buffers); } +DISABLE_CFI_ICALL void DebugGLApi::glGenerateMipmapEXTFn(GLenum target) { GL_SERVICE_LOG("glGenerateMipmapEXT" << "(" << GLEnums::GetStringEnum(target) << ")"); gl_api_->glGenerateMipmapEXTFn(target); } +DISABLE_CFI_ICALL void DebugGLApi::glGenFencesAPPLEFn(GLsizei n, GLuint* fences) { GL_SERVICE_LOG("glGenFencesAPPLE" << "(" << n << ", " << static_cast<const void*>(fences) @@ -9059,6 +9969,7 @@ gl_api_->glGenFencesAPPLEFn(n, fences); } +DISABLE_CFI_ICALL void DebugGLApi::glGenFencesNVFn(GLsizei n, GLuint* fences) { GL_SERVICE_LOG("glGenFencesNV" << "(" << n << ", " << static_cast<const void*>(fences) @@ -9066,6 +9977,7 @@ gl_api_->glGenFencesNVFn(n, fences); } +DISABLE_CFI_ICALL void DebugGLApi::glGenFramebuffersEXTFn(GLsizei n, GLuint* framebuffers) { GL_SERVICE_LOG("glGenFramebuffersEXT" << "(" << n << ", " << static_cast<const void*>(framebuffers) @@ -9073,6 +9985,7 @@ gl_api_->glGenFramebuffersEXTFn(n, framebuffers); } +DISABLE_CFI_ICALL GLuint DebugGLApi::glGenPathsNVFn(GLsizei range) { GL_SERVICE_LOG("glGenPathsNV" << "(" << range << ")"); @@ -9081,12 +9994,14 @@ return result; } +DISABLE_CFI_ICALL void DebugGLApi::glGenQueriesFn(GLsizei n, GLuint* ids) { GL_SERVICE_LOG("glGenQueries" << "(" << n << ", " << static_cast<const void*>(ids) << ")"); gl_api_->glGenQueriesFn(n, ids); } +DISABLE_CFI_ICALL void DebugGLApi::glGenRenderbuffersEXTFn(GLsizei n, GLuint* renderbuffers) { GL_SERVICE_LOG("glGenRenderbuffersEXT" << "(" << n << ", " << static_cast<const void*>(renderbuffers) @@ -9094,6 +10009,7 @@ gl_api_->glGenRenderbuffersEXTFn(n, renderbuffers); } +DISABLE_CFI_ICALL void DebugGLApi::glGenSamplersFn(GLsizei n, GLuint* samplers) { GL_SERVICE_LOG("glGenSamplers" << "(" << n << ", " << static_cast<const void*>(samplers) @@ -9101,6 +10017,7 @@ gl_api_->glGenSamplersFn(n, samplers); } +DISABLE_CFI_ICALL void DebugGLApi::glGenTexturesFn(GLsizei n, GLuint* textures) { GL_SERVICE_LOG("glGenTextures" << "(" << n << ", " << static_cast<const void*>(textures) @@ -9108,12 +10025,14 @@ gl_api_->glGenTexturesFn(n, textures); } +DISABLE_CFI_ICALL void DebugGLApi::glGenTransformFeedbacksFn(GLsizei n, GLuint* ids) { GL_SERVICE_LOG("glGenTransformFeedbacks" << "(" << n << ", " << static_cast<const void*>(ids) << ")"); gl_api_->glGenTransformFeedbacksFn(n, ids); } +DISABLE_CFI_ICALL void DebugGLApi::glGenVertexArraysOESFn(GLsizei n, GLuint* arrays) { GL_SERVICE_LOG("glGenVertexArraysOES" << "(" << n << ", " << static_cast<const void*>(arrays) @@ -9121,6 +10040,7 @@ gl_api_->glGenVertexArraysOESFn(n, arrays); } +DISABLE_CFI_ICALL void DebugGLApi::glGetActiveAttribFn(GLuint program, GLuint index, GLsizei bufsize, @@ -9138,6 +10058,7 @@ name); } +DISABLE_CFI_ICALL void DebugGLApi::glGetActiveUniformFn(GLuint program, GLuint index, GLsizei bufsize, @@ -9155,6 +10076,7 @@ name); } +DISABLE_CFI_ICALL void DebugGLApi::glGetActiveUniformBlockivFn(GLuint program, GLuint uniformBlockIndex, GLenum pname, @@ -9167,6 +10089,7 @@ params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetActiveUniformBlockivRobustANGLEFn( GLuint program, GLuint uniformBlockIndex, @@ -9183,6 +10106,7 @@ program, uniformBlockIndex, pname, bufSize, length, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetActiveUniformBlockNameFn(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, @@ -9196,6 +10120,7 @@ length, uniformBlockName); } +DISABLE_CFI_ICALL void DebugGLApi::glGetActiveUniformsivFn(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, @@ -9210,6 +10135,7 @@ params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetAttachedShadersFn(GLuint program, GLsizei maxcount, GLsizei* count, @@ -9221,6 +10147,7 @@ gl_api_->glGetAttachedShadersFn(program, maxcount, count, shaders); } +DISABLE_CFI_ICALL GLint DebugGLApi::glGetAttribLocationFn(GLuint program, const char* name) { GL_SERVICE_LOG("glGetAttribLocation" << "(" << program << ", " << name << ")"); @@ -9229,6 +10156,7 @@ return result; } +DISABLE_CFI_ICALL void DebugGLApi::glGetBooleani_vRobustANGLEFn(GLenum target, GLuint index, GLsizei bufSize, @@ -9241,6 +10169,7 @@ gl_api_->glGetBooleani_vRobustANGLEFn(target, index, bufSize, length, data); } +DISABLE_CFI_ICALL void DebugGLApi::glGetBooleanvFn(GLenum pname, GLboolean* params) { GL_SERVICE_LOG("glGetBooleanv" << "(" << GLEnums::GetStringEnum(pname) << ", " @@ -9248,6 +10177,7 @@ gl_api_->glGetBooleanvFn(pname, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetBooleanvRobustANGLEFn(GLenum pname, GLsizei bufSize, GLsizei* length, @@ -9259,6 +10189,7 @@ gl_api_->glGetBooleanvRobustANGLEFn(pname, bufSize, length, data); } +DISABLE_CFI_ICALL void DebugGLApi::glGetBufferParameteri64vRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -9273,6 +10204,7 @@ params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetBufferParameterivFn(GLenum target, GLenum pname, GLint* params) { @@ -9283,6 +10215,7 @@ gl_api_->glGetBufferParameterivFn(target, pname, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetBufferParameterivRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -9297,6 +10230,7 @@ params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetBufferPointervRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -9310,6 +10244,7 @@ params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetDebugMessageLogFn(GLuint count, GLsizei bufSize, GLenum* sources, @@ -9330,6 +10265,7 @@ severities, lengths, messageLog); } +DISABLE_CFI_ICALL GLenum DebugGLApi::glGetErrorFn(void) { GL_SERVICE_LOG("glGetError" << "(" @@ -9341,6 +10277,7 @@ return result; } +DISABLE_CFI_ICALL void DebugGLApi::glGetFenceivNVFn(GLuint fence, GLenum pname, GLint* params) { GL_SERVICE_LOG("glGetFenceivNV" << "(" << fence << ", " << GLEnums::GetStringEnum(pname) @@ -9348,6 +10285,7 @@ gl_api_->glGetFenceivNVFn(fence, pname, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetFloatvFn(GLenum pname, GLfloat* params) { GL_SERVICE_LOG("glGetFloatv" << "(" << GLEnums::GetStringEnum(pname) << ", " @@ -9355,6 +10293,7 @@ gl_api_->glGetFloatvFn(pname, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetFloatvRobustANGLEFn(GLenum pname, GLsizei bufSize, GLsizei* length, @@ -9366,6 +10305,7 @@ gl_api_->glGetFloatvRobustANGLEFn(pname, bufSize, length, data); } +DISABLE_CFI_ICALL GLint DebugGLApi::glGetFragDataIndexFn(GLuint program, const char* name) { GL_SERVICE_LOG("glGetFragDataIndex" << "(" << program << ", " << name << ")"); @@ -9374,6 +10314,7 @@ return result; } +DISABLE_CFI_ICALL GLint DebugGLApi::glGetFragDataLocationFn(GLuint program, const char* name) { GL_SERVICE_LOG("glGetFragDataLocation" << "(" << program << ", " << name << ")"); @@ -9382,6 +10323,7 @@ return result; } +DISABLE_CFI_ICALL void DebugGLApi::glGetFramebufferAttachmentParameterivEXTFn(GLenum target, GLenum attachment, GLenum pname, @@ -9395,6 +10337,7 @@ params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetFramebufferAttachmentParameterivRobustANGLEFn( GLenum target, GLenum attachment, @@ -9412,6 +10355,7 @@ target, attachment, pname, bufSize, length, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetFramebufferParameterivRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -9426,6 +10370,7 @@ length, params); } +DISABLE_CFI_ICALL GLenum DebugGLApi::glGetGraphicsResetStatusARBFn(void) { GL_SERVICE_LOG("glGetGraphicsResetStatusARB" << "(" @@ -9435,6 +10380,7 @@ return result; } +DISABLE_CFI_ICALL void DebugGLApi::glGetInteger64i_vFn(GLenum target, GLuint index, GLint64* data) { @@ -9444,6 +10390,7 @@ gl_api_->glGetInteger64i_vFn(target, index, data); } +DISABLE_CFI_ICALL void DebugGLApi::glGetInteger64i_vRobustANGLEFn(GLenum target, GLuint index, GLsizei bufSize, @@ -9456,6 +10403,7 @@ gl_api_->glGetInteger64i_vRobustANGLEFn(target, index, bufSize, length, data); } +DISABLE_CFI_ICALL void DebugGLApi::glGetInteger64vFn(GLenum pname, GLint64* params) { GL_SERVICE_LOG("glGetInteger64v" << "(" << GLEnums::GetStringEnum(pname) << ", " @@ -9463,6 +10411,7 @@ gl_api_->glGetInteger64vFn(pname, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetInteger64vRobustANGLEFn(GLenum pname, GLsizei bufSize, GLsizei* length, @@ -9474,6 +10423,7 @@ gl_api_->glGetInteger64vRobustANGLEFn(pname, bufSize, length, data); } +DISABLE_CFI_ICALL void DebugGLApi::glGetIntegeri_vFn(GLenum target, GLuint index, GLint* data) { GL_SERVICE_LOG("glGetIntegeri_v" << "(" << GLEnums::GetStringEnum(target) << ", " << index @@ -9481,6 +10431,7 @@ gl_api_->glGetIntegeri_vFn(target, index, data); } +DISABLE_CFI_ICALL void DebugGLApi::glGetIntegeri_vRobustANGLEFn(GLenum target, GLuint index, GLsizei bufSize, @@ -9493,6 +10444,7 @@ gl_api_->glGetIntegeri_vRobustANGLEFn(target, index, bufSize, length, data); } +DISABLE_CFI_ICALL void DebugGLApi::glGetIntegervFn(GLenum pname, GLint* params) { GL_SERVICE_LOG("glGetIntegerv" << "(" << GLEnums::GetStringEnum(pname) << ", " @@ -9500,6 +10452,7 @@ gl_api_->glGetIntegervFn(pname, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetIntegervRobustANGLEFn(GLenum pname, GLsizei bufSize, GLsizei* length, @@ -9511,6 +10464,7 @@ gl_api_->glGetIntegervRobustANGLEFn(pname, bufSize, length, data); } +DISABLE_CFI_ICALL void DebugGLApi::glGetInternalformativFn(GLenum target, GLenum internalformat, GLenum pname, @@ -9525,6 +10479,7 @@ params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetInternalformativRobustANGLEFn(GLenum target, GLenum internalformat, GLenum pname, @@ -9541,6 +10496,7 @@ bufSize, length, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetMultisamplefvFn(GLenum pname, GLuint index, GLfloat* val) { @@ -9550,6 +10506,7 @@ gl_api_->glGetMultisamplefvFn(pname, index, val); } +DISABLE_CFI_ICALL void DebugGLApi::glGetMultisamplefvRobustANGLEFn(GLenum pname, GLuint index, GLsizei bufSize, @@ -9562,6 +10519,7 @@ gl_api_->glGetMultisamplefvRobustANGLEFn(pname, index, bufSize, length, val); } +DISABLE_CFI_ICALL void DebugGLApi::glGetnUniformfvRobustANGLEFn(GLuint program, GLint location, GLsizei bufSize, @@ -9575,6 +10533,7 @@ params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetnUniformivRobustANGLEFn(GLuint program, GLint location, GLsizei bufSize, @@ -9588,6 +10547,7 @@ params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetnUniformuivRobustANGLEFn(GLuint program, GLint location, GLsizei bufSize, @@ -9601,6 +10561,7 @@ params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetObjectLabelFn(GLenum identifier, GLuint name, GLsizei bufSize, @@ -9613,6 +10574,7 @@ gl_api_->glGetObjectLabelFn(identifier, name, bufSize, length, label); } +DISABLE_CFI_ICALL void DebugGLApi::glGetObjectPtrLabelFn(void* ptr, GLsizei bufSize, GLsizei* length, @@ -9624,6 +10586,7 @@ gl_api_->glGetObjectPtrLabelFn(ptr, bufSize, length, label); } +DISABLE_CFI_ICALL void DebugGLApi::glGetPointervFn(GLenum pname, void** params) { GL_SERVICE_LOG("glGetPointerv" << "(" << GLEnums::GetStringEnum(pname) << ", " << params @@ -9631,6 +10594,7 @@ gl_api_->glGetPointervFn(pname, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetPointervRobustANGLERobustANGLEFn(GLenum pname, GLsizei bufSize, GLsizei* length, @@ -9643,6 +10607,7 @@ params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetProgramBinaryFn(GLuint program, GLsizei bufSize, GLsizei* length, @@ -9656,6 +10621,7 @@ gl_api_->glGetProgramBinaryFn(program, bufSize, length, binaryFormat, binary); } +DISABLE_CFI_ICALL void DebugGLApi::glGetProgramInfoLogFn(GLuint program, GLsizei bufsize, GLsizei* length, @@ -9667,6 +10633,7 @@ gl_api_->glGetProgramInfoLogFn(program, bufsize, length, infolog); } +DISABLE_CFI_ICALL void DebugGLApi::glGetProgramInterfaceivFn(GLuint program, GLenum programInterface, GLenum pname, @@ -9679,6 +10646,7 @@ gl_api_->glGetProgramInterfaceivFn(program, programInterface, pname, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetProgramInterfaceivRobustANGLEFn(GLuint program, GLenum programInterface, GLenum pname, @@ -9695,6 +10663,7 @@ pname, bufSize, length, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetProgramivFn(GLuint program, GLenum pname, GLint* params) { GL_SERVICE_LOG("glGetProgramiv" << "(" << program << ", " << GLEnums::GetStringEnum(pname) @@ -9702,6 +10671,7 @@ gl_api_->glGetProgramivFn(program, pname, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetProgramivRobustANGLEFn(GLuint program, GLenum pname, GLsizei bufSize, @@ -9714,6 +10684,7 @@ gl_api_->glGetProgramivRobustANGLEFn(program, pname, bufSize, length, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetProgramResourceivFn(GLuint program, GLenum programInterface, GLuint index, @@ -9732,6 +10703,7 @@ props, bufSize, length, params); } +DISABLE_CFI_ICALL GLint DebugGLApi::glGetProgramResourceLocationFn(GLuint program, GLenum programInterface, const char* name) { @@ -9745,6 +10717,7 @@ return result; } +DISABLE_CFI_ICALL void DebugGLApi::glGetProgramResourceNameFn(GLuint program, GLenum programInterface, GLuint index, @@ -9760,6 +10733,7 @@ length, name); } +DISABLE_CFI_ICALL void DebugGLApi::glGetQueryivFn(GLenum target, GLenum pname, GLint* params) { GL_SERVICE_LOG("glGetQueryiv" << "(" << GLEnums::GetStringEnum(target) << ", " @@ -9768,6 +10742,7 @@ gl_api_->glGetQueryivFn(target, pname, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetQueryivRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -9781,6 +10756,7 @@ gl_api_->glGetQueryivRobustANGLEFn(target, pname, bufSize, length, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetQueryObjecti64vFn(GLuint id, GLenum pname, GLint64* params) { @@ -9790,6 +10766,7 @@ gl_api_->glGetQueryObjecti64vFn(id, pname, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetQueryObjecti64vRobustANGLEFn(GLuint id, GLenum pname, GLsizei bufSize, @@ -9803,6 +10780,7 @@ params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetQueryObjectivFn(GLuint id, GLenum pname, GLint* params) { GL_SERVICE_LOG("glGetQueryObjectiv" << "(" << id << ", " << GLEnums::GetStringEnum(pname) << ", " @@ -9810,6 +10788,7 @@ gl_api_->glGetQueryObjectivFn(id, pname, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetQueryObjectivRobustANGLEFn(GLuint id, GLenum pname, GLsizei bufSize, @@ -9822,6 +10801,7 @@ gl_api_->glGetQueryObjectivRobustANGLEFn(id, pname, bufSize, length, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetQueryObjectui64vFn(GLuint id, GLenum pname, GLuint64* params) { @@ -9831,6 +10811,7 @@ gl_api_->glGetQueryObjectui64vFn(id, pname, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetQueryObjectui64vRobustANGLEFn(GLuint id, GLenum pname, GLsizei bufSize, @@ -9844,6 +10825,7 @@ params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetQueryObjectuivFn(GLuint id, GLenum pname, GLuint* params) { @@ -9853,6 +10835,7 @@ gl_api_->glGetQueryObjectuivFn(id, pname, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetQueryObjectuivRobustANGLEFn(GLuint id, GLenum pname, GLsizei bufSize, @@ -9865,6 +10848,7 @@ gl_api_->glGetQueryObjectuivRobustANGLEFn(id, pname, bufSize, length, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetRenderbufferParameterivEXTFn(GLenum target, GLenum pname, GLint* params) { @@ -9875,6 +10859,7 @@ gl_api_->glGetRenderbufferParameterivEXTFn(target, pname, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetRenderbufferParameterivRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -9889,6 +10874,7 @@ length, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetSamplerParameterfvFn(GLuint sampler, GLenum pname, GLfloat* params) { @@ -9898,6 +10884,7 @@ gl_api_->glGetSamplerParameterfvFn(sampler, pname, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetSamplerParameterfvRobustANGLEFn(GLuint sampler, GLenum pname, GLsizei bufSize, @@ -9911,6 +10898,7 @@ params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetSamplerParameterIivRobustANGLEFn(GLuint sampler, GLenum pname, GLsizei bufSize, @@ -9924,6 +10912,7 @@ length, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetSamplerParameterIuivRobustANGLEFn(GLuint sampler, GLenum pname, GLsizei bufSize, @@ -9937,6 +10926,7 @@ length, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetSamplerParameterivFn(GLuint sampler, GLenum pname, GLint* params) { @@ -9946,6 +10936,7 @@ gl_api_->glGetSamplerParameterivFn(sampler, pname, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetSamplerParameterivRobustANGLEFn(GLuint sampler, GLenum pname, GLsizei bufSize, @@ -9959,6 +10950,7 @@ params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetShaderInfoLogFn(GLuint shader, GLsizei bufsize, GLsizei* length, @@ -9970,6 +10962,7 @@ gl_api_->glGetShaderInfoLogFn(shader, bufsize, length, infolog); } +DISABLE_CFI_ICALL void DebugGLApi::glGetShaderivFn(GLuint shader, GLenum pname, GLint* params) { GL_SERVICE_LOG("glGetShaderiv" << "(" << shader << ", " << GLEnums::GetStringEnum(pname) @@ -9977,6 +10970,7 @@ gl_api_->glGetShaderivFn(shader, pname, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetShaderivRobustANGLEFn(GLuint shader, GLenum pname, GLsizei bufSize, @@ -9989,6 +10983,7 @@ gl_api_->glGetShaderivRobustANGLEFn(shader, pname, bufSize, length, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetShaderPrecisionFormatFn(GLenum shadertype, GLenum precisiontype, GLint* range, @@ -10002,6 +10997,7 @@ precision); } +DISABLE_CFI_ICALL void DebugGLApi::glGetShaderSourceFn(GLuint shader, GLsizei bufsize, GLsizei* length, @@ -10013,6 +11009,7 @@ gl_api_->glGetShaderSourceFn(shader, bufsize, length, source); } +DISABLE_CFI_ICALL const GLubyte* DebugGLApi::glGetStringFn(GLenum name) { GL_SERVICE_LOG("glGetString" << "(" << GLEnums::GetStringEnum(name) << ")"); @@ -10021,6 +11018,7 @@ return result; } +DISABLE_CFI_ICALL const GLubyte* DebugGLApi::glGetStringiFn(GLenum name, GLuint index) { GL_SERVICE_LOG("glGetStringi" << "(" << GLEnums::GetStringEnum(name) << ", " << index @@ -10030,6 +11028,7 @@ return result; } +DISABLE_CFI_ICALL void DebugGLApi::glGetSyncivFn(GLsync sync, GLenum pname, GLsizei bufSize, @@ -10042,6 +11041,7 @@ gl_api_->glGetSyncivFn(sync, pname, bufSize, length, values); } +DISABLE_CFI_ICALL void DebugGLApi::glGetTexLevelParameterfvFn(GLenum target, GLint level, GLenum pname, @@ -10053,6 +11053,7 @@ gl_api_->glGetTexLevelParameterfvFn(target, level, pname, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetTexLevelParameterfvRobustANGLEFn(GLenum target, GLint level, GLenum pname, @@ -10068,6 +11069,7 @@ length, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetTexLevelParameterivFn(GLenum target, GLint level, GLenum pname, @@ -10079,6 +11081,7 @@ gl_api_->glGetTexLevelParameterivFn(target, level, pname, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetTexLevelParameterivRobustANGLEFn(GLenum target, GLint level, GLenum pname, @@ -10094,6 +11097,7 @@ length, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetTexParameterfvFn(GLenum target, GLenum pname, GLfloat* params) { @@ -10104,6 +11108,7 @@ gl_api_->glGetTexParameterfvFn(target, pname, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetTexParameterfvRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -10118,6 +11123,7 @@ params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetTexParameterIivRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -10132,6 +11138,7 @@ params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetTexParameterIuivRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -10146,6 +11153,7 @@ params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetTexParameterivFn(GLenum target, GLenum pname, GLint* params) { @@ -10156,6 +11164,7 @@ gl_api_->glGetTexParameterivFn(target, pname, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetTexParameterivRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -10170,6 +11179,7 @@ params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetTransformFeedbackVaryingFn(GLuint program, GLuint index, GLsizei bufSize, @@ -10187,6 +11197,7 @@ size, type, name); } +DISABLE_CFI_ICALL void DebugGLApi::glGetTranslatedShaderSourceANGLEFn(GLuint shader, GLsizei bufsize, GLsizei* length, @@ -10198,6 +11209,7 @@ gl_api_->glGetTranslatedShaderSourceANGLEFn(shader, bufsize, length, source); } +DISABLE_CFI_ICALL GLuint DebugGLApi::glGetUniformBlockIndexFn(GLuint program, const char* uniformBlockName) { GL_SERVICE_LOG("glGetUniformBlockIndex" @@ -10207,6 +11219,7 @@ return result; } +DISABLE_CFI_ICALL void DebugGLApi::glGetUniformfvFn(GLuint program, GLint location, GLfloat* params) { @@ -10216,6 +11229,7 @@ gl_api_->glGetUniformfvFn(program, location, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetUniformfvRobustANGLEFn(GLuint program, GLint location, GLsizei bufSize, @@ -10229,6 +11243,7 @@ params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetUniformIndicesFn(GLuint program, GLsizei uniformCount, const char* const* uniformNames, @@ -10241,6 +11256,7 @@ uniformIndices); } +DISABLE_CFI_ICALL void DebugGLApi::glGetUniformivFn(GLuint program, GLint location, GLint* params) { @@ -10250,6 +11266,7 @@ gl_api_->glGetUniformivFn(program, location, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetUniformivRobustANGLEFn(GLuint program, GLint location, GLsizei bufSize, @@ -10263,6 +11280,7 @@ params); } +DISABLE_CFI_ICALL GLint DebugGLApi::glGetUniformLocationFn(GLuint program, const char* name) { GL_SERVICE_LOG("glGetUniformLocation" << "(" << program << ", " << name << ")"); @@ -10271,6 +11289,7 @@ return result; } +DISABLE_CFI_ICALL void DebugGLApi::glGetUniformuivFn(GLuint program, GLint location, GLuint* params) { @@ -10280,6 +11299,7 @@ gl_api_->glGetUniformuivFn(program, location, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetUniformuivRobustANGLEFn(GLuint program, GLint location, GLsizei bufSize, @@ -10293,6 +11313,7 @@ params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetVertexAttribfvFn(GLuint index, GLenum pname, GLfloat* params) { @@ -10302,6 +11323,7 @@ gl_api_->glGetVertexAttribfvFn(index, pname, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetVertexAttribfvRobustANGLEFn(GLuint index, GLenum pname, GLsizei bufSize, @@ -10315,6 +11337,7 @@ params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetVertexAttribIivRobustANGLEFn(GLuint index, GLenum pname, GLsizei bufSize, @@ -10328,6 +11351,7 @@ params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetVertexAttribIuivRobustANGLEFn(GLuint index, GLenum pname, GLsizei bufSize, @@ -10341,6 +11365,7 @@ params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetVertexAttribivFn(GLuint index, GLenum pname, GLint* params) { @@ -10350,6 +11375,7 @@ gl_api_->glGetVertexAttribivFn(index, pname, params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetVertexAttribivRobustANGLEFn(GLuint index, GLenum pname, GLsizei bufSize, @@ -10363,6 +11389,7 @@ params); } +DISABLE_CFI_ICALL void DebugGLApi::glGetVertexAttribPointervFn(GLuint index, GLenum pname, void** pointer) { @@ -10372,6 +11399,7 @@ gl_api_->glGetVertexAttribPointervFn(index, pname, pointer); } +DISABLE_CFI_ICALL void DebugGLApi::glGetVertexAttribPointervRobustANGLEFn(GLuint index, GLenum pname, GLsizei bufSize, @@ -10385,6 +11413,7 @@ pointer); } +DISABLE_CFI_ICALL void DebugGLApi::glHintFn(GLenum target, GLenum mode) { GL_SERVICE_LOG("glHint" << "(" << GLEnums::GetStringEnum(target) << ", " @@ -10392,12 +11421,14 @@ gl_api_->glHintFn(target, mode); } +DISABLE_CFI_ICALL void DebugGLApi::glInsertEventMarkerEXTFn(GLsizei length, const char* marker) { GL_SERVICE_LOG("glInsertEventMarkerEXT" << "(" << length << ", " << marker << ")"); gl_api_->glInsertEventMarkerEXTFn(length, marker); } +DISABLE_CFI_ICALL void DebugGLApi::glInvalidateFramebufferFn(GLenum target, GLsizei numAttachments, const GLenum* attachments) { @@ -10408,6 +11439,7 @@ gl_api_->glInvalidateFramebufferFn(target, numAttachments, attachments); } +DISABLE_CFI_ICALL void DebugGLApi::glInvalidateSubFramebufferFn(GLenum target, GLsizei numAttachments, const GLenum* attachments, @@ -10424,6 +11456,7 @@ y, width, height); } +DISABLE_CFI_ICALL GLboolean DebugGLApi::glIsBufferFn(GLuint buffer) { GL_SERVICE_LOG("glIsBuffer" << "(" << buffer << ")"); @@ -10432,6 +11465,7 @@ return result; } +DISABLE_CFI_ICALL GLboolean DebugGLApi::glIsEnabledFn(GLenum cap) { GL_SERVICE_LOG("glIsEnabled" << "(" << GLEnums::GetStringEnum(cap) << ")"); @@ -10440,6 +11474,7 @@ return result; } +DISABLE_CFI_ICALL GLboolean DebugGLApi::glIsFenceAPPLEFn(GLuint fence) { GL_SERVICE_LOG("glIsFenceAPPLE" << "(" << fence << ")"); @@ -10448,6 +11483,7 @@ return result; } +DISABLE_CFI_ICALL GLboolean DebugGLApi::glIsFenceNVFn(GLuint fence) { GL_SERVICE_LOG("glIsFenceNV" << "(" << fence << ")"); @@ -10456,6 +11492,7 @@ return result; } +DISABLE_CFI_ICALL GLboolean DebugGLApi::glIsFramebufferEXTFn(GLuint framebuffer) { GL_SERVICE_LOG("glIsFramebufferEXT" << "(" << framebuffer << ")"); @@ -10464,6 +11501,7 @@ return result; } +DISABLE_CFI_ICALL GLboolean DebugGLApi::glIsPathNVFn(GLuint path) { GL_SERVICE_LOG("glIsPathNV" << "(" << path << ")"); @@ -10472,6 +11510,7 @@ return result; } +DISABLE_CFI_ICALL GLboolean DebugGLApi::glIsProgramFn(GLuint program) { GL_SERVICE_LOG("glIsProgram" << "(" << program << ")"); @@ -10480,6 +11519,7 @@ return result; } +DISABLE_CFI_ICALL GLboolean DebugGLApi::glIsQueryFn(GLuint query) { GL_SERVICE_LOG("glIsQuery" << "(" << query << ")"); @@ -10488,6 +11528,7 @@ return result; } +DISABLE_CFI_ICALL GLboolean DebugGLApi::glIsRenderbufferEXTFn(GLuint renderbuffer) { GL_SERVICE_LOG("glIsRenderbufferEXT" << "(" << renderbuffer << ")"); @@ -10496,6 +11537,7 @@ return result; } +DISABLE_CFI_ICALL GLboolean DebugGLApi::glIsSamplerFn(GLuint sampler) { GL_SERVICE_LOG("glIsSampler" << "(" << sampler << ")"); @@ -10504,6 +11546,7 @@ return result; } +DISABLE_CFI_ICALL GLboolean DebugGLApi::glIsShaderFn(GLuint shader) { GL_SERVICE_LOG("glIsShader" << "(" << shader << ")"); @@ -10512,6 +11555,7 @@ return result; } +DISABLE_CFI_ICALL GLboolean DebugGLApi::glIsSyncFn(GLsync sync) { GL_SERVICE_LOG("glIsSync" << "(" << sync << ")"); @@ -10520,6 +11564,7 @@ return result; } +DISABLE_CFI_ICALL GLboolean DebugGLApi::glIsTextureFn(GLuint texture) { GL_SERVICE_LOG("glIsTexture" << "(" << texture << ")"); @@ -10528,6 +11573,7 @@ return result; } +DISABLE_CFI_ICALL GLboolean DebugGLApi::glIsTransformFeedbackFn(GLuint id) { GL_SERVICE_LOG("glIsTransformFeedback" << "(" << id << ")"); @@ -10536,6 +11582,7 @@ return result; } +DISABLE_CFI_ICALL GLboolean DebugGLApi::glIsVertexArrayOESFn(GLuint array) { GL_SERVICE_LOG("glIsVertexArrayOES" << "(" << array << ")"); @@ -10544,18 +11591,21 @@ return result; } +DISABLE_CFI_ICALL void DebugGLApi::glLineWidthFn(GLfloat width) { GL_SERVICE_LOG("glLineWidth" << "(" << width << ")"); gl_api_->glLineWidthFn(width); } +DISABLE_CFI_ICALL void DebugGLApi::glLinkProgramFn(GLuint program) { GL_SERVICE_LOG("glLinkProgram" << "(" << program << ")"); gl_api_->glLinkProgramFn(program); } +DISABLE_CFI_ICALL void* DebugGLApi::glMapBufferFn(GLenum target, GLenum access) { GL_SERVICE_LOG("glMapBuffer" << "(" << GLEnums::GetStringEnum(target) << ", " @@ -10565,6 +11615,7 @@ return result; } +DISABLE_CFI_ICALL void* DebugGLApi::glMapBufferRangeFn(GLenum target, GLintptr offset, GLsizeiptr length, @@ -10577,6 +11628,7 @@ return result; } +DISABLE_CFI_ICALL void DebugGLApi::glMatrixLoadfEXTFn(GLenum matrixMode, const GLfloat* m) { GL_SERVICE_LOG("glMatrixLoadfEXT" << "(" << GLEnums::GetStringEnum(matrixMode) << ", " @@ -10584,18 +11636,21 @@ gl_api_->glMatrixLoadfEXTFn(matrixMode, m); } +DISABLE_CFI_ICALL void DebugGLApi::glMatrixLoadIdentityEXTFn(GLenum matrixMode) { GL_SERVICE_LOG("glMatrixLoadIdentityEXT" << "(" << GLEnums::GetStringEnum(matrixMode) << ")"); gl_api_->glMatrixLoadIdentityEXTFn(matrixMode); } +DISABLE_CFI_ICALL void DebugGLApi::glMemoryBarrierEXTFn(GLbitfield barriers) { GL_SERVICE_LOG("glMemoryBarrierEXT" << "(" << barriers << ")"); gl_api_->glMemoryBarrierEXTFn(barriers); } +DISABLE_CFI_ICALL void DebugGLApi::glObjectLabelFn(GLenum identifier, GLuint name, GLsizei length, @@ -10606,6 +11661,7 @@ gl_api_->glObjectLabelFn(identifier, name, length, label); } +DISABLE_CFI_ICALL void DebugGLApi::glObjectPtrLabelFn(void* ptr, GLsizei length, const char* label) { @@ -10615,6 +11671,7 @@ gl_api_->glObjectPtrLabelFn(ptr, length, label); } +DISABLE_CFI_ICALL void DebugGLApi::glPathCommandsNVFn(GLuint path, GLsizei numCommands, const GLubyte* commands, @@ -10630,6 +11687,7 @@ coords); } +DISABLE_CFI_ICALL void DebugGLApi::glPathParameterfNVFn(GLuint path, GLenum pname, GLfloat value) { @@ -10639,6 +11697,7 @@ gl_api_->glPathParameterfNVFn(path, pname, value); } +DISABLE_CFI_ICALL void DebugGLApi::glPathParameteriNVFn(GLuint path, GLenum pname, GLint value) { GL_SERVICE_LOG("glPathParameteriNV" << "(" << path << ", " << GLEnums::GetStringEnum(pname) << ", " @@ -10646,6 +11705,7 @@ gl_api_->glPathParameteriNVFn(path, pname, value); } +DISABLE_CFI_ICALL void DebugGLApi::glPathStencilFuncNVFn(GLenum func, GLint ref, GLuint mask) { GL_SERVICE_LOG("glPathStencilFuncNV" << "(" << GLEnums::GetStringEnum(func) << ", " << ref << ", " @@ -10653,6 +11713,7 @@ gl_api_->glPathStencilFuncNVFn(func, ref, mask); } +DISABLE_CFI_ICALL void DebugGLApi::glPauseTransformFeedbackFn(void) { GL_SERVICE_LOG("glPauseTransformFeedback" << "(" @@ -10660,6 +11721,7 @@ gl_api_->glPauseTransformFeedbackFn(); } +DISABLE_CFI_ICALL void DebugGLApi::glPixelStoreiFn(GLenum pname, GLint param) { GL_SERVICE_LOG("glPixelStorei" << "(" << GLEnums::GetStringEnum(pname) << ", " << param @@ -10667,6 +11729,7 @@ gl_api_->glPixelStoreiFn(pname, param); } +DISABLE_CFI_ICALL void DebugGLApi::glPointParameteriFn(GLenum pname, GLint param) { GL_SERVICE_LOG("glPointParameteri" << "(" << GLEnums::GetStringEnum(pname) << ", " << param @@ -10674,6 +11737,7 @@ gl_api_->glPointParameteriFn(pname, param); } +DISABLE_CFI_ICALL void DebugGLApi::glPolygonModeFn(GLenum face, GLenum mode) { GL_SERVICE_LOG("glPolygonMode" << "(" << GLEnums::GetStringEnum(face) << ", " @@ -10681,12 +11745,14 @@ gl_api_->glPolygonModeFn(face, mode); } +DISABLE_CFI_ICALL void DebugGLApi::glPolygonOffsetFn(GLfloat factor, GLfloat units) { GL_SERVICE_LOG("glPolygonOffset" << "(" << factor << ", " << units << ")"); gl_api_->glPolygonOffsetFn(factor, units); } +DISABLE_CFI_ICALL void DebugGLApi::glPopDebugGroupFn() { GL_SERVICE_LOG("glPopDebugGroup" << "(" @@ -10694,6 +11760,7 @@ gl_api_->glPopDebugGroupFn(); } +DISABLE_CFI_ICALL void DebugGLApi::glPopGroupMarkerEXTFn(void) { GL_SERVICE_LOG("glPopGroupMarkerEXT" << "(" @@ -10701,12 +11768,14 @@ gl_api_->glPopGroupMarkerEXTFn(); } +DISABLE_CFI_ICALL void DebugGLApi::glPrimitiveRestartIndexFn(GLuint index) { GL_SERVICE_LOG("glPrimitiveRestartIndex" << "(" << index << ")"); gl_api_->glPrimitiveRestartIndexFn(index); } +DISABLE_CFI_ICALL void DebugGLApi::glProgramBinaryFn(GLuint program, GLenum binaryFormat, const GLvoid* binary, @@ -10718,6 +11787,7 @@ gl_api_->glProgramBinaryFn(program, binaryFormat, binary, length); } +DISABLE_CFI_ICALL void DebugGLApi::glProgramParameteriFn(GLuint program, GLenum pname, GLint value) { @@ -10727,6 +11797,7 @@ gl_api_->glProgramParameteriFn(program, pname, value); } +DISABLE_CFI_ICALL void DebugGLApi::glProgramPathFragmentInputGenNVFn(GLuint program, GLint location, GLenum genMode, @@ -10740,6 +11811,7 @@ components, coeffs); } +DISABLE_CFI_ICALL void DebugGLApi::glPushDebugGroupFn(GLenum source, GLuint id, GLsizei length, @@ -10750,24 +11822,28 @@ gl_api_->glPushDebugGroupFn(source, id, length, message); } +DISABLE_CFI_ICALL void DebugGLApi::glPushGroupMarkerEXTFn(GLsizei length, const char* marker) { GL_SERVICE_LOG("glPushGroupMarkerEXT" << "(" << length << ", " << marker << ")"); gl_api_->glPushGroupMarkerEXTFn(length, marker); } +DISABLE_CFI_ICALL void DebugGLApi::glQueryCounterFn(GLuint id, GLenum target) { GL_SERVICE_LOG("glQueryCounter" << "(" << id << ", " << GLEnums::GetStringEnum(target) << ")"); gl_api_->glQueryCounterFn(id, target); } +DISABLE_CFI_ICALL void DebugGLApi::glReadBufferFn(GLenum src) { GL_SERVICE_LOG("glReadBuffer" << "(" << GLEnums::GetStringEnum(src) << ")"); gl_api_->glReadBufferFn(src); } +DISABLE_CFI_ICALL void DebugGLApi::glReadnPixelsRobustANGLEFn(GLint x, GLint y, GLsizei width, @@ -10791,6 +11867,7 @@ bufSize, length, columns, rows, data); } +DISABLE_CFI_ICALL void DebugGLApi::glReadPixelsFn(GLint x, GLint y, GLsizei width, @@ -10806,6 +11883,7 @@ gl_api_->glReadPixelsFn(x, y, width, height, format, type, pixels); } +DISABLE_CFI_ICALL void DebugGLApi::glReadPixelsRobustANGLEFn(GLint x, GLint y, GLsizei width, @@ -10829,6 +11907,7 @@ length, columns, rows, pixels); } +DISABLE_CFI_ICALL void DebugGLApi::glReleaseShaderCompilerFn(void) { GL_SERVICE_LOG("glReleaseShaderCompiler" << "(" @@ -10836,6 +11915,7 @@ gl_api_->glReleaseShaderCompilerFn(); } +DISABLE_CFI_ICALL void DebugGLApi::glRenderbufferStorageEXTFn(GLenum target, GLenum internalformat, GLsizei width, @@ -10847,6 +11927,7 @@ gl_api_->glRenderbufferStorageEXTFn(target, internalformat, width, height); } +DISABLE_CFI_ICALL void DebugGLApi::glRenderbufferStorageMultisampleFn(GLenum target, GLsizei samples, GLenum internalformat, @@ -10860,6 +11941,7 @@ width, height); } +DISABLE_CFI_ICALL void DebugGLApi::glRenderbufferStorageMultisampleEXTFn(GLenum target, GLsizei samples, GLenum internalformat, @@ -10873,12 +11955,14 @@ internalformat, width, height); } +DISABLE_CFI_ICALL void DebugGLApi::glRequestExtensionANGLEFn(const char* name) { GL_SERVICE_LOG("glRequestExtensionANGLE" << "(" << name << ")"); gl_api_->glRequestExtensionANGLEFn(name); } +DISABLE_CFI_ICALL void DebugGLApi::glResumeTransformFeedbackFn(void) { GL_SERVICE_LOG("glResumeTransformFeedback" << "(" @@ -10886,6 +11970,7 @@ gl_api_->glResumeTransformFeedbackFn(); } +DISABLE_CFI_ICALL void DebugGLApi::glSampleCoverageFn(GLclampf value, GLboolean invert) { GL_SERVICE_LOG("glSampleCoverage" << "(" << value << ", " << GLEnums::GetStringBool(invert) @@ -10893,6 +11978,7 @@ gl_api_->glSampleCoverageFn(value, invert); } +DISABLE_CFI_ICALL void DebugGLApi::glSamplerParameterfFn(GLuint sampler, GLenum pname, GLfloat param) { @@ -10902,6 +11988,7 @@ gl_api_->glSamplerParameterfFn(sampler, pname, param); } +DISABLE_CFI_ICALL void DebugGLApi::glSamplerParameterfvFn(GLuint sampler, GLenum pname, const GLfloat* params) { @@ -10911,6 +11998,7 @@ gl_api_->glSamplerParameterfvFn(sampler, pname, params); } +DISABLE_CFI_ICALL void DebugGLApi::glSamplerParameterfvRobustANGLEFn(GLuint sampler, GLenum pname, GLsizei bufSize, @@ -10922,6 +12010,7 @@ gl_api_->glSamplerParameterfvRobustANGLEFn(sampler, pname, bufSize, param); } +DISABLE_CFI_ICALL void DebugGLApi::glSamplerParameteriFn(GLuint sampler, GLenum pname, GLint param) { @@ -10931,6 +12020,7 @@ gl_api_->glSamplerParameteriFn(sampler, pname, param); } +DISABLE_CFI_ICALL void DebugGLApi::glSamplerParameterIivRobustANGLEFn(GLuint sampler, GLenum pname, GLsizei bufSize, @@ -10942,6 +12032,7 @@ gl_api_->glSamplerParameterIivRobustANGLEFn(sampler, pname, bufSize, param); } +DISABLE_CFI_ICALL void DebugGLApi::glSamplerParameterIuivRobustANGLEFn(GLuint sampler, GLenum pname, GLsizei bufSize, @@ -10953,6 +12044,7 @@ gl_api_->glSamplerParameterIuivRobustANGLEFn(sampler, pname, bufSize, param); } +DISABLE_CFI_ICALL void DebugGLApi::glSamplerParameterivFn(GLuint sampler, GLenum pname, const GLint* params) { @@ -10962,6 +12054,7 @@ gl_api_->glSamplerParameterivFn(sampler, pname, params); } +DISABLE_CFI_ICALL void DebugGLApi::glSamplerParameterivRobustANGLEFn(GLuint sampler, GLenum pname, GLsizei bufSize, @@ -10973,6 +12066,7 @@ gl_api_->glSamplerParameterivRobustANGLEFn(sampler, pname, bufSize, param); } +DISABLE_CFI_ICALL void DebugGLApi::glScissorFn(GLint x, GLint y, GLsizei width, GLsizei height) { GL_SERVICE_LOG("glScissor" << "(" << x << ", " << y << ", " << width << ", " << height @@ -10980,12 +12074,14 @@ gl_api_->glScissorFn(x, y, width, height); } +DISABLE_CFI_ICALL void DebugGLApi::glSetFenceAPPLEFn(GLuint fence) { GL_SERVICE_LOG("glSetFenceAPPLE" << "(" << fence << ")"); gl_api_->glSetFenceAPPLEFn(fence); } +DISABLE_CFI_ICALL void DebugGLApi::glSetFenceNVFn(GLuint fence, GLenum condition) { GL_SERVICE_LOG("glSetFenceNV" << "(" << fence << ", " << GLEnums::GetStringEnum(condition) @@ -10993,6 +12089,7 @@ gl_api_->glSetFenceNVFn(fence, condition); } +DISABLE_CFI_ICALL void DebugGLApi::glShaderBinaryFn(GLsizei n, const GLuint* shaders, GLenum binaryformat, @@ -11005,6 +12102,7 @@ gl_api_->glShaderBinaryFn(n, shaders, binaryformat, binary, length); } +DISABLE_CFI_ICALL void DebugGLApi::glShaderSourceFn(GLuint shader, GLsizei count, const char* const* str, @@ -11031,6 +12129,7 @@ }); } +DISABLE_CFI_ICALL void DebugGLApi::glStencilFillPathInstancedNVFn( GLsizei numPaths, GLenum pathNameType, @@ -11052,6 +12151,7 @@ transformType, transformValues); } +DISABLE_CFI_ICALL void DebugGLApi::glStencilFillPathNVFn(GLuint path, GLenum fillMode, GLuint mask) { @@ -11061,6 +12161,7 @@ gl_api_->glStencilFillPathNVFn(path, fillMode, mask); } +DISABLE_CFI_ICALL void DebugGLApi::glStencilFuncFn(GLenum func, GLint ref, GLuint mask) { GL_SERVICE_LOG("glStencilFunc" << "(" << GLEnums::GetStringEnum(func) << ", " << ref << ", " @@ -11068,6 +12169,7 @@ gl_api_->glStencilFuncFn(func, ref, mask); } +DISABLE_CFI_ICALL void DebugGLApi::glStencilFuncSeparateFn(GLenum face, GLenum func, GLint ref, @@ -11079,18 +12181,21 @@ gl_api_->glStencilFuncSeparateFn(face, func, ref, mask); } +DISABLE_CFI_ICALL void DebugGLApi::glStencilMaskFn(GLuint mask) { GL_SERVICE_LOG("glStencilMask" << "(" << mask << ")"); gl_api_->glStencilMaskFn(mask); } +DISABLE_CFI_ICALL void DebugGLApi::glStencilMaskSeparateFn(GLenum face, GLuint mask) { GL_SERVICE_LOG("glStencilMaskSeparate" << "(" << GLEnums::GetStringEnum(face) << ", " << mask << ")"); gl_api_->glStencilMaskSeparateFn(face, mask); } +DISABLE_CFI_ICALL void DebugGLApi::glStencilOpFn(GLenum fail, GLenum zfail, GLenum zpass) { GL_SERVICE_LOG("glStencilOp" << "(" << GLEnums::GetStringEnum(fail) << ", " @@ -11099,6 +12204,7 @@ gl_api_->glStencilOpFn(fail, zfail, zpass); } +DISABLE_CFI_ICALL void DebugGLApi::glStencilOpSeparateFn(GLenum face, GLenum fail, GLenum zfail, @@ -11111,6 +12217,7 @@ gl_api_->glStencilOpSeparateFn(face, fail, zfail, zpass); } +DISABLE_CFI_ICALL void DebugGLApi::glStencilStrokePathInstancedNVFn( GLsizei numPaths, GLenum pathNameType, @@ -11131,6 +12238,7 @@ transformValues); } +DISABLE_CFI_ICALL void DebugGLApi::glStencilStrokePathNVFn(GLuint path, GLint reference, GLuint mask) { @@ -11139,6 +12247,7 @@ gl_api_->glStencilStrokePathNVFn(path, reference, mask); } +DISABLE_CFI_ICALL void DebugGLApi::glStencilThenCoverFillPathInstancedNVFn( GLsizei numPaths, GLenum pathNameType, @@ -11162,6 +12271,7 @@ transformType, transformValues); } +DISABLE_CFI_ICALL void DebugGLApi::glStencilThenCoverFillPathNVFn(GLuint path, GLenum fillMode, GLuint mask, @@ -11173,6 +12283,7 @@ gl_api_->glStencilThenCoverFillPathNVFn(path, fillMode, mask, coverMode); } +DISABLE_CFI_ICALL void DebugGLApi::glStencilThenCoverStrokePathInstancedNVFn( GLsizei numPaths, GLenum pathNameType, @@ -11195,6 +12306,7 @@ transformType, transformValues); } +DISABLE_CFI_ICALL void DebugGLApi::glStencilThenCoverStrokePathNVFn(GLuint path, GLint reference, GLuint mask, @@ -11205,6 +12317,7 @@ gl_api_->glStencilThenCoverStrokePathNVFn(path, reference, mask, coverMode); } +DISABLE_CFI_ICALL GLboolean DebugGLApi::glTestFenceAPPLEFn(GLuint fence) { GL_SERVICE_LOG("glTestFenceAPPLE" << "(" << fence << ")"); @@ -11213,6 +12326,7 @@ return result; } +DISABLE_CFI_ICALL GLboolean DebugGLApi::glTestFenceNVFn(GLuint fence) { GL_SERVICE_LOG("glTestFenceNV" << "(" << fence << ")"); @@ -11221,6 +12335,7 @@ return result; } +DISABLE_CFI_ICALL void DebugGLApi::glTexBufferFn(GLenum target, GLenum internalformat, GLuint buffer) { @@ -11231,6 +12346,7 @@ gl_api_->glTexBufferFn(target, internalformat, buffer); } +DISABLE_CFI_ICALL void DebugGLApi::glTexBufferRangeFn(GLenum target, GLenum internalformat, GLuint buffer, @@ -11243,6 +12359,7 @@ gl_api_->glTexBufferRangeFn(target, internalformat, buffer, offset, size); } +DISABLE_CFI_ICALL void DebugGLApi::glTexImage2DFn(GLenum target, GLint level, GLint internalformat, @@ -11262,6 +12379,7 @@ format, type, pixels); } +DISABLE_CFI_ICALL void DebugGLApi::glTexImage2DRobustANGLEFn(GLenum target, GLint level, GLint internalformat, @@ -11283,6 +12401,7 @@ pixels); } +DISABLE_CFI_ICALL void DebugGLApi::glTexImage3DFn(GLenum target, GLint level, GLint internalformat, @@ -11304,6 +12423,7 @@ border, format, type, pixels); } +DISABLE_CFI_ICALL void DebugGLApi::glTexImage3DRobustANGLEFn(GLenum target, GLint level, GLint internalformat, @@ -11327,6 +12447,7 @@ bufSize, pixels); } +DISABLE_CFI_ICALL void DebugGLApi::glTexParameterfFn(GLenum target, GLenum pname, GLfloat param) { GL_SERVICE_LOG("glTexParameterf" << "(" << GLEnums::GetStringEnum(target) << ", " @@ -11334,6 +12455,7 @@ gl_api_->glTexParameterfFn(target, pname, param); } +DISABLE_CFI_ICALL void DebugGLApi::glTexParameterfvFn(GLenum target, GLenum pname, const GLfloat* params) { @@ -11344,6 +12466,7 @@ gl_api_->glTexParameterfvFn(target, pname, params); } +DISABLE_CFI_ICALL void DebugGLApi::glTexParameterfvRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -11355,6 +12478,7 @@ gl_api_->glTexParameterfvRobustANGLEFn(target, pname, bufSize, params); } +DISABLE_CFI_ICALL void DebugGLApi::glTexParameteriFn(GLenum target, GLenum pname, GLint param) { GL_SERVICE_LOG("glTexParameteri" << "(" << GLEnums::GetStringEnum(target) << ", " @@ -11362,6 +12486,7 @@ gl_api_->glTexParameteriFn(target, pname, param); } +DISABLE_CFI_ICALL void DebugGLApi::glTexParameterIivRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -11373,6 +12498,7 @@ gl_api_->glTexParameterIivRobustANGLEFn(target, pname, bufSize, params); } +DISABLE_CFI_ICALL void DebugGLApi::glTexParameterIuivRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -11384,6 +12510,7 @@ gl_api_->glTexParameterIuivRobustANGLEFn(target, pname, bufSize, params); } +DISABLE_CFI_ICALL void DebugGLApi::glTexParameterivFn(GLenum target, GLenum pname, const GLint* params) { @@ -11394,6 +12521,7 @@ gl_api_->glTexParameterivFn(target, pname, params); } +DISABLE_CFI_ICALL void DebugGLApi::glTexParameterivRobustANGLEFn(GLenum target, GLenum pname, GLsizei bufSize, @@ -11405,6 +12533,7 @@ gl_api_->glTexParameterivRobustANGLEFn(target, pname, bufSize, params); } +DISABLE_CFI_ICALL void DebugGLApi::glTexStorage2DEXTFn(GLenum target, GLsizei levels, GLenum internalformat, @@ -11417,6 +12546,7 @@ gl_api_->glTexStorage2DEXTFn(target, levels, internalformat, width, height); } +DISABLE_CFI_ICALL void DebugGLApi::glTexStorage3DFn(GLenum target, GLsizei levels, GLenum internalformat, @@ -11431,6 +12561,7 @@ depth); } +DISABLE_CFI_ICALL void DebugGLApi::glTexSubImage2DFn(GLenum target, GLint level, GLint xoffset, @@ -11450,6 +12581,7 @@ format, type, pixels); } +DISABLE_CFI_ICALL void DebugGLApi::glTexSubImage2DRobustANGLEFn(GLenum target, GLint level, GLint xoffset, @@ -11470,6 +12602,7 @@ height, format, type, bufSize, pixels); } +DISABLE_CFI_ICALL void DebugGLApi::glTexSubImage3DFn(GLenum target, GLint level, GLint xoffset, @@ -11492,6 +12625,7 @@ height, depth, format, type, pixels); } +DISABLE_CFI_ICALL void DebugGLApi::glTexSubImage3DRobustANGLEFn(GLenum target, GLint level, GLint xoffset, @@ -11516,6 +12650,7 @@ type, bufSize, pixels); } +DISABLE_CFI_ICALL void DebugGLApi::glTransformFeedbackVaryingsFn(GLuint program, GLsizei count, const char* const* varyings, @@ -11527,12 +12662,14 @@ gl_api_->glTransformFeedbackVaryingsFn(program, count, varyings, bufferMode); } +DISABLE_CFI_ICALL void DebugGLApi::glUniform1fFn(GLint location, GLfloat x) { GL_SERVICE_LOG("glUniform1f" << "(" << location << ", " << x << ")"); gl_api_->glUniform1fFn(location, x); } +DISABLE_CFI_ICALL void DebugGLApi::glUniform1fvFn(GLint location, GLsizei count, const GLfloat* v) { @@ -11542,12 +12679,14 @@ gl_api_->glUniform1fvFn(location, count, v); } +DISABLE_CFI_ICALL void DebugGLApi::glUniform1iFn(GLint location, GLint x) { GL_SERVICE_LOG("glUniform1i" << "(" << location << ", " << x << ")"); gl_api_->glUniform1iFn(location, x); } +DISABLE_CFI_ICALL void DebugGLApi::glUniform1ivFn(GLint location, GLsizei count, const GLint* v) { GL_SERVICE_LOG("glUniform1iv" << "(" << location << ", " << count << ", " @@ -11555,12 +12694,14 @@ gl_api_->glUniform1ivFn(location, count, v); } +DISABLE_CFI_ICALL void DebugGLApi::glUniform1uiFn(GLint location, GLuint v0) { GL_SERVICE_LOG("glUniform1ui" << "(" << location << ", " << v0 << ")"); gl_api_->glUniform1uiFn(location, v0); } +DISABLE_CFI_ICALL void DebugGLApi::glUniform1uivFn(GLint location, GLsizei count, const GLuint* v) { @@ -11570,12 +12711,14 @@ gl_api_->glUniform1uivFn(location, count, v); } +DISABLE_CFI_ICALL void DebugGLApi::glUniform2fFn(GLint location, GLfloat x, GLfloat y) { GL_SERVICE_LOG("glUniform2f" << "(" << location << ", " << x << ", " << y << ")"); gl_api_->glUniform2fFn(location, x, y); } +DISABLE_CFI_ICALL void DebugGLApi::glUniform2fvFn(GLint location, GLsizei count, const GLfloat* v) { @@ -11585,12 +12728,14 @@ gl_api_->glUniform2fvFn(location, count, v); } +DISABLE_CFI_ICALL void DebugGLApi::glUniform2iFn(GLint location, GLint x, GLint y) { GL_SERVICE_LOG("glUniform2i" << "(" << location << ", " << x << ", " << y << ")"); gl_api_->glUniform2iFn(location, x, y); } +DISABLE_CFI_ICALL void DebugGLApi::glUniform2ivFn(GLint location, GLsizei count, const GLint* v) { GL_SERVICE_LOG("glUniform2iv" << "(" << location << ", " << count << ", " @@ -11598,12 +12743,14 @@ gl_api_->glUniform2ivFn(location, count, v); } +DISABLE_CFI_ICALL void DebugGLApi::glUniform2uiFn(GLint location, GLuint v0, GLuint v1) { GL_SERVICE_LOG("glUniform2ui" << "(" << location << ", " << v0 << ", " << v1 << ")"); gl_api_->glUniform2uiFn(location, v0, v1); } +DISABLE_CFI_ICALL void DebugGLApi::glUniform2uivFn(GLint location, GLsizei count, const GLuint* v) { @@ -11613,6 +12760,7 @@ gl_api_->glUniform2uivFn(location, count, v); } +DISABLE_CFI_ICALL void DebugGLApi::glUniform3fFn(GLint location, GLfloat x, GLfloat y, @@ -11623,6 +12771,7 @@ gl_api_->glUniform3fFn(location, x, y, z); } +DISABLE_CFI_ICALL void DebugGLApi::glUniform3fvFn(GLint location, GLsizei count, const GLfloat* v) { @@ -11632,6 +12781,7 @@ gl_api_->glUniform3fvFn(location, count, v); } +DISABLE_CFI_ICALL void DebugGLApi::glUniform3iFn(GLint location, GLint x, GLint y, GLint z) { GL_SERVICE_LOG("glUniform3i" << "(" << location << ", " << x << ", " << y << ", " << z @@ -11639,6 +12789,7 @@ gl_api_->glUniform3iFn(location, x, y, z); } +DISABLE_CFI_ICALL void DebugGLApi::glUniform3ivFn(GLint location, GLsizei count, const GLint* v) { GL_SERVICE_LOG("glUniform3iv" << "(" << location << ", " << count << ", " @@ -11646,6 +12797,7 @@ gl_api_->glUniform3ivFn(location, count, v); } +DISABLE_CFI_ICALL void DebugGLApi::glUniform3uiFn(GLint location, GLuint v0, GLuint v1, @@ -11656,6 +12808,7 @@ gl_api_->glUniform3uiFn(location, v0, v1, v2); } +DISABLE_CFI_ICALL void DebugGLApi::glUniform3uivFn(GLint location, GLsizei count, const GLuint* v) { @@ -11665,6 +12818,7 @@ gl_api_->glUniform3uivFn(location, count, v); } +DISABLE_CFI_ICALL void DebugGLApi::glUniform4fFn(GLint location, GLfloat x, GLfloat y, @@ -11676,6 +12830,7 @@ gl_api_->glUniform4fFn(location, x, y, z, w); } +DISABLE_CFI_ICALL void DebugGLApi::glUniform4fvFn(GLint location, GLsizei count, const GLfloat* v) { @@ -11685,6 +12840,7 @@ gl_api_->glUniform4fvFn(location, count, v); } +DISABLE_CFI_ICALL void DebugGLApi::glUniform4iFn(GLint location, GLint x, GLint y, @@ -11696,6 +12852,7 @@ gl_api_->glUniform4iFn(location, x, y, z, w); } +DISABLE_CFI_ICALL void DebugGLApi::glUniform4ivFn(GLint location, GLsizei count, const GLint* v) { GL_SERVICE_LOG("glUniform4iv" << "(" << location << ", " << count << ", " @@ -11703,6 +12860,7 @@ gl_api_->glUniform4ivFn(location, count, v); } +DISABLE_CFI_ICALL void DebugGLApi::glUniform4uiFn(GLint location, GLuint v0, GLuint v1, @@ -11714,6 +12872,7 @@ gl_api_->glUniform4uiFn(location, v0, v1, v2, v3); } +DISABLE_CFI_ICALL void DebugGLApi::glUniform4uivFn(GLint location, GLsizei count, const GLuint* v) { @@ -11723,6 +12882,7 @@ gl_api_->glUniform4uivFn(location, count, v); } +DISABLE_CFI_ICALL void DebugGLApi::glUniformBlockBindingFn(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding) { @@ -11733,6 +12893,7 @@ uniformBlockBinding); } +DISABLE_CFI_ICALL void DebugGLApi::glUniformMatrix2fvFn(GLint location, GLsizei count, GLboolean transpose, @@ -11744,6 +12905,7 @@ gl_api_->glUniformMatrix2fvFn(location, count, transpose, value); } +DISABLE_CFI_ICALL void DebugGLApi::glUniformMatrix2x3fvFn(GLint location, GLsizei count, GLboolean transpose, @@ -11755,6 +12917,7 @@ gl_api_->glUniformMatrix2x3fvFn(location, count, transpose, value); } +DISABLE_CFI_ICALL void DebugGLApi::glUniformMatrix2x4fvFn(GLint location, GLsizei count, GLboolean transpose, @@ -11766,6 +12929,7 @@ gl_api_->glUniformMatrix2x4fvFn(location, count, transpose, value); } +DISABLE_CFI_ICALL void DebugGLApi::glUniformMatrix3fvFn(GLint location, GLsizei count, GLboolean transpose, @@ -11777,6 +12941,7 @@ gl_api_->glUniformMatrix3fvFn(location, count, transpose, value); } +DISABLE_CFI_ICALL void DebugGLApi::glUniformMatrix3x2fvFn(GLint location, GLsizei count, GLboolean transpose, @@ -11788,6 +12953,7 @@ gl_api_->glUniformMatrix3x2fvFn(location, count, transpose, value); } +DISABLE_CFI_ICALL void DebugGLApi::glUniformMatrix3x4fvFn(GLint location, GLsizei count, GLboolean transpose, @@ -11799,6 +12965,7 @@ gl_api_->glUniformMatrix3x4fvFn(location, count, transpose, value); } +DISABLE_CFI_ICALL void DebugGLApi::glUniformMatrix4fvFn(GLint location, GLsizei count, GLboolean transpose, @@ -11810,6 +12977,7 @@ gl_api_->glUniformMatrix4fvFn(location, count, transpose, value); } +DISABLE_CFI_ICALL void DebugGLApi::glUniformMatrix4x2fvFn(GLint location, GLsizei count, GLboolean transpose, @@ -11821,6 +12989,7 @@ gl_api_->glUniformMatrix4x2fvFn(location, count, transpose, value); } +DISABLE_CFI_ICALL void DebugGLApi::glUniformMatrix4x3fvFn(GLint location, GLsizei count, GLboolean transpose, @@ -11832,6 +13001,7 @@ gl_api_->glUniformMatrix4x3fvFn(location, count, transpose, value); } +DISABLE_CFI_ICALL GLboolean DebugGLApi::glUnmapBufferFn(GLenum target) { GL_SERVICE_LOG("glUnmapBuffer" << "(" << GLEnums::GetStringEnum(target) << ")"); @@ -11840,24 +13010,28 @@ return result; } +DISABLE_CFI_ICALL void DebugGLApi::glUseProgramFn(GLuint program) { GL_SERVICE_LOG("glUseProgram" << "(" << program << ")"); gl_api_->glUseProgramFn(program); } +DISABLE_CFI_ICALL void DebugGLApi::glValidateProgramFn(GLuint program) { GL_SERVICE_LOG("glValidateProgram" << "(" << program << ")"); gl_api_->glValidateProgramFn(program); } +DISABLE_CFI_ICALL void DebugGLApi::glVertexAttrib1fFn(GLuint indx, GLfloat x) { GL_SERVICE_LOG("glVertexAttrib1f" << "(" << indx << ", " << x << ")"); gl_api_->glVertexAttrib1fFn(indx, x); } +DISABLE_CFI_ICALL void DebugGLApi::glVertexAttrib1fvFn(GLuint indx, const GLfloat* values) { GL_SERVICE_LOG("glVertexAttrib1fv" << "(" << indx << ", " << static_cast<const void*>(values) @@ -11865,12 +13039,14 @@ gl_api_->glVertexAttrib1fvFn(indx, values); } +DISABLE_CFI_ICALL void DebugGLApi::glVertexAttrib2fFn(GLuint indx, GLfloat x, GLfloat y) { GL_SERVICE_LOG("glVertexAttrib2f" << "(" << indx << ", " << x << ", " << y << ")"); gl_api_->glVertexAttrib2fFn(indx, x, y); } +DISABLE_CFI_ICALL void DebugGLApi::glVertexAttrib2fvFn(GLuint indx, const GLfloat* values) { GL_SERVICE_LOG("glVertexAttrib2fv" << "(" << indx << ", " << static_cast<const void*>(values) @@ -11878,6 +13054,7 @@ gl_api_->glVertexAttrib2fvFn(indx, values); } +DISABLE_CFI_ICALL void DebugGLApi::glVertexAttrib3fFn(GLuint indx, GLfloat x, GLfloat y, @@ -11887,6 +13064,7 @@ gl_api_->glVertexAttrib3fFn(indx, x, y, z); } +DISABLE_CFI_ICALL void DebugGLApi::glVertexAttrib3fvFn(GLuint indx, const GLfloat* values) { GL_SERVICE_LOG("glVertexAttrib3fv" << "(" << indx << ", " << static_cast<const void*>(values) @@ -11894,6 +13072,7 @@ gl_api_->glVertexAttrib3fvFn(indx, values); } +DISABLE_CFI_ICALL void DebugGLApi::glVertexAttrib4fFn(GLuint indx, GLfloat x, GLfloat y, @@ -11905,6 +13084,7 @@ gl_api_->glVertexAttrib4fFn(indx, x, y, z, w); } +DISABLE_CFI_ICALL void DebugGLApi::glVertexAttrib4fvFn(GLuint indx, const GLfloat* values) { GL_SERVICE_LOG("glVertexAttrib4fv" << "(" << indx << ", " << static_cast<const void*>(values) @@ -11912,12 +13092,14 @@ gl_api_->glVertexAttrib4fvFn(indx, values); } +DISABLE_CFI_ICALL void DebugGLApi::glVertexAttribDivisorANGLEFn(GLuint index, GLuint divisor) { GL_SERVICE_LOG("glVertexAttribDivisorANGLE" << "(" << index << ", " << divisor << ")"); gl_api_->glVertexAttribDivisorANGLEFn(index, divisor); } +DISABLE_CFI_ICALL void DebugGLApi::glVertexAttribI4iFn(GLuint indx, GLint x, GLint y, @@ -11929,6 +13111,7 @@ gl_api_->glVertexAttribI4iFn(indx, x, y, z, w); } +DISABLE_CFI_ICALL void DebugGLApi::glVertexAttribI4ivFn(GLuint indx, const GLint* values) { GL_SERVICE_LOG("glVertexAttribI4iv" << "(" << indx << ", " << static_cast<const void*>(values) @@ -11936,6 +13119,7 @@ gl_api_->glVertexAttribI4ivFn(indx, values); } +DISABLE_CFI_ICALL void DebugGLApi::glVertexAttribI4uiFn(GLuint indx, GLuint x, GLuint y, @@ -11947,6 +13131,7 @@ gl_api_->glVertexAttribI4uiFn(indx, x, y, z, w); } +DISABLE_CFI_ICALL void DebugGLApi::glVertexAttribI4uivFn(GLuint indx, const GLuint* values) { GL_SERVICE_LOG("glVertexAttribI4uiv" << "(" << indx << ", " << static_cast<const void*>(values) @@ -11954,6 +13139,7 @@ gl_api_->glVertexAttribI4uivFn(indx, values); } +DISABLE_CFI_ICALL void DebugGLApi::glVertexAttribIPointerFn(GLuint indx, GLint size, GLenum type, @@ -11966,6 +13152,7 @@ gl_api_->glVertexAttribIPointerFn(indx, size, type, stride, ptr); } +DISABLE_CFI_ICALL void DebugGLApi::glVertexAttribPointerFn(GLuint indx, GLint size, GLenum type, @@ -11980,6 +13167,7 @@ gl_api_->glVertexAttribPointerFn(indx, size, type, normalized, stride, ptr); } +DISABLE_CFI_ICALL void DebugGLApi::glViewportFn(GLint x, GLint y, GLsizei width, GLsizei height) { GL_SERVICE_LOG("glViewport" << "(" << x << ", " << y << ", " << width << ", " << height @@ -11987,12 +13175,14 @@ gl_api_->glViewportFn(x, y, width, height); } +DISABLE_CFI_ICALL void DebugGLApi::glWaitSyncFn(GLsync sync, GLbitfield flags, GLuint64 timeout) { GL_SERVICE_LOG("glWaitSync" << "(" << sync << ", " << flags << ", " << timeout << ")"); gl_api_->glWaitSyncFn(sync, flags, timeout); } +DISABLE_CFI_ICALL void DebugGLApi::glWindowRectanglesEXTFn(GLenum mode, GLsizei n, const GLint* box) {
diff --git a/ui/gl/gl_bindings_autogen_glx.cc b/ui/gl/gl_bindings_autogen_glx.cc index 44d5391..47284d5 100644 --- a/ui/gl/gl_bindings_autogen_glx.cc +++ b/ui/gl/gl_bindings_autogen_glx.cc
@@ -10,6 +10,8 @@ #include <string> +#include "base/compiler_specific.h" +#include "base/memory/protected_memory.h" #include "base/trace_event/trace_event.h" #include "ui/gl/gl_bindings.h" #include "ui/gl/gl_context.h" @@ -20,7 +22,10 @@ namespace gl { -DriverGLX g_driver_glx; // Exists in .bss +// Place the driver in protected memory so that it is set +// read-only after it is initialized, preventing it from +// being tampered with. See http://crbug.com/771365. +PROTECTED_MEMORY_SECTION base::ProtectedMemory<DriverGLX> g_driver_glx; void DriverGLX::InitializeStaticBindings() { // Ensure struct has been zero-initialized. @@ -183,6 +188,7 @@ memset(this, 0, sizeof(*this)); } +DISABLE_CFI_ICALL void GLXApiBase::glXBindTexImageEXTFn(Display* dpy, GLXDrawable drawable, int buffer, @@ -190,6 +196,7 @@ driver_->fn.glXBindTexImageEXTFn(dpy, drawable, buffer, attribList); } +DISABLE_CFI_ICALL GLXFBConfig* GLXApiBase::glXChooseFBConfigFn(Display* dpy, int screen, const int* attribList, @@ -197,12 +204,14 @@ return driver_->fn.glXChooseFBConfigFn(dpy, screen, attribList, nitems); } +DISABLE_CFI_ICALL XVisualInfo* GLXApiBase::glXChooseVisualFn(Display* dpy, int screen, int* attribList) { return driver_->fn.glXChooseVisualFn(dpy, screen, attribList); } +DISABLE_CFI_ICALL void GLXApiBase::glXCopyContextFn(Display* dpy, GLXContext src, GLXContext dst, @@ -210,6 +219,7 @@ driver_->fn.glXCopyContextFn(dpy, src, dst, mask); } +DISABLE_CFI_ICALL void GLXApiBase::glXCopySubBufferMESAFn(Display* dpy, GLXDrawable drawable, int x, @@ -219,6 +229,7 @@ driver_->fn.glXCopySubBufferMESAFn(dpy, drawable, x, y, width, height); } +DISABLE_CFI_ICALL GLXContext GLXApiBase::glXCreateContextFn(Display* dpy, XVisualInfo* vis, GLXContext shareList, @@ -226,6 +237,7 @@ return driver_->fn.glXCreateContextFn(dpy, vis, shareList, direct); } +DISABLE_CFI_ICALL GLXContext GLXApiBase::glXCreateContextAttribsARBFn(Display* dpy, GLXFBConfig config, GLXContext share_context, @@ -235,12 +247,14 @@ direct, attrib_list); } +DISABLE_CFI_ICALL GLXPixmap GLXApiBase::glXCreateGLXPixmapFn(Display* dpy, XVisualInfo* visual, Pixmap pixmap) { return driver_->fn.glXCreateGLXPixmapFn(dpy, visual, pixmap); } +DISABLE_CFI_ICALL GLXContext GLXApiBase::glXCreateNewContextFn(Display* dpy, GLXFBConfig config, int renderType, @@ -250,12 +264,14 @@ direct); } +DISABLE_CFI_ICALL GLXPbuffer GLXApiBase::glXCreatePbufferFn(Display* dpy, GLXFBConfig config, const int* attribList) { return driver_->fn.glXCreatePbufferFn(dpy, config, attribList); } +DISABLE_CFI_ICALL GLXPixmap GLXApiBase::glXCreatePixmapFn(Display* dpy, GLXFBConfig config, Pixmap pixmap, @@ -263,6 +279,7 @@ return driver_->fn.glXCreatePixmapFn(dpy, config, pixmap, attribList); } +DISABLE_CFI_ICALL GLXWindow GLXApiBase::glXCreateWindowFn(Display* dpy, GLXFBConfig config, Window win, @@ -270,30 +287,37 @@ return driver_->fn.glXCreateWindowFn(dpy, config, win, attribList); } +DISABLE_CFI_ICALL void GLXApiBase::glXDestroyContextFn(Display* dpy, GLXContext ctx) { driver_->fn.glXDestroyContextFn(dpy, ctx); } +DISABLE_CFI_ICALL void GLXApiBase::glXDestroyGLXPixmapFn(Display* dpy, GLXPixmap pixmap) { driver_->fn.glXDestroyGLXPixmapFn(dpy, pixmap); } +DISABLE_CFI_ICALL void GLXApiBase::glXDestroyPbufferFn(Display* dpy, GLXPbuffer pbuf) { driver_->fn.glXDestroyPbufferFn(dpy, pbuf); } +DISABLE_CFI_ICALL void GLXApiBase::glXDestroyPixmapFn(Display* dpy, GLXPixmap pixmap) { driver_->fn.glXDestroyPixmapFn(dpy, pixmap); } +DISABLE_CFI_ICALL void GLXApiBase::glXDestroyWindowFn(Display* dpy, GLXWindow window) { driver_->fn.glXDestroyWindowFn(dpy, window); } +DISABLE_CFI_ICALL const char* GLXApiBase::glXGetClientStringFn(Display* dpy, int name) { return driver_->fn.glXGetClientStringFn(dpy, name); } +DISABLE_CFI_ICALL int GLXApiBase::glXGetConfigFn(Display* dpy, XVisualInfo* visual, int attrib, @@ -301,22 +325,27 @@ return driver_->fn.glXGetConfigFn(dpy, visual, attrib, value); } +DISABLE_CFI_ICALL GLXContext GLXApiBase::glXGetCurrentContextFn(void) { return driver_->fn.glXGetCurrentContextFn(); } +DISABLE_CFI_ICALL Display* GLXApiBase::glXGetCurrentDisplayFn(void) { return driver_->fn.glXGetCurrentDisplayFn(); } +DISABLE_CFI_ICALL GLXDrawable GLXApiBase::glXGetCurrentDrawableFn(void) { return driver_->fn.glXGetCurrentDrawableFn(); } +DISABLE_CFI_ICALL GLXDrawable GLXApiBase::glXGetCurrentReadDrawableFn(void) { return driver_->fn.glXGetCurrentReadDrawableFn(); } +DISABLE_CFI_ICALL int GLXApiBase::glXGetFBConfigAttribFn(Display* dpy, GLXFBConfig config, int attribute, @@ -324,18 +353,21 @@ return driver_->fn.glXGetFBConfigAttribFn(dpy, config, attribute, value); } +DISABLE_CFI_ICALL GLXFBConfig GLXApiBase::glXGetFBConfigFromVisualSGIXFn( Display* dpy, XVisualInfo* visualInfo) { return driver_->fn.glXGetFBConfigFromVisualSGIXFn(dpy, visualInfo); } +DISABLE_CFI_ICALL GLXFBConfig* GLXApiBase::glXGetFBConfigsFn(Display* dpy, int screen, int* nelements) { return driver_->fn.glXGetFBConfigsFn(dpy, screen, nelements); } +DISABLE_CFI_ICALL bool GLXApiBase::glXGetMscRateOMLFn(Display* dpy, GLXDrawable drawable, int32_t* numerator, @@ -343,12 +375,14 @@ return driver_->fn.glXGetMscRateOMLFn(dpy, drawable, numerator, denominator); } +DISABLE_CFI_ICALL void GLXApiBase::glXGetSelectedEventFn(Display* dpy, GLXDrawable drawable, unsigned long* mask) { driver_->fn.glXGetSelectedEventFn(dpy, drawable, mask); } +DISABLE_CFI_ICALL bool GLXApiBase::glXGetSyncValuesOMLFn(Display* dpy, GLXDrawable drawable, int64_t* ust, @@ -357,15 +391,18 @@ return driver_->fn.glXGetSyncValuesOMLFn(dpy, drawable, ust, msc, sbc); } +DISABLE_CFI_ICALL XVisualInfo* GLXApiBase::glXGetVisualFromFBConfigFn(Display* dpy, GLXFBConfig config) { return driver_->fn.glXGetVisualFromFBConfigFn(dpy, config); } +DISABLE_CFI_ICALL int GLXApiBase::glXIsDirectFn(Display* dpy, GLXContext ctx) { return driver_->fn.glXIsDirectFn(dpy, ctx); } +DISABLE_CFI_ICALL int GLXApiBase::glXMakeContextCurrentFn(Display* dpy, GLXDrawable draw, GLXDrawable read, @@ -373,12 +410,14 @@ return driver_->fn.glXMakeContextCurrentFn(dpy, draw, read, ctx); } +DISABLE_CFI_ICALL int GLXApiBase::glXMakeCurrentFn(Display* dpy, GLXDrawable drawable, GLXContext ctx) { return driver_->fn.glXMakeCurrentFn(dpy, drawable, ctx); } +DISABLE_CFI_ICALL int GLXApiBase::glXQueryContextFn(Display* dpy, GLXContext ctx, int attribute, @@ -386,6 +425,7 @@ return driver_->fn.glXQueryContextFn(dpy, ctx, attribute, value); } +DISABLE_CFI_ICALL void GLXApiBase::glXQueryDrawableFn(Display* dpy, GLXDrawable draw, int attribute, @@ -393,68 +433,82 @@ driver_->fn.glXQueryDrawableFn(dpy, draw, attribute, value); } +DISABLE_CFI_ICALL int GLXApiBase::glXQueryExtensionFn(Display* dpy, int* errorb, int* event) { return driver_->fn.glXQueryExtensionFn(dpy, errorb, event); } +DISABLE_CFI_ICALL const char* GLXApiBase::glXQueryExtensionsStringFn(Display* dpy, int screen) { return driver_->fn.glXQueryExtensionsStringFn(dpy, screen); } +DISABLE_CFI_ICALL const char* GLXApiBase::glXQueryServerStringFn(Display* dpy, int screen, int name) { return driver_->fn.glXQueryServerStringFn(dpy, screen, name); } +DISABLE_CFI_ICALL int GLXApiBase::glXQueryVersionFn(Display* dpy, int* maj, int* min) { return driver_->fn.glXQueryVersionFn(dpy, maj, min); } +DISABLE_CFI_ICALL void GLXApiBase::glXReleaseTexImageEXTFn(Display* dpy, GLXDrawable drawable, int buffer) { driver_->fn.glXReleaseTexImageEXTFn(dpy, drawable, buffer); } +DISABLE_CFI_ICALL void GLXApiBase::glXSelectEventFn(Display* dpy, GLXDrawable drawable, unsigned long mask) { driver_->fn.glXSelectEventFn(dpy, drawable, mask); } +DISABLE_CFI_ICALL void GLXApiBase::glXSwapBuffersFn(Display* dpy, GLXDrawable drawable) { driver_->fn.glXSwapBuffersFn(dpy, drawable); } +DISABLE_CFI_ICALL void GLXApiBase::glXSwapIntervalEXTFn(Display* dpy, GLXDrawable drawable, int interval) { driver_->fn.glXSwapIntervalEXTFn(dpy, drawable, interval); } +DISABLE_CFI_ICALL void GLXApiBase::glXSwapIntervalMESAFn(unsigned int interval) { driver_->fn.glXSwapIntervalMESAFn(interval); } +DISABLE_CFI_ICALL void GLXApiBase::glXUseXFontFn(Font font, int first, int count, int list) { driver_->fn.glXUseXFontFn(font, first, count, list); } +DISABLE_CFI_ICALL void GLXApiBase::glXWaitGLFn(void) { driver_->fn.glXWaitGLFn(); } +DISABLE_CFI_ICALL int GLXApiBase::glXWaitVideoSyncSGIFn(int divisor, int remainder, unsigned int* count) { return driver_->fn.glXWaitVideoSyncSGIFn(divisor, remainder, count); } +DISABLE_CFI_ICALL void GLXApiBase::glXWaitXFn(void) { driver_->fn.glXWaitXFn(); } +DISABLE_CFI_ICALL void TraceGLXApi::glXBindTexImageEXTFn(Display* dpy, GLXDrawable drawable, int buffer, @@ -463,6 +517,7 @@ glx_api_->glXBindTexImageEXTFn(dpy, drawable, buffer, attribList); } +DISABLE_CFI_ICALL GLXFBConfig* TraceGLXApi::glXChooseFBConfigFn(Display* dpy, int screen, const int* attribList, @@ -471,6 +526,7 @@ return glx_api_->glXChooseFBConfigFn(dpy, screen, attribList, nitems); } +DISABLE_CFI_ICALL XVisualInfo* TraceGLXApi::glXChooseVisualFn(Display* dpy, int screen, int* attribList) { @@ -478,6 +534,7 @@ return glx_api_->glXChooseVisualFn(dpy, screen, attribList); } +DISABLE_CFI_ICALL void TraceGLXApi::glXCopyContextFn(Display* dpy, GLXContext src, GLXContext dst, @@ -486,6 +543,7 @@ glx_api_->glXCopyContextFn(dpy, src, dst, mask); } +DISABLE_CFI_ICALL void TraceGLXApi::glXCopySubBufferMESAFn(Display* dpy, GLXDrawable drawable, int x, @@ -496,6 +554,7 @@ glx_api_->glXCopySubBufferMESAFn(dpy, drawable, x, y, width, height); } +DISABLE_CFI_ICALL GLXContext TraceGLXApi::glXCreateContextFn(Display* dpy, XVisualInfo* vis, GLXContext shareList, @@ -504,6 +563,7 @@ return glx_api_->glXCreateContextFn(dpy, vis, shareList, direct); } +DISABLE_CFI_ICALL GLXContext TraceGLXApi::glXCreateContextAttribsARBFn(Display* dpy, GLXFBConfig config, GLXContext share_context, @@ -514,6 +574,7 @@ direct, attrib_list); } +DISABLE_CFI_ICALL GLXPixmap TraceGLXApi::glXCreateGLXPixmapFn(Display* dpy, XVisualInfo* visual, Pixmap pixmap) { @@ -521,6 +582,7 @@ return glx_api_->glXCreateGLXPixmapFn(dpy, visual, pixmap); } +DISABLE_CFI_ICALL GLXContext TraceGLXApi::glXCreateNewContextFn(Display* dpy, GLXFBConfig config, int renderType, @@ -531,6 +593,7 @@ direct); } +DISABLE_CFI_ICALL GLXPbuffer TraceGLXApi::glXCreatePbufferFn(Display* dpy, GLXFBConfig config, const int* attribList) { @@ -538,6 +601,7 @@ return glx_api_->glXCreatePbufferFn(dpy, config, attribList); } +DISABLE_CFI_ICALL GLXPixmap TraceGLXApi::glXCreatePixmapFn(Display* dpy, GLXFBConfig config, Pixmap pixmap, @@ -546,6 +610,7 @@ return glx_api_->glXCreatePixmapFn(dpy, config, pixmap, attribList); } +DISABLE_CFI_ICALL GLXWindow TraceGLXApi::glXCreateWindowFn(Display* dpy, GLXFBConfig config, Window win, @@ -554,36 +619,43 @@ return glx_api_->glXCreateWindowFn(dpy, config, win, attribList); } +DISABLE_CFI_ICALL void TraceGLXApi::glXDestroyContextFn(Display* dpy, GLXContext ctx) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glXDestroyContext") glx_api_->glXDestroyContextFn(dpy, ctx); } +DISABLE_CFI_ICALL void TraceGLXApi::glXDestroyGLXPixmapFn(Display* dpy, GLXPixmap pixmap) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glXDestroyGLXPixmap") glx_api_->glXDestroyGLXPixmapFn(dpy, pixmap); } +DISABLE_CFI_ICALL void TraceGLXApi::glXDestroyPbufferFn(Display* dpy, GLXPbuffer pbuf) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glXDestroyPbuffer") glx_api_->glXDestroyPbufferFn(dpy, pbuf); } +DISABLE_CFI_ICALL void TraceGLXApi::glXDestroyPixmapFn(Display* dpy, GLXPixmap pixmap) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glXDestroyPixmap") glx_api_->glXDestroyPixmapFn(dpy, pixmap); } +DISABLE_CFI_ICALL void TraceGLXApi::glXDestroyWindowFn(Display* dpy, GLXWindow window) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glXDestroyWindow") glx_api_->glXDestroyWindowFn(dpy, window); } +DISABLE_CFI_ICALL const char* TraceGLXApi::glXGetClientStringFn(Display* dpy, int name) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glXGetClientString") return glx_api_->glXGetClientStringFn(dpy, name); } +DISABLE_CFI_ICALL int TraceGLXApi::glXGetConfigFn(Display* dpy, XVisualInfo* visual, int attrib, @@ -592,26 +664,31 @@ return glx_api_->glXGetConfigFn(dpy, visual, attrib, value); } +DISABLE_CFI_ICALL GLXContext TraceGLXApi::glXGetCurrentContextFn(void) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glXGetCurrentContext") return glx_api_->glXGetCurrentContextFn(); } +DISABLE_CFI_ICALL Display* TraceGLXApi::glXGetCurrentDisplayFn(void) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glXGetCurrentDisplay") return glx_api_->glXGetCurrentDisplayFn(); } +DISABLE_CFI_ICALL GLXDrawable TraceGLXApi::glXGetCurrentDrawableFn(void) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glXGetCurrentDrawable") return glx_api_->glXGetCurrentDrawableFn(); } +DISABLE_CFI_ICALL GLXDrawable TraceGLXApi::glXGetCurrentReadDrawableFn(void) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glXGetCurrentReadDrawable") return glx_api_->glXGetCurrentReadDrawableFn(); } +DISABLE_CFI_ICALL int TraceGLXApi::glXGetFBConfigAttribFn(Display* dpy, GLXFBConfig config, int attribute, @@ -620,6 +697,7 @@ return glx_api_->glXGetFBConfigAttribFn(dpy, config, attribute, value); } +DISABLE_CFI_ICALL GLXFBConfig TraceGLXApi::glXGetFBConfigFromVisualSGIXFn( Display* dpy, XVisualInfo* visualInfo) { @@ -628,6 +706,7 @@ return glx_api_->glXGetFBConfigFromVisualSGIXFn(dpy, visualInfo); } +DISABLE_CFI_ICALL GLXFBConfig* TraceGLXApi::glXGetFBConfigsFn(Display* dpy, int screen, int* nelements) { @@ -635,6 +714,7 @@ return glx_api_->glXGetFBConfigsFn(dpy, screen, nelements); } +DISABLE_CFI_ICALL bool TraceGLXApi::glXGetMscRateOMLFn(Display* dpy, GLXDrawable drawable, int32_t* numerator, @@ -643,6 +723,7 @@ return glx_api_->glXGetMscRateOMLFn(dpy, drawable, numerator, denominator); } +DISABLE_CFI_ICALL void TraceGLXApi::glXGetSelectedEventFn(Display* dpy, GLXDrawable drawable, unsigned long* mask) { @@ -650,6 +731,7 @@ glx_api_->glXGetSelectedEventFn(dpy, drawable, mask); } +DISABLE_CFI_ICALL bool TraceGLXApi::glXGetSyncValuesOMLFn(Display* dpy, GLXDrawable drawable, int64_t* ust, @@ -659,17 +741,20 @@ return glx_api_->glXGetSyncValuesOMLFn(dpy, drawable, ust, msc, sbc); } +DISABLE_CFI_ICALL XVisualInfo* TraceGLXApi::glXGetVisualFromFBConfigFn(Display* dpy, GLXFBConfig config) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glXGetVisualFromFBConfig") return glx_api_->glXGetVisualFromFBConfigFn(dpy, config); } +DISABLE_CFI_ICALL int TraceGLXApi::glXIsDirectFn(Display* dpy, GLXContext ctx) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glXIsDirect") return glx_api_->glXIsDirectFn(dpy, ctx); } +DISABLE_CFI_ICALL int TraceGLXApi::glXMakeContextCurrentFn(Display* dpy, GLXDrawable draw, GLXDrawable read, @@ -678,6 +763,7 @@ return glx_api_->glXMakeContextCurrentFn(dpy, draw, read, ctx); } +DISABLE_CFI_ICALL int TraceGLXApi::glXMakeCurrentFn(Display* dpy, GLXDrawable drawable, GLXContext ctx) { @@ -685,6 +771,7 @@ return glx_api_->glXMakeCurrentFn(dpy, drawable, ctx); } +DISABLE_CFI_ICALL int TraceGLXApi::glXQueryContextFn(Display* dpy, GLXContext ctx, int attribute, @@ -693,6 +780,7 @@ return glx_api_->glXQueryContextFn(dpy, ctx, attribute, value); } +DISABLE_CFI_ICALL void TraceGLXApi::glXQueryDrawableFn(Display* dpy, GLXDrawable draw, int attribute, @@ -701,16 +789,19 @@ glx_api_->glXQueryDrawableFn(dpy, draw, attribute, value); } +DISABLE_CFI_ICALL int TraceGLXApi::glXQueryExtensionFn(Display* dpy, int* errorb, int* event) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glXQueryExtension") return glx_api_->glXQueryExtensionFn(dpy, errorb, event); } +DISABLE_CFI_ICALL const char* TraceGLXApi::glXQueryExtensionsStringFn(Display* dpy, int screen) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glXQueryExtensionsString") return glx_api_->glXQueryExtensionsStringFn(dpy, screen); } +DISABLE_CFI_ICALL const char* TraceGLXApi::glXQueryServerStringFn(Display* dpy, int screen, int name) { @@ -718,11 +809,13 @@ return glx_api_->glXQueryServerStringFn(dpy, screen, name); } +DISABLE_CFI_ICALL int TraceGLXApi::glXQueryVersionFn(Display* dpy, int* maj, int* min) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glXQueryVersion") return glx_api_->glXQueryVersionFn(dpy, maj, min); } +DISABLE_CFI_ICALL void TraceGLXApi::glXReleaseTexImageEXTFn(Display* dpy, GLXDrawable drawable, int buffer) { @@ -730,6 +823,7 @@ glx_api_->glXReleaseTexImageEXTFn(dpy, drawable, buffer); } +DISABLE_CFI_ICALL void TraceGLXApi::glXSelectEventFn(Display* dpy, GLXDrawable drawable, unsigned long mask) { @@ -737,11 +831,13 @@ glx_api_->glXSelectEventFn(dpy, drawable, mask); } +DISABLE_CFI_ICALL void TraceGLXApi::glXSwapBuffersFn(Display* dpy, GLXDrawable drawable) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glXSwapBuffers") glx_api_->glXSwapBuffersFn(dpy, drawable); } +DISABLE_CFI_ICALL void TraceGLXApi::glXSwapIntervalEXTFn(Display* dpy, GLXDrawable drawable, int interval) { @@ -749,21 +845,25 @@ glx_api_->glXSwapIntervalEXTFn(dpy, drawable, interval); } +DISABLE_CFI_ICALL void TraceGLXApi::glXSwapIntervalMESAFn(unsigned int interval) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glXSwapIntervalMESA") glx_api_->glXSwapIntervalMESAFn(interval); } +DISABLE_CFI_ICALL void TraceGLXApi::glXUseXFontFn(Font font, int first, int count, int list) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glXUseXFont") glx_api_->glXUseXFontFn(font, first, count, list); } +DISABLE_CFI_ICALL void TraceGLXApi::glXWaitGLFn(void) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glXWaitGL") glx_api_->glXWaitGLFn(); } +DISABLE_CFI_ICALL int TraceGLXApi::glXWaitVideoSyncSGIFn(int divisor, int remainder, unsigned int* count) { @@ -771,11 +871,13 @@ return glx_api_->glXWaitVideoSyncSGIFn(divisor, remainder, count); } +DISABLE_CFI_ICALL void TraceGLXApi::glXWaitXFn(void) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glXWaitX") glx_api_->glXWaitXFn(); } +DISABLE_CFI_ICALL void DebugGLXApi::glXBindTexImageEXTFn(Display* dpy, GLXDrawable drawable, int buffer, @@ -787,6 +889,7 @@ glx_api_->glXBindTexImageEXTFn(dpy, drawable, buffer, attribList); } +DISABLE_CFI_ICALL GLXFBConfig* DebugGLXApi::glXChooseFBConfigFn(Display* dpy, int screen, const int* attribList, @@ -801,6 +904,7 @@ return result; } +DISABLE_CFI_ICALL XVisualInfo* DebugGLXApi::glXChooseVisualFn(Display* dpy, int screen, int* attribList) { @@ -812,6 +916,7 @@ return result; } +DISABLE_CFI_ICALL void DebugGLXApi::glXCopyContextFn(Display* dpy, GLXContext src, GLXContext dst, @@ -822,6 +927,7 @@ glx_api_->glXCopyContextFn(dpy, src, dst, mask); } +DISABLE_CFI_ICALL void DebugGLXApi::glXCopySubBufferMESAFn(Display* dpy, GLXDrawable drawable, int x, @@ -835,6 +941,7 @@ glx_api_->glXCopySubBufferMESAFn(dpy, drawable, x, y, width, height); } +DISABLE_CFI_ICALL GLXContext DebugGLXApi::glXCreateContextFn(Display* dpy, XVisualInfo* vis, GLXContext shareList, @@ -848,6 +955,7 @@ return result; } +DISABLE_CFI_ICALL GLXContext DebugGLXApi::glXCreateContextAttribsARBFn(Display* dpy, GLXFBConfig config, GLXContext share_context, @@ -863,6 +971,7 @@ return result; } +DISABLE_CFI_ICALL GLXPixmap DebugGLXApi::glXCreateGLXPixmapFn(Display* dpy, XVisualInfo* visual, Pixmap pixmap) { @@ -874,6 +983,7 @@ return result; } +DISABLE_CFI_ICALL GLXContext DebugGLXApi::glXCreateNewContextFn(Display* dpy, GLXFBConfig config, int renderType, @@ -889,6 +999,7 @@ return result; } +DISABLE_CFI_ICALL GLXPbuffer DebugGLXApi::glXCreatePbufferFn(Display* dpy, GLXFBConfig config, const int* attribList) { @@ -900,6 +1011,7 @@ return result; } +DISABLE_CFI_ICALL GLXPixmap DebugGLXApi::glXCreatePixmapFn(Display* dpy, GLXFBConfig config, Pixmap pixmap, @@ -914,6 +1026,7 @@ return result; } +DISABLE_CFI_ICALL GLXWindow DebugGLXApi::glXCreateWindowFn(Display* dpy, GLXFBConfig config, Window win, @@ -927,12 +1040,14 @@ return result; } +DISABLE_CFI_ICALL void DebugGLXApi::glXDestroyContextFn(Display* dpy, GLXContext ctx) { GL_SERVICE_LOG("glXDestroyContext" << "(" << static_cast<const void*>(dpy) << ", " << ctx << ")"); glx_api_->glXDestroyContextFn(dpy, ctx); } +DISABLE_CFI_ICALL void DebugGLXApi::glXDestroyGLXPixmapFn(Display* dpy, GLXPixmap pixmap) { GL_SERVICE_LOG("glXDestroyGLXPixmap" << "(" << static_cast<const void*>(dpy) << ", " << pixmap @@ -940,6 +1055,7 @@ glx_api_->glXDestroyGLXPixmapFn(dpy, pixmap); } +DISABLE_CFI_ICALL void DebugGLXApi::glXDestroyPbufferFn(Display* dpy, GLXPbuffer pbuf) { GL_SERVICE_LOG("glXDestroyPbuffer" << "(" << static_cast<const void*>(dpy) << ", " << pbuf @@ -947,6 +1063,7 @@ glx_api_->glXDestroyPbufferFn(dpy, pbuf); } +DISABLE_CFI_ICALL void DebugGLXApi::glXDestroyPixmapFn(Display* dpy, GLXPixmap pixmap) { GL_SERVICE_LOG("glXDestroyPixmap" << "(" << static_cast<const void*>(dpy) << ", " << pixmap @@ -954,6 +1071,7 @@ glx_api_->glXDestroyPixmapFn(dpy, pixmap); } +DISABLE_CFI_ICALL void DebugGLXApi::glXDestroyWindowFn(Display* dpy, GLXWindow window) { GL_SERVICE_LOG("glXDestroyWindow" << "(" << static_cast<const void*>(dpy) << ", " << window @@ -961,6 +1079,7 @@ glx_api_->glXDestroyWindowFn(dpy, window); } +DISABLE_CFI_ICALL const char* DebugGLXApi::glXGetClientStringFn(Display* dpy, int name) { GL_SERVICE_LOG("glXGetClientString" << "(" << static_cast<const void*>(dpy) << ", " << name @@ -970,6 +1089,7 @@ return result; } +DISABLE_CFI_ICALL int DebugGLXApi::glXGetConfigFn(Display* dpy, XVisualInfo* visual, int attrib, @@ -983,6 +1103,7 @@ return result; } +DISABLE_CFI_ICALL GLXContext DebugGLXApi::glXGetCurrentContextFn(void) { GL_SERVICE_LOG("glXGetCurrentContext" << "(" @@ -992,6 +1113,7 @@ return result; } +DISABLE_CFI_ICALL Display* DebugGLXApi::glXGetCurrentDisplayFn(void) { GL_SERVICE_LOG("glXGetCurrentDisplay" << "(" @@ -1001,6 +1123,7 @@ return result; } +DISABLE_CFI_ICALL GLXDrawable DebugGLXApi::glXGetCurrentDrawableFn(void) { GL_SERVICE_LOG("glXGetCurrentDrawable" << "(" @@ -1010,6 +1133,7 @@ return result; } +DISABLE_CFI_ICALL GLXDrawable DebugGLXApi::glXGetCurrentReadDrawableFn(void) { GL_SERVICE_LOG("glXGetCurrentReadDrawable" << "(" @@ -1019,6 +1143,7 @@ return result; } +DISABLE_CFI_ICALL int DebugGLXApi::glXGetFBConfigAttribFn(Display* dpy, GLXFBConfig config, int attribute, @@ -1032,6 +1157,7 @@ return result; } +DISABLE_CFI_ICALL GLXFBConfig DebugGLXApi::glXGetFBConfigFromVisualSGIXFn( Display* dpy, XVisualInfo* visualInfo) { @@ -1044,6 +1170,7 @@ return result; } +DISABLE_CFI_ICALL GLXFBConfig* DebugGLXApi::glXGetFBConfigsFn(Display* dpy, int screen, int* nelements) { @@ -1055,6 +1182,7 @@ return result; } +DISABLE_CFI_ICALL bool DebugGLXApi::glXGetMscRateOMLFn(Display* dpy, GLXDrawable drawable, int32_t* numerator, @@ -1069,6 +1197,7 @@ return result; } +DISABLE_CFI_ICALL void DebugGLXApi::glXGetSelectedEventFn(Display* dpy, GLXDrawable drawable, unsigned long* mask) { @@ -1078,6 +1207,7 @@ glx_api_->glXGetSelectedEventFn(dpy, drawable, mask); } +DISABLE_CFI_ICALL bool DebugGLXApi::glXGetSyncValuesOMLFn(Display* dpy, GLXDrawable drawable, int64_t* ust, @@ -1093,6 +1223,7 @@ return result; } +DISABLE_CFI_ICALL XVisualInfo* DebugGLXApi::glXGetVisualFromFBConfigFn(Display* dpy, GLXFBConfig config) { GL_SERVICE_LOG("glXGetVisualFromFBConfig" @@ -1103,6 +1234,7 @@ return result; } +DISABLE_CFI_ICALL int DebugGLXApi::glXIsDirectFn(Display* dpy, GLXContext ctx) { GL_SERVICE_LOG("glXIsDirect" << "(" << static_cast<const void*>(dpy) << ", " << ctx << ")"); @@ -1111,6 +1243,7 @@ return result; } +DISABLE_CFI_ICALL int DebugGLXApi::glXMakeContextCurrentFn(Display* dpy, GLXDrawable draw, GLXDrawable read, @@ -1123,6 +1256,7 @@ return result; } +DISABLE_CFI_ICALL int DebugGLXApi::glXMakeCurrentFn(Display* dpy, GLXDrawable drawable, GLXContext ctx) { @@ -1134,6 +1268,7 @@ return result; } +DISABLE_CFI_ICALL int DebugGLXApi::glXQueryContextFn(Display* dpy, GLXContext ctx, int attribute, @@ -1147,6 +1282,7 @@ return result; } +DISABLE_CFI_ICALL void DebugGLXApi::glXQueryDrawableFn(Display* dpy, GLXDrawable draw, int attribute, @@ -1158,6 +1294,7 @@ glx_api_->glXQueryDrawableFn(dpy, draw, attribute, value); } +DISABLE_CFI_ICALL int DebugGLXApi::glXQueryExtensionFn(Display* dpy, int* errorb, int* event) { GL_SERVICE_LOG("glXQueryExtension" << "(" << static_cast<const void*>(dpy) << ", " @@ -1168,6 +1305,7 @@ return result; } +DISABLE_CFI_ICALL const char* DebugGLXApi::glXQueryExtensionsStringFn(Display* dpy, int screen) { GL_SERVICE_LOG("glXQueryExtensionsString" << "(" << static_cast<const void*>(dpy) << ", " << screen @@ -1177,6 +1315,7 @@ return result; } +DISABLE_CFI_ICALL const char* DebugGLXApi::glXQueryServerStringFn(Display* dpy, int screen, int name) { @@ -1188,6 +1327,7 @@ return result; } +DISABLE_CFI_ICALL int DebugGLXApi::glXQueryVersionFn(Display* dpy, int* maj, int* min) { GL_SERVICE_LOG("glXQueryVersion" << "(" << static_cast<const void*>(dpy) << ", " @@ -1198,6 +1338,7 @@ return result; } +DISABLE_CFI_ICALL void DebugGLXApi::glXReleaseTexImageEXTFn(Display* dpy, GLXDrawable drawable, int buffer) { @@ -1207,6 +1348,7 @@ glx_api_->glXReleaseTexImageEXTFn(dpy, drawable, buffer); } +DISABLE_CFI_ICALL void DebugGLXApi::glXSelectEventFn(Display* dpy, GLXDrawable drawable, unsigned long mask) { @@ -1216,6 +1358,7 @@ glx_api_->glXSelectEventFn(dpy, drawable, mask); } +DISABLE_CFI_ICALL void DebugGLXApi::glXSwapBuffersFn(Display* dpy, GLXDrawable drawable) { GL_SERVICE_LOG("glXSwapBuffers" << "(" << static_cast<const void*>(dpy) << ", " << drawable @@ -1223,6 +1366,7 @@ glx_api_->glXSwapBuffersFn(dpy, drawable); } +DISABLE_CFI_ICALL void DebugGLXApi::glXSwapIntervalEXTFn(Display* dpy, GLXDrawable drawable, int interval) { @@ -1232,12 +1376,14 @@ glx_api_->glXSwapIntervalEXTFn(dpy, drawable, interval); } +DISABLE_CFI_ICALL void DebugGLXApi::glXSwapIntervalMESAFn(unsigned int interval) { GL_SERVICE_LOG("glXSwapIntervalMESA" << "(" << interval << ")"); glx_api_->glXSwapIntervalMESAFn(interval); } +DISABLE_CFI_ICALL void DebugGLXApi::glXUseXFontFn(Font font, int first, int count, int list) { GL_SERVICE_LOG("glXUseXFont" << "(" << font << ", " << first << ", " << count << ", " @@ -1245,6 +1391,7 @@ glx_api_->glXUseXFontFn(font, first, count, list); } +DISABLE_CFI_ICALL void DebugGLXApi::glXWaitGLFn(void) { GL_SERVICE_LOG("glXWaitGL" << "(" @@ -1252,6 +1399,7 @@ glx_api_->glXWaitGLFn(); } +DISABLE_CFI_ICALL int DebugGLXApi::glXWaitVideoSyncSGIFn(int divisor, int remainder, unsigned int* count) { @@ -1263,6 +1411,7 @@ return result; } +DISABLE_CFI_ICALL void DebugGLXApi::glXWaitXFn(void) { GL_SERVICE_LOG("glXWaitX" << "("
diff --git a/ui/gl/gl_bindings_autogen_osmesa.cc b/ui/gl/gl_bindings_autogen_osmesa.cc index 75bd1e9..22bbbd2 100644 --- a/ui/gl/gl_bindings_autogen_osmesa.cc +++ b/ui/gl/gl_bindings_autogen_osmesa.cc
@@ -10,6 +10,8 @@ #include <string> +#include "base/compiler_specific.h" +#include "base/memory/protected_memory.h" #include "base/trace_event/trace_event.h" #include "ui/gl/gl_bindings.h" #include "ui/gl/gl_context.h" @@ -20,7 +22,10 @@ namespace gl { -DriverOSMESA g_driver_osmesa; // Exists in .bss +// Place the driver in protected memory so that it is set +// read-only after it is initialized, preventing it from +// being tampered with. See http://crbug.com/771365. +PROTECTED_MEMORY_SECTION base::ProtectedMemory<DriverOSMESA> g_driver_osmesa; void DriverOSMESA::InitializeStaticBindings() { // Ensure struct has been zero-initialized. @@ -62,15 +67,18 @@ memset(this, 0, sizeof(*this)); } +DISABLE_CFI_ICALL void OSMESAApiBase::OSMesaColorClampFn(GLboolean enable) { driver_->fn.OSMesaColorClampFn(enable); } +DISABLE_CFI_ICALL OSMesaContext OSMESAApiBase::OSMesaCreateContextFn(GLenum format, OSMesaContext sharelist) { return driver_->fn.OSMesaCreateContextFn(format, sharelist); } +DISABLE_CFI_ICALL OSMesaContext OSMESAApiBase::OSMesaCreateContextExtFn(GLenum format, GLint depthBits, GLint stencilBits, @@ -80,10 +88,12 @@ accumBits, sharelist); } +DISABLE_CFI_ICALL void OSMESAApiBase::OSMesaDestroyContextFn(OSMesaContext ctx) { driver_->fn.OSMesaDestroyContextFn(ctx); } +DISABLE_CFI_ICALL GLboolean OSMESAApiBase::OSMesaGetColorBufferFn(OSMesaContext c, GLint* width, GLint* height, @@ -92,10 +102,12 @@ return driver_->fn.OSMesaGetColorBufferFn(c, width, height, format, buffer); } +DISABLE_CFI_ICALL OSMesaContext OSMESAApiBase::OSMesaGetCurrentContextFn(void) { return driver_->fn.OSMesaGetCurrentContextFn(); } +DISABLE_CFI_ICALL GLboolean OSMESAApiBase::OSMesaGetDepthBufferFn(OSMesaContext c, GLint* width, GLint* height, @@ -105,14 +117,17 @@ buffer); } +DISABLE_CFI_ICALL void OSMESAApiBase::OSMesaGetIntegervFn(GLint pname, GLint* value) { driver_->fn.OSMesaGetIntegervFn(pname, value); } +DISABLE_CFI_ICALL OSMESAproc OSMESAApiBase::OSMesaGetProcAddressFn(const char* funcName) { return driver_->fn.OSMesaGetProcAddressFn(funcName); } +DISABLE_CFI_ICALL GLboolean OSMESAApiBase::OSMesaMakeCurrentFn(OSMesaContext ctx, void* buffer, GLenum type, @@ -121,21 +136,25 @@ return driver_->fn.OSMesaMakeCurrentFn(ctx, buffer, type, width, height); } +DISABLE_CFI_ICALL void OSMESAApiBase::OSMesaPixelStoreFn(GLint pname, GLint value) { driver_->fn.OSMesaPixelStoreFn(pname, value); } +DISABLE_CFI_ICALL void TraceOSMESAApi::OSMesaColorClampFn(GLboolean enable) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::OSMesaColorClamp") osmesa_api_->OSMesaColorClampFn(enable); } +DISABLE_CFI_ICALL OSMesaContext TraceOSMESAApi::OSMesaCreateContextFn(GLenum format, OSMesaContext sharelist) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::OSMesaCreateContext") return osmesa_api_->OSMesaCreateContextFn(format, sharelist); } +DISABLE_CFI_ICALL OSMesaContext TraceOSMESAApi::OSMesaCreateContextExtFn( GLenum format, GLint depthBits, @@ -147,11 +166,13 @@ accumBits, sharelist); } +DISABLE_CFI_ICALL void TraceOSMESAApi::OSMesaDestroyContextFn(OSMesaContext ctx) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::OSMesaDestroyContext") osmesa_api_->OSMesaDestroyContextFn(ctx); } +DISABLE_CFI_ICALL GLboolean TraceOSMESAApi::OSMesaGetColorBufferFn(OSMesaContext c, GLint* width, GLint* height, @@ -161,11 +182,13 @@ return osmesa_api_->OSMesaGetColorBufferFn(c, width, height, format, buffer); } +DISABLE_CFI_ICALL OSMesaContext TraceOSMESAApi::OSMesaGetCurrentContextFn(void) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::OSMesaGetCurrentContext") return osmesa_api_->OSMesaGetCurrentContextFn(); } +DISABLE_CFI_ICALL GLboolean TraceOSMESAApi::OSMesaGetDepthBufferFn(OSMesaContext c, GLint* width, GLint* height, @@ -176,16 +199,19 @@ buffer); } +DISABLE_CFI_ICALL void TraceOSMESAApi::OSMesaGetIntegervFn(GLint pname, GLint* value) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::OSMesaGetIntegerv") osmesa_api_->OSMesaGetIntegervFn(pname, value); } +DISABLE_CFI_ICALL OSMESAproc TraceOSMESAApi::OSMesaGetProcAddressFn(const char* funcName) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::OSMesaGetProcAddress") return osmesa_api_->OSMesaGetProcAddressFn(funcName); } +DISABLE_CFI_ICALL GLboolean TraceOSMESAApi::OSMesaMakeCurrentFn(OSMesaContext ctx, void* buffer, GLenum type, @@ -195,17 +221,20 @@ return osmesa_api_->OSMesaMakeCurrentFn(ctx, buffer, type, width, height); } +DISABLE_CFI_ICALL void TraceOSMESAApi::OSMesaPixelStoreFn(GLint pname, GLint value) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::OSMesaPixelStore") osmesa_api_->OSMesaPixelStoreFn(pname, value); } +DISABLE_CFI_ICALL void DebugOSMESAApi::OSMesaColorClampFn(GLboolean enable) { GL_SERVICE_LOG("OSMesaColorClamp" << "(" << GLEnums::GetStringBool(enable) << ")"); osmesa_api_->OSMesaColorClampFn(enable); } +DISABLE_CFI_ICALL OSMesaContext DebugOSMESAApi::OSMesaCreateContextFn(GLenum format, OSMesaContext sharelist) { GL_SERVICE_LOG("OSMesaCreateContext" @@ -216,6 +245,7 @@ return result; } +DISABLE_CFI_ICALL OSMesaContext DebugOSMESAApi::OSMesaCreateContextExtFn( GLenum format, GLint depthBits, @@ -232,12 +262,14 @@ return result; } +DISABLE_CFI_ICALL void DebugOSMESAApi::OSMesaDestroyContextFn(OSMesaContext ctx) { GL_SERVICE_LOG("OSMesaDestroyContext" << "(" << ctx << ")"); osmesa_api_->OSMesaDestroyContextFn(ctx); } +DISABLE_CFI_ICALL GLboolean DebugOSMESAApi::OSMesaGetColorBufferFn(OSMesaContext c, GLint* width, GLint* height, @@ -253,6 +285,7 @@ return result; } +DISABLE_CFI_ICALL OSMesaContext DebugOSMESAApi::OSMesaGetCurrentContextFn(void) { GL_SERVICE_LOG("OSMesaGetCurrentContext" << "(" @@ -262,6 +295,7 @@ return result; } +DISABLE_CFI_ICALL GLboolean DebugOSMESAApi::OSMesaGetDepthBufferFn(OSMesaContext c, GLint* width, GLint* height, @@ -278,6 +312,7 @@ return result; } +DISABLE_CFI_ICALL void DebugOSMESAApi::OSMesaGetIntegervFn(GLint pname, GLint* value) { GL_SERVICE_LOG("OSMesaGetIntegerv" << "(" << pname << ", " << static_cast<const void*>(value) @@ -285,6 +320,7 @@ osmesa_api_->OSMesaGetIntegervFn(pname, value); } +DISABLE_CFI_ICALL OSMESAproc DebugOSMESAApi::OSMesaGetProcAddressFn(const char* funcName) { GL_SERVICE_LOG("OSMesaGetProcAddress" << "(" << funcName << ")"); @@ -293,6 +329,7 @@ return result; } +DISABLE_CFI_ICALL GLboolean DebugOSMESAApi::OSMesaMakeCurrentFn(OSMesaContext ctx, void* buffer, GLenum type, @@ -308,6 +345,7 @@ return result; } +DISABLE_CFI_ICALL void DebugOSMESAApi::OSMesaPixelStoreFn(GLint pname, GLint value) { GL_SERVICE_LOG("OSMesaPixelStore" << "(" << pname << ", " << value << ")");
diff --git a/ui/gl/gl_bindings_autogen_wgl.cc b/ui/gl/gl_bindings_autogen_wgl.cc index 547cf73..3c40f10e 100644 --- a/ui/gl/gl_bindings_autogen_wgl.cc +++ b/ui/gl/gl_bindings_autogen_wgl.cc
@@ -10,6 +10,8 @@ #include <string> +#include "base/compiler_specific.h" +#include "base/memory/protected_memory.h" #include "base/trace_event/trace_event.h" #include "ui/gl/gl_bindings.h" #include "ui/gl/gl_context.h" @@ -20,7 +22,10 @@ namespace gl { -DriverWGL g_driver_wgl; // Exists in .bss +// Place the driver in protected memory so that it is set +// read-only after it is initialized, preventing it from +// being tampered with. See http://crbug.com/771365. +PROTECTED_MEMORY_SECTION base::ProtectedMemory<DriverWGL> g_driver_wgl; void DriverWGL::InitializeStaticBindings() { // Ensure struct has been zero-initialized. @@ -116,6 +121,7 @@ memset(this, 0, sizeof(*this)); } +DISABLE_CFI_ICALL BOOL WGLApiBase::wglChoosePixelFormatARBFn(HDC dc, const int* int_attrib_list, const float* float_attrib_list, @@ -127,14 +133,17 @@ formats, num_formats); } +DISABLE_CFI_ICALL BOOL WGLApiBase::wglCopyContextFn(HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask) { return driver_->fn.wglCopyContextFn(hglrcSrc, hglrcDst, mask); } +DISABLE_CFI_ICALL HGLRC WGLApiBase::wglCreateContextFn(HDC hdc) { return driver_->fn.wglCreateContextFn(hdc); } +DISABLE_CFI_ICALL HGLRC WGLApiBase::wglCreateContextAttribsARBFn(HDC hDC, HGLRC hShareContext, const int* attribList) { @@ -142,10 +151,12 @@ attribList); } +DISABLE_CFI_ICALL HGLRC WGLApiBase::wglCreateLayerContextFn(HDC hdc, int iLayerPlane) { return driver_->fn.wglCreateLayerContextFn(hdc, iLayerPlane); } +DISABLE_CFI_ICALL HPBUFFERARB WGLApiBase::wglCreatePbufferARBFn(HDC hDC, int iPixelFormat, int iWidth, @@ -155,60 +166,74 @@ piAttribList); } +DISABLE_CFI_ICALL BOOL WGLApiBase::wglDeleteContextFn(HGLRC hglrc) { return driver_->fn.wglDeleteContextFn(hglrc); } +DISABLE_CFI_ICALL BOOL WGLApiBase::wglDestroyPbufferARBFn(HPBUFFERARB hPbuffer) { return driver_->fn.wglDestroyPbufferARBFn(hPbuffer); } +DISABLE_CFI_ICALL HGLRC WGLApiBase::wglGetCurrentContextFn() { return driver_->fn.wglGetCurrentContextFn(); } +DISABLE_CFI_ICALL HDC WGLApiBase::wglGetCurrentDCFn() { return driver_->fn.wglGetCurrentDCFn(); } +DISABLE_CFI_ICALL const char* WGLApiBase::wglGetExtensionsStringARBFn(HDC hDC) { return driver_->fn.wglGetExtensionsStringARBFn(hDC); } +DISABLE_CFI_ICALL const char* WGLApiBase::wglGetExtensionsStringEXTFn() { return driver_->fn.wglGetExtensionsStringEXTFn(); } +DISABLE_CFI_ICALL HDC WGLApiBase::wglGetPbufferDCARBFn(HPBUFFERARB hPbuffer) { return driver_->fn.wglGetPbufferDCARBFn(hPbuffer); } +DISABLE_CFI_ICALL BOOL WGLApiBase::wglMakeCurrentFn(HDC hdc, HGLRC hglrc) { return driver_->fn.wglMakeCurrentFn(hdc, hglrc); } +DISABLE_CFI_ICALL BOOL WGLApiBase::wglQueryPbufferARBFn(HPBUFFERARB hPbuffer, int iAttribute, int* piValue) { return driver_->fn.wglQueryPbufferARBFn(hPbuffer, iAttribute, piValue); } +DISABLE_CFI_ICALL int WGLApiBase::wglReleasePbufferDCARBFn(HPBUFFERARB hPbuffer, HDC hDC) { return driver_->fn.wglReleasePbufferDCARBFn(hPbuffer, hDC); } +DISABLE_CFI_ICALL BOOL WGLApiBase::wglShareListsFn(HGLRC hglrc1, HGLRC hglrc2) { return driver_->fn.wglShareListsFn(hglrc1, hglrc2); } +DISABLE_CFI_ICALL BOOL WGLApiBase::wglSwapIntervalEXTFn(int interval) { return driver_->fn.wglSwapIntervalEXTFn(interval); } +DISABLE_CFI_ICALL BOOL WGLApiBase::wglSwapLayerBuffersFn(HDC hdc, UINT fuPlanes) { return driver_->fn.wglSwapLayerBuffersFn(hdc, fuPlanes); } +DISABLE_CFI_ICALL BOOL TraceWGLApi::wglChoosePixelFormatARBFn(HDC dc, const int* int_attrib_list, const float* float_attrib_list, @@ -221,16 +246,19 @@ formats, num_formats); } +DISABLE_CFI_ICALL BOOL TraceWGLApi::wglCopyContextFn(HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::wglCopyContext") return wgl_api_->wglCopyContextFn(hglrcSrc, hglrcDst, mask); } +DISABLE_CFI_ICALL HGLRC TraceWGLApi::wglCreateContextFn(HDC hdc) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::wglCreateContext") return wgl_api_->wglCreateContextFn(hdc); } +DISABLE_CFI_ICALL HGLRC TraceWGLApi::wglCreateContextAttribsARBFn(HDC hDC, HGLRC hShareContext, const int* attribList) { @@ -238,11 +266,13 @@ return wgl_api_->wglCreateContextAttribsARBFn(hDC, hShareContext, attribList); } +DISABLE_CFI_ICALL HGLRC TraceWGLApi::wglCreateLayerContextFn(HDC hdc, int iLayerPlane) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::wglCreateLayerContext") return wgl_api_->wglCreateLayerContextFn(hdc, iLayerPlane); } +DISABLE_CFI_ICALL HPBUFFERARB TraceWGLApi::wglCreatePbufferARBFn(HDC hDC, int iPixelFormat, int iWidth, @@ -253,46 +283,55 @@ piAttribList); } +DISABLE_CFI_ICALL BOOL TraceWGLApi::wglDeleteContextFn(HGLRC hglrc) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::wglDeleteContext") return wgl_api_->wglDeleteContextFn(hglrc); } +DISABLE_CFI_ICALL BOOL TraceWGLApi::wglDestroyPbufferARBFn(HPBUFFERARB hPbuffer) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::wglDestroyPbufferARB") return wgl_api_->wglDestroyPbufferARBFn(hPbuffer); } +DISABLE_CFI_ICALL HGLRC TraceWGLApi::wglGetCurrentContextFn() { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::wglGetCurrentContext") return wgl_api_->wglGetCurrentContextFn(); } +DISABLE_CFI_ICALL HDC TraceWGLApi::wglGetCurrentDCFn() { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::wglGetCurrentDC") return wgl_api_->wglGetCurrentDCFn(); } +DISABLE_CFI_ICALL const char* TraceWGLApi::wglGetExtensionsStringARBFn(HDC hDC) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::wglGetExtensionsStringARB") return wgl_api_->wglGetExtensionsStringARBFn(hDC); } +DISABLE_CFI_ICALL const char* TraceWGLApi::wglGetExtensionsStringEXTFn() { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::wglGetExtensionsStringEXT") return wgl_api_->wglGetExtensionsStringEXTFn(); } +DISABLE_CFI_ICALL HDC TraceWGLApi::wglGetPbufferDCARBFn(HPBUFFERARB hPbuffer) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::wglGetPbufferDCARB") return wgl_api_->wglGetPbufferDCARBFn(hPbuffer); } +DISABLE_CFI_ICALL BOOL TraceWGLApi::wglMakeCurrentFn(HDC hdc, HGLRC hglrc) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::wglMakeCurrent") return wgl_api_->wglMakeCurrentFn(hdc, hglrc); } +DISABLE_CFI_ICALL BOOL TraceWGLApi::wglQueryPbufferARBFn(HPBUFFERARB hPbuffer, int iAttribute, int* piValue) { @@ -300,26 +339,31 @@ return wgl_api_->wglQueryPbufferARBFn(hPbuffer, iAttribute, piValue); } +DISABLE_CFI_ICALL int TraceWGLApi::wglReleasePbufferDCARBFn(HPBUFFERARB hPbuffer, HDC hDC) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::wglReleasePbufferDCARB") return wgl_api_->wglReleasePbufferDCARBFn(hPbuffer, hDC); } +DISABLE_CFI_ICALL BOOL TraceWGLApi::wglShareListsFn(HGLRC hglrc1, HGLRC hglrc2) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::wglShareLists") return wgl_api_->wglShareListsFn(hglrc1, hglrc2); } +DISABLE_CFI_ICALL BOOL TraceWGLApi::wglSwapIntervalEXTFn(int interval) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::wglSwapIntervalEXT") return wgl_api_->wglSwapIntervalEXTFn(interval); } +DISABLE_CFI_ICALL BOOL TraceWGLApi::wglSwapLayerBuffersFn(HDC hdc, UINT fuPlanes) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::wglSwapLayerBuffers") return wgl_api_->wglSwapLayerBuffersFn(hdc, fuPlanes); } +DISABLE_CFI_ICALL BOOL DebugWGLApi::wglChoosePixelFormatARBFn(HDC dc, const int* int_attrib_list, const float* float_attrib_list, @@ -339,6 +383,7 @@ return result; } +DISABLE_CFI_ICALL BOOL DebugWGLApi::wglCopyContextFn(HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask) { GL_SERVICE_LOG("wglCopyContext" << "(" << hglrcSrc << ", " << hglrcDst << ", " << mask << ")"); @@ -347,6 +392,7 @@ return result; } +DISABLE_CFI_ICALL HGLRC DebugWGLApi::wglCreateContextFn(HDC hdc) { GL_SERVICE_LOG("wglCreateContext" << "(" << hdc << ")"); @@ -355,6 +401,7 @@ return result; } +DISABLE_CFI_ICALL HGLRC DebugWGLApi::wglCreateContextAttribsARBFn(HDC hDC, HGLRC hShareContext, const int* attribList) { @@ -367,6 +414,7 @@ return result; } +DISABLE_CFI_ICALL HGLRC DebugWGLApi::wglCreateLayerContextFn(HDC hdc, int iLayerPlane) { GL_SERVICE_LOG("wglCreateLayerContext" << "(" << hdc << ", " << iLayerPlane << ")"); @@ -375,6 +423,7 @@ return result; } +DISABLE_CFI_ICALL HPBUFFERARB DebugWGLApi::wglCreatePbufferARBFn(HDC hDC, int iPixelFormat, int iWidth, @@ -390,6 +439,7 @@ return result; } +DISABLE_CFI_ICALL BOOL DebugWGLApi::wglDeleteContextFn(HGLRC hglrc) { GL_SERVICE_LOG("wglDeleteContext" << "(" << hglrc << ")"); @@ -398,6 +448,7 @@ return result; } +DISABLE_CFI_ICALL BOOL DebugWGLApi::wglDestroyPbufferARBFn(HPBUFFERARB hPbuffer) { GL_SERVICE_LOG("wglDestroyPbufferARB" << "(" << hPbuffer << ")"); @@ -406,6 +457,7 @@ return result; } +DISABLE_CFI_ICALL HGLRC DebugWGLApi::wglGetCurrentContextFn() { GL_SERVICE_LOG("wglGetCurrentContext" << "(" @@ -415,6 +467,7 @@ return result; } +DISABLE_CFI_ICALL HDC DebugWGLApi::wglGetCurrentDCFn() { GL_SERVICE_LOG("wglGetCurrentDC" << "(" @@ -424,6 +477,7 @@ return result; } +DISABLE_CFI_ICALL const char* DebugWGLApi::wglGetExtensionsStringARBFn(HDC hDC) { GL_SERVICE_LOG("wglGetExtensionsStringARB" << "(" << hDC << ")"); @@ -432,6 +486,7 @@ return result; } +DISABLE_CFI_ICALL const char* DebugWGLApi::wglGetExtensionsStringEXTFn() { GL_SERVICE_LOG("wglGetExtensionsStringEXT" << "(" @@ -441,6 +496,7 @@ return result; } +DISABLE_CFI_ICALL HDC DebugWGLApi::wglGetPbufferDCARBFn(HPBUFFERARB hPbuffer) { GL_SERVICE_LOG("wglGetPbufferDCARB" << "(" << hPbuffer << ")"); @@ -449,6 +505,7 @@ return result; } +DISABLE_CFI_ICALL BOOL DebugWGLApi::wglMakeCurrentFn(HDC hdc, HGLRC hglrc) { GL_SERVICE_LOG("wglMakeCurrent" << "(" << hdc << ", " << hglrc << ")"); @@ -457,6 +514,7 @@ return result; } +DISABLE_CFI_ICALL BOOL DebugWGLApi::wglQueryPbufferARBFn(HPBUFFERARB hPbuffer, int iAttribute, int* piValue) { @@ -468,6 +526,7 @@ return result; } +DISABLE_CFI_ICALL int DebugWGLApi::wglReleasePbufferDCARBFn(HPBUFFERARB hPbuffer, HDC hDC) { GL_SERVICE_LOG("wglReleasePbufferDCARB" << "(" << hPbuffer << ", " << hDC << ")"); @@ -476,6 +535,7 @@ return result; } +DISABLE_CFI_ICALL BOOL DebugWGLApi::wglShareListsFn(HGLRC hglrc1, HGLRC hglrc2) { GL_SERVICE_LOG("wglShareLists" << "(" << hglrc1 << ", " << hglrc2 << ")"); @@ -484,6 +544,7 @@ return result; } +DISABLE_CFI_ICALL BOOL DebugWGLApi::wglSwapIntervalEXTFn(int interval) { GL_SERVICE_LOG("wglSwapIntervalEXT" << "(" << interval << ")"); @@ -492,6 +553,7 @@ return result; } +DISABLE_CFI_ICALL BOOL DebugWGLApi::wglSwapLayerBuffersFn(HDC hdc, UINT fuPlanes) { GL_SERVICE_LOG("wglSwapLayerBuffers" << "(" << hdc << ", " << fuPlanes << ")");
diff --git a/ui/gl/gl_context_glx_unittest.cc b/ui/gl/gl_context_glx_unittest.cc index 25478c7..da01392 100644 --- a/ui/gl/gl_context_glx_unittest.cc +++ b/ui/gl/gl_context_glx_unittest.cc
@@ -65,12 +65,12 @@ // window. In those cases, override the glx api to force MakeCurrent() to // fail. context->ReleaseCurrent(surface.get()); - auto real_fn = g_driver_glx.fn.glXMakeContextCurrentFn; - g_driver_glx.fn.glXMakeContextCurrentFn = + auto real_fn = g_driver_glx->fn.glXMakeContextCurrentFn; + g_driver_glx->fn.glXMakeContextCurrentFn = [](Display* display, GLXDrawable drawable, GLXDrawable read, GLXContext context) -> int { return 0; }; EXPECT_FALSE(context->MakeCurrent(surface.get())); - g_driver_glx.fn.glXMakeContextCurrentFn = real_fn; + g_driver_glx->fn.glXMakeContextCurrentFn = real_fn; } // At this point, MakeCurrent() failed. Make sure the GLContextGLX still was // not destroyed.
diff --git a/ui/gl/gl_context_wgl.cc b/ui/gl/gl_context_wgl.cc index 520b4ca..01b6252c 100644 --- a/ui/gl/gl_context_wgl.cc +++ b/ui/gl/gl_context_wgl.cc
@@ -153,7 +153,7 @@ void GLContextWGL::OnSetSwapInterval(int interval) { DCHECK(IsCurrent(nullptr)); - if (g_driver_wgl.ext.b_WGL_EXT_swap_control) { + if (g_driver_wgl->ext.b_WGL_EXT_swap_control) { wglSwapIntervalEXT(interval); } else { LOG(WARNING) <<
diff --git a/ui/gl/gl_egl_api_implementation.cc b/ui/gl/gl_egl_api_implementation.cc index f3bcf75..5bc79cb 100644 --- a/ui/gl/gl_egl_api_implementation.cc +++ b/ui/gl/gl_egl_api_implementation.cc
@@ -17,11 +17,12 @@ DebugEGLApi* g_debug_egl = nullptr; void InitializeStaticGLBindingsEGL() { - g_driver_egl.InitializeStaticBindings(); + auto writer = base::AutoWritableMemory::Create(g_driver_egl); + g_driver_egl->InitializeStaticBindings(); if (!g_real_egl) { g_real_egl = new RealEGLApi(); } - g_real_egl->Initialize(&g_driver_egl); + g_real_egl->Initialize(&*g_driver_egl); g_current_egl_context = g_real_egl; } @@ -42,7 +43,8 @@ g_real_egl = NULL; } g_current_egl_context = NULL; - g_driver_egl.ClearBindings(); + auto writer = base::AutoWritableMemory::Create(g_driver_egl); + g_driver_egl->ClearBindings(); } EGLApi::EGLApi() {
diff --git a/ui/gl/gl_fence.cc b/ui/gl/gl_fence.cc index 39cb8dc..c41b658 100644 --- a/ui/gl/gl_fence.cc +++ b/ui/gl/gl_fence.cc
@@ -39,7 +39,7 @@ #if defined(OS_MACOSX) g_current_gl_driver->ext.b_GL_APPLE_fence || #else - g_driver_egl.ext.b_EGL_KHR_fence_sync || + g_driver_egl->ext.b_EGL_KHR_fence_sync || #endif g_current_gl_driver->ext.b_GL_NV_fence; } @@ -50,8 +50,8 @@ std::unique_ptr<GLFence> fence; #if !defined(OS_MACOSX) - if (g_driver_egl.ext.b_EGL_KHR_fence_sync && - g_driver_egl.ext.b_EGL_KHR_wait_sync) { + if (g_driver_egl->ext.b_EGL_KHR_fence_sync && + g_driver_egl->ext.b_EGL_KHR_wait_sync) { // Prefer GLFenceEGL which doesn't require GL context switching. fence = GLFenceEGL::Create(); DCHECK(fence); @@ -66,7 +66,7 @@ } else if (g_current_gl_driver->ext.b_GL_APPLE_fence) { fence.reset(new GLFenceAPPLE); #else - } else if (g_driver_egl.ext.b_EGL_KHR_fence_sync) { + } else if (g_driver_egl->ext.b_EGL_KHR_fence_sync) { fence = GLFenceEGL::Create(); DCHECK(fence); #endif
diff --git a/ui/gl/gl_fence_egl.cc b/ui/gl/gl_fence_egl.cc index 536346f..2b58e43 100644 --- a/ui/gl/gl_fence_egl.cc +++ b/ui/gl/gl_fence_egl.cc
@@ -77,7 +77,7 @@ } void GLFenceEGL::ServerWait() { - if (!g_driver_egl.ext.b_EGL_KHR_wait_sync) { + if (!g_driver_egl->ext.b_EGL_KHR_wait_sync) { ClientWait(); return; }
diff --git a/ui/gl/gl_glx_api_implementation.cc b/ui/gl/gl_glx_api_implementation.cc index d7903a2..c50ec2e 100644 --- a/ui/gl/gl_glx_api_implementation.cc +++ b/ui/gl/gl_glx_api_implementation.cc
@@ -17,11 +17,12 @@ DebugGLXApi* g_debug_glx; void InitializeStaticGLBindingsGLX() { - g_driver_glx.InitializeStaticBindings(); + auto writer = base::AutoWritableMemory::Create(g_driver_glx); + g_driver_glx->InitializeStaticBindings(); if (!g_real_glx) { g_real_glx = new RealGLXApi(); } - g_real_glx->Initialize(&g_driver_glx); + g_real_glx->Initialize(&*g_driver_glx); g_current_glx_context = g_real_glx; } @@ -42,7 +43,8 @@ g_real_glx = NULL; } g_current_glx_context = NULL; - g_driver_glx.ClearBindings(); + auto writer = base::AutoWritableMemory::Create(g_driver_glx); + g_driver_glx->ClearBindings(); } GLXApi::GLXApi() {
diff --git a/ui/gl/gl_osmesa_api_implementation.cc b/ui/gl/gl_osmesa_api_implementation.cc index 081fc32..e2f64696 100644 --- a/ui/gl/gl_osmesa_api_implementation.cc +++ b/ui/gl/gl_osmesa_api_implementation.cc
@@ -10,13 +10,14 @@ DebugOSMESAApi* g_debug_osmesa = nullptr; void InitializeStaticGLBindingsOSMESA() { - g_driver_osmesa.InitializeStaticBindings(); + auto writer = base::AutoWritableMemory::Create(g_driver_osmesa); + g_driver_osmesa->InitializeStaticBindings(); if (!g_real_osmesa) { g_real_osmesa = new RealOSMESAApi(); } - g_real_osmesa->Initialize(&g_driver_osmesa); + g_real_osmesa->Initialize(&*g_driver_osmesa); g_current_osmesa_context = g_real_osmesa; - g_driver_osmesa.InitializeExtensionBindings(); + g_driver_osmesa->InitializeExtensionBindings(); } void InitializeDebugGLBindingsOSMESA() { @@ -36,7 +37,8 @@ g_real_osmesa = NULL; } g_current_osmesa_context = NULL; - g_driver_osmesa.ClearBindings(); + auto writer = base::AutoWritableMemory::Create(g_driver_osmesa); + g_driver_osmesa->ClearBindings(); } OSMESAApi::OSMESAApi() {
diff --git a/ui/gl/gl_surface_egl.cc b/ui/gl/gl_surface_egl.cc index 556c566..fff52c4 100644 --- a/ui/gl/gl_surface_egl.cc +++ b/ui/gl/gl_surface_egl.cc
@@ -557,23 +557,25 @@ return true; // Must be called before InitializeDisplay(). - g_driver_egl.InitializeClientExtensionBindings(); + auto writer = base::AutoWritableMemory::Create(g_driver_egl); + g_driver_egl->InitializeClientExtensionBindings(); InitializeDisplay(native_display); if (g_display == EGL_NO_DISPLAY) return false; // Must be called after InitializeDisplay(). - g_driver_egl.InitializeExtensionBindings(); + g_driver_egl->InitializeExtensionBindings(); return InitializeOneOffCommon(); } // static bool GLSurfaceEGL::InitializeOneOffForTesting() { - g_driver_egl.InitializeClientExtensionBindings(); + auto writer = base::AutoWritableMemory::Create(g_driver_egl); + g_driver_egl->InitializeClientExtensionBindings(); g_display = eglGetCurrentDisplay(); - g_driver_egl.InitializeExtensionBindings(); + g_driver_egl->InitializeExtensionBindings(); return InitializeOneOffCommon(); } @@ -668,7 +670,7 @@ #if defined(OS_ANDROID) if (base::android::BuildInfo::GetInstance()->sdk_int() >= base::android::SDK_VERSION_NOUGAT && - g_driver_egl.fn.eglDupNativeFenceFDANDROIDFn) { + g_driver_egl->fn.eglDupNativeFenceFDANDROIDFn) { g_egl_android_native_fence_sync_supported = true; } #endif @@ -681,7 +683,8 @@ bool GLSurfaceEGL::InitializeExtensionSettingsOneOff() { if (!initialized_) return false; - g_driver_egl.UpdateConditionalExtensionBindings(); + auto writer = base::AutoWritableMemory::Create(g_driver_egl); + g_driver_egl->UpdateConditionalExtensionBindings(); g_egl_extensions = eglQueryString(g_display, EGL_EXTENSIONS); return true; @@ -895,7 +898,7 @@ egl_window_attributes.push_back(size_.height()); } - if (g_driver_egl.ext.b_EGL_NV_post_sub_buffer) { + if (g_driver_egl->ext.b_EGL_NV_post_sub_buffer) { egl_window_attributes.push_back(EGL_POST_SUB_BUFFER_SUPPORTED_NV); egl_window_attributes.push_back(EGL_TRUE); } @@ -960,7 +963,7 @@ return false; } - if (g_driver_egl.ext.b_EGL_NV_post_sub_buffer) { + if (g_driver_egl->ext.b_EGL_NV_post_sub_buffer) { EGLint surfaceVal; EGLBoolean retVal = eglQuerySurface( GetDisplay(), surface_, EGL_POST_SUB_BUFFER_SUPPORTED_NV, &surfaceVal); @@ -968,7 +971,7 @@ } supports_swap_buffer_with_damage_ = - g_driver_egl.ext.b_EGL_KHR_swap_buffers_with_damage; + g_driver_egl->ext.b_EGL_KHR_swap_buffers_with_damage; if (!vsync_provider_external_ && EGLSyncControlVSyncProvider::IsSupported()) { vsync_provider_internal_ = @@ -979,11 +982,11 @@ } bool NativeViewGLSurfaceEGL::SupportsSwapTimestamps() const { - return g_driver_egl.ext.b_EGL_ANDROID_get_frame_timestamps; + return g_driver_egl->ext.b_EGL_ANDROID_get_frame_timestamps; } void NativeViewGLSurfaceEGL::SetEnableSwapTimestamps() { - DCHECK(g_driver_egl.ext.b_EGL_ANDROID_get_frame_timestamps); + DCHECK(g_driver_egl->ext.b_EGL_ANDROID_get_frame_timestamps); // If frame timestamps are supported, set the proper attribute to enable the // feature and then cache the timestamps supported by the underlying @@ -1487,10 +1490,10 @@ NOTREACHED(); return NULL; #else - if (!g_driver_egl.ext.b_EGL_ANGLE_query_surface_pointer) + if (!g_driver_egl->ext.b_EGL_ANGLE_query_surface_pointer) return NULL; - if (!g_driver_egl.ext.b_EGL_ANGLE_surface_d3d_texture_2d_share_handle) + if (!g_driver_egl->ext.b_EGL_ANGLE_surface_d3d_texture_2d_share_handle) return NULL; void* handle;
diff --git a/ui/gl/gl_surface_glx.cc b/ui/gl/gl_surface_glx.cc index 5b0794c..a80f544b 100644 --- a/ui/gl/gl_surface_glx.cc +++ b/ui/gl/gl_surface_glx.cc
@@ -456,7 +456,8 @@ if (!initialized_) return false; - g_driver_glx.InitializeExtensionBindings(); + auto writer = base::AutoWritableMemory::Create(g_driver_glx); + g_driver_glx->InitializeExtensionBindings(); g_glx_context_create = HasGLXExtension("GLX_ARB_create_context"); g_glx_create_context_robustness_supported = @@ -693,7 +694,7 @@ } bool NativeViewGLSurfaceGLX::SupportsPostSubBuffer() { - return g_driver_glx.ext.b_GLX_MESA_copy_sub_buffer; + return g_driver_glx->ext.b_GLX_MESA_copy_sub_buffer; } void* NativeViewGLSurfaceGLX::GetConfig() { @@ -716,7 +717,7 @@ int width, int height, const PresentationCallback& callback) { - DCHECK(g_driver_glx.ext.b_GLX_MESA_copy_sub_buffer); + DCHECK(g_driver_glx->ext.b_GLX_MESA_copy_sub_buffer); PreSwapBuffers(callback); glXCopySubBufferMESA(g_display, GetDrawableHandle(), x, y, width, height); PostSwapBuffers();
diff --git a/ui/gl/gl_surface_osmesa.cc b/ui/gl/gl_surface_osmesa.cc index c20a45a..0a20986 100644 --- a/ui/gl/gl_surface_osmesa.cc +++ b/ui/gl/gl_surface_osmesa.cc
@@ -109,9 +109,15 @@ gfx::SwapResult GLSurfaceOSMesaHeadless::SwapBuffers( const PresentationCallback& callback) { + callback.Run(gfx::PresentationFeedback(base::TimeTicks::Now(), + base::TimeDelta(), 0 /* flags */)); return gfx::SwapResult::SWAP_ACK; } +bool GLSurfaceOSMesaHeadless::SupportsPresentationCallback() { + return true; +} + GLSurfaceOSMesaHeadless::GLSurfaceOSMesaHeadless() : GLSurfaceOSMesa( GLSurfaceFormat(GLSurfaceFormat::PIXEL_LAYOUT_BGRA),
diff --git a/ui/gl/gl_surface_osmesa.h b/ui/gl/gl_surface_osmesa.h index b397d366..e06974f 100644 --- a/ui/gl/gl_surface_osmesa.h +++ b/ui/gl/gl_surface_osmesa.h
@@ -54,8 +54,10 @@ public: GLSurfaceOSMesaHeadless(); + // GLSurfaceOSMesa overrides: bool IsOffscreen() override; gfx::SwapResult SwapBuffers(const PresentationCallback& callback) override; + bool SupportsPresentationCallback() override; protected: ~GLSurfaceOSMesaHeadless() override;
diff --git a/ui/gl/gl_surface_stub.cc b/ui/gl/gl_surface_stub.cc index a22b5699..eda3a501 100644 --- a/ui/gl/gl_surface_stub.cc +++ b/ui/gl/gl_surface_stub.cc
@@ -4,6 +4,8 @@ #include "ui/gl/gl_surface_stub.h" +#include "base/time/time.h" + namespace gl { void GLSurfaceStub::Destroy() { @@ -22,6 +24,8 @@ gfx::SwapResult GLSurfaceStub::SwapBuffers( const PresentationCallback& callback) { + callback.Run(gfx::PresentationFeedback(base::TimeTicks::Now(), + base::TimeDelta(), 0 /* flags */)); return gfx::SwapResult::SWAP_ACK; } @@ -49,6 +53,10 @@ return supports_draw_rectangle_ ? gfx::Vector2d(100, 200) : gfx::Vector2d(); } +bool GLSurfaceStub::SupportsPresentationCallback() { + return true; +} + GLSurfaceStub::~GLSurfaceStub() {} } // namespace gl
diff --git a/ui/gl/gl_surface_stub.h b/ui/gl/gl_surface_stub.h index 1d9282b..c3db1fb 100644 --- a/ui/gl/gl_surface_stub.h +++ b/ui/gl/gl_surface_stub.h
@@ -34,6 +34,7 @@ GLSurfaceFormat GetFormat() override; bool SupportsDCLayers() const override; gfx::Vector2d GetDrawOffset() const override; + bool SupportsPresentationCallback() override; protected: ~GLSurfaceStub() override;
diff --git a/ui/gl/gl_surface_wgl.cc b/ui/gl/gl_surface_wgl.cc index d3a91b9..d77dce5 100644 --- a/ui/gl/gl_surface_wgl.cc +++ b/ui/gl/gl_surface_wgl.cc
@@ -180,7 +180,7 @@ bool GLSurfaceWGL::InitializeExtensionSettingsOneOff() { if (!initialized_) return false; - g_driver_wgl.InitializeExtensionBindings(); + g_driver_wgl->InitializeExtensionBindings(); return true; } @@ -355,7 +355,7 @@ bool PbufferGLSurfaceWGL::Initialize(GLSurfaceFormat format) { DCHECK(!device_context_); - if (!g_driver_wgl.fn.wglCreatePbufferARBFn) { + if (!g_driver_wgl->fn.wglCreatePbufferARBFn) { LOG(ERROR) << "wglCreatePbufferARB not available."; Destroy(); return false;
diff --git a/ui/gl/gl_switches_util.cc b/ui/gl/gl_switches_util.cc new file mode 100644 index 0000000..6af28d3 --- /dev/null +++ b/ui/gl/gl_switches_util.cc
@@ -0,0 +1,18 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/gl/gl_switches_util.h" + +#include "base/command_line.h" +#include "base/macros.h" +#include "ui/gl/gl_switches.h" + +namespace gl { + +bool IsPresentationCallbackEnabled() { + return base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnablePresentationCallback); +} + +} // namespace gl
diff --git a/ui/gl/gl_switches_util.h b/ui/gl/gl_switches_util.h new file mode 100644 index 0000000..598b2ca --- /dev/null +++ b/ui/gl/gl_switches_util.h
@@ -0,0 +1,16 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_GL_GL_SWITCHES_UTIL_H_ +#define UI_GL_GL_SWITCHES_UTIL_H_ + +#include "ui/gl/gl_export.h" + +namespace gl { + +GL_EXPORT bool IsPresentationCallbackEnabled(); + +} // namespace gl + +#endif // UI_GL_GL_SWITCHES_UTIL_H_
diff --git a/ui/gl/gl_wgl_api_implementation.cc b/ui/gl/gl_wgl_api_implementation.cc index 7cda14e..488f64eef 100644 --- a/ui/gl/gl_wgl_api_implementation.cc +++ b/ui/gl/gl_wgl_api_implementation.cc
@@ -17,11 +17,12 @@ DebugWGLApi* g_debug_wgl = nullptr; void InitializeStaticGLBindingsWGL() { - g_driver_wgl.InitializeStaticBindings(); + auto writer = base::AutoWritableMemory::Create(g_driver_wgl); + g_driver_wgl->InitializeStaticBindings(); if (!g_real_wgl) { g_real_wgl = new RealWGLApi(); } - g_real_wgl->Initialize(&g_driver_wgl); + g_real_wgl->Initialize(&*g_driver_wgl); g_current_wgl_context = g_real_wgl; } @@ -42,7 +43,8 @@ g_real_wgl = NULL; } g_current_wgl_context = NULL; - g_driver_wgl.ClearBindings(); + auto writer = base::AutoWritableMemory::Create(g_driver_wgl); + g_driver_wgl->ClearBindings(); } WGLApi::WGLApi() {
diff --git a/ui/gl/glx_api_unittest.cc b/ui/gl/glx_api_unittest.cc index 1b2dfc9..2e28d72 100644 --- a/ui/gl/glx_api_unittest.cc +++ b/ui/gl/glx_api_unittest.cc
@@ -15,8 +15,9 @@ void SetUp() override { fake_extension_string_ = ""; - g_driver_glx.ClearBindings(); - g_driver_glx.fn.glXQueryExtensionsStringFn = &FakeQueryExtensionsString; + auto writer = base::AutoWritableMemory::Create(g_driver_glx); + g_driver_glx->ClearBindings(); + g_driver_glx->fn.glXQueryExtensionsStringFn = &FakeQueryExtensionsString; SetGLImplementation(kGLImplementationMockGL); SetGLGetProcAddressProc( static_cast<GLGetProcAddressProc>(&FakeGLGetProcAddress)); @@ -25,7 +26,8 @@ void TearDown() override { g_current_glx_context = nullptr; api_.reset(nullptr); - g_driver_glx.ClearBindings(); + auto writer = base::AutoWritableMemory::Create(g_driver_glx); + g_driver_glx->ClearBindings(); fake_extension_string_ = ""; } @@ -33,11 +35,12 @@ void InitializeAPI(const char* disabled_extensions) { api_.reset(new RealGLXApi()); g_current_glx_context = api_.get(); - api_->Initialize(&g_driver_glx); + api_->Initialize(&*g_driver_glx); if (disabled_extensions) { SetDisabledExtensionsGLX(disabled_extensions); } - g_driver_glx.InitializeExtensionBindings(); + auto writer = base::AutoWritableMemory::Create(g_driver_glx); + g_driver_glx->InitializeExtensionBindings(); } void SetFakeExtensionString(const char* fake_string) { @@ -85,11 +88,11 @@ SetFakeExtensionString(kFakeExtensions); InitializeAPI(nullptr); - EXPECT_TRUE(g_driver_glx.ext.b_GLX_ARB_create_context); + EXPECT_TRUE(g_driver_glx->ext.b_GLX_ARB_create_context); InitializeAPI(kFakeDisabledExtensions); - EXPECT_FALSE(g_driver_glx.ext.b_GLX_ARB_create_context); + EXPECT_FALSE(g_driver_glx->ext.b_GLX_ARB_create_context); } TEST_F(GLXApiTest, DisabledExtensionStringTest) {
diff --git a/ui/gl/init/BUILD.gn b/ui/gl/init/BUILD.gn index a201859..c6fe4e87 100644 --- a/ui/gl/init/BUILD.gn +++ b/ui/gl/init/BUILD.gn
@@ -36,6 +36,7 @@ "gl_factory_android.cc", "gl_initializer_android.cc", ] + deps += [ "//ui/gl:gl_features" ] } else if (is_win) { sources += [ "gl_factory_win.cc",
diff --git a/ui/gl/init/gl_initializer_android.cc b/ui/gl/init/gl_initializer_android.cc index 7293e29..3981015d 100644 --- a/ui/gl/init/gl_initializer_android.cc +++ b/ui/gl/init/gl_initializer_android.cc
@@ -11,17 +11,28 @@ #include "base/native_library.h" #include "ui/gl/gl_bindings.h" #include "ui/gl/gl_egl_api_implementation.h" +#include "ui/gl/gl_features.h" #include "ui/gl/gl_gl_api_implementation.h" #include "ui/gl/gl_implementation_osmesa.h" #include "ui/gl/gl_osmesa_api_implementation.h" #include "ui/gl/gl_surface_egl.h" +#if BUILDFLAG(USE_STATIC_ANGLE) +#include <EGL/egl.h> +#endif // BUILDFLAG(USE_STATIC_ANGLE) + namespace gl { namespace init { namespace { bool InitializeStaticEGLInternal() { +#if BUILDFLAG(USE_STATIC_ANGLE) +#pragma push_macro("eglGetProcAddress") +#undef eglGetProcAddress + SetGLGetProcAddressProc(&eglGetProcAddress); +#pragma pop_macro("eglGetProcAddress") +#else // BUILDFLAG(USE_STATIC_ANGLE) base::NativeLibrary gles_library = LoadLibraryAndPrintError("libGLESv2.so"); if (!gles_library) return false; @@ -45,6 +56,7 @@ SetGLGetProcAddressProc(get_proc_address); AddGLNativeLibrary(egl_library); AddGLNativeLibrary(gles_library); +#endif // BUILDFLAG(USE_STATIC_ANGLE) SetGLImplementation(kGLImplementationEGLGLES2); InitializeStaticGLBindingsGL();
diff --git a/ui/gl/wgl_api_unittest.cc b/ui/gl/wgl_api_unittest.cc index a0fe216..958f30f 100644 --- a/ui/gl/wgl_api_unittest.cc +++ b/ui/gl/wgl_api_unittest.cc
@@ -21,9 +21,10 @@ fake_arb_extension_string_ = ""; fake_ext_extension_string_ = ""; - g_driver_wgl.ClearBindings(); - g_driver_wgl.fn.wglGetExtensionsStringARBFn = &FakeGetExtensionsStringARB; - g_driver_wgl.fn.wglGetExtensionsStringEXTFn = &FakeGetExtensionsStringEXT; + auto writer = base::AutoWritableMemory::Create(g_driver_wgl); + g_driver_wgl->ClearBindings(); + g_driver_wgl->fn.wglGetExtensionsStringARBFn = &FakeGetExtensionsStringARB; + g_driver_wgl->fn.wglGetExtensionsStringEXTFn = &FakeGetExtensionsStringEXT; SetGLImplementation(kGLImplementationDesktopGL); SetGLGetProcAddressProc(&FakeGLGetProcAddress); } @@ -31,7 +32,7 @@ void TearDown() override { g_current_wgl_context = nullptr; api_.reset(nullptr); - g_driver_wgl.ClearBindings(); + g_driver_wgl->ClearBindings(); fake_ext_extension_string_ = ""; fake_arb_extension_string_ = ""; @@ -40,11 +41,12 @@ void InitializeAPI(const char* disabled_extensions) { api_.reset(new RealWGLApi()); g_current_wgl_context = api_.get(); - api_->Initialize(&g_driver_wgl); + api_->Initialize(&*g_driver_wgl); if (disabled_extensions) { SetDisabledExtensionsWGL(disabled_extensions); } - g_driver_wgl.InitializeExtensionBindings(); + auto writer = base::AutoWritableMemory::Create(g_driver_wgl); + g_driver_wgl->InitializeExtensionBindings(); } void SetFakeEXTExtensionString(const char* fake_string) { @@ -92,17 +94,17 @@ InitializeAPI(nullptr); - EXPECT_FALSE(g_driver_wgl.ext.b_WGL_ARB_extensions_string); + EXPECT_FALSE(g_driver_wgl->ext.b_WGL_ARB_extensions_string); // NULL simulates not being able to resolve wglGetExtensionsStringARB SetFakeARBExtensionString(nullptr); SetFakeEXTExtensionString(kFakeExtensions); InitializeAPI(nullptr); - EXPECT_TRUE(g_driver_wgl.ext.b_WGL_ARB_extensions_string); + EXPECT_TRUE(g_driver_wgl->ext.b_WGL_ARB_extensions_string); InitializeAPI(kFakeExtensions); - EXPECT_FALSE(g_driver_wgl.ext.b_WGL_ARB_extensions_string); + EXPECT_FALSE(g_driver_wgl->ext.b_WGL_ARB_extensions_string); SetFakeARBExtensionString(""); SetFakeEXTExtensionString(kFakeExtensions); @@ -111,16 +113,16 @@ // We expect false here, because wglGetExtensionsStringARB // always takes precedence over wglGetExtensionsStringEXT // if it is available. - EXPECT_FALSE(g_driver_wgl.ext.b_WGL_ARB_extensions_string); + EXPECT_FALSE(g_driver_wgl->ext.b_WGL_ARB_extensions_string); SetFakeARBExtensionString(kFakeExtensions); SetFakeEXTExtensionString(""); InitializeAPI(nullptr); - EXPECT_TRUE(g_driver_wgl.ext.b_WGL_ARB_extensions_string); + EXPECT_TRUE(g_driver_wgl->ext.b_WGL_ARB_extensions_string); InitializeAPI(kFakeDisabledExtensions); - EXPECT_FALSE(g_driver_wgl.ext.b_WGL_ARB_extensions_string); + EXPECT_FALSE(g_driver_wgl->ext.b_WGL_ARB_extensions_string); } TEST_F(WGLApiTest, DisabledExtensionStringTest) {
diff --git a/ui/message_center/views/message_view.cc b/ui/message_center/views/message_view.cc index b67d31d..25904ad0 100644 --- a/ui/message_center/views/message_view.cc +++ b/ui/message_center/views/message_view.cc
@@ -32,6 +32,9 @@ const int kShadowCornerRadius = 0; const int kShadowElevation = 2; +// The global flag of Sidebar enability. +bool sidebar_enabled = false; + // Creates a text for spoken feedback from the data contained in the // notification. base::string16 CreateAccessibleName( @@ -65,8 +68,14 @@ namespace message_center { +// static const char MessageView::kViewClassName[] = "MessageView"; +// static +void MessageView::SetSidebarEnabled() { + sidebar_enabled = true; +} + MessageView::MessageView(const Notification& notification) : notification_id_(notification.id()), slide_out_controller_(this, this) { SetFocusBehavior(FocusBehavior::ALWAYS); @@ -99,19 +108,26 @@ void MessageView::SetIsNested() { is_nested_ = true; - if (ShouldRoundMessageViewCorners()) { - SetBorder(views::CreateRoundedRectBorder( - kNotificationBorderThickness, kNotificationCornerRadius, kBorderColor)); + if (sidebar_enabled) { + DCHECK(ShouldRoundMessageViewCorners()); + SetBorder(views::CreateRoundedRectBorder(0, kNotificationCornerRadius, + kBorderColor)); } else { - const auto& shadow = - gfx::ShadowDetails::Get(kShadowElevation, kShadowCornerRadius); - gfx::Insets ninebox_insets = - gfx::ShadowValue::GetBlurRegion(shadow.values) + - gfx::Insets(kShadowCornerRadius); - SetBorder(views::CreateBorderPainter( - std::unique_ptr<views::Painter>(views::Painter::CreateImagePainter( - shadow.ninebox_image, ninebox_insets)), - -gfx::ShadowValue::GetMargin(shadow.values))); + if (ShouldRoundMessageViewCorners()) { + SetBorder(views::CreateRoundedRectBorder(kNotificationBorderThickness, + kNotificationCornerRadius, + kBorderColor)); + } else { + const auto& shadow = + gfx::ShadowDetails::Get(kShadowElevation, kShadowCornerRadius); + gfx::Insets ninebox_insets = + gfx::ShadowValue::GetBlurRegion(shadow.values) + + gfx::Insets(kShadowCornerRadius); + SetBorder(views::CreateBorderPainter( + std::unique_ptr<views::Painter>(views::Painter::CreateImagePainter( + shadow.ninebox_image, ninebox_insets)), + -gfx::ShadowValue::GetMargin(shadow.values))); + } } }
diff --git a/ui/message_center/views/message_view.h b/ui/message_center/views/message_view.h index 622f36c..79d73e8 100644 --- a/ui/message_center/views/message_view.h +++ b/ui/message_center/views/message_view.h
@@ -38,6 +38,13 @@ public: static const char kViewClassName[]; + // Notify this notification view is in the sidebar. This is necessary until + // removing the experimental flag for Sidebar, since the flag exists in Ash, + // so we don't refer the flag directly. Some layout and behavior may change by + // this flag. + // TODO(yoshiki, tetsui): Remove this after removing the flag for Sidebar. + static void SetSidebarEnabled(); + explicit MessageView(const Notification& notification); ~MessageView() override;
diff --git a/ui/ozone/platform/headless/gl_surface_osmesa_png.cc b/ui/ozone/platform/headless/gl_surface_osmesa_png.cc index d67da65..8700136 100644 --- a/ui/ozone/platform/headless/gl_surface_osmesa_png.cc +++ b/ui/ozone/platform/headless/gl_surface_osmesa_png.cc
@@ -39,9 +39,15 @@ if (!output_path_.empty()) WriteBufferToPng(); + callback.Run(gfx::PresentationFeedback(base::TimeTicks::Now(), + base::TimeDelta(), 0 /* flags */)); return gfx::SwapResult::SWAP_ACK; } +bool GLSurfaceOSMesaPng::SupportsPresentationCallback() { + return true; +} + GLSurfaceOSMesaPng::~GLSurfaceOSMesaPng() { Destroy(); }
diff --git a/ui/ozone/platform/headless/gl_surface_osmesa_png.h b/ui/ozone/platform/headless/gl_surface_osmesa_png.h index b3d2c56..dc124841f 100644 --- a/ui/ozone/platform/headless/gl_surface_osmesa_png.h +++ b/ui/ozone/platform/headless/gl_surface_osmesa_png.h
@@ -18,6 +18,7 @@ // gl::GLSurfaceOSMesa: bool IsOffscreen() override; gfx::SwapResult SwapBuffers(const PresentationCallback& callback) override; + bool SupportsPresentationCallback() override; private: ~GLSurfaceOSMesaPng() override;
diff --git a/ui/views/accessibility/native_view_accessibility_win_unittest.cc b/ui/views/accessibility/native_view_accessibility_win_unittest.cc index 0968e7f4..9a4d564 100644 --- a/ui/views/accessibility/native_view_accessibility_win_unittest.cc +++ b/ui/views/accessibility/native_view_accessibility_win_unittest.cc
@@ -280,5 +280,22 @@ EXPECT_EQ(1L, child_count); } +TEST_F(NativeViewAccessibilityWinTest, WindowHasRoleApplication) { + // We expect that our internal window object does not expose + // ROLE_SYSTEM_WINDOW, but ROLE_SYSTEM_APPLICATION instead. + Widget widget; + Widget::InitParams init_params = + CreateParams(Widget::InitParams::TYPE_WINDOW); + init_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; + widget.Init(init_params); + + ComPtr<IAccessible> accessible( + widget.GetRootView()->GetNativeViewAccessible()); + ScopedVariant childid_self(CHILDID_SELF); + ScopedVariant role; + EXPECT_EQ(S_OK, accessible->get_accRole(childid_self, role.Receive())); + EXPECT_EQ(role.type(), VT_I4); + EXPECT_EQ(V_I4(role.ptr()), ROLE_SYSTEM_APPLICATION); +} } // namespace test } // namespace views
diff --git a/ui/views/bubble/bubble_dialog_delegate.cc b/ui/views/bubble/bubble_dialog_delegate.cc index 6384d12d..7f425fe 100644 --- a/ui/views/bubble/bubble_dialog_delegate.cc +++ b/ui/views/bubble/bubble_dialog_delegate.cc
@@ -15,6 +15,7 @@ #include "ui/gfx/geometry/rect.h" #include "ui/native_theme/native_theme.h" #include "ui/views/bubble/bubble_frame_view.h" +#include "ui/views/layout/layout_manager.h" #include "ui/views/layout/layout_provider.h" #include "ui/views/view_tracker.h" #include "ui/views/views_delegate.h" @@ -60,8 +61,8 @@ BubbleDialogDelegateView::~BubbleDialogDelegateView() { if (GetWidget()) GetWidget()->RemoveObserver(this); - SetLayoutManager(NULL); - SetAnchorView(NULL); + SetLayoutManager(nullptr); + SetAnchorView(nullptr); } // static
diff --git a/ui/views/controls/textfield/textfield_model_unittest.cc b/ui/views/controls/textfield/textfield_model_unittest.cc index a28fb1e..d35aba0 100644 --- a/ui/views/controls/textfield/textfield_model_unittest.cc +++ b/ui/views/controls/textfield/textfield_model_unittest.cc
@@ -447,6 +447,51 @@ TextfieldModel model(NULL); model.Append( base::ASCIIToUTF16("The answer to Life, the Universe, and Everything")); +#if defined(OS_WIN) // Move right by word includes space/punctuation. + model.MoveCursor(gfx::WORD_BREAK, gfx::CURSOR_RIGHT, gfx::SELECTION_NONE); + EXPECT_EQ(4U, model.GetCursorPosition()); + model.MoveCursor(gfx::WORD_BREAK, gfx::CURSOR_RIGHT, gfx::SELECTION_NONE); + EXPECT_EQ(11U, model.GetCursorPosition()); + model.MoveCursor(gfx::WORD_BREAK, gfx::CURSOR_RIGHT, gfx::SELECTION_NONE); + model.MoveCursor(gfx::WORD_BREAK, gfx::CURSOR_RIGHT, gfx::SELECTION_NONE); + // Should pass the non word chars ', ' and be at the start of "the". + EXPECT_EQ(20U, model.GetCursorPosition()); + + model.MoveCursor(gfx::WORD_BREAK, gfx::CURSOR_RIGHT, gfx::SELECTION_RETAIN); + EXPECT_EQ(24U, model.GetCursorPosition()); + EXPECT_STR_EQ("the ", model.GetSelectedText()); + + // Move to the end. + model.MoveCursor(gfx::WORD_BREAK, gfx::CURSOR_RIGHT, gfx::SELECTION_RETAIN); + model.MoveCursor(gfx::WORD_BREAK, gfx::CURSOR_RIGHT, gfx::SELECTION_RETAIN); + model.MoveCursor(gfx::WORD_BREAK, gfx::CURSOR_RIGHT, gfx::SELECTION_RETAIN); + EXPECT_STR_EQ("the Universe, and Everything", model.GetSelectedText()); + // Should be safe to go next word at the end. + model.MoveCursor(gfx::WORD_BREAK, gfx::CURSOR_RIGHT, gfx::SELECTION_RETAIN); + EXPECT_STR_EQ("the Universe, and Everything", model.GetSelectedText()); + model.InsertChar('2'); + EXPECT_EQ(21U, model.GetCursorPosition()); + + // Now backwards. + model.MoveCursor(gfx::CHARACTER_BREAK, gfx::CURSOR_LEFT, + gfx::SELECTION_NONE); // leave 2. + model.MoveCursor(gfx::WORD_BREAK, gfx::CURSOR_LEFT, gfx::SELECTION_RETAIN); + EXPECT_EQ(14U, model.GetCursorPosition()); + EXPECT_STR_EQ("Life, ", model.GetSelectedText()); + model.MoveCursor(gfx::WORD_BREAK, gfx::CURSOR_LEFT, gfx::SELECTION_RETAIN); + EXPECT_STR_EQ("to Life, ", model.GetSelectedText()); + model.MoveCursor(gfx::WORD_BREAK, gfx::CURSOR_LEFT, gfx::SELECTION_RETAIN); + model.MoveCursor(gfx::WORD_BREAK, gfx::CURSOR_LEFT, gfx::SELECTION_RETAIN); + model.MoveCursor(gfx::WORD_BREAK, gfx::CURSOR_LEFT, + gfx::SELECTION_RETAIN); // Now at start. + EXPECT_STR_EQ("The answer to Life, ", model.GetSelectedText()); + // Should be safe to go to the previous word at the beginning. + model.MoveCursor(gfx::WORD_BREAK, gfx::CURSOR_LEFT, gfx::SELECTION_RETAIN); + EXPECT_STR_EQ("The answer to Life, ", model.GetSelectedText()); + model.ReplaceChar('4'); + EXPECT_EQ(base::string16(), model.GetSelectedText()); + EXPECT_STR_EQ("42", model.text()); +#else // Non-Windows: move right by word does NOT include space/punctuation. model.MoveCursor(gfx::WORD_BREAK, gfx::CURSOR_RIGHT, gfx::SELECTION_NONE); EXPECT_EQ(3U, model.GetCursorPosition()); model.MoveCursor(gfx::WORD_BREAK, gfx::CURSOR_RIGHT, gfx::SELECTION_NONE); @@ -490,6 +535,7 @@ model.ReplaceChar('4'); EXPECT_EQ(base::string16(), model.GetSelectedText()); EXPECT_STR_EQ("42", model.text()); +#endif } TEST_F(TextfieldModelTest, SetText) { @@ -676,6 +722,55 @@ EXPECT_EQ(0U, range.start()); EXPECT_EQ(0U, range.end()); +#if defined(OS_WIN) // Move/select right by word includes space/punctuation. + model.MoveCursor(gfx::WORD_BREAK, gfx::CURSOR_RIGHT, gfx::SELECTION_RETAIN); + range = model.render_text()->selection(); + EXPECT_FALSE(range.is_empty()); + EXPECT_FALSE(range.is_reversed()); + EXPECT_EQ(0U, range.start()); + EXPECT_EQ(6U, range.end()); + + model.MoveCursor(gfx::CHARACTER_BREAK, gfx::CURSOR_LEFT, + gfx::SELECTION_RETAIN); + range = model.render_text()->selection(); + EXPECT_FALSE(range.is_empty()); + EXPECT_EQ(0U, range.start()); + EXPECT_EQ(5U, range.end()); + + model.MoveCursor(gfx::WORD_BREAK, gfx::CURSOR_LEFT, gfx::SELECTION_RETAIN); + range = model.render_text()->selection(); + EXPECT_TRUE(range.is_empty()); + EXPECT_EQ(0U, range.start()); + EXPECT_EQ(0U, range.end()); + + // now from the end. + model.MoveCursor(gfx::LINE_BREAK, gfx::CURSOR_RIGHT, gfx::SELECTION_NONE); + range = model.render_text()->selection(); + EXPECT_TRUE(range.is_empty()); + EXPECT_EQ(11U, range.start()); + EXPECT_EQ(11U, range.end()); + + model.MoveCursor(gfx::WORD_BREAK, gfx::CURSOR_LEFT, gfx::SELECTION_RETAIN); + range = model.render_text()->selection(); + EXPECT_FALSE(range.is_empty()); + EXPECT_TRUE(range.is_reversed()); + EXPECT_EQ(11U, range.start()); + EXPECT_EQ(6U, range.end()); + model.MoveCursor(gfx::CHARACTER_BREAK, gfx::CURSOR_RIGHT, + gfx::SELECTION_RETAIN); + range = model.render_text()->selection(); + EXPECT_FALSE(range.is_empty()); + EXPECT_TRUE(range.is_reversed()); + EXPECT_EQ(11U, range.start()); + EXPECT_EQ(7U, range.end()); + + model.MoveCursor(gfx::WORD_BREAK, gfx::CURSOR_RIGHT, gfx::SELECTION_RETAIN); + range = model.render_text()->selection(); + EXPECT_TRUE(range.is_empty()); + EXPECT_EQ(11U, range.start()); + EXPECT_EQ(11U, range.end()); +#else + // Non-Windows: move/select right by word does NOT include space/punctuation. model.MoveCursor(gfx::WORD_BREAK, gfx::CURSOR_RIGHT, gfx::SELECTION_RETAIN); range = model.render_text()->selection(); EXPECT_FALSE(range.is_empty()); @@ -723,6 +818,7 @@ EXPECT_TRUE(range.is_empty()); EXPECT_EQ(11U, range.start()); EXPECT_EQ(11U, range.end()); +#endif // Select All model.MoveCursor(gfx::LINE_BREAK, gfx::CURSOR_LEFT, gfx::SELECTION_RETAIN); @@ -784,6 +880,16 @@ gfx::Range selection = model.render_text()->selection(); EXPECT_EQ(gfx::Range(0), selection); +#if defined(OS_WIN) // Select word right includes trailing space/punctuation. + model.MoveCursor(gfx::WORD_BREAK, gfx::CURSOR_RIGHT, gfx::SELECTION_RETAIN); + selection = model.render_text()->selection(); + EXPECT_EQ(gfx::Range(0, 6), selection); + + model.MoveCursor(gfx::CHARACTER_BREAK, gfx::CURSOR_LEFT, + gfx::SELECTION_RETAIN); + selection = model.render_text()->selection(); + EXPECT_EQ(gfx::Range(0, 5), selection); +#else // Non-Windows: select word right does NOT include space/punctuation. model.MoveCursor(gfx::WORD_BREAK, gfx::CURSOR_RIGHT, gfx::SELECTION_RETAIN); selection = model.render_text()->selection(); EXPECT_EQ(gfx::Range(0, 5), selection); @@ -792,11 +898,11 @@ gfx::SELECTION_RETAIN); selection = model.render_text()->selection(); EXPECT_EQ(gfx::Range(0, 4), selection); +#endif model.MoveCursor(gfx::WORD_BREAK, gfx::CURSOR_LEFT, gfx::SELECTION_RETAIN); selection = model.render_text()->selection(); EXPECT_EQ(gfx::Range(0), selection); - // now from the end. model.MoveCursor(gfx::LINE_BREAK, gfx::CURSOR_RIGHT, gfx::SELECTION_NONE); selection = model.render_text()->selection();
diff --git a/ui/views/controls/textfield/textfield_unittest.cc b/ui/views/controls/textfield/textfield_unittest.cc index 0aba18e3..4ee16e7 100644 --- a/ui/views/controls/textfield/textfield_unittest.cc +++ b/ui/views/controls/textfield/textfield_unittest.cc
@@ -890,7 +890,11 @@ // Test word select. SendWordEvent(ui::VKEY_RIGHT, true); +#if defined(OS_WIN) // Select word right includes space/punctuation. + EXPECT_STR_EQ("one two ", textfield_->GetSelectedText()); +#else // Non-Windows: select word right does NOT include space/punctuation. EXPECT_STR_EQ("one two", textfield_->GetSelectedText()); +#endif SendWordEvent(ui::VKEY_RIGHT, true); EXPECT_STR_EQ("one two three", textfield_->GetSelectedText()); SendWordEvent(ui::VKEY_LEFT, true); @@ -927,7 +931,11 @@ // Select word towards right. SendWordEvent(ui::VKEY_RIGHT, true); +#if defined(OS_WIN) // Select word right includes space/punctuation. + EXPECT_STR_EQ("67 ", textfield_->GetSelectedText()); +#else // Non-Win: select word right does NOT include space/punctuation. EXPECT_STR_EQ("67", textfield_->GetSelectedText()); +#endif SendWordEvent(ui::VKEY_RIGHT, true); EXPECT_STR_EQ("67 89", textfield_->GetSelectedText()); @@ -1161,8 +1169,11 @@ shift = false; SendHomeEvent(shift); SendWordEvent(ui::VKEY_DELETE, shift); +#if defined(OS_WIN) // Delete word incldes space/punctuation. + EXPECT_STR_EQ("two three four", textfield_->text()); +#else // Non-Windows: delete word does NOT include space/punctuation. EXPECT_STR_EQ(" two three four", textfield_->text()); - +#endif // Delete to a line break on Linux and ChromeOS, to a word break on Windows // and Mac. SendWordEvent(ui::VKEY_RIGHT, shift); @@ -1170,6 +1181,8 @@ SendWordEvent(ui::VKEY_DELETE, shift); #if defined(OS_LINUX) EXPECT_STR_EQ(" two", textfield_->text()); +#elif defined(OS_WIN) + EXPECT_STR_EQ("two four", textfield_->text()); #else EXPECT_STR_EQ(" two four", textfield_->text()); #endif @@ -1393,6 +1406,20 @@ EXPECT_STR_EQ("one two thre ", textfield_->text()); EXPECT_STR_EQ("one two thre ", last_contents_); +#if defined(OS_WIN) // Move right by word includes space/punctuation. + // Ctrl+Right should move the cursor to the end of the last word. + SendWordEvent(ui::VKEY_RIGHT, shift); + SendKeyEvent(ui::VKEY_E); + EXPECT_STR_EQ("one two thre e", textfield_->text()); + EXPECT_STR_EQ("one two thre e", last_contents_); + + // Ctrl+Right again should not move the cursor, because + // it is aleady at the end. + SendWordEvent(ui::VKEY_RIGHT, shift); + SendKeyEvent(ui::VKEY_BACK); + EXPECT_STR_EQ("one two thre ", textfield_->text()); + EXPECT_STR_EQ("one two thre ", last_contents_); +#else // Non-Windows: move right by word does NOT include space/punctuation. // Ctrl+Right should move the cursor to the end of the last word. SendWordEvent(ui::VKEY_RIGHT, shift); SendKeyEvent(ui::VKEY_E); @@ -1404,7 +1431,7 @@ SendKeyEvent(ui::VKEY_BACK); EXPECT_STR_EQ("one two three", textfield_->text()); EXPECT_STR_EQ("one two three", last_contents_); - +#endif // Test with leading whitespace. textfield_->SetText(ASCIIToUTF16(" ne two"));
diff --git a/ui/views/layout/grid_layout.h b/ui/views/layout/grid_layout.h index 9028ed69..b50daea 100644 --- a/ui/views/layout/grid_layout.h +++ b/ui/views/layout/grid_layout.h
@@ -108,6 +108,8 @@ }; // Creates a new GridLayout and installs it as the LayoutManager for |host|. + // The returned pointer is owned by the view and already installed as its + // layout manager. static GridLayout* CreateAndInstall(View* host); ~GridLayout() override;
diff --git a/ui/views/view.cc b/ui/views/view.cc index 4b0022c..56734ae8 100644 --- a/ui/views/view.cc +++ b/ui/views/view.cc
@@ -631,13 +631,16 @@ return layout_manager_.get(); } -void View::SetLayoutManager(LayoutManager* layout_manager) { - if (layout_manager == layout_manager_.get()) - return; +void View::SetLayoutManager(nullptr_t) { + SetLayoutManagerImpl(nullptr); +} - layout_manager_.reset(layout_manager); - if (layout_manager_) - layout_manager_->Installed(this); +void View::SetLayoutManager(LayoutManager* layout) { + // Some callers of this deprecated function may set the same layout manager + // twice, which used to be a no-op. Retain this behavior to avoid crashing. + if (layout == layout_manager_.get()) + return; + SetLayoutManager(std::unique_ptr<LayoutManager>(layout)); } // Attributes ------------------------------------------------------------------ @@ -2359,6 +2362,18 @@ descendants_to_notify_.reset(); } +void View::SetLayoutManagerImpl(std::unique_ptr<LayoutManager> layout_manager) { + // Some code keeps a bare pointer to the layout manager for calling + // derived-class-specific-functions. It's an easy mistake to create a new + // unique_ptr and re-set the layout manager with a new unique_ptr, which + // will cause a crash. Re-setting to null is OK. + CHECK(!layout_manager.get() || layout_manager_.get() != layout_manager.get()); + + layout_manager_ = std::move(layout_manager); + if (layout_manager_) + layout_manager_->Installed(this); +} + void View::SetLayerBounds(const gfx::Size& size, const LayerOffsetData& offset_data) { layer()->SetBounds(gfx::Rect(size) + offset_data.offset());
diff --git a/ui/views/view.h b/ui/views/view.h index d1120c44..a5827533 100644 --- a/ui/views/view.h +++ b/ui/views/view.h
@@ -510,9 +510,28 @@ // Gets/Sets the Layout Manager used by this view to size and place its // children. + // // The LayoutManager is owned by the View and is deleted when the view is - // deleted, or when a new LayoutManager is installed. + // deleted, or when a new LayoutManager is installed. Call + // SetLayoutManager(nullptr) to clear it. + // + // SetLayoutManager returns a bare pointer version of the input parameter + // (now owned by the view). If code needs to use the layout manager after + // being assigned, use this pattern: + // + // views::BoxLayout* box_layout = SetLayoutManager( + // std::make_unique<views::BoxLayout>(...)); + // box_layout->Foo(); LayoutManager* GetLayoutManager() const; + template <typename LayoutManager> + LayoutManager* SetLayoutManager( + std::unique_ptr<LayoutManager> layout_manager) { + LayoutManager* lm = layout_manager.get(); + SetLayoutManagerImpl(std::move(layout_manager)); + return lm; + } + void SetLayoutManager(nullptr_t); + // DEPRECATED version that takes ownership of a raw pointer. void SetLayoutManager(LayoutManager* layout); // Attributes ---------------------------------------------------------------- @@ -1512,6 +1531,9 @@ void AddDescendantToNotify(View* view); void RemoveDescendantToNotify(View* view); + // Non-templatized backend for SetLayoutManager(). + void SetLayoutManagerImpl(std::unique_ptr<LayoutManager> layout); + // Transformations ----------------------------------------------------------- // Returns in |transform| the transform to get from coordinates of |ancestor|
diff --git a/ui/webui/resources/cr_elements/chromeos/network/compiled_resources2.gyp b/ui/webui/resources/cr_elements/chromeos/network/compiled_resources2.gyp index 77ed996..d7600a5 100644 --- a/ui/webui/resources/cr_elements/chromeos/network/compiled_resources2.gyp +++ b/ui/webui/resources/cr_elements/chromeos/network/compiled_resources2.gyp
@@ -44,6 +44,7 @@ { 'target_name': 'cr_network_select', 'dependencies': [ + '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:util', '<(EXTERNS_GYP):networking_private', 'cr_network_list_types', 'cr_onc_types',
diff --git a/ui/webui/resources/cr_elements/chromeos/network/cr_network_select.js b/ui/webui/resources/cr_elements/chromeos/network/cr_network_select.js index dc53005a..2a3afa75 100644 --- a/ui/webui/resources/cr_elements/chromeos/network/cr_network_select.js +++ b/ui/webui/resources/cr_elements/chromeos/network/cr_network_select.js
@@ -166,10 +166,18 @@ CrOnc.ConnectionState.CONNECTED) ? this.networkStateList_[0] : null; - if (defaultState.GUID != this.defaultStateGuid_) { - this.defaultStateGuid_ = defaultState.GUID; - this.fire('default-network-changed', defaultState); - } + + if (!defaultState && !this.defaultStateGuid_) + return; + + // defaultState.GUID must never be empty. + assert(!defaultState || defaultState.GUID); + + if (defaultState && defaultState.GUID == this.defaultStateGuid_) + return; + + this.defaultStateGuid_ = defaultState ? defaultState.GUID : ''; + this.fire('default-network-changed', defaultState); }, /**
diff --git a/ui/webui/resources/cr_elements/cr_expand_button/cr_expand_button.html b/ui/webui/resources/cr_elements/cr_expand_button/cr_expand_button.html index 5bf7ce37..2753d98 100644 --- a/ui/webui/resources/cr_elements/cr_expand_button/cr_expand_button.html +++ b/ui/webui/resources/cr_elements/cr_expand_button/cr_expand_button.html
@@ -6,10 +6,6 @@ <dom-module id="cr-expand-button"> <template> <style include="cr-icons cr-shared-style"> - :host { - display: inline-block; - } - :host([disabled]) { pointer-events: none; } @@ -17,13 +13,24 @@ button[is=paper-icon-button-light] { @apply(--cr-paper-icon-button-margin); } + + #outer { + align-items: center; + display: flex; + } + + #label { + flex: 1; + } </style> - <content></content> - <button is="paper-icon-button-light" class$="[[iconName_(expanded)]]" - toggles active="{{expanded}}" disabled="[[disabled]]" alt="[[alt]]" - aria-active-attribute="aria-expanded" on-tap="toggleExpand_" - tabindex$="[[tabIndex]]"> - </button> + <div id="outer" on-tap="toggleExpand_"> + <div id="label" on-tap="toggleExpand_"><slot></slot></div> + <button is="paper-icon-button-light" class$="[[iconName_(expanded)]]" + toggles active="{{expanded}}" disabled="[[disabled]]" alt="[[alt]]" + aria-active-attribute="aria-expanded" + tabindex$="[[tabIndex]]"> + </button> + </div> </template> <script src="cr_expand_button.js"></script> </dom-module>