diff --git a/DEPS b/DEPS index 3c0c08fd7..7cc5d7f 100644 --- a/DEPS +++ b/DEPS
@@ -44,7 +44,7 @@ # 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': '88178697abff240c3bdc774506b5b11e4db4c839', + 'v8_revision': '1c4fcefc1480ae6c2e9c6e456ee6aafa823215d9', # 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. @@ -64,7 +64,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': 'e10509a3d2a1641984845d579963d574305ea6cc', + 'pdfium_revision': '222e1a425e2d2199a842883dcc330a549f400630', # 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. @@ -96,7 +96,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling catapult # and whatever else without interference from each other. - 'catapult_revision': '1556ddcf20a16bdd8f54d7a9bd43df8dc5b4a53d', + 'catapult_revision': 'a64c010c74cc810921c037fcf7ccee1d5c5b0c00', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other.
diff --git a/WATCHLISTS b/WATCHLISTS index 2a4e2bd..e780b80 100644 --- a/WATCHLISTS +++ b/WATCHLISTS
@@ -1996,7 +1996,7 @@ 'eme': ['eme-reviews@chromium.org'], 'extension': ['chromium-apps-reviews@chromium.org', 'extensions-reviews@chromium.org'], - 'feature_policy': ['lunalu@chromium.org', + 'feature_policy': ['loonybear@chromium.org', 'iclelland@chromium.org'], 'feedback_ui': ['apacible+watch@chromium.org'], 'fileapi': ['kinuko+fileapi@chromium.org',
diff --git a/android_webview/browser/browser_view_renderer.cc b/android_webview/browser/browser_view_renderer.cc index c1e6c61..c4191417 100644 --- a/android_webview/browser/browser_view_renderer.cc +++ b/android_webview/browser/browser_view_renderer.cc
@@ -253,7 +253,7 @@ allow_async_draw_ = true; std::unique_ptr<ChildFrame> child_frame = base::MakeUnique<ChildFrame>( - std::move(future), frame.compositor_frame_sink_id, std::move(frame.frame), + std::move(future), frame.layer_tree_frame_sink_id, std::move(frame.frame), compositor_id_, viewport_rect_for_tile_priority.IsEmpty(), transform_for_tile_priority, offscreen_pre_raster_, external_draw_constraints_.is_layer); @@ -321,7 +321,7 @@ content::SynchronousCompositor* compositor = FindCompositor(child_frame->compositor_id); if (compositor && !resources.empty()) - compositor->ReturnResources(child_frame->compositor_frame_sink_id, + compositor->ReturnResources(child_frame->layer_tree_frame_sink_id, resources); } @@ -336,7 +336,7 @@ resources.swap(pair.second.resources); if (compositor && !resources.empty()) { - compositor->ReturnResources(pair.second.compositor_frame_sink_id, + compositor->ReturnResources(pair.second.layer_tree_frame_sink_id, resources); } }
diff --git a/android_webview/browser/browser_view_renderer_unittest.cc b/android_webview/browser/browser_view_renderer_unittest.cc index 4db9e91..8a34ef0 100644 --- a/android_webview/browser/browser_view_renderer_unittest.cc +++ b/android_webview/browser/browser_view_renderer_unittest.cc
@@ -342,7 +342,7 @@ class ResourceRenderingTest : public RenderingTest { public: using ResourceCountMap = std::map<cc::ResourceId, int>; - using CompositorFrameSinkResourceCountMap = + using LayerTreeFrameSinkResourceCountMap = std::map<uint32_t, ResourceCountMap>; virtual std::unique_ptr<content::SynchronousCompositor::Frame> GetFrame( @@ -355,7 +355,7 @@ void WillOnDraw() override { if (next_frame_) { - compositor_->SetHardwareFrame(next_frame_->compositor_frame_sink_id, + compositor_->SetHardwareFrame(next_frame_->layer_tree_frame_sink_id, std::move(next_frame_->frame)); } } @@ -369,13 +369,13 @@ } } - CompositorFrameSinkResourceCountMap GetReturnedResourceCounts() { - CompositorFrameSinkResourceCountMap counts; + LayerTreeFrameSinkResourceCountMap GetReturnedResourceCounts() { + LayerTreeFrameSinkResourceCountMap counts; content::TestSynchronousCompositor::FrameAckArray returned_resources_array; compositor_->SwapReturnedResources(&returned_resources_array); for (const auto& resources : returned_resources_array) { for (const auto& returned_resource : resources.resources) { - counts[resources.compositor_frame_sink_id][returned_resource.id] += + counts[resources.layer_tree_frame_sink_id][returned_resource.id] += returned_resource.count; } } @@ -398,9 +398,9 @@ int frame_number_; }; -class SwitchCompositorFrameSinkIdTest : public ResourceRenderingTest { +class SwitchLayerTreeFrameSinkIdTest : public ResourceRenderingTest { struct FrameInfo { - uint32_t compositor_frame_sink_id; + uint32_t layer_tree_frame_sink_id; cc::ResourceId resource_id; // Each frame contains a single resource. }; @@ -418,22 +418,22 @@ std::unique_ptr<content::SynchronousCompositor::Frame> frame( new content::SynchronousCompositor::Frame); - frame->compositor_frame_sink_id = - infos[frame_number].compositor_frame_sink_id; + frame->layer_tree_frame_sink_id = + infos[frame_number].layer_tree_frame_sink_id; frame->frame = ConstructFrame(infos[frame_number].resource_id); - if (last_compositor_frame_sink_id_ != - infos[frame_number].compositor_frame_sink_id) { + if (last_layer_tree_frame_sink_id_ != + infos[frame_number].layer_tree_frame_sink_id) { expected_return_count_.clear(); - last_compositor_frame_sink_id_ = - infos[frame_number].compositor_frame_sink_id; + last_layer_tree_frame_sink_id_ = + infos[frame_number].layer_tree_frame_sink_id; } ++expected_return_count_[infos[frame_number].resource_id]; return frame; } void StartTest() override { - last_compositor_frame_sink_id_ = -1U; + last_layer_tree_frame_sink_id_ = -1U; ResourceRenderingTest::StartTest(); } @@ -444,16 +444,16 @@ // Make sure resources for the last output surface are returned. EXPECT_EQ(expected_return_count_, - GetReturnedResourceCounts()[last_compositor_frame_sink_id_]); + GetReturnedResourceCounts()[last_layer_tree_frame_sink_id_]); EndTest(); } private: - uint32_t last_compositor_frame_sink_id_; + uint32_t last_layer_tree_frame_sink_id_; ResourceCountMap expected_return_count_; }; -RENDERING_TEST_F(SwitchCompositorFrameSinkIdTest); +RENDERING_TEST_F(SwitchLayerTreeFrameSinkIdTest); class RenderThreadManagerDeletionTest : public ResourceRenderingTest { std::unique_ptr<content::SynchronousCompositor::Frame> GetFrame( @@ -462,20 +462,20 @@ return nullptr; } - const uint32_t compositor_frame_sink_id = 0u; + const uint32_t layer_tree_frame_sink_id = 0u; const cc::ResourceId resource_id = static_cast<cc::ResourceId>(frame_number); std::unique_ptr<content::SynchronousCompositor::Frame> frame( new content::SynchronousCompositor::Frame); - frame->compositor_frame_sink_id = compositor_frame_sink_id; + frame->layer_tree_frame_sink_id = layer_tree_frame_sink_id; frame->frame = ConstructFrame(resource_id); - ++expected_return_count_[compositor_frame_sink_id][resource_id]; + ++expected_return_count_[layer_tree_frame_sink_id][resource_id]; return frame; } void CheckResults() override { - CompositorFrameSinkResourceCountMap resource_counts; + LayerTreeFrameSinkResourceCountMap resource_counts; functor_.reset(); // Make sure resources for the last frame are returned. EXPECT_EQ(expected_return_count_, GetReturnedResourceCounts()); @@ -483,7 +483,7 @@ } private: - CompositorFrameSinkResourceCountMap expected_return_count_; + LayerTreeFrameSinkResourceCountMap expected_return_count_; }; RENDERING_TEST_F(RenderThreadManagerDeletionTest); @@ -524,20 +524,20 @@ return nullptr; } - const uint32_t compositor_frame_sink_id = 0u; + const uint32_t layer_tree_frame_sink_id = 0u; const cc::ResourceId resource_id = static_cast<cc::ResourceId>(frame_number); std::unique_ptr<content::SynchronousCompositor::Frame> frame( new content::SynchronousCompositor::Frame); - frame->compositor_frame_sink_id = compositor_frame_sink_id; + frame->layer_tree_frame_sink_id = layer_tree_frame_sink_id; frame->frame = ConstructFrame(resource_id); - ++expected_return_count_[compositor_frame_sink_id][resource_id]; + ++expected_return_count_[layer_tree_frame_sink_id][resource_id]; return frame; } void CheckResults() override { - CompositorFrameSinkResourceCountMap resource_counts; + LayerTreeFrameSinkResourceCountMap resource_counts; functor_.reset(); // Make sure resources for all frames are returned. EXPECT_EQ(expected_return_count_, GetReturnedResourceCounts()); @@ -546,7 +546,7 @@ private: std::unique_ptr<FakeFunctor> saved_functor_; - CompositorFrameSinkResourceCountMap expected_return_count_; + LayerTreeFrameSinkResourceCountMap expected_return_count_; }; RENDERING_TEST_F(RenderThreadManagerSwitchTest);
diff --git a/android_webview/browser/child_frame.cc b/android_webview/browser/child_frame.cc index f0d639b..ce87860 100644 --- a/android_webview/browser/child_frame.cc +++ b/android_webview/browser/child_frame.cc
@@ -13,7 +13,7 @@ ChildFrame::ChildFrame( scoped_refptr<content::SynchronousCompositor::FrameFuture> frame_future, - uint32_t compositor_frame_sink_id, + uint32_t layer_tree_frame_sink_id, std::unique_ptr<cc::CompositorFrame> frame, const CompositorID& compositor_id, bool viewport_rect_for_tile_priority_empty, @@ -21,7 +21,7 @@ bool offscreen_pre_raster, bool is_layer) : frame_future(std::move(frame_future)), - compositor_frame_sink_id(compositor_frame_sink_id), + layer_tree_frame_sink_id(layer_tree_frame_sink_id), frame(std::move(frame)), compositor_id(compositor_id), viewport_rect_for_tile_priority_empty( @@ -41,7 +41,7 @@ DCHECK(!frame); auto frame_ptr = frame_future->GetFrame(); if (frame_ptr) { - compositor_frame_sink_id = frame_ptr->compositor_frame_sink_id; + layer_tree_frame_sink_id = frame_ptr->layer_tree_frame_sink_id; frame = std::move(frame_ptr->frame); } frame_future = nullptr;
diff --git a/android_webview/browser/child_frame.h b/android_webview/browser/child_frame.h index 5e88f21..e976bfc 100644 --- a/android_webview/browser/child_frame.h +++ b/android_webview/browser/child_frame.h
@@ -25,7 +25,7 @@ public: ChildFrame( scoped_refptr<content::SynchronousCompositor::FrameFuture> frame_future, - uint32_t compositor_frame_sink_id, + uint32_t layer_tree_frame_sink_id, std::unique_ptr<cc::CompositorFrame> frame, const CompositorID& compositor_id, bool viewport_rect_for_tile_priority_empty, @@ -41,7 +41,7 @@ // or |frame|. It's illegal if both are non-null. scoped_refptr<content::SynchronousCompositor::FrameFuture> frame_future; // These two fields are not const to make async path easier. - uint32_t compositor_frame_sink_id; + uint32_t layer_tree_frame_sink_id; std::unique_ptr<cc::CompositorFrame> frame; // The id of the compositor this |frame| comes from. const CompositorID compositor_id;
diff --git a/android_webview/browser/compositor_frame_consumer.h b/android_webview/browser/compositor_frame_consumer.h index 600ae42..d1cb24b3 100644 --- a/android_webview/browser/compositor_frame_consumer.h +++ b/android_webview/browser/compositor_frame_consumer.h
@@ -25,7 +25,7 @@ ReturnedResources(); ~ReturnedResources(); - uint32_t compositor_frame_sink_id; + uint32_t layer_tree_frame_sink_id; cc::ReturnedResourceArray resources; }; using ReturnedResourcesMap =
diff --git a/android_webview/browser/hardware_renderer.cc b/android_webview/browser/hardware_renderer.cc index 95ca24a..f88749b 100644 --- a/android_webview/browser/hardware_renderer.cc +++ b/android_webview/browser/hardware_renderer.cc
@@ -30,8 +30,8 @@ frame_sink_id_(surfaces_->AllocateFrameSinkId()), local_surface_id_allocator_( base::MakeUnique<cc::LocalSurfaceIdAllocator>()), - last_committed_compositor_frame_sink_id_(0u), - last_submitted_compositor_frame_sink_id_(0u) { + last_committed_layer_tree_frame_sink_id_(0u), + last_submitted_layer_tree_frame_sink_id_(0u) { DCHECK(last_egl_context_); surfaces_->GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_); CreateNewCompositorFrameSinkSupport(); @@ -85,8 +85,8 @@ child_frame_queue_.clear(); } if (child_frame_) { - last_committed_compositor_frame_sink_id_ = - child_frame_->compositor_frame_sink_id; + last_committed_layer_tree_frame_sink_id_ = + child_frame_->layer_tree_frame_sink_id; } // We need to watch if the current Android context has changed and enforce @@ -104,15 +104,15 @@ // unnecessary kModeProcess. if (child_frame_.get() && child_frame_->frame.get()) { if (!compositor_id_.Equals(child_frame_->compositor_id) || - last_submitted_compositor_frame_sink_id_ != - child_frame_->compositor_frame_sink_id) { + last_submitted_layer_tree_frame_sink_id_ != + child_frame_->layer_tree_frame_sink_id) { if (child_id_.is_valid()) DestroySurface(); CreateNewCompositorFrameSinkSupport(); compositor_id_ = child_frame_->compositor_id; - last_submitted_compositor_frame_sink_id_ = - child_frame_->compositor_frame_sink_id; + last_submitted_layer_tree_frame_sink_id_ = + child_frame_->layer_tree_frame_sink_id; } std::unique_ptr<cc::CompositorFrame> child_compositor_frame = @@ -178,7 +178,7 @@ void HardwareRenderer::DidReceiveCompositorFrameAck( const cc::ReturnedResourceArray& resources) { ReturnResourcesToCompositor(resources, compositor_id_, - last_submitted_compositor_frame_sink_id_); + last_submitted_layer_tree_frame_sink_id_); } void HardwareRenderer::OnBeginFrame(const cc::BeginFrameArgs& args) { @@ -188,7 +188,7 @@ void HardwareRenderer::ReclaimResources( const cc::ReturnedResourceArray& resources) { ReturnResourcesToCompositor(resources, compositor_id_, - last_submitted_compositor_frame_sink_id_); + last_submitted_layer_tree_frame_sink_id_); } void HardwareRenderer::WillDrawSurface( @@ -244,17 +244,17 @@ // The child frame's compositor id is not necessarily same as // compositor_id_. ReturnResourcesToCompositor(resources_to_return, child_frame->compositor_id, - child_frame->compositor_frame_sink_id); + child_frame->layer_tree_frame_sink_id); } void HardwareRenderer::ReturnResourcesToCompositor( const cc::ReturnedResourceArray& resources, const CompositorID& compositor_id, - uint32_t compositor_frame_sink_id) { - if (compositor_frame_sink_id != last_committed_compositor_frame_sink_id_) + uint32_t layer_tree_frame_sink_id) { + if (layer_tree_frame_sink_id != last_committed_layer_tree_frame_sink_id_) return; render_thread_manager_->InsertReturnedResourcesOnRT(resources, compositor_id, - compositor_frame_sink_id); + layer_tree_frame_sink_id); } void HardwareRenderer::CreateNewCompositorFrameSinkSupport() {
diff --git a/android_webview/browser/hardware_renderer.h b/android_webview/browser/hardware_renderer.h index a99fb73..a6836bf 100644 --- a/android_webview/browser/hardware_renderer.h +++ b/android_webview/browser/hardware_renderer.h
@@ -60,7 +60,7 @@ void ReturnChildFrame(std::unique_ptr<ChildFrame> child_frame); void ReturnResourcesToCompositor(const cc::ReturnedResourceArray& resources, const CompositorID& compositor_id, - uint32_t compositor_frame_sink_id); + uint32_t layer_tree_frame_sink_id); void AllocateSurface(); void DestroySurface(); @@ -94,10 +94,10 @@ cc::LocalSurfaceId child_id_; CompositorID compositor_id_; // HardwareRenderer guarantees resources are returned in the order of - // compositor_frame_sink_id, and resources for old output surfaces are + // layer_tree_frame_sink_id, and resources for old output surfaces are // dropped. - uint32_t last_committed_compositor_frame_sink_id_; - uint32_t last_submitted_compositor_frame_sink_id_; + uint32_t last_committed_layer_tree_frame_sink_id_; + uint32_t last_submitted_layer_tree_frame_sink_id_; DISALLOW_COPY_AND_ASSIGN(HardwareRenderer); };
diff --git a/android_webview/browser/render_thread_manager.cc b/android_webview/browser/render_thread_manager.cc index 9070cc9..8faa8eb 100644 --- a/android_webview/browser/render_thread_manager.cc +++ b/android_webview/browser/render_thread_manager.cc
@@ -260,23 +260,23 @@ } RenderThreadManager::ReturnedResources::ReturnedResources() - : compositor_frame_sink_id(0u) {} + : layer_tree_frame_sink_id(0u) {} RenderThreadManager::ReturnedResources::~ReturnedResources() {} void RenderThreadManager::InsertReturnedResourcesOnRT( const cc::ReturnedResourceArray& resources, const CompositorID& compositor_id, - uint32_t compositor_frame_sink_id) { + uint32_t layer_tree_frame_sink_id) { base::AutoLock lock(lock_); ReturnedResources& returned_resources = returned_resources_map_[compositor_id]; - if (returned_resources.compositor_frame_sink_id != compositor_frame_sink_id) { + if (returned_resources.layer_tree_frame_sink_id != layer_tree_frame_sink_id) { returned_resources.resources.clear(); } returned_resources.resources.insert(returned_resources.resources.end(), resources.begin(), resources.end()); - returned_resources.compositor_frame_sink_id = compositor_frame_sink_id; + returned_resources.layer_tree_frame_sink_id = layer_tree_frame_sink_id; } void RenderThreadManager::SwapReturnedResourcesOnUI(
diff --git a/android_webview/browser/render_thread_manager.h b/android_webview/browser/render_thread_manager.h index e93c4b8..fe335d36 100644 --- a/android_webview/browser/render_thread_manager.h +++ b/android_webview/browser/render_thread_manager.h
@@ -66,7 +66,7 @@ const ParentCompositorDrawConstraints& parent_draw_constraints); void InsertReturnedResourcesOnRT(const cc::ReturnedResourceArray& resources, const CompositorID& compositor_id, - uint32_t compositor_frame_sink_id); + uint32_t layer_tree_frame_sink_id); private: friend class internal::RequestInvokeGLTracker;
diff --git a/android_webview/tools/system_webview_shell/test/data/webexposed/global-interface-listing-expected.txt b/android_webview/tools/system_webview_shell/test/data/webexposed/global-interface-listing-expected.txt index dcee1c8..f29be24 100644 --- a/android_webview/tools/system_webview_shell/test/data/webexposed/global-interface-listing-expected.txt +++ b/android_webview/tools/system_webview_shell/test/data/webexposed/global-interface-listing-expected.txt
@@ -5166,7 +5166,8 @@ getter animationName getter elapsedTime method constructor -interface WebKitCSSMatrix +interface WebKitCSSMatrix : DOMMatrixReadOnly + attribute @@toStringTag getter a getter b getter c @@ -5190,16 +5191,18 @@ getter m43 getter m44 method constructor - method inverse - method multiply - method rotate - method rotateAxisAngle - method scale + method invertSelf + method multiplySelf + method preMultiplySelf + method rotateAxisAngleSelf + method rotateFromVectorSelf + method rotateSelf + method scale3dSelf + method scaleSelf method setMatrixValue - method skewX - method skewY - method toString - method translate + method skewXSelf + method skewYSelf + method translateSelf setter a setter b setter c
diff --git a/ash/ime/ime_controller.cc b/ash/ime/ime_controller.cc index 35d2e91..b73c8bf8 100644 --- a/ash/ime/ime_controller.cc +++ b/ash/ime/ime_controller.cc
@@ -46,15 +46,27 @@ } // mojom::ImeController: -void ImeController::RefreshIme(mojom::ImeInfoPtr current_ime, +void ImeController::RefreshIme(const std::string& current_ime_id, std::vector<mojom::ImeInfoPtr> available_imes, std::vector<mojom::ImeMenuItemPtr> menu_items) { - current_ime_ = *current_ime; + if (current_ime_id.empty()) + current_ime_ = mojom::ImeInfo(); available_imes_.clear(); available_imes_.reserve(available_imes.size()); - for (const auto& ime : available_imes) + for (const auto& ime : available_imes) { + if (ime->id.empty()) { + DLOG(ERROR) << "Received IME with invalid ID."; + continue; + } available_imes_.push_back(*ime); + if (ime->id == current_ime_id) + current_ime_ = *ime; + } + + // Either there is no current IME or we found a valid one in the list of + // available IMEs. + DCHECK(current_ime_id.empty() || !current_ime_.id.empty()); current_ime_menu_items_.clear(); current_ime_menu_items_.reserve(menu_items.size());
diff --git a/ash/ime/ime_controller.h b/ash/ime/ime_controller.h index 744a543e..ce967bbc 100644 --- a/ash/ime/ime_controller.h +++ b/ash/ime/ime_controller.h
@@ -51,7 +51,7 @@ // mojom::ImeController: void SetClient(mojom::ImeControllerClientPtr client) override; - void RefreshIme(mojom::ImeInfoPtr current_ime, + void RefreshIme(const std::string& current_ime_id, std::vector<mojom::ImeInfoPtr> available_imes, std::vector<mojom::ImeMenuItemPtr> menu_items) override; void SetImesManagedByPolicy(bool managed) override; @@ -64,6 +64,7 @@ // Client interface back to IME code in chrome. mojom::ImeControllerClientPtr client_; + // Copy of the current IME so we can return it by reference. mojom::ImeInfo current_ime_; // "Available" IMEs are both installed and enabled by the user in settings.
diff --git a/ash/ime/ime_controller_unittest.cc b/ash/ime/ime_controller_unittest.cc index 19ef8af0..d6716cf 100644 --- a/ash/ime/ime_controller_unittest.cc +++ b/ash/ime/ime_controller_unittest.cc
@@ -52,7 +52,7 @@ std::vector<mojom::ImeMenuItemPtr> menu_items; menu_items.push_back(item1.Clone()); - controller->RefreshIme(std::move(ime1), std::move(available_imes), + controller->RefreshIme("ime1", std::move(available_imes), std::move(menu_items)); // Cached data was updated. @@ -67,6 +67,27 @@ EXPECT_EQ(1, observer.refresh_count_); } +TEST_F(ImeControllerTest, NoCurrentIme) { + ImeController* controller = Shell::Get()->ime_controller(); + + // Set up a single IME. + mojom::ImeInfoPtr ime1 = mojom::ImeInfo::New(); + ime1->id = "ime1"; + std::vector<mojom::ImeInfoPtr> available_imes1; + available_imes1.push_back(ime1.Clone()); + controller->RefreshIme("ime1", std::move(available_imes1), + std::vector<mojom::ImeMenuItemPtr>()); + EXPECT_EQ("ime1", controller->current_ime().id); + + // When there is no current IME the cached current IME is empty. + std::vector<mojom::ImeInfoPtr> available_imes2; + available_imes2.push_back(ime1.Clone()); + const std::string empty_ime_id; + controller->RefreshIme(empty_ime_id, std::move(available_imes2), + std::vector<mojom::ImeMenuItemPtr>()); + EXPECT_TRUE(controller->current_ime().id.empty()); +} + TEST_F(ImeControllerTest, SetImesManagedByPolicy) { ImeController* controller = Shell::Get()->ime_controller(); TestImeObserver observer;
diff --git a/ash/laser/laser_pointer_view.cc b/ash/laser/laser_pointer_view.cc index 56cecc0..23e9ae87 100644 --- a/ash/laser/laser_pointer_view.cc +++ b/ash/laser/laser_pointer_view.cc
@@ -22,9 +22,9 @@ #include "base/threading/thread_task_runner_handle.h" #include "base/trace_event/trace_event.h" #include "cc/output/compositor_frame.h" -#include "cc/output/compositor_frame_sink.h" -#include "cc/output/compositor_frame_sink_client.h" #include "cc/output/context_provider.h" +#include "cc/output/layer_tree_frame_sink.h" +#include "cc/output/layer_tree_frame_sink_client.h" #include "cc/quads/texture_draw_quad.h" #include "cc/resources/texture_mailbox.h" #include "cc/resources/transferable_resource.h" @@ -184,24 +184,22 @@ DISALLOW_COPY_AND_ASSIGN(LaserSegment); }; -class LaserCompositorFrameSinkHolder : public cc::CompositorFrameSinkClient { +class LaserLayerTreeFrameSinkHolder : public cc::LayerTreeFrameSinkClient { public: - LaserCompositorFrameSinkHolder( + LaserLayerTreeFrameSinkHolder( LaserPointerView* view, - std::unique_ptr<cc::CompositorFrameSink> frame_sink) + std::unique_ptr<cc::LayerTreeFrameSink> frame_sink) : view_(view), frame_sink_(std::move(frame_sink)) { frame_sink_->BindToClient(this); } - ~LaserCompositorFrameSinkHolder() override { - frame_sink_->DetachFromClient(); - } + ~LaserLayerTreeFrameSinkHolder() override { frame_sink_->DetachFromClient(); } - cc::CompositorFrameSink* frame_sink() { return frame_sink_.get(); } + cc::LayerTreeFrameSink* frame_sink() { return frame_sink_.get(); } // Called before laser pointer view is destroyed. void OnLaserPointerViewDestroying() { view_ = nullptr; } - // Overridden from cc::CompositorFrameSinkClient: + // Overridden from cc::LayerTreeFrameSinkClient: void SetBeginFrameSource(cc::BeginFrameSource* source) override {} void ReclaimResources(const cc::ReturnedResourceArray& resources) override { if (view_) @@ -212,7 +210,7 @@ if (view_) view_->DidReceiveCompositorFrameAck(); } - void DidLoseCompositorFrameSink() override {} + void DidLoseLayerTreeFrameSink() override {} void OnDraw(const gfx::Transform& transform, const gfx::Rect& viewport, bool resourceless_software_draw) override {} @@ -223,9 +221,9 @@ private: LaserPointerView* view_; - std::unique_ptr<cc::CompositorFrameSink> frame_sink_; + std::unique_ptr<cc::LayerTreeFrameSink> frame_sink_; - DISALLOW_COPY_AND_ASSIGN(LaserCompositorFrameSinkHolder); + DISALLOW_COPY_AND_ASSIGN(LaserLayerTreeFrameSinkHolder); }; // This struct contains the resources associated with a laser pointer frame. @@ -274,8 +272,8 @@ scale_factor_ = ui::GetScaleFactorForNativeView(widget_->GetNativeView()); - frame_sink_holder_ = base::MakeUnique<LaserCompositorFrameSinkHolder>( - this, widget_->GetNativeView()->CreateCompositorFrameSink()); + frame_sink_holder_ = base::MakeUnique<LaserLayerTreeFrameSinkHolder>( + this, widget_->GetNativeView()->CreateLayerTreeFrameSink()); } LaserPointerView::~LaserPointerView() {
diff --git a/ash/laser/laser_pointer_view.h b/ash/laser/laser_pointer_view.h index 7096431..fd8df67 100644 --- a/ash/laser/laser_pointer_view.h +++ b/ash/laser/laser_pointer_view.h
@@ -29,7 +29,7 @@ } namespace ash { -class LaserCompositorFrameSinkHolder; +class LaserLayerTreeFrameSinkHolder; struct LaserResource; // LaserPointerView displays the palette tool laser pointer. It draws the laser, @@ -74,7 +74,7 @@ gfx::Rect surface_damage_rect_; bool needs_update_surface_ = false; bool pending_draw_surface_ = false; - std::unique_ptr<LaserCompositorFrameSinkHolder> frame_sink_holder_; + std::unique_ptr<LaserLayerTreeFrameSinkHolder> frame_sink_holder_; int next_resource_id_ = 1; base::flat_map<int, std::unique_ptr<LaserResource>> resources_; std::vector<std::unique_ptr<LaserResource>> returned_resources_;
diff --git a/ash/login/lock_screen_controller.cc b/ash/login/lock_screen_controller.cc index 5f863dc..00172eb 100644 --- a/ash/login/lock_screen_controller.cc +++ b/ash/login/lock_screen_controller.cc
@@ -48,13 +48,14 @@ NOTIMPLEMENTED(); } -void LockScreenController::SetAuthType(const AccountId& account_id, - mojom::AuthType auth_type, - const base::string16& initial_value) { +void LockScreenController::SetAuthType( + const AccountId& account_id, + proximity_auth::mojom::AuthType auth_type, + const base::string16& initial_value) { NOTIMPLEMENTED(); } -void LockScreenController::LoadUsers(std::unique_ptr<base::ListValue> users, +void LockScreenController::LoadUsers(std::vector<mojom::LoginUserInfoPtr> users, bool show_guest) { NOTIMPLEMENTED(); }
diff --git a/ash/login/lock_screen_controller.h b/ash/login/lock_screen_controller.h index bff4f129..b832563 100644 --- a/ash/login/lock_screen_controller.h +++ b/ash/login/lock_screen_controller.h
@@ -40,9 +40,9 @@ mojom::UserPodCustomIconOptionsPtr icon) override; void HideUserPodCustomIcon(const AccountId& account_id) override; void SetAuthType(const AccountId& account_id, - mojom::AuthType auth_type, + proximity_auth::mojom::AuthType auth_type, const base::string16& initial_value) override; - void LoadUsers(std::unique_ptr<base::ListValue> users, + void LoadUsers(std::vector<mojom::LoginUserInfoPtr> users, bool show_guest) override; void SetPinEnabledForUser(const AccountId& account_id, bool is_enabled) override;
diff --git a/ash/public/interfaces/BUILD.gn b/ash/public/interfaces/BUILD.gn index 1d8da270..9c7c601 100644 --- a/ash/public/interfaces/BUILD.gn +++ b/ash/public/interfaces/BUILD.gn
@@ -21,6 +21,7 @@ "ime_info.mojom", "locale.mojom", "lock_screen.mojom", + "login_user_info.mojom", "media.mojom", "new_window.mojom", "night_light_controller.mojom", @@ -40,6 +41,7 @@ ] public_deps = [ + "//components/proximity_auth/public/interfaces", "//components/signin/public/interfaces", "//mojo/common:common_custom_types", "//skia/public/interfaces",
diff --git a/ash/public/interfaces/ime_controller.mojom b/ash/public/interfaces/ime_controller.mojom index 65dd3b9..549e5966 100644 --- a/ash/public/interfaces/ime_controller.mojom +++ b/ash/public/interfaces/ime_controller.mojom
@@ -12,9 +12,8 @@ SetClient(ImeControllerClient client); // Updates the cached IME information and refreshes the IME menus. - // |current_ime| has an empty ID when there is no active IME yet. - // TODO(jamescook): Convert |current_ime| to an ID instead of an IMEInfo. - RefreshIme(ImeInfo current_ime, + // |current_ime_id| is empty when there is no active IME yet. + RefreshIme(string current_ime_id, array<ImeInfo> available_imes, array<ImeMenuItem> menu_items);
diff --git a/ash/public/interfaces/ime_info.mojom b/ash/public/interfaces/ime_info.mojom index 3d8ca018..011fd45 100644 --- a/ash/public/interfaces/ime_info.mojom +++ b/ash/public/interfaces/ime_info.mojom
@@ -8,10 +8,6 @@ // Metadata about an installed input method. struct ImeInfo { - // True if the IME is the current IME. - // TODO(jamescook): Remove this and use ImeController::current_ime(). - bool selected; - // True if the IME is a third-party extension. bool third_party;
diff --git a/ash/public/interfaces/lock_screen.mojom b/ash/public/interfaces/lock_screen.mojom index 0947cf4..4a91f777 100644 --- a/ash/public/interfaces/lock_screen.mojom +++ b/ash/public/interfaces/lock_screen.mojom
@@ -4,30 +4,10 @@ module ash.mojom; +import "ash/public/interfaces/login_user_info.mojom"; +import "components/proximity_auth/public/interfaces/auth_type.mojom"; import "components/signin/public/interfaces/account_id.mojom"; import "mojo/common/string16.mojom"; -import "mojo/common/values.mojom"; - -// Supported authentication types. Keep in sync with enum in -// screenlock_bridge.h -enum AuthType { - OFFLINE_PASSWORD, - ONLINE_SIGN_IN, - NUMERIC_PIN, - USER_CLICK, - EXPAND_THEN_USER_CLICK, - FORCE_OFFLINE_PASSWORD, -}; - -// Information about the custom icon in the user pod. -struct UserPodCustomIconOptions { - string id; - mojo.common.mojom.String16 tooltip; - bool autoshow_tooltip; - mojo.common.mojom.String16 aria_label; - bool hardlock_on_click; - bool is_trial_run; -}; // Allows clients (e.g. Chrome browser) to control the ash lock screen. interface LockScreen { @@ -68,16 +48,13 @@ // |auth_type|: Authentication type. // |initial_value|: A message shown in the password field of the user pod. SetAuthType(signin.mojom.AccountId account_id, - AuthType auth_type, + proximity_auth.mojom.AuthType auth_type, mojo.common.mojom.String16 initial_value); // Requests to load users in the lock screen. - // TODO: create a mojo struct for |users|, this contains user information - // for login/lock screen, some of which might not be needed for the new - // view-based UI. See crbug.com/729687. // |users|: A list of users who can unlock the device. // |show_guest|: Whether to show guest session button. - LoadUsers(mojo.common.mojom.ListValue users, bool show_guest); + LoadUsers(array<LoginUserInfo> users, bool show_guest); // Notification if pin is enabled or disabled for the given user. // |account_id|: The account id of the user in the user pod.
diff --git a/ash/public/interfaces/login_user_info.mojom b/ash/public/interfaces/login_user_info.mojom new file mode 100644 index 0000000..36e1daa5 --- /dev/null +++ b/ash/public/interfaces/login_user_info.mojom
@@ -0,0 +1,55 @@ +// 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 ash.mojom; + +import "ash/public/interfaces/user_info.mojom"; +import "components/proximity_auth/public/interfaces/auth_type.mojom"; +import "mojo/common/string16.mojom"; + +// Supported multi-profile user behavior values. +// Keep in sync with the enum in md_user_pod_row.js and user_pod_row.js +enum MultiProfileUserBehavior { + UNRESTRICTED = 0, + PRIMARY_ONLY = 1, + NOT_ALLOWED = 2, + OWNER_PRIMARY_ONLY = 3, +}; + +// Information about the custom icon in the user pod. +struct UserPodCustomIconOptions { + string id; + mojo.common.mojom.String16 tooltip; + bool autoshow_tooltip; + mojo.common.mojom.String16 aria_label; + bool hardlock_on_click; + bool is_trial_run; +}; + +// Info about a user in login/lock screen. +struct LoginUserInfo { + // User's basic information including account id, email, avatar etc. + UserInfo basic_user_info; + + // What method the user can use to sign in. + proximity_auth.mojom.AuthType auth_type; + + // True if this user has already signed in. + bool is_signed_in; + + // True if this user is the device owner. + bool is_device_owner; + + // True if fingerprint unlock is allowed for this user. + bool allow_fingerprint_unlock; + + // True if multi-profiles sign in is allowed for this user. + bool is_multiprofile_allowed; + + // Enforced policy for multi-profiles sign in. + MultiProfileUserBehavior multiprofile_policy; + + // True if this user can be removed. + bool can_remove; +};
diff --git a/ash/system/ime/tray_ime_chromeos.cc b/ash/system/ime/tray_ime_chromeos.cc index d79c7642..26baa3b 100644 --- a/ash/system/ime/tray_ime_chromeos.cc +++ b/ash/system/ime/tray_ime_chromeos.cc
@@ -86,12 +86,13 @@ return controlled_setting_icon_; } - void Update(const std::vector<mojom::ImeInfo>& list, + void Update(const std::string& current_ime_id, + const std::vector<mojom::ImeInfo>& list, const std::vector<mojom::ImeMenuItem>& property_list, bool show_keyboard_toggle, SingleImeBehavior single_ime_behavior) override { - ImeListView::Update(list, property_list, show_keyboard_toggle, - single_ime_behavior); + ImeListView::Update(current_ime_id, list, property_list, + show_keyboard_toggle, single_ime_behavior); CreateTitleRow(IDS_ASH_STATUS_TRAY_IME); } @@ -187,7 +188,8 @@ default_->UpdateLabel(GetDefaultViewLabel(ime_count > 1)); } if (detailed_) { - detailed_->Update(ime_controller_->available_imes(), + detailed_->Update(ime_controller_->current_ime().id, + ime_controller_->available_imes(), ime_controller_->current_ime_menu_items(), ShouldShowKeyboardToggle(), GetSingleImeBehavior()); }
diff --git a/ash/system/ime/tray_ime_chromeos_unittest.cc b/ash/system/ime/tray_ime_chromeos_unittest.cc index ffc570c..7b65293 100644 --- a/ash/system/ime/tray_ime_chromeos_unittest.cc +++ b/ash/system/ime/tray_ime_chromeos_unittest.cc
@@ -15,6 +15,7 @@ #include "ash/system/ime_menu/ime_list_view.h" #include "ash/system/tray/system_tray_notifier.h" #include "ash/test/ash_test_base.h" +#include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "ui/events/devices/device_data_manager.h" #include "ui/keyboard/keyboard_util.h" @@ -84,6 +85,8 @@ void TrayIMETest::SetActiveImeCount(int count) { available_imes_.resize(count); + for (int i = 0; i < count; ++i) + available_imes_[i].id = base::IntToString(i); RefreshImeController(); } @@ -144,8 +147,6 @@ } void TrayIMETest::RefreshImeController() { - mojom::ImeInfoPtr current_ime_ptr = current_ime_.Clone(); - std::vector<mojom::ImeInfoPtr> available_ime_ptrs; for (const auto& ime : available_imes_) available_ime_ptrs.push_back(ime.Clone()); @@ -154,7 +155,7 @@ for (const auto& item : menu_items_) menu_item_ptrs.push_back(item.Clone()); - Shell::Get()->ime_controller()->RefreshIme(std::move(current_ime_ptr), + Shell::Get()->ime_controller()->RefreshIme(current_ime_.id, std::move(available_ime_ptrs), std::move(menu_item_ptrs)); }
diff --git a/ash/system/ime_menu/ime_list_view.cc b/ash/system/ime_menu/ime_list_view.cc index 83c692b..51f46ed 100644 --- a/ash/system/ime_menu/ime_list_view.cc +++ b/ash/system/ime_menu/ime_list_view.cc
@@ -196,12 +196,13 @@ void ImeListView::Init(bool show_keyboard_toggle, SingleImeBehavior single_ime_behavior) { ImeController* ime_controller = Shell::Get()->ime_controller(); - Update(ime_controller->available_imes(), + Update(ime_controller->current_ime().id, ime_controller->available_imes(), ime_controller->current_ime_menu_items(), show_keyboard_toggle, single_ime_behavior); } -void ImeListView::Update(const std::vector<mojom::ImeInfo>& list, +void ImeListView::Update(const std::string& current_ime_id, + const std::vector<mojom::ImeInfo>& list, const std::vector<mojom::ImeMenuItem>& property_items, bool show_keyboard_toggle, SingleImeBehavior single_ime_behavior) { @@ -211,7 +212,7 @@ CreateScrollableList(); if (single_ime_behavior == ImeListView::SHOW_SINGLE_IME || list.size() > 1) - AppendImeListAndProperties(list, property_items); + AppendImeListAndProperties(current_ime_id, list, property_items); if (show_keyboard_toggle) PrependKeyboardStatusRow(); @@ -247,21 +248,23 @@ } void ImeListView::AppendImeListAndProperties( + const std::string& current_ime_id, const std::vector<mojom::ImeInfo>& list, const std::vector<mojom::ImeMenuItem>& property_list) { DCHECK(ime_map_.empty()); for (size_t i = 0; i < list.size(); i++) { + const bool selected = current_ime_id == list[i].id; views::View* ime_view = new ImeListItemView(owner(), this, list[i].short_name, list[i].name, - list[i].selected, gfx::kGoogleGreen700); + selected, gfx::kGoogleGreen700); scroll_content()->AddChildView(ime_view); ime_map_[ime_view] = list[i].id; - if (list[i].selected) + if (selected) current_ime_view_ = ime_view; // Add the properties, if any, of the currently-selected IME. - if (list[i].selected && !property_list.empty()) { + if (selected && !property_list.empty()) { // Adds a separator on the top of property items. scroll_content()->AddChildView( TrayPopupUtils::CreateListItemSeparator(true));
diff --git a/ash/system/ime_menu/ime_list_view.h b/ash/system/ime_menu/ime_list_view.h index 2ac88033..7a430236 100644 --- a/ash/system/ime_menu/ime_list_view.h +++ b/ash/system/ime_menu/ime_list_view.h
@@ -40,7 +40,8 @@ void Init(bool show_keyboard_toggle, SingleImeBehavior single_ime_behavior); // Updates the view. - virtual void Update(const std::vector<mojom::ImeInfo>& list, + virtual void Update(const std::string& current_ime_id, + const std::vector<mojom::ImeInfo>& list, const std::vector<mojom::ImeMenuItem>& property_items, bool show_keyboard_toggle, SingleImeBehavior single_ime_behavior); @@ -81,6 +82,7 @@ // Appends the IMEs and properties to the IME menu's scrollable area. void AppendImeListAndProperties( + const std::string& current_ime_id, const std::vector<mojom::ImeInfo>& list, const std::vector<mojom::ImeMenuItem>& property_items);
diff --git a/ash/system/ime_menu/ime_menu_tray.cc b/ash/system/ime_menu/ime_menu_tray.cc index de4071a6..d41378ac 100644 --- a/ash/system/ime_menu/ime_menu_tray.cc +++ b/ash/system/ime_menu/ime_menu_tray.cc
@@ -445,7 +445,8 @@ void ImeMenuTray::OnIMERefresh() { UpdateTrayLabel(); if (bubble_ && ime_list_view_) { - ime_list_view_->Update(ime_controller_->available_imes(), + ime_list_view_->Update(ime_controller_->current_ime().id, + ime_controller_->available_imes(), ime_controller_->current_ime_menu_items(), false, ImeListView::SHOW_SINGLE_IME); }
diff --git a/ash/system/ime_menu/ime_menu_tray_unittest.cc b/ash/system/ime_menu/ime_menu_tray_unittest.cc index 818e629..a73eb10 100644 --- a/ash/system/ime_menu/ime_menu_tray_unittest.cc +++ b/ash/system/ime_menu/ime_menu_tray_unittest.cc
@@ -32,14 +32,13 @@ return StatusAreaWidgetTestHelper::GetStatusAreaWidget()->ime_menu_tray(); } -void SetCurrentIme(mojom::ImeInfo current_ime, +void SetCurrentIme(const std::string& current_ime_id, const std::vector<mojom::ImeInfo>& available_imes) { - mojom::ImeInfoPtr current_ime_ptr = current_ime.Clone(); std::vector<mojom::ImeInfoPtr> available_ime_ptrs; for (const auto& ime : available_imes) available_ime_ptrs.push_back(ime.Clone()); Shell::Get()->ime_controller()->RefreshIme( - std::move(current_ime_ptr), std::move(available_ime_ptrs), + current_ime_id, std::move(available_ime_ptrs), std::vector<mojom::ImeMenuItemPtr>()); } @@ -131,14 +130,11 @@ info2.third_party = true; // Changes the input method to "ime1". - info1.selected = true; - SetCurrentIme(info1, {info1, info2}); + SetCurrentIme("ime1", {info1, info2}); EXPECT_EQ(UTF8ToUTF16("US"), GetTrayText()); // Changes the input method to a third-party IME extension. - info1.selected = false; - info2.selected = true; - SetCurrentIme(info2, {info1, info2}); + SetCurrentIme("ime2", {info1, info2}); EXPECT_EQ(UTF8ToUTF16("UK*"), GetTrayText()); } @@ -195,33 +191,28 @@ info1.medium_name = UTF8ToUTF16("English"); info1.short_name = UTF8ToUTF16("US"); info1.third_party = false; - info1.selected = true; info2.id = "ime2"; info2.name = UTF8ToUTF16("English UK"); info2.medium_name = UTF8ToUTF16("English UK"); info2.short_name = UTF8ToUTF16("UK"); info2.third_party = true; - info2.selected = false; info3.id = "ime3"; info3.name = UTF8ToUTF16("Pinyin"); info3.medium_name = UTF8ToUTF16("Chinese Pinyin"); info3.short_name = UTF8ToUTF16("拼"); info3.third_party = false; - info3.selected = false; std::vector<mojom::ImeInfo> ime_info_list{info1, info2, info3}; // Switch to ime1. - SetCurrentIme(info1, ime_info_list); + SetCurrentIme("ime1", ime_info_list); EXPECT_EQ(UTF8ToUTF16("US"), GetTrayText()); ExpectValidImeList(ime_info_list, info1); // Switch to ime3. - ime_info_list[0].selected = false; - ime_info_list[2].selected = true; - SetCurrentIme(info3, ime_info_list); + SetCurrentIme("ime3", ime_info_list); EXPECT_EQ(UTF8ToUTF16("拼"), GetTrayText()); ExpectValidImeList(ime_info_list, info3);
diff --git a/base/BUILD.gn b/base/BUILD.gn index 85a9631..1a3174b 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn
@@ -1196,7 +1196,7 @@ # Allow more direct string conversions on platforms with native utf8 # strings - if (is_mac || is_ios || is_chromeos || is_chromecast) { + if (is_mac || is_ios || is_chromeos || is_chromecast || is_fuchsia) { defines += [ "SYSTEM_NATIVE_UTF8" ] } @@ -2323,7 +2323,7 @@ # Allow more direct string conversions on platforms with native utf8 # strings - if (is_mac || is_ios || is_chromeos || is_chromecast) { + if (is_mac || is_ios || is_chromeos || is_chromecast || is_fuchsia) { defines += [ "SYSTEM_NATIVE_UTF8" ] }
diff --git a/base/memory/ref_counted.cc b/base/memory/ref_counted.cc index f85ba5e..bc8bd5f 100644 --- a/base/memory/ref_counted.cc +++ b/base/memory/ref_counted.cc
@@ -28,31 +28,6 @@ #endif } -void RefCountedThreadSafeBase::AddRef() const { -#if DCHECK_IS_ON() - DCHECK(!in_dtor_); - DCHECK(!needs_adopt_ref_) - << "This RefCounted object is created with non-zero reference count." - << " The first reference to such a object has to be made by AdoptRef or" - << " MakeRefCounted."; -#endif - AtomicRefCountInc(&ref_count_); -} - -bool RefCountedThreadSafeBase::Release() const { -#if DCHECK_IS_ON() - DCHECK(!in_dtor_); - DCHECK(!AtomicRefCountIsZero(&ref_count_)); -#endif - if (!AtomicRefCountDec(&ref_count_)) { -#if DCHECK_IS_ON() - in_dtor_ = true; -#endif - return true; - } - return false; -} - #if DCHECK_IS_ON() bool RefCountedBase::CalledOnValidSequence() const { return sequence_checker_.CalledOnValidSequence() ||
diff --git a/base/memory/ref_counted.h b/base/memory/ref_counted.h index 6c363cc..3695f87b 100644 --- a/base/memory/ref_counted.h +++ b/base/memory/ref_counted.h
@@ -142,10 +142,31 @@ ~RefCountedThreadSafeBase(); - void AddRef() const; + void AddRef() const { +#if DCHECK_IS_ON() + DCHECK(!in_dtor_); + DCHECK(!needs_adopt_ref_) + << "This RefCounted object is created with non-zero reference count." + << " The first reference to such a object has to be made by AdoptRef or" + << " MakeRefCounted."; +#endif + AtomicRefCountInc(&ref_count_); + } // Returns true if the object should self-delete. - bool Release() const; + bool Release() const { +#if DCHECK_IS_ON() + DCHECK(!in_dtor_); + DCHECK(!AtomicRefCountIsZero(&ref_count_)); +#endif + if (!AtomicRefCountDec(&ref_count_)) { +#if DCHECK_IS_ON() + in_dtor_ = true; +#endif + return true; + } + return false; + } private: template <typename U>
diff --git a/base/metrics/bucket_ranges.cc b/base/metrics/bucket_ranges.cc index 084cdd3..f995d7c 100644 --- a/base/metrics/bucket_ranges.cc +++ b/base/metrics/bucket_ranges.cc
@@ -109,12 +109,6 @@ BucketRanges::~BucketRanges() {} -void BucketRanges::set_range(size_t i, HistogramBase::Sample value) { - DCHECK_LT(i, ranges_.size()); - CHECK_GE(value, 0); - ranges_[i] = value; -} - uint32_t BucketRanges::CalculateChecksum() const { // Seed checksum. uint32_t checksum = static_cast<uint32_t>(ranges_.size());
diff --git a/base/metrics/bucket_ranges.h b/base/metrics/bucket_ranges.h index db82e552..578119f 100644 --- a/base/metrics/bucket_ranges.h +++ b/base/metrics/bucket_ranges.h
@@ -40,7 +40,11 @@ size_t size() const { return ranges_.size(); } HistogramBase::Sample range(size_t i) const { return ranges_[i]; } - void set_range(size_t i, HistogramBase::Sample value); + void set_range(size_t i, HistogramBase::Sample value) { + DCHECK_LT(i, ranges_.size()); + DCHECK_GE(value, 0); + ranges_[i] = value; + } uint32_t checksum() const { return checksum_; } void set_checksum(uint32_t checksum) { checksum_ = checksum; }
diff --git a/base/strings/sys_string_conversions_posix.cc b/base/strings/sys_string_conversions_posix.cc index a8dcfd0..35acaa0 100644 --- a/base/strings/sys_string_conversions_posix.cc +++ b/base/strings/sys_string_conversions_posix.cc
@@ -157,6 +157,6 @@ return out; } -#endif // OS_CHROMEOS +#endif // defined(SYSTEM_NATIVE_UTF8) || defined(OS_ANDROID) } // namespace base
diff --git a/base/synchronization/lock_impl.h b/base/synchronization/lock_impl.h index 603585a0..880e70d 100644 --- a/base/synchronization/lock_impl.h +++ b/base/synchronization/lock_impl.h
@@ -6,12 +6,14 @@ #define BASE_SYNCHRONIZATION_LOCK_IMPL_H_ #include "base/base_export.h" +#include "base/logging.h" #include "base/macros.h" #include "build/build_config.h" #if defined(OS_WIN) #include <windows.h> #elif defined(OS_POSIX) +#include <errno.h> #include <pthread.h> #endif @@ -26,7 +28,7 @@ #if defined(OS_WIN) using NativeHandle = SRWLOCK; #elif defined(OS_POSIX) - using NativeHandle = pthread_mutex_t; + using NativeHandle = pthread_mutex_t; #endif LockImpl(); @@ -41,7 +43,7 @@ // Release the lock. This must only be called by the lock's holder: after // a successful call to Try, or a call to Lock. - void Unlock(); + inline void Unlock(); // Return the native underlying lock. // TODO(awalker): refactor lock and condition variables so that this is @@ -59,6 +61,17 @@ DISALLOW_COPY_AND_ASSIGN(LockImpl); }; +#if defined(OS_WIN) +void LockImpl::Unlock() { + ::ReleaseSRWLockExclusive(&native_handle_); +} +#elif defined(OS_POSIX) +void LockImpl::Unlock() { + int rv = pthread_mutex_unlock(&native_handle_); + DCHECK_EQ(rv, 0) << ". " << strerror(rv); +} +#endif + } // namespace internal } // namespace base
diff --git a/base/synchronization/lock_impl_posix.cc b/base/synchronization/lock_impl_posix.cc index e54595b8..5ad337d9 100644 --- a/base/synchronization/lock_impl_posix.cc +++ b/base/synchronization/lock_impl_posix.cc
@@ -4,11 +4,9 @@ #include "base/synchronization/lock_impl.h" -#include <errno.h> #include <string.h> #include "base/debug/activity_tracker.h" -#include "base/logging.h" #include "base/synchronization/lock.h" namespace base { @@ -65,11 +63,6 @@ DCHECK_EQ(rv, 0) << ". " << strerror(rv); } -void LockImpl::Unlock() { - int rv = pthread_mutex_unlock(&native_handle_); - DCHECK_EQ(rv, 0) << ". " << strerror(rv); -} - // static bool LockImpl::PriorityInheritanceAvailable() { #if PRIORITY_INHERITANCE_LOCKS_POSSIBLE() && defined(OS_MACOSX)
diff --git a/base/synchronization/lock_impl_win.cc b/base/synchronization/lock_impl_win.cc index 31f95f4..7a2ff72 100644 --- a/base/synchronization/lock_impl_win.cc +++ b/base/synchronization/lock_impl_win.cc
@@ -22,9 +22,5 @@ ::AcquireSRWLockExclusive(&native_handle_); } -void LockImpl::Unlock() { - ::ReleaseSRWLockExclusive(&native_handle_); -} - } // namespace internal } // namespace base
diff --git a/base/threading/thread_local_storage.h b/base/threading/thread_local_storage.h index fd2a789..d6b66e8 100644 --- a/base/threading/thread_local_storage.h +++ b/base/threading/thread_local_storage.h
@@ -56,7 +56,13 @@ // SetTLSValue(). static void FreeTLS(TLSKey key); static void SetTLSValue(TLSKey key, void* value); - static void* GetTLSValue(TLSKey key); + static void* GetTLSValue(TLSKey key) { +#if defined(OS_WIN) + return TlsGetValue(key); +#elif defined(OS_POSIX) + return pthread_getspecific(key); +#endif + } // Each platform (OS implementation) is required to call this method on each // terminating thread when the thread is about to terminate. This method
diff --git a/base/threading/thread_local_storage_posix.cc b/base/threading/thread_local_storage_posix.cc index ebaf400..89edeee 100644 --- a/base/threading/thread_local_storage_posix.cc +++ b/base/threading/thread_local_storage_posix.cc
@@ -20,10 +20,6 @@ DCHECK_EQ(ret, 0); } -void* PlatformThreadLocalStorage::GetTLSValue(TLSKey key) { - return pthread_getspecific(key); -} - void PlatformThreadLocalStorage::SetTLSValue(TLSKey key, void* value) { int ret = pthread_setspecific(key, value); DCHECK_EQ(ret, 0);
diff --git a/base/threading/thread_local_storage_win.cc b/base/threading/thread_local_storage_win.cc index 42a7d01..a9aec31 100644 --- a/base/threading/thread_local_storage_win.cc +++ b/base/threading/thread_local_storage_win.cc
@@ -26,10 +26,6 @@ DCHECK(ret); } -void* PlatformThreadLocalStorage::GetTLSValue(TLSKey key) { - return TlsGetValue(key); -} - void PlatformThreadLocalStorage::SetTLSValue(TLSKey key, void* value) { BOOL ret = TlsSetValue(key, value); DCHECK(ret);
diff --git a/build/android/gyp/java_google_api_keys.py b/build/android/gyp/java_google_api_keys.py index 95cb416..e20d578 100755 --- a/build/android/gyp/java_google_api_keys.py +++ b/build/android/gyp/java_google_api_keys.py
@@ -99,7 +99,6 @@ values = {} values['GOOGLE_API_KEY'] = google_api_keys.GetAPIKey() - values['GOOGLE_API_KEY_REMOTING'] = google_api_keys.GetAPIKeyRemoting() values['GOOGLE_API_KEY_PHYSICAL_WEB_TEST'] = (google_api_keys. GetAPIKeyPhysicalWebTest()) values['GOOGLE_CLIENT_ID_MAIN'] = google_api_keys.GetClientID('MAIN')
diff --git a/cc/BUILD.gn b/cc/BUILD.gn index f8a6ceb..0ffd466 100644 --- a/cc/BUILD.gn +++ b/cc/BUILD.gn
@@ -150,9 +150,6 @@ "output/compositor_frame.h", "output/compositor_frame_metadata.cc", "output/compositor_frame_metadata.h", - "output/compositor_frame_sink.cc", - "output/compositor_frame_sink.h", - "output/compositor_frame_sink_client.h", "output/context_cache_controller.cc", "output/context_cache_controller.h", "output/context_provider.cc", @@ -179,6 +176,9 @@ "output/latency_info_swap_promise.h", "output/layer_quad.cc", "output/layer_quad.h", + "output/layer_tree_frame_sink.cc", + "output/layer_tree_frame_sink.h", + "output/layer_tree_frame_sink_client.h", "output/managed_memory_policy.cc", "output/managed_memory_policy.h", "output/output_surface.cc", @@ -526,10 +526,6 @@ "test/begin_frame_source_test.h", "test/compositor_frame_helpers.cc", "test/compositor_frame_helpers.h", - "test/fake_compositor_frame_sink.cc", - "test/fake_compositor_frame_sink.h", - "test/fake_compositor_frame_sink_client.cc", - "test/fake_compositor_frame_sink_client.h", "test/fake_compositor_frame_sink_support_client.cc", "test/fake_compositor_frame_sink_support_client.h", "test/fake_content_layer_client.cc", @@ -537,6 +533,10 @@ "test/fake_external_begin_frame_source.cc", "test/fake_external_begin_frame_source.h", "test/fake_impl_task_runner_provider.h", + "test/fake_layer_tree_frame_sink.cc", + "test/fake_layer_tree_frame_sink.h", + "test/fake_layer_tree_frame_sink_client.cc", + "test/fake_layer_tree_frame_sink_client.h", "test/fake_layer_tree_host.cc", "test/fake_layer_tree_host.h", "test/fake_layer_tree_host_client.cc", @@ -639,8 +639,6 @@ "test/surface_hittest_test_helpers.h", "test/task_graph_runner_test_template.cc", "test/task_graph_runner_test_template.h", - "test/test_compositor_frame_sink.cc", - "test/test_compositor_frame_sink.h", "test/test_context_provider.cc", "test/test_context_provider.h", "test/test_context_support.cc", @@ -655,6 +653,8 @@ "test/test_image_factory.h", "test/test_in_process_context_provider.cc", "test/test_in_process_context_provider.h", + "test/test_layer_tree_frame_sink.cc", + "test/test_layer_tree_frame_sink.h", "test/test_layer_tree_host_base.cc", "test/test_layer_tree_host_base.h", "test/test_occlusion_tracker.h", @@ -766,10 +766,10 @@ "output/begin_frame_args_unittest.cc", "output/bsp_tree_unittest.cc", "output/buffer_to_texture_target_map_unittest.cc", - "output/compositor_frame_sink_unittest.cc", "output/context_cache_controller_unittest.cc", "output/gl_renderer_unittest.cc", "output/layer_quad_unittest.cc", + "output/layer_tree_frame_sink_unittest.cc", "output/overlay_unittest.cc", "output/renderer_pixeltest.cc", "output/shader_unittest.cc", @@ -858,7 +858,7 @@ # Surfaces test files. "surfaces/compositor_frame_sink_support_unittest.cc", - "surfaces/direct_compositor_frame_sink_unittest.cc", + "surfaces/direct_layer_tree_frame_sink_unittest.cc", "surfaces/display_scheduler_unittest.cc", "surfaces/display_unittest.cc", "surfaces/referenced_surface_tracker_unittest.cc",
diff --git a/cc/layers/heads_up_display_layer_impl_unittest.cc b/cc/layers/heads_up_display_layer_impl_unittest.cc index ddfb058..94d3f13 100644 --- a/cc/layers/heads_up_display_layer_impl_unittest.cc +++ b/cc/layers/heads_up_display_layer_impl_unittest.cc
@@ -6,8 +6,8 @@ #include "cc/layers/append_quads_data.h" #include "cc/layers/heads_up_display_layer_impl.h" -#include "cc/test/fake_compositor_frame_sink.h" #include "cc/test/fake_impl_task_runner_provider.h" +#include "cc/test/fake_layer_tree_frame_sink.h" #include "cc/test/fake_layer_tree_host_impl.h" #include "cc/test/test_task_graph_runner.h" #include "cc/trees/layer_tree_impl.h" @@ -38,12 +38,12 @@ TEST(HeadsUpDisplayLayerImplTest, ResourcelessSoftwareDrawAfterResourceLoss) { FakeImplTaskRunnerProvider task_runner_provider; TestTaskGraphRunner task_graph_runner; - std::unique_ptr<CompositorFrameSink> compositor_frame_sink = - FakeCompositorFrameSink::Create3d(); + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink = + FakeLayerTreeFrameSink::Create3d(); FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); host_impl.CreatePendingTree(); host_impl.SetVisible(true); - host_impl.InitializeRenderer(compositor_frame_sink.get()); + host_impl.InitializeRenderer(layer_tree_frame_sink.get()); std::unique_ptr<HeadsUpDisplayLayerImpl> layer_ptr = HeadsUpDisplayLayerImpl::Create(host_impl.pending_tree(), 1); layer_ptr->SetBounds(gfx::Size(100, 100)); @@ -55,26 +55,26 @@ // Check regular hardware draw is ok. CheckDrawLayer(layer, host_impl.resource_provider(), - compositor_frame_sink->context_provider(), DRAW_MODE_HARDWARE); + layer_tree_frame_sink->context_provider(), DRAW_MODE_HARDWARE); // Simulate a resource loss on transitioning to resourceless software mode. layer->ReleaseResources(); // Should skip resourceless software draw and not crash in UpdateHudTexture. CheckDrawLayer(layer, host_impl.resource_provider(), - compositor_frame_sink->context_provider(), + layer_tree_frame_sink->context_provider(), DRAW_MODE_RESOURCELESS_SOFTWARE); } TEST(HeadsUpDisplayLayerImplTest, CPUAndGPURasterCanvas) { FakeImplTaskRunnerProvider task_runner_provider; TestTaskGraphRunner task_graph_runner; - std::unique_ptr<CompositorFrameSink> compositor_frame_sink = - FakeCompositorFrameSink::Create3d(); + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink = + FakeLayerTreeFrameSink::Create3d(); FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); host_impl.CreatePendingTree(); host_impl.SetVisible(true); - host_impl.InitializeRenderer(compositor_frame_sink.get()); + host_impl.InitializeRenderer(layer_tree_frame_sink.get()); std::unique_ptr<HeadsUpDisplayLayerImpl> layer_ptr = HeadsUpDisplayLayerImpl::Create(host_impl.pending_tree(), 1); layer_ptr->SetBounds(gfx::Size(100, 100)); @@ -86,7 +86,7 @@ // Check Ganesh canvas drawing is ok. CheckDrawLayer(layer, host_impl.resource_provider(), - compositor_frame_sink->context_provider(), DRAW_MODE_HARDWARE); + layer_tree_frame_sink->context_provider(), DRAW_MODE_HARDWARE); // Check SW canvas drawing is ok. CheckDrawLayer(layer, host_impl.resource_provider(), NULL,
diff --git a/cc/layers/layer_impl_unittest.cc b/cc/layers/layer_impl_unittest.cc index 721d4ca..326ef45 100644 --- a/cc/layers/layer_impl_unittest.cc +++ b/cc/layers/layer_impl_unittest.cc
@@ -9,8 +9,8 @@ #include "cc/layers/painted_scrollbar_layer_impl.h" #include "cc/layers/solid_color_scrollbar_layer_impl.h" #include "cc/test/animation_test_common.h" -#include "cc/test/fake_compositor_frame_sink.h" #include "cc/test/fake_impl_task_runner_provider.h" +#include "cc/test/fake_layer_tree_frame_sink.h" #include "cc/test/fake_layer_tree_host_impl.h" #include "cc/test/geometry_test_utils.h" #include "cc/test/test_task_graph_runner.h" @@ -124,11 +124,11 @@ // Create a simple LayerImpl tree: FakeImplTaskRunnerProvider task_runner_provider; TestTaskGraphRunner task_graph_runner; - std::unique_ptr<CompositorFrameSink> compositor_frame_sink = - FakeCompositorFrameSink::Create3d(); + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink = + FakeLayerTreeFrameSink::Create3d(); FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); host_impl.SetVisible(true); - EXPECT_TRUE(host_impl.InitializeRenderer(compositor_frame_sink.get())); + EXPECT_TRUE(host_impl.InitializeRenderer(layer_tree_frame_sink.get())); host_impl.CreatePendingTree(); std::unique_ptr<LayerImpl> root_clip_ptr = LayerImpl::Create(host_impl.pending_tree(), 1); @@ -219,11 +219,11 @@ TEST(LayerImplTest, VerifyActiveLayerChangesAreTrackedProperly) { FakeImplTaskRunnerProvider task_runner_provider; TestTaskGraphRunner task_graph_runner; - std::unique_ptr<CompositorFrameSink> compositor_frame_sink = - FakeCompositorFrameSink::Create3d(); + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink = + FakeLayerTreeFrameSink::Create3d(); FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); host_impl.SetVisible(true); - EXPECT_TRUE(host_impl.InitializeRenderer(compositor_frame_sink.get())); + EXPECT_TRUE(host_impl.InitializeRenderer(layer_tree_frame_sink.get())); std::unique_ptr<LayerImpl> root_clip_ptr = LayerImpl::Create(host_impl.active_tree(), 1); LayerImpl* root_clip = root_clip_ptr.get(); @@ -294,11 +294,11 @@ TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) { FakeImplTaskRunnerProvider task_runner_provider; TestTaskGraphRunner task_graph_runner; - std::unique_ptr<CompositorFrameSink> compositor_frame_sink = - FakeCompositorFrameSink::Create3d(); + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink = + FakeLayerTreeFrameSink::Create3d(); FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); host_impl.SetVisible(true); - EXPECT_TRUE(host_impl.InitializeRenderer(compositor_frame_sink.get())); + EXPECT_TRUE(host_impl.InitializeRenderer(layer_tree_frame_sink.get())); host_impl.active_tree()->SetRootLayerForTesting( LayerImpl::Create(host_impl.active_tree(), 1)); LayerImpl* root = host_impl.active_tree()->root_layer_for_testing(); @@ -408,11 +408,11 @@ TEST(LayerImplTest, SafeOpaqueBackgroundColor) { FakeImplTaskRunnerProvider task_runner_provider; TestTaskGraphRunner task_graph_runner; - std::unique_ptr<CompositorFrameSink> compositor_frame_sink = - FakeCompositorFrameSink::Create3d(); + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink = + FakeLayerTreeFrameSink::Create3d(); FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); host_impl.SetVisible(true); - EXPECT_TRUE(host_impl.InitializeRenderer(compositor_frame_sink.get())); + EXPECT_TRUE(host_impl.InitializeRenderer(layer_tree_frame_sink.get())); host_impl.active_tree()->SetRootLayerForTesting( LayerImpl::Create(host_impl.active_tree(), 1)); LayerImpl* layer = host_impl.active_tree()->root_layer_for_testing(); @@ -446,8 +446,8 @@ TEST(LayerImplTest, PerspectiveTransformHasReasonableScale) { FakeImplTaskRunnerProvider task_runner_provider; TestTaskGraphRunner task_graph_runner; - std::unique_ptr<CompositorFrameSink> compositor_frame_sink = - FakeCompositorFrameSink::Create3d(); + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink = + FakeLayerTreeFrameSink::Create3d(); LayerTreeSettings settings; settings.layer_transforms_should_scale_layer_contents = true; FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider,
diff --git a/cc/layers/layer_list_iterator_unittest.cc b/cc/layers/layer_list_iterator_unittest.cc index 54e1006e..0c984bf 100644 --- a/cc/layers/layer_list_iterator_unittest.cc +++ b/cc/layers/layer_list_iterator_unittest.cc
@@ -8,8 +8,8 @@ #include "base/containers/adapters.h" #include "cc/animation/animation_host.h" -#include "cc/test/fake_compositor_frame_sink.h" #include "cc/test/fake_impl_task_runner_provider.h" +#include "cc/test/fake_layer_tree_frame_sink.h" #include "cc/test/fake_layer_tree_host.h" #include "cc/test/fake_layer_tree_host_impl.h" #include "cc/test/test_task_graph_runner.h" @@ -203,11 +203,11 @@ // Unfortunate preamble. FakeImplTaskRunnerProvider task_runner_provider; TestTaskGraphRunner task_graph_runner; - std::unique_ptr<CompositorFrameSink> compositor_frame_sink = - FakeCompositorFrameSink::Create3d(); + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink = + FakeLayerTreeFrameSink::Create3d(); FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); host_impl.SetVisible(true); - EXPECT_TRUE(host_impl.InitializeRenderer(compositor_frame_sink.get())); + EXPECT_TRUE(host_impl.InitializeRenderer(layer_tree_frame_sink.get())); // This test constructs the following tree. // 1 @@ -256,11 +256,11 @@ // Unfortunate preamble. FakeImplTaskRunnerProvider task_runner_provider; TestTaskGraphRunner task_graph_runner; - std::unique_ptr<CompositorFrameSink> compositor_frame_sink = - FakeCompositorFrameSink::Create3d(); + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink = + FakeLayerTreeFrameSink::Create3d(); FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); host_impl.SetVisible(true); - EXPECT_TRUE(host_impl.InitializeRenderer(compositor_frame_sink.get())); + EXPECT_TRUE(host_impl.InitializeRenderer(layer_tree_frame_sink.get())); // This test constructs a tree consisting of a single layer. std::unique_ptr<LayerImpl> layer1 = @@ -291,11 +291,11 @@ // Unfortunate preamble. FakeImplTaskRunnerProvider task_runner_provider; TestTaskGraphRunner task_graph_runner; - std::unique_ptr<CompositorFrameSink> compositor_frame_sink = - FakeCompositorFrameSink::Create3d(); + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink = + FakeLayerTreeFrameSink::Create3d(); FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); host_impl.SetVisible(true); - EXPECT_TRUE(host_impl.InitializeRenderer(compositor_frame_sink.get())); + EXPECT_TRUE(host_impl.InitializeRenderer(layer_tree_frame_sink.get())); // This test constructs the following tree. // 1 @@ -346,11 +346,11 @@ // Unfortunate preamble. FakeImplTaskRunnerProvider task_runner_provider; TestTaskGraphRunner task_graph_runner; - std::unique_ptr<CompositorFrameSink> compositor_frame_sink = - FakeCompositorFrameSink::Create3d(); + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink = + FakeLayerTreeFrameSink::Create3d(); FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); host_impl.SetVisible(true); - EXPECT_TRUE(host_impl.InitializeRenderer(compositor_frame_sink.get())); + EXPECT_TRUE(host_impl.InitializeRenderer(layer_tree_frame_sink.get())); // This test constructs a tree consisting of a single layer. std::unique_ptr<LayerImpl> layer1 =
diff --git a/cc/layers/nine_patch_layer_impl_unittest.cc b/cc/layers/nine_patch_layer_impl_unittest.cc index d704a83..7d6636bd 100644 --- a/cc/layers/nine_patch_layer_impl_unittest.cc +++ b/cc/layers/nine_patch_layer_impl_unittest.cc
@@ -9,8 +9,8 @@ #include "cc/quads/texture_draw_quad.h" #include "cc/resources/ui_resource_bitmap.h" #include "cc/resources/ui_resource_client.h" -#include "cc/test/fake_compositor_frame_sink.h" #include "cc/test/fake_impl_task_runner_provider.h" +#include "cc/test/fake_layer_tree_frame_sink.h" #include "cc/test/fake_ui_resource_layer_tree_host_impl.h" #include "cc/test/geometry_test_utils.h" #include "cc/test/layer_test_common.h" @@ -45,12 +45,12 @@ FakeImplTaskRunnerProvider task_runner_provider; TestTaskGraphRunner task_graph_runner; - std::unique_ptr<CompositorFrameSink> compositor_frame_sink = - FakeCompositorFrameSink::Create3d(); + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink = + FakeLayerTreeFrameSink::Create3d(); FakeUIResourceLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); host_impl.SetVisible(true); - host_impl.InitializeRenderer(compositor_frame_sink.get()); + host_impl.InitializeRenderer(layer_tree_frame_sink.get()); std::unique_ptr<NinePatchLayerImpl> layer = NinePatchLayerImpl::Create(host_impl.active_tree(), 1); @@ -153,12 +153,12 @@ FakeImplTaskRunnerProvider task_runner_provider; TestTaskGraphRunner task_graph_runner; - std::unique_ptr<CompositorFrameSink> compositor_frame_sink = - FakeCompositorFrameSink::Create3d(); + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink = + FakeLayerTreeFrameSink::Create3d(); FakeUIResourceLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); host_impl.SetVisible(true); - host_impl.InitializeRenderer(compositor_frame_sink.get()); + host_impl.InitializeRenderer(layer_tree_frame_sink.get()); std::unique_ptr<NinePatchLayerImpl> layer = NinePatchLayerImpl::Create(host_impl.active_tree(), 1);
diff --git a/cc/layers/picture_layer_impl_perftest.cc b/cc/layers/picture_layer_impl_perftest.cc index 3f5033a..98382d4 100644 --- a/cc/layers/picture_layer_impl_perftest.cc +++ b/cc/layers/picture_layer_impl_perftest.cc
@@ -7,8 +7,8 @@ #include "base/macros.h" #include "base/threading/thread_task_runner_handle.h" #include "cc/base/lap_timer.h" -#include "cc/test/fake_compositor_frame_sink.h" #include "cc/test/fake_impl_task_runner_provider.h" +#include "cc/test/fake_layer_tree_frame_sink.h" #include "cc/test/fake_layer_tree_host_impl.h" #include "cc/test/fake_picture_layer_impl.h" #include "cc/test/fake_raster_source.h" @@ -42,7 +42,7 @@ public: PictureLayerImplPerfTest() : task_runner_provider_(base::ThreadTaskRunnerHandle::Get()), - compositor_frame_sink_(FakeCompositorFrameSink::Create3d()), + layer_tree_frame_sink_(FakeLayerTreeFrameSink::Create3d()), host_impl_(LayerTreeSettings(), &task_runner_provider_, &task_graph_runner_), @@ -52,7 +52,7 @@ void SetUp() override { host_impl_.SetVisible(true); - host_impl_.InitializeRenderer(compositor_frame_sink_.get()); + host_impl_.InitializeRenderer(layer_tree_frame_sink_.get()); } void SetupPendingTree(const gfx::Size& layer_bounds) { @@ -175,7 +175,7 @@ protected: TestTaskGraphRunner task_graph_runner_; FakeImplTaskRunnerProvider task_runner_provider_; - std::unique_ptr<CompositorFrameSink> compositor_frame_sink_; + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink_; FakeLayerTreeHostImpl host_impl_; FakePictureLayerImpl* pending_layer_; LapTimer timer_;
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc index 6b326b8..0d7ac4d0 100644 --- a/cc/layers/picture_layer_impl_unittest.cc +++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -22,9 +22,9 @@ #include "cc/quads/draw_quad.h" #include "cc/quads/tile_draw_quad.h" #include "cc/test/begin_frame_args_test.h" -#include "cc/test/fake_compositor_frame_sink.h" #include "cc/test/fake_content_layer_client.h" #include "cc/test/fake_impl_task_runner_provider.h" +#include "cc/test/fake_layer_tree_frame_sink.h" #include "cc/test/fake_layer_tree_host.h" #include "cc/test/fake_layer_tree_host_client.h" #include "cc/test/fake_layer_tree_host_impl.h" @@ -86,8 +86,8 @@ return settings; } - std::unique_ptr<CompositorFrameSink> CreateCompositorFrameSink() override { - return FakeCompositorFrameSink::Create3dForGpuRasterization(); + std::unique_ptr<LayerTreeFrameSink> CreateLayerTreeFrameSink() override { + return FakeLayerTreeFrameSink::Create3dForGpuRasterization(); } void SetupDefaultTreesWithFixedTileSize(const gfx::Size& layer_bounds, @@ -1445,8 +1445,7 @@ std::unique_ptr<TestWebGraphicsContext3D> context = TestWebGraphicsContext3D::Create(); context->set_max_texture_size(140); - ResetCompositorFrameSink( - FakeCompositorFrameSink::Create3d(std::move(context))); + ResetLayerTreeFrameSink(FakeLayerTreeFrameSink::Create3d(std::move(context))); SetupDrawPropertiesAndUpdateTiles(pending_layer(), 1.f, 1.f, 1.f, 1.f, 0.f, false); @@ -1481,8 +1480,7 @@ std::unique_ptr<TestWebGraphicsContext3D> context = TestWebGraphicsContext3D::Create(); context->set_max_texture_size(140); - ResetCompositorFrameSink( - FakeCompositorFrameSink::Create3d(std::move(context))); + ResetLayerTreeFrameSink(FakeLayerTreeFrameSink::Create3d(std::move(context))); SetupDrawPropertiesAndUpdateTiles(active_layer(), 1.f, 1.f, 1.f, 1.f, 0.f, false); @@ -3593,8 +3591,8 @@ class PictureLayerImplTestWithDelegatingRenderer : public PictureLayerImplTest { public: - std::unique_ptr<CompositorFrameSink> CreateCompositorFrameSink() override { - return FakeCompositorFrameSink::Create3d(); + std::unique_ptr<LayerTreeFrameSink> CreateLayerTreeFrameSink() override { + return FakeLayerTreeFrameSink::Create3d(); } };
diff --git a/cc/layers/picture_layer_unittest.cc b/cc/layers/picture_layer_unittest.cc index f976ab9f..82cd0be 100644 --- a/cc/layers/picture_layer_unittest.cc +++ b/cc/layers/picture_layer_unittest.cc
@@ -13,8 +13,8 @@ #include "cc/layers/content_layer_client.h" #include "cc/layers/picture_layer_impl.h" #include "cc/paint/paint_flags.h" -#include "cc/test/fake_compositor_frame_sink.h" #include "cc/test/fake_content_layer_client.h" +#include "cc/test/fake_layer_tree_frame_sink.h" #include "cc/test/fake_layer_tree_host.h" #include "cc/test/fake_picture_layer.h" #include "cc/test/fake_picture_layer_impl.h" @@ -57,11 +57,11 @@ FakeImplTaskRunnerProvider impl_task_runner_provider; - std::unique_ptr<FakeCompositorFrameSink> compositor_frame_sink = - FakeCompositorFrameSink::CreateSoftware(); + std::unique_ptr<FakeLayerTreeFrameSink> layer_tree_frame_sink = + FakeLayerTreeFrameSink::CreateSoftware(); FakeLayerTreeHostImpl host_impl( LayerTreeSettings(), &impl_task_runner_provider, &task_graph_runner); - host_impl.InitializeRenderer(compositor_frame_sink.get()); + host_impl.InitializeRenderer(layer_tree_frame_sink.get()); host_impl.CreatePendingTree(); std::unique_ptr<FakePictureLayerImpl> layer_impl = FakePictureLayerImpl::Create(host_impl.pending_tree(), 1); @@ -96,13 +96,13 @@ host->CommitComplete(); FakeImplTaskRunnerProvider impl_task_runner_provider; - std::unique_ptr<CompositorFrameSink> compositor_frame_sink( - FakeCompositorFrameSink::Create3d()); + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink( + FakeLayerTreeFrameSink::Create3d()); LayerTreeSettings layer_tree_settings = LayerTreeSettings(); FakeLayerTreeHostImpl host_impl( layer_tree_settings, &impl_task_runner_provider, &task_graph_runner); host_impl.SetVisible(true); - host_impl.InitializeRenderer(compositor_frame_sink.get()); + host_impl.InitializeRenderer(layer_tree_frame_sink.get()); host_impl.CreatePendingTree(); host_impl.pending_tree()->SetRootLayerForTesting( FakePictureLayerImpl::Create(host_impl.pending_tree(), 1)); @@ -137,13 +137,13 @@ host->CommitComplete(); FakeImplTaskRunnerProvider impl_task_runner_provider; - std::unique_ptr<CompositorFrameSink> compositor_frame_sink( - FakeCompositorFrameSink::Create3d()); + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink( + FakeLayerTreeFrameSink::Create3d()); LayerTreeSettings layer_tree_settings = LayerTreeSettings(); FakeLayerTreeHostImpl host_impl( layer_tree_settings, &impl_task_runner_provider, &task_graph_runner); host_impl.SetVisible(true); - host_impl.InitializeRenderer(compositor_frame_sink.get()); + host_impl.InitializeRenderer(layer_tree_frame_sink.get()); host_impl.CreatePendingTree(); host_impl.pending_tree()->SetRootLayerForTesting( FakePictureLayerImpl::Create(host_impl.pending_tree(), 1)); @@ -182,13 +182,13 @@ FakeImplTaskRunnerProvider impl_task_runner_provider; - std::unique_ptr<CompositorFrameSink> compositor_frame_sink( - FakeCompositorFrameSink::Create3d()); + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink( + FakeLayerTreeFrameSink::Create3d()); LayerTreeSettings layer_tree_settings = LayerTreeSettings(); FakeLayerTreeHostImpl host_impl( layer_tree_settings, &impl_task_runner_provider, &task_graph_runner); host_impl.SetVisible(true); - EXPECT_TRUE(host_impl.InitializeRenderer(compositor_frame_sink.get())); + EXPECT_TRUE(host_impl.InitializeRenderer(layer_tree_frame_sink.get())); host_impl.CreatePendingTree(); host_impl.pending_tree()->SetRootLayerForTesting(
diff --git a/cc/layers/render_surface_unittest.cc b/cc/layers/render_surface_unittest.cc index db9fed9..d05b5b1b 100644 --- a/cc/layers/render_surface_unittest.cc +++ b/cc/layers/render_surface_unittest.cc
@@ -6,8 +6,8 @@ #include "cc/layers/layer_impl.h" #include "cc/layers/render_surface_impl.h" #include "cc/quads/shared_quad_state.h" -#include "cc/test/fake_compositor_frame_sink.h" #include "cc/test/fake_impl_task_runner_provider.h" +#include "cc/test/fake_layer_tree_frame_sink.h" #include "cc/test/fake_layer_tree_host_impl.h" #include "cc/test/geometry_test_utils.h" #include "cc/test/layer_test_common.h" @@ -39,8 +39,8 @@ FakeImplTaskRunnerProvider task_runner_provider; TestTaskGraphRunner task_graph_runner; - std::unique_ptr<CompositorFrameSink> compositor_frame_sink = - FakeCompositorFrameSink::Create3d(); + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink = + FakeLayerTreeFrameSink::Create3d(); FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); std::unique_ptr<LayerImpl> owning_layer = LayerImpl::Create(host_impl.active_tree(), 1); @@ -49,7 +49,7 @@ host_impl.active_tree()->ResetAllChangeTracking(); host_impl.active_tree()->SetRootLayerForTesting(std::move(owning_layer)); host_impl.SetVisible(true); - host_impl.InitializeRenderer(compositor_frame_sink.get()); + host_impl.InitializeRenderer(layer_tree_frame_sink.get()); host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); host_impl.active_tree()->UpdateDrawProperties(false /* update_lcd_text */); @@ -92,8 +92,8 @@ TEST(RenderSurfaceTest, SanityCheckSurfaceCreatesCorrectSharedQuadState) { FakeImplTaskRunnerProvider task_runner_provider; TestTaskGraphRunner task_graph_runner; - std::unique_ptr<CompositorFrameSink> compositor_frame_sink = - FakeCompositorFrameSink::Create3d(); + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink = + FakeLayerTreeFrameSink::Create3d(); FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); std::unique_ptr<LayerImpl> root_layer = LayerImpl::Create(host_impl.active_tree(), 1); @@ -109,7 +109,7 @@ root_layer->test_properties()->AddChild(std::move(owning_layer)); host_impl.active_tree()->SetRootLayerForTesting(std::move(root_layer)); host_impl.SetVisible(true); - host_impl.InitializeRenderer(compositor_frame_sink.get()); + host_impl.InitializeRenderer(layer_tree_frame_sink.get()); host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); host_impl.active_tree()->UpdateDrawProperties(false /* update_lcd_text */); @@ -154,8 +154,8 @@ TEST(RenderSurfaceTest, SanityCheckSurfaceCreatesCorrectRenderPass) { FakeImplTaskRunnerProvider task_runner_provider; TestTaskGraphRunner task_graph_runner; - std::unique_ptr<CompositorFrameSink> compositor_frame_sink = - FakeCompositorFrameSink::Create3d(); + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink = + FakeLayerTreeFrameSink::Create3d(); FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); std::unique_ptr<LayerImpl> root_layer = LayerImpl::Create(host_impl.active_tree(), 1); @@ -168,7 +168,7 @@ root_layer->test_properties()->AddChild(std::move(owning_layer)); host_impl.active_tree()->SetRootLayerForTesting(std::move(root_layer)); host_impl.SetVisible(true); - host_impl.InitializeRenderer(compositor_frame_sink.get()); + host_impl.InitializeRenderer(layer_tree_frame_sink.get()); host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); host_impl.active_tree()->UpdateDrawProperties(false /* update_lcd_text */);
diff --git a/cc/layers/texture_layer_impl_unittest.cc b/cc/layers/texture_layer_impl_unittest.cc index babb446d..aa44f93 100644 --- a/cc/layers/texture_layer_impl_unittest.cc +++ b/cc/layers/texture_layer_impl_unittest.cc
@@ -6,11 +6,11 @@ #include <stddef.h> -#include "cc/output/compositor_frame_sink.h" #include "cc/output/context_provider.h" +#include "cc/output/layer_tree_frame_sink.h" #include "cc/quads/draw_quad.h" #include "cc/quads/texture_draw_quad.h" -#include "cc/test/fake_compositor_frame_sink.h" +#include "cc/test/fake_layer_tree_frame_sink.h" #include "cc/test/layer_test_common.h" #include "gpu/command_buffer/client/gles2_interface.h" #include "testing/gtest/include/gtest/gtest.h" @@ -55,7 +55,7 @@ LayerTestCommon::LayerImplTest impl; gpu::Mailbox mailbox; - impl.compositor_frame_sink() + impl.layer_tree_frame_sink() ->context_provider() ->ContextGL() ->GenMailboxCHROMIUM(mailbox.name); @@ -115,7 +115,7 @@ LayerTestCommon::LayerImplTest impl; gpu::Mailbox mailbox; - impl.compositor_frame_sink() + impl.layer_tree_frame_sink() ->context_provider() ->ContextGL() ->GenMailboxCHROMIUM(mailbox.name); @@ -151,14 +151,14 @@ TEST(TextureLayerImplTest, ResourceNotFreedOnGpuRasterToggle) { bool released = false; LayerTestCommon::LayerImplTest impl( - FakeCompositorFrameSink::Create3dForGpuRasterization()); + FakeLayerTreeFrameSink::Create3dForGpuRasterization()); impl.host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); gfx::Size layer_size(1000, 1000); gfx::Size viewport_size(1000, 1000); gpu::Mailbox mailbox; - impl.compositor_frame_sink() + impl.layer_tree_frame_sink() ->context_provider() ->ContextGL() ->GenMailboxCHROMIUM(mailbox.name);
diff --git a/cc/layers/texture_layer_unittest.cc b/cc/layers/texture_layer_unittest.cc index c886a26..7e224a8 100644 --- a/cc/layers/texture_layer_unittest.cc +++ b/cc/layers/texture_layer_unittest.cc
@@ -27,14 +27,14 @@ #include "cc/layers/texture_layer_impl.h" #include "cc/output/context_provider.h" #include "cc/resources/returned_resource.h" -#include "cc/test/fake_compositor_frame_sink.h" #include "cc/test/fake_impl_task_runner_provider.h" +#include "cc/test/fake_layer_tree_frame_sink.h" #include "cc/test/fake_layer_tree_host_client.h" #include "cc/test/fake_layer_tree_host_impl.h" #include "cc/test/layer_test_common.h" #include "cc/test/layer_tree_test.h" #include "cc/test/stub_layer_tree_host_single_thread_client.h" -#include "cc/test/test_compositor_frame_sink.h" +#include "cc/test/test_layer_tree_frame_sink.h" #include "cc/test/test_task_graph_runner.h" #include "cc/test/test_web_graphics_context_3d.h" #include "cc/trees/blocking_task_runner.h" @@ -207,9 +207,8 @@ class TextureLayerTest : public testing::Test { public: TextureLayerTest() - : compositor_frame_sink_(FakeCompositorFrameSink::Create3d()), - host_impl_(&task_runner_provider_, - &task_graph_runner_), + : layer_tree_frame_sink_(FakeLayerTreeFrameSink::Create3d()), + host_impl_(&task_runner_provider_, &task_graph_runner_), test_data_(&shared_bitmap_manager_) {} protected: @@ -238,7 +237,7 @@ FakeLayerTreeHostClient fake_client_; TestSharedBitmapManager shared_bitmap_manager_; TestTaskGraphRunner task_graph_runner_; - std::unique_ptr<CompositorFrameSink> compositor_frame_sink_; + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink_; FakeLayerTreeHostImpl host_impl_; CommonMailboxObjects test_data_; }; @@ -635,7 +634,7 @@ public: TextureLayerImplWithMailboxThreadedCallback() = default; - std::unique_ptr<TestCompositorFrameSink> CreateCompositorFrameSink( + std::unique_ptr<TestLayerTreeFrameSink> CreateLayerTreeFrameSink( const RendererSettings& renderer_settings, double refresh_rate, scoped_refptr<ContextProvider> compositor_context_provider, @@ -644,7 +643,7 @@ bool synchronous_composite = !HasImplThread() && !layer_tree_host()->GetSettings().single_thread_proxy_scheduler; - return base::MakeUnique<TestCompositorFrameSink>( + return base::MakeUnique<TestLayerTreeFrameSink>( compositor_context_provider, std::move(worker_context_provider), shared_bitmap_manager(), gpu_memory_buffer_manager(), renderer_settings, ImplThreadTaskRunner(), synchronous_composite, disable_display_vsync, @@ -891,7 +890,7 @@ layer_tree_host_ = MockLayerTreeHost::Create( &fake_client_, &task_graph_runner_, animation_host_.get()); host_impl_.SetVisible(true); - EXPECT_TRUE(host_impl_.InitializeRenderer(compositor_frame_sink_.get())); + EXPECT_TRUE(host_impl_.InitializeRenderer(layer_tree_frame_sink_.get())); } bool WillDraw(TextureLayerImpl* layer, DrawMode mode) {
diff --git a/cc/layers/ui_resource_layer_impl_unittest.cc b/cc/layers/ui_resource_layer_impl_unittest.cc index 37e3927..9e4d4a81 100644 --- a/cc/layers/ui_resource_layer_impl_unittest.cc +++ b/cc/layers/ui_resource_layer_impl_unittest.cc
@@ -9,8 +9,8 @@ #include "cc/quads/draw_quad.h" #include "cc/resources/ui_resource_bitmap.h" #include "cc/resources/ui_resource_client.h" -#include "cc/test/fake_compositor_frame_sink.h" #include "cc/test/fake_impl_task_runner_provider.h" +#include "cc/test/fake_layer_tree_frame_sink.h" #include "cc/test/fake_layer_tree_host_impl.h" #include "cc/test/fake_ui_resource_layer_tree_host_impl.h" #include "cc/test/layer_test_common.h" @@ -66,12 +66,12 @@ TEST(UIResourceLayerImplTest, VerifyDrawQuads) { FakeImplTaskRunnerProvider task_runner_provider; TestTaskGraphRunner task_graph_runner; - std::unique_ptr<CompositorFrameSink> compositor_frame_sink = - FakeCompositorFrameSink::Create3d(); + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink = + FakeLayerTreeFrameSink::Create3d(); FakeUIResourceLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); host_impl.SetVisible(true); - host_impl.InitializeRenderer(compositor_frame_sink.get()); + host_impl.InitializeRenderer(layer_tree_frame_sink.get()); // Make sure we're appending quads when there are valid values. gfx::Size bitmap_size(100, 100); @@ -118,12 +118,12 @@ TEST(UIResourceLayerImplTest, VerifySetOpaqueOnSkBitmap) { FakeImplTaskRunnerProvider task_runner_provider; TestTaskGraphRunner task_graph_runner; - std::unique_ptr<CompositorFrameSink> compositor_frame_sink = - FakeCompositorFrameSink::Create3d(); + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink = + FakeLayerTreeFrameSink::Create3d(); FakeUIResourceLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); host_impl.SetVisible(true); - host_impl.InitializeRenderer(compositor_frame_sink.get()); + host_impl.InitializeRenderer(layer_tree_frame_sink.get()); gfx::Size bitmap_size(100, 100); gfx::Size layer_size(100, 100); @@ -147,12 +147,12 @@ TEST(UIResourceLayerImplTest, VerifySetOpaqueOnLayer) { FakeImplTaskRunnerProvider task_runner_provider; TestTaskGraphRunner task_graph_runner; - std::unique_ptr<CompositorFrameSink> compositor_frame_sink = - FakeCompositorFrameSink::Create3d(); + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink = + FakeLayerTreeFrameSink::Create3d(); FakeUIResourceLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); host_impl.SetVisible(true); - host_impl.InitializeRenderer(compositor_frame_sink.get()); + host_impl.InitializeRenderer(layer_tree_frame_sink.get()); gfx::Size bitmap_size(100, 100); gfx::Size layer_size(100, 100);
diff --git a/cc/output/compositor_frame_sink_unittest.cc b/cc/output/compositor_frame_sink_unittest.cc deleted file mode 100644 index 127eb43..0000000 --- a/cc/output/compositor_frame_sink_unittest.cc +++ /dev/null
@@ -1,74 +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 "cc/output/compositor_frame_sink.h" - -#include "base/memory/ptr_util.h" -#include "cc/output/compositor_frame.h" -#include "cc/test/fake_compositor_frame_sink_client.h" -#include "cc/test/test_context_provider.h" -#include "cc/test/test_web_graphics_context_3d.h" -#include "gpu/GLES2/gl2extchromium.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace cc { -namespace { - -class TestCompositorFrameSink : public CompositorFrameSink { - public: - explicit TestCompositorFrameSink( - scoped_refptr<TestContextProvider> context_provider, - scoped_refptr<TestContextProvider> worker_context_provider) - : CompositorFrameSink(std::move(context_provider), - std::move(worker_context_provider), - nullptr, - nullptr) {} - - void SubmitCompositorFrame(CompositorFrame frame) override { - client_->DidReceiveCompositorFrameAck(); - } - void DidNotProduceFrame(const BeginFrameAck& ack) override {} -}; - -TEST(CompositorFrameSinkTest, ContextLossInformsClient) { - scoped_refptr<TestContextProvider> provider = TestContextProvider::Create(); - scoped_refptr<TestContextProvider> worker_provider = - TestContextProvider::CreateWorker(); - TestCompositorFrameSink compositor_frame_sink(provider, worker_provider); - EXPECT_FALSE(compositor_frame_sink.HasClient()); - - FakeCompositorFrameSinkClient client; - EXPECT_TRUE(compositor_frame_sink.BindToClient(&client)); - EXPECT_TRUE(compositor_frame_sink.HasClient()); - - // Verify DidLoseCompositorFrameSink callback is hooked up correctly. - EXPECT_FALSE(client.did_lose_compositor_frame_sink_called()); - compositor_frame_sink.context_provider()->ContextGL()->LoseContextCHROMIUM( - GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB); - compositor_frame_sink.context_provider()->ContextGL()->Flush(); - EXPECT_TRUE(client.did_lose_compositor_frame_sink_called()); -} - -// TODO(danakj): Add a test for worker context failure as well when -// CompositorFrameSink creates/binds it. -TEST(CompositorFrameSinkTest, ContextLossFailsBind) { - scoped_refptr<TestContextProvider> context_provider = - TestContextProvider::Create(); - scoped_refptr<TestContextProvider> worker_provider = - TestContextProvider::CreateWorker(); - - // Lose the context so BindToClient fails. - context_provider->UnboundTestContext3d()->set_context_lost(true); - - TestCompositorFrameSink compositor_frame_sink(context_provider, - worker_provider); - EXPECT_FALSE(compositor_frame_sink.HasClient()); - - FakeCompositorFrameSinkClient client; - EXPECT_FALSE(compositor_frame_sink.BindToClient(&client)); - EXPECT_FALSE(compositor_frame_sink.HasClient()); -} - -} // namespace -} // namespace cc
diff --git a/cc/output/compositor_frame_sink.cc b/cc/output/layer_tree_frame_sink.cc similarity index 73% rename from cc/output/compositor_frame_sink.cc rename to cc/output/layer_tree_frame_sink.cc index 607ddf1..fedee969 100644 --- a/cc/output/compositor_frame_sink.cc +++ b/cc/output/layer_tree_frame_sink.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 "cc/output/compositor_frame_sink.h" +#include "cc/output/layer_tree_frame_sink.h" #include <stdint.h> @@ -11,14 +11,14 @@ #include "base/macros.h" #include "base/threading/thread_task_runner_handle.h" #include "base/trace_event/trace_event.h" -#include "cc/output/compositor_frame_sink_client.h" +#include "cc/output/layer_tree_frame_sink_client.h" #include "gpu/GLES2/gl2extchromium.h" #include "gpu/command_buffer/client/context_support.h" #include "gpu/command_buffer/client/gles2_interface.h" namespace cc { -CompositorFrameSink::CompositorFrameSink( +LayerTreeFrameSink::LayerTreeFrameSink( scoped_refptr<ContextProvider> context_provider, scoped_refptr<ContextProvider> worker_context_provider, gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, @@ -26,22 +26,20 @@ : context_provider_(std::move(context_provider)), worker_context_provider_(std::move(worker_context_provider)), gpu_memory_buffer_manager_(gpu_memory_buffer_manager), - shared_bitmap_manager_(shared_bitmap_manager) { -} + shared_bitmap_manager_(shared_bitmap_manager) {} -CompositorFrameSink::CompositorFrameSink( +LayerTreeFrameSink::LayerTreeFrameSink( scoped_refptr<VulkanContextProvider> vulkan_context_provider) : vulkan_context_provider_(vulkan_context_provider), gpu_memory_buffer_manager_(nullptr), - shared_bitmap_manager_(nullptr) { -} + shared_bitmap_manager_(nullptr) {} -CompositorFrameSink::~CompositorFrameSink() { +LayerTreeFrameSink::~LayerTreeFrameSink() { if (client_) DetachFromClient(); } -bool CompositorFrameSink::BindToClient(CompositorFrameSinkClient* client) { +bool LayerTreeFrameSink::BindToClient(LayerTreeFrameSinkClient* client) { DCHECK(client); DCHECK(!client_); client_ = client; @@ -51,7 +49,7 @@ success = context_provider_->BindToCurrentThread(); if (success) { context_provider_->SetLostContextCallback( - base::Bind(&CompositorFrameSink::DidLoseCompositorFrameSink, + base::Bind(&LayerTreeFrameSink::DidLoseLayerTreeFrameSink, base::Unretained(this))); } } @@ -65,7 +63,7 @@ return success; } -void CompositorFrameSink::DetachFromClient() { +void LayerTreeFrameSink::DetachFromClient() { DCHECK(client_); if (context_provider_.get()) { @@ -77,9 +75,9 @@ client_ = nullptr; } -void CompositorFrameSink::DidLoseCompositorFrameSink() { - TRACE_EVENT0("cc", "CompositorFrameSink::DidLoseCompositorFrameSink"); - client_->DidLoseCompositorFrameSink(); +void LayerTreeFrameSink::DidLoseLayerTreeFrameSink() { + TRACE_EVENT0("cc", "LayerTreeFrameSink::DidLoseLayerTreeFrameSink"); + client_->DidLoseLayerTreeFrameSink(); } } // namespace cc
diff --git a/cc/output/compositor_frame_sink.h b/cc/output/layer_tree_frame_sink.h similarity index 75% rename from cc/output/compositor_frame_sink.h rename to cc/output/layer_tree_frame_sink.h index 28b7258..94d8231 100644 --- a/cc/output/compositor_frame_sink.h +++ b/cc/output/layer_tree_frame_sink.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 CC_OUTPUT_COMPOSITOR_FRAME_SINK_H_ -#define CC_OUTPUT_COMPOSITOR_FRAME_SINK_H_ +#ifndef CC_OUTPUT_LAYER_TREE_FRAME_SINK_H_ +#define CC_OUTPUT_LAYER_TREE_FRAME_SINK_H_ #include <deque> #include <memory> @@ -27,17 +27,17 @@ struct BeginFrameAck; class CompositorFrame; -class CompositorFrameSinkClient; +class LayerTreeFrameSinkClient; class LocalSurfaceId; class SharedBitmapManager; // An interface for submitting CompositorFrames to a display compositor -// which will compose frames from multiple CompositorFrameSinks to show -// on screen to the user. +// which will compose frames from multiple clients to show on screen to the +// user. // If a context_provider() is present, frames should be submitted with // OpenGL resources (created with the context_provider()). If not, then // SharedBitmap resources should be used. -class CC_EXPORT CompositorFrameSink { +class CC_EXPORT LayerTreeFrameSink { public: struct Capabilities { Capabilities() = default; @@ -56,33 +56,33 @@ // Constructor for GL-based and/or software resources. // gpu_memory_buffer_manager and shared_bitmap_manager must outlive the - // CompositorFrameSink. + // LayerTreeFrameSink. // shared_bitmap_manager is optional (won't be used) if context_provider is // present. // gpu_memory_buffer_manager is optional (won't be used) if context_provider // is not present. - CompositorFrameSink(scoped_refptr<ContextProvider> context_provider, - scoped_refptr<ContextProvider> worker_context_provider, - gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, - SharedBitmapManager* shared_bitmap_manager); + LayerTreeFrameSink(scoped_refptr<ContextProvider> context_provider, + scoped_refptr<ContextProvider> worker_context_provider, + gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, + SharedBitmapManager* shared_bitmap_manager); // Constructor for Vulkan-based resources. - explicit CompositorFrameSink( + explicit LayerTreeFrameSink( scoped_refptr<VulkanContextProvider> vulkan_context_provider); - virtual ~CompositorFrameSink(); + virtual ~LayerTreeFrameSink(); // Called by the compositor on the compositor thread. This is a place where // thread-specific data for the output surface can be initialized, since from // this point to when DetachFromClient() is called the output surface will // only be used on the compositor thread. // The caller should call DetachFromClient() on the same thread before - // destroying the CompositorFrameSink, even if this fails. And BindToClient - // should not be called twice for a given CompositorFrameSink. - virtual bool BindToClient(CompositorFrameSinkClient* client); + // destroying the LayerTreeFrameSink, even if this fails. And BindToClient + // should not be called twice for a given LayerTreeFrameSink. + virtual bool BindToClient(LayerTreeFrameSinkClient* client); // Must be called from the thread where BindToClient was called if - // BindToClient succeeded, after which the CompositorFrameSink may be + // BindToClient succeeded, after which the LayerTreeFrameSink may be // destroyed from any thread. This is a place where thread-specific data for // the object can be uninitialized. virtual void DetachFromClient(); @@ -107,14 +107,13 @@ return shared_bitmap_manager_; } - // If supported, this sets the LocalSurfaceId the CompositorFrameSink will use + // If supported, this sets the LocalSurfaceId the LayerTreeFrameSink will use // to submit a CompositorFrame. virtual void SetLocalSurfaceId(const LocalSurfaceId& local_surface_id) {} - // Support for a pull-model where draws are requested by the output surface. - // - // CompositorFrameSink::Invalidate is called by the compositor to notify that - // there's new content. + // Support for a pull-model where draws are requested by the implementation of + // LayerTreeFrameSink. This is called by the compositor to notify that there's + // new content. virtual void Invalidate() {} // For successful swaps, the implementation must call @@ -129,11 +128,11 @@ protected: // Bound to the ContextProvider to hear about when it is lost and inform the // |client_|. - void DidLoseCompositorFrameSink(); + void DidLoseLayerTreeFrameSink(); - CompositorFrameSinkClient* client_ = nullptr; + LayerTreeFrameSinkClient* client_ = nullptr; - struct CompositorFrameSink::Capabilities capabilities_; + struct LayerTreeFrameSink::Capabilities capabilities_; scoped_refptr<ContextProvider> context_provider_; scoped_refptr<ContextProvider> worker_context_provider_; scoped_refptr<VulkanContextProvider> vulkan_context_provider_; @@ -141,9 +140,9 @@ SharedBitmapManager* shared_bitmap_manager_; private: - DISALLOW_COPY_AND_ASSIGN(CompositorFrameSink); + DISALLOW_COPY_AND_ASSIGN(LayerTreeFrameSink); }; } // namespace cc -#endif // CC_OUTPUT_COMPOSITOR_FRAME_SINK_H_ +#endif // CC_OUTPUT_LAYER_TREE_FRAME_SINK_H_
diff --git a/cc/output/compositor_frame_sink_client.h b/cc/output/layer_tree_frame_sink_client.h similarity index 80% rename from cc/output/compositor_frame_sink_client.h rename to cc/output/layer_tree_frame_sink_client.h index afc9b3a..9cf8728 100644 --- a/cc/output/compositor_frame_sink_client.h +++ b/cc/output/layer_tree_frame_sink_client.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 CC_OUTPUT_COMPOSITOR_FRAME_SINK_CLIENT_H_ -#define CC_OUTPUT_COMPOSITOR_FRAME_SINK_CLIENT_H_ +#ifndef CC_OUTPUT_LAYER_TREE_FRAME_SINK_CLIENT_H_ +#define CC_OUTPUT_LAYER_TREE_FRAME_SINK_CLIENT_H_ #include "base/callback.h" #include "base/memory/ref_counted.h" @@ -23,10 +23,10 @@ class BeginFrameSource; struct ManagedMemoryPolicy; -class CC_EXPORT CompositorFrameSinkClient { +class CC_EXPORT LayerTreeFrameSinkClient { public: // Pass the begin frame source for the client to observe. Client does not own - // the BeginFrameSource. CompositorFrameSink should call this once after + // the BeginFrameSource. LayerTreeFrameSink should call this once after // binding to the client and then call again with a null while detaching. virtual void SetBeginFrameSource(BeginFrameSource* source) = 0; @@ -35,7 +35,7 @@ // If set, |callback| will be called subsequent to each new tree activation, // regardless of the compositor visibility or damage. |callback| must remain - // valid for the lifetime of the CompositorFrameSinkClient or until + // valid for the lifetime of the LayerTreeFrameSinkClient or until // unregistered by giving a null base::Closure. virtual void SetTreeActivationCallback(const base::Closure& callback) = 0; @@ -45,10 +45,10 @@ // so that frames are submitted only at the rate it can handle them. virtual void DidReceiveCompositorFrameAck() = 0; - // The CompositorFrameSink is lost when the ContextProviders held by it - // encounter an error. In this case the CompositorFrameSink (and the + // The LayerTreeFrameSink is lost when the ContextProviders held by it + // encounter an error. In this case the LayerTreeFrameSink (and the // ContextProviders) must be recreated. - virtual void DidLoseCompositorFrameSink() = 0; + virtual void DidLoseLayerTreeFrameSink() = 0; // For SynchronousCompositor (WebView) to ask the layer compositor to submit // a new CompositorFrame synchronously. @@ -68,9 +68,9 @@ const gfx::Transform& transform) = 0; protected: - virtual ~CompositorFrameSinkClient() {} + virtual ~LayerTreeFrameSinkClient() {} }; } // namespace cc -#endif // CC_OUTPUT_COMPOSITOR_FRAME_SINK_CLIENT_H_ +#endif // CC_OUTPUT_LAYER_TREE_FRAME_SINK_CLIENT_H_
diff --git a/cc/output/layer_tree_frame_sink_unittest.cc b/cc/output/layer_tree_frame_sink_unittest.cc new file mode 100644 index 0000000..9fc98f7 --- /dev/null +++ b/cc/output/layer_tree_frame_sink_unittest.cc
@@ -0,0 +1,74 @@ +// 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 "cc/output/layer_tree_frame_sink.h" + +#include "base/memory/ptr_util.h" +#include "cc/output/compositor_frame.h" +#include "cc/test/fake_layer_tree_frame_sink_client.h" +#include "cc/test/test_context_provider.h" +#include "cc/test/test_web_graphics_context_3d.h" +#include "gpu/GLES2/gl2extchromium.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace cc { +namespace { + +class TestLayerTreeFrameSink : public LayerTreeFrameSink { + public: + explicit TestLayerTreeFrameSink( + scoped_refptr<TestContextProvider> context_provider, + scoped_refptr<TestContextProvider> worker_context_provider) + : LayerTreeFrameSink(std::move(context_provider), + std::move(worker_context_provider), + nullptr, + nullptr) {} + + void SubmitCompositorFrame(CompositorFrame frame) override { + client_->DidReceiveCompositorFrameAck(); + } + void DidNotProduceFrame(const BeginFrameAck& ack) override {} +}; + +TEST(LayerTreeFrameSinkTest, ContextLossInformsClient) { + scoped_refptr<TestContextProvider> provider = TestContextProvider::Create(); + scoped_refptr<TestContextProvider> worker_provider = + TestContextProvider::CreateWorker(); + TestLayerTreeFrameSink layer_tree_frame_sink(provider, worker_provider); + EXPECT_FALSE(layer_tree_frame_sink.HasClient()); + + FakeLayerTreeFrameSinkClient client; + EXPECT_TRUE(layer_tree_frame_sink.BindToClient(&client)); + EXPECT_TRUE(layer_tree_frame_sink.HasClient()); + + // Verify DidLoseLayerTreeFrameSink callback is hooked up correctly. + EXPECT_FALSE(client.did_lose_layer_tree_frame_sink_called()); + layer_tree_frame_sink.context_provider()->ContextGL()->LoseContextCHROMIUM( + GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB); + layer_tree_frame_sink.context_provider()->ContextGL()->Flush(); + EXPECT_TRUE(client.did_lose_layer_tree_frame_sink_called()); +} + +// TODO(danakj): Add a test for worker context failure as well when +// LayerTreeFrameSink creates/binds it. +TEST(LayerTreeFrameSinkTest, ContextLossFailsBind) { + scoped_refptr<TestContextProvider> context_provider = + TestContextProvider::Create(); + scoped_refptr<TestContextProvider> worker_provider = + TestContextProvider::CreateWorker(); + + // Lose the context so BindToClient fails. + context_provider->UnboundTestContext3d()->set_context_lost(true); + + TestLayerTreeFrameSink layer_tree_frame_sink(context_provider, + worker_provider); + EXPECT_FALSE(layer_tree_frame_sink.HasClient()); + + FakeLayerTreeFrameSinkClient client; + EXPECT_FALSE(layer_tree_frame_sink.BindToClient(&client)); + EXPECT_FALSE(layer_tree_frame_sink.HasClient()); +} + +} // namespace +} // namespace cc
diff --git a/cc/scheduler/commit_earlyout_reason.h b/cc/scheduler/commit_earlyout_reason.h index cd79c5c..b272b34 100644 --- a/cc/scheduler/commit_earlyout_reason.h +++ b/cc/scheduler/commit_earlyout_reason.h
@@ -11,7 +11,7 @@ namespace cc { enum class CommitEarlyOutReason { - ABORTED_COMPOSITOR_FRAME_SINK_LOST, + ABORTED_LAYER_TREE_FRAME_SINK_LOST, ABORTED_NOT_VISIBLE, ABORTED_DEFERRED_COMMIT, FINISHED_NO_UPDATES, @@ -19,8 +19,8 @@ inline const char* CommitEarlyOutReasonToString(CommitEarlyOutReason reason) { switch (reason) { - case CommitEarlyOutReason::ABORTED_COMPOSITOR_FRAME_SINK_LOST: - return "CommitEarlyOutReason::ABORTED_COMPOSITOR_FRAME_SINK_LOST"; + case CommitEarlyOutReason::ABORTED_LAYER_TREE_FRAME_SINK_LOST: + return "CommitEarlyOutReason::ABORTED_LAYER_TREE_FRAME_SINK_LOST"; case CommitEarlyOutReason::ABORTED_NOT_VISIBLE: return "CommitEarlyOutReason::ABORTED_NOT_VISIBLE"; case CommitEarlyOutReason::ABORTED_DEFERRED_COMMIT:
diff --git a/cc/scheduler/compositor_timing_history.cc b/cc/scheduler/compositor_timing_history.cc index d53023a..9b25f361 100644 --- a/cc/scheduler/compositor_timing_history.cc +++ b/cc/scheduler/compositor_timing_history.cc
@@ -459,7 +459,7 @@ return draw_duration_history_.Percentile(kDrawEstimationPercentile); } -void CompositorTimingHistory::DidCreateAndInitializeCompositorFrameSink() { +void CompositorTimingHistory::DidCreateAndInitializeLayerTreeFrameSink() { // After we get a new output surface, we won't get a spurious // CompositorFrameAck from the old output surface. submit_start_time_ = base::TimeTicks();
diff --git a/cc/scheduler/compositor_timing_history.h b/cc/scheduler/compositor_timing_history.h index 58f5a20..21a6eae 100644 --- a/cc/scheduler/compositor_timing_history.h +++ b/cc/scheduler/compositor_timing_history.h
@@ -52,7 +52,7 @@ // State that affects when events should be expected/recorded/reported. void SetRecordingEnabled(bool enabled); - void DidCreateAndInitializeCompositorFrameSink(); + void DidCreateAndInitializeLayerTreeFrameSink(); // Events to be timed. void WillBeginImplFrame(bool new_active_tree_is_likely,
diff --git a/cc/scheduler/scheduler.cc b/cc/scheduler/scheduler.cc index ac507a3d..ee5c3b7 100644 --- a/cc/scheduler/scheduler.cc +++ b/cc/scheduler/scheduler.cc
@@ -180,19 +180,19 @@ state_machine_.DidPrepareTiles(); } -void Scheduler::DidLoseCompositorFrameSink() { - TRACE_EVENT0("cc", "Scheduler::DidLoseCompositorFrameSink"); - state_machine_.DidLoseCompositorFrameSink(); +void Scheduler::DidLoseLayerTreeFrameSink() { + TRACE_EVENT0("cc", "Scheduler::DidLoseLayerTreeFrameSink"); + state_machine_.DidLoseLayerTreeFrameSink(); UpdateCompositorTimingHistoryRecordingEnabled(); ProcessScheduledActions(); } -void Scheduler::DidCreateAndInitializeCompositorFrameSink() { - TRACE_EVENT0("cc", "Scheduler::DidCreateAndInitializeCompositorFrameSink"); +void Scheduler::DidCreateAndInitializeLayerTreeFrameSink() { + TRACE_EVENT0("cc", "Scheduler::DidCreateAndInitializeLayerTreeFrameSink"); DCHECK(!observing_begin_frame_source_); DCHECK(begin_impl_frame_deadline_task_.IsCancelled()); - state_machine_.DidCreateAndInitializeCompositorFrameSink(); - compositor_timing_history_->DidCreateAndInitializeCompositorFrameSink(); + state_machine_.DidCreateAndInitializeLayerTreeFrameSink(); + compositor_timing_history_->DidCreateAndInitializeLayerTreeFrameSink(); UpdateCompositorTimingHistoryRecordingEnabled(); ProcessScheduledActions(); } @@ -304,7 +304,7 @@ ProcessScheduledActions(); } -void Scheduler::OnDrawForCompositorFrameSink(bool resourceless_software_draw) { +void Scheduler::OnDrawForLayerTreeFrameSink(bool resourceless_software_draw) { DCHECK(settings_.using_synchronous_renderer_compositor); DCHECK_EQ(state_machine_.begin_impl_frame_state(), SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); @@ -475,7 +475,7 @@ DCHECK_EQ(state_machine_.begin_impl_frame_state(), SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); DCHECK(begin_impl_frame_deadline_task_.IsCancelled()); - DCHECK(state_machine_.HasInitializedCompositorFrameSink()); + DCHECK(state_machine_.HasInitializedLayerTreeFrameSink()); begin_impl_frame_tracker_.Start(args); state_machine_.OnBeginImplFrame(args.source_id, args.sequence_number); @@ -684,17 +684,17 @@ compositor_timing_history_->DrawAborted(); break; } - case SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION: - state_machine_.WillBeginCompositorFrameSinkCreation(); - client_->ScheduledActionBeginCompositorFrameSinkCreation(); + case SchedulerStateMachine::ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION: + state_machine_.WillBeginLayerTreeFrameSinkCreation(); + client_->ScheduledActionBeginLayerTreeFrameSinkCreation(); break; case SchedulerStateMachine::ACTION_PREPARE_TILES: state_machine_.WillPrepareTiles(); client_->ScheduledActionPrepareTiles(); break; - case SchedulerStateMachine::ACTION_INVALIDATE_COMPOSITOR_FRAME_SINK: { - state_machine_.WillInvalidateCompositorFrameSink(); - client_->ScheduledActionInvalidateCompositorFrameSink(); + case SchedulerStateMachine::ACTION_INVALIDATE_LAYER_TREE_FRAME_SINK: { + state_machine_.WillInvalidateLayerTreeFrameSink(); + client_->ScheduledActionInvalidateLayerTreeFrameSink(); break; } } @@ -766,7 +766,7 @@ void Scheduler::UpdateCompositorTimingHistoryRecordingEnabled() { compositor_timing_history_->SetRecordingEnabled( - state_machine_.HasInitializedCompositorFrameSink() && + state_machine_.HasInitializedLayerTreeFrameSink() && state_machine_.visible()); }
diff --git a/cc/scheduler/scheduler.h b/cc/scheduler/scheduler.h index 72241c5..aa1aad6a 100644 --- a/cc/scheduler/scheduler.h +++ b/cc/scheduler/scheduler.h
@@ -42,9 +42,9 @@ virtual DrawResult ScheduledActionDrawForced() = 0; virtual void ScheduledActionCommit() = 0; virtual void ScheduledActionActivateSyncTree() = 0; - virtual void ScheduledActionBeginCompositorFrameSinkCreation() = 0; + virtual void ScheduledActionBeginLayerTreeFrameSinkCreation() = 0; virtual void ScheduledActionPrepareTiles() = 0; - virtual void ScheduledActionInvalidateCompositorFrameSink() = 0; + virtual void ScheduledActionInvalidateLayerTreeFrameSink() = 0; virtual void ScheduledActionPerformImplSideInvalidation() = 0; virtual void DidFinishImplFrame() = 0; virtual void DidNotProduceFrame(const BeginFrameAck& ack) = 0; @@ -73,7 +73,7 @@ void OnBeginFrameSourcePausedChanged(bool paused) override; bool OnBeginFrameDerivedImpl(const BeginFrameArgs& args) override; - void OnDrawForCompositorFrameSink(bool resourceless_software_draw); + void OnDrawForLayerTreeFrameSink(bool resourceless_software_draw); const SchedulerSettings& settings() const { return settings_; } @@ -103,9 +103,9 @@ void SetNeedsImplSideInvalidation(); // Drawing should result in submitting a CompositorFrame to the - // CompositorFrameSink and then calling this. + // LayerTreeFrameSink and then calling this. void DidSubmitCompositorFrame(); - // The CompositorFrameSink acks when it is ready for a new frame which + // The LayerTreeFrameSink acks when it is ready for a new frame which // should result in this getting called to unblock the next draw. void DidReceiveCompositorFrameAck(); @@ -118,8 +118,8 @@ void WillPrepareTiles(); void DidPrepareTiles(); - void DidLoseCompositorFrameSink(); - void DidCreateAndInitializeCompositorFrameSink(); + void DidLoseLayerTreeFrameSink(); + void DidCreateAndInitializeLayerTreeFrameSink(); // Tests do not want to shut down until all possible BeginMainFrames have // occured to prevent flakiness.
diff --git a/cc/scheduler/scheduler_state_machine.cc b/cc/scheduler/scheduler_state_machine.cc index cbfe4f63..0f5df578 100644 --- a/cc/scheduler/scheduler_state_machine.cc +++ b/cc/scheduler/scheduler_state_machine.cc
@@ -23,19 +23,19 @@ SchedulerStateMachine::~SchedulerStateMachine() = default; -const char* SchedulerStateMachine::CompositorFrameSinkStateToString( - CompositorFrameSinkState state) { +const char* SchedulerStateMachine::LayerTreeFrameSinkStateToString( + LayerTreeFrameSinkState state) { switch (state) { - case COMPOSITOR_FRAME_SINK_NONE: - return "COMPOSITOR_FRAME_SINK_NONE"; - case COMPOSITOR_FRAME_SINK_ACTIVE: - return "COMPOSITOR_FRAME_SINK_ACTIVE"; - case COMPOSITOR_FRAME_SINK_CREATING: - return "COMPOSITOR_FRAME_SINK_CREATING"; - case COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_COMMIT: - return "COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_COMMIT"; - case COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_ACTIVATION: - return "COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_ACTIVATION"; + case LAYER_TREE_FRAME_SINK_NONE: + return "LAYER_TREE_FRAME_SINK_NONE"; + case LAYER_TREE_FRAME_SINK_ACTIVE: + return "LAYER_TREE_FRAME_SINK_ACTIVE"; + case LAYER_TREE_FRAME_SINK_CREATING: + return "LAYER_TREE_FRAME_SINK_CREATING"; + case LAYER_TREE_FRAME_SINK_WAITING_FOR_FIRST_COMMIT: + return "LAYER_TREE_FRAME_SINK_WAITING_FOR_FIRST_COMMIT"; + case LAYER_TREE_FRAME_SINK_WAITING_FOR_FIRST_ACTIVATION: + return "LAYER_TREE_FRAME_SINK_WAITING_FOR_FIRST_ACTIVATION"; } NOTREACHED(); return "???"; @@ -132,12 +132,12 @@ return "ACTION_DRAW_FORCED"; case ACTION_DRAW_ABORT: return "ACTION_DRAW_ABORT"; - case ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION: - return "ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION"; + case ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION: + return "ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION"; case ACTION_PREPARE_TILES: return "ACTION_PREPARE_TILES"; - case ACTION_INVALIDATE_COMPOSITOR_FRAME_SINK: - return "ACTION_INVALIDATE_COMPOSITOR_FRAME_SINK"; + case ACTION_INVALIDATE_LAYER_TREE_FRAME_SINK: + return "ACTION_INVALIDATE_LAYER_TREE_FRAME_SINK"; case ACTION_PERFORM_IMPL_SIDE_INVALIDATION: return "ACTION_PERFORM_IMPL_SIDE_INVALIDATION"; case ACTION_NOTIFY_BEGIN_MAIN_FRAME_NOT_SENT: @@ -164,8 +164,8 @@ state->SetString("begin_main_frame_state", BeginMainFrameStateToString(begin_main_frame_state_)); state->SetString( - "compositor_frame_sink_state", - CompositorFrameSinkStateToString(compositor_frame_sink_state_)); + "layer_tree_frame_sink_state", + LayerTreeFrameSinkStateToString(layer_tree_frame_sink_state_)); state->SetString("forced_redraw_state", ForcedRedrawOnTimeoutStateToString(forced_redraw_state_)); state->EndDictionary(); @@ -199,16 +199,16 @@ state->SetBoolean("wants_begin_main_frame_not_expected", wants_begin_main_frame_not_expected_); state->SetBoolean("did_commit_during_frame", did_commit_during_frame_); - state->SetBoolean("did_invalidate_compositor_frame_sink", - did_invalidate_compositor_frame_sink_); + state->SetBoolean("did_invalidate_layer_tree_frame_sink", + did_invalidate_layer_tree_frame_sink_); state->SetBoolean("did_perform_impl_side_invalidaion", did_perform_impl_side_invalidation_); state->SetBoolean("did_prepare_tiles", did_prepare_tiles_); state->SetInteger("consecutive_checkerboard_animations", consecutive_checkerboard_animations_); state->SetInteger("pending_submit_frames", pending_submit_frames_); - state->SetInteger("submit_frames_with_current_compositor_frame_sink", - submit_frames_with_current_compositor_frame_sink_); + state->SetInteger("submit_frames_with_current_layer_tree_frame_sink", + submit_frames_with_current_layer_tree_frame_sink_); state->SetBoolean("needs_redraw", needs_redraw_); state->SetBoolean("needs_prepare_tiles", needs_prepare_tiles_); state->SetBoolean("needs_begin_main_frame", needs_begin_main_frame_); @@ -223,8 +223,8 @@ state->SetBoolean("active_tree_needs_first_draw", active_tree_needs_first_draw_); state->SetBoolean("wait_for_ready_to_draw", wait_for_ready_to_draw_); - state->SetBoolean("did_create_and_initialize_first_compositor_frame_sink", - did_create_and_initialize_first_compositor_frame_sink_); + state->SetBoolean("did_create_and_initialize_first_layer_tree_frame_sink", + did_create_and_initialize_first_layer_tree_frame_sink_); state->SetString("tree_priority", TreePriorityToString(tree_priority_)); state->SetString("scroll_handler_state", ScrollHandlerStateToString(scroll_handler_state_)); @@ -253,10 +253,10 @@ // pending activations will be forced and draws will be aborted. However, // when the embedder is Android WebView, software draws could be scheduled by // the Android OS at any time and draws should not be aborted in this case. - bool is_compositor_frame_sink_lost = - (compositor_frame_sink_state_ == COMPOSITOR_FRAME_SINK_NONE); + bool is_layer_tree_frame_sink_lost = + (layer_tree_frame_sink_state_ == LAYER_TREE_FRAME_SINK_NONE); if (resourceless_draw_) - return is_compositor_frame_sink_lost || !can_draw_; + return is_layer_tree_frame_sink_lost || !can_draw_; // These are all the cases where we normally cannot or do not want to draw // but, if needs_redraw_ is true and we do not draw to make forward progress, @@ -264,7 +264,7 @@ // This should be a superset of PendingActivationsShouldBeForced() since // activation of the pending tree is blocked by drawing of the active tree and // the main thread might be blocked on activation of the most recent commit. - return is_compositor_frame_sink_lost || !can_draw_ || !visible_ || + return is_layer_tree_frame_sink_lost || !can_draw_ || !visible_ || begin_frame_source_paused_; } @@ -272,7 +272,7 @@ // There is no output surface to trigger our activations. // If we do not force activations to make forward progress, we might deadlock // with the main thread. - if (compositor_frame_sink_state_ == COMPOSITOR_FRAME_SINK_NONE) + if (layer_tree_frame_sink_state_ == LAYER_TREE_FRAME_SINK_NONE) return true; // If we're not visible, we should force activation. @@ -293,7 +293,7 @@ return false; } -bool SchedulerStateMachine::ShouldBeginCompositorFrameSinkCreation() const { +bool SchedulerStateMachine::ShouldBeginLayerTreeFrameSinkCreation() const { if (!visible_) return false; @@ -303,8 +303,8 @@ return false; } - // Make sure the BeginImplFrame from any previous CompositorFrameSinks - // are complete before creating the new CompositorFrameSink. + // Make sure the BeginImplFrame from any previous LayerTreeFrameSinks + // are complete before creating the new LayerTreeFrameSink. if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_IDLE) return false; @@ -317,7 +317,7 @@ // We need to create the output surface if we don't have one and we haven't // started creating one yet. - return compositor_frame_sink_state_ == COMPOSITOR_FRAME_SINK_NONE; + return layer_tree_frame_sink_state_ == LAYER_TREE_FRAME_SINK_NONE; } bool SchedulerStateMachine::ShouldDraw() const { @@ -335,7 +335,7 @@ return false; // Don't draw if we are waiting on the first commit after a surface. - if (compositor_frame_sink_state_ != COMPOSITOR_FRAME_SINK_ACTIVE) + if (layer_tree_frame_sink_state_ != LAYER_TREE_FRAME_SINK_ACTIVE) return false; // Do not queue too many draws. @@ -491,8 +491,8 @@ if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_COMMIT) return true; - // We shouldn't normally accept commits if there isn't an CompositorFrameSink. - if (!HasInitializedCompositorFrameSink()) + // We shouldn't normally accept commits if there isn't a LayerTreeFrameSink. + if (!HasInitializedLayerTreeFrameSink()) return false; if (!settings_.main_frame_while_submit_frame_throttled_enabled) { @@ -549,9 +549,9 @@ return needs_prepare_tiles_; } -bool SchedulerStateMachine::ShouldInvalidateCompositorFrameSink() const { +bool SchedulerStateMachine::ShouldInvalidateLayerTreeFrameSink() const { // Do not invalidate more than once per begin frame. - if (did_invalidate_compositor_frame_sink_) + if (did_invalidate_layer_tree_frame_sink_) return false; // Only the synchronous compositor requires invalidations. @@ -587,10 +587,10 @@ return ACTION_PREPARE_TILES; if (ShouldSendBeginMainFrame()) return ACTION_SEND_BEGIN_MAIN_FRAME; - if (ShouldInvalidateCompositorFrameSink()) - return ACTION_INVALIDATE_COMPOSITOR_FRAME_SINK; - if (ShouldBeginCompositorFrameSinkCreation()) - return ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION; + if (ShouldInvalidateLayerTreeFrameSink()) + return ACTION_INVALIDATE_LAYER_TREE_FRAME_SINK; + if (ShouldBeginLayerTreeFrameSinkCreation()) + return ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION; if (ShouldNotifyBeginMainFrameNotSent()) return ACTION_NOTIFY_BEGIN_MAIN_FRAME_NOT_SENT; return ACTION_NONE; @@ -659,7 +659,7 @@ return false; // Don't create a pending tree till a frame sink is initialized. - if (!HasInitializedCompositorFrameSink()) + if (!HasInitializedLayerTreeFrameSink()) return false; return true; @@ -739,18 +739,18 @@ } // Update the output surface state. - if (compositor_frame_sink_state_ == - COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_COMMIT) { - compositor_frame_sink_state_ = - has_pending_tree_ ? COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_ACTIVATION - : COMPOSITOR_FRAME_SINK_ACTIVE; + if (layer_tree_frame_sink_state_ == + LAYER_TREE_FRAME_SINK_WAITING_FOR_FIRST_COMMIT) { + layer_tree_frame_sink_state_ = + has_pending_tree_ ? LAYER_TREE_FRAME_SINK_WAITING_FOR_FIRST_ACTIVATION + : LAYER_TREE_FRAME_SINK_ACTIVE; } } void SchedulerStateMachine::WillActivate() { - if (compositor_frame_sink_state_ == - COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_ACTIVATION) - compositor_frame_sink_state_ = COMPOSITOR_FRAME_SINK_ACTIVE; + if (layer_tree_frame_sink_state_ == + LAYER_TREE_FRAME_SINK_WAITING_FOR_FIRST_ACTIVATION) + layer_tree_frame_sink_state_ = LAYER_TREE_FRAME_SINK_ACTIVE; if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_ACTIVATION) forced_redraw_state_ = FORCED_REDRAW_STATE_WAITING_FOR_DRAW; @@ -863,9 +863,9 @@ needs_prepare_tiles_ = false; } -void SchedulerStateMachine::WillBeginCompositorFrameSinkCreation() { - DCHECK_EQ(compositor_frame_sink_state_, COMPOSITOR_FRAME_SINK_NONE); - compositor_frame_sink_state_ = COMPOSITOR_FRAME_SINK_CREATING; +void SchedulerStateMachine::WillBeginLayerTreeFrameSinkCreation() { + DCHECK_EQ(layer_tree_frame_sink_state_, LAYER_TREE_FRAME_SINK_NONE); + layer_tree_frame_sink_state_ = LAYER_TREE_FRAME_SINK_CREATING; // The following DCHECKs make sure we are in the proper quiescent state. // The pipeline should be flushed entirely before we start output @@ -875,10 +875,10 @@ DCHECK(!active_tree_needs_first_draw_); } -void SchedulerStateMachine::WillInvalidateCompositorFrameSink() { - DCHECK(!did_invalidate_compositor_frame_sink_); - did_invalidate_compositor_frame_sink_ = true; - last_frame_number_invalidate_compositor_frame_sink_performed_ = +void SchedulerStateMachine::WillInvalidateLayerTreeFrameSink() { + DCHECK(!did_invalidate_layer_tree_frame_sink_); + did_invalidate_layer_tree_frame_sink_ = true; + last_frame_number_invalidate_layer_tree_frame_sink_performed_ = current_frame_number_; // The synchronous compositor makes no guarantees about a draw coming in after @@ -900,7 +900,7 @@ bool SchedulerStateMachine::BeginFrameNeeded() const { // We can't handle BeginFrames when output surface isn't initialized. // TODO(brianderson): Support output surface creation inside a BeginFrame. - if (!HasInitializedCompositorFrameSink()) + if (!HasInitializedLayerTreeFrameSink()) return false; // If we are not visible, we don't need BeginFrame messages. @@ -1048,7 +1048,7 @@ did_notify_begin_main_frame_not_sent_ = false; did_send_begin_main_frame_for_current_frame_ = false; did_commit_during_frame_ = false; - did_invalidate_compositor_frame_sink_ = false; + did_invalidate_layer_tree_frame_sink_ = false; did_perform_impl_side_invalidation_ = false; } @@ -1199,7 +1199,7 @@ DCHECK_LT(pending_submit_frames_, kMaxPendingSubmitFrames); pending_submit_frames_++; - submit_frames_with_current_compositor_frame_sink_++; + submit_frames_with_current_layer_tree_frame_sink_++; did_submit_in_last_frame_ = true; last_frame_number_submit_performed_ = current_frame_number_; @@ -1264,7 +1264,7 @@ main_thread_missed_last_deadline_ = false; switch (reason) { - case CommitEarlyOutReason::ABORTED_COMPOSITOR_FRAME_SINK_LOST: + case CommitEarlyOutReason::ABORTED_LAYER_TREE_FRAME_SINK_LOST: case CommitEarlyOutReason::ABORTED_NOT_VISIBLE: case CommitEarlyOutReason::ABORTED_DEFERRED_COMMIT: begin_main_frame_state_ = BEGIN_MAIN_FRAME_STATE_IDLE; @@ -1282,11 +1282,11 @@ did_prepare_tiles_ = true; } -void SchedulerStateMachine::DidLoseCompositorFrameSink() { - if (compositor_frame_sink_state_ == COMPOSITOR_FRAME_SINK_NONE || - compositor_frame_sink_state_ == COMPOSITOR_FRAME_SINK_CREATING) +void SchedulerStateMachine::DidLoseLayerTreeFrameSink() { + if (layer_tree_frame_sink_state_ == LAYER_TREE_FRAME_SINK_NONE || + layer_tree_frame_sink_state_ == LAYER_TREE_FRAME_SINK_CREATING) return; - compositor_frame_sink_state_ = COMPOSITOR_FRAME_SINK_NONE; + layer_tree_frame_sink_state_ = LAYER_TREE_FRAME_SINK_NONE; needs_redraw_ = false; wait_for_ready_to_draw_ = false; } @@ -1300,18 +1300,18 @@ wait_for_ready_to_draw_ = false; } -void SchedulerStateMachine::DidCreateAndInitializeCompositorFrameSink() { - DCHECK_EQ(compositor_frame_sink_state_, COMPOSITOR_FRAME_SINK_CREATING); - compositor_frame_sink_state_ = COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_COMMIT; +void SchedulerStateMachine::DidCreateAndInitializeLayerTreeFrameSink() { + DCHECK_EQ(layer_tree_frame_sink_state_, LAYER_TREE_FRAME_SINK_CREATING); + layer_tree_frame_sink_state_ = LAYER_TREE_FRAME_SINK_WAITING_FOR_FIRST_COMMIT; - if (did_create_and_initialize_first_compositor_frame_sink_) { + if (did_create_and_initialize_first_layer_tree_frame_sink_) { // TODO(boliu): See if we can remove this when impl-side painting is always // on. Does anything on the main thread need to update after recreate? needs_begin_main_frame_ = true; } - did_create_and_initialize_first_compositor_frame_sink_ = true; + did_create_and_initialize_first_layer_tree_frame_sink_ = true; pending_submit_frames_ = 0; - submit_frames_with_current_compositor_frame_sink_ = 0; + submit_frames_with_current_layer_tree_frame_sink_ = 0; main_thread_missed_last_deadline_ = false; } @@ -1320,15 +1320,15 @@ begin_main_frame_state_ = BEGIN_MAIN_FRAME_STATE_STARTED; } -bool SchedulerStateMachine::HasInitializedCompositorFrameSink() const { - switch (compositor_frame_sink_state_) { - case COMPOSITOR_FRAME_SINK_NONE: - case COMPOSITOR_FRAME_SINK_CREATING: +bool SchedulerStateMachine::HasInitializedLayerTreeFrameSink() const { + switch (layer_tree_frame_sink_state_) { + case LAYER_TREE_FRAME_SINK_NONE: + case LAYER_TREE_FRAME_SINK_CREATING: return false; - case COMPOSITOR_FRAME_SINK_ACTIVE: - case COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_COMMIT: - case COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_ACTIVATION: + case LAYER_TREE_FRAME_SINK_ACTIVE: + case LAYER_TREE_FRAME_SINK_WAITING_FOR_FIRST_COMMIT: + case LAYER_TREE_FRAME_SINK_WAITING_FOR_FIRST_ACTIVATION: return true; } NOTREACHED();
diff --git a/cc/scheduler/scheduler_state_machine.h b/cc/scheduler/scheduler_state_machine.h index 8ed42c8..bbd7323 100644 --- a/cc/scheduler/scheduler_state_machine.h +++ b/cc/scheduler/scheduler_state_machine.h
@@ -50,15 +50,15 @@ explicit SchedulerStateMachine(const SchedulerSettings& settings); ~SchedulerStateMachine(); - enum CompositorFrameSinkState { - COMPOSITOR_FRAME_SINK_NONE, - COMPOSITOR_FRAME_SINK_ACTIVE, - COMPOSITOR_FRAME_SINK_CREATING, - COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_COMMIT, - COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_ACTIVATION, + enum LayerTreeFrameSinkState { + LAYER_TREE_FRAME_SINK_NONE, + LAYER_TREE_FRAME_SINK_ACTIVE, + LAYER_TREE_FRAME_SINK_CREATING, + LAYER_TREE_FRAME_SINK_WAITING_FOR_FIRST_COMMIT, + LAYER_TREE_FRAME_SINK_WAITING_FOR_FIRST_ACTIVATION, }; - static const char* CompositorFrameSinkStateToString( - CompositorFrameSinkState state); + static const char* LayerTreeFrameSinkStateToString( + LayerTreeFrameSinkState state); // Note: BeginImplFrameState does not cycle through these states in a fixed // order on all platforms. It's up to the scheduler to set these correctly. @@ -122,9 +122,9 @@ ACTION_DRAW_IF_POSSIBLE, ACTION_DRAW_FORCED, ACTION_DRAW_ABORT, - ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION, + ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION, ACTION_PREPARE_TILES, - ACTION_INVALIDATE_COMPOSITOR_FRAME_SINK, + ACTION_INVALIDATE_LAYER_TREE_FRAME_SINK, ACTION_NOTIFY_BEGIN_MAIN_FRAME_NOT_SENT, }; static const char* ActionToString(Action action); @@ -138,9 +138,9 @@ void WillCommit(bool commit_had_no_updates); void WillActivate(); void WillDraw(); - void WillBeginCompositorFrameSinkCreation(); + void WillBeginLayerTreeFrameSinkCreation(); void WillPrepareTiles(); - void WillInvalidateCompositorFrameSink(); + void WillInvalidateLayerTreeFrameSink(); void WillPerformImplSideInvalidation(); void DidDraw(DrawResult draw_result); @@ -205,7 +205,7 @@ // submitting anything when there is not damage, for example. void DidSubmitCompositorFrame(); - // Notification from the CompositorFrameSink that a submitted frame has been + // Notification from the LayerTreeFrameSink that a submitted frame has been // consumed and it is ready for the next one. void DidReceiveCompositorFrameAck(); @@ -275,9 +275,9 @@ } void DidPrepareTiles(); - void DidLoseCompositorFrameSink(); - void DidCreateAndInitializeCompositorFrameSink(); - bool HasInitializedCompositorFrameSink() const; + void DidLoseLayerTreeFrameSink(); + void DidCreateAndInitializeLayerTreeFrameSink(); + bool HasInitializedLayerTreeFrameSink() const; // True if we need to abort draws to make forward progress. bool PendingDrawsShouldBeAborted() const; @@ -320,13 +320,13 @@ // TODO(sunnyps): Rename this to ShouldAbortCurrentFrame or similar. bool PendingActivationsShouldBeForced() const; - bool ShouldBeginCompositorFrameSinkCreation() const; + bool ShouldBeginLayerTreeFrameSinkCreation() const; bool ShouldDraw() const; bool ShouldActivatePendingTree() const; bool ShouldSendBeginMainFrame() const; bool ShouldCommit() const; bool ShouldPrepareTiles() const; - bool ShouldInvalidateCompositorFrameSink() const; + bool ShouldInvalidateLayerTreeFrameSink() const; bool ShouldNotifyBeginMainFrameNotSent() const; void WillDrawInternal(); @@ -339,8 +339,8 @@ const SchedulerSettings settings_; - CompositorFrameSinkState compositor_frame_sink_state_ = - COMPOSITOR_FRAME_SINK_NONE; + LayerTreeFrameSinkState layer_tree_frame_sink_state_ = + LAYER_TREE_FRAME_SINK_NONE; BeginImplFrameState begin_impl_frame_state_ = BEGIN_IMPL_FRAME_STATE_IDLE; BeginMainFrameState begin_main_frame_state_ = BEGIN_MAIN_FRAME_STATE_IDLE; ForcedRedrawOnTimeoutState forced_redraw_state_ = FORCED_REDRAW_STATE_IDLE; @@ -366,7 +366,7 @@ int last_frame_number_submit_performed_ = -1; int last_frame_number_draw_performed_ = -1; int last_frame_number_begin_main_frame_sent_ = -1; - int last_frame_number_invalidate_compositor_frame_sink_performed_ = -1; + int last_frame_number_invalidate_layer_tree_frame_sink_performed_ = -1; // These are used to ensure that an action only happens once per frame, // deadline, etc. @@ -376,13 +376,13 @@ // started. Reset to true when we stop asking for begin frames. bool did_notify_begin_main_frame_not_sent_ = true; bool did_commit_during_frame_ = false; - bool did_invalidate_compositor_frame_sink_ = false; + bool did_invalidate_layer_tree_frame_sink_ = false; bool did_perform_impl_side_invalidation_ = false; bool did_prepare_tiles_ = false; int consecutive_checkerboard_animations_ = 0; int pending_submit_frames_ = 0; - int submit_frames_with_current_compositor_frame_sink_ = 0; + int submit_frames_with_current_layer_tree_frame_sink_ = 0; bool needs_redraw_ = false; bool needs_prepare_tiles_ = false; bool needs_begin_main_frame_ = false; @@ -394,7 +394,7 @@ bool has_pending_tree_ = false; bool pending_tree_is_ready_for_activation_ = false; bool active_tree_needs_first_draw_ = false; - bool did_create_and_initialize_first_compositor_frame_sink_ = false; + bool did_create_and_initialize_first_layer_tree_frame_sink_ = false; TreePriority tree_priority_ = NEW_CONTENT_TAKES_PRIORITY; ScrollHandlerState scroll_handler_state_ = ScrollHandlerState::SCROLL_DOES_NOT_AFFECT_SCROLL_HANDLER;
diff --git a/cc/scheduler/scheduler_state_machine_unittest.cc b/cc/scheduler/scheduler_state_machine_unittest.cc index c5c5dcc..77b1648f5 100644 --- a/cc/scheduler/scheduler_state_machine_unittest.cc +++ b/cc/scheduler/scheduler_state_machine_unittest.cc
@@ -66,9 +66,9 @@ #define SET_UP_STATE(state) \ state.SetVisible(true); \ EXPECT_ACTION_UPDATE_STATE( \ - SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); \ + SchedulerStateMachine::ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION); \ EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); \ - state.CreateAndInitializeCompositorFrameSinkWithActivatedCommit(); \ + state.CreateAndInitializeLayerTreeFrameSinkWithActivatedCommit(); \ state.SetCanDraw(true); namespace cc { @@ -95,9 +95,9 @@ : SchedulerStateMachine(scheduler_settings), draw_result_for_test_(DRAW_SUCCESS) {} - void CreateAndInitializeCompositorFrameSinkWithActivatedCommit() { - DidCreateAndInitializeCompositorFrameSink(); - compositor_frame_sink_state_ = COMPOSITOR_FRAME_SINK_ACTIVE; + void CreateAndInitializeLayerTreeFrameSinkWithActivatedCommit() { + DidCreateAndInitializeLayerTreeFrameSink(); + layer_tree_frame_sink_state_ = LAYER_TREE_FRAME_SINK_ACTIVE; } void IssueNextBeginImplFrame() { @@ -123,8 +123,8 @@ return begin_impl_frame_state_; } - CompositorFrameSinkState compositor_frame_sink_state() const { - return compositor_frame_sink_state_; + LayerTreeFrameSinkState layer_tree_frame_sink_state() const { + return layer_tree_frame_sink_state_; } void SetNeedsBeginMainFrameForTest(bool needs_begin_main_frame) { @@ -226,16 +226,16 @@ return; } - case SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION: - sm->WillBeginCompositorFrameSinkCreation(); + case SchedulerStateMachine::ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION: + sm->WillBeginLayerTreeFrameSinkCreation(); return; case SchedulerStateMachine::ACTION_PREPARE_TILES: sm->WillPrepareTiles(); return; - case SchedulerStateMachine::ACTION_INVALIDATE_COMPOSITOR_FRAME_SINK: - sm->WillInvalidateCompositorFrameSink(); + case SchedulerStateMachine::ACTION_INVALIDATE_LAYER_TREE_FRAME_SINK: + sm->WillInvalidateLayerTreeFrameSink(); return; case SchedulerStateMachine::ACTION_PERFORM_IMPL_SIDE_INVALIDATION: @@ -249,9 +249,9 @@ StateMachine state(default_scheduler_settings); state.SetVisible(true); EXPECT_ACTION_UPDATE_STATE( - SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); + SchedulerStateMachine::ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); - state.CreateAndInitializeCompositorFrameSinkWithActivatedCommit(); + state.CreateAndInitializeLayerTreeFrameSinkWithActivatedCommit(); state.SetBeginMainFrameState( SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_IDLE); @@ -300,9 +300,9 @@ state.SetMainThreadWantsBeginMainFrameNotExpectedMessages(true); state.SetVisible(true); EXPECT_ACTION_UPDATE_STATE( - SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); + SchedulerStateMachine::ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION); state.IssueNextBeginImplFrame(); - state.CreateAndInitializeCompositorFrameSinkWithActivatedCommit(); + state.CreateAndInitializeLayerTreeFrameSinkWithActivatedCommit(); EXPECT_ACTION_UPDATE_STATE( SchedulerStateMachine::ACTION_NOTIFY_BEGIN_MAIN_FRAME_NOT_SENT); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); @@ -322,9 +322,9 @@ StateMachine state(default_scheduler_settings); state.SetVisible(true); EXPECT_ACTION_UPDATE_STATE( - SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); + SchedulerStateMachine::ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); - state.CreateAndInitializeCompositorFrameSinkWithActivatedCommit(); + state.CreateAndInitializeLayerTreeFrameSinkWithActivatedCommit(); state.SetBeginMainFrameState( SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_IDLE); state.SetNeedsRedraw(false); @@ -366,9 +366,9 @@ SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_IDLE); state.SetVisible(true); EXPECT_ACTION_UPDATE_STATE( - SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); + SchedulerStateMachine::ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); - state.CreateAndInitializeCompositorFrameSinkWithActivatedCommit(); + state.CreateAndInitializeLayerTreeFrameSinkWithActivatedCommit(); state.SetNeedsRedraw(false); state.SetNeedsBeginMainFrame(); @@ -393,9 +393,9 @@ SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_IDLE); state.SetVisible(true); EXPECT_ACTION_UPDATE_STATE( - SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); + SchedulerStateMachine::ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); - state.CreateAndInitializeCompositorFrameSinkWithActivatedCommit(); + state.CreateAndInitializeLayerTreeFrameSinkWithActivatedCommit(); state.SetNeedsRedraw(false); state.SetNeedsBeginMainFrame(); state.SetCanDraw(false); @@ -767,9 +767,9 @@ StateMachine state(default_scheduler_settings); state.SetVisible(true); EXPECT_ACTION_UPDATE_STATE( - SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); + SchedulerStateMachine::ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); - state.CreateAndInitializeCompositorFrameSinkWithActivatedCommit(); + state.CreateAndInitializeLayerTreeFrameSinkWithActivatedCommit(); state.SetBeginMainFrameState(begin_main_frame_states[i]); state.SetBeginImplFrameState(all_begin_impl_frame_states[j]); bool visible = @@ -795,9 +795,9 @@ StateMachine state(default_scheduler_settings); state.SetVisible(true); EXPECT_ACTION_UPDATE_STATE( - SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); + SchedulerStateMachine::ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); - state.CreateAndInitializeCompositorFrameSinkWithActivatedCommit(); + state.CreateAndInitializeLayerTreeFrameSinkWithActivatedCommit(); state.SetCanDraw(true); state.SetBeginMainFrameState(begin_main_frame_states[i]); state.SetBeginImplFrameState( @@ -834,9 +834,9 @@ StateMachine state(default_scheduler_settings); state.SetVisible(true); EXPECT_ACTION_UPDATE_STATE( - SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); + SchedulerStateMachine::ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); - state.CreateAndInitializeCompositorFrameSinkWithActivatedCommit(); + state.CreateAndInitializeLayerTreeFrameSinkWithActivatedCommit(); state.SetBeginMainFrameState(begin_main_frame_states[i]); state.SetVisible(false); state.SetNeedsRedraw(true); @@ -870,9 +870,9 @@ StateMachine state(default_scheduler_settings); state.SetVisible(true); EXPECT_ACTION_UPDATE_STATE( - SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); + SchedulerStateMachine::ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); - state.CreateAndInitializeCompositorFrameSinkWithActivatedCommit(); + state.CreateAndInitializeLayerTreeFrameSinkWithActivatedCommit(); state.SetBeginMainFrameState(begin_main_frame_states[i]); state.SetVisible(false); state.SetNeedsRedraw(true); @@ -892,9 +892,9 @@ StateMachine state(default_scheduler_settings); state.SetVisible(true); EXPECT_ACTION_UPDATE_STATE( - SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); + SchedulerStateMachine::ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); - state.CreateAndInitializeCompositorFrameSinkWithActivatedCommit(); + state.CreateAndInitializeLayerTreeFrameSinkWithActivatedCommit(); state.SetActiveTreeNeedsFirstDraw(true); state.SetNeedsBeginMainFrame(); @@ -1290,9 +1290,9 @@ StateMachine state(default_scheduler_settings); state.SetVisible(true); EXPECT_ACTION_UPDATE_STATE( - SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); + SchedulerStateMachine::ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); - state.CreateAndInitializeCompositorFrameSinkWithActivatedCommit(); + state.CreateAndInitializeLayerTreeFrameSinkWithActivatedCommit(); state.SetVisible(false); state.SetNeedsBeginMainFrame(); EXPECT_FALSE(state.CouldSendBeginMainFrame()); @@ -1304,36 +1304,36 @@ StateMachine state(default_scheduler_settings); state.SetVisible(true); EXPECT_ACTION_UPDATE_STATE( - SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); + SchedulerStateMachine::ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); - state.CreateAndInitializeCompositorFrameSinkWithActivatedCommit(); + state.CreateAndInitializeLayerTreeFrameSinkWithActivatedCommit(); state.SetBeginFrameSourcePaused(true); state.SetNeedsBeginMainFrame(); EXPECT_FALSE(state.CouldSendBeginMainFrame()); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); } -TEST(SchedulerStateMachineTest, TestNoRequestCompositorFrameSinkWhenInvisible) { +TEST(SchedulerStateMachineTest, TestNoRequestLayerTreeFrameSinkWhenInvisible) { SchedulerSettings default_scheduler_settings; StateMachine state(default_scheduler_settings); - // We should not request an CompositorFrameSink when we are still invisible. + // We should not request a LayerTreeFrameSink when we are still invisible. EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); state.SetVisible(true); EXPECT_ACTION_UPDATE_STATE( - SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); + SchedulerStateMachine::ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); - state.CreateAndInitializeCompositorFrameSinkWithActivatedCommit(); + state.CreateAndInitializeLayerTreeFrameSinkWithActivatedCommit(); state.SetVisible(false); - state.DidLoseCompositorFrameSink(); + state.DidLoseLayerTreeFrameSink(); state.SetNeedsBeginMainFrame(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); state.SetVisible(true); EXPECT_ACTION_UPDATE_STATE( - SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); + SchedulerStateMachine::ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION); } // See ProxyMain::BeginMainFrame "EarlyOut_NotVisible" / -// "EarlyOut_CompositorFrameSinkLost" cases. +// "EarlyOut_LayerTreeFrameSinkLost" cases. TEST(SchedulerStateMachineTest, TestAbortBeginMainFrameBecauseInvisible) { SchedulerSettings default_scheduler_settings; StateMachine state(default_scheduler_settings); @@ -1392,9 +1392,9 @@ StateMachine state(default_scheduler_settings); state.SetVisible(true); EXPECT_ACTION_UPDATE_STATE( - SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); + SchedulerStateMachine::ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); - state.DidCreateAndInitializeCompositorFrameSink(); + state.DidCreateAndInitializeLayerTreeFrameSink(); state.SetCanDraw(true); // Get into a begin frame / commit state. @@ -1442,8 +1442,8 @@ state.SetCanDraw(true); EXPECT_ACTION_UPDATE_STATE( - SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); - state.CreateAndInitializeCompositorFrameSinkWithActivatedCommit(); + SchedulerStateMachine::ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION); + state.CreateAndInitializeLayerTreeFrameSinkWithActivatedCommit(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); // Check that the first init does not SetNeedsBeginMainFrame. @@ -1464,19 +1464,19 @@ StateMachine state(default_scheduler_settings); SET_UP_STATE(state) - EXPECT_NE(SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION, + EXPECT_NE(SchedulerStateMachine::ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION, state.NextAction()); - state.DidLoseCompositorFrameSink(); + state.DidLoseLayerTreeFrameSink(); EXPECT_ACTION_UPDATE_STATE( - SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); + SchedulerStateMachine::ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); // Once context recreation begins, nothing should happen. EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); // Recreate the context. - state.CreateAndInitializeCompositorFrameSinkWithActivatedCommit(); + state.CreateAndInitializeLayerTreeFrameSinkWithActivatedCommit(); // When the context is recreated, we should begin a commit. state.IssueNextBeginImplFrame(); @@ -1490,14 +1490,14 @@ StateMachine state(default_scheduler_settings); SET_UP_STATE(state) - EXPECT_NE(SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION, + EXPECT_NE(SchedulerStateMachine::ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION, state.NextAction()); - state.DidLoseCompositorFrameSink(); - EXPECT_EQ(state.compositor_frame_sink_state(), - SchedulerStateMachine::COMPOSITOR_FRAME_SINK_NONE); + state.DidLoseLayerTreeFrameSink(); + EXPECT_EQ(state.layer_tree_frame_sink_state(), + SchedulerStateMachine::LAYER_TREE_FRAME_SINK_NONE); EXPECT_ACTION_UPDATE_STATE( - SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); + SchedulerStateMachine::ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); // Once context recreation begins, nothing should happen. @@ -1514,10 +1514,10 @@ EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); // Recreate the context - state.DidCreateAndInitializeCompositorFrameSink(); + state.DidCreateAndInitializeLayerTreeFrameSink(); EXPECT_EQ( - state.compositor_frame_sink_state(), - SchedulerStateMachine::COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_COMMIT); + state.layer_tree_frame_sink_state(), + SchedulerStateMachine::LAYER_TREE_FRAME_SINK_WAITING_FOR_FIRST_COMMIT); EXPECT_FALSE(state.RedrawPending()); // When the context is recreated, we wait until the next BeginImplFrame @@ -1539,16 +1539,16 @@ state.NotifyBeginMainFrameStarted(); state.NotifyReadyToCommit(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT); - EXPECT_EQ(state.compositor_frame_sink_state(), + EXPECT_EQ(state.layer_tree_frame_sink_state(), SchedulerStateMachine:: - COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_ACTIVATION); + LAYER_TREE_FRAME_SINK_WAITING_FOR_FIRST_ACTIVATION); state.NotifyReadyToActivate(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); - EXPECT_EQ(state.compositor_frame_sink_state(), - SchedulerStateMachine::COMPOSITOR_FRAME_SINK_ACTIVE); + EXPECT_EQ(state.layer_tree_frame_sink_state(), + SchedulerStateMachine::LAYER_TREE_FRAME_SINK_ACTIVE); - // Finishing the first commit after initializing an CompositorFrameSink should + // Finishing the first commit after initializing a LayerTreeFrameSink should // automatically cause a redraw. EXPECT_TRUE(state.RedrawPending()); state.IssueNextBeginImplFrame(); @@ -1627,7 +1627,7 @@ BeginFrameArgs::kInvalidFrameNumber); // Cause a lost context while the BeginMainFrame is in flight. - state.DidLoseCompositorFrameSink(); + state.DidLoseLayerTreeFrameSink(); EXPECT_FALSE(state.BeginFrameNeeded()); // Ask for another draw. Expect nothing happens. @@ -1645,7 +1645,7 @@ EXPECT_SEQUENCE_NUMBERS(10u, 10u, 10u, 10u, BeginFrameArgs::kInvalidFrameNumber); - // We will abort the draw when the CompositorFrameSink is lost if we are + // We will abort the draw when the LayerTreeFrameSink is lost if we are // waiting for the first draw to unblock the main thread. EXPECT_TRUE(state.active_tree_needs_first_draw()); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_ABORT); @@ -1655,7 +1655,7 @@ // Expect to begin context recreation only in BEGIN_IMPL_FRAME_STATE_IDLE EXPECT_IMPL_FRAME_STATE(SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); EXPECT_ACTION( - SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); + SchedulerStateMachine::ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION); state.OnBeginImplFrame(0, 11); EXPECT_IMPL_FRAME_STATE( @@ -1694,7 +1694,7 @@ EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); // Cause a lost context while the BeginMainFrame is in flight. - state.DidLoseCompositorFrameSink(); + state.DidLoseLayerTreeFrameSink(); // Ask for another draw and also set needs commit. Expect nothing happens. state.SetNeedsRedraw(true); @@ -1709,13 +1709,13 @@ EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE); EXPECT_TRUE(state.active_tree_needs_first_draw()); - // Because the CompositorFrameSink is missing, we expect the draw to abort. + // Because the LayerTreeFrameSink is missing, we expect the draw to abort. EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_ABORT); // Expect to begin context recreation only in BEGIN_IMPL_FRAME_STATE_IDLE EXPECT_IMPL_FRAME_STATE(SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); EXPECT_ACTION( - SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); + SchedulerStateMachine::ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION); state.IssueNextBeginImplFrame(); EXPECT_IMPL_FRAME_STATE( @@ -1729,10 +1729,10 @@ state.OnBeginImplFrameIdle(); EXPECT_ACTION_UPDATE_STATE( - SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); + SchedulerStateMachine::ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION); - // After we get a new CompositorFrameSink, the commit flow should start. - state.CreateAndInitializeCompositorFrameSinkWithActivatedCommit(); + // After we get a new LayerTreeFrameSink, the commit flow should start. + state.CreateAndInitializeLayerTreeFrameSinkWithActivatedCommit(); state.IssueNextBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE( SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); @@ -1752,19 +1752,19 @@ } TEST(SchedulerStateMachineTest, - DontDrawBeforeCommitAfterLostCompositorFrameSink) { + DontDrawBeforeCommitAfterLostLayerTreeFrameSink) { SchedulerSettings default_scheduler_settings; StateMachine state(default_scheduler_settings); SET_UP_STATE(state) state.SetNeedsRedraw(true); - // Cause a lost CompositorFrameSink, and restore it. - state.DidLoseCompositorFrameSink(); + // Cause a lost LayerTreeFrameSink, and restore it. + state.DidLoseLayerTreeFrameSink(); EXPECT_ACTION_UPDATE_STATE( - SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); + SchedulerStateMachine::ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); - state.DidCreateAndInitializeCompositorFrameSink(); + state.DidCreateAndInitializeLayerTreeFrameSink(); EXPECT_FALSE(state.RedrawPending()); state.IssueNextBeginImplFrame(); @@ -1772,7 +1772,7 @@ } TEST(SchedulerStateMachineTest, - TestPendingActivationsShouldBeForcedAfterLostCompositorFrameSink) { + TestPendingActivationsShouldBeForcedAfterLostLayerTreeFrameSink) { SchedulerSettings default_scheduler_settings; StateMachine state(default_scheduler_settings); SET_UP_STATE(state) @@ -1781,7 +1781,7 @@ SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT); // Cause a lost context. - state.DidLoseCompositorFrameSink(); + state.DidLoseLayerTreeFrameSink(); state.NotifyBeginMainFrameStarted(); state.NotifyReadyToCommit(); @@ -1799,9 +1799,9 @@ StateMachine state(default_scheduler_settings); state.SetVisible(true); EXPECT_ACTION_UPDATE_STATE( - SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); + SchedulerStateMachine::ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); - state.CreateAndInitializeCompositorFrameSinkWithActivatedCommit(); + state.CreateAndInitializeLayerTreeFrameSinkWithActivatedCommit(); EXPECT_FALSE(state.BeginFrameNeeded()); state.SetNeedsRedraw(true); @@ -1819,9 +1819,9 @@ StateMachine state(default_scheduler_settings); state.SetVisible(true); EXPECT_ACTION_UPDATE_STATE( - SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); + SchedulerStateMachine::ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); - state.CreateAndInitializeCompositorFrameSinkWithActivatedCommit(); + state.CreateAndInitializeLayerTreeFrameSinkWithActivatedCommit(); state.SetVisible(false); state.SetNeedsBeginMainFrame(); EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE); @@ -1840,9 +1840,9 @@ StateMachine state(default_scheduler_settings); state.SetVisible(true); EXPECT_ACTION_UPDATE_STATE( - SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); + SchedulerStateMachine::ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); - state.CreateAndInitializeCompositorFrameSinkWithActivatedCommit(); + state.CreateAndInitializeLayerTreeFrameSinkWithActivatedCommit(); state.SetVisible(false); state.SetBeginMainFrameState( SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT); @@ -1865,9 +1865,9 @@ StateMachine state(default_scheduler_settings); state.SetVisible(true); EXPECT_ACTION_UPDATE_STATE( - SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); + SchedulerStateMachine::ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); - state.CreateAndInitializeCompositorFrameSinkWithActivatedCommit(); + state.CreateAndInitializeLayerTreeFrameSinkWithActivatedCommit(); state.SetBeginFrameSourcePaused(true); state.SetBeginMainFrameState( SchedulerStateMachine::BEGIN_MAIN_FRAME_STATE_SENT); @@ -1890,20 +1890,20 @@ StateMachine state(default_scheduler_settings); SET_UP_STATE(state) state.SetNeedsBeginMainFrame(); - state.DidLoseCompositorFrameSink(); + state.DidLoseLayerTreeFrameSink(); - // When we are visible, we normally want to begin CompositorFrameSink creation + // When we are visible, we normally want to begin LayerTreeFrameSink creation // as soon as possible. EXPECT_ACTION_UPDATE_STATE( - SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); + SchedulerStateMachine::ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION); - state.DidCreateAndInitializeCompositorFrameSink(); + state.DidCreateAndInitializeLayerTreeFrameSink(); EXPECT_EQ( - state.compositor_frame_sink_state(), - SchedulerStateMachine::COMPOSITOR_FRAME_SINK_WAITING_FOR_FIRST_COMMIT); + state.layer_tree_frame_sink_state(), + SchedulerStateMachine::LAYER_TREE_FRAME_SINK_WAITING_FOR_FIRST_COMMIT); // We should not send a BeginMainFrame when we are invisible, even if we've - // lost the CompositorFrameSink and are trying to get the first commit, since + // lost the LayerTreeFrameSink and are trying to get the first commit, since // the // main thread will just abort anyway. state.SetVisible(false); @@ -1965,24 +1965,24 @@ state.SetBeginFrameSourcePaused(false); state.SetVisible(false); - state.DidLoseCompositorFrameSink(); + state.DidLoseLayerTreeFrameSink(); state.SetCanDraw(false); - state.WillBeginCompositorFrameSinkCreation(); - state.DidCreateAndInitializeCompositorFrameSink(); + state.WillBeginLayerTreeFrameSinkCreation(); + state.DidCreateAndInitializeLayerTreeFrameSink(); EXPECT_TRUE(state.PendingDrawsShouldBeAborted()); state.SetCanDraw(true); - state.DidLoseCompositorFrameSink(); + state.DidLoseLayerTreeFrameSink(); EXPECT_TRUE(state.PendingDrawsShouldBeAborted()); state.SetCanDraw(true); - state.WillBeginCompositorFrameSinkCreation(); - state.DidCreateAndInitializeCompositorFrameSink(); + state.WillBeginLayerTreeFrameSinkCreation(); + state.DidCreateAndInitializeLayerTreeFrameSink(); EXPECT_FALSE(state.PendingDrawsShouldBeAborted()); state.SetCanDraw(false); - state.DidLoseCompositorFrameSink(); + state.DidLoseLayerTreeFrameSink(); EXPECT_TRUE(state.PendingDrawsShouldBeAborted()); } @@ -2092,7 +2092,7 @@ } TEST(SchedulerStateMachineTest, - TestTriggerDeadlineImmediatelyOnLostCompositorFrameSink) { + TestTriggerDeadlineImmediatelyOnLostLayerTreeFrameSink) { SchedulerSettings default_scheduler_settings; StateMachine state(default_scheduler_settings); SET_UP_STATE(state) @@ -2105,9 +2105,9 @@ EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); EXPECT_FALSE(state.ShouldTriggerBeginImplFrameDeadlineImmediately()); - state.DidLoseCompositorFrameSink(); + state.DidLoseLayerTreeFrameSink(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); - // The deadline should be triggered immediately when CompositorFrameSink is + // The deadline should be triggered immediately when LayerTreeFrameSink is // lost. EXPECT_TRUE(state.ShouldTriggerBeginImplFrameDeadlineImmediately()); } @@ -2188,7 +2188,7 @@ } TEST(SchedulerStateMachineTest, - NoCompositorFrameSinkCreationWhileCommitPending) { + NoLayerTreeFrameSinkCreationWhileCommitPending) { SchedulerSettings settings; StateMachine state(settings); SET_UP_STATE(state); @@ -2198,10 +2198,10 @@ state.IssueNextBeginImplFrame(); PerformAction(&state, SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); - // Lose the CompositorFrameSink. - state.DidLoseCompositorFrameSink(); + // Lose the LayerTreeFrameSink. + state.DidLoseLayerTreeFrameSink(); - // The scheduler shouldn't trigger the CompositorFrameSink creation till the + // The scheduler shouldn't trigger the LayerTreeFrameSink creation till the // previous commit has been cleared. EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); @@ -2212,15 +2212,15 @@ EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); // Abort the commit, since that is what we expect the main thread to do if the - // CompositorFrameSink was lost due to a synchronous call from the main thread - // to release the CompositorFrameSink. + // LayerTreeFrameSink was lost due to a synchronous call from the main thread + // to release the LayerTreeFrameSink. state.NotifyBeginMainFrameStarted(); state.BeginMainFrameAborted( - CommitEarlyOutReason::ABORTED_COMPOSITOR_FRAME_SINK_LOST); + CommitEarlyOutReason::ABORTED_LAYER_TREE_FRAME_SINK_LOST); - // The scheduler should begin the CompositorFrameSink creation now. + // The scheduler should begin the LayerTreeFrameSink creation now. EXPECT_ACTION_UPDATE_STATE( - SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); + SchedulerStateMachine::ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION); } TEST(SchedulerStateMachineTest, NoImplSideInvalidationsWhileInvisible) { @@ -2265,16 +2265,16 @@ } TEST(SchedulerStateMachineTest, - NoImplSideInvalidationWithoutCompositorFrameSink) { + NoImplSideInvalidationWithoutLayerTreeFrameSink) { SchedulerSettings settings; StateMachine state(settings); SET_UP_STATE(state); // Impl-side invalidations should not be triggered till the frame sink is // initialized. - state.DidLoseCompositorFrameSink(); + state.DidLoseLayerTreeFrameSink(); EXPECT_ACTION_UPDATE_STATE( - SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); + SchedulerStateMachine::ACTION_BEGIN_LAYER_TREE_FRAME_SINK_CREATION); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); // No impl-side invalidations should be performed during frame sink creation. @@ -2283,9 +2283,9 @@ state.OnBeginImplFrameDeadline(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); - // Initializing the CompositorFrameSink puts us in a state waiting for the + // Initializing the LayerTreeFrameSink puts us in a state waiting for the // first commit. - state.DidCreateAndInitializeCompositorFrameSink(); + state.DidCreateAndInitializeLayerTreeFrameSink(); state.IssueNextBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE( SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
diff --git a/cc/scheduler/scheduler_unittest.cc b/cc/scheduler/scheduler_unittest.cc index b8622cc..6327c22 100644 --- a/cc/scheduler/scheduler_unittest.cc +++ b/cc/scheduler/scheduler_unittest.cc
@@ -156,16 +156,16 @@ void ScheduledActionActivateSyncTree() override { PushAction("ScheduledActionActivateSyncTree"); } - void ScheduledActionBeginCompositorFrameSinkCreation() override { - PushAction("ScheduledActionBeginCompositorFrameSinkCreation"); + void ScheduledActionBeginLayerTreeFrameSinkCreation() override { + PushAction("ScheduledActionBeginLayerTreeFrameSinkCreation"); } void ScheduledActionPrepareTiles() override { PushAction("ScheduledActionPrepareTiles"); scheduler_->WillPrepareTiles(); scheduler_->DidPrepareTiles(); } - void ScheduledActionInvalidateCompositorFrameSink() override { - actions_.push_back("ScheduledActionInvalidateCompositorFrameSink"); + void ScheduledActionInvalidateLayerTreeFrameSink() override { + actions_.push_back("ScheduledActionInvalidateLayerTreeFrameSink"); states_.push_back(scheduler_->AsValue()); } void ScheduledActionPerformImplSideInvalidation() override { @@ -301,14 +301,14 @@ std::unique_ptr<FakeSchedulerClient> client) { client_ = std::move(client); CreateScheduler(bfs_type); - EXPECT_SCOPED(InitializeCompositorFrameSinkAndFirstCommit()); + EXPECT_SCOPED(InitializeLayerTreeFrameSinkAndFirstCommit()); } void SetUpScheduler(BeginFrameSourceType bfs_type) { SetUpScheduler(bfs_type, base::MakeUnique<FakeSchedulerClient>()); } - void SetUpSchedulerWithNoCompositorFrameSink(BeginFrameSourceType bfs_type) { + void SetUpSchedulerWithNoLayerTreeFrameSink(BeginFrameSourceType bfs_type) { client_ = base::MakeUnique<FakeSchedulerClient>(); CreateScheduler(bfs_type); } @@ -319,10 +319,10 @@ // As this function contains EXPECT macros, to allow debugging it should be // called inside EXPECT_SCOPED like so; // EXPECT_SCOPED( - // client.InitializeCompositorFrameSinkAndFirstCommit(scheduler)); - void InitializeCompositorFrameSinkAndFirstCommit() { + // client.InitializeLayerTreeFrameSinkAndFirstCommit(scheduler)); + void InitializeLayerTreeFrameSinkAndFirstCommit() { TRACE_EVENT0( - "cc", "SchedulerUnitTest::InitializeCompositorFrameSinkAndFirstCommit"); + "cc", "SchedulerUnitTest::InitializeLayerTreeFrameSinkAndFirstCommit"); DCHECK(scheduler_); // Check the client doesn't have any actions queued when calling this @@ -330,15 +330,15 @@ EXPECT_NO_ACTION(); EXPECT_FALSE(scheduler_->begin_frames_expected()); - // Start the initial CompositorFrameSink creation. + // Start the initial LayerTreeFrameSink creation. scheduler_->SetVisible(true); scheduler_->SetCanDraw(true); - EXPECT_ACTIONS("ScheduledActionBeginCompositorFrameSinkCreation"); + EXPECT_ACTIONS("ScheduledActionBeginLayerTreeFrameSinkCreation"); client_->Reset(); // We don't see anything happening until the first impl frame. - scheduler_->DidCreateAndInitializeCompositorFrameSink(); + scheduler_->DidCreateAndInitializeLayerTreeFrameSink(); scheduler_->SetNeedsBeginMainFrame(); EXPECT_TRUE(scheduler_->begin_frames_expected()); EXPECT_FALSE(client_->IsInsideBeginImplFrame()); @@ -358,7 +358,7 @@ if (scheduler_settings_.using_synchronous_renderer_compositor) { scheduler_->SetNeedsRedraw(); bool resourceless_software_draw = false; - scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw); + scheduler_->OnDrawForLayerTreeFrameSink(resourceless_software_draw); } else { // Run the posted deadline task. EXPECT_TRUE(client_->IsInsideBeginImplFrame()); @@ -459,14 +459,14 @@ FakeCompositorTimingHistory* fake_compositor_timing_history_; }; -TEST_F(SchedulerTest, InitializeCompositorFrameSinkDoesNotBeginImplFrame) { - SetUpSchedulerWithNoCompositorFrameSink(EXTERNAL_BFS); +TEST_F(SchedulerTest, InitializeLayerTreeFrameSinkDoesNotBeginImplFrame) { + SetUpSchedulerWithNoLayerTreeFrameSink(EXTERNAL_BFS); scheduler_->SetVisible(true); scheduler_->SetCanDraw(true); - EXPECT_ACTIONS("ScheduledActionBeginCompositorFrameSinkCreation"); + EXPECT_ACTIONS("ScheduledActionBeginLayerTreeFrameSinkCreation"); client_->Reset(); - scheduler_->DidCreateAndInitializeCompositorFrameSink(); + scheduler_->DidCreateAndInitializeLayerTreeFrameSink(); EXPECT_NO_ACTION(); } @@ -668,7 +668,7 @@ EXPECT_FALSE(client_->IsInsideBeginImplFrame()); // Because we just swapped, the Scheduler should also request the next - // BeginImplFrame from the CompositorFrameSink. + // BeginImplFrame from the LayerTreeFrameSink. EXPECT_TRUE(scheduler_->begin_frames_expected()); client_->Reset(); // Since another commit is needed, the next BeginImplFrame should initiate @@ -1275,7 +1275,7 @@ EXPECT_TRUE(client_->HasAction("ScheduledActionDrawIfPossible")); } -TEST_F(SchedulerTest, WaitForReadyToDrawCancelledWhenLostCompositorFrameSink) { +TEST_F(SchedulerTest, WaitForReadyToDrawCancelledWhenLostLayerTreeFrameSink) { SchedulerClientNeedsPrepareTilesInDraw* client = new SchedulerClientNeedsPrepareTilesInDraw; scheduler_settings_.commit_to_active_tree = true; @@ -1305,13 +1305,13 @@ // There is no posted deadline. EXPECT_NO_ACTION(); - // Scheduler loses CompositorFrameSink, and stops waiting for ready to draw + // Scheduler loses LayerTreeFrameSink, and stops waiting for ready to draw // signal. client_->Reset(); - scheduler_->DidLoseCompositorFrameSink(); + scheduler_->DidLoseLayerTreeFrameSink(); EXPECT_TRUE(client_->IsInsideBeginImplFrame()); task_runner().RunPendingTasks(); // Run posted deadline. - EXPECT_ACTIONS("ScheduledActionBeginCompositorFrameSinkCreation", + EXPECT_ACTIONS("ScheduledActionBeginLayerTreeFrameSinkCreation", "RemoveObserver(this)"); } @@ -2204,22 +2204,22 @@ } TEST_F(SchedulerTest, - DidLoseCompositorFrameSinkAfterCompositorFrameSinkIsInitialized) { - SetUpSchedulerWithNoCompositorFrameSink(EXTERNAL_BFS); + DidLoseLayerTreeFrameSinkAfterLayerTreeFrameSinkIsInitialized) { + SetUpSchedulerWithNoLayerTreeFrameSink(EXTERNAL_BFS); scheduler_->SetVisible(true); scheduler_->SetCanDraw(true); - EXPECT_ACTIONS("ScheduledActionBeginCompositorFrameSinkCreation"); + EXPECT_ACTIONS("ScheduledActionBeginLayerTreeFrameSinkCreation"); client_->Reset(); - scheduler_->DidCreateAndInitializeCompositorFrameSink(); + scheduler_->DidCreateAndInitializeLayerTreeFrameSink(); EXPECT_NO_ACTION(); - scheduler_->DidLoseCompositorFrameSink(); - EXPECT_ACTIONS("ScheduledActionBeginCompositorFrameSinkCreation"); + scheduler_->DidLoseLayerTreeFrameSink(); + EXPECT_ACTIONS("ScheduledActionBeginLayerTreeFrameSinkCreation"); } -TEST_F(SchedulerTest, DidLoseCompositorFrameSinkAfterBeginFrameStarted) { +TEST_F(SchedulerTest, DidLoseLayerTreeFrameSinkAfterBeginFrameStarted) { SetUpScheduler(EXTERNAL_BFS); // SetNeedsBeginMainFrame should begin the frame. @@ -2232,7 +2232,7 @@ EXPECT_TRUE(client_->IsInsideBeginImplFrame()); client_->Reset(); - scheduler_->DidLoseCompositorFrameSink(); + scheduler_->DidLoseLayerTreeFrameSink(); // RemoveObserver(this) is not called until the end of the frame. EXPECT_NO_ACTION(); @@ -2243,12 +2243,12 @@ client_->Reset(); task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); - EXPECT_ACTIONS("ScheduledActionBeginCompositorFrameSinkCreation", + EXPECT_ACTIONS("ScheduledActionBeginLayerTreeFrameSinkCreation", "RemoveObserver(this)"); } TEST_F(SchedulerTest, - DidLoseCompositorFrameSinkAfterBeginFrameStartedWithHighLatency) { + DidLoseLayerTreeFrameSinkAfterBeginFrameStartedWithHighLatency) { SetUpScheduler(EXTERNAL_BFS); // SetNeedsBeginMainFrame should begin the frame. @@ -2261,7 +2261,7 @@ EXPECT_TRUE(client_->IsInsideBeginImplFrame()); client_->Reset(); - scheduler_->DidLoseCompositorFrameSink(); + scheduler_->DidLoseLayerTreeFrameSink(); // Do nothing when impl frame is in deadine pending state. EXPECT_NO_ACTION(); @@ -2269,7 +2269,7 @@ // Run posted deadline. EXPECT_TRUE(client_->IsInsideBeginImplFrame()); task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); - // OnBeginImplFrameDeadline didn't schedule CompositorFrameSink creation + // OnBeginImplFrameDeadline didn't schedule LayerTreeFrameSink creation // because // main frame is not yet completed. EXPECT_ACTIONS("RemoveObserver(this)"); @@ -2286,10 +2286,10 @@ scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks()); scheduler_->NotifyReadyToCommit(); EXPECT_ACTIONS("ScheduledActionCommit", "ScheduledActionActivateSyncTree", - "ScheduledActionBeginCompositorFrameSinkCreation"); + "ScheduledActionBeginLayerTreeFrameSinkCreation"); } -TEST_F(SchedulerTest, DidLoseCompositorFrameSinkAfterReadyToCommit) { +TEST_F(SchedulerTest, DidLoseLayerTreeFrameSinkAfterReadyToCommit) { SetUpScheduler(EXTERNAL_BFS); // SetNeedsBeginMainFrame should begin the frame. @@ -2307,18 +2307,18 @@ EXPECT_ACTIONS("ScheduledActionCommit"); client_->Reset(); - scheduler_->DidLoseCompositorFrameSink(); + scheduler_->DidLoseLayerTreeFrameSink(); // Sync tree should be forced to activate. EXPECT_ACTIONS("ScheduledActionActivateSyncTree"); // RemoveObserver(this) is not called until the end of the frame. client_->Reset(); task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); - EXPECT_ACTIONS("ScheduledActionBeginCompositorFrameSinkCreation", + EXPECT_ACTIONS("ScheduledActionBeginLayerTreeFrameSinkCreation", "RemoveObserver(this)"); } -TEST_F(SchedulerTest, DidLoseCompositorFrameSinkAfterSetNeedsPrepareTiles) { +TEST_F(SchedulerTest, DidLoseLayerTreeFrameSinkAfterSetNeedsPrepareTiles) { SetUpScheduler(EXTERNAL_BFS); scheduler_->SetNeedsPrepareTiles(); @@ -2331,19 +2331,18 @@ EXPECT_TRUE(client_->IsInsideBeginImplFrame()); client_->Reset(); - scheduler_->DidLoseCompositorFrameSink(); + scheduler_->DidLoseLayerTreeFrameSink(); // RemoveObserver(this) is not called until the end of the frame. EXPECT_NO_ACTION(); client_->Reset(); task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); EXPECT_ACTIONS("ScheduledActionPrepareTiles", - "ScheduledActionBeginCompositorFrameSinkCreation", + "ScheduledActionBeginLayerTreeFrameSinkCreation", "RemoveObserver(this)"); } -TEST_F(SchedulerTest, - DidLoseCompositorFrameSinkWithDelayBasedBeginFrameSource) { +TEST_F(SchedulerTest, DidLoseLayerTreeFrameSinkWithDelayBasedBeginFrameSource) { SetUpScheduler(THROTTLED_BFS); // SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame. @@ -2371,18 +2370,18 @@ EXPECT_TRUE(scheduler_->begin_frames_expected()); client_->Reset(); - scheduler_->DidLoseCompositorFrameSink(); + scheduler_->DidLoseLayerTreeFrameSink(); // RemoveObserver(this) is not called until the end of the frame. EXPECT_NO_ACTION(); EXPECT_TRUE(scheduler_->begin_frames_expected()); client_->Reset(); task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true)); - EXPECT_ACTIONS("ScheduledActionBeginCompositorFrameSinkCreation"); + EXPECT_ACTIONS("ScheduledActionBeginLayerTreeFrameSinkCreation"); EXPECT_FALSE(scheduler_->begin_frames_expected()); } -TEST_F(SchedulerTest, DidLoseCompositorFrameSinkWhenIdle) { +TEST_F(SchedulerTest, DidLoseLayerTreeFrameSinkWhenIdle) { SetUpScheduler(EXTERNAL_BFS); // SetNeedsBeginMainFrame should begin the frame. @@ -2409,8 +2408,8 @@ // Idle time between BeginFrames. client_->Reset(); - scheduler_->DidLoseCompositorFrameSink(); - EXPECT_ACTIONS("ScheduledActionBeginCompositorFrameSinkCreation", + scheduler_->DidLoseLayerTreeFrameSink(); + EXPECT_ACTIONS("ScheduledActionBeginLayerTreeFrameSinkCreation", "RemoveObserver(this)"); } @@ -2645,13 +2644,13 @@ scheduler_->NotifyReadyToActivate(); EXPECT_ACTIONS("ScheduledActionActivateSyncTree"); - // Scheduler loses CompositorFrameSink, and stops waiting for ready to draw + // Scheduler loses LayerTreeFrameSink, and stops waiting for ready to draw // signal. client_->Reset(); - scheduler_->DidLoseCompositorFrameSink(); + scheduler_->DidLoseLayerTreeFrameSink(); EXPECT_TRUE(client_->IsInsideBeginImplFrame()); task_runner().RunPendingTasks(); - EXPECT_ACTIONS("ScheduledActionBeginCompositorFrameSinkCreation", + EXPECT_ACTIONS("ScheduledActionBeginLayerTreeFrameSinkCreation", "RemoveObserver(this)"); // Changing begin frame source doesn't do anything. @@ -2661,7 +2660,7 @@ EXPECT_NO_ACTION(); client_->Reset(); - scheduler_->DidCreateAndInitializeCompositorFrameSink(); + scheduler_->DidCreateAndInitializeLayerTreeFrameSink(); EXPECT_NO_ACTION(); client_->Reset(); @@ -2779,14 +2778,14 @@ // Next vsync. AdvanceFrame(); EXPECT_ACTIONS("WillBeginImplFrame", - "ScheduledActionInvalidateCompositorFrameSink"); + "ScheduledActionInvalidateLayerTreeFrameSink"); EXPECT_FALSE(client_->IsInsideBeginImplFrame()); client_->Reset(); // Android onDraw. This doesn't consume the single begin frame request. scheduler_->SetNeedsRedraw(); bool resourceless_software_draw = false; - scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw); + scheduler_->OnDrawForLayerTreeFrameSink(resourceless_software_draw); EXPECT_ACTIONS("ScheduledActionDrawIfPossible"); EXPECT_FALSE(client_->IsInsideBeginImplFrame()); client_->Reset(); @@ -2798,13 +2797,13 @@ // Next vsync. AdvanceFrame(); EXPECT_ACTIONS("WillBeginImplFrame", - "ScheduledActionInvalidateCompositorFrameSink"); + "ScheduledActionInvalidateLayerTreeFrameSink"); EXPECT_FALSE(client_->IsInsideBeginImplFrame()); client_->Reset(); // Android onDraw. scheduler_->SetNeedsRedraw(); - scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw); + scheduler_->OnDrawForLayerTreeFrameSink(resourceless_software_draw); EXPECT_ACTIONS("ScheduledActionDrawIfPossible"); EXPECT_FALSE(client_->IsInsideBeginImplFrame()); client_->Reset(); @@ -2822,7 +2821,7 @@ scheduler_->SetNeedsRedraw(); bool resourceless_software_draw = false; - scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw); + scheduler_->OnDrawForLayerTreeFrameSink(resourceless_software_draw); EXPECT_ACTIONS("AddObserver(this)", "ScheduledActionDrawIfPossible"); EXPECT_FALSE(client_->IsInsideBeginImplFrame()); client_->Reset(); @@ -2918,7 +2917,7 @@ // Next vsync. args = SendNextBeginFrame(); EXPECT_ACTIONS("WillBeginImplFrame", - "ScheduledActionInvalidateCompositorFrameSink"); + "ScheduledActionInvalidateLayerTreeFrameSink"); EXPECT_FALSE(client_->IsInsideBeginImplFrame()); // Not confirmed yet and no damage, since not drawn yet. @@ -2934,7 +2933,7 @@ // Android onDraw. scheduler_->SetNeedsRedraw(); bool resourceless_software_draw = false; - scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw); + scheduler_->OnDrawForLayerTreeFrameSink(resourceless_software_draw); EXPECT_ACTIONS("ScheduledActionDrawIfPossible"); EXPECT_FALSE(client_->IsInsideBeginImplFrame()); client_->Reset(); @@ -2982,7 +2981,7 @@ AdvanceFrame(); EXPECT_ACTIONS("WillBeginImplFrame", "ScheduledActionSendBeginMainFrame", - "ScheduledActionInvalidateCompositorFrameSink"); + "ScheduledActionInvalidateLayerTreeFrameSink"); EXPECT_FALSE(client_->IsInsideBeginImplFrame()); client_->Reset(); @@ -3020,13 +3019,13 @@ // Next vsync. EXPECT_SCOPED(AdvanceFrame()); EXPECT_ACTIONS("WillBeginImplFrame", - "ScheduledActionInvalidateCompositorFrameSink"); + "ScheduledActionInvalidateLayerTreeFrameSink"); client_->Reset(); // Android onDraw. scheduler_->SetNeedsRedraw(); bool resourceless_software_draw = false; - scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw); + scheduler_->OnDrawForLayerTreeFrameSink(resourceless_software_draw); EXPECT_ACTIONS("ScheduledActionDrawIfPossible", "ScheduledActionPrepareTiles"); EXPECT_FALSE(client_->IsInsideBeginImplFrame()); @@ -3035,7 +3034,7 @@ // Android onDraw. scheduler_->SetNeedsRedraw(); - scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw); + scheduler_->OnDrawForLayerTreeFrameSink(resourceless_software_draw); EXPECT_ACTIONS("ScheduledActionDrawIfPossible", "ScheduledActionPrepareTiles"); EXPECT_FALSE(client_->IsInsideBeginImplFrame()); @@ -3061,13 +3060,13 @@ // Next vsync. EXPECT_SCOPED(AdvanceFrame()); EXPECT_ACTIONS("WillBeginImplFrame", - "ScheduledActionInvalidateCompositorFrameSink"); + "ScheduledActionInvalidateLayerTreeFrameSink"); client_->Reset(); // Android onDraw. scheduler_->SetNeedsRedraw(); bool resourceless_software_draw = false; - scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw); + scheduler_->OnDrawForLayerTreeFrameSink(resourceless_software_draw); EXPECT_ACTIONS("ScheduledActionDrawIfPossible"); EXPECT_FALSE(client_->IsInsideBeginImplFrame()); EXPECT_FALSE(scheduler_->PrepareTilesPending()); @@ -3090,12 +3089,12 @@ // Next vsync. EXPECT_SCOPED(AdvanceFrame()); EXPECT_ACTIONS("WillBeginImplFrame", - "ScheduledActionInvalidateCompositorFrameSink"); + "ScheduledActionInvalidateLayerTreeFrameSink"); client_->Reset(); // Android onDraw. scheduler_->SetNeedsRedraw(); - scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw); + scheduler_->OnDrawForLayerTreeFrameSink(resourceless_software_draw); EXPECT_ACTIONS("ScheduledActionDrawIfPossible"); EXPECT_FALSE(client_->IsInsideBeginImplFrame()); EXPECT_FALSE(scheduler_->PrepareTilesPending()); @@ -3115,7 +3114,7 @@ scheduler_->SetNeedsRedraw(); bool resourceless_software_draw = true; - scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw); + scheduler_->OnDrawForLayerTreeFrameSink(resourceless_software_draw); // SynchronousCompositor has to draw regardless of visibility. EXPECT_ACTIONS("ScheduledActionDrawIfPossible"); EXPECT_FALSE(client_->IsInsideBeginImplFrame()); @@ -3186,7 +3185,7 @@ EXPECT_FALSE(scheduler_->ImplLatencyTakesPriority()); } -TEST_F(SchedulerTest, NoCompositorFrameSinkCreationWhileCommitPending) { +TEST_F(SchedulerTest, NoLayerTreeFrameSinkCreationWhileCommitPending) { SetUpScheduler(THROTTLED_BFS); // SetNeedsBeginMainFrame should begin the frame. @@ -3195,13 +3194,13 @@ EXPECT_SCOPED(AdvanceFrame()); EXPECT_ACTIONS("WillBeginImplFrame", "ScheduledActionSendBeginMainFrame"); - // Lose the CompositorFrameSink and trigger the deadline. + // Lose the LayerTreeFrameSink and trigger the deadline. client_->Reset(); - scheduler_->DidLoseCompositorFrameSink(); + scheduler_->DidLoseLayerTreeFrameSink(); EXPECT_TRUE(client_->IsInsideBeginImplFrame()); EXPECT_NO_ACTION(); - // The scheduler should not trigger the CompositorFrameSink creation till the + // The scheduler should not trigger the LayerTreeFrameSink creation till the // commit is aborted. task_runner_->RunTasksWhile(client_->InsideBeginImplFrame(true)); EXPECT_FALSE(client_->IsInsideBeginImplFrame()); @@ -3211,8 +3210,8 @@ client_->Reset(); scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks::Now()); scheduler_->BeginMainFrameAborted( - CommitEarlyOutReason::ABORTED_COMPOSITOR_FRAME_SINK_LOST); - EXPECT_ACTIONS("ScheduledActionBeginCompositorFrameSinkCreation"); + CommitEarlyOutReason::ABORTED_LAYER_TREE_FRAME_SINK_LOST); + EXPECT_ACTIONS("ScheduledActionBeginLayerTreeFrameSinkCreation"); } TEST_F(SchedulerTest, ImplSideInvalidationsInDeadline) {
diff --git a/cc/surfaces/BUILD.gn b/cc/surfaces/BUILD.gn index b2ca53b..de46eef 100644 --- a/cc/surfaces/BUILD.gn +++ b/cc/surfaces/BUILD.gn
@@ -36,8 +36,8 @@ "compositor_frame_sink_support.cc", "compositor_frame_sink_support.h", "compositor_frame_sink_support_client.h", - "direct_compositor_frame_sink.cc", - "direct_compositor_frame_sink.h", + "direct_layer_tree_frame_sink.cc", + "direct_layer_tree_frame_sink.h", "direct_surface_reference_factory.cc", "direct_surface_reference_factory.h", "display.cc",
diff --git a/cc/surfaces/direct_compositor_frame_sink.cc b/cc/surfaces/direct_layer_tree_frame_sink.cc similarity index 73% rename from cc/surfaces/direct_compositor_frame_sink.cc rename to cc/surfaces/direct_layer_tree_frame_sink.cc index da704c51..2bae572 100644 --- a/cc/surfaces/direct_compositor_frame_sink.cc +++ b/cc/surfaces/direct_layer_tree_frame_sink.cc
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "cc/surfaces/direct_compositor_frame_sink.h" +#include "cc/surfaces/direct_layer_tree_frame_sink.h" #include "base/bind.h" #include "cc/output/compositor_frame.h" -#include "cc/output/compositor_frame_sink_client.h" +#include "cc/output/layer_tree_frame_sink_client.h" #include "cc/surfaces/display.h" #include "cc/surfaces/frame_sink_id.h" #include "cc/surfaces/local_surface_id_allocator.h" @@ -15,7 +15,7 @@ namespace cc { -DirectCompositorFrameSink::DirectCompositorFrameSink( +DirectLayerTreeFrameSink::DirectLayerTreeFrameSink( const FrameSinkId& frame_sink_id, SurfaceManager* surface_manager, Display* display, @@ -23,26 +23,26 @@ scoped_refptr<ContextProvider> worker_context_provider, gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, SharedBitmapManager* shared_bitmap_manager) - : CompositorFrameSink(std::move(context_provider), - std::move(worker_context_provider), - gpu_memory_buffer_manager, - shared_bitmap_manager), + : LayerTreeFrameSink(std::move(context_provider), + std::move(worker_context_provider), + gpu_memory_buffer_manager, + shared_bitmap_manager), frame_sink_id_(frame_sink_id), surface_manager_(surface_manager), display_(display) { DCHECK(thread_checker_.CalledOnValidThread()); capabilities_.must_always_swap = true; - // Display and DirectCompositorFrameSink share a GL context, so sync + // Display and DirectLayerTreeFrameSink share a GL context, so sync // points aren't needed when passing resources between them. capabilities_.delegated_sync_points_required = false; } -DirectCompositorFrameSink::DirectCompositorFrameSink( +DirectLayerTreeFrameSink::DirectLayerTreeFrameSink( const FrameSinkId& frame_sink_id, SurfaceManager* surface_manager, Display* display, scoped_refptr<VulkanContextProvider> vulkan_context_provider) - : CompositorFrameSink(std::move(vulkan_context_provider)), + : LayerTreeFrameSink(std::move(vulkan_context_provider)), frame_sink_id_(frame_sink_id), surface_manager_(surface_manager), display_(display) { @@ -50,15 +50,14 @@ capabilities_.must_always_swap = true; } -DirectCompositorFrameSink::~DirectCompositorFrameSink() { +DirectLayerTreeFrameSink::~DirectLayerTreeFrameSink() { DCHECK(thread_checker_.CalledOnValidThread()); } -bool DirectCompositorFrameSink::BindToClient( - CompositorFrameSinkClient* client) { +bool DirectLayerTreeFrameSink::BindToClient(LayerTreeFrameSinkClient* client) { DCHECK(thread_checker_.CalledOnValidThread()); - if (!CompositorFrameSink::BindToClient(client)) + if (!LayerTreeFrameSink::BindToClient(client)) return false; // We want the Display's output surface to hear about lost context, and since @@ -82,7 +81,7 @@ return true; } -void DirectCompositorFrameSink::DetachFromClient() { +void DirectLayerTreeFrameSink::DetachFromClient() { client_->SetBeginFrameSource(nullptr); begin_frame_source_.reset(); @@ -90,10 +89,10 @@ // one client is alive for this namespace at any given time. support_.reset(); - CompositorFrameSink::DetachFromClient(); + LayerTreeFrameSink::DetachFromClient(); } -void DirectCompositorFrameSink::SubmitCompositorFrame(CompositorFrame frame) { +void DirectLayerTreeFrameSink::SubmitCompositorFrame(CompositorFrame frame) { DCHECK(frame.metadata.begin_frame_ack.has_damage); DCHECK_LE(BeginFrameArgs::kStartingFrameNumber, frame.metadata.begin_frame_ack.sequence_number); @@ -112,51 +111,51 @@ DCHECK(result); } -void DirectCompositorFrameSink::DidNotProduceFrame(const BeginFrameAck& ack) { +void DirectLayerTreeFrameSink::DidNotProduceFrame(const BeginFrameAck& ack) { DCHECK(!ack.has_damage); DCHECK_LE(BeginFrameArgs::kStartingFrameNumber, ack.sequence_number); support_->DidNotProduceFrame(ack); } -void DirectCompositorFrameSink::DisplayOutputSurfaceLost() { +void DirectLayerTreeFrameSink::DisplayOutputSurfaceLost() { is_lost_ = true; - client_->DidLoseCompositorFrameSink(); + client_->DidLoseLayerTreeFrameSink(); } -void DirectCompositorFrameSink::DisplayWillDrawAndSwap( +void DirectLayerTreeFrameSink::DisplayWillDrawAndSwap( bool will_draw_and_swap, const RenderPassList& render_passes) { // This notification is not relevant to our client outside of tests. } -void DirectCompositorFrameSink::DisplayDidDrawAndSwap() { +void DirectLayerTreeFrameSink::DisplayDidDrawAndSwap() { // This notification is not relevant to our client outside of tests. We // unblock the client from DidDrawCallback() when the surface is going to // be drawn. } -void DirectCompositorFrameSink::DidReceiveCompositorFrameAck( +void DirectLayerTreeFrameSink::DidReceiveCompositorFrameAck( const ReturnedResourceArray& resources) { client_->ReclaimResources(resources); client_->DidReceiveCompositorFrameAck(); } -void DirectCompositorFrameSink::OnBeginFrame(const BeginFrameArgs& args) { +void DirectLayerTreeFrameSink::OnBeginFrame(const BeginFrameArgs& args) { begin_frame_source_->OnBeginFrame(args); } -void DirectCompositorFrameSink::ReclaimResources( +void DirectLayerTreeFrameSink::ReclaimResources( const ReturnedResourceArray& resources) { client_->ReclaimResources(resources); } -void DirectCompositorFrameSink::WillDrawSurface( +void DirectLayerTreeFrameSink::WillDrawSurface( const LocalSurfaceId& local_surface_id, const gfx::Rect& damage_rect) { // TODO(staraz): Implement this. } -void DirectCompositorFrameSink::OnNeedsBeginFrames(bool needs_begin_frame) { +void DirectLayerTreeFrameSink::OnNeedsBeginFrames(bool needs_begin_frame) { support_->SetNeedsBeginFrame(needs_begin_frame); }
diff --git a/cc/surfaces/direct_compositor_frame_sink.h b/cc/surfaces/direct_layer_tree_frame_sink.h similarity index 84% rename from cc/surfaces/direct_compositor_frame_sink.h rename to cc/surfaces/direct_layer_tree_frame_sink.h index 24480cb..f1c9c4b 100644 --- a/cc/surfaces/direct_compositor_frame_sink.h +++ b/cc/surfaces/direct_layer_tree_frame_sink.h
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CC_SURFACES_DIRECT_COMPOSITOR_FRAME_SINK_H_ -#define CC_SURFACES_DIRECT_COMPOSITOR_FRAME_SINK_H_ +#ifndef CC_SURFACES_DIRECT_LAYER_TREE_FRAME_SINK_H_ +#define CC_SURFACES_DIRECT_LAYER_TREE_FRAME_SINK_H_ #include "base/macros.h" #include "base/threading/thread_checker.h" -#include "cc/output/compositor_frame_sink.h" +#include "cc/output/layer_tree_frame_sink.h" #include "cc/scheduler/begin_frame_source.h" #include "cc/surfaces/compositor_frame_sink_support.h" #include "cc/surfaces/compositor_frame_sink_support_client.h" @@ -22,15 +22,15 @@ // This class submits compositor frames to an in-process Display, with the // client's frame being the root surface of the Display. -class CC_SURFACES_EXPORT DirectCompositorFrameSink - : public CompositorFrameSink, +class CC_SURFACES_EXPORT DirectLayerTreeFrameSink + : public LayerTreeFrameSink, public NON_EXPORTED_BASE(CompositorFrameSinkSupportClient), public ExternalBeginFrameSourceClient, public NON_EXPORTED_BASE(DisplayClient) { public: // The underlying Display, SurfaceManager, and LocalSurfaceIdAllocator must // outlive this class. - DirectCompositorFrameSink( + DirectLayerTreeFrameSink( const FrameSinkId& frame_sink_id, SurfaceManager* surface_manager, Display* display, @@ -38,15 +38,15 @@ scoped_refptr<ContextProvider> worker_context_provider, gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, SharedBitmapManager* shared_bitmap_manager); - DirectCompositorFrameSink( + DirectLayerTreeFrameSink( const FrameSinkId& frame_sink_id, SurfaceManager* surface_manager, Display* display, scoped_refptr<VulkanContextProvider> vulkan_context_provider); - ~DirectCompositorFrameSink() override; + ~DirectLayerTreeFrameSink() override; - // CompositorFrameSink implementation. - bool BindToClient(CompositorFrameSinkClient* client) override; + // LayerTreeFrameSink implementation. + bool BindToClient(LayerTreeFrameSinkClient* client) override; void DetachFromClient() override; void SubmitCompositorFrame(CompositorFrame frame) override; void DidNotProduceFrame(const BeginFrameAck& ack) override; @@ -85,9 +85,9 @@ bool is_lost_ = false; std::unique_ptr<ExternalBeginFrameSource> begin_frame_source_; - DISALLOW_COPY_AND_ASSIGN(DirectCompositorFrameSink); + DISALLOW_COPY_AND_ASSIGN(DirectLayerTreeFrameSink); }; } // namespace cc -#endif // CC_SURFACES_DIRECT_COMPOSITOR_FRAME_SINK_H_ +#endif // CC_SURFACES_DIRECT_LAYER_TREE_FRAME_SINK_H_
diff --git a/cc/surfaces/direct_compositor_frame_sink_unittest.cc b/cc/surfaces/direct_layer_tree_frame_sink_unittest.cc similarity index 82% rename from cc/surfaces/direct_compositor_frame_sink_unittest.cc rename to cc/surfaces/direct_layer_tree_frame_sink_unittest.cc index a56be81..3558826 100644 --- a/cc/surfaces/direct_compositor_frame_sink_unittest.cc +++ b/cc/surfaces/direct_layer_tree_frame_sink_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 "cc/surfaces/direct_compositor_frame_sink.h" +#include "cc/surfaces/direct_layer_tree_frame_sink.h" #include <memory> @@ -18,7 +18,7 @@ #include "cc/surfaces/surface_manager.h" #include "cc/test/begin_frame_args_test.h" #include "cc/test/compositor_frame_helpers.h" -#include "cc/test/fake_compositor_frame_sink_client.h" +#include "cc/test/fake_layer_tree_frame_sink_client.h" #include "cc/test/fake_output_surface.h" #include "cc/test/ordered_simple_task_runner.h" #include "cc/test/test_context_provider.h" @@ -31,16 +31,16 @@ static constexpr FrameSinkId kArbitraryFrameSinkId(1, 1); -class TestDirectCompositorFrameSink : public DirectCompositorFrameSink { +class TestDirectLayerTreeFrameSink : public DirectLayerTreeFrameSink { public: - using DirectCompositorFrameSink::DirectCompositorFrameSink; + using DirectLayerTreeFrameSink::DirectLayerTreeFrameSink; CompositorFrameSinkSupport* support() const { return support_.get(); } }; -class DirectCompositorFrameSinkTest : public testing::Test { +class DirectLayerTreeFrameSinkTest : public testing::Test { public: - DirectCompositorFrameSinkTest() + DirectLayerTreeFrameSinkTest() : now_src_(new base::SimpleTestTickClock()), task_runner_(new OrderedSimpleTaskRunner(now_src_.get(), true)), display_size_(1920, 1080), @@ -64,21 +64,21 @@ kArbitraryFrameSinkId, std::move(display_output_surface), std::move(scheduler), base::MakeUnique<TextureMailboxDeleter>(task_runner_.get()))); - compositor_frame_sink_.reset(new TestDirectCompositorFrameSink( + layer_tree_frame_sink_.reset(new TestDirectLayerTreeFrameSink( kArbitraryFrameSinkId, &surface_manager_, display_.get(), context_provider_, nullptr, &gpu_memory_buffer_manager_, &bitmap_manager_)); - compositor_frame_sink_->BindToClient(&compositor_frame_sink_client_); + layer_tree_frame_sink_->BindToClient(&layer_tree_frame_sink_client_); display_->Resize(display_size_); display_->SetVisible(true); EXPECT_FALSE( - compositor_frame_sink_client_.did_lose_compositor_frame_sink_called()); + layer_tree_frame_sink_client_.did_lose_layer_tree_frame_sink_called()); } - ~DirectCompositorFrameSinkTest() override { - compositor_frame_sink_->DetachFromClient(); + ~DirectLayerTreeFrameSinkTest() override { + layer_tree_frame_sink_->DetachFromClient(); } void SwapBuffersWithDamage(const gfx::Rect& damage_rect) { @@ -89,7 +89,7 @@ frame.metadata.begin_frame_ack = BeginFrameAck(0, 1, 1, true); frame.render_pass_list.push_back(std::move(render_pass)); - compositor_frame_sink_->SubmitCompositorFrame(std::move(frame)); + layer_tree_frame_sink_->SubmitCompositorFrame(std::move(frame)); } void SetUp() override { @@ -115,25 +115,25 @@ FakeOutputSurface* display_output_surface_ = nullptr; std::unique_ptr<BackToBackBeginFrameSource> begin_frame_source_; std::unique_ptr<Display> display_; - FakeCompositorFrameSinkClient compositor_frame_sink_client_; - std::unique_ptr<TestDirectCompositorFrameSink> compositor_frame_sink_; + FakeLayerTreeFrameSinkClient layer_tree_frame_sink_client_; + std::unique_ptr<TestDirectLayerTreeFrameSink> layer_tree_frame_sink_; }; -TEST_F(DirectCompositorFrameSinkTest, DamageTriggersSwapBuffers) { +TEST_F(DirectLayerTreeFrameSinkTest, DamageTriggersSwapBuffers) { SwapBuffersWithDamage(display_rect_); EXPECT_EQ(1u, display_output_surface_->num_sent_frames()); task_runner_->RunUntilIdle(); EXPECT_EQ(2u, display_output_surface_->num_sent_frames()); } -TEST_F(DirectCompositorFrameSinkTest, NoDamageDoesNotTriggerSwapBuffers) { +TEST_F(DirectLayerTreeFrameSinkTest, NoDamageDoesNotTriggerSwapBuffers) { SwapBuffersWithDamage(gfx::Rect()); EXPECT_EQ(1u, display_output_surface_->num_sent_frames()); task_runner_->RunUntilIdle(); EXPECT_EQ(1u, display_output_surface_->num_sent_frames()); } -TEST_F(DirectCompositorFrameSinkTest, SuspendedDoesNotTriggerSwapBuffers) { +TEST_F(DirectLayerTreeFrameSinkTest, SuspendedDoesNotTriggerSwapBuffers) { SwapBuffersWithDamage(display_rect_); EXPECT_EQ(1u, display_output_surface_->num_sent_frames()); display_output_surface_->set_suspended_for_recycle(true);
diff --git a/cc/surfaces/frame_sink_manager.cc b/cc/surfaces/frame_sink_manager.cc index 22f1d17..2d6078a 100644 --- a/cc/surfaces/frame_sink_manager.cc +++ b/cc/surfaces/frame_sink_manager.cc
@@ -27,8 +27,7 @@ FrameSinkManager::FrameSinkManager() = default; FrameSinkManager::~FrameSinkManager() { - // All CompositorFrameSinks should be unregistered prior to - // SurfaceManager destruction. + // All FrameSinks should be unregistered prior to SurfaceManager destruction. DCHECK_EQ(clients_.size(), 0u); DCHECK_EQ(registered_sources_.size(), 0u); }
diff --git a/cc/surfaces/surface_hittest_unittest.cc b/cc/surfaces/surface_hittest_unittest.cc index 4e406e3..9b2b236 100644 --- a/cc/surfaces/surface_hittest_unittest.cc +++ b/cc/surfaces/surface_hittest_unittest.cc
@@ -29,7 +29,7 @@ struct TestCase { SurfaceId input_surface_id; gfx::Point input_point; - SurfaceId expected_compositor_frame_sink_id; + SurfaceId expected_layer_tree_frame_sink_id; gfx::Point expected_output_point; }; @@ -42,7 +42,7 @@ const TestCase& test = tests[i]; gfx::Point point(test.input_point); gfx::Transform transform; - EXPECT_EQ(test.expected_compositor_frame_sink_id, + EXPECT_EQ(test.expected_layer_tree_frame_sink_id, hittest.GetTargetSurfaceAtPoint(test.input_surface_id, point, &transform)); transform.TransformPoint(&point); @@ -52,7 +52,7 @@ // transform as returned by GetTargetSurfaceAtPoint. gfx::Transform target_transform; EXPECT_TRUE(hittest.GetTransformToTargetSurface( - test.input_surface_id, test.expected_compositor_frame_sink_id, + test.input_surface_id, test.expected_layer_tree_frame_sink_id, &target_transform)); EXPECT_EQ(transform, target_transform); }
diff --git a/cc/surfaces/surface_manager.cc b/cc/surfaces/surface_manager.cc index f51b71f9..2b35c74 100644 --- a/cc/surfaces/surface_manager.cc +++ b/cc/surfaces/surface_manager.cc
@@ -485,11 +485,11 @@ if (lifetime_type_ == LifetimeType::REFERENCES) { // We can get into a situation where multiple CompositorFrames arrive for - // a CompositorFrameSink before the client can add any references for the - // frame. When the second frame with a new size arrives, the first will be - // destroyed in SurfaceFactory and then if there are no references it will - // be deleted during surface GC. A temporary reference, removed when a - // real reference is received, is added to prevent this from happening. + // a FrameSink before the client can add any references for the frame. When + // the second frame with a new size arrives, the first will be destroyed in + // SurfaceFactory and then if there are no references it will be deleted + // during surface GC. A temporary reference, removed when a real reference + // is received, is added to prevent this from happening. AddTemporaryReference(surface_info.id()); }
diff --git a/cc/surfaces/surface_manager_ref_unittest.cc b/cc/surfaces/surface_manager_ref_unittest.cc index 82dbd1cf..c3518e7 100644 --- a/cc/surfaces/surface_manager_ref_unittest.cc +++ b/cc/surfaces/surface_manager_ref_unittest.cc
@@ -501,9 +501,9 @@ manager().AssignTemporaryReference(id1a, kFrameSink1); ASSERT_THAT(GetAllTempReferences(), UnorderedElementsAre(id1a, id1b)); - // If the parent client crashes then the CompositorFrameSink connection will - // be closed and the FrameSinkId invalidated. The temporary reference - // |kFrameSink1| owns to |id2a| will be removed. + // If the parent client crashes then the FrameSink connection will be closed + // and the FrameSinkId invalidated. The temporary reference |kFrameSink1| owns + // to |id2a| will be removed. DestroyCompositorFrameSinkSupport(kFrameSink1); ASSERT_THAT(GetAllTempReferences(), UnorderedElementsAre(id1b));
diff --git a/cc/test/fake_compositor_frame_sink_client.cc b/cc/test/fake_compositor_frame_sink_client.cc deleted file mode 100644 index 59963ab5..0000000 --- a/cc/test/fake_compositor_frame_sink_client.cc +++ /dev/null
@@ -1,28 +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 "cc/output/compositor_frame_sink.h" -#include "cc/test/fake_compositor_frame_sink_client.h" - -namespace cc { - -void FakeCompositorFrameSinkClient::SetBeginFrameSource( - BeginFrameSource* source) { - begin_frame_source_ = source; -} - -void FakeCompositorFrameSinkClient::DidReceiveCompositorFrameAck() { - ack_count_++; -} - -void FakeCompositorFrameSinkClient::DidLoseCompositorFrameSink() { - did_lose_compositor_frame_sink_called_ = true; -} - -void FakeCompositorFrameSinkClient::SetMemoryPolicy( - const ManagedMemoryPolicy& policy) { - memory_policy_ = policy; -} - -} // namespace cc
diff --git a/cc/test/fake_compositor_frame_sink.cc b/cc/test/fake_layer_tree_frame_sink.cc similarity index 67% rename from cc/test/fake_compositor_frame_sink.cc rename to cc/test/fake_layer_tree_frame_sink.cc index ebc6842..88b3793 100644 --- a/cc/test/fake_compositor_frame_sink.cc +++ b/cc/test/fake_layer_tree_frame_sink.cc
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "cc/test/fake_compositor_frame_sink.h" +#include "cc/test/fake_layer_tree_frame_sink.h" #include "base/bind.h" #include "base/threading/thread_task_runner_handle.h" -#include "cc/output/compositor_frame_sink_client.h" +#include "cc/output/layer_tree_frame_sink_client.h" #include "cc/resources/returned_resource.h" #include "cc/scheduler/begin_frame_source.h" #include "cc/scheduler/delay_based_time_source.h" @@ -15,13 +15,13 @@ namespace cc { -FakeCompositorFrameSink::FakeCompositorFrameSink( +FakeLayerTreeFrameSink::FakeLayerTreeFrameSink( scoped_refptr<ContextProvider> context_provider, scoped_refptr<ContextProvider> worker_context_provider) - : CompositorFrameSink(std::move(context_provider), - std::move(worker_context_provider), - nullptr, - nullptr), + : LayerTreeFrameSink(std::move(context_provider), + std::move(worker_context_provider), + nullptr, + nullptr), weak_ptr_factory_(this) { gpu_memory_buffer_manager_ = context_provider_ ? &test_gpu_memory_buffer_manager_ : nullptr; @@ -29,10 +29,10 @@ context_provider_ ? nullptr : &test_shared_bitmap_manager_; } -FakeCompositorFrameSink::~FakeCompositorFrameSink() = default; +FakeLayerTreeFrameSink::~FakeLayerTreeFrameSink() = default; -bool FakeCompositorFrameSink::BindToClient(CompositorFrameSinkClient* client) { - if (!CompositorFrameSink::BindToClient(client)) +bool FakeLayerTreeFrameSink::BindToClient(LayerTreeFrameSinkClient* client) { + if (!LayerTreeFrameSink::BindToClient(client)) return false; begin_frame_source_ = base::MakeUnique<BackToBackBeginFrameSource>( base::MakeUnique<DelayBasedTimeSource>( @@ -41,12 +41,12 @@ return true; } -void FakeCompositorFrameSink::DetachFromClient() { +void FakeLayerTreeFrameSink::DetachFromClient() { ReturnResourcesHeldByParent(); - CompositorFrameSink::DetachFromClient(); + LayerTreeFrameSink::DetachFromClient(); } -void FakeCompositorFrameSink::SubmitCompositorFrame(CompositorFrame frame) { +void FakeLayerTreeFrameSink::SubmitCompositorFrame(CompositorFrame frame) { ReturnResourcesHeldByParent(); last_sent_frame_.reset(new CompositorFrame(std::move(frame))); @@ -60,17 +60,17 @@ base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, - base::BindOnce(&FakeCompositorFrameSink::DidReceiveCompositorFrameAck, + base::BindOnce(&FakeLayerTreeFrameSink::DidReceiveCompositorFrameAck, weak_ptr_factory_.GetWeakPtr())); } -void FakeCompositorFrameSink::DidNotProduceFrame(const BeginFrameAck& ack) {} +void FakeLayerTreeFrameSink::DidNotProduceFrame(const BeginFrameAck& ack) {} -void FakeCompositorFrameSink::DidReceiveCompositorFrameAck() { +void FakeLayerTreeFrameSink::DidReceiveCompositorFrameAck() { client_->DidReceiveCompositorFrameAck(); } -void FakeCompositorFrameSink::ReturnResourcesHeldByParent() { +void FakeLayerTreeFrameSink::ReturnResourcesHeldByParent() { if (last_sent_frame_) { // Return the last frame's resources immediately. ReturnedResourceArray resources;
diff --git a/cc/test/fake_compositor_frame_sink.h b/cc/test/fake_layer_tree_frame_sink.h similarity index 65% rename from cc/test/fake_compositor_frame_sink.h rename to cc/test/fake_layer_tree_frame_sink.h index 49b4abe..d6d63c4 100644 --- a/cc/test/fake_compositor_frame_sink.h +++ b/cc/test/fake_layer_tree_frame_sink.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 CC_TEST_FAKE_COMPOSITOR_FRAME_SINK_H_ -#define CC_TEST_FAKE_COMPOSITOR_FRAME_SINK_H_ +#ifndef CC_TEST_FAKE_LAYER_TREE_FRAME_SINK_H_ +#define CC_TEST_FAKE_LAYER_TREE_FRAME_SINK_H_ #include <stddef.h> @@ -14,7 +14,7 @@ #include "base/time/time.h" #include "cc/output/begin_frame_args.h" #include "cc/output/compositor_frame.h" -#include "cc/output/compositor_frame_sink.h" +#include "cc/output/layer_tree_frame_sink.h" #include "cc/output/software_output_device.h" #include "cc/test/test_context_provider.h" #include "cc/test/test_gles2_interface.h" @@ -26,64 +26,61 @@ class BeginFrameSource; -class FakeCompositorFrameSink : public CompositorFrameSink { +class FakeLayerTreeFrameSink : public LayerTreeFrameSink { public: - ~FakeCompositorFrameSink() override; + ~FakeLayerTreeFrameSink() override; - static std::unique_ptr<FakeCompositorFrameSink> Create3d() { - return base::WrapUnique(new FakeCompositorFrameSink( + static std::unique_ptr<FakeLayerTreeFrameSink> Create3d() { + return base::WrapUnique(new FakeLayerTreeFrameSink( TestContextProvider::Create(), TestContextProvider::CreateWorker())); } - static std::unique_ptr<FakeCompositorFrameSink> Create3d( + static std::unique_ptr<FakeLayerTreeFrameSink> Create3d( scoped_refptr<TestContextProvider> context_provider) { - return base::WrapUnique(new FakeCompositorFrameSink( + return base::WrapUnique(new FakeLayerTreeFrameSink( context_provider, TestContextProvider::CreateWorker())); } - static std::unique_ptr<FakeCompositorFrameSink> Create3d( + static std::unique_ptr<FakeLayerTreeFrameSink> Create3d( std::unique_ptr<TestWebGraphicsContext3D> context) { - return base::WrapUnique(new FakeCompositorFrameSink( + return base::WrapUnique(new FakeLayerTreeFrameSink( TestContextProvider::Create(std::move(context)), TestContextProvider::CreateWorker())); } - static std::unique_ptr<FakeCompositorFrameSink> - Create3dForGpuRasterization() { + static std::unique_ptr<FakeLayerTreeFrameSink> Create3dForGpuRasterization() { auto context = TestWebGraphicsContext3D::Create(); context->set_gpu_rasterization(true); auto context_provider = TestContextProvider::Create(std::move(context)); - return base::WrapUnique(new FakeCompositorFrameSink( + return base::WrapUnique(new FakeLayerTreeFrameSink( std::move(context_provider), TestContextProvider::CreateWorker())); } - static std::unique_ptr<FakeCompositorFrameSink> CreateSoftware() { - return base::WrapUnique(new FakeCompositorFrameSink(nullptr, nullptr)); + static std::unique_ptr<FakeLayerTreeFrameSink> CreateSoftware() { + return base::WrapUnique(new FakeLayerTreeFrameSink(nullptr, nullptr)); } - // CompositorFrameSink implementation. + // LayerTreeFrameSink implementation. void SubmitCompositorFrame(CompositorFrame frame) override; void DidNotProduceFrame(const BeginFrameAck& ack) override; - bool BindToClient(CompositorFrameSinkClient* client) override; + bool BindToClient(LayerTreeFrameSinkClient* client) override; void DetachFromClient() override; CompositorFrame* last_sent_frame() { return last_sent_frame_.get(); } size_t num_sent_frames() { return num_sent_frames_; } - CompositorFrameSinkClient* client() { return client_; } + LayerTreeFrameSinkClient* client() { return client_; } const TransferableResourceArray& resources_held_by_parent() { return resources_held_by_parent_; } - gfx::Rect last_swap_rect() const { - return last_swap_rect_; - } + gfx::Rect last_swap_rect() const { return last_swap_rect_; } void ReturnResourcesHeldByParent(); protected: - FakeCompositorFrameSink( + FakeLayerTreeFrameSink( scoped_refptr<ContextProvider> context_provider, scoped_refptr<ContextProvider> worker_context_provider); @@ -99,9 +96,9 @@ void DidReceiveCompositorFrameAck(); std::unique_ptr<BeginFrameSource> begin_frame_source_; - base::WeakPtrFactory<FakeCompositorFrameSink> weak_ptr_factory_; + base::WeakPtrFactory<FakeLayerTreeFrameSink> weak_ptr_factory_; }; } // namespace cc -#endif // CC_TEST_FAKE_COMPOSITOR_FRAME_SINK_H_ +#endif // CC_TEST_FAKE_LAYER_TREE_FRAME_SINK_H_
diff --git a/cc/test/fake_layer_tree_frame_sink_client.cc b/cc/test/fake_layer_tree_frame_sink_client.cc new file mode 100644 index 0000000..ed1f8ea --- /dev/null +++ b/cc/test/fake_layer_tree_frame_sink_client.cc
@@ -0,0 +1,28 @@ +// 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 "cc/test/fake_layer_tree_frame_sink_client.h" +#include "cc/output/layer_tree_frame_sink.h" + +namespace cc { + +void FakeLayerTreeFrameSinkClient::SetBeginFrameSource( + BeginFrameSource* source) { + begin_frame_source_ = source; +} + +void FakeLayerTreeFrameSinkClient::DidReceiveCompositorFrameAck() { + ack_count_++; +} + +void FakeLayerTreeFrameSinkClient::DidLoseLayerTreeFrameSink() { + did_lose_layer_tree_frame_sink_called_ = true; +} + +void FakeLayerTreeFrameSinkClient::SetMemoryPolicy( + const ManagedMemoryPolicy& policy) { + memory_policy_ = policy; +} + +} // namespace cc
diff --git a/cc/test/fake_compositor_frame_sink_client.h b/cc/test/fake_layer_tree_frame_sink_client.h similarity index 69% rename from cc/test/fake_compositor_frame_sink_client.h rename to cc/test/fake_layer_tree_frame_sink_client.h index a004912..fff25f14 100644 --- a/cc/test/fake_compositor_frame_sink_client.h +++ b/cc/test/fake_layer_tree_frame_sink_client.h
@@ -2,22 +2,23 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CC_TEST_FAKE_COMPOSITOR_FRAME_SINK_CLIENT_H_ -#define CC_TEST_FAKE_COMPOSITOR_FRAME_SINK_CLIENT_H_ +#ifndef CC_TEST_FAKE_LAYER_TREE_FRAME_SINK_CLIENT_H_ +#define CC_TEST_FAKE_LAYER_TREE_FRAME_SINK_CLIENT_H_ -#include "cc/output/compositor_frame_sink_client.h" +#include "cc/output/layer_tree_frame_sink_client.h" + #include "cc/output/managed_memory_policy.h" namespace cc { -class FakeCompositorFrameSinkClient : public CompositorFrameSinkClient { +class FakeLayerTreeFrameSinkClient : public LayerTreeFrameSinkClient { public: - FakeCompositorFrameSinkClient() : memory_policy_(0) {} + FakeLayerTreeFrameSinkClient() : memory_policy_(0) {} void SetBeginFrameSource(BeginFrameSource* source) override; void DidReceiveCompositorFrameAck() override; void ReclaimResources(const ReturnedResourceArray& resources) override {} - void DidLoseCompositorFrameSink() override; + void DidLoseLayerTreeFrameSink() override; void SetExternalTilePriorityConstraints( const gfx::Rect& viewport_rect_for_tile_priority, const gfx::Transform& transform_for_tile_priority) override {} @@ -29,8 +30,8 @@ int ack_count() { return ack_count_; } - bool did_lose_compositor_frame_sink_called() { - return did_lose_compositor_frame_sink_called_; + bool did_lose_layer_tree_frame_sink_called() { + return did_lose_layer_tree_frame_sink_called_; } const ManagedMemoryPolicy& memory_policy() const { return memory_policy_; } @@ -39,11 +40,11 @@ private: int ack_count_ = 0; - bool did_lose_compositor_frame_sink_called_ = false; + bool did_lose_layer_tree_frame_sink_called_ = false; ManagedMemoryPolicy memory_policy_; BeginFrameSource* begin_frame_source_; }; } // namespace cc -#endif // CC_TEST_FAKE_COMPOSITOR_FRAME_SINK_CLIENT_H_ +#endif // CC_TEST_FAKE_LAYER_TREE_FRAME_SINK_CLIENT_H_
diff --git a/cc/test/fake_layer_tree_host_client.cc b/cc/test/fake_layer_tree_host_client.cc index 1f5f912..f40ebb5 100644 --- a/cc/test/fake_layer_tree_host_client.cc +++ b/cc/test/fake_layer_tree_host_client.cc
@@ -4,7 +4,7 @@ #include "cc/test/fake_layer_tree_host_client.h" -#include "cc/test/fake_compositor_frame_sink.h" +#include "cc/test/fake_layer_tree_frame_sink.h" #include "cc/trees/layer_tree_host.h" namespace cc { @@ -12,13 +12,13 @@ FakeLayerTreeHostClient::FakeLayerTreeHostClient() = default; FakeLayerTreeHostClient::~FakeLayerTreeHostClient() = default; -void FakeLayerTreeHostClient::RequestNewCompositorFrameSink() { +void FakeLayerTreeHostClient::RequestNewLayerTreeFrameSink() { DCHECK(host_); - host_->SetCompositorFrameSink(FakeCompositorFrameSink::Create3d()); + host_->SetLayerTreeFrameSink(FakeLayerTreeFrameSink::Create3d()); } -void FakeLayerTreeHostClient::DidFailToInitializeCompositorFrameSink() { - RequestNewCompositorFrameSink(); +void FakeLayerTreeHostClient::DidFailToInitializeLayerTreeFrameSink() { + RequestNewLayerTreeFrameSink(); } } // namespace cc
diff --git a/cc/test/fake_layer_tree_host_client.h b/cc/test/fake_layer_tree_host_client.h index 0eb80269..2fe38fa 100644 --- a/cc/test/fake_layer_tree_host_client.h +++ b/cc/test/fake_layer_tree_host_client.h
@@ -19,8 +19,8 @@ void SetLayerTreeHost(LayerTreeHost* host) { host_ = host; } // StubLayerTreeHostClient overrides. - void RequestNewCompositorFrameSink() override; - void DidFailToInitializeCompositorFrameSink() override; + void RequestNewLayerTreeFrameSink() override; + void DidFailToInitializeLayerTreeFrameSink() override; private: LayerTreeHost* host_ = nullptr;
diff --git a/cc/test/fake_layer_tree_host_impl.cc b/cc/test/fake_layer_tree_host_impl.cc index a98ebd3..cc8b84c9 100644 --- a/cc/test/fake_layer_tree_host_impl.cc +++ b/cc/test/fake_layer_tree_host_impl.cc
@@ -54,7 +54,7 @@ } FakeLayerTreeHostImpl::~FakeLayerTreeHostImpl() { - ReleaseCompositorFrameSink(); + ReleaseLayerTreeFrameSink(); } void FakeLayerTreeHostImpl::CreatePendingTree() {
diff --git a/cc/test/fake_layer_tree_host_impl_client.h b/cc/test/fake_layer_tree_host_impl_client.h index 8d7471a..78b2ed8 100644 --- a/cc/test/fake_layer_tree_host_impl_client.h +++ b/cc/test/fake_layer_tree_host_impl_client.h
@@ -13,7 +13,7 @@ class FakeLayerTreeHostImplClient : public LayerTreeHostImplClient { public: // LayerTreeHostImplClient implementation. - void DidLoseCompositorFrameSinkOnImplThread() override {} + void DidLoseLayerTreeFrameSinkOnImplThread() override {} void SetBeginFrameSource(BeginFrameSource* source) override {} void DidReceiveCompositorFrameAckOnImplThread() override {} void OnCanDrawStateChanged(bool can_draw) override {} @@ -34,7 +34,7 @@ void WillPrepareTiles() override {} void DidPrepareTiles() override {} void DidCompletePageScaleAnimationOnImplThread() override {} - void OnDrawForCompositorFrameSink(bool resourceless_software_draw) override {} + void OnDrawForLayerTreeFrameSink(bool resourceless_software_draw) override {} void NeedsImplSideInvalidation() override; void RequestBeginMainFrameNotExpected(bool new_state) override {} void NotifyImageDecodeRequestFinished() override {}
diff --git a/cc/test/fake_proxy.cc b/cc/test/fake_proxy.cc index a5a3a25..fed9365 100644 --- a/cc/test/fake_proxy.cc +++ b/cc/test/fake_proxy.cc
@@ -18,8 +18,6 @@ return false; } -void FakeProxy::ReleaseCompositorFrameSink() {} - bool FakeProxy::CommitRequested() const { return false; } void FakeProxy::SetMutator(std::unique_ptr<LayerTreeMutator> mutator) {}
diff --git a/cc/test/fake_proxy.h b/cc/test/fake_proxy.h index 8688d857..daf017f 100644 --- a/cc/test/fake_proxy.h +++ b/cc/test/fake_proxy.h
@@ -19,9 +19,9 @@ bool IsStarted() const override; bool CommitToActiveTree() const override; - void SetCompositorFrameSink( - CompositorFrameSink* compositor_frame_sink) override {} - void ReleaseCompositorFrameSink() override; + void SetLayerTreeFrameSink( + LayerTreeFrameSink* layer_tree_frame_sink) override {} + void ReleaseLayerTreeFrameSink() override {} void SetVisible(bool visible) override {} void SetNeedsAnimate() override {} void SetNeedsUpdateLayers() override {}
diff --git a/cc/test/layer_test_common.cc b/cc/test/layer_test_common.cc index cb19026..0f61bac 100644 --- a/cc/test/layer_test_common.cc +++ b/cc/test/layer_test_common.cc
@@ -17,7 +17,7 @@ #include "cc/quads/draw_quad.h" #include "cc/quads/render_pass.h" #include "cc/test/animation_test_common.h" -#include "cc/test/fake_compositor_frame_sink.h" +#include "cc/test/fake_layer_tree_frame_sink.h" #include "cc/test/mock_occlusion_tracker.h" #include "cc/trees/layer_tree_host_common.h" #include "testing/gtest/include/gtest/gtest.h" @@ -132,16 +132,16 @@ : LayerImplTest(LayerTreeSettings()) {} LayerTestCommon::LayerImplTest::LayerImplTest( - std::unique_ptr<CompositorFrameSink> compositor_frame_sink) - : LayerImplTest(LayerTreeSettings(), std::move(compositor_frame_sink)) {} + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink) + : LayerImplTest(LayerTreeSettings(), std::move(layer_tree_frame_sink)) {} LayerTestCommon::LayerImplTest::LayerImplTest(const LayerTreeSettings& settings) - : LayerImplTest(settings, FakeCompositorFrameSink::Create3d()) {} + : LayerImplTest(settings, FakeLayerTreeFrameSink::Create3d()) {} LayerTestCommon::LayerImplTest::LayerImplTest( const LayerTreeSettings& settings, - std::unique_ptr<CompositorFrameSink> compositor_frame_sink) - : compositor_frame_sink_(std::move(compositor_frame_sink)), + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink) + : layer_tree_frame_sink_(std::move(layer_tree_frame_sink)), animation_host_(AnimationHost::CreateForTesting(ThreadInstance::MAIN)), host_(FakeLayerTreeHost::Create(&client_, &task_graph_runner_, @@ -154,7 +154,7 @@ host_->host_impl()->active_tree()->SetRootLayerForTesting(std::move(root)); host_->host_impl()->SetVisible(true); EXPECT_TRUE( - host_->host_impl()->InitializeRenderer(compositor_frame_sink_.get())); + host_->host_impl()->InitializeRenderer(layer_tree_frame_sink_.get())); const int timeline_id = AnimationIdProvider::NextTimelineId(); timeline_ = AnimationTimeline::Create(timeline_id); @@ -168,7 +168,7 @@ LayerTestCommon::LayerImplTest::~LayerImplTest() { animation_host_->RemoveAnimationTimeline(timeline_); timeline_ = nullptr; - host_->host_impl()->ReleaseCompositorFrameSink(); + host_->host_impl()->ReleaseLayerTreeFrameSink(); } void LayerTestCommon::LayerImplTest::CalcDrawProps(
diff --git a/cc/test/layer_test_common.h b/cc/test/layer_test_common.h index 3d3bd104..87466a0 100644 --- a/cc/test/layer_test_common.h +++ b/cc/test/layer_test_common.h
@@ -36,7 +36,7 @@ namespace cc { class LayerImpl; -class CompositorFrameSink; +class LayerTreeFrameSink; class QuadList; class RenderSurfaceImpl; class ResourceProvider; @@ -59,10 +59,10 @@ public: LayerImplTest(); explicit LayerImplTest( - std::unique_ptr<CompositorFrameSink> compositor_frame_sink); + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink); explicit LayerImplTest(const LayerTreeSettings& settings); LayerImplTest(const LayerTreeSettings& settings, - std::unique_ptr<CompositorFrameSink> compositor_frame_sink); + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink); ~LayerImplTest(); template <typename T> @@ -176,8 +176,8 @@ void RequestCopyOfOutput(); - CompositorFrameSink* compositor_frame_sink() const { - return host_->host_impl()->compositor_frame_sink(); + LayerTreeFrameSink* layer_tree_frame_sink() const { + return host_->host_impl()->layer_tree_frame_sink(); } ResourceProvider* resource_provider() const { return host_->host_impl()->resource_provider(); @@ -201,7 +201,7 @@ private: FakeLayerTreeHostClient client_; TestTaskGraphRunner task_graph_runner_; - std::unique_ptr<CompositorFrameSink> compositor_frame_sink_; + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink_; std::unique_ptr<AnimationHost> animation_host_; std::unique_ptr<FakeLayerTreeHost> host_; std::unique_ptr<RenderPass> render_pass_;
diff --git a/cc/test/layer_tree_pixel_resource_test.cc b/cc/test/layer_tree_pixel_resource_test.cc index 261c833..1dd5db0e 100644 --- a/cc/test/layer_tree_pixel_resource_test.cc +++ b/cc/test/layer_tree_pixel_resource_test.cc
@@ -6,7 +6,7 @@ #include "base/memory/ptr_util.h" #include "cc/layers/layer.h" -#include "cc/output/compositor_frame_sink.h" +#include "cc/output/layer_tree_frame_sink.h" #include "cc/raster/bitmap_raster_buffer_provider.h" #include "cc/raster/gpu_raster_buffer_provider.h" #include "cc/raster/one_copy_raster_buffer_provider.h" @@ -129,9 +129,9 @@ DCHECK(initialized_); ContextProvider* compositor_context_provider = - host_impl->compositor_frame_sink()->context_provider(); + host_impl->layer_tree_frame_sink()->context_provider(); ContextProvider* worker_context_provider = - host_impl->compositor_frame_sink()->worker_context_provider(); + host_impl->layer_tree_frame_sink()->worker_context_provider(); ResourceProvider* resource_provider = host_impl->resource_provider(); int max_bytes_per_copy_operation = 1024 * 1024; int max_staging_buffer_usage_in_bytes = 32 * 1024 * 1024;
diff --git a/cc/test/layer_tree_pixel_test.cc b/cc/test/layer_tree_pixel_test.cc index ce61a691..915a95d 100644 --- a/cc/test/layer_tree_pixel_test.cc +++ b/cc/test/layer_tree_pixel_test.cc
@@ -21,8 +21,8 @@ #include "cc/test/pixel_comparator.h" #include "cc/test/pixel_test_output_surface.h" #include "cc/test/pixel_test_utils.h" -#include "cc/test/test_compositor_frame_sink.h" #include "cc/test/test_in_process_context_provider.h" +#include "cc/test/test_layer_tree_frame_sink.h" #include "cc/trees/layer_tree_impl.h" #include "gpu/command_buffer/client/gles2_implementation.h" #include "gpu/ipc/gl_in_process_context.h" @@ -38,8 +38,8 @@ LayerTreePixelTest::~LayerTreePixelTest() {} -std::unique_ptr<TestCompositorFrameSink> -LayerTreePixelTest::CreateCompositorFrameSink( +std::unique_ptr<TestLayerTreeFrameSink> +LayerTreePixelTest::CreateLayerTreeFrameSink( const RendererSettings& renderer_settings, double refresh_rate, scoped_refptr<ContextProvider>, @@ -55,7 +55,7 @@ bool synchronous_composite = !HasImplThread() && !layer_tree_host()->GetSettings().single_thread_proxy_scheduler; - auto delegating_output_surface = base::MakeUnique<TestCompositorFrameSink>( + auto delegating_output_surface = base::MakeUnique<TestLayerTreeFrameSink>( compositor_context_provider, std::move(worker_context_provider), shared_bitmap_manager(), gpu_memory_buffer_manager(), RendererSettings(), ImplThreadTaskRunner(), synchronous_composite, disable_display_vsync,
diff --git a/cc/test/layer_tree_pixel_test.h b/cc/test/layer_tree_pixel_test.h index 26f9da68f..5b2c7bb 100644 --- a/cc/test/layer_tree_pixel_test.h +++ b/cc/test/layer_tree_pixel_test.h
@@ -36,7 +36,7 @@ ~LayerTreePixelTest() override; // LayerTreeTest overrides. - std::unique_ptr<TestCompositorFrameSink> CreateCompositorFrameSink( + std::unique_ptr<TestLayerTreeFrameSink> CreateLayerTreeFrameSink( const RendererSettings& renderer_settings, double refresh_rate, scoped_refptr<ContextProvider> compositor_context_provider,
diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc index 67b7028..2bd8d5b 100644 --- a/cc/test/layer_tree_test.cc +++ b/cc/test/layer_tree_test.cc
@@ -24,8 +24,8 @@ #include "cc/test/begin_frame_args_test.h" #include "cc/test/fake_layer_tree_host_client.h" #include "cc/test/fake_output_surface.h" -#include "cc/test/test_compositor_frame_sink.h" #include "cc/test/test_context_provider.h" +#include "cc/test/test_layer_tree_frame_sink.h" #include "cc/test/test_shared_bitmap_manager.h" #include "cc/trees/layer_tree_host_client.h" #include "cc/trees/layer_tree_host_impl.h" @@ -240,8 +240,8 @@ test_hooks_->DidActivateTreeOnThread(this); } - bool InitializeRenderer(CompositorFrameSink* compositor_frame_sink) override { - bool success = LayerTreeHostImpl::InitializeRenderer(compositor_frame_sink); + bool InitializeRenderer(LayerTreeFrameSink* layer_tree_frame_sink) override { + bool success = LayerTreeHostImpl::InitializeRenderer(layer_tree_frame_sink); test_hooks_->InitializedRendererOnThread(this, success); return success; } @@ -343,17 +343,17 @@ void RecordWheelAndTouchScrollingCount(bool has_scrolled_by_wheel, bool has_scrolled_by_touch) override {} - void RequestNewCompositorFrameSink() override { - test_hooks_->RequestNewCompositorFrameSink(); + void RequestNewLayerTreeFrameSink() override { + test_hooks_->RequestNewLayerTreeFrameSink(); } - void DidInitializeCompositorFrameSink() override { - test_hooks_->DidInitializeCompositorFrameSink(); + void DidInitializeLayerTreeFrameSink() override { + test_hooks_->DidInitializeLayerTreeFrameSink(); } - void DidFailToInitializeCompositorFrameSink() override { - test_hooks_->DidFailToInitializeCompositorFrameSink(); - RequestNewCompositorFrameSink(); + void DidFailToInitializeLayerTreeFrameSink() override { + test_hooks_->DidFailToInitializeLayerTreeFrameSink(); + RequestNewLayerTreeFrameSink(); } void WillCommit() override { test_hooks_->WillCommit(); } @@ -369,7 +369,7 @@ } void DidSubmitCompositorFrame() override {} - void DidLoseCompositorFrameSink() override {} + void DidLoseLayerTreeFrameSink() override {} void RequestScheduleComposite() override { test_hooks_->ScheduleComposite(); } void DidCompletePageScaleAnimation() override {} void BeginMainFrameNotExpectedSoon() override { @@ -466,13 +466,13 @@ bool test_started_; }; -class LayerTreeTestCompositorFrameSinkClient - : public TestCompositorFrameSinkClient { +class LayerTreeTestLayerTreeFrameSinkClient + : public TestLayerTreeFrameSinkClient { public: - explicit LayerTreeTestCompositorFrameSinkClient(TestHooks* hooks) + explicit LayerTreeTestLayerTreeFrameSinkClient(TestHooks* hooks) : hooks_(hooks) {} - // TestCompositorFrameSinkClient implementation. + // TestLayerTreeFrameSinkClient implementation. std::unique_ptr<OutputSurface> CreateDisplayOutputSurface( scoped_refptr<ContextProvider> compositor_context_provider) override { return hooks_->CreateDisplayOutputSurfaceOnThread( @@ -498,8 +498,8 @@ }; LayerTreeTest::LayerTreeTest() - : compositor_frame_sink_client_( - new LayerTreeTestCompositorFrameSinkClient(this)), + : layer_tree_frame_sink_client_( + new LayerTreeTestLayerTreeFrameSinkClient(this)), weak_factory_(this) { main_thread_weak_ptr_ = weak_factory_.GetWeakPtr(); @@ -638,9 +638,9 @@ main_thread_weak_ptr_)); } -std::unique_ptr<CompositorFrameSink> -LayerTreeTest::ReleaseCompositorFrameSinkOnLayerTreeHost() { - return layer_tree_host_->ReleaseCompositorFrameSink(); +std::unique_ptr<LayerTreeFrameSink> +LayerTreeTest::ReleaseLayerTreeFrameSinkOnLayerTreeHost() { + return layer_tree_host_->ReleaseLayerTreeFrameSink(); } void LayerTreeTest::SetVisibleOnLayerTreeHost(bool visible) { @@ -855,7 +855,7 @@ AfterTest(); } -void LayerTreeTest::RequestNewCompositorFrameSink() { +void LayerTreeTest::RequestNewLayerTreeFrameSink() { scoped_refptr<TestContextProvider> shared_context_provider = TestContextProvider::Create(); scoped_refptr<TestContextProvider> worker_context_provider = @@ -867,15 +867,14 @@ constexpr double refresh_rate = 200.0; renderer_settings.resource_settings.buffer_to_texture_target_map = DefaultBufferToTextureTargetMapForTesting(); - auto compositor_frame_sink = CreateCompositorFrameSink( + auto layer_tree_frame_sink = CreateLayerTreeFrameSink( renderer_settings, refresh_rate, std::move(shared_context_provider), std::move(worker_context_provider)); - compositor_frame_sink->SetClient(compositor_frame_sink_client_.get()); - layer_tree_host_->SetCompositorFrameSink(std::move(compositor_frame_sink)); + layer_tree_frame_sink->SetClient(layer_tree_frame_sink_client_.get()); + layer_tree_host_->SetLayerTreeFrameSink(std::move(layer_tree_frame_sink)); } -std::unique_ptr<TestCompositorFrameSink> -LayerTreeTest::CreateCompositorFrameSink( +std::unique_ptr<TestLayerTreeFrameSink> LayerTreeTest::CreateLayerTreeFrameSink( const RendererSettings& renderer_settings, double refresh_rate, scoped_refptr<ContextProvider> compositor_context_provider, @@ -884,7 +883,7 @@ bool synchronous_composite = !HasImplThread() && !layer_tree_host()->GetSettings().single_thread_proxy_scheduler; - return base::MakeUnique<TestCompositorFrameSink>( + return base::MakeUnique<TestLayerTreeFrameSink>( compositor_context_provider, std::move(worker_context_provider), shared_bitmap_manager(), gpu_memory_buffer_manager(), renderer_settings, impl_task_runner_, synchronous_composite, disable_display_vsync,
diff --git a/cc/test/layer_tree_test.h b/cc/test/layer_tree_test.h index 67f927e8..e7c4644 100644 --- a/cc/test/layer_tree_test.h +++ b/cc/test/layer_tree_test.h
@@ -23,10 +23,10 @@ class LayerImpl; class LayerTreeHost; class LayerTreeHostForTesting; -class LayerTreeTestCompositorFrameSinkClient; +class LayerTreeTestLayerTreeFrameSinkClient; class Proxy; class TestContextProvider; -class TestCompositorFrameSink; +class TestLayerTreeFrameSink; class TestTaskGraphRunner; // Creates the virtual viewport layer hierarchy under the given root_layer. @@ -98,8 +98,8 @@ void RealEndTest(); - std::unique_ptr<CompositorFrameSink> - ReleaseCompositorFrameSinkOnLayerTreeHost(); + std::unique_ptr<LayerTreeFrameSink> + ReleaseLayerTreeFrameSinkOnLayerTreeHost(); void SetVisibleOnLayerTreeHost(bool visible); virtual void AfterTest() = 0; @@ -134,18 +134,18 @@ void DestroyLayerTreeHost(); // By default, output surface recreation is synchronous. - void RequestNewCompositorFrameSink() override; + void RequestNewLayerTreeFrameSink() override; // Override this and call the base class to change what ContextProviders will // be used (such as for pixel tests). Or override it and create your own - // TestCompositorFrameSink to control how it is created. - virtual std::unique_ptr<TestCompositorFrameSink> CreateCompositorFrameSink( + // TestLayerTreeFrameSink to control how it is created. + virtual std::unique_ptr<TestLayerTreeFrameSink> CreateLayerTreeFrameSink( const RendererSettings& renderer_settings, double refresh_rate, scoped_refptr<ContextProvider> compositor_context_provider, scoped_refptr<ContextProvider> worker_context_provider); // Override this and call the base class to change what ContextProvider will // be used, such as to prevent sharing the context with the - // CompositorFrameSink. Or override it and create your own OutputSurface to + // LayerTreeFrameSink. Or override it and create your own OutputSurface to // change what type of OutputSurface is used, such as a real OutputSurface for // pixel tests or a software-compositing OutputSurface. std::unique_ptr<OutputSurface> CreateDisplayOutputSurfaceOnThread( @@ -190,8 +190,8 @@ int timeout_seconds_ = false; - std::unique_ptr<LayerTreeTestCompositorFrameSinkClient> - compositor_frame_sink_client_; + std::unique_ptr<LayerTreeTestLayerTreeFrameSinkClient> + layer_tree_frame_sink_client_; scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner_; std::unique_ptr<base::Thread> impl_thread_;
diff --git a/cc/test/stub_layer_tree_host_client.h b/cc/test/stub_layer_tree_host_client.h index 948e5b2..0e23fc43a 100644 --- a/cc/test/stub_layer_tree_host_client.h +++ b/cc/test/stub_layer_tree_host_client.h
@@ -27,9 +27,9 @@ float top_controls_delta) override {} void RecordWheelAndTouchScrollingCount(bool has_scrolled_by_wheel, bool has_scrolled_by_touch) override {} - void RequestNewCompositorFrameSink() override {} - void DidInitializeCompositorFrameSink() override {} - void DidFailToInitializeCompositorFrameSink() override {} + void RequestNewLayerTreeFrameSink() override {} + void DidInitializeLayerTreeFrameSink() override {} + void DidFailToInitializeLayerTreeFrameSink() override {} void WillCommit() override {} void DidCommit() override {} void DidCommitAndDrawFrame() override {}
diff --git a/cc/test/stub_layer_tree_host_single_thread_client.h b/cc/test/stub_layer_tree_host_single_thread_client.h index 1112675..762b6ce 100644 --- a/cc/test/stub_layer_tree_host_single_thread_client.h +++ b/cc/test/stub_layer_tree_host_single_thread_client.h
@@ -18,7 +18,7 @@ void RequestScheduleComposite() override {} void RequestScheduleAnimation() override {} void DidSubmitCompositorFrame() override {} - void DidLoseCompositorFrameSink() override {} + void DidLoseLayerTreeFrameSink() override {} }; } // namespace cc
diff --git a/cc/test/test_hooks.h b/cc/test/test_hooks.h index bff5cd5..a59f6aa 100644 --- a/cc/test/test_hooks.h +++ b/cc/test/test_hooks.h
@@ -94,8 +94,8 @@ virtual void WillBeginMainFrame() {} virtual void DidBeginMainFrame() {} virtual void UpdateLayerTreeHost() {} - virtual void DidInitializeCompositorFrameSink() {} - virtual void DidFailToInitializeCompositorFrameSink() {} + virtual void DidInitializeLayerTreeFrameSink() {} + virtual void DidFailToInitializeLayerTreeFrameSink() {} virtual void DidAddAnimation() {} virtual void WillCommit() {} virtual void DidCommit() {} @@ -122,7 +122,7 @@ // OutputSurface indirections to the LayerTreeTest, that can be further // overridden. - virtual void RequestNewCompositorFrameSink() = 0; + virtual void RequestNewLayerTreeFrameSink() = 0; virtual std::unique_ptr<OutputSurface> CreateDisplayOutputSurfaceOnThread( scoped_refptr<ContextProvider> compositor_context_provider) = 0; };
diff --git a/cc/test/test_compositor_frame_sink.cc b/cc/test/test_layer_tree_frame_sink.cc similarity index 80% rename from cc/test/test_compositor_frame_sink.cc rename to cc/test/test_layer_tree_frame_sink.cc index f03d709c..36b7e98b 100644 --- a/cc/test/test_compositor_frame_sink.cc +++ b/cc/test/test_layer_tree_frame_sink.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 "cc/test/test_compositor_frame_sink.h" +#include "cc/test/test_layer_tree_frame_sink.h" #include <stdint.h> #include <utility> @@ -10,18 +10,18 @@ #include "base/memory/ptr_util.h" #include "base/single_thread_task_runner.h" #include "cc/output/begin_frame_args.h" -#include "cc/output/compositor_frame_sink_client.h" #include "cc/output/copy_output_request.h" #include "cc/output/direct_renderer.h" +#include "cc/output/layer_tree_frame_sink_client.h" #include "cc/output/output_surface.h" #include "cc/output/texture_mailbox_deleter.h" #include "cc/surfaces/compositor_frame_sink_support.h" namespace cc { -static constexpr FrameSinkId kCompositorFrameSinkId(1, 1); +static constexpr FrameSinkId kLayerTreeFrameSinkId(1, 1); -TestCompositorFrameSink::TestCompositorFrameSink( +TestLayerTreeFrameSink::TestLayerTreeFrameSink( scoped_refptr<ContextProvider> compositor_context_provider, scoped_refptr<ContextProvider> worker_context_provider, SharedBitmapManager* shared_bitmap_manager, @@ -31,16 +31,16 @@ bool synchronous_composite, bool disable_display_vsync, double refresh_rate) - : CompositorFrameSink(std::move(compositor_context_provider), - std::move(worker_context_provider), - gpu_memory_buffer_manager, - shared_bitmap_manager), + : LayerTreeFrameSink(std::move(compositor_context_provider), + std::move(worker_context_provider), + gpu_memory_buffer_manager, + shared_bitmap_manager), synchronous_composite_(synchronous_composite), disable_display_vsync_(disable_display_vsync), renderer_settings_(renderer_settings), refresh_rate_(refresh_rate), task_runner_(std::move(task_runner)), - frame_sink_id_(kCompositorFrameSinkId), + frame_sink_id_(kLayerTreeFrameSinkId), surface_manager_(new SurfaceManager), local_surface_id_allocator_(new LocalSurfaceIdAllocator()), external_begin_frame_source_(this), @@ -50,17 +50,17 @@ capabilities_.delegated_sync_points_required = true; } -TestCompositorFrameSink::~TestCompositorFrameSink() { +TestLayerTreeFrameSink::~TestLayerTreeFrameSink() { DCHECK(copy_requests_.empty()); } -void TestCompositorFrameSink::RequestCopyOfOutput( +void TestLayerTreeFrameSink::RequestCopyOfOutput( std::unique_ptr<CopyOutputRequest> request) { copy_requests_.push_back(std::move(request)); } -bool TestCompositorFrameSink::BindToClient(CompositorFrameSinkClient* client) { - if (!CompositorFrameSink::BindToClient(client)) +bool TestLayerTreeFrameSink::BindToClient(LayerTreeFrameSinkClient* client) { + if (!LayerTreeFrameSink::BindToClient(client)) return false; std::unique_ptr<OutputSurface> display_output_surface = @@ -113,7 +113,7 @@ return true; } -void TestCompositorFrameSink::DetachFromClient() { +void TestLayerTreeFrameSink::DetachFromClient() { if (begin_frame_source_) surface_manager_->UnregisterBeginFrameSource(begin_frame_source_.get()); client_->SetBeginFrameSource(nullptr); @@ -123,15 +123,15 @@ local_surface_id_allocator_ = nullptr; surface_manager_ = nullptr; test_client_ = nullptr; - CompositorFrameSink::DetachFromClient(); + LayerTreeFrameSink::DetachFromClient(); } -void TestCompositorFrameSink::SetLocalSurfaceId( +void TestLayerTreeFrameSink::SetLocalSurfaceId( const LocalSurfaceId& local_surface_id) { test_client_->DisplayReceivedLocalSurfaceId(local_surface_id); } -void TestCompositorFrameSink::SubmitCompositorFrame(CompositorFrame frame) { +void TestLayerTreeFrameSink::SubmitCompositorFrame(CompositorFrame frame) { DCHECK(frame.metadata.begin_frame_ack.has_damage); DCHECK_LE(BeginFrameArgs::kStartingFrameNumber, frame.metadata.begin_frame_ack.sequence_number); @@ -163,18 +163,18 @@ // calling the client to tell it that it is done. task_runner_->PostTask( FROM_HERE, - base::BindOnce(&TestCompositorFrameSink::SendCompositorFrameAckToClient, + base::BindOnce(&TestLayerTreeFrameSink::SendCompositorFrameAckToClient, weak_ptr_factory_.GetWeakPtr())); } } -void TestCompositorFrameSink::DidNotProduceFrame(const BeginFrameAck& ack) { +void TestLayerTreeFrameSink::DidNotProduceFrame(const BeginFrameAck& ack) { DCHECK(!ack.has_damage); DCHECK_LE(BeginFrameArgs::kStartingFrameNumber, ack.sequence_number); support_->DidNotProduceFrame(ack); } -void TestCompositorFrameSink::DidReceiveCompositorFrameAck( +void TestLayerTreeFrameSink::DidReceiveCompositorFrameAck( const ReturnedResourceArray& resources) { ReclaimResources(resources); // In synchronous mode, we manually send acks and this method should not be @@ -184,38 +184,38 @@ client_->DidReceiveCompositorFrameAck(); } -void TestCompositorFrameSink::OnBeginFrame(const BeginFrameArgs& args) { +void TestLayerTreeFrameSink::OnBeginFrame(const BeginFrameArgs& args) { external_begin_frame_source_.OnBeginFrame(args); } -void TestCompositorFrameSink::ReclaimResources( +void TestLayerTreeFrameSink::ReclaimResources( const ReturnedResourceArray& resources) { client_->ReclaimResources(resources); } -void TestCompositorFrameSink::WillDrawSurface( +void TestLayerTreeFrameSink::WillDrawSurface( const LocalSurfaceId& local_surface_id, const gfx::Rect& damage_rect) {} -void TestCompositorFrameSink::DisplayOutputSurfaceLost() { - client_->DidLoseCompositorFrameSink(); +void TestLayerTreeFrameSink::DisplayOutputSurfaceLost() { + client_->DidLoseLayerTreeFrameSink(); } -void TestCompositorFrameSink::DisplayWillDrawAndSwap( +void TestLayerTreeFrameSink::DisplayWillDrawAndSwap( bool will_draw_and_swap, const RenderPassList& render_passes) { test_client_->DisplayWillDrawAndSwap(will_draw_and_swap, render_passes); } -void TestCompositorFrameSink::DisplayDidDrawAndSwap() { +void TestLayerTreeFrameSink::DisplayDidDrawAndSwap() { test_client_->DisplayDidDrawAndSwap(); } -void TestCompositorFrameSink::OnNeedsBeginFrames(bool needs_begin_frames) { +void TestLayerTreeFrameSink::OnNeedsBeginFrames(bool needs_begin_frames) { support_->SetNeedsBeginFrame(needs_begin_frames); } -void TestCompositorFrameSink::SendCompositorFrameAckToClient() { +void TestLayerTreeFrameSink::SendCompositorFrameAckToClient() { client_->DidReceiveCompositorFrameAck(); }
diff --git a/cc/test/test_compositor_frame_sink.h b/cc/test/test_layer_tree_frame_sink.h similarity index 80% rename from cc/test/test_compositor_frame_sink.h rename to cc/test/test_layer_tree_frame_sink.h index 7c27af4..569c039 100644 --- a/cc/test/test_compositor_frame_sink.h +++ b/cc/test/test_layer_tree_frame_sink.h
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CC_TEST_TEST_COMPOSITOR_FRAME_SINK_H_ -#define CC_TEST_TEST_COMPOSITOR_FRAME_SINK_H_ +#ifndef CC_TEST_TEST_LAYER_TREE_FRAME_SINK_H_ +#define CC_TEST_TEST_LAYER_TREE_FRAME_SINK_H_ #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" -#include "cc/output/compositor_frame_sink.h" +#include "cc/output/layer_tree_frame_sink.h" #include "cc/output/renderer_settings.h" #include "cc/scheduler/begin_frame_source.h" #include "cc/surfaces/compositor_frame_sink_support_client.h" @@ -25,9 +25,9 @@ class CopyOutputRequest; class OutputSurface; -class TestCompositorFrameSinkClient { +class TestLayerTreeFrameSinkClient { public: - virtual ~TestCompositorFrameSinkClient() {} + virtual ~TestLayerTreeFrameSinkClient() {} // This passes the ContextProvider being used by LayerTreeHostImpl which // can be used for the OutputSurface optionally. @@ -42,15 +42,15 @@ virtual void DisplayDidDrawAndSwap() = 0; }; -// CompositorFrameSink that owns and forwards frames to a Display. -class TestCompositorFrameSink : public CompositorFrameSink, - public CompositorFrameSinkSupportClient, - public DisplayClient, - public ExternalBeginFrameSourceClient { +// LayerTreeFrameSink that owns and forwards frames to a Display. +class TestLayerTreeFrameSink : public LayerTreeFrameSink, + public CompositorFrameSinkSupportClient, + public DisplayClient, + public ExternalBeginFrameSourceClient { public: // Pass true for |force_disable_reclaim_resources| to act like the Display // is out-of-process and can't return resources synchronously. - TestCompositorFrameSink( + TestLayerTreeFrameSink( scoped_refptr<ContextProvider> compositor_context_provider, scoped_refptr<ContextProvider> worker_context_provider, SharedBitmapManager* shared_bitmap_manager, @@ -60,10 +60,10 @@ bool synchronous_composite, bool disable_display_vsync, double refresh_rate); - ~TestCompositorFrameSink() override; + ~TestLayerTreeFrameSink() override; // This client must be set before BindToClient() happens. - void SetClient(TestCompositorFrameSinkClient* client) { + void SetClient(TestLayerTreeFrameSinkClient* client) { test_client_ = client; } void SetEnlargePassTextureAmount(const gfx::Size& s) { @@ -75,8 +75,8 @@ // Will be included with the next SubmitCompositorFrame. void RequestCopyOfOutput(std::unique_ptr<CopyOutputRequest> request); - // CompositorFrameSink implementation. - bool BindToClient(CompositorFrameSinkClient* client) override; + // LayerTreeFrameSink implementation. + bool BindToClient(LayerTreeFrameSinkClient* client) override; void DetachFromClient() override; void SetLocalSurfaceId(const LocalSurfaceId& local_surface_id) override; void SubmitCompositorFrame(CompositorFrame frame) override; @@ -111,7 +111,7 @@ FrameSinkId frame_sink_id_; // TODO(danakj): These don't need to be stored in unique_ptrs when - // CompositorFrameSink is owned/destroyed on the compositor thread. + // LayerTreeFrameSink is owned/destroyed on the compositor thread. std::unique_ptr<SurfaceManager> surface_manager_; std::unique_ptr<LocalSurfaceIdAllocator> local_surface_id_allocator_; LocalSurfaceId local_surface_id_; @@ -127,14 +127,14 @@ // Uses surface_manager_ and begin_frame_source_. std::unique_ptr<Display> display_; - TestCompositorFrameSinkClient* test_client_ = nullptr; + TestLayerTreeFrameSinkClient* test_client_ = nullptr; gfx::Size enlarge_pass_texture_amount_; std::vector<std::unique_ptr<CopyOutputRequest>> copy_requests_; - base::WeakPtrFactory<TestCompositorFrameSink> weak_ptr_factory_; + base::WeakPtrFactory<TestLayerTreeFrameSink> weak_ptr_factory_; }; } // namespace cc -#endif // CC_TEST_TEST_COMPOSITOR_FRAME_SINK_H_ +#endif // CC_TEST_TEST_LAYER_TREE_FRAME_SINK_H_
diff --git a/cc/test/test_layer_tree_host_base.cc b/cc/test/test_layer_tree_host_base.cc index fa79157..a252a59 100644 --- a/cc/test/test_layer_tree_host_base.cc +++ b/cc/test/test_layer_tree_host_base.cc
@@ -6,7 +6,7 @@ #include "base/memory/ptr_util.h" #include "base/threading/thread_task_runner_handle.h" -#include "cc/test/fake_compositor_frame_sink.h" +#include "cc/test/fake_layer_tree_frame_sink.h" #include "cc/test/fake_raster_source.h" #include "cc/trees/layer_tree_impl.h" @@ -23,7 +23,7 @@ TestLayerTreeHostBase::~TestLayerTreeHostBase() = default; void TestLayerTreeHostBase::SetUp() { - compositor_frame_sink_ = CreateCompositorFrameSink(); + layer_tree_frame_sink_ = CreateLayerTreeFrameSink(); task_graph_runner_ = CreateTaskGraphRunner(); host_impl_ = CreateHostImpl(CreateSettings(), &task_runner_provider_, task_graph_runner_.get()); @@ -36,9 +36,9 @@ return settings; } -std::unique_ptr<CompositorFrameSink> -TestLayerTreeHostBase::CreateCompositorFrameSink() { - return FakeCompositorFrameSink::Create3d(); +std::unique_ptr<LayerTreeFrameSink> +TestLayerTreeHostBase::CreateLayerTreeFrameSink() { + return FakeLayerTreeFrameSink::Create3d(); } std::unique_ptr<FakeLayerTreeHostImpl> TestLayerTreeHostBase::CreateHostImpl( @@ -56,15 +56,15 @@ void TestLayerTreeHostBase::InitializeRenderer() { host_impl_->SetVisible(true); - host_impl_->InitializeRenderer(compositor_frame_sink_.get()); + host_impl_->InitializeRenderer(layer_tree_frame_sink_.get()); } -void TestLayerTreeHostBase::ResetCompositorFrameSink( - std::unique_ptr<CompositorFrameSink> compositor_frame_sink) { - host_impl()->DidLoseCompositorFrameSink(); +void TestLayerTreeHostBase::ResetLayerTreeFrameSink( + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink) { + host_impl()->DidLoseLayerTreeFrameSink(); host_impl()->SetVisible(true); - host_impl()->InitializeRenderer(compositor_frame_sink.get()); - compositor_frame_sink_ = std::move(compositor_frame_sink); + host_impl()->InitializeRenderer(layer_tree_frame_sink.get()); + layer_tree_frame_sink_ = std::move(layer_tree_frame_sink); } std::unique_ptr<FakeLayerTreeHostImpl> TestLayerTreeHostBase::TakeHostImpl() {
diff --git a/cc/test/test_layer_tree_host_base.h b/cc/test/test_layer_tree_host_base.h index e05cf42..4bbd512 100644 --- a/cc/test/test_layer_tree_host_base.h +++ b/cc/test/test_layer_tree_host_base.h
@@ -7,7 +7,7 @@ #include <memory> -#include "cc/output/compositor_frame_sink.h" +#include "cc/output/layer_tree_frame_sink.h" #include "cc/test/fake_impl_task_runner_provider.h" #include "cc/test/fake_layer_tree_host_impl.h" #include "cc/test/fake_picture_layer_impl.h" @@ -26,7 +26,7 @@ void SetUp() override; virtual LayerTreeSettings CreateSettings(); - virtual std::unique_ptr<CompositorFrameSink> CreateCompositorFrameSink(); + virtual std::unique_ptr<LayerTreeFrameSink> CreateLayerTreeFrameSink(); virtual std::unique_ptr<FakeLayerTreeHostImpl> CreateHostImpl( const LayerTreeSettings& settings, TaskRunnerProvider* task_runner_provider, @@ -34,8 +34,8 @@ virtual std::unique_ptr<TaskGraphRunner> CreateTaskGraphRunner(); virtual void InitializeRenderer(); - void ResetCompositorFrameSink( - std::unique_ptr<CompositorFrameSink> compositor_frame_sink); + void ResetLayerTreeFrameSink( + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink); std::unique_ptr<FakeLayerTreeHostImpl> TakeHostImpl(); void SetupDefaultTrees(const gfx::Size& layer_bounds); @@ -53,8 +53,8 @@ TaskGraphRunner* task_graph_runner() const { return task_graph_runner_.get(); } - CompositorFrameSink* compositor_frame_sink() const { - return compositor_frame_sink_.get(); + LayerTreeFrameSink* layer_tree_frame_sink() const { + return layer_tree_frame_sink_.get(); } FakePictureLayerImpl* pending_layer() const { return pending_layer_; } FakePictureLayerImpl* active_layer() const { return active_layer_; } @@ -66,7 +66,7 @@ FakeImplTaskRunnerProvider task_runner_provider_; std::unique_ptr<TaskGraphRunner> task_graph_runner_; - std::unique_ptr<CompositorFrameSink> compositor_frame_sink_; + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink_; std::unique_ptr<FakeLayerTreeHostImpl> host_impl_; FakePictureLayerImpl* pending_layer_;
diff --git a/cc/tiles/tile_manager_perftest.cc b/cc/tiles/tile_manager_perftest.cc index c87e217..483f76dd 100644 --- a/cc/tiles/tile_manager_perftest.cc +++ b/cc/tiles/tile_manager_perftest.cc
@@ -13,9 +13,9 @@ #include "cc/base/lap_timer.h" #include "cc/raster/raster_buffer.h" #include "cc/test/begin_frame_args_test.h" -#include "cc/test/fake_compositor_frame_sink.h" -#include "cc/test/fake_compositor_frame_sink_client.h" #include "cc/test/fake_impl_task_runner_provider.h" +#include "cc/test/fake_layer_tree_frame_sink.h" +#include "cc/test/fake_layer_tree_frame_sink_client.h" #include "cc/test/fake_layer_tree_host_impl.h" #include "cc/test/fake_picture_layer_impl.h" #include "cc/test/fake_raster_source.h" @@ -48,7 +48,7 @@ void InitializeRenderer() override { host_impl()->SetVisible(true); - host_impl()->InitializeRenderer(compositor_frame_sink()); + host_impl()->InitializeRenderer(layer_tree_frame_sink()); tile_manager()->SetTileTaskManagerForTesting( base::MakeUnique<FakeTileTaskManagerImpl>()); }
diff --git a/cc/tiles/tile_manager_unittest.cc b/cc/tiles/tile_manager_unittest.cc index d36a7824..5e11640 100644 --- a/cc/tiles/tile_manager_unittest.cc +++ b/cc/tiles/tile_manager_unittest.cc
@@ -19,9 +19,9 @@ #include "cc/raster/synchronous_task_graph_runner.h" #include "cc/resources/resource_pool.h" #include "cc/test/begin_frame_args_test.h" -#include "cc/test/fake_compositor_frame_sink.h" -#include "cc/test/fake_compositor_frame_sink_client.h" #include "cc/test/fake_impl_task_runner_provider.h" +#include "cc/test/fake_layer_tree_frame_sink.h" +#include "cc/test/fake_layer_tree_frame_sink_client.h" #include "cc/test/fake_layer_tree_host_impl.h" #include "cc/test/fake_picture_layer_impl.h" #include "cc/test/fake_picture_layer_tiling_client.h" @@ -1550,8 +1550,8 @@ } // By default use software compositing (no context provider). - std::unique_ptr<CompositorFrameSink> CreateCompositorFrameSink() override { - return FakeCompositorFrameSink::CreateSoftware(); + std::unique_ptr<LayerTreeFrameSink> CreateLayerTreeFrameSink() override { + return FakeLayerTreeFrameSink::CreateSoftware(); } MockLayerTreeHostImpl& MockHostImpl() { @@ -1756,8 +1756,8 @@ return base::MakeUnique<SynchronousTaskGraphRunner>(); } - std::unique_ptr<CompositorFrameSink> CreateCompositorFrameSink() override { - return FakeCompositorFrameSink::Create3d(); + std::unique_ptr<LayerTreeFrameSink> CreateLayerTreeFrameSink() override { + return FakeLayerTreeFrameSink::Create3d(); } LayerTreeSettings CreateSettings() override {
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc index 57dec2e..763c62d 100644 --- a/cc/trees/layer_tree_host.cc +++ b/cc/trees/layer_tree_host.cc
@@ -404,43 +404,42 @@ } } -void LayerTreeHost::SetCompositorFrameSink( - std::unique_ptr<CompositorFrameSink> surface) { - TRACE_EVENT0("cc", "LayerTreeHostInProcess::SetCompositorFrameSink"); +void LayerTreeHost::SetLayerTreeFrameSink( + std::unique_ptr<LayerTreeFrameSink> surface) { + TRACE_EVENT0("cc", "LayerTreeHostInProcess::SetLayerTreeFrameSink"); DCHECK(surface); - DCHECK(!new_compositor_frame_sink_); - new_compositor_frame_sink_ = std::move(surface); - proxy_->SetCompositorFrameSink(new_compositor_frame_sink_.get()); + DCHECK(!new_layer_tree_frame_sink_); + new_layer_tree_frame_sink_ = std::move(surface); + proxy_->SetLayerTreeFrameSink(new_layer_tree_frame_sink_.get()); } -std::unique_ptr<CompositorFrameSink> -LayerTreeHost::ReleaseCompositorFrameSink() { +std::unique_ptr<LayerTreeFrameSink> LayerTreeHost::ReleaseLayerTreeFrameSink() { DCHECK(!visible_); - DidLoseCompositorFrameSink(); - proxy_->ReleaseCompositorFrameSink(); - return std::move(current_compositor_frame_sink_); + DidLoseLayerTreeFrameSink(); + proxy_->ReleaseLayerTreeFrameSink(); + return std::move(current_layer_tree_frame_sink_); } -void LayerTreeHost::RequestNewCompositorFrameSink() { - client_->RequestNewCompositorFrameSink(); +void LayerTreeHost::RequestNewLayerTreeFrameSink() { + client_->RequestNewLayerTreeFrameSink(); } -void LayerTreeHost::DidInitializeCompositorFrameSink() { - DCHECK(new_compositor_frame_sink_); - current_compositor_frame_sink_ = std::move(new_compositor_frame_sink_); - client_->DidInitializeCompositorFrameSink(); +void LayerTreeHost::DidInitializeLayerTreeFrameSink() { + DCHECK(new_layer_tree_frame_sink_); + current_layer_tree_frame_sink_ = std::move(new_layer_tree_frame_sink_); + client_->DidInitializeLayerTreeFrameSink(); } -void LayerTreeHost::DidFailToInitializeCompositorFrameSink() { - DCHECK(new_compositor_frame_sink_); +void LayerTreeHost::DidFailToInitializeLayerTreeFrameSink() { + DCHECK(new_layer_tree_frame_sink_); // Note: It is safe to drop all output surface references here as // LayerTreeHostImpl will not keep a pointer to either the old or - // new CompositorFrameSink after failing to initialize the new one. - current_compositor_frame_sink_ = nullptr; - new_compositor_frame_sink_ = nullptr; - client_->DidFailToInitializeCompositorFrameSink(); + // new LayerTreeFrameSink after failing to initialize the new one. + current_layer_tree_frame_sink_ = nullptr; + new_layer_tree_frame_sink_ = nullptr; + client_->DidFailToInitializeLayerTreeFrameSink(); } std::unique_ptr<LayerTreeHostImpl> @@ -464,8 +463,8 @@ return host_impl; } -void LayerTreeHost::DidLoseCompositorFrameSink() { - TRACE_EVENT0("cc", "LayerTreeHostInProcess::DidLoseCompositorFrameSink"); +void LayerTreeHost::DidLoseLayerTreeFrameSink() { + TRACE_EVENT0("cc", "LayerTreeHostInProcess::DidLoseLayerTreeFrameSink"); DCHECK(task_runner_provider_->IsMainThread()); SetNeedsCommit(); } @@ -643,9 +642,9 @@ return; bool gpu_rasterization_enabled = false; - if (host_impl->compositor_frame_sink()) { + if (host_impl->layer_tree_frame_sink()) { ContextProvider* compositor_context_provider = - host_impl->compositor_frame_sink()->context_provider(); + host_impl->layer_tree_frame_sink()->context_provider(); if (compositor_context_provider) { gpu_rasterization_enabled = compositor_context_provider->ContextCapabilities().gpu_rasterization;
diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h index f283e39f..7aa95ec9 100644 --- a/cc/trees/layer_tree_host.h +++ b/cc/trees/layer_tree_host.h
@@ -33,7 +33,7 @@ #include "cc/input/scrollbar.h" #include "cc/layers/layer_collections.h" #include "cc/layers/layer_list_iterator.h" -#include "cc/output/compositor_frame_sink.h" +#include "cc/output/layer_tree_frame_sink.h" #include "cc/output/swap_promise.h" #include "cc/resources/resource_format.h" #include "cc/surfaces/surface_reference_owner.h" @@ -131,23 +131,23 @@ // Sets whether the content is suitable to use Gpu Rasterization. void SetHasGpuRasterizationTrigger(bool has_trigger); - // Visibility and CompositorFrameSink ------------------------------- + // Visibility and LayerTreeFrameSink ------------------------------- void SetVisible(bool visible); bool IsVisible() const; - // Called in response to an CompositorFrameSink request made to the client - // using LayerTreeHostClient::RequestNewCompositorFrameSink. The client will - // be informed of the CompositorFrameSink initialization status using - // DidInitializaCompositorFrameSink or DidFailToInitializeCompositorFrameSink. + // Called in response to a LayerTreeFrameSink request made to the client + // using LayerTreeHostClient::RequestNewLayerTreeFrameSink. The client will + // be informed of the LayerTreeFrameSink initialization status using + // DidInitializaLayerTreeFrameSink or DidFailToInitializeLayerTreeFrameSink. // The request is completed when the host successfully initializes an - // CompositorFrameSink. - void SetCompositorFrameSink( - std::unique_ptr<CompositorFrameSink> compositor_frame_sink); + // LayerTreeFrameSink. + void SetLayerTreeFrameSink( + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink); // Forces the host to immediately release all references to the - // CompositorFrameSink, if any. Can be safely called any time. - std::unique_ptr<CompositorFrameSink> ReleaseCompositorFrameSink(); + // LayerTreeFrameSink, if any. Can be safely called any time. + std::unique_ptr<LayerTreeFrameSink> ReleaseLayerTreeFrameSink(); // Frame Scheduling (main and compositor frames) requests ------- @@ -416,12 +416,12 @@ void FinishCommitOnImplThread(LayerTreeHostImpl* host_impl); void WillCommit(); void CommitComplete(); - void RequestNewCompositorFrameSink(); - void DidInitializeCompositorFrameSink(); - void DidFailToInitializeCompositorFrameSink(); + void RequestNewLayerTreeFrameSink(); + void DidInitializeLayerTreeFrameSink(); + void DidFailToInitializeLayerTreeFrameSink(); virtual std::unique_ptr<LayerTreeHostImpl> CreateLayerTreeHostImpl( LayerTreeHostImplClient* client); - void DidLoseCompositorFrameSink(); + void DidLoseLayerTreeFrameSink(); void DidCommitAndDrawFrame() { client_->DidCommitAndDrawFrame(); } void DidReceiveCompositorFrameAck() { client_->DidReceiveCompositorFrameAck(); @@ -551,13 +551,13 @@ SwapPromiseManager swap_promise_manager_; - // |current_compositor_frame_sink_| can't be updated until we've successfully - // initialized a new CompositorFrameSink. |new_compositor_frame_sink_| - // contains the new CompositorFrameSink that is currently being initialized. - // If initialization is successful then |new_compositor_frame_sink_| replaces - // |current_compositor_frame_sink_|. - std::unique_ptr<CompositorFrameSink> new_compositor_frame_sink_; - std::unique_ptr<CompositorFrameSink> current_compositor_frame_sink_; + // |current_layer_tree_frame_sink_| can't be updated until we've successfully + // initialized a new LayerTreeFrameSink. |new_layer_tree_frame_sink_| + // contains the new LayerTreeFrameSink that is currently being initialized. + // If initialization is successful then |new_layer_tree_frame_sink_| replaces + // |current_layer_tree_frame_sink_|. + std::unique_ptr<LayerTreeFrameSink> new_layer_tree_frame_sink_; + std::unique_ptr<LayerTreeFrameSink> current_layer_tree_frame_sink_; const LayerTreeSettings settings_; LayerTreeDebugState debug_state_;
diff --git a/cc/trees/layer_tree_host_client.h b/cc/trees/layer_tree_host_client.h index f54a69b0..1b06e89 100644 --- a/cc/trees/layer_tree_host_client.h +++ b/cc/trees/layer_tree_host_client.h
@@ -15,7 +15,6 @@ } namespace cc { -class CompositorFrameSink; struct BeginFrameArgs; class LayerTreeHostClient { @@ -48,13 +47,13 @@ virtual void RecordWheelAndTouchScrollingCount( bool has_scrolled_by_wheel, bool has_scrolled_by_touch) = 0; - // Request an CompositorFrameSink from the client. When the client has one it - // should call LayerTreeHost::SetCompositorFrameSink. This will result in - // either DidFailToInitializeCompositorFrameSink or - // DidInitializeCompositorFrameSink being called. - virtual void RequestNewCompositorFrameSink() = 0; - virtual void DidInitializeCompositorFrameSink() = 0; - virtual void DidFailToInitializeCompositorFrameSink() = 0; + // Request a LayerTreeFrameSink from the client. When the client has one it + // should call LayerTreeHost::SetLayerTreeFrameSink. This will result in + // either DidFailToInitializeLayerTreeFrameSink or + // DidInitializeLayerTreeFrameSink being called. + virtual void RequestNewLayerTreeFrameSink() = 0; + virtual void DidInitializeLayerTreeFrameSink() = 0; + virtual void DidFailToInitializeLayerTreeFrameSink() = 0; virtual void WillCommit() = 0; virtual void DidCommit() = 0; virtual void DidCommitAndDrawFrame() = 0;
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc index f5b9502..1fe36ba 100644 --- a/cc/trees/layer_tree_host_common_unittest.cc +++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -29,9 +29,9 @@ #include "cc/output/copy_output_request.h" #include "cc/output/copy_output_result.h" #include "cc/test/animation_test_common.h" -#include "cc/test/fake_compositor_frame_sink.h" #include "cc/test/fake_content_layer_client.h" #include "cc/test/fake_impl_task_runner_provider.h" +#include "cc/test/fake_layer_tree_frame_sink.h" #include "cc/test/fake_layer_tree_host.h" #include "cc/test/fake_layer_tree_host_impl.h" #include "cc/test/fake_picture_layer.h" @@ -3020,8 +3020,8 @@ TEST_F(LayerTreeHostCommonTest, OcclusionBySiblingOfTarget) { FakeImplTaskRunnerProvider task_runner_provider; TestTaskGraphRunner task_graph_runner; - std::unique_ptr<CompositorFrameSink> compositor_frame_sink = - FakeCompositorFrameSink::Create3d(); + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink = + FakeLayerTreeFrameSink::Create3d(); FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); std::unique_ptr<LayerImpl> root = @@ -3071,7 +3071,7 @@ root->test_properties()->AddChild(std::move(child)); host_impl.active_tree()->SetRootLayerForTesting(std::move(root)); host_impl.SetVisible(true); - host_impl.InitializeRenderer(compositor_frame_sink.get()); + host_impl.InitializeRenderer(layer_tree_frame_sink.get()); host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); bool update_lcd_text = false; host_impl.active_tree()->UpdateDrawProperties(update_lcd_text); @@ -3095,8 +3095,8 @@ TEST_F(LayerTreeHostCommonTest, TextureLayerSnapping) { FakeImplTaskRunnerProvider task_runner_provider; TestTaskGraphRunner task_graph_runner; - std::unique_ptr<CompositorFrameSink> compositor_frame_sink = - FakeCompositorFrameSink::Create3d(); + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink = + FakeLayerTreeFrameSink::Create3d(); FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); std::unique_ptr<LayerImpl> root = @@ -3118,7 +3118,7 @@ root->test_properties()->AddChild(std::move(child)); host_impl.active_tree()->SetRootLayerForTesting(std::move(root)); host_impl.SetVisible(true); - host_impl.InitializeRenderer(compositor_frame_sink.get()); + host_impl.InitializeRenderer(layer_tree_frame_sink.get()); host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); bool update_lcd_text = false; host_impl.active_tree()->UpdateDrawProperties(update_lcd_text); @@ -3137,8 +3137,8 @@ OcclusionForLayerWithUninvertibleDrawTransform) { FakeImplTaskRunnerProvider task_runner_provider; TestTaskGraphRunner task_graph_runner; - std::unique_ptr<CompositorFrameSink> compositor_frame_sink = - FakeCompositorFrameSink::Create3d(); + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink = + FakeLayerTreeFrameSink::Create3d(); FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); std::unique_ptr<LayerImpl> root = @@ -3181,7 +3181,7 @@ root->test_properties()->AddChild(std::move(occluding_child)); host_impl.active_tree()->SetRootLayerForTesting(std::move(root)); host_impl.SetVisible(true); - host_impl.InitializeRenderer(compositor_frame_sink.get()); + host_impl.InitializeRenderer(layer_tree_frame_sink.get()); host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); bool update_lcd_text = false; host_impl.active_tree()->UpdateDrawProperties(update_lcd_text);
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 44c03b0..67f5b43ff 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc
@@ -48,8 +48,8 @@ #include "cc/layers/viewport.h" #include "cc/output/compositor_frame.h" #include "cc/output/compositor_frame_metadata.h" -#include "cc/output/compositor_frame_sink.h" #include "cc/output/copy_output_request.h" +#include "cc/output/layer_tree_frame_sink.h" #include "cc/quads/render_pass_draw_quad.h" #include "cc/quads/shared_quad_state.h" #include "cc/quads/solid_color_draw_quad.h" @@ -196,7 +196,7 @@ : client_(client), task_runner_provider_(task_runner_provider), current_begin_frame_tracker_(BEGINFRAMETRACKER_FROM_HERE), - compositor_frame_sink_(nullptr), + layer_tree_frame_sink_(nullptr), need_update_gpu_rasterization_status_(false), content_is_suitable_for_gpu_rasterization_(true), has_gpu_rasterization_trigger_(false), @@ -237,7 +237,7 @@ id_(id), requires_high_res_to_draw_(false), is_likely_to_require_a_draw_(false), - has_valid_compositor_frame_sink_(false), + has_valid_layer_tree_frame_sink_(false), mutator_(nullptr), scroll_animating_latched_node_id_(ScrollTree::kInvalidNodeId), has_scrolled_by_wheel_(false), @@ -277,7 +277,7 @@ "cc::LayerTreeHostImpl", id_); // It is released before shutdown. - DCHECK(!compositor_frame_sink_); + DCHECK(!layer_tree_frame_sink_); DCHECK(!resource_provider_); DCHECK(!resource_pool_); @@ -396,9 +396,9 @@ // client_->OnCanDrawStateChanged in the proper places and update the // NotifyIfCanDrawChanged test. - if (!compositor_frame_sink_) { + if (!layer_tree_frame_sink_) { TRACE_EVENT_INSTANT0("cc", - "LayerTreeHostImpl::CanDraw no CompositorFrameSink", + "LayerTreeHostImpl::CanDraw no LayerTreeFrameSink", TRACE_EVENT_SCOPE_THREAD); return false; } @@ -727,7 +727,7 @@ DrawMode LayerTreeHostImpl::GetDrawMode() const { if (resourceless_software_draw_) { return DRAW_MODE_RESOURCELESS_SOFTWARE; - } else if (compositor_frame_sink_->context_provider()) { + } else if (layer_tree_frame_sink_->context_provider()) { return DRAW_MODE_HARDWARE; } else { return DRAW_MODE_SOFTWARE; @@ -802,7 +802,7 @@ bool hud_wants_to_draw_ = active_tree_->hud_layer() && active_tree_->hud_layer()->IsAnimatingHUDContents(); bool must_always_swap = - compositor_frame_sink_->capabilities().must_always_swap; + layer_tree_frame_sink_->capabilities().must_always_swap; // When touch handle visibility changes there is no visible damage // because touch handles are composited in the browser. However we // still want the browser to be notified that the handles changed @@ -1035,7 +1035,7 @@ // would be animating checkerboards, because failing under those conditions // triggers a new main frame, which may cause the copy request layer to be // destroyed. - // TODO(weiliangc): Test copy request w/ CompositorFrameSink recreation. Would + // TODO(weiliangc): Test copy request w/ LayerTreeFrameSink recreation. Would // trigger this DCHECK. DCHECK(!have_copy_request || draw_result == DRAW_SUCCESS); @@ -1510,7 +1510,7 @@ if (pending_tree_) pending_tree_->set_needs_update_draw_properties(); - // Compositor, not CompositorFrameSink, is responsible for setting damage + // Compositor, not LayerTreeFrameSink, is responsible for setting damage // and triggering redraw for constraint changes. SetFullViewportDamage(); SetNeedsRedraw(); @@ -1582,7 +1582,7 @@ client_->OnCanDrawStateChanged(CanDraw()); } - client_->OnDrawForCompositorFrameSink(resourceless_software_draw_); + client_->OnDrawForLayerTreeFrameSink(resourceless_software_draw_); } if (resourceless_software_draw) { @@ -1671,7 +1671,7 @@ } fps_counter_->SaveTimeStamp(CurrentBeginFrameArgs().frame_time, - !compositor_frame_sink_->context_provider()); + !layer_tree_frame_sink_->context_provider()); rendering_stats_instrumentation_->IncrementFrameCount(1); memory_history_->SaveEntry(tile_manager_.memory_stats_from_last_assign()); @@ -1709,7 +1709,7 @@ TRACE_EVENT0("cc", "DrawLayers.UpdateHudTexture"); active_tree_->hud_layer()->UpdateHudTexture( draw_mode, resource_provider_.get(), - compositor_frame_sink_->context_provider()); + layer_tree_frame_sink_->context_provider()); } CompositorFrameMetadata metadata = MakeCompositorFrameMetadata(); @@ -1752,10 +1752,10 @@ // the LocalSurfaceId should hang off CompositorFrameMetadata. if (settings_.enable_surface_synchronization && active_tree()->local_surface_id().is_valid()) { - compositor_frame_sink_->SetLocalSurfaceId( + layer_tree_frame_sink_->SetLocalSurfaceId( active_tree()->local_surface_id()); } - compositor_frame_sink_->SubmitCompositorFrame(std::move(compositor_frame)); + layer_tree_frame_sink_->SubmitCompositorFrame(std::move(compositor_frame)); // Clears the list of swap promises after calling DidSwap on each of them to // signal that the swap is over. @@ -1814,12 +1814,12 @@ } bool LayerTreeHostImpl::CanUseGpuRasterization() { - if (!(compositor_frame_sink_ && compositor_frame_sink_->context_provider() && - compositor_frame_sink_->worker_context_provider())) + if (!(layer_tree_frame_sink_ && layer_tree_frame_sink_->context_provider() && + layer_tree_frame_sink_->worker_context_provider())) return false; ContextProvider* context_provider = - compositor_frame_sink_->worker_context_provider(); + layer_tree_frame_sink_->worker_context_provider(); ContextProvider::ScopedContextLock scoped_context(context_provider); if (!context_provider->GrContext()) return false; @@ -1829,16 +1829,16 @@ bool LayerTreeHostImpl::UpdateGpuRasterizationStatus() { // TODO(danakj): Can we avoid having this run when there's no - // CompositorFrameSink? + // LayerTreeFrameSink? // For now just early out and leave things unchanged, we'll come back here - // when we get an CompositorFrameSink. - if (!compositor_frame_sink_) + // when we get a LayerTreeFrameSink. + if (!layer_tree_frame_sink_) return false; int requested_msaa_samples = RequestedMSAASampleCount(); int max_msaa_samples = 0; ContextProvider* compositor_context_provider = - compositor_frame_sink_->context_provider(); + layer_tree_frame_sink_->context_provider(); bool gpu_rasterization_enabled = false; if (compositor_context_provider) { const auto& caps = compositor_context_provider->ContextCapabilities(); @@ -1945,8 +1945,8 @@ } void LayerTreeHostImpl::DidNotProduceFrame(const BeginFrameAck& ack) { - if (compositor_frame_sink_) - compositor_frame_sink_->DidNotProduceFrame(ack); + if (layer_tree_frame_sink_) + layer_tree_frame_sink_->DidNotProduceFrame(ack); } void LayerTreeHostImpl::UpdateViewportContainerSizes() { @@ -1999,11 +1999,11 @@ single_thread_synchronous_task_graph_runner_->RunUntilIdle(); } -void LayerTreeHostImpl::DidLoseCompositorFrameSink() { +void LayerTreeHostImpl::DidLoseLayerTreeFrameSink() { if (resource_provider_) resource_provider_->DidLoseContextProvider(); - has_valid_compositor_frame_sink_ = false; - client_->DidLoseCompositorFrameSinkOnImplThread(); + has_valid_layer_tree_frame_sink_ = false; + client_->DidLoseLayerTreeFrameSinkOnImplThread(); } bool LayerTreeHostImpl::HaveRootScrollLayer() const { @@ -2268,7 +2268,7 @@ if (use_gpu_rasterization_) { image_decode_cache_ = base::MakeUnique<GpuImageDecodeCache>( - compositor_frame_sink_->worker_context_provider(), + layer_tree_frame_sink_->worker_context_provider(), settings_.preferred_tile_format, settings_.decoded_image_working_set_budget_bytes, settings_.decoded_image_cache_budget_bytes); @@ -2307,7 +2307,7 @@ CHECK(resource_provider_); ContextProvider* compositor_context_provider = - compositor_frame_sink_->context_provider(); + layer_tree_frame_sink_->context_provider(); if (!compositor_context_provider) { *resource_pool = ResourcePool::Create(resource_provider_.get(), GetTaskRunner(), @@ -2321,7 +2321,7 @@ } ContextProvider* worker_context_provider = - compositor_frame_sink_->worker_context_provider(); + layer_tree_frame_sink_->worker_context_provider(); if (use_gpu_rasterization_) { DCHECK(worker_context_provider); @@ -2443,26 +2443,26 @@ // We've potentially just freed a large number of resources on our various // contexts. Flushing now helps ensure these are cleaned up quickly // preventing driver cache growth. See crbug.com/643251 - if (compositor_frame_sink_) { - if (auto* compositor_context = compositor_frame_sink_->context_provider()) + if (layer_tree_frame_sink_) { + if (auto* compositor_context = layer_tree_frame_sink_->context_provider()) compositor_context->ContextGL()->ShallowFlushCHROMIUM(); if (auto* worker_context = - compositor_frame_sink_->worker_context_provider()) { + layer_tree_frame_sink_->worker_context_provider()) { ContextProvider::ScopedContextLock hold(worker_context); worker_context->ContextGL()->ShallowFlushCHROMIUM(); } } } -void LayerTreeHostImpl::ReleaseCompositorFrameSink() { - TRACE_EVENT0("cc", "LayerTreeHostImpl::ReleaseCompositorFrameSink"); +void LayerTreeHostImpl::ReleaseLayerTreeFrameSink() { + TRACE_EVENT0("cc", "LayerTreeHostImpl::ReleaseLayerTreeFrameSink"); - if (!compositor_frame_sink_) { - DCHECK(!has_valid_compositor_frame_sink_); + if (!layer_tree_frame_sink_) { + DCHECK(!has_valid_layer_tree_frame_sink_); return; } - has_valid_compositor_frame_sink_ = false; + has_valid_layer_tree_frame_sink_ = false; // Since we will create a new resource provider, we cannot continue to use // the old resources (i.e. render_surfaces and texture IDs). Clear them @@ -2473,27 +2473,27 @@ CleanUpTileManagerAndUIResources(); resource_provider_ = nullptr; - // Release any context visibility before we destroy the CompositorFrameSink. + // Release any context visibility before we destroy the LayerTreeFrameSink. SetContextVisibility(false); - // Detach from the old CompositorFrameSink and reset |compositor_frame_sink_| + // Detach from the old LayerTreeFrameSink and reset |layer_tree_frame_sink_| // pointer as this surface is going to be destroyed independent of if binding - // the new CompositorFrameSink succeeds or not. - compositor_frame_sink_->DetachFromClient(); - compositor_frame_sink_ = nullptr; + // the new LayerTreeFrameSink succeeds or not. + layer_tree_frame_sink_->DetachFromClient(); + layer_tree_frame_sink_ = nullptr; - // We don't know if the next CompositorFrameSink will support GPU + // We don't know if the next LayerTreeFrameSink will support GPU // rasterization. Make sure to clear the flag so that we force a // re-computation. use_gpu_rasterization_ = false; } bool LayerTreeHostImpl::InitializeRenderer( - CompositorFrameSink* compositor_frame_sink) { + LayerTreeFrameSink* layer_tree_frame_sink) { TRACE_EVENT0("cc", "LayerTreeHostImpl::InitializeRenderer"); - ReleaseCompositorFrameSink(); - if (!compositor_frame_sink->BindToClient(this)) { + ReleaseLayerTreeFrameSink(); + if (!layer_tree_frame_sink->BindToClient(this)) { // Avoid recreating tree resources because we might not have enough // information to do this yet (eg. we don't have a TileManager at this // point). @@ -2503,17 +2503,17 @@ // When using software compositing, change to the limits specified for it. // Since this is a one way trip, we don't need to worry about going back to // GPU compositing. - if (!compositor_frame_sink->context_provider()) + if (!layer_tree_frame_sink->context_provider()) SetMemoryPolicy(settings_.software_memory_policy); - compositor_frame_sink_ = compositor_frame_sink; - has_valid_compositor_frame_sink_ = true; + layer_tree_frame_sink_ = layer_tree_frame_sink; + has_valid_layer_tree_frame_sink_ = true; resource_provider_ = base::MakeUnique<ResourceProvider>( - compositor_frame_sink_->context_provider(), - compositor_frame_sink_->shared_bitmap_manager(), - compositor_frame_sink_->gpu_memory_buffer_manager(), + layer_tree_frame_sink_->context_provider(), + layer_tree_frame_sink_->shared_bitmap_manager(), + layer_tree_frame_sink_->gpu_memory_buffer_manager(), task_runner_provider_->blocking_main_thread_task_runner(), - compositor_frame_sink_->capabilities().delegated_sync_points_required, + layer_tree_frame_sink_->capabilities().delegated_sync_points_required, settings_.enable_color_correct_rasterization, settings_.resource_settings); @@ -2522,7 +2522,7 @@ // already. UpdateGpuRasterizationStatus(); - // See note in LayerTreeImpl::UpdateDrawProperties, new CompositorFrameSink + // See note in LayerTreeImpl::UpdateDrawProperties, new LayerTreeFrameSink // means a new max texture size which affects draw properties. Also, if the // draw properties were up to date, layers still lost resources and we need to // UpdateDrawProperties() after calling RecreateTreeResources(). @@ -3937,7 +3937,7 @@ if (id) DeleteUIResource(uid); - if (!has_valid_compositor_frame_sink_) { + if (!has_valid_layer_tree_frame_sink_) { evicted_ui_resources_.insert(uid); return; } @@ -4023,7 +4023,7 @@ void LayerTreeHostImpl::DeleteUIResource(UIResourceId uid) { ResourceId id = ResourceIdForUIResource(uid); if (id) { - if (has_valid_compositor_frame_sink_) + if (has_valid_layer_tree_frame_sink_) resource_provider_->DeleteResource(id); ui_resource_map_.erase(uid); } @@ -4272,13 +4272,13 @@ } void LayerTreeHostImpl::SetContextVisibility(bool is_visible) { - if (!compositor_frame_sink_) + if (!layer_tree_frame_sink_) return; // Update the compositor context. If we are already in the correct visibility // state, skip. This can happen if we transition invisible/visible rapidly, // before we get a chance to go invisible in NotifyAllTileTasksComplete. - auto* compositor_context = compositor_frame_sink_->context_provider(); + auto* compositor_context = layer_tree_frame_sink_->context_provider(); if (compositor_context && is_visible != !!compositor_context_visibility_) { if (is_visible) { compositor_context_visibility_ = @@ -4292,7 +4292,7 @@ // Update the worker context. If we are already in the correct visibility // state, skip. This can happen if we transition invisible/visible rapidly, // before we get a chance to go invisible in NotifyAllTileTasksComplete. - auto* worker_context = compositor_frame_sink_->worker_context_provider(); + auto* worker_context = layer_tree_frame_sink_->worker_context_provider(); if (worker_context && is_visible != !!worker_context_visibility_) { ContextProvider::ScopedContextLock hold(worker_context); if (is_visible) {
diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h index 07405dc54..611f24b 100644 --- a/cc/trees/layer_tree_host_impl.h +++ b/cc/trees/layer_tree_host_impl.h
@@ -26,8 +26,8 @@ #include "cc/input/scrollbar_animation_controller.h" #include "cc/layers/layer_collections.h" #include "cc/output/begin_frame_args.h" -#include "cc/output/compositor_frame_sink_client.h" #include "cc/output/context_cache_controller.h" +#include "cc/output/layer_tree_frame_sink_client.h" #include "cc/output/managed_memory_policy.h" #include "cc/quads/render_pass.h" #include "cc/resources/resource_provider.h" @@ -55,7 +55,7 @@ class BrowserControlsOffsetManager; class CompositorFrameMetadata; -class CompositorFrameSink; +class LayerTreeFrameSink; class DebugRectHistory; class EvictionTilePriorityQueue; class FrameRateCounter; @@ -97,7 +97,7 @@ // LayerTreeHost->Proxy callback interface. class LayerTreeHostImplClient { public: - virtual void DidLoseCompositorFrameSinkOnImplThread() = 0; + virtual void DidLoseLayerTreeFrameSinkOnImplThread() = 0; virtual void SetBeginFrameSource(BeginFrameSource* source) = 0; virtual void DidReceiveCompositorFrameAckOnImplThread() = 0; virtual void OnCanDrawStateChanged(bool can_draw) = 0; @@ -124,8 +124,7 @@ virtual void DidCompletePageScaleAnimationOnImplThread() = 0; // Called when output surface asks for a draw. - virtual void OnDrawForCompositorFrameSink( - bool resourceless_software_draw) = 0; + virtual void OnDrawForLayerTreeFrameSink(bool resourceless_software_draw) = 0; virtual void NeedsImplSideInvalidation() = 0; // Called when a requested image decode completes. @@ -142,7 +141,7 @@ class CC_EXPORT LayerTreeHostImpl : public InputHandler, public TileManagerClient, - public CompositorFrameSinkClient, + public LayerTreeFrameSinkClient, public BrowserControlsOffsetManagerClient, public ScrollbarAnimationControllerClient, public VideoFrameControllerClient, @@ -366,12 +365,12 @@ void AddVideoFrameController(VideoFrameController* controller) override; void RemoveVideoFrameController(VideoFrameController* controller) override; - // CompositorFrameSinkClient implementation. + // LayerTreeFrameSinkClient implementation. void SetBeginFrameSource(BeginFrameSource* source) override; void SetExternalTilePriorityConstraints( const gfx::Rect& viewport_rect, const gfx::Transform& transform) override; - void DidLoseCompositorFrameSink() override; + void DidLoseLayerTreeFrameSink() override; void DidReceiveCompositorFrameAck() override; void ReclaimResources(const ReturnedResourceArray& resources) override; void SetMemoryPolicy(const ManagedMemoryPolicy& policy) override; @@ -389,17 +388,17 @@ // Implementation. int id() const { return id_; } bool CanDraw() const; - CompositorFrameSink* compositor_frame_sink() const { - return compositor_frame_sink_; + LayerTreeFrameSink* layer_tree_frame_sink() const { + return layer_tree_frame_sink_; } - void ReleaseCompositorFrameSink(); + void ReleaseLayerTreeFrameSink(); std::string LayerTreeAsJson() const; int RequestedMSAASampleCount() const; // TODO(danakj): Rename this, there is no renderer. - virtual bool InitializeRenderer(CompositorFrameSink* compositor_frame_sink); + virtual bool InitializeRenderer(LayerTreeFrameSink* layer_tree_frame_sink); TileManager* tile_manager() { return &tile_manager_; } void SetHasGpuRasterizationTrigger(bool flag); @@ -727,12 +726,12 @@ // request queue. std::set<UIResourceId> evicted_ui_resources_; - CompositorFrameSink* compositor_frame_sink_; + LayerTreeFrameSink* layer_tree_frame_sink_; LocalSurfaceId local_surface_id_; // The following scoped variables must not outlive the - // |compositor_frame_sink_|. + // |layer_tree_frame_sink_|. // These should be transfered to ContextCacheController's // ClientBecameNotVisible() before the output surface is destroyed. std::unique_ptr<ContextCacheController::ScopedVisibility> @@ -813,7 +812,7 @@ // overridden. gfx::Size device_viewport_size_; - // Optional top-level constraints that can be set by the CompositorFrameSink. + // Optional top-level constraints that can be set by the LayerTreeFrameSink. // - external_transform_ applies a transform above the root layer // - external_viewport_ is used DrawProperties, tile management and // glViewport/window projection matrix. @@ -852,9 +851,9 @@ bool requires_high_res_to_draw_; bool is_likely_to_require_a_draw_; - // TODO(danakj): Delete the compositor frame sink and all resources when + // TODO(danakj): Delete the LayerTreeFrameSink and all resources when // it's lost instead of having this bool. - bool has_valid_compositor_frame_sink_; + bool has_valid_layer_tree_frame_sink_; std::unique_ptr<Viewport> viewport_;
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc index 28c61eb6..5137129 100644 --- a/cc/trees/layer_tree_host_impl_unittest.cc +++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -49,7 +49,7 @@ #include "cc/resources/ui_resource_manager.h" #include "cc/test/animation_test_common.h" #include "cc/test/begin_frame_args_test.h" -#include "cc/test/fake_compositor_frame_sink.h" +#include "cc/test/fake_layer_tree_frame_sink.h" #include "cc/test/fake_layer_tree_host_impl.h" #include "cc/test/fake_mask_layer_impl.h" #include "cc/test/fake_output_surface.h" @@ -61,7 +61,7 @@ #include "cc/test/layer_test_common.h" #include "cc/test/layer_tree_test.h" #include "cc/test/skia_common.h" -#include "cc/test/test_compositor_frame_sink.h" +#include "cc/test/test_layer_tree_frame_sink.h" #include "cc/test/test_task_graph_runner.h" #include "cc/test/test_web_graphics_context_3d.h" #include "cc/trees/effect_node.h" @@ -137,15 +137,15 @@ } void SetUp() override { - CreateHostImpl(DefaultSettings(), CreateCompositorFrameSink()); + CreateHostImpl(DefaultSettings(), CreateLayerTreeFrameSink()); } void TearDown() override { if (host_impl_) - host_impl_->ReleaseCompositorFrameSink(); + host_impl_->ReleaseLayerTreeFrameSink(); } - void DidLoseCompositorFrameSinkOnImplThread() override {} + void DidLoseLayerTreeFrameSinkOnImplThread() override {} void SetBeginFrameSource(BeginFrameSource* source) override {} void DidReceiveCompositorFrameAckOnImplThread() override {} void OnCanDrawStateChanged(bool can_draw) override { @@ -180,7 +180,7 @@ void DidCompletePageScaleAnimationOnImplThread() override { did_complete_page_scale_animation_ = true; } - void OnDrawForCompositorFrameSink(bool resourceless_software_draw) override { + void OnDrawForLayerTreeFrameSink(bool resourceless_software_draw) override { std::unique_ptr<TestFrameData> frame(new TestFrameData); EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(frame.get())); last_on_draw_render_passes_.clear(); @@ -201,9 +201,9 @@ virtual bool CreateHostImpl( const LayerTreeSettings& settings, - std::unique_ptr<CompositorFrameSink> compositor_frame_sink) { + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink) { return CreateHostImplWithTaskRunnerProvider( - settings, std::move(compositor_frame_sink), &task_runner_provider_); + settings, std::move(layer_tree_frame_sink), &task_runner_provider_); } AnimationHost* GetImplAnimationHost() const { @@ -212,10 +212,10 @@ virtual bool CreateHostImplWithTaskRunnerProvider( const LayerTreeSettings& settings, - std::unique_ptr<CompositorFrameSink> compositor_frame_sink, + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink, TaskRunnerProvider* task_runner_provider) { if (host_impl_) - host_impl_->ReleaseCompositorFrameSink(); + host_impl_->ReleaseLayerTreeFrameSink(); host_impl_.reset(); InitializeImageWorker(settings); host_impl_ = LayerTreeHostImpl::Create( @@ -223,9 +223,9 @@ &task_graph_runner_, AnimationHost::CreateForTesting(ThreadInstance::IMPL), 0, image_worker_ ? image_worker_->task_runner() : nullptr); - compositor_frame_sink_ = std::move(compositor_frame_sink); + layer_tree_frame_sink_ = std::move(layer_tree_frame_sink); host_impl_->SetVisible(true); - bool init = host_impl_->InitializeRenderer(compositor_frame_sink_.get()); + bool init = host_impl_->InitializeRenderer(layer_tree_frame_sink_.get()); host_impl_->SetViewportSize(gfx::Size(10, 10)); host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 1.f); // Set the BeginFrameArgs so that methods which use it are able to. @@ -581,8 +581,8 @@ scoped_refptr<AnimationTimeline> timeline() { return timeline_; } protected: - virtual std::unique_ptr<CompositorFrameSink> CreateCompositorFrameSink() { - return FakeCompositorFrameSink::Create3dForGpuRasterization(); + virtual std::unique_ptr<LayerTreeFrameSink> CreateLayerTreeFrameSink() { + return FakeLayerTreeFrameSink::Create3dForGpuRasterization(); } void DrawOneFrame() { @@ -623,7 +623,7 @@ DebugScopedSetMainThreadBlocked always_main_thread_blocked_; TestTaskGraphRunner task_graph_runner_; - std::unique_ptr<CompositorFrameSink> compositor_frame_sink_; + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink_; std::unique_ptr<LayerTreeHostImpl> host_impl_; FakeRenderingStatsInstrumentation stats_instrumentation_; bool on_can_draw_state_changed_called_; @@ -647,7 +647,7 @@ class LayerTreeHostImplTimelinesTest : public LayerTreeHostImplTest { public: void SetUp() override { - CreateHostImpl(DefaultSettings(), CreateCompositorFrameSink()); + CreateHostImpl(DefaultSettings(), CreateLayerTreeFrameSink()); } }; @@ -741,7 +741,7 @@ } TEST_F(LayerTreeHostImplTest, ResourcelessDrawWithEmptyViewport) { - CreateHostImpl(DefaultSettings(), FakeCompositorFrameSink::CreateSoftware()); + CreateHostImpl(DefaultSettings(), FakeLayerTreeFrameSink::CreateSoftware()); SetupScrollAndContentsLayers(gfx::Size(100, 100)); host_impl_->active_tree()->BuildPropertyTreesForTesting(); @@ -749,18 +749,17 @@ host_impl_->SetViewportSize(gfx::Size()); EXPECT_FALSE(host_impl_->CanDraw()); - FakeCompositorFrameSink* fake_compositor_frame_sink = - static_cast<FakeCompositorFrameSink*>( - host_impl_->compositor_frame_sink()); - EXPECT_EQ(fake_compositor_frame_sink->num_sent_frames(), 0u); + auto* fake_layer_tree_frame_sink = + static_cast<FakeLayerTreeFrameSink*>(host_impl_->layer_tree_frame_sink()); + EXPECT_EQ(fake_layer_tree_frame_sink->num_sent_frames(), 0u); gfx::Transform identity; gfx::Rect viewport(100, 100); const bool resourceless_software_draw = true; host_impl_->OnDraw(identity, viewport, resourceless_software_draw); - ASSERT_EQ(fake_compositor_frame_sink->num_sent_frames(), 1u); + ASSERT_EQ(fake_layer_tree_frame_sink->num_sent_frames(), 1u); EXPECT_EQ( gfx::SizeF(100.f, 100.f), - fake_compositor_frame_sink->last_sent_frame()->metadata.root_layer_size); + fake_layer_tree_frame_sink->last_sent_frame()->metadata.root_layer_size); } TEST_F(LayerTreeHostImplTest, ScrollDeltaNoLayers) { @@ -970,7 +969,7 @@ // Initialization will fail. EXPECT_FALSE(CreateHostImpl( DefaultSettings(), - FakeCompositorFrameSink::Create3d(std::move(context_owned)))); + FakeLayerTreeFrameSink::Create3d(std::move(context_owned)))); SetupScrollAndContentsLayers(gfx::Size(100, 100)); @@ -1634,7 +1633,7 @@ TEST_F(LayerTreeHostImplTest, AnimationSchedulingCommitToActiveTree) { FakeImplTaskRunnerProvider provider(nullptr); CreateHostImplWithTaskRunnerProvider(DefaultSettings(), - CreateCompositorFrameSink(), &provider); + CreateLayerTreeFrameSink(), &provider); EXPECT_TRUE(host_impl_->CommitToActiveTree()); host_impl_->SetViewportSize(gfx::Size(50, 50)); @@ -1676,7 +1675,7 @@ EXPECT_FALSE(did_request_commit_); // Delete the LayerTreeHostImpl before the TaskRunnerProvider goes away. - host_impl_->ReleaseCompositorFrameSink(); + host_impl_->ReleaseLayerTreeFrameSink(); host_impl_ = nullptr; } @@ -1833,7 +1832,7 @@ TEST_F(LayerTreeHostImplTest, ViewportScrollOrder) { LayerTreeSettings settings = DefaultSettings(); - CreateHostImpl(settings, CreateCompositorFrameSink()); + CreateHostImpl(settings, CreateLayerTreeFrameSink()); host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 0.25f, 4.f); const gfx::Size content_size(1000, 1000); @@ -1892,7 +1891,7 @@ // dropped. crbug.com/539334. TEST_F(LayerTreeHostImplTest, ScrollViewportWithFractionalAmounts) { LayerTreeSettings settings = DefaultSettings(); - CreateHostImpl(settings, CreateCompositorFrameSink()); + CreateHostImpl(settings, CreateLayerTreeFrameSink()); host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 2.f); const gfx::Size content_size(1000, 1000); @@ -1941,7 +1940,7 @@ // to the outer viewport. TEST_F(LayerTreeHostImplTest, ScrollDuringPinchGesture) { LayerTreeSettings settings = DefaultSettings(); - CreateHostImpl(settings, CreateCompositorFrameSink()); + CreateHostImpl(settings, CreateLayerTreeFrameSink()); host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 2.f); const gfx::Size content_size(1000, 1000); @@ -1995,7 +1994,7 @@ // should assume the user means to scroll into the edge of the screen. TEST_F(LayerTreeHostImplTest, PinchZoomSnapsToScreenEdge) { LayerTreeSettings settings = DefaultSettings(); - CreateHostImpl(settings, CreateCompositorFrameSink()); + CreateHostImpl(settings, CreateLayerTreeFrameSink()); host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 2.f); const gfx::Size content_size(1000, 1000); @@ -2843,7 +2842,7 @@ class LayerTreeHostImplTestScrollbarAnimation : public LayerTreeHostImplTest { protected: void SetupLayers(LayerTreeSettings settings) { - host_impl_->ReleaseCompositorFrameSink(); + host_impl_->ReleaseLayerTreeFrameSink(); host_impl_ = nullptr; gfx::Size content_size(100, 100); @@ -2853,9 +2852,9 @@ settings, this, &task_runner_provider_, &task_graph_runner_, &stats_instrumentation_); host_impl_ = base::WrapUnique(host_impl_override_time); - compositor_frame_sink_ = CreateCompositorFrameSink(); + layer_tree_frame_sink_ = CreateLayerTreeFrameSink(); host_impl_->SetVisible(true); - host_impl_->InitializeRenderer(compositor_frame_sink_.get()); + host_impl_->InitializeRenderer(layer_tree_frame_sink_.get()); SetupScrollAndContentsLayers(content_size); host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 4.f); @@ -3065,7 +3064,7 @@ // If no animator is set, scrollbar won't show and no animation is expected. bool expecting_animations = animator != LayerTreeSettings::NO_ANIMATOR; - CreateHostImpl(settings, CreateCompositorFrameSink()); + CreateHostImpl(settings, CreateLayerTreeFrameSink()); host_impl_->CreatePendingTree(); CreateScrollAndContentsLayers(host_impl_->pending_tree(), content_size); std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar = @@ -3158,7 +3157,7 @@ settings.scrollbar_fade_duration = base::TimeDelta::FromMilliseconds(20); gfx::Size content_size(100, 100); - CreateHostImpl(settings, CreateCompositorFrameSink()); + CreateHostImpl(settings, CreateLayerTreeFrameSink()); host_impl_->CreatePendingTree(); CreateScrollAndContentsLayers(host_impl_->pending_tree(), content_size); std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar = @@ -3225,7 +3224,7 @@ TEST_F(LayerTreeHostImplTest, ScrollbarInnerLargerThanOuter) { LayerTreeSettings settings = DefaultSettings(); - CreateHostImpl(settings, CreateCompositorFrameSink()); + CreateHostImpl(settings, CreateLayerTreeFrameSink()); gfx::Size inner_viewport_size(315, 200); gfx::Size outer_viewport_size(300, 200); @@ -3265,7 +3264,7 @@ settings.scrollbar_animator = LayerTreeSettings::ANDROID_OVERLAY; settings.scrollbar_fade_delay = base::TimeDelta::FromMilliseconds(20); settings.scrollbar_fade_duration = base::TimeDelta::FromMilliseconds(20); - CreateHostImpl(settings, CreateCompositorFrameSink()); + CreateHostImpl(settings, CreateLayerTreeFrameSink()); gfx::Size viewport_size(300, 200); gfx::Size content_size(1000, 1000); @@ -3286,27 +3285,23 @@ container->test_properties()->AddChild(SolidColorScrollbarLayerImpl::Create( host_impl_->active_tree(), vert_1_id, VERTICAL, 5, 5, true, true)); - SolidColorScrollbarLayerImpl* vert_1_scrollbar = - static_cast<SolidColorScrollbarLayerImpl*>( - container->test_properties()->children[1]); + auto* vert_1_scrollbar = static_cast<SolidColorScrollbarLayerImpl*>( + container->test_properties()->children[1]); container->test_properties()->AddChild(SolidColorScrollbarLayerImpl::Create( host_impl_->active_tree(), horiz_1_id, HORIZONTAL, 5, 5, true, true)); - SolidColorScrollbarLayerImpl* horiz_1_scrollbar = - static_cast<SolidColorScrollbarLayerImpl*>( - container->test_properties()->children[2]); + auto* horiz_1_scrollbar = static_cast<SolidColorScrollbarLayerImpl*>( + container->test_properties()->children[2]); container->test_properties()->AddChild(SolidColorScrollbarLayerImpl::Create( host_impl_->active_tree(), vert_2_id, VERTICAL, 5, 5, true, true)); - SolidColorScrollbarLayerImpl* vert_2_scrollbar = - static_cast<SolidColorScrollbarLayerImpl*>( - container->test_properties()->children[3]); + auto* vert_2_scrollbar = static_cast<SolidColorScrollbarLayerImpl*>( + container->test_properties()->children[3]); container->test_properties()->AddChild(SolidColorScrollbarLayerImpl::Create( host_impl_->active_tree(), horiz_2_id, HORIZONTAL, 5, 5, true, true)); - SolidColorScrollbarLayerImpl* horiz_2_scrollbar = - static_cast<SolidColorScrollbarLayerImpl*>( - container->test_properties()->children[4]); + auto* horiz_2_scrollbar = static_cast<SolidColorScrollbarLayerImpl*>( + container->test_properties()->children[4]); std::unique_ptr<LayerImpl> child = LayerImpl::Create(host_impl_->active_tree(), child_scroll_id); @@ -3401,7 +3396,7 @@ settings.scrollbar_animator = LayerTreeSettings::AURA_OVERLAY; settings.scrollbar_fade_delay = base::TimeDelta::FromMilliseconds(20); settings.scrollbar_fade_duration = base::TimeDelta::FromMilliseconds(20); - CreateHostImpl(settings, CreateCompositorFrameSink()); + CreateHostImpl(settings, CreateLayerTreeFrameSink()); gfx::Size viewport_size(300, 200); gfx::Size content_size(1000, 1000); @@ -3413,9 +3408,8 @@ container->test_properties()->AddChild(SolidColorScrollbarLayerImpl::Create( host_impl_->active_tree(), 10, VERTICAL, 5, 0, false, true)); - SolidColorScrollbarLayerImpl* vert_scrollbar = - static_cast<SolidColorScrollbarLayerImpl*>( - container->test_properties()->children[1]); + auto* vert_scrollbar = static_cast<SolidColorScrollbarLayerImpl*>( + container->test_properties()->children[1]); vert_scrollbar->SetScrollElementId(root_scroll->element_id()); vert_scrollbar->SetBounds(gfx::Size(10, 200)); @@ -3476,7 +3470,7 @@ gfx::Size content_size(1000, 1000); gfx::Size scrollbar_size(gfx::Size(15, viewport_size.height())); - CreateHostImpl(settings, CreateCompositorFrameSink()); + CreateHostImpl(settings, CreateLayerTreeFrameSink()); host_impl_->active_tree()->SetDeviceScaleFactor(device_scale_factor); host_impl_->SetViewportSize(device_viewport_size); @@ -3596,11 +3590,10 @@ host_impl_->active_tree()->SetSurfaceLayerIds(fallback_surfaces_set); DrawFrame(); - FakeCompositorFrameSink* fake_compositor_frame_sink = - static_cast<FakeCompositorFrameSink*>( - host_impl_->compositor_frame_sink()); + auto* fake_layer_tree_frame_sink = + static_cast<FakeLayerTreeFrameSink*>(host_impl_->layer_tree_frame_sink()); const CompositorFrameMetadata& metadata = - fake_compositor_frame_sink->last_sent_frame()->metadata; + fake_layer_tree_frame_sink->last_sent_frame()->metadata; EXPECT_THAT( metadata.activation_dependencies, testing::UnorderedElementsAre(primary_surfaces[0], primary_surfaces[1])); @@ -3811,13 +3804,13 @@ // will be masked out by the root layer's bounds. host_impl_->active_tree()->SetRootLayerForTesting( DidDrawCheckLayer::Create(host_impl_->active_tree(), 1)); - DidDrawCheckLayer* root = + auto* root = static_cast<DidDrawCheckLayer*>(*host_impl_->active_tree()->begin()); root->test_properties()->AddChild( DidDrawCheckLayer::Create(host_impl_->active_tree(), 2)); root->test_properties()->force_render_surface = true; - DidDrawCheckLayer* layer = + auto* layer = static_cast<DidDrawCheckLayer*>(root->test_properties()->children[0]); host_impl_->active_tree()->BuildPropertyTreesForTesting(); @@ -3855,13 +3848,13 @@ // will be masked out by the root layer's bounds. host_impl_->active_tree()->SetRootLayerForTesting( DidDrawCheckLayer::Create(host_impl_->active_tree(), 1)); - DidDrawCheckLayer* root = + auto* root = static_cast<DidDrawCheckLayer*>(*host_impl_->active_tree()->begin()); root->SetMasksToBounds(true); root->test_properties()->force_render_surface = true; root->test_properties()->AddChild( DidDrawCheckLayer::Create(host_impl_->active_tree(), 2)); - DidDrawCheckLayer* layer = + auto* layer = static_cast<DidDrawCheckLayer*>(root->test_properties()->children[0]); // Ensure visible_layer_rect for layer is empty. layer->SetPosition(gfx::PointF(100.f, 100.f)); @@ -3906,18 +3899,18 @@ host_impl_->active_tree()->SetRootLayerForTesting( DidDrawCheckLayer::Create(host_impl_->active_tree(), 1)); - DidDrawCheckLayer* root = + auto* root = static_cast<DidDrawCheckLayer*>(*host_impl_->active_tree()->begin()); root->test_properties()->AddChild( DidDrawCheckLayer::Create(host_impl_->active_tree(), 2)); - DidDrawCheckLayer* occluded_layer = + auto* occluded_layer = static_cast<DidDrawCheckLayer*>(root->test_properties()->children[0]); root->test_properties()->AddChild( DidDrawCheckLayer::Create(host_impl_->active_tree(), 3)); root->test_properties()->force_render_surface = true; - DidDrawCheckLayer* top_layer = + auto* top_layer = static_cast<DidDrawCheckLayer*>(root->test_properties()->children[1]); // This layer covers the occluded_layer above. Make this layer large so it can // occlude. @@ -3945,18 +3938,18 @@ TEST_F(LayerTreeHostImplTest, DidDrawCalledOnAllLayers) { host_impl_->active_tree()->SetRootLayerForTesting( DidDrawCheckLayer::Create(host_impl_->active_tree(), 1)); - DidDrawCheckLayer* root = + auto* root = static_cast<DidDrawCheckLayer*>(*host_impl_->active_tree()->begin()); root->test_properties()->AddChild( DidDrawCheckLayer::Create(host_impl_->active_tree(), 2)); root->test_properties()->force_render_surface = true; - DidDrawCheckLayer* layer1 = + auto* layer1 = static_cast<DidDrawCheckLayer*>(root->test_properties()->children[0]); layer1->test_properties()->AddChild( DidDrawCheckLayer::Create(host_impl_->active_tree(), 3)); - DidDrawCheckLayer* layer2 = + auto* layer2 = static_cast<DidDrawCheckLayer*>(layer1->test_properties()->children[0]); layer1->test_properties()->force_render_surface = true; @@ -4052,7 +4045,7 @@ root->layer_tree_impl(), layer_id++, state.has_missing_tile, state.has_incomplete_tile, state.is_animating, root->layer_tree_impl()->resource_provider(), timeline)); - DidDrawCheckLayer* layer = + auto* layer = static_cast<DidDrawCheckLayer*>(root->test_properties()->children.back()); if (state.has_copy_request) layer->AddCopyRequest(); @@ -4131,7 +4124,7 @@ host_impl_->active_tree()->SetRootLayerForTesting( DidDrawCheckLayer::Create(host_impl_->active_tree(), 1)); - DidDrawCheckLayer* root = + auto* root = static_cast<DidDrawCheckLayer*>(*host_impl_->active_tree()->begin()); root->test_properties()->force_render_surface = true; host_impl_->active_tree()->BuildPropertyTreesForTesting(); @@ -4172,7 +4165,7 @@ TEST_F(LayerTreeHostImplTest, PrepareToDrawWhenDrawAndSwapFullViewportEveryFrame) { - CreateHostImpl(DefaultSettings(), FakeCompositorFrameSink::CreateSoftware()); + CreateHostImpl(DefaultSettings(), FakeLayerTreeFrameSink::CreateSoftware()); const gfx::Transform external_transform; const gfx::Rect external_viewport; @@ -4199,7 +4192,7 @@ host_impl_->active_tree()->SetRootLayerForTesting( DidDrawCheckLayer::Create(host_impl_->active_tree(), 1)); - DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>( + auto* root = static_cast<DidDrawCheckLayer*>( host_impl_->active_tree()->root_layer_for_testing()); root->test_properties()->force_render_surface = true; host_impl_->active_tree()->BuildPropertyTreesForTesting(); @@ -4290,9 +4283,9 @@ bool CreateHostImpl( const LayerTreeSettings& settings, - std::unique_ptr<CompositorFrameSink> compositor_frame_sink) override { + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink) override { bool init = LayerTreeHostImplTest::CreateHostImpl( - settings, std::move(compositor_frame_sink)); + settings, std::move(layer_tree_frame_sink)); if (init) { host_impl_->active_tree()->set_top_controls_height(top_controls_height_); host_impl_->active_tree()->SetCurrentBrowserControlsShownRatio(1.f); @@ -4306,7 +4299,7 @@ const gfx::Size& outer_viewport_size, const gfx::Size& scroll_layer_size) { settings_ = DefaultSettings(); - CreateHostImpl(settings_, CreateCompositorFrameSink()); + CreateHostImpl(settings_, CreateLayerTreeFrameSink()); SetupBrowserControlsAndScrollLayerWithVirtualViewport( host_impl_->active_tree(), inner_viewport_size, outer_viewport_size, scroll_layer_size); @@ -4491,9 +4484,8 @@ LayerImpl* inner_container = active_tree->InnerViewportContainerLayer(); LayerImpl* outer_container = active_tree->OuterViewportContainerLayer(); - SolidColorScrollbarLayerImpl* scrollbar_layer = - static_cast<SolidColorScrollbarLayerImpl*>( - active_tree->LayerById(scrollbar_id)); + auto* scrollbar_layer = static_cast<SolidColorScrollbarLayerImpl*>( + active_tree->LayerById(scrollbar_id)); // The browser controls should start off showing so the viewport should be // shrunk. @@ -4828,7 +4820,7 @@ TEST_F(LayerTreeHostImplBrowserControlsTest, PositionBrowserControlsExplicitly) { settings_ = DefaultSettings(); - CreateHostImpl(settings_, CreateCompositorFrameSink()); + CreateHostImpl(settings_, CreateLayerTreeFrameSink()); SetupBrowserControlsAndScrollLayerWithVirtualViewport( layer_size_, layer_size_, layer_size_); DrawFrame(); @@ -4863,7 +4855,7 @@ // change after the activation. TEST_F(LayerTreeHostImplBrowserControlsTest, ApplyDeltaOnTreeActivation) { settings_ = DefaultSettings(); - CreateHostImpl(settings_, CreateCompositorFrameSink()); + CreateHostImpl(settings_, CreateLayerTreeFrameSink()); SetupBrowserControlsAndScrollLayerWithVirtualViewport( layer_size_, layer_size_, layer_size_); DrawFrame(); @@ -4913,7 +4905,7 @@ TEST_F(LayerTreeHostImplBrowserControlsTest, BrowserControlsLayoutHeightChanged) { settings_ = DefaultSettings(); - CreateHostImpl(settings_, CreateCompositorFrameSink()); + CreateHostImpl(settings_, CreateLayerTreeFrameSink()); SetupBrowserControlsAndScrollLayerWithVirtualViewport( layer_size_, layer_size_, layer_size_); DrawFrame(); @@ -5152,7 +5144,7 @@ TEST_F(LayerTreeHostImplBrowserControlsTest, ScrollNonScrollableRootWithBrowserControls) { settings_ = DefaultSettings(); - CreateHostImpl(settings_, CreateCompositorFrameSink()); + CreateHostImpl(settings_, CreateLayerTreeFrameSink()); SetupBrowserControlsAndScrollLayerWithVirtualViewport( layer_size_, layer_size_, layer_size_); DrawFrame(); @@ -5846,7 +5838,7 @@ host_impl_->DidFinishImplFrame(); // Tear down the LayerTreeHostImpl before the InputHandlerClient. - host_impl_->ReleaseCompositorFrameSink(); + host_impl_->ReleaseLayerTreeFrameSink(); host_impl_ = nullptr; } @@ -6528,7 +6520,7 @@ EXPECT_EQ(gfx::SizeF(new_size), scroll_watcher.scrollable_size()); // Tear down the LayerTreeHostImpl before the InputHandlerClient. - host_impl_->ReleaseCompositorFrameSink(); + host_impl_->ReleaseLayerTreeFrameSink(); host_impl_ = nullptr; } @@ -6844,7 +6836,7 @@ TEST_F(LayerTreeHostImplTest, OverscrollAlways) { InputHandlerScrollResult scroll_result; LayerTreeSettings settings = DefaultSettings(); - CreateHostImpl(settings, CreateCompositorFrameSink()); + CreateHostImpl(settings, CreateLayerTreeFrameSink()); LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(50, 50)); LayerImpl* clip_layer = @@ -6948,7 +6940,7 @@ TEST_F(LayerTreeHostImplTest, OverscrollOnMainThread) { InputHandlerScrollResult scroll_result; LayerTreeSettings settings = DefaultSettings(); - CreateHostImpl(settings, CreateCompositorFrameSink()); + CreateHostImpl(settings, CreateLayerTreeFrameSink()); const gfx::Size content_size(50, 50); const gfx::Size viewport_size(50, 50); @@ -7398,7 +7390,7 @@ TEST_F(LayerTreeHostImplTest, OverscrollOnImplThread) { InputHandlerScrollResult scroll_result; LayerTreeSettings settings = DefaultSettings(); - CreateHostImpl(settings, CreateCompositorFrameSink()); + CreateHostImpl(settings, CreateLayerTreeFrameSink()); const gfx::Size content_size(50, 50); const gfx::Size viewport_size(50, 50); @@ -7529,7 +7521,7 @@ root->test_properties()->AddChild(BlendStateCheckLayer::Create( host_impl_->active_tree(), 2, host_impl_->resource_provider())); - BlendStateCheckLayer* layer1 = + auto* layer1 = static_cast<BlendStateCheckLayer*>(root->test_properties()->children[0]); layer1->SetPosition(gfx::PointF(2.f, 2.f)); @@ -7582,7 +7574,7 @@ layer1->test_properties()->AddChild(BlendStateCheckLayer::Create( host_impl_->active_tree(), 3, host_impl_->resource_provider())); - BlendStateCheckLayer* layer2 = static_cast<BlendStateCheckLayer*>( + auto* layer2 = static_cast<BlendStateCheckLayer*>( layer1->test_properties()->children[0]); layer2->SetPosition(gfx::PointF(4.f, 4.f)); @@ -7787,12 +7779,12 @@ int layer_id = 1; host_impl_->active_tree()->SetRootLayerForTesting( DidDrawCheckLayer::Create(host_impl_->active_tree(), layer_id++)); - DidDrawCheckLayer* root = + auto* root = static_cast<DidDrawCheckLayer*>(*host_impl_->active_tree()->begin()); root->test_properties()->AddChild( DidDrawCheckLayer::Create(host_impl_->active_tree(), layer_id++)); - DidDrawCheckLayer* video_layer = + auto* video_layer = static_cast<DidDrawCheckLayer*>(root->test_properties()->children.back()); video_layer->set_may_contain_video(true); EXPECT_TRUE(MayContainVideoBitSetOnFrameData(host_impl_.get())); @@ -7800,7 +7792,7 @@ // Test with the video layer occluded. root->test_properties()->AddChild( DidDrawCheckLayer::Create(host_impl_->active_tree(), layer_id++)); - DidDrawCheckLayer* large_layer = + auto* large_layer = static_cast<DidDrawCheckLayer*>(root->test_properties()->children.back()); large_layer->SetBounds(big_size); large_layer->SetContentsOpaque(true); @@ -7826,11 +7818,11 @@ child_(NULL), did_activate_pending_tree_(false) {} - std::unique_ptr<CompositorFrameSink> CreateFakeCompositorFrameSink( + std::unique_ptr<LayerTreeFrameSink> CreateFakeLayerTreeFrameSink( bool software) { if (software) - return FakeCompositorFrameSink::CreateSoftware(); - return FakeCompositorFrameSink::Create3d(); + return FakeLayerTreeFrameSink::CreateSoftware(); + return FakeLayerTreeFrameSink::Create3d(); } void SetupActiveTreeLayers() { @@ -8047,7 +8039,7 @@ viewport_size_ = gfx::Size(1000, 1000); bool software = false; - CreateHostImpl(DefaultSettings(), CreateFakeCompositorFrameSink(software)); + CreateHostImpl(DefaultSettings(), CreateFakeLayerTreeFrameSink(software)); host_impl_->SetViewportSize(DipSizeToPixelSize(viewport_size_)); SetupActiveTreeLayers(); @@ -8061,7 +8053,7 @@ viewport_size_ = gfx::Size(1000, 1000); bool software = false; - CreateHostImpl(DefaultSettings(), CreateFakeCompositorFrameSink(software)); + CreateHostImpl(DefaultSettings(), CreateFakeLayerTreeFrameSink(software)); host_impl_->active_tree()->SetDeviceScaleFactor(2.f); host_impl_->SetViewportSize(DipSizeToPixelSize(viewport_size_)); @@ -8076,7 +8068,7 @@ viewport_size_ = gfx::Size(1000, 1000); bool software = true; - CreateHostImpl(DefaultSettings(), CreateFakeCompositorFrameSink(software)); + CreateHostImpl(DefaultSettings(), CreateFakeLayerTreeFrameSink(software)); // Pending tree to force active_tree size invalid. Not used otherwise. host_impl_->CreatePendingTree(); @@ -8093,7 +8085,7 @@ viewport_size_ = gfx::Size(1000, 1000); bool software = true; - CreateHostImpl(DefaultSettings(), CreateFakeCompositorFrameSink(software)); + CreateHostImpl(DefaultSettings(), CreateFakeLayerTreeFrameSink(software)); // Set larger viewport and activate it to active tree. host_impl_->CreatePendingTree(); @@ -8128,7 +8120,7 @@ }; // Make sure damage tracking propagates all the way to the CompositorFrame -// submitted to the CompositorFrameSink, where it should request to swap only +// submitted to the LayerTreeFrameSink, where it should request to swap only // the sub-buffer that is damaged. TEST_F(LayerTreeHostImplTest, PartialSwapReceivesDamageRect) { scoped_refptr<TestContextProvider> context_provider( @@ -8136,10 +8128,10 @@ context_provider->BindToCurrentThread(); context_provider->TestContext3d()->set_have_post_sub_buffer(true); - std::unique_ptr<FakeCompositorFrameSink> compositor_frame_sink( - FakeCompositorFrameSink::Create3d(context_provider)); - FakeCompositorFrameSink* fake_compositor_frame_sink = - compositor_frame_sink.get(); + std::unique_ptr<FakeLayerTreeFrameSink> layer_tree_frame_sink( + FakeLayerTreeFrameSink::Create3d(context_provider)); + FakeLayerTreeFrameSink* fake_layer_tree_frame_sink = + layer_tree_frame_sink.get(); // This test creates its own LayerTreeHostImpl, so // that we can force partial swap enabled. @@ -8150,7 +8142,7 @@ &task_graph_runner_, AnimationHost::CreateForTesting(ThreadInstance::IMPL), 0, nullptr); layer_tree_host_impl->SetVisible(true); - layer_tree_host_impl->InitializeRenderer(compositor_frame_sink.get()); + layer_tree_host_impl->InitializeRenderer(layer_tree_frame_sink.get()); layer_tree_host_impl->WillBeginImplFrame( CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 2)); layer_tree_host_impl->SetViewportSize(gfx::Size(500, 500)); @@ -8177,7 +8169,7 @@ layer_tree_host_impl->DidDrawAllLayers(frame); gfx::Rect expected_swap_rect(500, 500); EXPECT_EQ(expected_swap_rect.ToString(), - fake_compositor_frame_sink->last_swap_rect().ToString()); + fake_layer_tree_frame_sink->last_swap_rect().ToString()); // Second frame, only the damaged area should get swapped. Damage should be // the union of old and new child rects: gfx::Rect(26, 28). @@ -8198,7 +8190,7 @@ expected_swap_rect = gfx::Rect(26, 28); EXPECT_EQ(expected_swap_rect.ToString(), - fake_compositor_frame_sink->last_swap_rect().ToString()); + fake_layer_tree_frame_sink->last_swap_rect().ToString()); layer_tree_host_impl->SetViewportSize(gfx::Size(10, 10)); // This will damage everything. @@ -8211,9 +8203,9 @@ expected_swap_rect = gfx::Rect(10, 10); EXPECT_EQ(expected_swap_rect.ToString(), - fake_compositor_frame_sink->last_swap_rect().ToString()); + fake_layer_tree_frame_sink->last_swap_rect().ToString()); - layer_tree_host_impl->ReleaseCompositorFrameSink(); + layer_tree_host_impl->ReleaseLayerTreeFrameSink(); } TEST_F(LayerTreeHostImplTest, RootLayerDoesntCreateExtraSurface) { @@ -8269,9 +8261,9 @@ std::unique_ptr<TestWebGraphicsContext3D> context = TestWebGraphicsContext3D::Create(); TestWebGraphicsContext3D* context3d = context.get(); - std::unique_ptr<CompositorFrameSink> compositor_frame_sink( - FakeCompositorFrameSink::Create3d(std::move(context))); - CreateHostImpl(DefaultSettings(), std::move(compositor_frame_sink)); + std::unique_ptr<LayerTreeFrameSink> layer_tree_frame_sink( + FakeLayerTreeFrameSink::Create3d(std::move(context))); + CreateHostImpl(DefaultSettings(), std::move(layer_tree_frame_sink)); std::unique_ptr<LayerImpl> root_layer = LayerImpl::Create(host_impl_->active_tree(), 1); @@ -8348,8 +8340,8 @@ class LayerTreeHostImplTestDrawAndTestDamage : public LayerTreeHostImplTest { protected: - std::unique_ptr<CompositorFrameSink> CreateCompositorFrameSink() override { - return FakeCompositorFrameSink::Create3d(); + std::unique_ptr<LayerTreeFrameSink> CreateLayerTreeFrameSink() override { + return FakeLayerTreeFrameSink::Create3d(); } void DrawFrameAndTestDamage(const gfx::Rect& expected_damage) { @@ -8554,7 +8546,7 @@ ForcedDrawToSoftwareDeviceSkipsUnsupportedLayers) { set_reduce_memory_result(false); EXPECT_TRUE(CreateHostImpl(DefaultSettings(), - FakeCompositorFrameSink::CreateSoftware())); + FakeLayerTreeFrameSink::CreateSoftware())); const gfx::Transform external_transform; const gfx::Rect external_viewport; @@ -8586,7 +8578,7 @@ // Checks that we use the memory limits provided. TEST_F(LayerTreeHostImplTest, MemoryLimits) { - host_impl_->ReleaseCompositorFrameSink(); + host_impl_->ReleaseLayerTreeFrameSink(); host_impl_ = nullptr; const size_t kGpuByteLimit = 1234321; @@ -8620,10 +8612,10 @@ AnimationHost::CreateForTesting(ThreadInstance::IMPL), 0, nullptr); // Gpu compositing. - compositor_frame_sink_ = - FakeCompositorFrameSink::Create3d(TestWebGraphicsContext3D::Create()); + layer_tree_frame_sink_ = + FakeLayerTreeFrameSink::Create3d(TestWebGraphicsContext3D::Create()); host_impl_->SetVisible(true); - host_impl_->InitializeRenderer(compositor_frame_sink_.get()); + host_impl_->InitializeRenderer(layer_tree_frame_sink_.get()); { const auto& state = host_impl_->global_tile_state(); EXPECT_EQ(kGpuByteLimit, state.hard_memory_limit_in_bytes); @@ -8649,9 +8641,9 @@ } // Software compositing. - host_impl_->ReleaseCompositorFrameSink(); - compositor_frame_sink_ = FakeCompositorFrameSink::CreateSoftware(); - host_impl_->InitializeRenderer(compositor_frame_sink_.get()); + host_impl_->ReleaseLayerTreeFrameSink(); + layer_tree_frame_sink_ = FakeLayerTreeFrameSink::CreateSoftware(); + host_impl_->InitializeRenderer(layer_tree_frame_sink_.get()); { const auto& state = host_impl_->global_tile_state(); EXPECT_EQ(kSoftwareByteLimit, state.hard_memory_limit_in_bytes); @@ -8762,9 +8754,9 @@ fake_host_impl_ = new FakeLayerTreeHostImpl( LayerTreeSettings(), &task_runner_provider_, &task_graph_runner_); host_impl_.reset(fake_host_impl_); - compositor_frame_sink_ = CreateCompositorFrameSink(); + layer_tree_frame_sink_ = CreateLayerTreeFrameSink(); host_impl_->SetVisible(true); - host_impl_->InitializeRenderer(compositor_frame_sink_.get()); + host_impl_->InitializeRenderer(layer_tree_frame_sink_.get()); host_impl_->SetViewportSize(gfx::Size(10, 10)); } @@ -8783,9 +8775,9 @@ std::unique_ptr<TestWebGraphicsContext3D> context = TestWebGraphicsContext3D::Create(); TestWebGraphicsContext3D* context3d = context.get(); - std::unique_ptr<FakeCompositorFrameSink> compositor_frame_sink = - FakeCompositorFrameSink::Create3d(); - CreateHostImpl(DefaultSettings(), std::move(compositor_frame_sink)); + std::unique_ptr<FakeLayerTreeFrameSink> layer_tree_frame_sink = + FakeLayerTreeFrameSink::Create3d(); + CreateHostImpl(DefaultSettings(), std::move(layer_tree_frame_sink)); EXPECT_EQ(0u, context3d->NumTextures()); @@ -8827,7 +8819,7 @@ std::unique_ptr<TestWebGraphicsContext3D> context = TestWebGraphicsContext3D::Create(); TestWebGraphicsContext3D* context3d = context.get(); - CreateHostImpl(DefaultSettings(), FakeCompositorFrameSink::Create3d()); + CreateHostImpl(DefaultSettings(), FakeLayerTreeFrameSink::Create3d()); EXPECT_EQ(0u, context3d->NumTextures()); @@ -8850,7 +8842,7 @@ void ShutdownReleasesContext_Callback( std::unique_ptr<CopyOutputResult> result) {} -class FrameSinkClient : public TestCompositorFrameSinkClient { +class FrameSinkClient : public TestLayerTreeFrameSinkClient { public: explicit FrameSinkClient( scoped_refptr<ContextProvider> display_context_provider) @@ -8880,13 +8872,13 @@ constexpr bool synchronous_composite = true; constexpr bool disable_display_vsync = false; constexpr double refresh_rate = 60.0; - auto compositor_frame_sink = base::MakeUnique<TestCompositorFrameSink>( + auto layer_tree_frame_sink = base::MakeUnique<TestLayerTreeFrameSink>( context_provider, TestContextProvider::CreateWorker(), nullptr, nullptr, RendererSettings(), base::ThreadTaskRunnerHandle::Get().get(), synchronous_composite, disable_display_vsync, refresh_rate); - compositor_frame_sink->SetClient(&test_client_); + layer_tree_frame_sink->SetClient(&test_client_); - CreateHostImpl(DefaultSettings(), std::move(compositor_frame_sink)); + CreateHostImpl(DefaultSettings(), std::move(layer_tree_frame_sink)); SetupRootLayerImpl(LayerImpl::Create(host_impl_->active_tree(), 1)); @@ -8906,7 +8898,7 @@ EXPECT_FALSE(context_provider->HasOneRef()); EXPECT_EQ(1u, context_provider->TestContext3d()->NumTextures()); - host_impl_->ReleaseCompositorFrameSink(); + host_impl_->ReleaseLayerTreeFrameSink(); host_impl_ = nullptr; // The CopyOutputResult's callback was cancelled, the CopyOutputResult @@ -9241,9 +9233,8 @@ host_impl_->active_tree()->SetRootLayerForTesting(std::move(root)); host_impl_->active_tree()->BuildPropertyTreesForTesting(); - FakeCompositorFrameSink* fake_compositor_frame_sink = - static_cast<FakeCompositorFrameSink*>( - host_impl_->compositor_frame_sink()); + auto* fake_layer_tree_frame_sink = + static_cast<FakeLayerTreeFrameSink*>(host_impl_->layer_tree_frame_sink()); ui::LatencyInfo latency_info; latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, @@ -9259,7 +9250,7 @@ host_impl_->DidDrawAllLayers(frame); const std::vector<ui::LatencyInfo>& metadata_latency_after = - fake_compositor_frame_sink->last_sent_frame()->metadata.latency_info; + fake_layer_tree_frame_sink->last_sent_frame()->metadata.latency_info; EXPECT_EQ(1u, metadata_latency_after.size()); EXPECT_TRUE(metadata_latency_after[0].FindLatency( ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, NULL)); @@ -9278,9 +9269,8 @@ host_impl_->active_tree()->BuildPropertyTreesForTesting(); // Ensure the default frame selection bounds are empty. - FakeCompositorFrameSink* fake_compositor_frame_sink = - static_cast<FakeCompositorFrameSink*>( - host_impl_->compositor_frame_sink()); + auto* fake_layer_tree_frame_sink = + static_cast<FakeLayerTreeFrameSink*>(host_impl_->layer_tree_frame_sink()); // Plumb the layer-local selection bounds. gfx::Point selection_top(5, 0); @@ -9304,7 +9294,7 @@ // Ensure the selection bounds have propagated to the frame metadata. const Selection<gfx::SelectionBound>& selection_after = - fake_compositor_frame_sink->last_sent_frame()->metadata.selection; + fake_layer_tree_frame_sink->last_sent_frame()->metadata.selection; EXPECT_EQ(selection.start.type, selection_after.start.type()); EXPECT_EQ(selection.end.type, selection_after.end.type()); EXPECT_EQ(gfx::PointF(selection_bottom), selection_after.start.edge_bottom()); @@ -9443,7 +9433,7 @@ public: void SetUp() override { LayerTreeSettings settings = DefaultSettings(); - CreateHostImpl(settings, CreateCompositorFrameSink()); + CreateHostImpl(settings, CreateLayerTreeFrameSink()); host_impl_->active_tree()->set_top_controls_height(top_controls_height_); host_impl_->sync_tree()->set_top_controls_height(top_controls_height_); host_impl_->active_tree()->SetCurrentBrowserControlsShownRatio(1.f); @@ -10399,7 +10389,7 @@ void SetUp() override { LayerTreeSettings settings = DefaultSettings(); settings.max_memory_for_prepaint_percentage = 50; - CreateHostImpl(settings, CreateCompositorFrameSink()); + CreateHostImpl(settings, CreateLayerTreeFrameSink()); } }; @@ -10647,8 +10637,8 @@ class ResourcelessSoftwareLayerTreeHostImplTest : public LayerTreeHostImplTest { protected: - std::unique_ptr<CompositorFrameSink> CreateCompositorFrameSink() override { - return FakeCompositorFrameSink::Create3d(); + std::unique_ptr<LayerTreeFrameSink> CreateLayerTreeFrameSink() override { + return FakeLayerTreeFrameSink::Create3d(); } }; @@ -11534,7 +11524,7 @@ Occlusion(), true); host_impl_->pending_tree()->SetRootLayerForTesting(std::move(layer)); - FakePictureLayerImpl* root_layer = static_cast<FakePictureLayerImpl*>( + auto* root_layer = static_cast<FakePictureLayerImpl*>( host_impl_->pending_tree()->root_layer_for_testing()); root_layer->set_has_valid_tile_priorities(true); @@ -11632,7 +11622,7 @@ class LayerTreeHostImplCountingLostSurfaces : public LayerTreeHostImplTest { public: LayerTreeHostImplCountingLostSurfaces() : num_lost_surfaces_(0) {} - void DidLoseCompositorFrameSinkOnImplThread() override { + void DidLoseLayerTreeFrameSinkOnImplThread() override { num_lost_surfaces_++; } @@ -11645,9 +11635,9 @@ // we go from having a valid output surface to not having a valid output // surface. EXPECT_EQ(0, num_lost_surfaces_); - host_impl_->DidLoseCompositorFrameSink(); + host_impl_->DidLoseLayerTreeFrameSink(); EXPECT_EQ(1, num_lost_surfaces_); - host_impl_->DidLoseCompositorFrameSink(); + host_impl_->DidLoseLayerTreeFrameSink(); EXPECT_LE(1, num_lost_surfaces_); } @@ -11875,7 +11865,7 @@ context_with_msaa->set_gpu_rasterization(true); LayerTreeSettings msaaSettings = DefaultSettings(); msaaSettings.gpu_rasterization_msaa_sample_count = 4; - EXPECT_TRUE(CreateHostImpl(msaaSettings, FakeCompositorFrameSink::Create3d( + EXPECT_TRUE(CreateHostImpl(msaaSettings, FakeLayerTreeFrameSink::Create3d( std::move(context_with_msaa)))); // Set initial state, before varying GPU rasterization suitability. @@ -11911,7 +11901,7 @@ context_with_msaa->set_gpu_rasterization(true); LayerTreeSettings msaaSettings = DefaultSettings(); msaaSettings.gpu_rasterization_msaa_sample_count = -1; - EXPECT_TRUE(CreateHostImpl(msaaSettings, FakeCompositorFrameSink::Create3d( + EXPECT_TRUE(CreateHostImpl(msaaSettings, FakeLayerTreeFrameSink::Create3d( std::move(context_with_msaa)))); // Set initial state, before varying scale factor. @@ -11947,7 +11937,7 @@ context_with_msaa->set_gpu_rasterization(true); LayerTreeSettings msaaSettings = DefaultSettings(); msaaSettings.gpu_rasterization_msaa_sample_count = 4; - EXPECT_TRUE(CreateHostImpl(msaaSettings, FakeCompositorFrameSink::Create3d( + EXPECT_TRUE(CreateHostImpl(msaaSettings, FakeLayerTreeFrameSink::Create3d( std::move(context_with_msaa)))); host_impl_->SetHasGpuRasterizationTrigger(true); @@ -11962,8 +11952,8 @@ class GpuRasterizationDisabledLayerTreeHostImplTest : public LayerTreeHostImplTest { public: - std::unique_ptr<CompositorFrameSink> CreateCompositorFrameSink() override { - return FakeCompositorFrameSink::Create3d(); + std::unique_ptr<LayerTreeFrameSink> CreateLayerTreeFrameSink() override { + return FakeLayerTreeFrameSink::Create3d(); } }; @@ -11972,7 +11962,7 @@ GpuRasterizationStatusOverrides) { // GPU rasterization explicitly disabled. LayerTreeSettings settings = DefaultSettings(); - EXPECT_TRUE(CreateHostImpl(settings, FakeCompositorFrameSink::Create3d())); + EXPECT_TRUE(CreateHostImpl(settings, FakeLayerTreeFrameSink::Create3d())); host_impl_->SetHasGpuRasterizationTrigger(true); host_impl_->SetContentIsSuitableForGpuRasterization(true); host_impl_->CommitComplete(); @@ -11982,7 +11972,7 @@ // GPU rasterization explicitly forced. settings.gpu_rasterization_forced = true; - EXPECT_TRUE(CreateHostImpl(settings, FakeCompositorFrameSink::Create3d())); + EXPECT_TRUE(CreateHostImpl(settings, FakeLayerTreeFrameSink::Create3d())); host_impl_->SetHasGpuRasterizationTrigger(false); host_impl_->SetContentIsSuitableForGpuRasterization(false); @@ -12001,10 +11991,10 @@ context_provider->UnboundTestContext3d()->SetMaxSamples(4); context_provider->UnboundTestContext3d()->set_msaa_is_slow(msaa_is_slow); context_provider->UnboundTestContext3d()->set_gpu_rasterization(true); - auto msaa_is_normal_compositor_frame_sink = - FakeCompositorFrameSink::Create3d(context_provider); + auto msaa_is_normal_layer_tree_frame_sink = + FakeLayerTreeFrameSink::Create3d(context_provider); EXPECT_TRUE(CreateHostImpl( - settings, std::move(msaa_is_normal_compositor_frame_sink))); + settings, std::move(msaa_is_normal_layer_tree_frame_sink))); } }; @@ -12172,13 +12162,11 @@ } } -// Checks that if we lose a GPU raster enabled CompositorFrameSink and replace -// it -// with a software CompositorFrameSink, LayerTreeHostImpl correctly re-computes -// GPU -// rasterization status. -TEST_F(LayerTreeHostImplTest, RecomputeGpuRasterOnCompositorFrameSinkChange) { - host_impl_->ReleaseCompositorFrameSink(); +// Checks that if we lose a GPU raster enabled LayerTreeFrameSink and replace +// it with a software LayerTreeFrameSink, LayerTreeHostImpl correctly +// re-computes GPU rasterization status. +TEST_F(LayerTreeHostImplTest, RecomputeGpuRasterOnLayerTreeFrameSinkChange) { + host_impl_->ReleaseLayerTreeFrameSink(); host_impl_ = nullptr; LayerTreeSettings settings = DefaultSettings(); @@ -12191,14 +12179,14 @@ host_impl_->SetVisible(true); // InitializeRenderer with a gpu-raster enabled output surface. - auto gpu_raster_compositor_frame_sink = - FakeCompositorFrameSink::Create3d(TestWebGraphicsContext3D::Create()); - host_impl_->InitializeRenderer(gpu_raster_compositor_frame_sink.get()); + auto gpu_raster_layer_tree_frame_sink = + FakeLayerTreeFrameSink::Create3d(TestWebGraphicsContext3D::Create()); + host_impl_->InitializeRenderer(gpu_raster_layer_tree_frame_sink.get()); EXPECT_TRUE(host_impl_->use_gpu_rasterization()); // Re-initialize with a software output surface. - compositor_frame_sink_ = FakeCompositorFrameSink::CreateSoftware(); - host_impl_->InitializeRenderer(compositor_frame_sink_.get()); + layer_tree_frame_sink_ = FakeLayerTreeFrameSink::CreateSoftware(); + host_impl_->InitializeRenderer(layer_tree_frame_sink_.get()); EXPECT_FALSE(host_impl_->use_gpu_rasterization()); } @@ -12220,7 +12208,7 @@ const int child_clip_id = 12; const int child_scroll_id = 13; - CreateHostImpl(settings, CreateCompositorFrameSink()); + CreateHostImpl(settings, CreateLayerTreeFrameSink()); host_impl_->active_tree()->SetDeviceScaleFactor(1); host_impl_->SetViewportSize(viewport_size); CreateScrollAndContentsLayers(host_impl_->active_tree(), content_size); @@ -12466,7 +12454,7 @@ settings.enable_checker_imaging = true; settings.default_tile_size = gfx::Size(256, 256); settings.max_untiled_layer_size = gfx::Size(256, 256); - CreateHostImpl(settings, CreateCompositorFrameSink()); + CreateHostImpl(settings, CreateLayerTreeFrameSink()); gfx::Size layer_size = gfx::Size(750, 750); std::unique_ptr<FakeRecordingSource> recording_source = @@ -12494,8 +12482,7 @@ pending_tree->SetRootLayerForTesting( FakePictureLayerImpl::CreateWithRasterSource(pending_tree, 1, raster_source)); - FakePictureLayerImpl* root = - static_cast<FakePictureLayerImpl*>(*pending_tree->begin()); + auto* root = static_cast<FakePictureLayerImpl*>(*pending_tree->begin()); root->SetBounds(layer_size); root->SetDrawsContent(true); pending_tree->BuildPropertyTreesForTesting(); @@ -12538,14 +12525,14 @@ TEST_F(LayerTreeHostImplTest, RasterColorSpaceNoColorCorrection) { LayerTreeSettings settings = DefaultSettings(); - CreateHostImpl(settings, CreateCompositorFrameSink()); + CreateHostImpl(settings, CreateLayerTreeFrameSink()); EXPECT_FALSE(host_impl_->GetRasterColorSpace().IsValid()); } TEST_F(LayerTreeHostImplTest, RasterColorSpace) { LayerTreeSettings settings = DefaultSettings(); settings.enable_color_correct_rasterization = true; - CreateHostImpl(settings, CreateCompositorFrameSink()); + CreateHostImpl(settings, CreateLayerTreeFrameSink()); EXPECT_EQ(host_impl_->GetRasterColorSpace(), gfx::ColorSpace::CreateSRGB()); }
diff --git a/cc/trees/layer_tree_host_perftest.cc b/cc/trees/layer_tree_host_perftest.cc index c18633e..df03b17 100644 --- a/cc/trees/layer_tree_host_perftest.cc +++ b/cc/trees/layer_tree_host_perftest.cc
@@ -23,7 +23,7 @@ #include "cc/test/layer_tree_json_parser.h" #include "cc/test/layer_tree_test.h" #include "cc/test/paths.h" -#include "cc/test/test_compositor_frame_sink.h" +#include "cc/test/test_layer_tree_frame_sink.h" #include "cc/trees/layer_tree_impl.h" #include "testing/perf/perf_test.h" @@ -46,7 +46,7 @@ measure_commit_cost_(false) { } - std::unique_ptr<TestCompositorFrameSink> CreateCompositorFrameSink( + std::unique_ptr<TestLayerTreeFrameSink> CreateLayerTreeFrameSink( const RendererSettings& renderer_settings, double refresh_rate, scoped_refptr<ContextProvider> compositor_context_provider, @@ -55,7 +55,7 @@ bool synchronous_composite = !HasImplThread() && !layer_tree_host()->GetSettings().single_thread_proxy_scheduler; - return base::MakeUnique<TestCompositorFrameSink>( + return base::MakeUnique<TestLayerTreeFrameSink>( compositor_context_provider, std::move(worker_context_provider), shared_bitmap_manager(), gpu_memory_buffer_manager(), renderer_settings, ImplThreadTaskRunner(), synchronous_composite, disable_display_vsync,
diff --git a/cc/trees/layer_tree_host_pixeltest_blending.cc b/cc/trees/layer_tree_host_pixeltest_blending.cc index f8367bfb..8cecb9e 100644 --- a/cc/trees/layer_tree_host_pixeltest_blending.cc +++ b/cc/trees/layer_tree_host_pixeltest_blending.cc
@@ -9,7 +9,7 @@ #include "cc/paint/paint_image.h" #include "cc/test/layer_tree_pixel_resource_test.h" #include "cc/test/pixel_comparator.h" -#include "cc/test/test_compositor_frame_sink.h" +#include "cc/test/test_layer_tree_frame_sink.h" #include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkSurface.h" @@ -69,7 +69,7 @@ } protected: - std::unique_ptr<TestCompositorFrameSink> CreateCompositorFrameSink( + std::unique_ptr<TestLayerTreeFrameSink> CreateLayerTreeFrameSink( const RendererSettings& renderer_settings, double refresh_rate, scoped_refptr<ContextProvider> compositor_context_provider, @@ -78,7 +78,7 @@ modified_renderer_settings.force_antialiasing = force_antialiasing_; modified_renderer_settings.force_blending_with_shaders = force_blending_with_shaders_; - return LayerTreeHostPixelResourceTest::CreateCompositorFrameSink( + return LayerTreeHostPixelResourceTest::CreateLayerTreeFrameSink( modified_renderer_settings, refresh_rate, compositor_context_provider, worker_context_provider); }
diff --git a/cc/trees/layer_tree_host_pixeltest_tiles.cc b/cc/trees/layer_tree_host_pixeltest_tiles.cc index 5e5499d..c4ff86c 100644 --- a/cc/trees/layer_tree_host_pixeltest_tiles.cc +++ b/cc/trees/layer_tree_host_pixeltest_tiles.cc
@@ -11,7 +11,7 @@ #include "cc/paint/paint_flags.h" #include "cc/paint/paint_op_buffer.h" #include "cc/test/layer_tree_pixel_test.h" -#include "cc/test/test_compositor_frame_sink.h" +#include "cc/test/test_layer_tree_frame_sink.h" #include "gpu/command_buffer/client/gles2_interface.h" #if !defined(OS_ANDROID) @@ -178,7 +178,7 @@ // Issue a GL finish before preparing tiles to ensure resources become // available for use in a timely manner. Needed for the one-copy path. ContextProvider* context_provider = - host_impl->compositor_frame_sink()->worker_context_provider(); + host_impl->layer_tree_frame_sink()->worker_context_provider(); if (!context_provider) return;
diff --git a/cc/trees/layer_tree_host_single_thread_client.h b/cc/trees/layer_tree_host_single_thread_client.h index 00cc3dba..416b5de 100644 --- a/cc/trees/layer_tree_host_single_thread_client.h +++ b/cc/trees/layer_tree_host_single_thread_client.h
@@ -22,10 +22,10 @@ // limiting. virtual void DidSubmitCompositorFrame() = 0; - // Called when the active CompositorFrameSink is lost and needs to be + // Called when the active LayerTreeFrameSink is lost and needs to be // replaced. This allows the embedder to schedule a composite which will - // run the machinery to acquire a new CompositorFrameSink. - virtual void DidLoseCompositorFrameSink() = 0; + // run the machinery to acquire a new LayerTreeFrameSink. + virtual void DidLoseLayerTreeFrameSink() = 0; protected: virtual ~LayerTreeHostSingleThreadClient() {}
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc index acffb0a..cd297d7f 100644 --- a/cc/trees/layer_tree_host_unittest.cc +++ b/cc/trees/layer_tree_host_unittest.cc
@@ -52,7 +52,7 @@ #include "cc/test/push_properties_counting_layer_impl.h" #include "cc/test/render_pass_test_utils.h" #include "cc/test/skia_common.h" -#include "cc/test/test_compositor_frame_sink.h" +#include "cc/test/test_layer_tree_frame_sink.h" #include "cc/test/test_web_graphics_context_3d.h" #include "cc/trees/clip_node.h" #include "cc/trees/effect_node.h" @@ -441,7 +441,7 @@ class LayerTreeHostContextCacheTest : public LayerTreeHostTest { public: - std::unique_ptr<TestCompositorFrameSink> CreateCompositorFrameSink( + std::unique_ptr<TestLayerTreeFrameSink> CreateLayerTreeFrameSink( const RendererSettings& renderer_settings, double refresh_rate, scoped_refptr<ContextProvider> compositor_context_provider, @@ -466,7 +466,7 @@ EXPECT_CALL(*mock_worker_context_support_, SetAggressivelyFreeResources(false)); - return LayerTreeHostTest::CreateCompositorFrameSink( + return LayerTreeHostTest::CreateLayerTreeFrameSink( renderer_settings, refresh_rate, std::move(test_main_context_provider), std::move(test_worker_context_provider)); } @@ -579,13 +579,13 @@ SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostFreeContextResourcesOnDestroy); // Test if the LTH successfully frees and stops freeing context resources -// when the CompositorFrameSink is lost and recreated. -class LayerTreeHostCacheBehaviorOnCompositorFrameSinkRecreated +// when the LayerTreeFrameSink is lost and recreated. +class LayerTreeHostCacheBehaviorOnLayerTreeFrameSinkRecreated : public LayerTreeHostContextCacheTest { public: void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl, const BeginFrameArgs& args) override { - // This code is run once, to trigger recreation of our CompositorFrameSink. + // This code is run once, to trigger recreation of our LayerTreeFrameSink. if (test_state_ != TestState::INIT) return; @@ -593,18 +593,18 @@ Mock::VerifyAndClearExpectations(mock_main_context_support_); Mock::VerifyAndClearExpectations(mock_worker_context_support_); - // CompositorFrameSink lost expectations. + // LayerTreeFrameSink lost expectations. EXPECT_CALL(*mock_worker_context_support_, SetAggressivelyFreeResources(true)); EXPECT_CALL(*mock_main_context_support_, SetAggressivelyFreeResources(true)); - host_impl->DidLoseCompositorFrameSink(); + host_impl->DidLoseLayerTreeFrameSink(); test_state_ = TestState::RECREATED; } void InitializedRendererOnThread(LayerTreeHostImpl* host_impl, bool success) override { - // This is run after we have recreated our CompositorFrameSink. + // This is run after we have recreated our LayerTreeFrameSink. if (test_state_ != TestState::RECREATED) return; @@ -627,7 +627,7 @@ }; SINGLE_AND_MULTI_THREAD_TEST_F( - LayerTreeHostCacheBehaviorOnCompositorFrameSinkRecreated); + LayerTreeHostCacheBehaviorOnLayerTreeFrameSinkRecreated); // Two setNeedsCommits in a row should lead to at least 1 commit and at least 1 // draw with frame 0. @@ -3359,9 +3359,9 @@ int commit_complete_count_; }; -class OnDrawCompositorFrameSink : public TestCompositorFrameSink { +class OnDrawLayerTreeFrameSink : public TestLayerTreeFrameSink { public: - explicit OnDrawCompositorFrameSink( + explicit OnDrawLayerTreeFrameSink( scoped_refptr<ContextProvider> compositor_context_provider, scoped_refptr<ContextProvider> worker_context_provider, SharedBitmapManager* shared_bitmap_manager, @@ -3371,18 +3371,18 @@ bool synchronous_composite, double refresh_rate, base::Closure invalidate_callback) - : TestCompositorFrameSink(std::move(compositor_context_provider), - std::move(worker_context_provider), - shared_bitmap_manager, - gpu_memory_buffer_manager, - renderer_settings, - task_runner, - synchronous_composite, - false /* disable_display_vsync */, - refresh_rate), + : TestLayerTreeFrameSink(std::move(compositor_context_provider), + std::move(worker_context_provider), + shared_bitmap_manager, + gpu_memory_buffer_manager, + renderer_settings, + task_runner, + synchronous_composite, + false /* disable_display_vsync */, + refresh_rate), invalidate_callback_(std::move(invalidate_callback)) {} - // TestCompositorFrameSink overrides. + // TestLayerTreeFrameSink overrides. void Invalidate() override { invalidate_callback_.Run(); } void OnDraw(bool resourceless_software_draw) { @@ -3403,7 +3403,7 @@ settings->using_synchronous_renderer_compositor = true; } - std::unique_ptr<TestCompositorFrameSink> CreateCompositorFrameSink( + std::unique_ptr<TestLayerTreeFrameSink> CreateLayerTreeFrameSink( const RendererSettings& renderer_settings, double refresh_rate, scoped_refptr<ContextProvider> compositor_context_provider, @@ -3412,12 +3412,12 @@ &LayerTreeHostTestAbortedCommitDoesntStallSynchronousCompositor:: CallOnDraw, base::Unretained(this)); - auto frame_sink = base::MakeUnique<OnDrawCompositorFrameSink>( + auto frame_sink = base::MakeUnique<OnDrawLayerTreeFrameSink>( compositor_context_provider, std::move(worker_context_provider), shared_bitmap_manager(), gpu_memory_buffer_manager(), renderer_settings, ImplThreadTaskRunner(), false /* synchronous_composite */, refresh_rate, std::move(on_draw_callback)); - compositor_frame_sink_ = frame_sink.get(); + layer_tree_frame_sink_ = frame_sink.get(); return std::move(frame_sink); } @@ -3427,13 +3427,13 @@ // surface. But it needs to be done on a new stack frame. bool resourceless_software_draw = false; ImplThreadTaskRunner()->PostTask( - FROM_HERE, base::BindOnce(&OnDrawCompositorFrameSink::OnDraw, - base::Unretained(compositor_frame_sink_), + FROM_HERE, base::BindOnce(&OnDrawLayerTreeFrameSink::OnDraw, + base::Unretained(layer_tree_frame_sink_), resourceless_software_draw)); } } - OnDrawCompositorFrameSink* compositor_frame_sink_ = nullptr; + OnDrawLayerTreeFrameSink* layer_tree_frame_sink_ = nullptr; }; MULTI_THREAD_TEST_F( @@ -3561,7 +3561,7 @@ void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { auto* context = static_cast<TestContextProvider*>( - impl->compositor_frame_sink()->context_provider()) + impl->layer_tree_frame_sink()->context_provider()) ->TestContext3d(); int frame = impl->active_tree()->source_frame_number(); @@ -5534,7 +5534,7 @@ class LayerTreeHostWithGpuRasterizationTest : public LayerTreeHostTest { protected: - std::unique_ptr<TestCompositorFrameSink> CreateCompositorFrameSink( + std::unique_ptr<TestLayerTreeFrameSink> CreateLayerTreeFrameSink( const RendererSettings& renderer_settings, double refresh_rate, scoped_refptr<ContextProvider> compositor_context_provider, @@ -5542,7 +5542,7 @@ auto context = TestWebGraphicsContext3D::Create(); context->set_gpu_rasterization(true); auto context_provider = TestContextProvider::Create(std::move(context)); - return LayerTreeHostTest::CreateCompositorFrameSink( + return LayerTreeHostTest::CreateLayerTreeFrameSink( renderer_settings, refresh_rate, std::move(context_provider), std::move(worker_context_provider)); } @@ -5619,7 +5619,7 @@ settings->gpu_rasterization_msaa_sample_count = 4; } - std::unique_ptr<TestCompositorFrameSink> CreateCompositorFrameSink( + std::unique_ptr<TestLayerTreeFrameSink> CreateLayerTreeFrameSink( const RendererSettings& renderer_settings, double refresh_rate, scoped_refptr<ContextProvider> compositor_context_provider, @@ -5630,7 +5630,7 @@ context->set_gpu_rasterization(true); compositor_context_provider = TestContextProvider::Create(std::move(context)); - return LayerTreeTest::CreateCompositorFrameSink( + return LayerTreeTest::CreateLayerTreeFrameSink( renderer_settings, refresh_rate, compositor_context_provider, worker_context_provider); } @@ -6044,7 +6044,7 @@ settings->use_zero_copy = true; } - std::unique_ptr<TestCompositorFrameSink> CreateCompositorFrameSink( + std::unique_ptr<TestLayerTreeFrameSink> CreateLayerTreeFrameSink( const RendererSettings& renderer_settings, double refresh_rate, scoped_refptr<ContextProvider> compositor_context_provider, @@ -6053,7 +6053,7 @@ bool synchronous_composite = !HasImplThread() && !layer_tree_host()->GetSettings().single_thread_proxy_scheduler; - return base::MakeUnique<TestCompositorFrameSink>( + return base::MakeUnique<TestLayerTreeFrameSink>( compositor_context_provider, std::move(worker_context_provider), shared_bitmap_manager(), gpu_memory_buffer_manager(), renderer_settings, ImplThreadTaskRunner(), synchronous_composite, disable_display_vsync, @@ -7434,7 +7434,7 @@ }; SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor); -// Makes sure that LocalSurfaceId is propagated to the CompositorFrameSink. +// Makes sure that LocalSurfaceId is propagated to the LayerTreeFrameSink. class LayerTreeHostTestLocalSurfaceId : public LayerTreeHostTest { protected: void InitializeSettings(LayerTreeSettings* settings) override { @@ -7521,7 +7521,7 @@ // Retrieve max texture size from Skia. ContextProvider* context_provider = - host_impl->compositor_frame_sink()->context_provider(); + host_impl->layer_tree_frame_sink()->context_provider(); ASSERT_TRUE(context_provider); ContextProvider::ScopedContextLock context_lock(context_provider); @@ -7865,7 +7865,7 @@ SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestHudLayerWithLayerLists); // Verifies that LayerTreeHostClient does not receive frame acks from a released -// CompositorFrameSink. +// LayerTreeFrameSink. class LayerTreeHostTestDiscardAckAfterRelease : public LayerTreeHostTest { protected: void SetupTree() override { @@ -7891,14 +7891,14 @@ void WillReceiveCompositorFrameAck() { switch (layer_tree_host()->SourceFrameNumber()) { case 1: - // For the first commit, don't release the CompositorFrameSink. We must + // For the first commit, don't release the LayerTreeFrameSink. We must // receive the ack later on. break; case 2: - // Release the CompositorFrameSink for the second commit. We'll later + // Release the LayerTreeFrameSink for the second commit. We'll later // check that the ack is discarded. layer_tree_host()->SetVisible(false); - layer_tree_host()->ReleaseCompositorFrameSink(); + layer_tree_host()->ReleaseLayerTreeFrameSink(); break; default: NOTREACHED(); @@ -7921,13 +7921,13 @@ void CheckFrameAck() { switch (layer_tree_host()->SourceFrameNumber()) { case 1: - // CompositorFrameSink was not released. We must receive the ack. + // LayerTreeFrameSink was not released. We must receive the ack. EXPECT_TRUE(received_ack_); // Cause damage so that we draw and swap. layer_tree_host()->root_layer()->SetBackgroundColor(SK_ColorGREEN); break; case 2: - // CompositorFrameSink was released. The ack must be discarded. + // LayerTreeFrameSink was released. The ack must be discarded. EXPECT_FALSE(received_ack_); EndTest(); break;
diff --git a/cc/trees/layer_tree_host_unittest_checkerimaging.cc b/cc/trees/layer_tree_host_unittest_checkerimaging.cc index 0828b10..692bb747 100644 --- a/cc/trees/layer_tree_host_unittest_checkerimaging.cc +++ b/cc/trees/layer_tree_host_unittest_checkerimaging.cc
@@ -9,7 +9,7 @@ #include "cc/test/fake_picture_layer.h" #include "cc/test/layer_tree_test.h" #include "cc/test/skia_common.h" -#include "cc/test/test_compositor_frame_sink.h" +#include "cc/test/test_layer_tree_frame_sink.h" #include "cc/trees/layer_tree_impl.h" namespace cc {
diff --git a/cc/trees/layer_tree_host_unittest_context.cc b/cc/trees/layer_tree_host_unittest_context.cc index ac83a150..d56d3d4 100644 --- a/cc/trees/layer_tree_host_unittest_context.cc +++ b/cc/trees/layer_tree_host_unittest_context.cc
@@ -29,8 +29,8 @@ #include "cc/test/fake_video_frame_provider.h" #include "cc/test/layer_tree_test.h" #include "cc/test/render_pass_test_utils.h" -#include "cc/test/test_compositor_frame_sink.h" #include "cc/test/test_context_provider.h" +#include "cc/test/test_layer_tree_frame_sink.h" #include "cc/test/test_shared_bitmap_manager.h" #include "cc/test/test_web_graphics_context_3d.h" #include "cc/trees/layer_tree_host.h" @@ -60,12 +60,12 @@ committed_at_least_once_(false), context_should_support_io_surface_(false), fallback_context_works_(false), - async_compositor_frame_sink_creation_(false) { + async_layer_tree_frame_sink_creation_(false) { media::InitializeMediaLibrary(); } void LoseContext() { - // CreateDisplayCompositorFrameSink happens on a different thread, so lock + // CreateDisplayLayerTreeFrameSink happens on a different thread, so lock // context3d_ to make sure we don't set it to null after recreating it // there. base::AutoLock lock(context3d_lock_); @@ -77,7 +77,7 @@ context3d_ = nullptr; } - std::unique_ptr<TestCompositorFrameSink> CreateCompositorFrameSink( + std::unique_ptr<TestLayerTreeFrameSink> CreateLayerTreeFrameSink( const RendererSettings& renderer_settings, double refresh_rate, scoped_refptr<ContextProvider> compositor_context_provider, @@ -99,7 +99,7 @@ GL_INNOCENT_CONTEXT_RESET_ARB); } - return LayerTreeTest::CreateCompositorFrameSink( + return LayerTreeTest::CreateLayerTreeFrameSink( renderer_settings, refresh_rate, TestContextProvider::Create(std::move(compositor_context3d)), std::move(worker_context_provider)); @@ -139,7 +139,7 @@ times_to_fail_recreate_ = 0; } - void DidFailToInitializeCompositorFrameSink() override { + void DidFailToInitializeLayerTreeFrameSink() override { ++times_create_failed_; } @@ -152,7 +152,7 @@ protected: // Protects use of context3d_ so LoseContext and - // CreateDisplayCompositorFrameSink can both use it on different threads. + // CreateDisplayLayerTreeFrameSink can both use it on different threads. base::Lock context3d_lock_; TestWebGraphicsContext3D* context3d_; @@ -165,7 +165,7 @@ bool committed_at_least_once_; bool context_should_support_io_surface_; bool fallback_context_works_; - bool async_compositor_frame_sink_creation_; + bool async_layer_tree_frame_sink_creation_; }; class LayerTreeHostContextTestLostContextSucceeds @@ -181,23 +181,23 @@ void BeginTest() override { PostSetNeedsCommitToMainThread(); } - void RequestNewCompositorFrameSink() override { - if (async_compositor_frame_sink_creation_) { + void RequestNewLayerTreeFrameSink() override { + if (async_layer_tree_frame_sink_creation_) { MainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce(&LayerTreeHostContextTestLostContextSucceeds:: - AsyncRequestNewCompositorFrameSink, + AsyncRequestNewLayerTreeFrameSink, base::Unretained(this))); } else { - AsyncRequestNewCompositorFrameSink(); + AsyncRequestNewLayerTreeFrameSink(); } } - void AsyncRequestNewCompositorFrameSink() { - LayerTreeHostContextTest::RequestNewCompositorFrameSink(); + void AsyncRequestNewLayerTreeFrameSink() { + LayerTreeHostContextTest::RequestNewLayerTreeFrameSink(); } - void DidInitializeCompositorFrameSink() override { + void DidInitializeLayerTreeFrameSink() override { if (first_initialized_) ++num_losses_; else @@ -240,35 +240,35 @@ 0, // times_to_lose_during_draw 0, // times_to_fail_recreate false, // fallback_context_works - false, // async_compositor_frame_sink_creation + false, // async_layer_tree_frame_sink_creation }, { 0, // times_to_lose_during_commit 1, // times_to_lose_during_draw 0, // times_to_fail_recreate false, // fallback_context_works - false, // async_compositor_frame_sink_creation + false, // async_layer_tree_frame_sink_creation }, { 1, // times_to_lose_during_commit 0, // times_to_lose_during_draw 3, // times_to_fail_recreate false, // fallback_context_works - false, // async_compositor_frame_sink_creation + false, // async_layer_tree_frame_sink_creation }, { 0, // times_to_lose_during_commit 1, // times_to_lose_during_draw 3, // times_to_fail_recreate false, // fallback_context_works - false, // async_compositor_frame_sink_creation + false, // async_layer_tree_frame_sink_creation }, { 0, // times_to_lose_during_commit 1, // times_to_lose_during_draw 3, // times_to_fail_recreate false, // fallback_context_works - true, // async_compositor_frame_sink_creation + true, // async_layer_tree_frame_sink_creation }, // Losing the context and recreating it any number of times should // succeed. @@ -277,28 +277,28 @@ 0, // times_to_lose_during_draw 0, // times_to_fail_recreate false, // fallback_context_works - false, // async_compositor_frame_sink_creation + false, // async_layer_tree_frame_sink_creation }, { 0, // times_to_lose_during_commit 10, // times_to_lose_during_draw 0, // times_to_fail_recreate false, // fallback_context_works - false, // async_compositor_frame_sink_creation + false, // async_layer_tree_frame_sink_creation }, { 10, // times_to_lose_during_commit 0, // times_to_lose_during_draw 0, // times_to_fail_recreate false, // fallback_context_works - true, // async_compositor_frame_sink_creation + true, // async_layer_tree_frame_sink_creation }, { 0, // times_to_lose_during_commit 10, // times_to_lose_during_draw 0, // times_to_fail_recreate false, // fallback_context_works - true, // async_compositor_frame_sink_creation + true, // async_layer_tree_frame_sink_creation }, // Losing the context, failing to reinitialize it, and making a fallback // context should work. @@ -307,14 +307,14 @@ 1, // times_to_lose_during_draw 0, // times_to_fail_recreate true, // fallback_context_works - false, // async_compositor_frame_sink_creation + false, // async_layer_tree_frame_sink_creation }, { 0, // times_to_lose_during_commit 1, // times_to_lose_during_draw 0, // times_to_fail_recreate true, // fallback_context_works - true, // async_compositor_frame_sink_creation + true, // async_layer_tree_frame_sink_creation }, }; @@ -330,8 +330,8 @@ times_to_lose_during_draw_ = kTests[test_case_].times_to_lose_during_draw; times_to_fail_recreate_ = kTests[test_case_].times_to_fail_recreate; fallback_context_works_ = kTests[test_case_].fallback_context_works; - async_compositor_frame_sink_creation_ = - kTests[test_case_].async_compositor_frame_sink_creation; + async_layer_tree_frame_sink_creation_ = + kTests[test_case_].async_layer_tree_frame_sink_creation; ++test_case_; return true; } @@ -341,7 +341,7 @@ int times_to_lose_during_draw; int times_to_fail_recreate; bool fallback_context_works; - bool async_compositor_frame_sink_creation; + bool async_layer_tree_frame_sink_creation; }; protected: @@ -354,10 +354,10 @@ SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestLostContextSucceeds); -class LayerTreeHostClientNotVisibleDoesNotCreateCompositorFrameSink +class LayerTreeHostClientNotVisibleDoesNotCreateLayerTreeFrameSink : public LayerTreeHostContextTest { public: - LayerTreeHostClientNotVisibleDoesNotCreateCompositorFrameSink() + LayerTreeHostClientNotVisibleDoesNotCreateLayerTreeFrameSink() : LayerTreeHostContextTest() {} void WillBeginTest() override { @@ -370,60 +370,60 @@ EndTest(); } - void RequestNewCompositorFrameSink() override { - ADD_FAILURE() << "RequestNewCompositorFrameSink() should not be called"; + void RequestNewLayerTreeFrameSink() override { + ADD_FAILURE() << "RequestNewLayerTreeFrameSink() should not be called"; } - void DidInitializeCompositorFrameSink() override { EXPECT_TRUE(false); } + void DidInitializeLayerTreeFrameSink() override { EXPECT_TRUE(false); } void AfterTest() override {} }; SINGLE_AND_MULTI_THREAD_TEST_F( - LayerTreeHostClientNotVisibleDoesNotCreateCompositorFrameSink); + LayerTreeHostClientNotVisibleDoesNotCreateLayerTreeFrameSink); -// This tests the CompositorFrameSink release logic in the following sequence. -// SetUp LTH and create and init CompositorFrameSink. +// This tests the LayerTreeFrameSink release logic in the following sequence. +// SetUp LTH and create and init LayerTreeFrameSink. // LTH::SetVisible(false); -// LTH::ReleaseCompositorFrameSink(); +// LTH::ReleaseLayerTreeFrameSink(); // ... // LTH::SetVisible(true); -// Create and init new CompositorFrameSink -class LayerTreeHostClientTakeAwayCompositorFrameSink +// Create and init new LayerTreeFrameSink +class LayerTreeHostClientTakeAwayLayerTreeFrameSink : public LayerTreeHostContextTest { public: - LayerTreeHostClientTakeAwayCompositorFrameSink() + LayerTreeHostClientTakeAwayLayerTreeFrameSink() : LayerTreeHostContextTest(), setos_counter_(0) {} void BeginTest() override { PostSetNeedsCommitToMainThread(); } - void RequestNewCompositorFrameSink() override { + void RequestNewLayerTreeFrameSink() override { if (layer_tree_host()->IsVisible()) { setos_counter_++; - LayerTreeHostContextTest::RequestNewCompositorFrameSink(); + LayerTreeHostContextTest::RequestNewLayerTreeFrameSink(); } } - void HideAndReleaseCompositorFrameSink() { + void HideAndReleaseLayerTreeFrameSink() { EXPECT_TRUE(layer_tree_host()->GetTaskRunnerProvider()->IsMainThread()); layer_tree_host()->SetVisible(false); - std::unique_ptr<CompositorFrameSink> surface = - layer_tree_host()->ReleaseCompositorFrameSink(); + std::unique_ptr<LayerTreeFrameSink> surface = + layer_tree_host()->ReleaseLayerTreeFrameSink(); CHECK(surface); MainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce( - &LayerTreeHostClientTakeAwayCompositorFrameSink::MakeVisible, + &LayerTreeHostClientTakeAwayLayerTreeFrameSink::MakeVisible, base::Unretained(this))); } - void DidInitializeCompositorFrameSink() override { + void DidInitializeLayerTreeFrameSink() override { EXPECT_TRUE(layer_tree_host()->IsVisible()); if (setos_counter_ == 1) { MainThreadTaskRunner()->PostTask( FROM_HERE, - base::BindOnce(&LayerTreeHostClientTakeAwayCompositorFrameSink:: - HideAndReleaseCompositorFrameSink, + base::BindOnce(&LayerTreeHostClientTakeAwayLayerTreeFrameSink:: + HideAndReleaseLayerTreeFrameSink, base::Unretained(this))); } else { EndTest(); @@ -440,12 +440,12 @@ int setos_counter_; }; -SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostClientTakeAwayCompositorFrameSink); +SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostClientTakeAwayLayerTreeFrameSink); -class MultipleCompositeDoesNotCreateCompositorFrameSink +class MultipleCompositeDoesNotCreateLayerTreeFrameSink : public LayerTreeHostContextTest { public: - MultipleCompositeDoesNotCreateCompositorFrameSink() + MultipleCompositeDoesNotCreateLayerTreeFrameSink() : LayerTreeHostContextTest(), request_count_(0) {} void InitializeSettings(LayerTreeSettings* settings) override { @@ -453,7 +453,7 @@ settings->use_zero_copy = true; } - void RequestNewCompositorFrameSink() override { + void RequestNewLayerTreeFrameSink() override { EXPECT_GE(1, ++request_count_); EndTest(); } @@ -463,7 +463,7 @@ layer_tree_host()->Composite(base::TimeTicks::FromInternalValue(2)); } - void DidInitializeCompositorFrameSink() override { EXPECT_TRUE(false); } + void DidInitializeLayerTreeFrameSink() override { EXPECT_TRUE(false); } void AfterTest() override {} @@ -471,15 +471,15 @@ }; // This test uses Composite() which only exists for single thread. -SINGLE_THREAD_TEST_F(MultipleCompositeDoesNotCreateCompositorFrameSink); +SINGLE_THREAD_TEST_F(MultipleCompositeDoesNotCreateLayerTreeFrameSink); // This test makes sure that once a SingleThreadProxy issues a -// DidFailToInitializeCompositorFrameSink, that future Composite calls will not +// DidFailToInitializeLayerTreeFrameSink, that future Composite calls will not // trigger additional requests for output surfaces. -class FailedCreateDoesNotCreateExtraCompositorFrameSink +class FailedCreateDoesNotCreateExtraLayerTreeFrameSink : public LayerTreeHostContextTest { public: - FailedCreateDoesNotCreateExtraCompositorFrameSink() + FailedCreateDoesNotCreateExtraLayerTreeFrameSink() : LayerTreeHostContextTest(), num_requests_(0), has_failed_(false) { times_to_fail_create_ = 1; } @@ -489,16 +489,16 @@ settings->use_zero_copy = true; } - void RequestNewCompositorFrameSink() override { + void RequestNewLayerTreeFrameSink() override { num_requests_++; // There should be one initial request and then one request from - // the LayerTreeTest test hooks DidFailToInitializeCompositorFrameSink + // the LayerTreeTest test hooks DidFailToInitializeLayerTreeFrameSink // (which is hard to skip). This second request is just ignored and is test // cruft. EXPECT_LE(num_requests_, 2); if (num_requests_ > 1) return; - LayerTreeHostContextTest::RequestNewCompositorFrameSink(); + LayerTreeHostContextTest::RequestNewLayerTreeFrameSink(); } void BeginTest() override { @@ -513,10 +513,10 @@ EndTest(); } - void DidInitializeCompositorFrameSink() override { EXPECT_TRUE(false); } + void DidInitializeLayerTreeFrameSink() override { EXPECT_TRUE(false); } - void DidFailToInitializeCompositorFrameSink() override { - LayerTreeHostContextTest::DidFailToInitializeCompositorFrameSink(); + void DidFailToInitializeLayerTreeFrameSink() override { + LayerTreeHostContextTest::DidFailToInitializeLayerTreeFrameSink(); EXPECT_FALSE(has_failed_); has_failed_ = true; } @@ -528,12 +528,12 @@ }; // This test uses Composite() which only exists for single thread. -SINGLE_THREAD_TEST_F(FailedCreateDoesNotCreateExtraCompositorFrameSink); +SINGLE_THREAD_TEST_F(FailedCreateDoesNotCreateExtraLayerTreeFrameSink); -class LayerTreeHostContextTestCommitAfterDelayedCompositorFrameSink +class LayerTreeHostContextTestCommitAfterDelayedLayerTreeFrameSink : public LayerTreeHostContextTest { public: - LayerTreeHostContextTestCommitAfterDelayedCompositorFrameSink() + LayerTreeHostContextTestCommitAfterDelayedLayerTreeFrameSink() : LayerTreeHostContextTest(), creating_output_(false) {} void InitializeSettings(LayerTreeSettings* settings) override { @@ -541,18 +541,18 @@ settings->use_zero_copy = true; } - void RequestNewCompositorFrameSink() override { + void RequestNewLayerTreeFrameSink() override { MainThreadTaskRunner()->PostTask( FROM_HERE, base::BindOnce( - &LayerTreeHostContextTestCommitAfterDelayedCompositorFrameSink:: - CreateAndSetCompositorFrameSink, + &LayerTreeHostContextTestCommitAfterDelayedLayerTreeFrameSink:: + CreateAndSetLayerTreeFrameSink, base::Unretained(this))); } - void CreateAndSetCompositorFrameSink() { + void CreateAndSetLayerTreeFrameSink() { creating_output_ = true; - LayerTreeHostContextTest::RequestNewCompositorFrameSink(); + LayerTreeHostContextTest::RequestNewLayerTreeFrameSink(); } void BeginTest() override { @@ -571,7 +571,7 @@ // This test uses Composite() which only exists for single thread. SINGLE_THREAD_TEST_F( - LayerTreeHostContextTestCommitAfterDelayedCompositorFrameSink); + LayerTreeHostContextTestCommitAfterDelayedLayerTreeFrameSink); class LayerTreeHostContextTestAvoidUnnecessaryComposite : public LayerTreeHostContextTest { @@ -584,8 +584,8 @@ settings->use_zero_copy = true; } - void RequestNewCompositorFrameSink() override { - LayerTreeHostContextTest::RequestNewCompositorFrameSink(); + void RequestNewLayerTreeFrameSink() override { + LayerTreeHostContextTest::RequestNewLayerTreeFrameSink(); EndTest(); } @@ -656,17 +656,17 @@ SINGLE_AND_MULTI_THREAD_TEST_F( LayerTreeHostContextTestLostContextSucceedsWithContent); -class LayerTreeHostContextTestCreateCompositorFrameSinkFailsOnce +class LayerTreeHostContextTestCreateLayerTreeFrameSinkFailsOnce : public LayerTreeHostContextTest { public: - LayerTreeHostContextTestCreateCompositorFrameSinkFailsOnce() + LayerTreeHostContextTestCreateLayerTreeFrameSinkFailsOnce() : times_to_fail_(1), times_initialized_(0) { times_to_fail_create_ = times_to_fail_; } void BeginTest() override { PostSetNeedsCommitToMainThread(); } - void DidInitializeCompositorFrameSink() override { times_initialized_++; } + void DidInitializeLayerTreeFrameSink() override { times_initialized_++; } void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { EndTest(); } @@ -681,7 +681,7 @@ }; SINGLE_AND_MULTI_THREAD_TEST_F( - LayerTreeHostContextTestCreateCompositorFrameSinkFailsOnce); + LayerTreeHostContextTestCreateLayerTreeFrameSinkFailsOnce); class LayerTreeHostContextTestLostContextAndEvictTextures : public LayerTreeHostContextTest { @@ -761,7 +761,7 @@ EndTest(); } - void DidInitializeCompositorFrameSink() override {} + void DidInitializeLayerTreeFrameSink() override {} void AfterTest() override {} @@ -1005,14 +1005,14 @@ return draw_result; } - void RequestNewCompositorFrameSink() override { + void RequestNewLayerTreeFrameSink() override { // This will get called twice: - // First when we create the initial CompositorFrameSink... + // First when we create the initial LayerTreeFrameSink... if (layer_tree_host()->SourceFrameNumber() > 0) { // ... and then again after we forced the context to be lost. lost_context_ = true; } - LayerTreeHostContextTest::RequestNewCompositorFrameSink(); + LayerTreeHostContextTest::RequestNewLayerTreeFrameSink(); } void DidCommitAndDrawFrame() override { @@ -1079,7 +1079,7 @@ void AfterTest() override {} - void DidInitializeCompositorFrameSink() override { EndTest(); } + void DidInitializeLayerTreeFrameSink() override { EndTest(); } private: FakeContentLayerClient client_; @@ -1576,11 +1576,11 @@ // After the first frame, we will lose the context and then not start // allowing commits until that happens. The 2nd frame should not happen - // before DidInitializeCompositorFrameSink occurs. + // before DidInitializeLayerTreeFrameSink occurs. lost_ = true; } - void DidInitializeCompositorFrameSink() override { + void DidInitializeLayerTreeFrameSink() override { EXPECT_TRUE(lost_); lost_ = false; } @@ -1627,7 +1627,7 @@ void WillPrepareTilesOnThread(LayerTreeHostImpl* host_impl) override { ContextProvider::ScopedContextLock scoped_context( - host_impl->compositor_frame_sink()->worker_context_provider()); + host_impl->layer_tree_frame_sink()->worker_context_provider()); gpu::gles2::GLES2Interface* gl = scoped_context.ContextGL(); gl->LoseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB);
diff --git a/cc/trees/layer_tree_host_unittest_copyrequest.cc b/cc/trees/layer_tree_host_unittest_copyrequest.cc index e468e60..02ab684 100644 --- a/cc/trees/layer_tree_host_unittest_copyrequest.cc +++ b/cc/trees/layer_tree_host_unittest_copyrequest.cc
@@ -17,7 +17,7 @@ #include "cc/test/fake_output_surface.h" #include "cc/test/fake_picture_layer.h" #include "cc/test/layer_tree_test.h" -#include "cc/test/test_compositor_frame_sink.h" +#include "cc/test/test_layer_tree_frame_sink.h" #include "cc/trees/layer_tree_impl.h" #include "gpu/GLES2/gl2extchromium.h" @@ -464,12 +464,12 @@ client_.set_bounds(root_->bounds()); } - std::unique_ptr<TestCompositorFrameSink> CreateCompositorFrameSink( + std::unique_ptr<TestLayerTreeFrameSink> CreateLayerTreeFrameSink( const RendererSettings& renderer_settings, double refresh_rate, scoped_refptr<ContextProvider> compositor_context_provider, scoped_refptr<ContextProvider> worker_context_provider) override { - auto frame_sink = LayerTreeHostCopyRequestTest::CreateCompositorFrameSink( + auto frame_sink = LayerTreeHostCopyRequestTest::CreateLayerTreeFrameSink( renderer_settings, refresh_rate, std::move(compositor_context_provider), std::move(worker_context_provider)); frame_sink_ = frame_sink.get(); @@ -536,7 +536,7 @@ RenderPassId parent_render_pass_id = 0; RenderPassId copy_layer_render_pass_id = 0; - TestCompositorFrameSink* frame_sink_ = nullptr; + TestLayerTreeFrameSink* frame_sink_ = nullptr; bool did_swap_ = false; FakeContentLayerClient client_; scoped_refptr<FakePictureLayer> root_; @@ -869,7 +869,7 @@ // These tests expect the LayerTreeHostImpl to share a context with // the Display so that sync points are not needed and the texture counts // are visible together. - // Since this test does not override CreateCompositorFrameSink, the + // Since this test does not override CreateLayerTreeFrameSink, the // |compositor_context_provider| will be a TestContextProvider. display_context_provider_ = static_cast<TestContextProvider*>(compositor_context_provider.get());
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc index 9b361177..84ca462 100644 --- a/cc/trees/layer_tree_impl.cc +++ b/cc/trees/layer_tree_impl.cc
@@ -30,7 +30,7 @@ #include "cc/layers/layer_list_iterator.h" #include "cc/layers/render_surface_impl.h" #include "cc/layers/scrollbar_layer_impl_base.h" -#include "cc/output/compositor_frame_sink.h" +#include "cc/output/layer_tree_frame_sink.h" #include "cc/resources/ui_resource_request.h" #include "cc/trees/clip_node.h" #include "cc/trees/draw_property_utils.h" @@ -1020,7 +1020,7 @@ // For max_texture_size. When a new output surface is received the needs // update draw properties flag is set again. - if (!layer_tree_host_impl_->compositor_frame_sink()) + if (!layer_tree_host_impl_->layer_tree_frame_sink()) return false; // Clear this after the renderer early out, as it should still be @@ -1345,7 +1345,7 @@ } ContextProvider* LayerTreeImpl::context_provider() const { - return layer_tree_host_impl_->compositor_frame_sink()->context_provider(); + return layer_tree_host_impl_->layer_tree_frame_sink()->context_provider(); } ResourceProvider* LayerTreeImpl::resource_provider() const {
diff --git a/cc/trees/proxy.h b/cc/trees/proxy.h index 020b94d..5e06000 100644 --- a/cc/trees/proxy.h +++ b/cc/trees/proxy.h
@@ -23,8 +23,8 @@ } namespace cc { +class LayerTreeFrameSink; class LayerTreeMutator; -class CompositorFrameSink; // Abstract interface responsible for proxying commands from the main-thread // side of the compositor over to the compositor implementation. @@ -35,12 +35,9 @@ virtual bool IsStarted() const = 0; virtual bool CommitToActiveTree() const = 0; - // Will call LayerTreeHost::OnCreateAndInitializeCompositorFrameSinkAttempted - // with the result of this function. - virtual void SetCompositorFrameSink( - CompositorFrameSink* compositor_frame_sink) = 0; - - virtual void ReleaseCompositorFrameSink() = 0; + virtual void SetLayerTreeFrameSink( + LayerTreeFrameSink* layer_tree_frame_sink) = 0; + virtual void ReleaseLayerTreeFrameSink() = 0; virtual void SetVisible(bool visible) = 0;
diff --git a/cc/trees/proxy_impl.cc b/cc/trees/proxy_impl.cc index 4b2dba0..2a7e31a 100644 --- a/cc/trees/proxy_impl.cc +++ b/cc/trees/proxy_impl.cc
@@ -19,8 +19,8 @@ #include "cc/base/devtools_instrumentation.h" #include "cc/benchmarks/benchmark_instrumentation.h" #include "cc/input/browser_controls_offset_manager.h" -#include "cc/output/compositor_frame_sink.h" #include "cc/output/context_provider.h" +#include "cc/output/layer_tree_frame_sink.h" #include "cc/scheduler/compositor_timing_history.h" #include "cc/scheduler/delay_based_time_source.h" #include "cc/trees/layer_tree_host.h" @@ -98,9 +98,9 @@ // Prevent the scheduler from performing actions while we're in an // inconsistent state. scheduler_->Stop(); - // Take away the CompositorFrameSink before destroying things so it doesn't + // Take away the LayerTreeFrameSink before destroying things so it doesn't // try to call into its client mid-shutdown. - layer_tree_host_impl_->ReleaseCompositorFrameSink(); + layer_tree_host_impl_->ReleaseLayerTreeFrameSink(); scheduler_ = nullptr; layer_tree_host_impl_ = nullptr; // We need to explicitly shutdown the notifier to destroy any weakptrs it is @@ -125,21 +125,21 @@ constraints, current, animate); } -void ProxyImpl::InitializeCompositorFrameSinkOnImpl( - CompositorFrameSink* compositor_frame_sink, +void ProxyImpl::InitializeLayerTreeFrameSinkOnImpl( + LayerTreeFrameSink* layer_tree_frame_sink, base::WeakPtr<ProxyMain> proxy_main_frame_sink_bound_weak_ptr) { - TRACE_EVENT0("cc", "ProxyImpl::InitializeCompositorFrameSinkOnImplThread"); + TRACE_EVENT0("cc", "ProxyImpl::InitializeLayerTreeFrameSinkOnImplThread"); DCHECK(IsImplThread()); proxy_main_frame_sink_bound_weak_ptr_ = proxy_main_frame_sink_bound_weak_ptr; LayerTreeHostImpl* host_impl = layer_tree_host_impl_.get(); - bool success = host_impl->InitializeRenderer(compositor_frame_sink); + bool success = host_impl->InitializeRenderer(layer_tree_frame_sink); MainThreadTaskRunner()->PostTask( - FROM_HERE, base::BindOnce(&ProxyMain::DidInitializeCompositorFrameSink, + FROM_HERE, base::BindOnce(&ProxyMain::DidInitializeLayerTreeFrameSink, proxy_main_weak_ptr_, success)); if (success) - scheduler_->DidCreateAndInitializeCompositorFrameSink(); + scheduler_->DidCreateAndInitializeLayerTreeFrameSink(); } void ProxyImpl::MainThreadHasStoppedFlingingOnImpl() { @@ -196,22 +196,22 @@ scheduler_->SetVisible(visible); } -void ProxyImpl::ReleaseCompositorFrameSinkOnImpl(CompletionEvent* completion) { +void ProxyImpl::ReleaseLayerTreeFrameSinkOnImpl(CompletionEvent* completion) { DCHECK(IsImplThread()); - // Unlike DidLoseCompositorFrameSinkOnImplThread, we don't need to call - // LayerTreeHost::DidLoseCompositorFrameSink since it already knows. - scheduler_->DidLoseCompositorFrameSink(); - layer_tree_host_impl_->ReleaseCompositorFrameSink(); + // Unlike DidLoseLayerTreeFrameSinkOnImplThread, we don't need to call + // LayerTreeHost::DidLoseLayerTreeFrameSink since it already knows. + scheduler_->DidLoseLayerTreeFrameSink(); + layer_tree_host_impl_->ReleaseLayerTreeFrameSink(); completion->Signal(); } void ProxyImpl::FinishGLOnImpl(CompletionEvent* completion) { TRACE_EVENT0("cc", "ProxyImpl::FinishGLOnImplThread"); DCHECK(IsImplThread()); - if (layer_tree_host_impl_->compositor_frame_sink()) { + if (layer_tree_host_impl_->layer_tree_frame_sink()) { ContextProvider* context_provider = - layer_tree_host_impl_->compositor_frame_sink()->context_provider(); + layer_tree_host_impl_->layer_tree_frame_sink()->context_provider(); if (context_provider) context_provider->ContextGL()->Finish(); } @@ -222,7 +222,7 @@ CompletionEvent* completion, bool* main_frame_will_happen) { DCHECK(IsImplThread()); - if (layer_tree_host_impl_->compositor_frame_sink()) { + if (layer_tree_host_impl_->layer_tree_frame_sink()) { *main_frame_will_happen = scheduler_->MainFrameForTestingWillHappen(); } else { *main_frame_will_happen = false; @@ -299,17 +299,17 @@ scheduler_->NotifyReadyToCommit(); } -void ProxyImpl::DidLoseCompositorFrameSinkOnImplThread() { - TRACE_EVENT0("cc", "ProxyImpl::DidLoseCompositorFrameSinkOnImplThread"); +void ProxyImpl::DidLoseLayerTreeFrameSinkOnImplThread() { + TRACE_EVENT0("cc", "ProxyImpl::DidLoseLayerTreeFrameSinkOnImplThread"); DCHECK(IsImplThread()); MainThreadTaskRunner()->PostTask( - FROM_HERE, base::BindOnce(&ProxyMain::DidLoseCompositorFrameSink, + FROM_HERE, base::BindOnce(&ProxyMain::DidLoseLayerTreeFrameSink, proxy_main_weak_ptr_)); - scheduler_->DidLoseCompositorFrameSink(); + scheduler_->DidLoseLayerTreeFrameSink(); } void ProxyImpl::SetBeginFrameSource(BeginFrameSource* source) { - // During shutdown, destroying the CompositorFrameSink may unset the + // During shutdown, destroying the LayerTreeFrameSink may unset the // BeginFrameSource. if (scheduler_) { // TODO(enne): this overrides any preexisting begin frame source. Those @@ -471,9 +471,9 @@ proxy_main_weak_ptr_)); } -void ProxyImpl::OnDrawForCompositorFrameSink(bool resourceless_software_draw) { +void ProxyImpl::OnDrawForLayerTreeFrameSink(bool resourceless_software_draw) { DCHECK(IsImplThread()); - scheduler_->OnDrawForCompositorFrameSink(resourceless_software_draw); + scheduler_->OnDrawForLayerTreeFrameSink(resourceless_software_draw); } void ProxyImpl::NeedsImplSideInvalidation() { @@ -595,12 +595,12 @@ layer_tree_host_impl_->ActivateSyncTree(); } -void ProxyImpl::ScheduledActionBeginCompositorFrameSinkCreation() { +void ProxyImpl::ScheduledActionBeginLayerTreeFrameSinkCreation() { TRACE_EVENT0("cc", - "ProxyImpl::ScheduledActionBeginCompositorFrameSinkCreation"); + "ProxyImpl::ScheduledActionBeginLayerTreeFrameSinkCreation"); DCHECK(IsImplThread()); MainThreadTaskRunner()->PostTask( - FROM_HERE, base::BindOnce(&ProxyMain::RequestNewCompositorFrameSink, + FROM_HERE, base::BindOnce(&ProxyMain::RequestNewLayerTreeFrameSink, proxy_main_weak_ptr_)); } @@ -610,11 +610,11 @@ layer_tree_host_impl_->PrepareTiles(); } -void ProxyImpl::ScheduledActionInvalidateCompositorFrameSink() { - TRACE_EVENT0("cc", "ProxyImpl::ScheduledActionInvalidateCompositorFrameSink"); +void ProxyImpl::ScheduledActionInvalidateLayerTreeFrameSink() { + TRACE_EVENT0("cc", "ProxyImpl::ScheduledActionInvalidateLayerTreeFrameSink"); DCHECK(IsImplThread()); - DCHECK(layer_tree_host_impl_->compositor_frame_sink()); - layer_tree_host_impl_->compositor_frame_sink()->Invalidate(); + DCHECK(layer_tree_host_impl_->layer_tree_frame_sink()); + layer_tree_host_impl_->layer_tree_frame_sink()->Invalidate(); } void ProxyImpl::ScheduledActionPerformImplSideInvalidation() { @@ -677,7 +677,7 @@ if (draw_frame) { if (layer_tree_host_impl_->DrawLayers(&frame)) - // Drawing implies we submitted a frame to the CompositorFrameSink. + // Drawing implies we submitted a frame to the LayerTreeFrameSink. scheduler_->DidSubmitCompositorFrame(); result = DRAW_SUCCESS; } else {
diff --git a/cc/trees/proxy_impl.h b/cc/trees/proxy_impl.h index fd29646..c98285be 100644 --- a/cc/trees/proxy_impl.h +++ b/cc/trees/proxy_impl.h
@@ -33,8 +33,8 @@ void UpdateBrowserControlsStateOnImpl(BrowserControlsState constraints, BrowserControlsState current, bool animate); - void InitializeCompositorFrameSinkOnImpl( - CompositorFrameSink* compositor_frame_sink, + void InitializeLayerTreeFrameSinkOnImpl( + LayerTreeFrameSink* layer_tree_frame_sink, base::WeakPtr<ProxyMain> proxy_main_frame_sink_bound_weak_ptr); void InitializeMutatorOnImpl(std::unique_ptr<LayerTreeMutator> mutator); void MainThreadHasStoppedFlingingOnImpl(); @@ -47,7 +47,7 @@ base::TimeTicks main_thread_start_time, std::vector<std::unique_ptr<SwapPromise>> swap_promises); void SetVisibleOnImpl(bool visible); - void ReleaseCompositorFrameSinkOnImpl(CompletionEvent* completion); + void ReleaseLayerTreeFrameSinkOnImpl(CompletionEvent* completion); void FinishGLOnImpl(CompletionEvent* completion); void NotifyReadyToCommitOnImpl(CompletionEvent* completion, LayerTreeHost* layer_tree_host, @@ -71,7 +71,7 @@ }; // LayerTreeHostImplClient implementation - void DidLoseCompositorFrameSinkOnImplThread() override; + void DidLoseLayerTreeFrameSinkOnImplThread() override; void SetBeginFrameSource(BeginFrameSource* source) override; void DidReceiveCompositorFrameAckOnImplThread() override; void OnCanDrawStateChanged(bool can_draw) override; @@ -94,7 +94,7 @@ void WillPrepareTiles() override; void DidPrepareTiles() override; void DidCompletePageScaleAnimationOnImplThread() override; - void OnDrawForCompositorFrameSink(bool resourceless_software_draw) override; + void OnDrawForLayerTreeFrameSink(bool resourceless_software_draw) override; void NeedsImplSideInvalidation() override; void NotifyImageDecodeRequestFinished() override; @@ -107,9 +107,9 @@ DrawResult ScheduledActionDrawForced() override; void ScheduledActionCommit() override; void ScheduledActionActivateSyncTree() override; - void ScheduledActionBeginCompositorFrameSinkCreation() override; + void ScheduledActionBeginLayerTreeFrameSinkCreation() override; void ScheduledActionPrepareTiles() override; - void ScheduledActionInvalidateCompositorFrameSink() override; + void ScheduledActionInvalidateLayerTreeFrameSink() override; void ScheduledActionPerformImplSideInvalidation() override; void SendBeginMainFrameNotExpectedSoon() override; void ScheduledActionBeginMainFrameNotExpectedUntil( @@ -156,7 +156,7 @@ // Used to post tasks to ProxyMain on the main thread. base::WeakPtr<ProxyMain> proxy_main_weak_ptr_; - // A weak pointer to ProxyMain that is invalidated when CompositorFrameSink is + // A weak pointer to ProxyMain that is invalidated when LayerTreeFrameSink is // released. base::WeakPtr<ProxyMain> proxy_main_frame_sink_bound_weak_ptr_;
diff --git a/cc/trees/proxy_main.cc b/cc/trees/proxy_main.cc index 96058fa..7549d9d 100644 --- a/cc/trees/proxy_main.cc +++ b/cc/trees/proxy_main.cc
@@ -14,7 +14,7 @@ #include "cc/base/completion_event.h" #include "cc/base/devtools_instrumentation.h" #include "cc/benchmarks/benchmark_instrumentation.h" -#include "cc/output/compositor_frame_sink.h" +#include "cc/output/layer_tree_frame_sink.h" #include "cc/output/swap_promise.h" #include "cc/resources/ui_resource_manager.h" #include "cc/trees/blocking_task_runner.h" @@ -92,26 +92,26 @@ layer_tree_host_->SetAnimationEvents(std::move(events)); } -void ProxyMain::DidLoseCompositorFrameSink() { - TRACE_EVENT0("cc", "ProxyMain::DidLoseCompositorFrameSink"); +void ProxyMain::DidLoseLayerTreeFrameSink() { + TRACE_EVENT0("cc", "ProxyMain::DidLoseLayerTreeFrameSink"); DCHECK(IsMainThread()); - layer_tree_host_->DidLoseCompositorFrameSink(); + layer_tree_host_->DidLoseLayerTreeFrameSink(); } -void ProxyMain::RequestNewCompositorFrameSink() { - TRACE_EVENT0("cc", "ProxyMain::RequestNewCompositorFrameSink"); +void ProxyMain::RequestNewLayerTreeFrameSink() { + TRACE_EVENT0("cc", "ProxyMain::RequestNewLayerTreeFrameSink"); DCHECK(IsMainThread()); - layer_tree_host_->RequestNewCompositorFrameSink(); + layer_tree_host_->RequestNewLayerTreeFrameSink(); } -void ProxyMain::DidInitializeCompositorFrameSink(bool success) { - TRACE_EVENT0("cc", "ProxyMain::DidInitializeCompositorFrameSink"); +void ProxyMain::DidInitializeLayerTreeFrameSink(bool success) { + TRACE_EVENT0("cc", "ProxyMain::DidInitializeLayerTreeFrameSink"); DCHECK(IsMainThread()); if (!success) - layer_tree_host_->DidFailToInitializeCompositorFrameSink(); + layer_tree_host_->DidFailToInitializeLayerTreeFrameSink(); else - layer_tree_host_->DidInitializeCompositorFrameSink(); + layer_tree_host_->DidInitializeLayerTreeFrameSink(); } void ProxyMain::DidCompletePageScaleAnimation() { @@ -292,12 +292,12 @@ return false; } -void ProxyMain::SetCompositorFrameSink( - CompositorFrameSink* compositor_frame_sink) { +void ProxyMain::SetLayerTreeFrameSink( + LayerTreeFrameSink* layer_tree_frame_sink) { ImplThreadTaskRunner()->PostTask( FROM_HERE, - base::BindOnce(&ProxyImpl::InitializeCompositorFrameSinkOnImpl, - base::Unretained(proxy_impl_.get()), compositor_frame_sink, + base::BindOnce(&ProxyImpl::InitializeLayerTreeFrameSinkOnImpl, + base::Unretained(proxy_impl_.get()), layer_tree_frame_sink, frame_sink_bound_weak_factory_.GetWeakPtr())); } @@ -475,14 +475,14 @@ return main_frame_will_happen; } -void ProxyMain::ReleaseCompositorFrameSink() { +void ProxyMain::ReleaseLayerTreeFrameSink() { DCHECK(IsMainThread()); frame_sink_bound_weak_factory_.InvalidateWeakPtrs(); DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_); CompletionEvent completion; ImplThreadTaskRunner()->PostTask( FROM_HERE, - base::BindOnce(&ProxyImpl::ReleaseCompositorFrameSinkOnImpl, + base::BindOnce(&ProxyImpl::ReleaseLayerTreeFrameSinkOnImpl, base::Unretained(proxy_impl_.get()), &completion)); completion.Wait(); }
diff --git a/cc/trees/proxy_main.h b/cc/trees/proxy_main.h index 8ca53fa..5007bb29 100644 --- a/cc/trees/proxy_main.h +++ b/cc/trees/proxy_main.h
@@ -15,7 +15,7 @@ class MutatorEvents; class CompletionEvent; -class CompositorFrameSink; +class LayerTreeFrameSink; class LayerTreeHost; class LayerTreeMutator; class ProxyImpl; @@ -45,9 +45,9 @@ void BeginMainFrameNotExpectedUntil(base::TimeTicks time); void DidCommitAndDrawFrame(); void SetAnimationEvents(std::unique_ptr<MutatorEvents> events); - void DidLoseCompositorFrameSink(); - void RequestNewCompositorFrameSink(); - void DidInitializeCompositorFrameSink(bool success); + void DidLoseLayerTreeFrameSink(); + void RequestNewLayerTreeFrameSink(); + void DidInitializeLayerTreeFrameSink(bool success); void DidCompletePageScaleAnimation(); void BeginMainFrame( std::unique_ptr<BeginMainFrameAndCommitState> begin_main_frame_state); @@ -66,8 +66,8 @@ // Proxy implementation. bool IsStarted() const override; bool CommitToActiveTree() const override; - void SetCompositorFrameSink( - CompositorFrameSink* compositor_frame_sink) override; + void SetLayerTreeFrameSink( + LayerTreeFrameSink* layer_tree_frame_sink) override; void SetVisible(bool visible) override; void SetNeedsAnimate() override; void SetNeedsUpdateLayers() override; @@ -83,7 +83,7 @@ bool SupportsImplScrolling() const override; void SetMutator(std::unique_ptr<LayerTreeMutator> mutator) override; bool MainFrameWillHappenForTesting() override; - void ReleaseCompositorFrameSink() override; + void ReleaseLayerTreeFrameSink() override; void UpdateBrowserControlsState(BrowserControlsState constraints, BrowserControlsState current, bool animate) override; @@ -132,7 +132,7 @@ std::unique_ptr<ProxyImpl> proxy_impl_; // WeakPtrs generated by this factory will be invalidated when - // CompositorFrameSink is released. + // LayerTreeFrameSink is released. base::WeakPtrFactory<ProxyMain> frame_sink_bound_weak_factory_; base::WeakPtrFactory<ProxyMain> weak_factory_;
diff --git a/cc/trees/single_thread_proxy.cc b/cc/trees/single_thread_proxy.cc index eb32486..887c412 100644 --- a/cc/trees/single_thread_proxy.cc +++ b/cc/trees/single_thread_proxy.cc
@@ -10,8 +10,8 @@ #include "base/trace_event/trace_event.h" #include "cc/base/devtools_instrumentation.h" #include "cc/benchmarks/benchmark_instrumentation.h" -#include "cc/output/compositor_frame_sink.h" #include "cc/output/context_provider.h" +#include "cc/output/layer_tree_frame_sink.h" #include "cc/quads/draw_quad.h" #include "cc/resources/ui_resource_manager.h" #include "cc/scheduler/commit_earlyout_reason.h" @@ -50,8 +50,8 @@ animate_requested_(false), commit_requested_(false), inside_synchronous_composite_(false), - compositor_frame_sink_creation_requested_(false), - compositor_frame_sink_lost_(true), + layer_tree_frame_sink_creation_requested_(false), + layer_tree_frame_sink_lost_(true), frame_sink_bound_weak_factory_(this), weak_factory_(this) { TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy"); @@ -113,49 +113,49 @@ scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible()); } -void SingleThreadProxy::RequestNewCompositorFrameSink() { +void SingleThreadProxy::RequestNewLayerTreeFrameSink() { DCHECK(task_runner_provider_->IsMainThread()); - compositor_frame_sink_creation_callback_.Cancel(); - if (compositor_frame_sink_creation_requested_) + layer_tree_frame_sink_creation_callback_.Cancel(); + if (layer_tree_frame_sink_creation_requested_) return; - compositor_frame_sink_creation_requested_ = true; - layer_tree_host_->RequestNewCompositorFrameSink(); + layer_tree_frame_sink_creation_requested_ = true; + layer_tree_host_->RequestNewLayerTreeFrameSink(); } -void SingleThreadProxy::ReleaseCompositorFrameSink() { - compositor_frame_sink_lost_ = true; +void SingleThreadProxy::ReleaseLayerTreeFrameSink() { + layer_tree_frame_sink_lost_ = true; frame_sink_bound_weak_factory_.InvalidateWeakPtrs(); if (scheduler_on_impl_thread_) - scheduler_on_impl_thread_->DidLoseCompositorFrameSink(); - return layer_tree_host_impl_->ReleaseCompositorFrameSink(); + scheduler_on_impl_thread_->DidLoseLayerTreeFrameSink(); + return layer_tree_host_impl_->ReleaseLayerTreeFrameSink(); } -void SingleThreadProxy::SetCompositorFrameSink( - CompositorFrameSink* compositor_frame_sink) { +void SingleThreadProxy::SetLayerTreeFrameSink( + LayerTreeFrameSink* layer_tree_frame_sink) { DCHECK(task_runner_provider_->IsMainThread()); - DCHECK(compositor_frame_sink_creation_requested_); + DCHECK(layer_tree_frame_sink_creation_requested_); bool success; { DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_); DebugScopedSetImplThread impl(task_runner_provider_); - success = layer_tree_host_impl_->InitializeRenderer(compositor_frame_sink); + success = layer_tree_host_impl_->InitializeRenderer(layer_tree_frame_sink); } if (success) { frame_sink_bound_weak_ptr_ = frame_sink_bound_weak_factory_.GetWeakPtr(); - layer_tree_host_->DidInitializeCompositorFrameSink(); + layer_tree_host_->DidInitializeLayerTreeFrameSink(); if (scheduler_on_impl_thread_) - scheduler_on_impl_thread_->DidCreateAndInitializeCompositorFrameSink(); + scheduler_on_impl_thread_->DidCreateAndInitializeLayerTreeFrameSink(); else if (!inside_synchronous_composite_) SetNeedsCommit(); - compositor_frame_sink_creation_requested_ = false; - compositor_frame_sink_lost_ = false; + layer_tree_frame_sink_creation_requested_ = false; + layer_tree_frame_sink_lost_ = false; } else { - // DidFailToInitializeCompositorFrameSink is treated as a - // RequestNewCompositorFrameSink, and so - // compositor_frame_sink_creation_requested remains true. - layer_tree_host_->DidFailToInitializeCompositorFrameSink(); + // DidFailToInitializeLayerTreeFrameSink is treated as a + // RequestNewLayerTreeFrameSink, and so + // layer_tree_frame_sink_creation_requested remains true. + layer_tree_host_->DidFailToInitializeLayerTreeFrameSink(); } } @@ -300,9 +300,9 @@ // inconsistent state. if (scheduler_on_impl_thread_) scheduler_on_impl_thread_->Stop(); - // Take away the CompositorFrameSink before destroying things so it doesn't + // Take away the LayerTreeFrameSink before destroying things so it doesn't // try to call into its client mid-shutdown. - layer_tree_host_impl_->ReleaseCompositorFrameSink(); + layer_tree_host_impl_->ReleaseLayerTreeFrameSink(); scheduler_on_impl_thread_ = nullptr; layer_tree_host_impl_ = nullptr; } @@ -407,19 +407,19 @@ layer_tree_host_->DidCompletePageScaleAnimation(); } -void SingleThreadProxy::DidLoseCompositorFrameSinkOnImplThread() { +void SingleThreadProxy::DidLoseLayerTreeFrameSinkOnImplThread() { TRACE_EVENT0("cc", - "SingleThreadProxy::DidLoseCompositorFrameSinkOnImplThread"); + "SingleThreadProxy::DidLoseLayerTreeFrameSinkOnImplThread"); { DebugScopedSetMainThread main(task_runner_provider_); // This must happen before we notify the scheduler as it may try to recreate // the output surface if already in BEGIN_IMPL_FRAME_STATE_IDLE. - layer_tree_host_->DidLoseCompositorFrameSink(); + layer_tree_host_->DidLoseLayerTreeFrameSink(); } - single_thread_client_->DidLoseCompositorFrameSink(); + single_thread_client_->DidLoseLayerTreeFrameSink(); if (scheduler_on_impl_thread_) - scheduler_on_impl_thread_->DidLoseCompositorFrameSink(); - compositor_frame_sink_lost_ = true; + scheduler_on_impl_thread_->DidLoseLayerTreeFrameSink(); + layer_tree_frame_sink_lost_ = true; } void SingleThreadProxy::SetBeginFrameSource(BeginFrameSource* source) { @@ -440,7 +440,7 @@ frame_sink_bound_weak_ptr_)); } -void SingleThreadProxy::OnDrawForCompositorFrameSink( +void SingleThreadProxy::OnDrawForLayerTreeFrameSink( bool resourceless_software_draw) { NOTREACHED() << "Implemented by ThreadProxy for synchronous compositor."; } @@ -478,11 +478,11 @@ #endif base::AutoReset<bool> inside_composite(&inside_synchronous_composite_, true); - if (compositor_frame_sink_lost_) { - RequestNewCompositorFrameSink(); - // RequestNewCompositorFrameSink could have synchronously created an output + if (layer_tree_frame_sink_lost_) { + RequestNewLayerTreeFrameSink(); + // RequestNewLayerTreeFrameSink could have synchronously created an output // surface, so check again before returning. - if (compositor_frame_sink_lost_) + if (layer_tree_frame_sink_lost_) return; } @@ -548,14 +548,14 @@ return layer_tree_host_impl_->visible() && layer_tree_host_impl_->CanDraw(); } -void SingleThreadProxy::ScheduleRequestNewCompositorFrameSink() { - if (compositor_frame_sink_creation_callback_.IsCancelled() && - !compositor_frame_sink_creation_requested_) { - compositor_frame_sink_creation_callback_.Reset( - base::Bind(&SingleThreadProxy::RequestNewCompositorFrameSink, +void SingleThreadProxy::ScheduleRequestNewLayerTreeFrameSink() { + if (layer_tree_frame_sink_creation_callback_.IsCancelled() && + !layer_tree_frame_sink_creation_requested_) { + layer_tree_frame_sink_creation_callback_.Reset( + base::Bind(&SingleThreadProxy::RequestNewLayerTreeFrameSink, weak_factory_.GetWeakPtr())); task_runner_provider_->MainThreadTaskRunner()->PostTask( - FROM_HERE, compositor_frame_sink_creation_callback_.callback()); + FROM_HERE, layer_tree_frame_sink_creation_callback_.callback()); } } @@ -592,7 +592,7 @@ if (draw_frame) { if (layer_tree_host_impl_->DrawLayers(frame)) { if (scheduler_on_impl_thread_) - // Drawing implies we submitted a frame to the CompositorFrameSink. + // Drawing implies we submitted a frame to the LayerTreeFrameSink. scheduler_on_impl_thread_->DidSubmitCompositorFrame(); single_thread_client_->DidSubmitCompositorFrame(); } @@ -775,7 +775,7 @@ layer_tree_host_impl_->ActivateSyncTree(); } -void SingleThreadProxy::ScheduledActionBeginCompositorFrameSinkCreation() { +void SingleThreadProxy::ScheduledActionBeginLayerTreeFrameSinkCreation() { DebugScopedSetMainThread main(task_runner_provider_); DCHECK(scheduler_on_impl_thread_); // If possible, create the output surface in a post task. Synchronously @@ -783,9 +783,9 @@ // from the ThreadProxy behavior. However, sometimes there is no // task runner. if (task_runner_provider_->MainThreadTaskRunner()) { - ScheduleRequestNewCompositorFrameSink(); + ScheduleRequestNewLayerTreeFrameSink(); } else { - RequestNewCompositorFrameSink(); + RequestNewLayerTreeFrameSink(); } } @@ -795,7 +795,7 @@ layer_tree_host_impl_->PrepareTiles(); } -void SingleThreadProxy::ScheduledActionInvalidateCompositorFrameSink() { +void SingleThreadProxy::ScheduledActionInvalidateLayerTreeFrameSink() { NOTREACHED(); }
diff --git a/cc/trees/single_thread_proxy.h b/cc/trees/single_thread_proxy.h index d5eca88a..6bbe3cf 100644 --- a/cc/trees/single_thread_proxy.h +++ b/cc/trees/single_thread_proxy.h
@@ -37,9 +37,9 @@ // Proxy implementation bool IsStarted() const override; bool CommitToActiveTree() const override; - void SetCompositorFrameSink( - CompositorFrameSink* compositor_frame_sink) override; - void ReleaseCompositorFrameSink() override; + void SetLayerTreeFrameSink( + LayerTreeFrameSink* layer_tree_frame_sink) override; + void ReleaseLayerTreeFrameSink() override; void SetVisible(bool visible) override; void SetNeedsAnimate() override; void SetNeedsUpdateLayers() override; @@ -68,16 +68,16 @@ DrawResult ScheduledActionDrawForced() override; void ScheduledActionCommit() override; void ScheduledActionActivateSyncTree() override; - void ScheduledActionBeginCompositorFrameSinkCreation() override; + void ScheduledActionBeginLayerTreeFrameSinkCreation() override; void ScheduledActionPrepareTiles() override; - void ScheduledActionInvalidateCompositorFrameSink() override; + void ScheduledActionInvalidateLayerTreeFrameSink() override; void ScheduledActionPerformImplSideInvalidation() override; void SendBeginMainFrameNotExpectedSoon() override; void ScheduledActionBeginMainFrameNotExpectedUntil( base::TimeTicks time) override; // LayerTreeHostImplClient implementation - void DidLoseCompositorFrameSinkOnImplThread() override; + void DidLoseLayerTreeFrameSinkOnImplThread() override; void SetBeginFrameSource(BeginFrameSource* source) override; void DidReceiveCompositorFrameAckOnImplThread() override; void OnCanDrawStateChanged(bool can_draw) override; @@ -98,12 +98,12 @@ void WillPrepareTiles() override; void DidPrepareTiles() override; void DidCompletePageScaleAnimationOnImplThread() override; - void OnDrawForCompositorFrameSink(bool resourceless_software_draw) override; + void OnDrawForLayerTreeFrameSink(bool resourceless_software_draw) override; void NeedsImplSideInvalidation() override; void RequestBeginMainFrameNotExpected(bool new_state) override; void NotifyImageDecodeRequestFinished() override; - void RequestNewCompositorFrameSink(); + void RequestNewLayerTreeFrameSink(); // Called by the legacy path where RenderWidget does the scheduling. void CompositeImmediately(base::TimeTicks frame_begin_time); @@ -125,7 +125,7 @@ void CommitComplete(); bool ShouldComposite() const; - void ScheduleRequestNewCompositorFrameSink(); + void ScheduleRequestNewLayerTreeFrameSink(); void IssueImageDecodeFinishedCallbacks(); void DidReceiveCompositorFrameAck(); @@ -158,18 +158,18 @@ // True if a request to the LayerTreeHostClient to create an output surface // is still outstanding. - bool compositor_frame_sink_creation_requested_; + bool layer_tree_frame_sink_creation_requested_; // When output surface is lost, is set to true until a new output surface is // initialized. - bool compositor_frame_sink_lost_; + bool layer_tree_frame_sink_lost_; - // This is the callback for the scheduled RequestNewCompositorFrameSink. - base::CancelableClosure compositor_frame_sink_creation_callback_; + // This is the callback for the scheduled RequestNewLayerTreeFrameSink. + base::CancelableClosure layer_tree_frame_sink_creation_callback_; base::WeakPtr<SingleThreadProxy> frame_sink_bound_weak_ptr_; // WeakPtrs generated by this factory will be invalidated when - // CompositorFrameSink is released. + // LayerTreeFrameSink is released. base::WeakPtrFactory<SingleThreadProxy> frame_sink_bound_weak_factory_; base::WeakPtrFactory<SingleThreadProxy> weak_factory_;
diff --git a/chrome/VERSION b/chrome/VERSION index c5e0ce0..d3338854c 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=61 MINOR=0 -BUILD=3137 +BUILD=3138 PATCH=0
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeActionModeCallback.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeActionModeCallback.java index 291faa36..0d899e6 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeActionModeCallback.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeActionModeCallback.java
@@ -10,8 +10,11 @@ import android.view.Menu; import android.view.MenuItem; +import org.chromium.base.Callback; +import org.chromium.base.VisibleForTesting; import org.chromium.base.metrics.RecordUserAction; import org.chromium.chrome.browser.firstrun.FirstRunStatus; +import org.chromium.chrome.browser.locale.LocaleManager; import org.chromium.chrome.browser.omnibox.geo.GeolocationHeader; import org.chromium.chrome.browser.search_engines.TemplateUrlService; import org.chromium.chrome.browser.tab.Tab; @@ -63,7 +66,14 @@ if (!mHelper.isActionModeValid()) return true; if (item.getItemId() == R.id.select_action_menu_web_search) { - search(); + final String selectedText = mHelper.getSelectedText(); + Callback<Boolean> callback = new Callback<Boolean>() { + @Override + public void onResult(Boolean result) { + if (result != null && result) search(selectedText); + } + }; + LocaleManager.getInstance().showSearchEnginePromoIfNeeded(mTab.getActivity(), callback); mHelper.finishActionMode(); } else { return mHelper.onActionItemClicked(mode, item); @@ -83,21 +93,29 @@ } } - private void search() { - RecordUserAction.record("MobileActionMode.WebSearch"); - if (mTab.getTabModelSelector() == null) return; - - String query = ActionModeCallbackHelper.sanitizeQuery(mHelper.getSelectedText(), - ActionModeCallbackHelper.MAX_SEARCH_QUERY_LENGTH); - if (TextUtils.isEmpty(query)) return; - + /** + * Generate the LoadUrlParams necessary to load the specified search query. + */ + @VisibleForTesting + protected LoadUrlParams generateUrlParamsForSearch(String query) { String url = TemplateUrlService.getInstance().getUrlForSearchQuery(query); String headers = GeolocationHeader.getGeoHeader(url, mTab); LoadUrlParams loadUrlParams = new LoadUrlParams(url); loadUrlParams.setVerbatimHeaders(headers); loadUrlParams.setTransitionType(PageTransition.GENERATED); - mTab.getTabModelSelector().openNewTab(loadUrlParams, + return loadUrlParams; + } + + private void search(String searchText) { + RecordUserAction.record("MobileActionMode.WebSearch"); + if (mTab.getTabModelSelector() == null) return; + + String query = ActionModeCallbackHelper.sanitizeQuery( + searchText, ActionModeCallbackHelper.MAX_SEARCH_QUERY_LENGTH); + if (TextUtils.isEmpty(query)) return; + + mTab.getTabModelSelector().openNewTab(generateUrlParamsForSearch(query), TabLaunchType.FROM_LONGPRESS_FOREGROUND, mTab, mTab.isIncognito()); } }
diff --git a/chrome/android/java_sources.gni b/chrome/android/java_sources.gni index 292189ab..a13900f 100644 --- a/chrome/android/java_sources.gni +++ b/chrome/android/java_sources.gni
@@ -1699,6 +1699,7 @@ chrome_junit_test_java_sources = [ "junit/src/org/chromium/chrome/browser/AppIndexingUtilTest.java", + "junit/src/org/chromium/chrome/browser/ChromeActionModeCallbackTest.java", "junit/src/org/chromium/chrome/browser/ChromeBackupAgentTest.java", "junit/src/org/chromium/chrome/browser/DelayedScreenLockIntentHandlerTest.java", "junit/src/org/chromium/chrome/browser/DisableHistogramsRule.java",
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/ChromeActionModeCallbackTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/ChromeActionModeCallbackTest.java new file mode 100644 index 0000000..96e4dfe --- /dev/null +++ b/chrome/android/junit/src/org/chromium/chrome/browser/ChromeActionModeCallbackTest.java
@@ -0,0 +1,110 @@ +// 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; + +import android.app.Activity; +import android.view.ActionMode; +import android.view.Menu; +import android.view.MenuItem; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import org.robolectric.RuntimeEnvironment; +import org.robolectric.annotation.Config; + +import org.chromium.base.Callback; +import org.chromium.base.ContextUtils; +import org.chromium.base.metrics.RecordUserAction; +import org.chromium.chrome.browser.firstrun.FirstRunStatus; +import org.chromium.chrome.browser.locale.LocaleManager; +import org.chromium.chrome.browser.tab.Tab; +import org.chromium.content.R; +import org.chromium.content_public.browser.ActionModeCallbackHelper; +import org.chromium.testing.local.LocalRobolectricTestRunner; + +/** + * Unit tests for the {@link ChromeActionModeCallback}. + */ +@RunWith(LocalRobolectricTestRunner.class) +@Config(manifest = Config.NONE) +public class ChromeActionModeCallbackTest { + @Mock + private Tab mTab; + @Mock + private ActionModeCallbackHelper mActionModeCallbackHelper; + @Mock + private ActionMode mActionMode; + @Mock + private Menu mMenu; + + private ChromeActionModeCallback mActionModeCallback; + + @Before + public void setUp() throws Exception { + MockitoAnnotations.initMocks(this); + ContextUtils.initApplicationContextForTests(RuntimeEnvironment.application); + RecordUserAction.setDisabledForTests(true); + + mActionModeCallback = Mockito.spy(new ChromeActionModeCallback( + RuntimeEnvironment.application, mTab, mActionModeCallbackHelper)); + } + + @After + public void tearDown() { + FirstRunStatus.setFirstRunFlowComplete(false); + RecordUserAction.setDisabledForTests(false); + } + + @Test + public void testOptionsBeforeFre() { + FirstRunStatus.setFirstRunFlowComplete(false); + + mActionModeCallback.onCreateActionMode(mActionMode, mMenu); + + Mockito.verify(mActionModeCallbackHelper) + .setAllowedMenuItems(ActionModeCallbackHelper.MENU_ITEM_PROCESS_TEXT + | ActionModeCallbackHelper.MENU_ITEM_SHARE); + } + + @Test + public void testOptionsAfterFre() { + FirstRunStatus.setFirstRunFlowComplete(true); + + mActionModeCallback.onCreateActionMode(mActionMode, mMenu); + + Mockito.verify(mActionModeCallbackHelper) + .setAllowedMenuItems(ActionModeCallbackHelper.MENU_ITEM_PROCESS_TEXT + | ActionModeCallbackHelper.MENU_ITEM_SHARE + | ActionModeCallbackHelper.MENU_ITEM_WEB_SEARCH); + } + + @Test + public void testShareTriggersSearchPromo() { + FirstRunStatus.setFirstRunFlowComplete(true); + + Mockito.when(mActionModeCallbackHelper.isActionModeValid()).thenReturn(true); + Mockito.when(mActionModeCallbackHelper.getSelectedText()).thenReturn("OhHai"); + + LocaleManager localeManager = Mockito.spy(new LocaleManager() { + @Override + public void showSearchEnginePromoIfNeeded( + Activity activity, Callback<Boolean> onSearchEngineFinalized) { + onSearchEngineFinalized.onResult(true); + } + }); + LocaleManager.setInstanceForTest(localeManager); + + MenuItem shareItem = Mockito.mock(MenuItem.class); + Mockito.when(shareItem.getItemId()).thenReturn(R.id.select_action_menu_web_search); + mActionModeCallback.onActionItemClicked(mActionMode, shareItem); + + Mockito.verify(localeManager).showSearchEnginePromoIfNeeded(Mockito.any(), Mockito.any()); + } +}
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index a97a8ba..057b1ec0 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -848,6 +848,8 @@ "page_load_metrics/observers/lofi_page_load_metrics_observer.h", "page_load_metrics/observers/media_page_load_metrics_observer.cc", "page_load_metrics/observers/media_page_load_metrics_observer.h", + "page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer.cc", + "page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer.h", "page_load_metrics/observers/no_state_prefetch_page_load_metrics_observer.cc", "page_load_metrics/observers/no_state_prefetch_page_load_metrics_observer.h", "page_load_metrics/observers/omnibox_suggestion_used_page_load_metrics_observer.cc", @@ -1162,32 +1164,6 @@ "resource_delegate_mac.mm", "resources_util.cc", "resources_util.h", - "safe_browsing/browser_url_loader_throttle.cc", - "safe_browsing/browser_url_loader_throttle.h", - "safe_browsing/chrome_cleaner/chrome_cleaner_controller_win.cc", - "safe_browsing/chrome_cleaner/chrome_cleaner_controller_win.h", - "safe_browsing/chrome_cleaner/chrome_cleaner_fetcher_win.cc", - "safe_browsing/chrome_cleaner/chrome_cleaner_fetcher_win.h", - "safe_browsing/chrome_cleaner/chrome_cleaner_runner_win.cc", - "safe_browsing/chrome_cleaner/chrome_cleaner_runner_win.h", - "safe_browsing/chrome_cleaner/reporter_runner_win.cc", - "safe_browsing/chrome_cleaner/reporter_runner_win.h", - "safe_browsing/chrome_cleaner/settings_resetter_win.cc", - "safe_browsing/chrome_cleaner/settings_resetter_win.h", - "safe_browsing/chrome_cleaner/srt_chrome_prompt_impl.cc", - "safe_browsing/chrome_cleaner/srt_chrome_prompt_impl.h", - "safe_browsing/chrome_cleaner/srt_client_info_win.cc", - "safe_browsing/chrome_cleaner/srt_client_info_win.h", - "safe_browsing/chrome_cleaner/srt_field_trial_win.cc", - "safe_browsing/chrome_cleaner/srt_field_trial_win.h", - "safe_browsing/chrome_cleaner/srt_global_error_win.cc", - "safe_browsing/chrome_cleaner/srt_global_error_win.h", - "safe_browsing/mojo_safe_browsing_impl.cc", - "safe_browsing/mojo_safe_browsing_impl.h", - "safe_browsing/safe_browsing_tab_observer.cc", - "safe_browsing/safe_browsing_tab_observer.h", - "safe_browsing/safe_browsing_url_checker_impl.cc", - "safe_browsing/safe_browsing_url_checker_impl.h", "safe_search_api/safe_search_url_checker.cc", "safe_search_api/safe_search_url_checker.h", "search/iframe_source.cc", @@ -1496,6 +1472,7 @@ "//chrome/browser/media/router", "//chrome/browser/metrics/variations:chrome_ui_string_overrider_factory", "//chrome/browser/net:probe_message_proto", + "//chrome/browser/safe_browsing", "//chrome/browser/ssl:proto", "//chrome/browser/ui", "//chrome/common/net", @@ -1586,7 +1563,6 @@ "//components/rappor:rappor_recorder", "//components/renderer_context_menu", "//components/resources", - "//components/safe_browsing/common:interfaces", "//components/safe_json", "//components/search", "//components/search_engines", @@ -1833,20 +1809,6 @@ "renderer_context_menu/context_menu_content_type_platform_app.h", "renderer_host/chrome_extension_message_filter.cc", "renderer_host/chrome_extension_message_filter.h", - "safe_browsing/chrome_cleaner/chrome_cleaner_dialog_controller_win.cc", - "safe_browsing/chrome_cleaner/chrome_cleaner_dialog_controller_win.h", - "safe_browsing/settings_reset_prompt/default_settings_fetcher.cc", - "safe_browsing/settings_reset_prompt/default_settings_fetcher.h", - "safe_browsing/settings_reset_prompt/extension_info.cc", - "safe_browsing/settings_reset_prompt/extension_info.h", - "safe_browsing/settings_reset_prompt/settings_reset_prompt_config.cc", - "safe_browsing/settings_reset_prompt/settings_reset_prompt_config.h", - "safe_browsing/settings_reset_prompt/settings_reset_prompt_controller.cc", - "safe_browsing/settings_reset_prompt/settings_reset_prompt_controller.h", - "safe_browsing/settings_reset_prompt/settings_reset_prompt_model.cc", - "safe_browsing/settings_reset_prompt/settings_reset_prompt_model.h", - "safe_browsing/settings_reset_prompt/settings_reset_prompt_prefs_manager.cc", - "safe_browsing/settings_reset_prompt/settings_reset_prompt_prefs_manager.h", "search/hotword_audio_history_handler.cc", "search/hotword_audio_history_handler.h", "search/hotword_client.h", @@ -2252,184 +2214,6 @@ ] } - if (safe_browsing_mode != 0) { - # "Safe Browsing Basic" files used for safe browsing in full mode - # (safe_browsing=1) and mobile (=2) - sources += [ - "loader/data_reduction_proxy_resource_throttle_android.cc", - "loader/data_reduction_proxy_resource_throttle_android.h", - "safe_browsing/certificate_reporting_metrics_provider.cc", - "safe_browsing/certificate_reporting_metrics_provider.h", - "safe_browsing/certificate_reporting_service.cc", - "safe_browsing/certificate_reporting_service.h", - "safe_browsing/certificate_reporting_service_factory.cc", - "safe_browsing/certificate_reporting_service_factory.h", - "safe_browsing/notification_image_reporter.cc", - "safe_browsing/notification_image_reporter.h", - "safe_browsing/permission_reporter.cc", - "safe_browsing/permission_reporter.h", - "safe_browsing/ping_manager.cc", - "safe_browsing/ping_manager.h", - "safe_browsing/safe_browsing_blocking_page.cc", - "safe_browsing/safe_browsing_blocking_page.h", - "safe_browsing/safe_browsing_navigation_observer.cc", - "safe_browsing/safe_browsing_navigation_observer.h", - "safe_browsing/safe_browsing_navigation_observer_manager.cc", - "safe_browsing/safe_browsing_navigation_observer_manager.h", - "safe_browsing/safe_browsing_service.cc", - "safe_browsing/safe_browsing_service.h", - "safe_browsing/services_delegate.h", - "safe_browsing/test_safe_browsing_blocking_page_quiet.cc", - "safe_browsing/test_safe_browsing_blocking_page_quiet.h", - "safe_browsing/test_safe_browsing_service.cc", - "safe_browsing/test_safe_browsing_service.h", - "safe_browsing/ui_manager.cc", - "safe_browsing/ui_manager.h", - ] - deps += [ - "//chrome/browser/safe_browsing:chunk_proto", - "//chrome/common/safe_browsing:proto", - "//components/safe_browsing:csd_proto", - "//components/safe_browsing:safe_browsing", - "//components/safe_browsing/browser:browser", - "//components/safe_browsing/common:common", - "//components/safe_browsing/password_protection", - "//components/safe_browsing/triggers:triggers", - "//components/safe_browsing_db:metadata_proto", - ] - if (safe_browsing_mode == 1) { - # "Safe Browsing Full" files in addition to the "basic" ones to use for - # full safe browsing. This has some in common with "mobile." - sources += [ - "download/download_completion_blocker.cc", - "download/download_completion_blocker.h", - "loader/safe_browsing_resource_throttle.cc", - "loader/safe_browsing_resource_throttle.h", - "safe_browsing/browser_feature_extractor.cc", - "safe_browsing/browser_feature_extractor.h", - "safe_browsing/browser_features.cc", - "safe_browsing/browser_features.h", - "safe_browsing/chrome_password_protection_service.cc", - "safe_browsing/chrome_password_protection_service.h", - "safe_browsing/chunk_range.cc", - "safe_browsing/chunk_range.h", - "safe_browsing/client_side_detection_host.cc", - "safe_browsing/client_side_detection_host.h", - "safe_browsing/client_side_detection_service.cc", - "safe_browsing/client_side_detection_service.h", - "safe_browsing/client_side_model_loader.cc", - "safe_browsing/client_side_model_loader.h", - "safe_browsing/download_feedback.cc", - "safe_browsing/download_feedback.h", - "safe_browsing/download_feedback_service.cc", - "safe_browsing/download_feedback_service.h", - "safe_browsing/download_protection_service.cc", - "safe_browsing/download_protection_service.h", - "safe_browsing/incident_reporting/binary_integrity_analyzer.cc", - "safe_browsing/incident_reporting/binary_integrity_analyzer.h", - "safe_browsing/incident_reporting/binary_integrity_analyzer_mac.cc", - "safe_browsing/incident_reporting/binary_integrity_analyzer_mac.h", - "safe_browsing/incident_reporting/binary_integrity_analyzer_win.cc", - "safe_browsing/incident_reporting/binary_integrity_analyzer_win.h", - "safe_browsing/incident_reporting/binary_integrity_incident.cc", - "safe_browsing/incident_reporting/binary_integrity_incident.h", - "safe_browsing/incident_reporting/blacklist_load_analyzer.cc", - "safe_browsing/incident_reporting/blacklist_load_analyzer.h", - "safe_browsing/incident_reporting/blacklist_load_analyzer_win.cc", - "safe_browsing/incident_reporting/blacklist_load_incident.cc", - "safe_browsing/incident_reporting/blacklist_load_incident.h", - "safe_browsing/incident_reporting/delayed_analysis_callback.h", - "safe_browsing/incident_reporting/delayed_callback_runner.cc", - "safe_browsing/incident_reporting/delayed_callback_runner.h", - "safe_browsing/incident_reporting/download_metadata_manager.cc", - "safe_browsing/incident_reporting/download_metadata_manager.h", - "safe_browsing/incident_reporting/environment_data_collection.cc", - "safe_browsing/incident_reporting/environment_data_collection.h", - "safe_browsing/incident_reporting/environment_data_collection_win.cc", - "safe_browsing/incident_reporting/environment_data_collection_win.h", - "safe_browsing/incident_reporting/extension_data_collection.cc", - "safe_browsing/incident_reporting/extension_data_collection.h", - "safe_browsing/incident_reporting/incident.cc", - "safe_browsing/incident_reporting/incident.h", - "safe_browsing/incident_reporting/incident_handler_util.cc", - "safe_browsing/incident_reporting/incident_handler_util.h", - "safe_browsing/incident_reporting/incident_receiver.h", - "safe_browsing/incident_reporting/incident_report_uploader.cc", - "safe_browsing/incident_reporting/incident_report_uploader.h", - "safe_browsing/incident_reporting/incident_report_uploader_impl.cc", - "safe_browsing/incident_reporting/incident_report_uploader_impl.h", - "safe_browsing/incident_reporting/incident_reporting_service.cc", - "safe_browsing/incident_reporting/incident_reporting_service.h", - "safe_browsing/incident_reporting/last_download_finder.cc", - "safe_browsing/incident_reporting/last_download_finder.h", - "safe_browsing/incident_reporting/module_integrity_verifier_win.cc", - "safe_browsing/incident_reporting/module_integrity_verifier_win.h", - "safe_browsing/incident_reporting/module_load_analyzer.cc", - "safe_browsing/incident_reporting/module_load_analyzer.h", - "safe_browsing/incident_reporting/module_load_analyzer_win.cc", - "safe_browsing/incident_reporting/platform_state_store.cc", - "safe_browsing/incident_reporting/platform_state_store.h", - "safe_browsing/incident_reporting/platform_state_store_win.cc", - "safe_browsing/incident_reporting/preference_validation_delegate.cc", - "safe_browsing/incident_reporting/preference_validation_delegate.h", - "safe_browsing/incident_reporting/resource_request_detector.cc", - "safe_browsing/incident_reporting/resource_request_detector.h", - "safe_browsing/incident_reporting/resource_request_incident.cc", - "safe_browsing/incident_reporting/resource_request_incident.h", - "safe_browsing/incident_reporting/state_store.cc", - "safe_browsing/incident_reporting/state_store.h", - "safe_browsing/incident_reporting/suspicious_module_incident.cc", - "safe_browsing/incident_reporting/suspicious_module_incident.h", - "safe_browsing/incident_reporting/tracked_preference_incident.cc", - "safe_browsing/incident_reporting/tracked_preference_incident.h", - "safe_browsing/incident_reporting/variations_seed_signature_analyzer.cc", - "safe_browsing/incident_reporting/variations_seed_signature_analyzer.h", - "safe_browsing/incident_reporting/variations_seed_signature_incident.cc", - "safe_browsing/incident_reporting/variations_seed_signature_incident.h", - "safe_browsing/local_database_manager.cc", - "safe_browsing/local_database_manager.h", - "safe_browsing/path_sanitizer.cc", - "safe_browsing/path_sanitizer.h", - "safe_browsing/protocol_manager.cc", - "safe_browsing/protocol_manager.h", - "safe_browsing/protocol_parser.cc", - "safe_browsing/protocol_parser.h", - "safe_browsing/safe_browsing_database.cc", - "safe_browsing/safe_browsing_database.h", - "safe_browsing/safe_browsing_store.cc", - "safe_browsing/safe_browsing_store.h", - "safe_browsing/safe_browsing_store_file.cc", - "safe_browsing/safe_browsing_store_file.h", - "safe_browsing/safe_browsing_util.cc", - "safe_browsing/safe_browsing_util.h", - "safe_browsing/sandboxed_dmg_analyzer_mac.cc", - "safe_browsing/sandboxed_dmg_analyzer_mac.h", - "safe_browsing/sandboxed_zip_analyzer.cc", - "safe_browsing/sandboxed_zip_analyzer.h", - "safe_browsing/services_delegate_impl.cc", - "safe_browsing/services_delegate_impl.h", - "safe_browsing/signature_evaluator_mac.h", - "safe_browsing/signature_evaluator_mac.mm", - "safe_browsing/two_phase_uploader.cc", - "safe_browsing/two_phase_uploader.h", - "safe_browsing/v4_test_utils.cc", - "safe_browsing/v4_test_utils.h", - ] - deps += [ "//components/safe_browsing_db:safe_browsing_db" ] - if (is_win) { - deps += [ "//chrome/browser/safe_browsing/incident_reporting:state_store_data_proto" ] - } - } else if (safe_browsing_mode == 2) { - sources += [ - "loader/safe_browsing_resource_throttle.cc", - "loader/safe_browsing_resource_throttle.h", - "safe_browsing/services_delegate_stub.cc", - "safe_browsing/services_delegate_stub.h", - ] - deps += [ "//components/safe_browsing_db:safe_browsing_db_mobile" ] - } - } - if (enable_hotwording) { defines += [ "ENABLE_HOTWORDING" ] }
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 3819af3..949641d 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -2746,6 +2746,11 @@ flag_descriptions::kEnableAutofillCreditCardUploadCvcPromptDescription, kOsDesktop, FEATURE_VALUE_TYPE(autofill::kAutofillUpstreamRequestCvcIfMissing)}, + {"enable-autofill-credit-card-bank-name-display", + flag_descriptions::kEnableAutofillCreditCardBankNameDisplayName, + flag_descriptions::kEnableAutofillCreditCardBankNameDisplayDescription, + kOsAll, FEATURE_VALUE_TYPE(autofill::kAutofillCreditCardBankNameDisplay)}, + #if defined(OS_WIN) {"windows10-custom-titlebar", flag_descriptions::kWindows10CustomTitlebarName,
diff --git a/chrome/browser/chromeos/input_method/input_method_manager_impl_unittest.cc b/chrome/browser/chromeos/input_method/input_method_manager_impl_unittest.cc index be2d234..3e657f0 100644 --- a/chrome/browser/chromeos/input_method/input_method_manager_impl_unittest.cc +++ b/chrome/browser/chromeos/input_method/input_method_manager_impl_unittest.cc
@@ -83,16 +83,16 @@ // ash::mojom::ImeController: void SetClient(ash::mojom::ImeControllerClientPtr client) override {} - void RefreshIme(ash::mojom::ImeInfoPtr current_ime, + void RefreshIme(const std::string& current_ime_id, std::vector<ash::mojom::ImeInfoPtr> available_imes, std::vector<ash::mojom::ImeMenuItemPtr> menu_items) override { - current_ime_ = std::move(current_ime); + current_ime_id_ = current_ime_id; available_imes_ = std::move(available_imes); } void SetImesManagedByPolicy(bool managed) override {} void ShowImeMenuOnShelf(bool show) override {} - ash::mojom::ImeInfoPtr current_ime_; + std::string current_ime_id_; std::vector<ash::mojom::ImeInfoPtr> available_imes_; private: @@ -1614,12 +1614,12 @@ // Ash received the IMEs. ASSERT_EQ(3u, ime_controller.available_imes_.size()); - EXPECT_EQ(ImeIdFromEngineId(ids[0]), ime_controller.current_ime_->id); + EXPECT_EQ(ImeIdFromEngineId(ids[0]), ime_controller.current_ime_id_); // Switch to Mozc. manager_->GetActiveIMEState()->SwitchToNextInputMethod(); ime_controller_client.FlushMojoForTesting(); - EXPECT_EQ(ImeIdFromEngineId(ids[1]), ime_controller.current_ime_->id); + EXPECT_EQ(ImeIdFromEngineId(ids[1]), ime_controller.current_ime_id_); // Lock the screen. scoped_refptr<input_method::InputMethodManager::State> saved_ime_state = @@ -1630,19 +1630,19 @@ ime_controller_client.FlushMojoForTesting(); EXPECT_EQ(2u, ime_controller.available_imes_.size()); // Qwerty+Dvorak. EXPECT_EQ(ImeIdFromEngineId("xkb:us:dvorak:eng"), - ime_controller.current_ime_->id); + ime_controller.current_ime_id_); manager_->GetActiveIMEState()->SwitchToNextInputMethod(); ime_controller_client.FlushMojoForTesting(); EXPECT_EQ(ImeIdFromEngineId("xkb:us::eng"), // The hardware keyboard layout. - ime_controller.current_ime_->id); + ime_controller.current_ime_id_); // Unlock screen. The original state, pinyin-dv, is restored. manager_->SetState(saved_ime_state); manager_->SetUISessionState(InputMethodManager::STATE_BROWSER_SCREEN); ime_controller_client.FlushMojoForTesting(); ASSERT_EQ(3u, ime_controller.available_imes_.size()); // Dvorak and 2 IMEs. - EXPECT_EQ(ImeIdFromEngineId(ids[1]), ime_controller.current_ime_->id); + EXPECT_EQ(ImeIdFromEngineId(ids[1]), ime_controller.current_ime_id_); } } // namespace input_method
diff --git a/chrome/browser/chromeos/login/app_launch_signin_screen.cc b/chrome/browser/chromeos/login/app_launch_signin_screen.cc index 882252e..62e11a9 100644 --- a/chrome/browser/chromeos/login/app_launch_signin_screen.cc +++ b/chrome/browser/chromeos/login/app_launch_signin_screen.cc
@@ -217,10 +217,10 @@ for (user_manager::UserList::const_iterator it = users.begin(); it != users.end(); ++it) { - proximity_auth::ScreenlockBridge::LockHandler::AuthType initial_auth_type = + proximity_auth::mojom::AuthType initial_auth_type = UserSelectionScreen::ShouldForceOnlineSignIn(*it) - ? proximity_auth::ScreenlockBridge::LockHandler::ONLINE_SIGN_IN - : proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD; + ? proximity_auth::mojom::AuthType::ONLINE_SIGN_IN + : proximity_auth::mojom::AuthType::OFFLINE_PASSWORD; auto user_dict = base::MakeUnique<base::DictionaryValue>(); UserSelectionScreen::FillUserDictionary( *it, true, /* is_owner */
diff --git a/chrome/browser/chromeos/login/lock/views_screen_locker.cc b/chrome/browser/chromeos/login/lock/views_screen_locker.cc index d68c666..9e74501 100644 --- a/chrome/browser/chromeos/login/lock/views_screen_locker.cc +++ b/chrome/browser/chromeos/login/lock/views_screen_locker.cc
@@ -52,8 +52,9 @@ void ViewsScreenLocker::Init() { lock_time_ = base::TimeTicks::Now(); user_selection_screen_->Init(screen_locker_->users()); - LockScreenClient::Get()->LoadUsers(user_selection_screen_->PrepareUserList(), - false /* show_guests */); + LockScreenClient::Get()->LoadUsers( + user_selection_screen_->UpdateAndReturnUserListForMojo(), + false /* show_guests */); if (!ime_state_.get()) ime_state_ = input_method::InputMethodManager::Get()->GetActiveIMEState();
diff --git a/chrome/browser/chromeos/login/screens/user_selection_screen.cc b/chrome/browser/chromeos/login/screens/user_selection_screen.cc index 8116cb60..47ff013 100644 --- a/chrome/browser/chromeos/login/screens/user_selection_screen.cc +++ b/chrome/browser/chromeos/login/screens/user_selection_screen.cc
@@ -14,6 +14,7 @@ #include "base/location.h" #include "base/logging.h" #include "base/memory/ptr_util.h" +#include "base/strings/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process_platform_part.h" @@ -31,6 +32,7 @@ #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" #include "chrome/grit/generated_resources.h" +#include "chrome/grit/theme_resources.h" #include "chromeos/chromeos_switches.h" #include "chromeos/cryptohome/cryptohome_parameters.h" #include "chromeos/dbus/cryptohome_client.h" @@ -44,6 +46,7 @@ #include "components/user_manager/user_manager.h" #include "components/user_manager/user_type.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/resource/resource_bundle.h" #include "ui/base/user_activity/user_activity_detector.h" namespace chromeos { @@ -130,7 +133,7 @@ // Returns true if the fingerprint icon should be displayed for the given // |user|. -bool AllowFingerprintForUser(user_manager::User* user) { +bool AllowFingerprintForUser(const user_manager::User* user) { if (!user->is_logged_in()) return false; @@ -156,6 +159,63 @@ user_manager::UserManager::Get()->FindUser(account_id)); } +AccountId GetOwnerAccountId() { + std::string owner_email; + chromeos::CrosSettings::Get()->GetString(chromeos::kDeviceOwner, + &owner_email); + const AccountId owner = user_manager::known_user::GetAccountId( + owner_email, std::string() /* id */, AccountType::UNKNOWN); + return owner; +} + +bool IsEnterpriseManaged() { + policy::BrowserPolicyConnectorChromeOS* connector = + g_browser_process->platform_part()->browser_policy_connector_chromeos(); + return connector->IsEnterpriseManaged(); +} + +bool IsSigninToAdd() { + return LoginDisplayHost::default_host() && + user_manager::UserManager::Get()->IsUserLoggedIn(); +} + +bool CanRemoveUser(bool is_single_user, const user_manager::User* user) { + // Single user check here is necessary because owner info might not be + // available when running into login screen on first boot. + // See http://crosbug.com/12723 + if (is_single_user && !IsEnterpriseManaged()) + return false; + if (!user->GetAccountId().is_valid()) + return false; + if (user->GetAccountId() == GetOwnerAccountId()) + return false; + if (user->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT || + user->is_logged_in() || IsSigninToAdd()) + return false; + + return true; +} + +void GetMultiProfilePolicy(const user_manager::User* user, + bool* out_is_allowed, + ash::mojom::MultiProfileUserBehavior* out_policy) { + const std::string& user_id = user->GetAccountId().GetUserEmail(); + MultiProfileUserController* multi_profile_user_controller = + ChromeUserManager::Get()->GetMultiProfileUserController(); + MultiProfileUserController::UserAllowedInSessionReason is_user_allowed_reason; + *out_is_allowed = multi_profile_user_controller->IsUserAllowedInSession( + user_id, &is_user_allowed_reason); + + std::string policy; + if (is_user_allowed_reason == + MultiProfileUserController::NOT_ALLOWED_OWNER_AS_SECONDARY) { + policy = MultiProfileUserController::kBehaviorOwnerPrimaryOnly; + } else { + policy = multi_profile_user_controller->GetCachedValue(user_id); + } + *out_policy = MultiProfileUserController::UserBehaviorStringToEnum(policy); +} + } // namespace // Helper class to call cryptohome to check whether a user needs dircrypto @@ -274,7 +334,7 @@ user_manager::User* user, bool is_owner, bool is_signin_to_add, - AuthType auth_type, + proximity_auth::mojom::AuthType auth_type, const std::vector<std::string>* public_session_recommended_locales, base::DictionaryValue* user_dict) { const bool is_public_session = @@ -290,7 +350,7 @@ user_dict->SetBoolean(kKeyLegacySupervisedUser, is_legacy_supervised_user); user_dict->SetBoolean(kKeyChildUser, is_child_user); user_dict->SetBoolean(kKeyDesktopUser, false); - user_dict->SetInteger(kKeyInitialAuthType, auth_type); + user_dict->SetInteger(kKeyInitialAuthType, static_cast<int>(auth_type)); user_dict->SetBoolean(kKeySignedIn, user->is_logged_in()); user_dict->SetBoolean(kKeyIsOwner, is_owner); user_dict->SetBoolean(kKeyIsActiveDirectory, user->IsActiveDirectoryUser()); @@ -319,31 +379,16 @@ user_manager::User* user, base::DictionaryValue* user_dict, bool is_signin_to_add) { - const std::string& user_id = user->GetAccountId().GetUserEmail(); - - if (is_signin_to_add) { - MultiProfileUserController* multi_profile_user_controller = - ChromeUserManager::Get()->GetMultiProfileUserController(); - MultiProfileUserController::UserAllowedInSessionReason isUserAllowedReason; - bool isUserAllowed = multi_profile_user_controller->IsUserAllowedInSession( - user_id, &isUserAllowedReason); - user_dict->SetBoolean(kKeyMultiProfilesAllowed, isUserAllowed); - - std::string behavior; - switch (isUserAllowedReason) { - case MultiProfileUserController::NOT_ALLOWED_OWNER_AS_SECONDARY: - behavior = MultiProfileUserController::kBehaviorOwnerPrimaryOnly; - break; - default: - behavior = multi_profile_user_controller->GetCachedValue(user_id); - } - MultiProfileUserController::MultiProfileUserBehavior user_behavior = - MultiProfileUserController::UserBehaviorStringToEnum(behavior); - user_dict->SetInteger(kKeyMultiProfilesPolicy, - static_cast<int>(user_behavior)); - } else { + if (!is_signin_to_add) { user_dict->SetBoolean(kKeyMultiProfilesAllowed, true); + return; } + + bool is_user_allowed; + ash::mojom::MultiProfileUserBehavior policy; + GetMultiProfilePolicy(user, &is_user_allowed, &policy); + user_dict->SetBoolean(kKeyMultiProfilesAllowed, is_user_allowed); + user_dict->SetInteger(kKeyMultiProfilesPolicy, static_cast<int>(policy)); } // static @@ -387,6 +432,39 @@ token_status == user_manager::User::OAUTH_TOKEN_STATUS_UNKNOWN)); } +// static +void UserSelectionScreen::FillUserMojoStruct( + const user_manager::User* user, + bool is_owner, + bool is_signin_to_add, + proximity_auth::mojom::AuthType auth_type, + ash::mojom::LoginUserInfo* user_info) { + user_info->basic_user_info = ash::mojom::UserInfo::New(); + user_info->basic_user_info->type = user->GetType(); + user_info->basic_user_info->account_id = user->GetAccountId(); + user_info->basic_user_info->display_name = + base::UTF16ToUTF8(user->GetDisplayName()); + user_info->basic_user_info->display_email = user->display_email(); + user_info->basic_user_info->avatar = user->GetImage(); + if (user_info->basic_user_info->avatar.isNull()) { + user_info->basic_user_info->avatar = + *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( + IDR_PROFILE_PICTURE_LOADING); + } + user_info->auth_type = auth_type; + user_info->is_signed_in = user->is_logged_in(); + user_info->is_device_owner = is_owner; + user_info->allow_fingerprint_unlock = AllowFingerprintForUser(user); + + // Fill multi-profile data. + if (!is_signin_to_add) { + user_info->is_multiprofile_allowed = true; + } else { + GetMultiProfilePolicy(user, &user_info->is_multiprofile_allowed, + &user_info->multiprofile_policy); + } +} + void UserSelectionScreen::SetHandler(LoginDisplayWebUIHandler* handler) { handler_ = handler; @@ -485,7 +563,8 @@ } void UserSelectionScreen::SendUserList() { - std::unique_ptr<base::ListValue> users_list = PrepareUserList(); + std::unique_ptr<base::ListValue> users_list = + UpdateAndReturnUserListForWebUI(); handler_->LoadUsers(users_to_send_, *users_list); } @@ -525,27 +604,32 @@ if (status == TokenHandleUtil::INVALID) { RecordReauthReason(account_id, ReauthReason::INVALID_TOKEN_HANDLE); token_handle_util_->MarkHandleInvalid(account_id); - SetAuthType(account_id, ONLINE_SIGN_IN, base::string16()); + SetAuthType(account_id, proximity_auth::mojom::AuthType::ONLINE_SIGN_IN, + base::string16()); } } // EasyUnlock stuff void UserSelectionScreen::SetAuthType(const AccountId& account_id, - AuthType auth_type, + proximity_auth::mojom::AuthType auth_type, const base::string16& initial_value) { - if (GetAuthType(account_id) == FORCE_OFFLINE_PASSWORD) + if (GetAuthType(account_id) == + proximity_auth::mojom::AuthType::FORCE_OFFLINE_PASSWORD) { return; - DCHECK(GetAuthType(account_id) != FORCE_OFFLINE_PASSWORD || - auth_type == FORCE_OFFLINE_PASSWORD); + } + + DCHECK(GetAuthType(account_id) != + proximity_auth::mojom::AuthType::FORCE_OFFLINE_PASSWORD || + auth_type == proximity_auth::mojom::AuthType::FORCE_OFFLINE_PASSWORD); user_auth_type_map_[account_id] = auth_type; view_->SetAuthType(account_id, auth_type, initial_value); } -proximity_auth::ScreenlockBridge::LockHandler::AuthType -UserSelectionScreen::GetAuthType(const AccountId& account_id) const { +proximity_auth::mojom::AuthType UserSelectionScreen::GetAuthType( + const AccountId& account_id) const { if (user_auth_type_map_.find(account_id) == user_auth_type_map_.end()) - return OFFLINE_PASSWORD; + return proximity_auth::mojom::AuthType::OFFLINE_PASSWORD; return user_auth_type_map_.find(account_id)->second; } @@ -608,7 +692,9 @@ void UserSelectionScreen::Hide() {} void UserSelectionScreen::HardLockPod(const AccountId& account_id) { - view_->SetAuthType(account_id, OFFLINE_PASSWORD, base::string16()); + view_->SetAuthType(account_id, + proximity_auth::mojom::AuthType::OFFLINE_PASSWORD, + base::string16()); EasyUnlockService* service = GetEasyUnlockServiceForUser(account_id); if (!service) return; @@ -629,24 +715,16 @@ service->RecordClickOnLockIcon(); } -std::unique_ptr<base::ListValue> UserSelectionScreen::PrepareUserList() { +std::unique_ptr<base::ListValue> +UserSelectionScreen::UpdateAndReturnUserListForWebUI() { std::unique_ptr<base::ListValue> users_list = base::MakeUnique<base::ListValue>(); // TODO(nkostylev): Move to a separate method in UserManager. // http://crbug.com/230852 - bool single_user = users_.size() == 1; - bool is_signin_to_add = LoginDisplayHost::default_host() && - user_manager::UserManager::Get()->IsUserLoggedIn(); - std::string owner_email; - chromeos::CrosSettings::Get()->GetString(chromeos::kDeviceOwner, - &owner_email); - const AccountId owner = user_manager::known_user::GetAccountId( - owner_email, std::string() /* id */, AccountType::UNKNOWN); - - policy::BrowserPolicyConnectorChromeOS* connector = - g_browser_process->platform_part()->browser_policy_connector_chromeos(); - bool is_enterprise_managed = connector->IsEnterpriseManaged(); + const bool single_user = users_.size() == 1; + const AccountId owner = GetOwnerAccountId(); + const bool is_signin_to_add = IsSigninToAdd(); users_to_send_ = PrepareUserListForSending(users_, owner, is_signin_to_add); @@ -659,10 +737,12 @@ bool is_owner = (account_id == owner); const bool is_public_account = ((*it)->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT); - const AuthType initial_auth_type = - is_public_account ? EXPAND_THEN_USER_CLICK - : (ShouldForceOnlineSignIn(*it) ? ONLINE_SIGN_IN - : OFFLINE_PASSWORD); + const proximity_auth::mojom::AuthType initial_auth_type = + is_public_account + ? proximity_auth::mojom::AuthType::EXPAND_THEN_USER_CLICK + : (ShouldForceOnlineSignIn(*it) + ? proximity_auth::mojom::AuthType::ONLINE_SIGN_IN + : proximity_auth::mojom::AuthType::OFFLINE_PASSWORD); user_auth_type_map_[account_id] = initial_auth_type; auto user_dict = base::MakeUnique<base::DictionaryValue>(); @@ -673,21 +753,49 @@ : &public_session_recommended_locales_[account_id]; FillUserDictionary(*it, is_owner, is_signin_to_add, initial_auth_type, public_session_recommended_locales, user_dict.get()); - bool signed_in = (*it)->is_logged_in(); - - // Single user check here is necessary because owner info might not be - // available when running into login screen on first boot. - // See http://crosbug.com/12723 - bool can_remove_user = - ((!single_user || is_enterprise_managed) && account_id.is_valid() && - !is_owner && !is_public_account && !signed_in && !is_signin_to_add); - user_dict->SetBoolean(kKeyCanRemove, can_remove_user); + user_dict->SetBoolean(kKeyCanRemove, CanRemoveUser(single_user, *it)); users_list->Append(std::move(user_dict)); } return users_list; } +std::vector<ash::mojom::LoginUserInfoPtr> +UserSelectionScreen::UpdateAndReturnUserListForMojo() { + std::vector<ash::mojom::LoginUserInfoPtr> user_info_list; + + const bool single_user = users_.size() == 1; + const AccountId owner = GetOwnerAccountId(); + const bool is_signin_to_add = IsSigninToAdd(); + users_to_send_ = PrepareUserListForSending(users_, owner, is_signin_to_add); + + user_auth_type_map_.clear(); + + for (user_manager::UserList::const_iterator it = users_to_send_.begin(); + it != users_to_send_.end(); ++it) { + const AccountId& account_id = (*it)->GetAccountId(); + bool is_owner = owner == account_id; + const bool is_public_account = + ((*it)->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT); + const proximity_auth::mojom::AuthType initial_auth_type = + is_public_account + ? proximity_auth::mojom::AuthType::EXPAND_THEN_USER_CLICK + : (ShouldForceOnlineSignIn(*it) + ? proximity_auth::mojom::AuthType::ONLINE_SIGN_IN + : proximity_auth::mojom::AuthType::OFFLINE_PASSWORD); + user_auth_type_map_[account_id] = initial_auth_type; + + ash::mojom::LoginUserInfoPtr login_user_info = + ash::mojom::LoginUserInfo::New(); + FillUserMojoStruct(*it, is_owner, is_signin_to_add, initial_auth_type, + login_user_info.get()); + login_user_info->can_remove = CanRemoveUser(single_user, *it); + user_info_list.push_back(std::move(login_user_info)); + } + + return user_info_list; +} + EasyUnlockService* UserSelectionScreen::GetEasyUnlockServiceForUser( const AccountId& account_id) const { if (GetScreenType() == OTHER_SCREEN)
diff --git a/chrome/browser/chromeos/login/screens/user_selection_screen.h b/chrome/browser/chromeos/login/screens/user_selection_screen.h index f9cc031..6dce0a9 100644 --- a/chrome/browser/chromeos/login/screens/user_selection_screen.h +++ b/chrome/browser/chromeos/login/screens/user_selection_screen.h
@@ -9,6 +9,7 @@ #include <string> #include <vector> +#include "ash/public/interfaces/lock_screen.mojom.h" #include "base/compiler_specific.h" #include "base/macros.h" #include "base/timer/timer.h" @@ -80,9 +81,10 @@ void EnableInput() override; void SetAuthType(const AccountId& account_id, - AuthType auth_type, + proximity_auth::mojom::AuthType auth_type, const base::string16& auth_value) override; - AuthType GetAuthType(const AccountId& account_id) const override; + proximity_auth::mojom::AuthType GetAuthType( + const AccountId& account_id) const override; ScreenType GetScreenType() const override; void Unlock(const AccountId& account_id) override; @@ -99,7 +101,7 @@ user_manager::User* user, bool is_owner, bool is_signin_to_add, - AuthType auth_type, + proximity_auth::mojom::AuthType auth_type, const std::vector<std::string>* public_session_recommended_locales, base::DictionaryValue* user_dict); @@ -115,7 +117,18 @@ // Determines if user auth status requires online sign in. static bool ShouldForceOnlineSignIn(const user_manager::User* user); - std::unique_ptr<base::ListValue> PrepareUserList(); + // Fills |user_info| with information about |user|. + // TODO: Public sesssions exist in login screen, but not lock screen. + // We will need public session locales in the future when we change login + // screen to view-based as well. See crbug.com/732452. + static void FillUserMojoStruct(const user_manager::User* user, + bool is_owner, + bool is_signin_to_add, + proximity_auth::mojom::AuthType auth_type, + ash::mojom::LoginUserInfo* user_info); + + std::unique_ptr<base::ListValue> UpdateAndReturnUserListForWebUI(); + std::vector<ash::mojom::LoginUserInfoPtr> UpdateAndReturnUserListForMojo(); protected: UserBoardView* view_ = nullptr; @@ -144,8 +157,7 @@ // Map of accounnt ids to their current authentication type. If a user is not // contained in the map, it is using the default authentication type. - std::map<AccountId, proximity_auth::ScreenlockBridge::LockHandler::AuthType> - user_auth_type_map_; + std::map<AccountId, proximity_auth::mojom::AuthType> user_auth_type_map_; // Timer for measuring idle state duration before password clear. base::OneShotTimer password_clear_timer_;
diff --git a/chrome/browser/chromeos/login/ui/views/user_board_view.h b/chrome/browser/chromeos/login/ui/views/user_board_view.h index 2183197..27ed303 100644 --- a/chrome/browser/chromeos/login/ui/views/user_board_view.h +++ b/chrome/browser/chromeos/login/ui/views/user_board_view.h
@@ -48,10 +48,9 @@ const proximity_auth::ScreenlockBridge::UserPodCustomIconOptions& icon) = 0; virtual void HideUserPodCustomIcon(const AccountId& account_id) = 0; - virtual void SetAuthType( - const AccountId& account_id, - proximity_auth::ScreenlockBridge::LockHandler::AuthType auth_type, - const base::string16& initial_value) = 0; + virtual void SetAuthType(const AccountId& account_id, + proximity_auth::mojom::AuthType auth_type, + const base::string16& initial_value) = 0; }; } // namespace chromeos
diff --git a/chrome/browser/chromeos/login/user_selection_screen_proxy.cc b/chrome/browser/chromeos/login/user_selection_screen_proxy.cc index 216cf82..8fa8baf1 100644 --- a/chrome/browser/chromeos/login/user_selection_screen_proxy.cc +++ b/chrome/browser/chromeos/login/user_selection_screen_proxy.cc
@@ -62,10 +62,9 @@ void UserSelectionScreenProxy::SetAuthType( const AccountId& account_id, - proximity_auth::ScreenlockBridge::LockHandler::AuthType auth_type, + proximity_auth::mojom::AuthType auth_type, const base::string16& initial_value) { - LockScreenClient::Get()->SetAuthType( - account_id, static_cast<ash::mojom::AuthType>(auth_type), initial_value); + LockScreenClient::Get()->SetAuthType(account_id, auth_type, initial_value); } base::WeakPtr<chromeos::UserBoardView> UserSelectionScreenProxy::GetWeakPtr() {
diff --git a/chrome/browser/chromeos/login/user_selection_screen_proxy.h b/chrome/browser/chromeos/login/user_selection_screen_proxy.h index 4d4fb5b0..82ec000 100644 --- a/chrome/browser/chromeos/login/user_selection_screen_proxy.h +++ b/chrome/browser/chromeos/login/user_selection_screen_proxy.h
@@ -31,10 +31,9 @@ const proximity_auth::ScreenlockBridge::UserPodCustomIconOptions& icon) override; void HideUserPodCustomIcon(const AccountId& account_id) override; - void SetAuthType( - const AccountId& account_id, - proximity_auth::ScreenlockBridge::LockHandler::AuthType auth_type, - const base::string16& initial_value) override; + void SetAuthType(const AccountId& account_id, + proximity_auth::mojom::AuthType auth_type, + const base::string16& initial_value) override; void Bind(chromeos::UserSelectionScreen* screen) override{}; void Unbind() override{}; base::WeakPtr<UserBoardView> GetWeakPtr() override;
diff --git a/chrome/browser/chromeos/login/users/multi_profile_user_controller.cc b/chrome/browser/chromeos/login/users/multi_profile_user_controller.cc index 787e73e..476103e 100644 --- a/chrome/browser/chromeos/login/users/multi_profile_user_controller.cc +++ b/chrome/browser/chromeos/login/users/multi_profile_user_controller.cc
@@ -128,17 +128,17 @@ } // static -MultiProfileUserController::MultiProfileUserBehavior +ash::mojom::MultiProfileUserBehavior MultiProfileUserController::UserBehaviorStringToEnum( const std::string& behavior) { if (behavior == kBehaviorPrimaryOnly) - return MultiProfileUserBehavior::kPrimaryOnly; + return ash::mojom::MultiProfileUserBehavior::PRIMARY_ONLY; if (behavior == kBehaviorNotAllowed) - return MultiProfileUserBehavior::kNotAllowed; + return ash::mojom::MultiProfileUserBehavior::NOT_ALLOWED; if (behavior == kBehaviorOwnerPrimaryOnly) - return MultiProfileUserBehavior::kOwnerPrimaryOnly; + return ash::mojom::MultiProfileUserBehavior::OWNER_PRIMARY_ONLY; - return MultiProfileUserBehavior::kUnrestriced; + return ash::mojom::MultiProfileUserBehavior::UNRESTRICTED; } bool MultiProfileUserController::IsUserAllowedInSession(
diff --git a/chrome/browser/chromeos/login/users/multi_profile_user_controller.h b/chrome/browser/chromeos/login/users/multi_profile_user_controller.h index c397d56..45d058bd 100644 --- a/chrome/browser/chromeos/login/users/multi_profile_user_controller.h +++ b/chrome/browser/chromeos/login/users/multi_profile_user_controller.h
@@ -9,6 +9,7 @@ #include <string> #include <vector> +#include "ash/public/interfaces/login_user_info.mojom.h" #include "base/macros.h" class PrefChangeRegistrar; @@ -55,15 +56,6 @@ NOT_ALLOWED_POLICY_FORBIDS }; - // Supported user behavior values. Keep in sync with the enum in - // md_user_pod_row.js and user_pod_row.js - enum class MultiProfileUserBehavior { - kUnrestriced, - kPrimaryOnly, - kNotAllowed, - kOwnerPrimaryOnly - }; - MultiProfileUserController(MultiProfileUserControllerDelegate* delegate, PrefService* local_state); ~MultiProfileUserController(); @@ -80,7 +72,7 @@ static UserAllowedInSessionReason GetPrimaryUserPolicy(); // Returns the user behavior in MultiProfileUserBehavior enum. - static MultiProfileUserBehavior UserBehaviorStringToEnum( + static ash::mojom::MultiProfileUserBehavior UserBehaviorStringToEnum( const std::string& behavior); // Returns true if user allowed to be in the current session. If |reason| not
diff --git a/chrome/browser/devtools/devtools_file_helper.cc b/chrome/browser/devtools/devtools_file_helper.cc index 463cedea..7fd7f1cc 100644 --- a/chrome/browser/devtools/devtools_file_helper.cc +++ b/chrome/browser/devtools/devtools_file_helper.cc
@@ -15,6 +15,8 @@ #include "base/md5.h" #include "base/memory/ptr_util.h" #include "base/strings/utf_string_conversions.h" +#include "base/task_scheduler/post_task.h" +#include "base/threading/sequenced_task_runner_handle.h" #include "base/value_conversions.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/devtools/devtools_file_watcher.h" @@ -120,14 +122,14 @@ }; void WriteToFile(const base::FilePath& path, const std::string& content) { - DCHECK_CURRENTLY_ON(BrowserThread::FILE); + base::ThreadRestrictions::AssertIOAllowed(); DCHECK(!path.empty()); base::WriteFile(path, content.c_str(), content.length()); } void AppendToFile(const base::FilePath& path, const std::string& content) { - DCHECK_CURRENTLY_ON(BrowserThread::FILE); + base::ThreadRestrictions::AssertIOAllowed(); DCHECK(!path.empty()); base::AppendToFile(path, content.c_str(), content.size()); @@ -210,14 +212,13 @@ : web_contents_(web_contents), profile_(profile), delegate_(delegate), + file_task_runner_( + base::CreateSequencedTaskRunnerWithTraits({base::MayBlock()})), weak_factory_(this) { pref_change_registrar_.Init(profile_->GetPrefs()); } -DevToolsFileHelper::~DevToolsFileHelper() { - BrowserThread::DeleteSoon(BrowserThread::FILE, FROM_HERE, - file_watcher_.release()); -} +DevToolsFileHelper::~DevToolsFileHelper() = default; void DevToolsFileHelper::Save(const std::string& url, const std::string& content, @@ -275,8 +276,8 @@ if (it == saved_files_.end()) return; callback.Run(); - BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, - BindOnce(&AppendToFile, it->second, content)); + file_task_runner_->PostTask(FROM_HERE, + BindOnce(&AppendToFile, it->second, content)); } void DevToolsFileHelper::SaveAsFileSelected(const std::string& url, @@ -292,8 +293,7 @@ files_map->SetWithoutPathExpansion(base::MD5String(url), base::CreateFilePathValue(path)); callback.Run(); - BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, - BindOnce(&WriteToFile, path, content)); + file_task_runner_->PostTask(FROM_HERE, BindOnce(&WriteToFile, path, content)); } void DevToolsFileHelper::AddFileSystem( @@ -308,23 +308,25 @@ select_file_dialog->Show(ui::SelectFileDialog::SELECT_FOLDER, base::FilePath()); } else { - BrowserThread::PostTask( - BrowserThread::FILE, FROM_HERE, + file_task_runner_->PostTask( + FROM_HERE, BindOnce(&DevToolsFileHelper::CheckProjectFileExistsAndAddFileSystem, weak_factory_.GetWeakPtr(), show_info_bar_callback, base::FilePath::FromUTF8Unsafe(file_system_path))); } } +// static void DevToolsFileHelper::CheckProjectFileExistsAndAddFileSystem( - const ShowInfoBarCallback& show_info_bar_callback, - const base::FilePath& path) { - DCHECK_CURRENTLY_ON(BrowserThread::FILE); + base::WeakPtr<DevToolsFileHelper> self, + ShowInfoBarCallback show_info_bar_callback, + base::FilePath path) { + base::ThreadRestrictions::AssertIOAllowed(); if (base::PathExists(path.Append(FILE_PATH_LITERAL(".devtools")))) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - BindOnce(&DevToolsFileHelper::InnerAddFileSystem, - weak_factory_.GetWeakPtr(), show_info_bar_callback, path)); + BindOnce(&DevToolsFileHelper::InnerAddFileSystem, std::move(self), + std::move(show_info_bar_callback), path)); } } @@ -387,8 +389,10 @@ file_system_paths_ = GetAddedFileSystemPaths(profile_); std::vector<FileSystem> file_systems; if (!file_watcher_) { - file_watcher_.reset(new DevToolsFileWatcher(base::Bind( - &DevToolsFileHelper::FilePathsChanged, weak_factory_.GetWeakPtr()))); + file_watcher_.reset(new DevToolsFileWatcher( + base::Bind(&DevToolsFileHelper::FilePathsChanged, + weak_factory_.GetWeakPtr()), + base::SequencedTaskRunnerHandle::Get())); pref_change_registrar_.Add( prefs::kDevToolsFileSystemPaths, base::Bind(&DevToolsFileHelper::FileSystemPathsSettingChanged, @@ -401,10 +405,7 @@ file_system_id, file_system_path); file_systems.push_back(filesystem); - BrowserThread::PostTask( - BrowserThread::FILE, FROM_HERE, - BindOnce(&DevToolsFileWatcher::AddWatch, - base::Unretained(file_watcher_.get()), path)); + file_watcher_->AddWatch(std::move(path)); } return file_systems; } @@ -440,10 +441,7 @@ file_system_id, file_system_path); delegate_->FileSystemAdded(filesystem); - BrowserThread::PostTask( - BrowserThread::FILE, FROM_HERE, - BindOnce(&DevToolsFileWatcher::AddWatch, - base::Unretained(file_watcher_.get()), path)); + file_watcher_->AddWatch(std::move(path)); } else { remaining.erase(file_system_path); } @@ -453,10 +451,7 @@ for (auto file_system_path : remaining) { delegate_->FileSystemRemoved(file_system_path); base::FilePath path = base::FilePath::FromUTF8Unsafe(file_system_path); - BrowserThread::PostTask( - BrowserThread::FILE, FROM_HERE, - BindOnce(&DevToolsFileWatcher::RemoveWatch, - base::Unretained(file_watcher_.get()), path)); + file_watcher_->RemoveWatch(std::move(path)); } }
diff --git a/chrome/browser/devtools/devtools_file_helper.h b/chrome/browser/devtools/devtools_file_helper.h index e613d02..cb37572 100644 --- a/chrome/browser/devtools/devtools_file_helper.h +++ b/chrome/browser/devtools/devtools_file_helper.h
@@ -16,13 +16,14 @@ #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/strings/string16.h" +#include "chrome/browser/devtools/devtools_file_watcher.h" #include "components/prefs/pref_change_registrar.h" -class DevToolsFileWatcher; class Profile; namespace base { class FilePath; +class SequencedTaskRunner; } namespace content { @@ -128,9 +129,6 @@ void InnerAddFileSystem( const ShowInfoBarCallback& show_info_bar_callback, const base::FilePath& path); - void CheckProjectFileExistsAndAddFileSystem( - const ShowInfoBarCallback& show_info_bar_callback, - const base::FilePath& path); void AddUserConfirmedFileSystem( const base::FilePath& path, bool allowed); @@ -139,6 +137,12 @@ const std::vector<std::string>& added_paths, const std::vector<std::string>& removed_paths); + // This should only be called on the file sequence. + static void CheckProjectFileExistsAndAddFileSystem( + base::WeakPtr<DevToolsFileHelper> self, + ShowInfoBarCallback show_info_bar_callback, + base::FilePath path); + content::WebContents* web_contents_; Profile* profile_; DevToolsFileHelper::Delegate* delegate_; @@ -146,7 +150,9 @@ PathsMap saved_files_; PrefChangeRegistrar pref_change_registrar_; std::set<std::string> file_system_paths_; - std::unique_ptr<DevToolsFileWatcher> file_watcher_; + std::unique_ptr<DevToolsFileWatcher, DevToolsFileWatcher::Deleter> + file_watcher_; + scoped_refptr<base::SequencedTaskRunner> file_task_runner_; base::WeakPtrFactory<DevToolsFileHelper> weak_factory_; DISALLOW_COPY_AND_ASSIGN(DevToolsFileHelper); };
diff --git a/chrome/browser/devtools/devtools_file_watcher.cc b/chrome/browser/devtools/devtools_file_watcher.cc index e97ef21..3c43d135 100644 --- a/chrome/browser/devtools/devtools_file_watcher.cc +++ b/chrome/browser/devtools/devtools_file_watcher.cc
@@ -15,6 +15,9 @@ #include "base/files/file_path_watcher.h" #include "base/files/file_util.h" #include "base/memory/ref_counted.h" +#include "base/sequenced_task_runner.h" +#include "base/task_scheduler/lazy_task_runner.h" +#include "base/threading/sequenced_task_runner_handle.h" #include "content/public/browser/browser_thread.h" using content::BrowserThread; @@ -51,6 +54,7 @@ std::set<base::FilePath> pending_paths_; base::Time last_event_time_; base::TimeDelta last_dispatch_cost_; + SEQUENCE_CHECKER(sequence_checker_); }; DevToolsFileWatcher::SharedFileWatcher::SharedFileWatcher() @@ -60,22 +64,26 @@ } DevToolsFileWatcher::SharedFileWatcher::~SharedFileWatcher() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DevToolsFileWatcher::s_shared_watcher_ = nullptr; } void DevToolsFileWatcher::SharedFileWatcher::AddListener( DevToolsFileWatcher* watcher) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); listeners_.push_back(watcher); } void DevToolsFileWatcher::SharedFileWatcher::RemoveListener( DevToolsFileWatcher* watcher) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); auto it = std::find(listeners_.begin(), listeners_.end(), watcher); listeners_.erase(it); } void DevToolsFileWatcher::SharedFileWatcher::AddWatch( const base::FilePath& path) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (watchers_.find(path) != watchers_.end()) return; if (!base::FilePathWatcher::RecursiveWatchAvailable()) @@ -104,13 +112,14 @@ void DevToolsFileWatcher::SharedFileWatcher::RemoveWatch( const base::FilePath& path) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); watchers_.erase(path); } void DevToolsFileWatcher::SharedFileWatcher::DirectoryChanged( const base::FilePath& path, bool error) { - DCHECK_CURRENTLY_ON(BrowserThread::FILE); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); pending_paths_.insert(path); if (pending_paths_.size() > 1) return; // PostDelayedTask is already pending. @@ -122,8 +131,8 @@ base::TimeDelta::FromMilliseconds(kFirstThrottleTimeout) : last_dispatch_cost_ * 2; - BrowserThread::PostDelayedTask( - BrowserThread::FILE, FROM_HERE, + base::SequencedTaskRunnerHandle::Get()->PostDelayedTask( + FROM_HERE, base::BindOnce( &DevToolsFileWatcher::SharedFileWatcher::DispatchNotifications, this), shedule_for); @@ -131,6 +140,7 @@ } void DevToolsFileWatcher::SharedFileWatcher::DispatchNotifications() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!pending_paths_.size()) return; base::Time start = base::Time::Now(); @@ -160,30 +170,49 @@ pending_paths_.clear(); for (auto* watcher : listeners_) { - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - base::BindOnce(watcher->callback_, changed_paths, - added_paths, removed_paths)); + watcher->client_task_runner_->PostTask( + FROM_HERE, base::BindOnce(watcher->callback_, changed_paths, + added_paths, removed_paths)); } last_dispatch_cost_ = base::Time::Now() - start; } +// DevToolsFileWatcher --------------------------------------------------------- + +namespace { +base::SequencedTaskRunner* impl_task_runner() { + constexpr base::TaskTraits kImplTaskTraits = {base::MayBlock(), + base::TaskPriority::BACKGROUND}; + static base::LazySequencedTaskRunner s_file_task_runner = + LAZY_SEQUENCED_TASK_RUNNER_INITIALIZER(kImplTaskTraits); + + return s_file_task_runner.Get().get(); +} +} // namespace + // static DevToolsFileWatcher::SharedFileWatcher* DevToolsFileWatcher::s_shared_watcher_ = nullptr; -// DevToolsFileWatcher --------------------------------------------------------- +// static +void DevToolsFileWatcher::Deleter::operator()(const DevToolsFileWatcher* ptr) { + impl_task_runner()->PostTask( + FROM_HERE, + base::BindOnce(&DevToolsFileWatcher::Destroy, base::Unretained(ptr))); +} -DevToolsFileWatcher::DevToolsFileWatcher(const WatchCallback& callback) - : callback_(callback) { - DCHECK_CURRENTLY_ON(BrowserThread::UI); - BrowserThread::PostTask( - BrowserThread::FILE, FROM_HERE, - base::BindOnce(&DevToolsFileWatcher::InitSharedWatcher, - base::Unretained(this))); +DevToolsFileWatcher::DevToolsFileWatcher( + WatchCallback callback, + scoped_refptr<base::SequencedTaskRunner> callback_task_runner) + : callback_(std::move(callback)), + client_task_runner_(std::move(callback_task_runner)) { + impl_task_runner()->PostTask( + FROM_HERE, base::BindOnce(&DevToolsFileWatcher::InitSharedWatcher, + base::Unretained(this))); } DevToolsFileWatcher::~DevToolsFileWatcher() { - DCHECK_CURRENTLY_ON(BrowserThread::FILE); + DCHECK(impl_task_runner()->RunsTasksInCurrentSequence()); shared_watcher_->RemoveListener(this); } @@ -194,12 +223,22 @@ shared_watcher_->AddListener(this); } -void DevToolsFileWatcher::AddWatch(const base::FilePath& path) { - DCHECK_CURRENTLY_ON(BrowserThread::FILE); - shared_watcher_->AddWatch(path); +void DevToolsFileWatcher::AddWatch(base::FilePath path) { + impl_task_runner()->PostTask( + FROM_HERE, base::BindOnce(&DevToolsFileWatcher::AddWatchOnImpl, + base::Unretained(this), std::move(path))); } -void DevToolsFileWatcher::RemoveWatch(const base::FilePath& path) { - DCHECK_CURRENTLY_ON(BrowserThread::FILE); - shared_watcher_->RemoveWatch(path); +void DevToolsFileWatcher::RemoveWatch(base::FilePath path) { + impl_task_runner()->PostTask( + FROM_HERE, base::BindOnce(&DevToolsFileWatcher::AddWatchOnImpl, + base::Unretained(this), std::move(path))); +} + +void DevToolsFileWatcher::AddWatchOnImpl(base::FilePath path) { + shared_watcher_->AddWatch(std::move(path)); +} + +void DevToolsFileWatcher::RemoveWatchOnImpl(base::FilePath path) { + shared_watcher_->RemoveWatch(std::move(path)); }
diff --git a/chrome/browser/devtools/devtools_file_watcher.h b/chrome/browser/devtools/devtools_file_watcher.h index eb597fccf..3b30b35 100644 --- a/chrome/browser/devtools/devtools_file_watcher.h +++ b/chrome/browser/devtools/devtools_file_watcher.h
@@ -12,28 +12,39 @@ namespace base { class FilePath; +class SequencedTaskRunner; } class DevToolsFileWatcher { public: + struct Deleter { + void operator()(const DevToolsFileWatcher* ptr); + }; + using WatchCallback = base::Callback<void(const std::vector<std::string>&, const std::vector<std::string>&, const std::vector<std::string>&)>; - explicit DevToolsFileWatcher(const WatchCallback& callback); - ~DevToolsFileWatcher(); + DevToolsFileWatcher( + WatchCallback callback, + scoped_refptr<base::SequencedTaskRunner> callback_task_runner); - void AddWatch(const base::FilePath& path); - void RemoveWatch(const base::FilePath& path); + void AddWatch(base::FilePath path); + void RemoveWatch(base::FilePath path); private: + ~DevToolsFileWatcher(); // Use Deleter to destroy objects of this type. class SharedFileWatcher; static SharedFileWatcher* s_shared_watcher_; + void Destroy() const { delete this; } void InitSharedWatcher(); - void FileChanged(const base::FilePath&, int); + void AddWatchOnImpl(base::FilePath path); + void RemoveWatchOnImpl(base::FilePath path); scoped_refptr<SharedFileWatcher> shared_watcher_; WatchCallback callback_; + scoped_refptr<base::SequencedTaskRunner> client_task_runner_; + DISALLOW_COPY_AND_ASSIGN(DevToolsFileWatcher); };
diff --git a/chrome/browser/devtools/devtools_file_watcher_unittest.cc b/chrome/browser/devtools/devtools_file_watcher_unittest.cc new file mode 100644 index 0000000..c43ee56 --- /dev/null +++ b/chrome/browser/devtools/devtools_file_watcher_unittest.cc
@@ -0,0 +1,79 @@ +// 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 <set> + +#include "base/bind.h" +#include "base/files/file_util.h" +#include "base/files/scoped_temp_dir.h" +#include "base/run_loop.h" +#include "base/test/scoped_task_environment.h" +#include "base/test/test_timeouts.h" +#include "base/threading/sequenced_task_runner_handle.h" +#include "chrome/browser/devtools/devtools_file_watcher.h" +#include "testing/gtest/include/gtest/gtest.h" + +class DevToolsFileWatcherTest : public testing::Test { + public: + void Callback(const std::vector<std::string>& changed_paths, + const std::vector<std::string>& added_paths, + const std::vector<std::string>& removed_paths) { + for (auto& p : changed_paths) + expected_changed_paths_.erase(p); + for (auto& p : added_paths) + ASSERT_EQ(1ul, expected_added_paths_.erase(p)); + for (auto& p : removed_paths) + ASSERT_EQ(1ul, expected_removed_paths_.erase(p)); + } + + void SetUp() override { + ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); + base_path_ = temp_dir_.GetPath(); + } + + base::ScopedTempDir temp_dir_; + base::FilePath base_path_; + base::test::ScopedTaskEnvironment task_environment_; + bool done_flag_ = false; + + std::set<std::string> expected_changed_paths_; + std::set<std::string> expected_added_paths_; + std::set<std::string> expected_removed_paths_; +}; + +TEST_F(DevToolsFileWatcherTest, BasicUsage) { + std::unique_ptr<DevToolsFileWatcher, DevToolsFileWatcher::Deleter> watcher( + new DevToolsFileWatcher(base::Bind(&DevToolsFileWatcherTest::Callback, + base::Unretained(this)), + base::SequencedTaskRunnerHandle::Get())); + + base::FilePath changed_path = base_path_.Append(FILE_PATH_LITERAL("file1")); + base::WriteFile(changed_path, "test", 4); + + watcher->AddWatch(base_path_); + expected_changed_paths_.insert(changed_path.AsUTF8Unsafe()); + + while (!expected_changed_paths_.empty()) { + task_environment_.RunUntilIdle(); + base::PlatformThread::Sleep(TestTimeouts::tiny_timeout()); + // Just for the first operation, repeat it until we get the callback, as + // watcher may take some time to start on another thread. + base::WriteFile(changed_path, "test", 4); + } + + base::FilePath added_path = base_path_.Append(FILE_PATH_LITERAL("file2")); + expected_added_paths_.insert(added_path.AsUTF8Unsafe()); + base::WriteFile(added_path, "test", 4); + while (!expected_added_paths_.empty()) { + task_environment_.RunUntilIdle(); + base::PlatformThread::Sleep(TestTimeouts::tiny_timeout()); + } + + expected_removed_paths_.insert(added_path.AsUTF8Unsafe()); + base::DeleteFile(added_path, false); + while (!expected_removed_paths_.empty()) { + task_environment_.RunUntilIdle(); + base::PlatformThread::Sleep(TestTimeouts::tiny_timeout()); + } +}
diff --git a/chrome/browser/extensions/BUILD.gn b/chrome/browser/extensions/BUILD.gn index 746767ab..0dd2a76c 100644 --- a/chrome/browser/extensions/BUILD.gn +++ b/chrome/browser/extensions/BUILD.gn
@@ -817,6 +817,7 @@ "//chrome/browser/devtools", "//chrome/browser/media/router", "//chrome/browser/media/router/discovery", + "//chrome/browser/safe_browsing", "//chrome/common", "//chrome/common/extensions:mojo_bindings", "//chrome/common/extensions/api:api_registration",
diff --git a/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.cc b/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.cc index dfe4f1b..4d8d4f4 100644 --- a/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.cc +++ b/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.cc
@@ -26,23 +26,23 @@ namespace { screenlock::AuthType FromLockHandlerAuthType( - proximity_auth::ScreenlockBridge::LockHandler::AuthType auth_type) { + proximity_auth::mojom::AuthType auth_type) { switch (auth_type) { - case proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD: + case proximity_auth::mojom::AuthType::OFFLINE_PASSWORD: return screenlock::AUTH_TYPE_OFFLINEPASSWORD; - case proximity_auth::ScreenlockBridge::LockHandler::NUMERIC_PIN: + case proximity_auth::mojom::AuthType::NUMERIC_PIN: return screenlock::AUTH_TYPE_NUMERICPIN; - case proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK: + case proximity_auth::mojom::AuthType::USER_CLICK: return screenlock::AUTH_TYPE_USERCLICK; - case proximity_auth::ScreenlockBridge::LockHandler::ONLINE_SIGN_IN: + case proximity_auth::mojom::AuthType::ONLINE_SIGN_IN: // Apps should treat forced online sign in same as system password. return screenlock::AUTH_TYPE_OFFLINEPASSWORD; - case proximity_auth::ScreenlockBridge::LockHandler::EXPAND_THEN_USER_CLICK: + case proximity_auth::mojom::AuthType::EXPAND_THEN_USER_CLICK: // This type is used for public sessions, which do not support screen // locking. NOTREACHED(); return screenlock::AUTH_TYPE_NONE; - case proximity_auth::ScreenlockBridge::LockHandler::FORCE_OFFLINE_PASSWORD: + case proximity_auth::mojom::AuthType::FORCE_OFFLINE_PASSWORD: return screenlock::AUTH_TYPE_OFFLINEPASSWORD; } NOTREACHED(); @@ -161,7 +161,7 @@ } bool ScreenlockPrivateEventRouter::OnAuthAttempted( - proximity_auth::ScreenlockBridge::LockHandler::AuthType auth_type, + proximity_auth::mojom::AuthType auth_type, const std::string& value) { EventRouter* router = EventRouter::Get(browser_context_); if (!router->HasEventListener(screenlock::OnAuthAttempted::kEventName))
diff --git a/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.h b/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.h index 8be74e5..84cee32 100644 --- a/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.h +++ b/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.h
@@ -60,9 +60,8 @@ explicit ScreenlockPrivateEventRouter(content::BrowserContext* context); ~ScreenlockPrivateEventRouter() override; - bool OnAuthAttempted( - proximity_auth::ScreenlockBridge::LockHandler::AuthType auth_type, - const std::string& value); + bool OnAuthAttempted(proximity_auth::mojom::AuthType auth_type, + const std::string& value); // BrowserContextKeyedAPI static BrowserContextKeyedAPIFactory<ScreenlockPrivateEventRouter>*
diff --git a/chrome/browser/extensions/api/screenlock_private/screenlock_private_apitest.cc b/chrome/browser/extensions/api/screenlock_private/screenlock_private_apitest.cc index a97f783..a4700be 100644 --- a/chrome/browser/extensions/api/screenlock_private/screenlock_private_apitest.cc +++ b/chrome/browser/extensions/api/screenlock_private/screenlock_private_apitest.cc
@@ -78,8 +78,7 @@ content::Details<std::pair<std::string, bool*>>(details).ptr()->first; if (message == kAttemptClickAuthMessage) { proximity_auth::ScreenlockBridge::Get()->lock_handler()->SetAuthType( - test_account_id_, - proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK, + test_account_id_, proximity_auth::mojom::AuthType::USER_CLICK, base::string16()); EasyUnlockService::Get(profile())->AttemptAuth(test_account_id_); }
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index fbd5255..65023640 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -2486,6 +2486,12 @@ #endif // defined(OS_ANDROID) +const char kEnableAutofillCreditCardBankNameDisplayName[] = + "Display the issuer bank name of a credit card in autofill."; + +const char kEnableAutofillCreditCardBankNameDisplayDescription[] = + "If enabled, displays the issuer bank name of a credit card in autofill."; + const char kEnableAutofillCreditCardLastUsedDateDisplayName[] = "Display the last used date of a credit card in autofill.";
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index 24a390d..cc47b59 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -175,6 +175,9 @@ extern const char kEnableAsmWasmName[]; extern const char kEnableAsmWasmDescription[]; +extern const char kEnableAutofillCreditCardBankNameDisplayName[]; +extern const char kEnableAutofillCreditCardBankNameDisplayDescription[]; + extern const char kEnableAutofillCreditCardLastUsedDateDisplayName[]; extern const char kEnableAutofillCreditCardLastUsedDateDisplayDescription[];
diff --git a/chrome/browser/media/router/mock_screen_availability_listener.h b/chrome/browser/media/router/mock_screen_availability_listener.h index 3abdee4..1d7888a 100644 --- a/chrome/browser/media/router/mock_screen_availability_listener.h +++ b/chrome/browser/media/router/mock_screen_availability_listener.h
@@ -21,8 +21,6 @@ MOCK_METHOD1(OnScreenAvailabilityChanged, void(blink::mojom::ScreenAvailability)); - MOCK_METHOD0(OnScreenAvailabilityNotSupported, void()); - private: GURL availability_url_; };
diff --git a/chrome/browser/media/router/presentation_service_delegate_impl.cc b/chrome/browser/media/router/presentation_service_delegate_impl.cc index 748db78..f69e0ce 100644 --- a/chrome/browser/media/router/presentation_service_delegate_impl.cc +++ b/chrome/browser/media/router/presentation_service_delegate_impl.cc
@@ -219,7 +219,7 @@ MediaSource source(GetMediaSourceFromListener(listener)); if (!IsValidPresentationUrl(source.url())) { listener->OnScreenAvailabilityChanged( - blink::mojom::ScreenAvailability::UNAVAILABLE); + blink::mojom::ScreenAvailability::SOURCE_NOT_SUPPORTED); return false; } @@ -233,7 +233,8 @@ if (!sinks_observer->Init()) { url_to_sinks_observer_.erase(source.id()); - listener->OnScreenAvailabilityNotSupported(); + listener->OnScreenAvailabilityChanged( + blink::mojom::ScreenAvailability::DISABLED); return false; }
diff --git a/chrome/browser/media/router/presentation_service_delegate_impl_unittest.cc b/chrome/browser/media/router/presentation_service_delegate_impl_unittest.cc index d153af6..b90b0b2d 100644 --- a/chrome/browser/media/router/presentation_service_delegate_impl_unittest.cc +++ b/chrome/browser/media/router/presentation_service_delegate_impl_unittest.cc
@@ -323,8 +323,9 @@ TEST_F(PresentationServiceDelegateImplTest, AddListenerForInvalidUrl) { MockScreenAvailabilityListener listener(GURL("unsupported-url://foo")); - EXPECT_CALL(listener, OnScreenAvailabilityChanged( - blink::mojom::ScreenAvailability::UNAVAILABLE)); + EXPECT_CALL(listener, + OnScreenAvailabilityChanged( + blink::mojom::ScreenAvailability::SOURCE_NOT_SUPPORTED)); EXPECT_FALSE(delegate_impl_->AddScreenAvailabilityListener( main_frame_process_id_, main_frame_routing_id_, &listener)); EXPECT_CALL(router_, RegisterMediaSinksObserver(_)).Times(0); @@ -517,7 +518,8 @@ TEST_F(PresentationServiceDelegateImplTest, SinksObserverCantRegister) { EXPECT_CALL(router_, RegisterMediaSinksObserver(_)).WillOnce(Return(false)); - EXPECT_CALL(listener1_, OnScreenAvailabilityNotSupported()); + EXPECT_CALL(listener1_, OnScreenAvailabilityChanged( + blink::mojom::ScreenAvailability::DISABLED)); EXPECT_FALSE(delegate_impl_->AddScreenAvailabilityListener( main_frame_process_id_, main_frame_routing_id_, &listener1_)); }
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 new file mode 100644 index 0000000..767ce004 --- /dev/null +++ b/chrome/browser/page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer.cc
@@ -0,0 +1,164 @@ +// 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/multi_tab_loading_page_load_metrics_observer.h" + +#include "base/metrics/histogram_macros.h" +#include "chrome/browser/page_load_metrics/page_load_metrics_util.h" +#include "content/public/browser/web_contents.h" + +#if defined(OS_ANDROID) +#include "chrome/browser/ui/android/tab_model/tab_model.h" +#include "chrome/browser/ui/android/tab_model/tab_model_list.h" +#else +#include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/browser_list.h" +#include "chrome/browser/ui/tabs/tab_strip_model.h" +#endif + +namespace internal { + +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 + +MultiTabLoadingPageLoadMetricsObserver:: + MultiTabLoadingPageLoadMetricsObserver() {} + +MultiTabLoadingPageLoadMetricsObserver:: + ~MultiTabLoadingPageLoadMetricsObserver() {} + +page_load_metrics::PageLoadMetricsObserver::ObservePolicy +MultiTabLoadingPageLoadMetricsObserver::OnStart( + content::NavigationHandle* navigation_handle, + const GURL& currently_committed_url, + bool started_in_foreground) { + return IsAnyTabLoading(navigation_handle) ? CONTINUE_OBSERVING + : STOP_OBSERVING; +} + +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()); + } + + if (WasStartedInBackgroundOptionalEventInForeground( + timing.paint_timing->first_contentful_paint, info)) { + PAGE_LOAD_HISTOGRAM( + internal::kHistogramMultiTabLoadingForegroundToFirstContentfulPaint, + timing.paint_timing->first_contentful_paint.value() - + info.first_foreground_time.value()); + } +} + +void MultiTabLoadingPageLoadMetricsObserver:: + OnFirstMeaningfulPaintInMainFrameDocument( + const page_load_metrics::mojom::PageLoadTiming& timing, + 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()); + } + if (WasStartedInBackgroundOptionalEventInForeground( + timing.paint_timing->first_meaningful_paint, info)) { + PAGE_LOAD_HISTOGRAM( + internal::kHistogramMultiTabLoadingForegroundToFirstMeaningfulPaint, + timing.paint_timing->first_meaningful_paint.value() - + info.first_foreground_time.value()); + } +} + +void MultiTabLoadingPageLoadMetricsObserver::OnDomContentLoadedEventStart( + const page_load_metrics::mojom::PageLoadTiming& timing, + const page_load_metrics::PageLoadExtraInfo& info) { + if (WasStartedInForegroundOptionalEventInForeground( + timing.document_timing->dom_content_loaded_event_start, info)) { + PAGE_LOAD_HISTOGRAM( + internal::kHistogramMultiTabLoadingDomContentLoaded, + timing.document_timing->dom_content_loaded_event_start.value()); + } else { + PAGE_LOAD_HISTOGRAM( + internal::kBackgroundHistogramMultiTabLoadingDomContentLoaded, + timing.document_timing->dom_content_loaded_event_start.value()); + } +} + +void MultiTabLoadingPageLoadMetricsObserver::OnLoadEventStart( + const page_load_metrics::mojom::PageLoadTiming& timing, + 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()); + } else { + PAGE_LOAD_HISTOGRAM(internal::kBackgroundHistogramMultiTabLoadingLoad, + timing.document_timing->load_event_start.value()); + } +} + +#if defined(OS_ANDROID) + +bool MultiTabLoadingPageLoadMetricsObserver::IsAnyTabLoading( + content::NavigationHandle* navigation_handle) { + content::WebContents* this_contents = navigation_handle->GetWebContents(); + for (TabModelList::const_iterator it = TabModelList::begin(); + it != TabModelList::end(); ++it) { + TabModel* model = *it; + for (int i = 0; i < model->GetTabCount(); ++i) { + content::WebContents* other_contents = model->GetWebContentsAt(i); + if (other_contents && other_contents != this_contents && + other_contents->IsLoading()) { + return true; + } + } + } + return false; +} + +#else // defined(OS_ANDROID) + +bool MultiTabLoadingPageLoadMetricsObserver::IsAnyTabLoading( + content::NavigationHandle* navigation_handle) { + content::WebContents* this_contents = navigation_handle->GetWebContents(); + for (auto* browser : *BrowserList::GetInstance()) { + TabStripModel* model = browser->tab_strip_model(); + for (int i = 0; i < model->count(); ++i) { + content::WebContents* other_contents = model->GetWebContentsAt(i); + if (other_contents != this_contents && other_contents->IsLoading()) { + return true; + } + } + } + return false; +} + +#endif // defined(OS_ANDROID)
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 new file mode 100644 index 0000000..5753f20 --- /dev/null +++ b/chrome/browser/page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer.h
@@ -0,0 +1,63 @@ +// 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_MULTI_TAB_LOADING_PAGE_LOAD_METRICS_OBSERVER_H_ +#define CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_MULTI_TAB_LOADING_PAGE_LOAD_METRICS_OBSERVER_H_ + +#include "base/macros.h" +#include "chrome/browser/page_load_metrics/page_load_metrics_observer.h" + +namespace content { +class NavigationHandle; +} + +namespace internal { + +// Exposed for tests. +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 + +// Observer responsible for recording core page load metrics while there are +// other loading tabs. +class MultiTabLoadingPageLoadMetricsObserver + : public page_load_metrics::PageLoadMetricsObserver { + public: + MultiTabLoadingPageLoadMetricsObserver(); + ~MultiTabLoadingPageLoadMetricsObserver() override; + + // page_load_metrics::PageLoadMetricsObserver: + page_load_metrics::PageLoadMetricsObserver::ObservePolicy OnStart( + content::NavigationHandle* navigation_handle, + const GURL& currently_committed_url, + bool started_in_foreground) override; + void OnFirstContentfulPaintInPage( + const page_load_metrics::mojom::PageLoadTiming& timing, + const page_load_metrics::PageLoadExtraInfo& extra_info) override; + void OnFirstMeaningfulPaintInMainFrameDocument( + const page_load_metrics::mojom::PageLoadTiming& timing, + const page_load_metrics::PageLoadExtraInfo& info) override; + void OnDomContentLoadedEventStart( + const page_load_metrics::mojom::PageLoadTiming& timing, + const page_load_metrics::PageLoadExtraInfo& info) override; + void OnLoadEventStart( + const page_load_metrics::mojom::PageLoadTiming& timing, + const page_load_metrics::PageLoadExtraInfo& info) override; + + protected: + // Overridden in testing. + virtual bool IsAnyTabLoading(content::NavigationHandle* navigation_handle); + + private: + DISALLOW_COPY_AND_ASSIGN(MultiTabLoadingPageLoadMetricsObserver); +}; + +#endif // CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_MULTI_TAB_LOADING_PAGE_LOAD_METRICS_OBSERVER_H_
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 new file mode 100644 index 0000000..eab2896b --- /dev/null +++ b/chrome/browser/page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer_browsertest.cc
@@ -0,0 +1,94 @@ +// 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/multi_tab_loading_page_load_metrics_observer.h" + +#include "base/test/histogram_tester.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" +#include "chrome/test/base/ui_test_utils.h" +#include "content/public/test/browser_test.h" +#include "content/public/test/browser_test_utils.h" +#include "net/test/embedded_test_server/embedded_test_server.h" +#include "testing/gtest/include/gtest/gtest.h" + +class MultiTabLoadingPageLoadMetricsBrowserTest : public InProcessBrowserTest { + public: + MultiTabLoadingPageLoadMetricsBrowserTest() {} + ~MultiTabLoadingPageLoadMetricsBrowserTest() override {} + + protected: + GURL GetTestURL() { return embedded_test_server()->GetURL("/simple.html"); } + + void NavigateToURLWithoutWaiting(GURL url) { + ui_test_utils::NavigateToURLWithDisposition( + browser(), url, WindowOpenDisposition::CURRENT_TAB, + ui_test_utils::BROWSER_TEST_NONE); + } + + void SetUpOnMainThread() override { + ASSERT_TRUE(embedded_test_server()->Start()); + InProcessBrowserTest::SetUpOnMainThread(); + } +}; + +IN_PROC_BROWSER_TEST_F(MultiTabLoadingPageLoadMetricsBrowserTest, SingleTab) { + base::HistogramTester histogram_tester; + + ui_test_utils::NavigateToURL(browser(), GetTestURL()); + + // 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); +} + +IN_PROC_BROWSER_TEST_F(MultiTabLoadingPageLoadMetricsBrowserTest, + MultiTabForeground) { + base::HistogramTester histogram_tester; + + NavigateToURLWithoutWaiting(embedded_test_server()->GetURL("/hung")); + + // Open a new foreground tab. + ui_test_utils::NavigateToURLWithDispositionBlockUntilNavigationsComplete( + browser(), GetTestURL(), 1, WindowOpenDisposition::NEW_FOREGROUND_TAB, + ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); + + // 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); +} + +IN_PROC_BROWSER_TEST_F(MultiTabLoadingPageLoadMetricsBrowserTest, + MultiTabBackground) { + base::HistogramTester histogram_tester; + + NavigateToURLWithoutWaiting(embedded_test_server()->GetURL("/hung")); + + // Open a tab in the background. + ui_test_utils::NavigateToURLWithDispositionBlockUntilNavigationsComplete( + browser(), GetTestURL(), 1, WindowOpenDisposition::NEW_BACKGROUND_TAB, + ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); + + // Close the foreground tab. + TabStripModel* tab_strip_model = browser()->tab_strip_model(); + content::WebContentsDestroyedWatcher destroyed_watcher( + tab_strip_model->GetWebContentsAt(0)); + EXPECT_TRUE(tab_strip_model->CloseWebContentsAt(0, 0)); + destroyed_watcher.Wait(); + // Now the background tab should have moved to the foreground. + + // 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); +}
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 new file mode 100644 index 0000000..d47dbb2 --- /dev/null +++ b/chrome/browser/page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer_unittest.cc
@@ -0,0 +1,138 @@ +// 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/multi_tab_loading_page_load_metrics_observer.h" + +#include "base/memory/ptr_util.h" +#include "base/optional.h" +#include "chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.h" + +namespace { + +const char kDefaultTestUrl[] = "https://google.com"; + +class TestMultiTabLoadingPageLoadMetricsObserver + : public MultiTabLoadingPageLoadMetricsObserver { + public: + explicit TestMultiTabLoadingPageLoadMetricsObserver(bool multi_tab_loading) + : multi_tab_loading_(multi_tab_loading) {} + ~TestMultiTabLoadingPageLoadMetricsObserver() override {} + + private: + bool IsAnyTabLoading(content::NavigationHandle* navigation_handle) override { + return multi_tab_loading_; + } + + const bool multi_tab_loading_; +}; + +} // namespace + +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; + + page_load_metrics::mojom::PageLoadTiming timing; + page_load_metrics::InitPageLoadTimingForTest(&timing); + timing.navigation_start = base::Time::FromDoubleT(1); + timing.paint_timing->first_contentful_paint = + base::TimeDelta::FromMilliseconds(300); + timing.paint_timing->first_meaningful_paint = + base::TimeDelta::FromMilliseconds(700); + timing.document_timing->dom_content_loaded_event_start = + base::TimeDelta::FromMilliseconds(600); + timing.document_timing->load_event_start = + base::TimeDelta::FromMilliseconds(1000); + PopulateRequiredTimingFields(&timing); + + if (tab_state == Background) { + // Start in background. + web_contents()->WasHidden(); + } + + NavigateAndCommit(GURL(kDefaultTestUrl)); + + if (tab_state == Background) { + // Foreground the tab. + web_contents()->WasShown(); + } + + SimulateTimingUpdate(timing); + } + + protected: + void RegisterObservers(page_load_metrics::PageLoadTracker* tracker) override { + tracker->AddObserver( + base::MakeUnique<TestMultiTabLoadingPageLoadMetricsObserver>( + use_case_.value() == MultiTabLoading)); + } + + private: + base::Optional<UseCase> use_case_; +}; + +TEST_F(MultiTabLoadingPageLoadMetricsObserverTest, SingleTabLoading) { + SimulatePageLoad(SingleTabLoading, Foreground); + 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); +} + +TEST_F(MultiTabLoadingPageLoadMetricsObserverTest, MultiTabLoading) { + SimulatePageLoad(MultiTabLoading, Foreground); + 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); +} + +TEST_F(MultiTabLoadingPageLoadMetricsObserverTest, MultiTabBackground) { + SimulatePageLoad(MultiTabLoading, Background); + 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); +}
diff --git a/chrome/browser/page_load_metrics/page_load_metrics_initialize.cc b/chrome/browser/page_load_metrics/page_load_metrics_initialize.cc index 4e400fb..ce05d70 100644 --- a/chrome/browser/page_load_metrics/page_load_metrics_initialize.cc +++ b/chrome/browser/page_load_metrics/page_load_metrics_initialize.cc
@@ -28,6 +28,7 @@ #include "chrome/browser/page_load_metrics/observers/loading_predictor_page_load_metrics_observer.h" #include "chrome/browser/page_load_metrics/observers/lofi_page_load_metrics_observer.h" #include "chrome/browser/page_load_metrics/observers/media_page_load_metrics_observer.h" +#include "chrome/browser/page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer.h" #include "chrome/browser/page_load_metrics/observers/no_state_prefetch_page_load_metrics_observer.h" #include "chrome/browser/page_load_metrics/observers/omnibox_suggestion_used_page_load_metrics_observer.h" #include "chrome/browser/page_load_metrics/observers/prerender_page_load_metrics_observer.h" @@ -93,6 +94,8 @@ base::MakeUnique<DocumentWritePageLoadMetricsObserver>()); tracker->AddObserver(base::MakeUnique<MediaPageLoadMetricsObserver>()); tracker->AddObserver( + base::MakeUnique<MultiTabLoadingPageLoadMetricsObserver>()); + tracker->AddObserver( base::MakeUnique<previews::PreviewsPageLoadMetricsObserver>()); tracker->AddObserver( base::MakeUnique<ServiceWorkerPageLoadMetricsObserver>());
diff --git a/chrome/browser/safe_browsing/BUILD.gn b/chrome/browser/safe_browsing/BUILD.gn index b59b2e5..8494c3c 100644 --- a/chrome/browser/safe_browsing/BUILD.gn +++ b/chrome/browser/safe_browsing/BUILD.gn
@@ -2,6 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//extensions/features/features.gni") import("//third_party/protobuf/proto_library.gni") proto_library("chunk_proto") { @@ -9,3 +10,236 @@ "chunk.proto", ] } + +static_library("safe_browsing") { + sources = [ + "browser_url_loader_throttle.cc", + "browser_url_loader_throttle.h", + "chrome_cleaner/chrome_cleaner_controller_win.cc", + "chrome_cleaner/chrome_cleaner_controller_win.h", + "chrome_cleaner/chrome_cleaner_fetcher_win.cc", + "chrome_cleaner/chrome_cleaner_fetcher_win.h", + "chrome_cleaner/chrome_cleaner_runner_win.cc", + "chrome_cleaner/chrome_cleaner_runner_win.h", + "chrome_cleaner/reporter_runner_win.cc", + "chrome_cleaner/reporter_runner_win.h", + "chrome_cleaner/settings_resetter_win.cc", + "chrome_cleaner/settings_resetter_win.h", + "chrome_cleaner/srt_chrome_prompt_impl.cc", + "chrome_cleaner/srt_chrome_prompt_impl.h", + "chrome_cleaner/srt_client_info_win.cc", + "chrome_cleaner/srt_client_info_win.h", + "chrome_cleaner/srt_field_trial_win.cc", + "chrome_cleaner/srt_field_trial_win.h", + "chrome_cleaner/srt_global_error_win.cc", + "chrome_cleaner/srt_global_error_win.h", + "mojo_safe_browsing_impl.cc", + "mojo_safe_browsing_impl.h", + "safe_browsing_tab_observer.cc", + "safe_browsing_tab_observer.h", + "safe_browsing_url_checker_impl.cc", + "safe_browsing_url_checker_impl.h", + ] + + deps = [ + "//chrome/app:generated_resources", + "//components/safe_browsing/common:interfaces", + ] + + if (enable_extensions) { + sources += [ + "chrome_cleaner/chrome_cleaner_dialog_controller_win.cc", + "chrome_cleaner/chrome_cleaner_dialog_controller_win.h", + "settings_reset_prompt/default_settings_fetcher.cc", + "settings_reset_prompt/default_settings_fetcher.h", + "settings_reset_prompt/extension_info.cc", + "settings_reset_prompt/extension_info.h", + "settings_reset_prompt/settings_reset_prompt_config.cc", + "settings_reset_prompt/settings_reset_prompt_config.h", + "settings_reset_prompt/settings_reset_prompt_controller.cc", + "settings_reset_prompt/settings_reset_prompt_controller.h", + "settings_reset_prompt/settings_reset_prompt_model.cc", + "settings_reset_prompt/settings_reset_prompt_model.h", + "settings_reset_prompt/settings_reset_prompt_prefs_manager.cc", + "settings_reset_prompt/settings_reset_prompt_prefs_manager.h", + ] + } + + if (safe_browsing_mode != 0) { + # "Safe Browsing Basic" files used for safe browsing in full mode + # (safe_browsing=1) and mobile (=2) + sources += [ + "../loader/data_reduction_proxy_resource_throttle_android.cc", + "../loader/data_reduction_proxy_resource_throttle_android.h", + "certificate_reporting_metrics_provider.cc", + "certificate_reporting_metrics_provider.h", + "certificate_reporting_service.cc", + "certificate_reporting_service.h", + "certificate_reporting_service_factory.cc", + "certificate_reporting_service_factory.h", + "notification_image_reporter.cc", + "notification_image_reporter.h", + "permission_reporter.cc", + "permission_reporter.h", + "ping_manager.cc", + "ping_manager.h", + "safe_browsing_blocking_page.cc", + "safe_browsing_blocking_page.h", + "safe_browsing_navigation_observer.cc", + "safe_browsing_navigation_observer.h", + "safe_browsing_navigation_observer_manager.cc", + "safe_browsing_navigation_observer_manager.h", + "safe_browsing_service.cc", + "safe_browsing_service.h", + "services_delegate.h", + "test_safe_browsing_blocking_page_quiet.cc", + "test_safe_browsing_blocking_page_quiet.h", + "test_safe_browsing_service.cc", + "test_safe_browsing_service.h", + "ui_manager.cc", + "ui_manager.h", + ] + deps += [ + "//chrome/browser/safe_browsing:chunk_proto", + "//chrome/common/safe_browsing:proto", + "//components/safe_browsing:csd_proto", + "//components/safe_browsing:safe_browsing", + "//components/safe_browsing/browser:browser", + "//components/safe_browsing/common:common", + "//components/safe_browsing/password_protection", + "//components/safe_browsing/triggers:triggers", + "//components/safe_browsing_db:metadata_proto", + ] + if (safe_browsing_mode == 1) { + # "Safe Browsing Full" files in addition to the "basic" ones to use for + # full safe browsing. This has some in common with "mobile." + sources += [ + "../download/download_completion_blocker.cc", + "../download/download_completion_blocker.h", + "../loader/safe_browsing_resource_throttle.cc", + "../loader/safe_browsing_resource_throttle.h", + "browser_feature_extractor.cc", + "browser_feature_extractor.h", + "browser_features.cc", + "browser_features.h", + "chrome_password_protection_service.cc", + "chrome_password_protection_service.h", + "chunk_range.cc", + "chunk_range.h", + "client_side_detection_host.cc", + "client_side_detection_host.h", + "client_side_detection_service.cc", + "client_side_detection_service.h", + "client_side_model_loader.cc", + "client_side_model_loader.h", + "download_feedback.cc", + "download_feedback.h", + "download_feedback_service.cc", + "download_feedback_service.h", + "download_protection_service.cc", + "download_protection_service.h", + "incident_reporting/binary_integrity_analyzer.cc", + "incident_reporting/binary_integrity_analyzer.h", + "incident_reporting/binary_integrity_analyzer_mac.cc", + "incident_reporting/binary_integrity_analyzer_mac.h", + "incident_reporting/binary_integrity_analyzer_win.cc", + "incident_reporting/binary_integrity_analyzer_win.h", + "incident_reporting/binary_integrity_incident.cc", + "incident_reporting/binary_integrity_incident.h", + "incident_reporting/blacklist_load_analyzer.cc", + "incident_reporting/blacklist_load_analyzer.h", + "incident_reporting/blacklist_load_analyzer_win.cc", + "incident_reporting/blacklist_load_incident.cc", + "incident_reporting/blacklist_load_incident.h", + "incident_reporting/delayed_analysis_callback.h", + "incident_reporting/delayed_callback_runner.cc", + "incident_reporting/delayed_callback_runner.h", + "incident_reporting/download_metadata_manager.cc", + "incident_reporting/download_metadata_manager.h", + "incident_reporting/environment_data_collection.cc", + "incident_reporting/environment_data_collection.h", + "incident_reporting/environment_data_collection_win.cc", + "incident_reporting/environment_data_collection_win.h", + "incident_reporting/extension_data_collection.cc", + "incident_reporting/extension_data_collection.h", + "incident_reporting/incident.cc", + "incident_reporting/incident.h", + "incident_reporting/incident_handler_util.cc", + "incident_reporting/incident_handler_util.h", + "incident_reporting/incident_receiver.h", + "incident_reporting/incident_report_uploader.cc", + "incident_reporting/incident_report_uploader.h", + "incident_reporting/incident_report_uploader_impl.cc", + "incident_reporting/incident_report_uploader_impl.h", + "incident_reporting/incident_reporting_service.cc", + "incident_reporting/incident_reporting_service.h", + "incident_reporting/last_download_finder.cc", + "incident_reporting/last_download_finder.h", + "incident_reporting/module_integrity_verifier_win.cc", + "incident_reporting/module_integrity_verifier_win.h", + "incident_reporting/module_load_analyzer.cc", + "incident_reporting/module_load_analyzer.h", + "incident_reporting/module_load_analyzer_win.cc", + "incident_reporting/platform_state_store.cc", + "incident_reporting/platform_state_store.h", + "incident_reporting/platform_state_store_win.cc", + "incident_reporting/preference_validation_delegate.cc", + "incident_reporting/preference_validation_delegate.h", + "incident_reporting/resource_request_detector.cc", + "incident_reporting/resource_request_detector.h", + "incident_reporting/resource_request_incident.cc", + "incident_reporting/resource_request_incident.h", + "incident_reporting/state_store.cc", + "incident_reporting/state_store.h", + "incident_reporting/suspicious_module_incident.cc", + "incident_reporting/suspicious_module_incident.h", + "incident_reporting/tracked_preference_incident.cc", + "incident_reporting/tracked_preference_incident.h", + "incident_reporting/variations_seed_signature_analyzer.cc", + "incident_reporting/variations_seed_signature_analyzer.h", + "incident_reporting/variations_seed_signature_incident.cc", + "incident_reporting/variations_seed_signature_incident.h", + "local_database_manager.cc", + "local_database_manager.h", + "path_sanitizer.cc", + "path_sanitizer.h", + "protocol_manager.cc", + "protocol_manager.h", + "protocol_parser.cc", + "protocol_parser.h", + "safe_browsing_database.cc", + "safe_browsing_database.h", + "safe_browsing_store.cc", + "safe_browsing_store.h", + "safe_browsing_store_file.cc", + "safe_browsing_store_file.h", + "safe_browsing_util.cc", + "safe_browsing_util.h", + "sandboxed_dmg_analyzer_mac.cc", + "sandboxed_dmg_analyzer_mac.h", + "sandboxed_zip_analyzer.cc", + "sandboxed_zip_analyzer.h", + "services_delegate_impl.cc", + "services_delegate_impl.h", + "signature_evaluator_mac.h", + "signature_evaluator_mac.mm", + "two_phase_uploader.cc", + "two_phase_uploader.h", + "v4_test_utils.cc", + "v4_test_utils.h", + ] + deps += [ "//components/safe_browsing_db:safe_browsing_db" ] + if (is_win) { + deps += [ "//chrome/browser/safe_browsing/incident_reporting:state_store_data_proto" ] + } + } else if (safe_browsing_mode == 2) { + sources += [ + "../loader/safe_browsing_resource_throttle.cc", + "../loader/safe_browsing_resource_throttle.h", + "services_delegate_stub.cc", + "services_delegate_stub.h", + ] + deps += [ "//components/safe_browsing_db:safe_browsing_db_mobile" ] + } + } +}
diff --git a/chrome/browser/signin/easy_unlock_app_manager.cc b/chrome/browser/signin/easy_unlock_app_manager.cc index 50327f1..e3ad8c3 100644 --- a/chrome/browser/signin/easy_unlock_app_manager.cc +++ b/chrome/browser/signin/easy_unlock_app_manager.cc
@@ -188,7 +188,7 @@ extensions::ScreenlockPrivateEventRouter::GetFactoryInstance()->Get( extension_service->profile()); return screenlock_router->OnAuthAttempted( - proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK, std::string()); + proximity_auth::mojom::AuthType::USER_CLICK, std::string()); } } // namespace
diff --git a/chrome/browser/signin/easy_unlock_auth_attempt.cc b/chrome/browser/signin/easy_unlock_auth_attempt.cc index 345e1d1..cc12f9a6 100644 --- a/chrome/browser/signin/easy_unlock_auth_attempt.cc +++ b/chrome/browser/signin/easy_unlock_auth_attempt.cc
@@ -108,11 +108,11 @@ if (!proximity_auth::ScreenlockBridge::Get()->IsLocked()) return false; - proximity_auth::ScreenlockBridge::LockHandler::AuthType auth_type = + proximity_auth::mojom::AuthType auth_type = proximity_auth::ScreenlockBridge::Get()->lock_handler()->GetAuthType( account_id_); - if (auth_type != proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK) { + if (auth_type != proximity_auth::mojom::AuthType::USER_CLICK) { Cancel(account_id_); return false; }
diff --git a/chrome/browser/signin/easy_unlock_auth_attempt_unittest.cc b/chrome/browser/signin/easy_unlock_auth_attempt_unittest.cc index 9affe469..003e8b9d 100644 --- a/chrome/browser/signin/easy_unlock_auth_attempt_unittest.cc +++ b/chrome/browser/signin/easy_unlock_auth_attempt_unittest.cc
@@ -117,7 +117,9 @@ }; explicit TestLockHandler(const AccountId& account_id) - : state_(STATE_NONE), auth_type_(USER_CLICK), account_id_(account_id) {} + : state_(STATE_NONE), + auth_type_(proximity_auth::mojom::AuthType::USER_CLICK), + account_id_(account_id) {} ~TestLockHandler() override {} @@ -130,7 +132,9 @@ } // Not using |SetAuthType| to make sure it's not called during tests. - void set_auth_type(AuthType value) { auth_type_ = value; } + void set_auth_type(proximity_auth::mojom::AuthType value) { + auth_type_ = value; + } // proximity_auth::ScreenlockBridge::LockHandler implementation: void ShowBannerMessage(const base::string16& message) override { @@ -154,12 +158,13 @@ } void SetAuthType(const AccountId& account_id, - AuthType auth_type, + proximity_auth::mojom::AuthType auth_type, const base::string16& auth_value) override { ADD_FAILURE() << "Should not be reached."; } - AuthType GetAuthType(const AccountId& account_id) const override { + proximity_auth::mojom::AuthType GetAuthType( + const AccountId& account_id) const override { return auth_type_; } @@ -199,7 +204,7 @@ private: AuthState state_; - AuthType auth_type_; + proximity_auth::mojom::AuthType auth_type_; const AccountId account_id_; std::string expected_secret_; @@ -256,7 +261,7 @@ ASSERT_EQ(TestLockHandler::STATE_ATTEMPTING_UNLOCK, lock_handler_->state()); lock_handler_->set_auth_type( - proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD); + proximity_auth::mojom::AuthType::OFFLINE_PASSWORD); EXPECT_FALSE(auth_attempt_->Start()); @@ -414,7 +419,7 @@ ASSERT_EQ(TestLockHandler::STATE_ATTEMPTING_SIGNIN, lock_handler_->state()); lock_handler_->set_auth_type( - proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD); + proximity_auth::mojom::AuthType::OFFLINE_PASSWORD); EXPECT_FALSE(auth_attempt_->Start());
diff --git a/chrome/browser/signin/easy_unlock_screenlock_state_handler.cc b/chrome/browser/signin/easy_unlock_screenlock_state_handler.cc index 6ab4c44..87d847b9f 100644 --- a/chrome/browser/signin/easy_unlock_screenlock_state_handler.cc +++ b/chrome/browser/signin/easy_unlock_screenlock_state_handler.cc
@@ -152,7 +152,7 @@ // Do nothing when auth type is online. if (screenlock_bridge_->lock_handler()->GetAuthType(account_id_) == - proximity_auth::ScreenlockBridge::LockHandler::ONLINE_SIGN_IN) { + proximity_auth::mojom::AuthType::ONLINE_SIGN_IN) { return; } @@ -271,18 +271,14 @@ return; // Do not override online signin. - const proximity_auth::ScreenlockBridge::LockHandler::AuthType - existing_auth_type = - screenlock_bridge_->lock_handler()->GetAuthType(account_id_); - if (existing_auth_type == - proximity_auth::ScreenlockBridge::LockHandler::ONLINE_SIGN_IN) + const proximity_auth::mojom::AuthType existing_auth_type = + screenlock_bridge_->lock_handler()->GetAuthType(account_id_); + if (existing_auth_type == proximity_auth::mojom::AuthType::ONLINE_SIGN_IN) return; - if (existing_auth_type != - proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD) { + if (existing_auth_type != proximity_auth::mojom::AuthType::OFFLINE_PASSWORD) { screenlock_bridge_->lock_handler()->SetAuthType( - account_id_, - proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, + account_id_, proximity_auth::mojom::AuthType::OFFLINE_PASSWORD, base::string16()); } @@ -377,26 +373,22 @@ return; // Do not override online signin. - const proximity_auth::ScreenlockBridge::LockHandler::AuthType - existing_auth_type = - screenlock_bridge_->lock_handler()->GetAuthType(account_id_); - DCHECK_NE(proximity_auth::ScreenlockBridge::LockHandler::ONLINE_SIGN_IN, + const proximity_auth::mojom::AuthType existing_auth_type = + screenlock_bridge_->lock_handler()->GetAuthType(account_id_); + DCHECK_NE(proximity_auth::mojom::AuthType::ONLINE_SIGN_IN, existing_auth_type); if (state_ == ScreenlockState::AUTHENTICATED) { - if (existing_auth_type != - proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK) { + if (existing_auth_type != proximity_auth::mojom::AuthType::USER_CLICK) { screenlock_bridge_->lock_handler()->SetAuthType( - account_id_, - proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK, + account_id_, proximity_auth::mojom::AuthType::USER_CLICK, l10n_util::GetStringUTF16( IDS_EASY_UNLOCK_SCREENLOCK_USER_POD_AUTH_VALUE)); } } else if (existing_auth_type != - proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD) { + proximity_auth::mojom::AuthType::OFFLINE_PASSWORD) { screenlock_bridge_->lock_handler()->SetAuthType( - account_id_, - proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, + account_id_, proximity_auth::mojom::AuthType::OFFLINE_PASSWORD, base::string16()); } }
diff --git a/chrome/browser/signin/easy_unlock_screenlock_state_handler_unittest.cc b/chrome/browser/signin/easy_unlock_screenlock_state_handler_unittest.cc index c0a9b99..364c6595 100644 --- a/chrome/browser/signin/easy_unlock_screenlock_state_handler_unittest.cc +++ b/chrome/browser/signin/easy_unlock_screenlock_state_handler_unittest.cc
@@ -52,7 +52,7 @@ explicit TestLockHandler(const AccountId& account_id) : account_id_(account_id), show_icon_count_(0u), - auth_type_(OFFLINE_PASSWORD) {} + auth_type_(proximity_auth::mojom::AuthType::OFFLINE_PASSWORD) {} ~TestLockHandler() override {} // proximity_auth::ScreenlockBridge::LockHandler implementation: @@ -84,7 +84,7 @@ } void SetAuthType(const AccountId& account_id, - AuthType auth_type, + proximity_auth::mojom::AuthType auth_type, const base::string16& auth_value) override { ASSERT_TRUE(account_id_ == account_id) << "account_id_=" << account_id_.Serialize() @@ -97,7 +97,8 @@ auth_value_ = auth_value; } - AuthType GetAuthType(const AccountId& account_id) const override { + proximity_auth::mojom::AuthType GetAuthType( + const AccountId& account_id) const override { EXPECT_TRUE(account_id_ == account_id) << "account_id_=" << account_id_.Serialize() << " != account_id=" << account_id.Serialize(); @@ -207,7 +208,7 @@ size_t show_icon_count_; // Auth type and value set using |SetAuthType|. - AuthType auth_type_; + proximity_auth::mojom::AuthType auth_type_; base::string16 auth_value_; DISALLOW_COPY_AND_ASSIGN(TestLockHandler); @@ -254,7 +255,7 @@ state_handler_->ChangeState(ScreenlockState::AUTHENTICATED); EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); - EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK, + EXPECT_EQ(proximity_auth::mojom::AuthType::USER_CLICK, lock_handler_->GetAuthType(account_id_)); ASSERT_TRUE(lock_handler_->HasCustomIcon()); @@ -272,7 +273,7 @@ state_handler_->ChangeState(ScreenlockState::AUTHENTICATED); EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); - EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK, + EXPECT_EQ(proximity_auth::mojom::AuthType::USER_CLICK, lock_handler_->GetAuthType(account_id_)); ASSERT_TRUE(lock_handler_->HasCustomIcon()); @@ -295,7 +296,7 @@ EXPECT_TRUE(state_handler_->IsActive()); EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); - EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, + EXPECT_EQ(proximity_auth::mojom::AuthType::OFFLINE_PASSWORD, lock_handler_->GetAuthType(account_id_)); ASSERT_TRUE(lock_handler_->HasCustomIcon()); @@ -312,14 +313,14 @@ state_handler_->ChangeState(ScreenlockState::AUTHENTICATED); EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); - EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK, + EXPECT_EQ(proximity_auth::mojom::AuthType::USER_CLICK, lock_handler_->GetAuthType(account_id_)); state_handler_->SetHardlockState( EasyUnlockScreenlockStateHandler::USER_HARDLOCK); EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); - EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, + EXPECT_EQ(proximity_auth::mojom::AuthType::OFFLINE_PASSWORD, lock_handler_->GetAuthType(account_id_)); ASSERT_TRUE(lock_handler_->HasCustomIcon()); @@ -339,14 +340,14 @@ state_handler_->ChangeState(ScreenlockState::AUTHENTICATED); EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); - EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK, + EXPECT_EQ(proximity_auth::mojom::AuthType::USER_CLICK, lock_handler_->GetAuthType(account_id_)); state_handler_->SetHardlockState( EasyUnlockScreenlockStateHandler::NO_PAIRING); EXPECT_FALSE(lock_handler_->HasCustomIcon()); - EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, + EXPECT_EQ(proximity_auth::mojom::AuthType::OFFLINE_PASSWORD, lock_handler_->GetAuthType(account_id_)); } @@ -365,7 +366,7 @@ EXPECT_TRUE(state_handler_->IsActive()); EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); - EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, + EXPECT_EQ(proximity_auth::mojom::AuthType::OFFLINE_PASSWORD, lock_handler_->GetAuthType(account_id_)); ASSERT_TRUE(lock_handler_->HasCustomIcon()); @@ -383,7 +384,7 @@ state_handler_->ChangeState(ScreenlockState::AUTHENTICATED); EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); - EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK, + EXPECT_EQ(proximity_auth::mojom::AuthType::USER_CLICK, lock_handler_->GetAuthType(account_id_)); ASSERT_TRUE(lock_handler_->HasCustomIcon()); @@ -392,7 +393,7 @@ state_handler_->SetTrialRun(); EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); - EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK, + EXPECT_EQ(proximity_auth::mojom::AuthType::USER_CLICK, lock_handler_->GetAuthType(account_id_)); ASSERT_TRUE(lock_handler_->HasCustomIcon()); @@ -404,7 +405,7 @@ state_handler_->ChangeState(ScreenlockState::AUTHENTICATED); EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); - EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK, + EXPECT_EQ(proximity_auth::mojom::AuthType::USER_CLICK, lock_handler_->GetAuthType(account_id_)); ASSERT_TRUE(lock_handler_->HasCustomIcon()); @@ -412,7 +413,7 @@ state_handler_.reset(); EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount()); - EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, + EXPECT_EQ(proximity_auth::mojom::AuthType::OFFLINE_PASSWORD, lock_handler_->GetAuthType(account_id_)); ASSERT_FALSE(lock_handler_->HasCustomIcon()); @@ -422,7 +423,7 @@ state_handler_->ChangeState(ScreenlockState::AUTHENTICATED); EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); - EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK, + EXPECT_EQ(proximity_auth::mojom::AuthType::USER_CLICK, lock_handler_->GetAuthType(account_id_)); ASSERT_TRUE(lock_handler_->HasCustomIcon()); @@ -432,7 +433,7 @@ proximity_auth::ScreenlockBridge::Get()->SetLockHandler(lock_handler_.get()); EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); - EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK, + EXPECT_EQ(proximity_auth::mojom::AuthType::USER_CLICK, lock_handler_->GetAuthType(account_id_)); ASSERT_TRUE(lock_handler_->HasCustomIcon()); } @@ -441,7 +442,7 @@ state_handler_->ChangeState(ScreenlockState::AUTHENTICATED); EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); - EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK, + EXPECT_EQ(proximity_auth::mojom::AuthType::USER_CLICK, lock_handler_->GetAuthType(account_id_)); ASSERT_TRUE(lock_handler_->HasCustomIcon()); @@ -454,7 +455,7 @@ proximity_auth::ScreenlockBridge::Get()->SetLockHandler(lock_handler_.get()); EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); - EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, + EXPECT_EQ(proximity_auth::mojom::AuthType::OFFLINE_PASSWORD, lock_handler_->GetAuthType(account_id_)); ASSERT_TRUE(lock_handler_->HasCustomIcon()); EXPECT_EQ(kSpinnerIconId, lock_handler_->GetCustomIconId()); @@ -595,14 +596,14 @@ state_handler_->ChangeState(ScreenlockState::AUTHENTICATED); EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); - EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK, + EXPECT_EQ(proximity_auth::mojom::AuthType::USER_CLICK, lock_handler_->GetAuthType(account_id_)); state_handler_->SetHardlockState( EasyUnlockScreenlockStateHandler::USER_HARDLOCK); EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); - EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, + EXPECT_EQ(proximity_auth::mojom::AuthType::OFFLINE_PASSWORD, lock_handler_->GetAuthType(account_id_)); ASSERT_TRUE(lock_handler_->HasCustomIcon()); EXPECT_EQ(kHardlockedIconId, lock_handler_->GetCustomIconId()); @@ -614,7 +615,7 @@ state_handler_->ChangeState(ScreenlockState::AUTHENTICATED); ASSERT_TRUE(lock_handler_->HasCustomIcon()); EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount()); - EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, + EXPECT_EQ(proximity_auth::mojom::AuthType::OFFLINE_PASSWORD, lock_handler_->GetAuthType(account_id_)); } @@ -646,14 +647,14 @@ EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); EXPECT_TRUE(lock_handler_->HasCustomIcon()); - EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, + EXPECT_EQ(proximity_auth::mojom::AuthType::OFFLINE_PASSWORD, lock_handler_->GetAuthType(account_id_)); EXPECT_EQ(kLockedIconId, lock_handler_->GetCustomIconId()); state_handler_->ChangeState(ScreenlockState::AUTHENTICATED); EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); EXPECT_TRUE(lock_handler_->HasCustomIcon()); - EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK, + EXPECT_EQ(proximity_auth::mojom::AuthType::USER_CLICK, lock_handler_->GetAuthType(account_id_)); EXPECT_TRUE(lock_handler_->CustomIconHardlocksOnClick()); } @@ -670,7 +671,7 @@ proximity_auth::ScreenlockBridge::Get()->SetLockHandler(lock_handler_.get()); EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); - EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, + EXPECT_EQ(proximity_auth::mojom::AuthType::OFFLINE_PASSWORD, lock_handler_->GetAuthType(account_id_)); ASSERT_TRUE(lock_handler_->HasCustomIcon()); EXPECT_EQ(kHardlockedIconId, lock_handler_->GetCustomIconId()); @@ -678,15 +679,14 @@ state_handler_->ChangeState(ScreenlockState::AUTHENTICATED); EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount()); EXPECT_TRUE(lock_handler_->HasCustomIcon()); - EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, + EXPECT_EQ(proximity_auth::mojom::AuthType::OFFLINE_PASSWORD, lock_handler_->GetAuthType(account_id_)); } TEST_F(EasyUnlockScreenlockStateHandlerTest, NoOverrideOnlineSignin) { - lock_handler_->SetAuthType( - account_id_, - proximity_auth::ScreenlockBridge::LockHandler::ONLINE_SIGN_IN, - base::string16()); + lock_handler_->SetAuthType(account_id_, + proximity_auth::mojom::AuthType::ONLINE_SIGN_IN, + base::string16()); std::vector<ScreenlockState> states; states.push_back(ScreenlockState::NO_BLUETOOTH); @@ -703,7 +703,7 @@ for (size_t i = 0; i < states.size(); ++i) { state_handler_->ChangeState(states[i]); - EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::ONLINE_SIGN_IN, + EXPECT_EQ(proximity_auth::mojom::AuthType::ONLINE_SIGN_IN, lock_handler_->GetAuthType(account_id_)); EXPECT_FALSE(lock_handler_->HasCustomIcon()); } @@ -718,7 +718,7 @@ for (size_t i = 0; i < hardlock_states.size(); ++i) { state_handler_->SetHardlockState(hardlock_states[i]); - EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::ONLINE_SIGN_IN, + EXPECT_EQ(proximity_auth::mojom::AuthType::ONLINE_SIGN_IN, lock_handler_->GetAuthType(account_id_)); EXPECT_FALSE(lock_handler_->HasCustomIcon()); }
diff --git a/chrome/browser/translate/chrome_translate_client.cc b/chrome/browser/translate/chrome_translate_client.cc index 0c978b9..5ee1a22 100644 --- a/chrome/browser/translate/chrome_translate_client.cc +++ b/chrome/browser/translate/chrome_translate_client.cc
@@ -7,6 +7,7 @@ #include <memory> #include <vector> +#include "base/feature_list.h" #include "base/logging.h" #include "base/path_service.h" #include "base/strings/string_split.h" @@ -31,6 +32,7 @@ #include "chrome/grit/theme_resources.h" #include "components/metrics/proto/translate_event.pb.h" #include "components/prefs/pref_service.h" +#include "components/sync/driver/sync_driver_switches.h" #include "components/sync/protocol/user_event_specifics.pb.h" #include "components/sync/user_events/user_event_service.h" #include "components/translate/core/browser/language_model.h" @@ -53,6 +55,7 @@ #include "url/gurl.h" namespace { +using base::FeatureList; using metrics::TranslateEventProto; TranslateEventProto::EventType BubbleResultToTranslateEvent( @@ -79,6 +82,8 @@ void LogLanguageDetectionEvent( const content::WebContents* const web_contents, const translate::LanguageDetectionDetails& details) { + if (!FeatureList::IsEnabled(switches::kSyncUserLanguageDetectionEvents)) + return; auto* const profile = Profile::FromBrowserContext(web_contents->GetBrowserContext()); @@ -104,6 +109,8 @@ void LogTranslateEvent(const content::WebContents* const web_contents, const metrics::TranslateEventProto& translate_event) { + if (!FeatureList::IsEnabled(switches::kSyncUserTranslationEvents)) + return; DCHECK(web_contents); auto* const profile = Profile::FromBrowserContext(web_contents->GetBrowserContext());
diff --git a/chrome/browser/translate/chrome_translate_client_unittest.cc b/chrome/browser/translate/chrome_translate_client_unittest.cc index 1793d84..18f9cf9 100644 --- a/chrome/browser/translate/chrome_translate_client_unittest.cc +++ b/chrome/browser/translate/chrome_translate_client_unittest.cc
@@ -9,9 +9,11 @@ #include "base/command_line.h" #include "base/memory/ref_counted.h" #include "base/run_loop.h" +#include "base/test/scoped_feature_list.h" #include "chrome/browser/sync/profile_sync_service_factory.h" #include "chrome/browser/sync/user_event_service_factory.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h" +#include "components/sync/driver/sync_driver_switches.h" #include "components/sync/user_events/fake_user_event_service.h" #include "components/translate/core/common/language_detection_details.h" #include "content/public/browser/web_contents.h" @@ -31,6 +33,9 @@ browser_sync::UserEventServiceFactory::GetInstance() ->SetTestingFactoryAndUse(browser_context(), &BuildFakeUserEventService)); + scoped_feature_list_ = base::MakeUnique<base::test::ScopedFeatureList>(); + scoped_feature_list_->InitAndEnableFeature( + switches::kSyncUserLanguageDetectionEvents); } void TearDown() override { ChromeRenderViewHostTestHarness::TearDown(); } @@ -41,6 +46,7 @@ } private: + std::unique_ptr<base::test::ScopedFeatureList> scoped_feature_list_; syncer::FakeUserEventService* fake_user_event_service_; };
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index d1b18be..894c60f 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -477,6 +477,7 @@ "//chrome/browser:resource_prefetch_predictor_proto", "//chrome/browser/devtools", "//chrome/browser/engagement:mojo_bindings", + "//chrome/browser/safe_browsing", "//chrome/browser/ui/webui/omnibox:mojo_bindings", "//chrome/browser/ui/webui/usb_internals:mojo_bindings", "//chrome/common",
diff --git a/chrome/browser/ui/ash/ime_controller_client.cc b/chrome/browser/ui/ash/ime_controller_client.cc index 16385ce..18ccedbf 100644 --- a/chrome/browser/ui/ash/ime_controller_client.cc +++ b/chrome/browser/ui/ash/ime_controller_client.cc
@@ -142,22 +142,20 @@ InputMethodManager::State* state = input_method_manager_->GetActiveIMEState().get(); if (!state) { - ime_controller_ptr_->RefreshIme(ash::mojom::ImeInfo::New(), + const std::string empty_ime_id; + ime_controller_ptr_->RefreshIme(empty_ime_id, std::vector<ash::mojom::ImeInfoPtr>(), std::vector<ash::mojom::ImeMenuItemPtr>()); return; } - InputMethodDescriptor current_descriptor = state->GetCurrentInputMethod(); - ash::mojom::ImeInfoPtr current_ime = GetAshImeInfo(current_descriptor); - current_ime->selected = true; + const std::string current_ime_id = state->GetCurrentInputMethod().id(); std::vector<ash::mojom::ImeInfoPtr> available_imes; std::unique_ptr<std::vector<InputMethodDescriptor>> available_ime_descriptors = state->GetActiveInputMethods(); for (const InputMethodDescriptor& descriptor : *available_ime_descriptors) { ash::mojom::ImeInfoPtr info = GetAshImeInfo(descriptor); - info->selected = descriptor.id() == current_ime->id; available_imes.push_back(std::move(info)); } @@ -172,7 +170,6 @@ ash_item->checked = menu_item.is_selection_item_checked; ash_menu_items.push_back(std::move(ash_item)); } - ime_controller_ptr_->RefreshIme(std::move(current_ime), - std::move(available_imes), + ime_controller_ptr_->RefreshIme(current_ime_id, std::move(available_imes), std::move(ash_menu_items)); }
diff --git a/chrome/browser/ui/ash/ime_controller_client_unittest.cc b/chrome/browser/ui/ash/ime_controller_client_unittest.cc index dc101460..457756fb 100644 --- a/chrome/browser/ui/ash/ime_controller_client_unittest.cc +++ b/chrome/browser/ui/ash/ime_controller_client_unittest.cc
@@ -137,10 +137,10 @@ // ash::mojom::ImeController: void SetClient(ash::mojom::ImeControllerClientPtr client) override {} - void RefreshIme(ash::mojom::ImeInfoPtr current_ime, + void RefreshIme(const std::string& current_ime_id, std::vector<ash::mojom::ImeInfoPtr> available_imes, std::vector<ash::mojom::ImeMenuItemPtr> menu_items) override { - current_ime_ = std::move(current_ime); + current_ime_id_ = current_ime_id; available_imes_ = std::move(available_imes); menu_items_ = std::move(menu_items); } @@ -152,7 +152,7 @@ } // The most recent values received via mojo. - ash::mojom::ImeInfoPtr current_ime_; + std::string current_ime_id_; std::vector<ash::mojom::ImeInfoPtr> available_imes_; std::vector<ash::mojom::ImeMenuItemPtr> menu_items_; bool managed_by_policy_ = false; @@ -166,9 +166,18 @@ class ImeControllerClientTest : public testing::Test { public: - ImeControllerClientTest() = default; + ImeControllerClientTest() { + input_method_manager_.delegate_.set_get_localized_string_callback( + base::Bind(&GetLocalizedString)); + } ~ImeControllerClientTest() override = default; + protected: + TestInputMethodManager input_method_manager_; + + // Mock of mojo interface in ash. + TestImeController ime_controller_; + private: base::test::ScopedTaskEnvironment scoped_task_environment_; @@ -176,78 +185,72 @@ }; TEST_F(ImeControllerClientTest, Construction) { - TestInputMethodManager input_method_manager; - TestImeController ime_controller; - std::unique_ptr<ImeControllerClient> client = - base::MakeUnique<ImeControllerClient>(&input_method_manager); - client->InitForTesting(ime_controller.CreateInterfacePtr()); - EXPECT_EQ(1, input_method_manager.add_observer_count_); - EXPECT_EQ(1, input_method_manager.add_menu_observer_count_); + base::MakeUnique<ImeControllerClient>(&input_method_manager_); + client->InitForTesting(ime_controller_.CreateInterfacePtr()); + EXPECT_EQ(1, input_method_manager_.add_observer_count_); + EXPECT_EQ(1, input_method_manager_.add_menu_observer_count_); client.reset(); - EXPECT_EQ(1, input_method_manager.remove_observer_count_); - EXPECT_EQ(1, input_method_manager.remove_menu_observer_count_); + EXPECT_EQ(1, input_method_manager_.remove_observer_count_); + EXPECT_EQ(1, input_method_manager_.remove_menu_observer_count_); } TEST_F(ImeControllerClientTest, SetImesManagedByPolicy) { - TestInputMethodManager input_method_manager; - TestImeController ime_controller; - - ImeControllerClient client(&input_method_manager); - client.InitForTesting(ime_controller.CreateInterfacePtr()); + ImeControllerClient client(&input_method_manager_); + client.InitForTesting(ime_controller_.CreateInterfacePtr()); client.SetImesManagedByPolicy(true); client.FlushMojoForTesting(); - EXPECT_TRUE(ime_controller.managed_by_policy_); + EXPECT_TRUE(ime_controller_.managed_by_policy_); } TEST_F(ImeControllerClientTest, ShowImeMenuOnShelf) { - TestInputMethodManager input_method_manager; - TestImeController ime_controller; - - ImeControllerClient client(&input_method_manager); - client.InitForTesting(ime_controller.CreateInterfacePtr()); + ImeControllerClient client(&input_method_manager_); + client.InitForTesting(ime_controller_.CreateInterfacePtr()); client.ImeMenuActivationChanged(true); client.FlushMojoForTesting(); - EXPECT_TRUE(ime_controller.show_ime_menu_on_shelf_); + EXPECT_TRUE(ime_controller_.show_ime_menu_on_shelf_); } TEST_F(ImeControllerClientTest, InputMethodChanged) { - TestInputMethodManager input_method_manager; - input_method_manager.delegate_.set_get_localized_string_callback( - base::Bind(&GetLocalizedString)); - TestImeController ime_controller; - - ImeControllerClient client(&input_method_manager); - client.InitForTesting(ime_controller.CreateInterfacePtr()); + ImeControllerClient client(&input_method_manager_); + client.InitForTesting(ime_controller_.CreateInterfacePtr()); // Simulate a switch to IME 2. - input_method_manager.state_->current_ime_id_ = "id2"; - client.InputMethodChanged(&input_method_manager, nullptr /* profile */, + input_method_manager_.state_->current_ime_id_ = "id2"; + client.InputMethodChanged(&input_method_manager_, nullptr /* profile */, false /* show_message */); client.FlushMojoForTesting(); // IME controller received the change and the list of available IMEs. - EXPECT_EQ("id2", ime_controller.current_ime_->id); - ASSERT_EQ(2u, ime_controller.available_imes_.size()); - EXPECT_EQ("id1", ime_controller.available_imes_[0]->id); + EXPECT_EQ("id2", ime_controller_.current_ime_id_); + ASSERT_EQ(2u, ime_controller_.available_imes_.size()); + EXPECT_EQ("id1", ime_controller_.available_imes_[0]->id); EXPECT_EQ(base::ASCIIToUTF16("name1"), - ime_controller.available_imes_[0]->name); - EXPECT_EQ("id2", ime_controller.available_imes_[1]->id); + ime_controller_.available_imes_[0]->name); + EXPECT_EQ("id2", ime_controller_.available_imes_[1]->id); EXPECT_EQ(base::ASCIIToUTF16("name2"), - ime_controller.available_imes_[1]->name); + ime_controller_.available_imes_[1]->name); +} + +TEST_F(ImeControllerClientTest, NoActiveState) { + ImeControllerClient client(&input_method_manager_); + client.InitForTesting(ime_controller_.CreateInterfacePtr()); + + input_method_manager_.state_ = nullptr; + client.InputMethodChanged(&input_method_manager_, nullptr /* profile */, + false /* show_message */); + client.FlushMojoForTesting(); + EXPECT_TRUE(ime_controller_.current_ime_id_.empty()); + EXPECT_TRUE(ime_controller_.available_imes_.empty()); + EXPECT_TRUE(ime_controller_.menu_items_.empty()); } TEST_F(ImeControllerClientTest, MenuItemChanged) { - TestInputMethodManager input_method_manager; - input_method_manager.delegate_.set_get_localized_string_callback( - base::Bind(&GetLocalizedString)); - TestImeController ime_controller; - - ImeControllerClient client(&input_method_manager); - client.InitForTesting(ime_controller.CreateInterfacePtr()); + ImeControllerClient client(&input_method_manager_); + client.InitForTesting(ime_controller_.CreateInterfacePtr()); const bool is_selection_item = true; InputMethodMenuItem item1("key1", "label1", is_selection_item, @@ -261,11 +264,11 @@ client.FlushMojoForTesting(); // IME controller received the menu items. - ASSERT_EQ(2u, ime_controller.menu_items_.size()); - EXPECT_EQ("key1", ime_controller.menu_items_[0]->key); - EXPECT_TRUE(ime_controller.menu_items_[0]->checked); - EXPECT_EQ("key2", ime_controller.menu_items_[1]->key); - EXPECT_FALSE(ime_controller.menu_items_[1]->checked); + ASSERT_EQ(2u, ime_controller_.menu_items_.size()); + EXPECT_EQ("key1", ime_controller_.menu_items_[0]->key); + EXPECT_TRUE(ime_controller_.menu_items_[0]->checked); + EXPECT_EQ("key2", ime_controller_.menu_items_[1]->key); + EXPECT_FALSE(ime_controller_.menu_items_[1]->checked); } } // namespace
diff --git a/chrome/browser/ui/ash/lock_screen_client.cc b/chrome/browser/ui/ash/lock_screen_client.cc index 8e0a3df..56bfb885c8 100644 --- a/chrome/browser/ui/ash/lock_screen_client.cc +++ b/chrome/browser/ui/ash/lock_screen_client.cc
@@ -119,13 +119,14 @@ } void LockScreenClient::SetAuthType(const AccountId& account_id, - ash::mojom::AuthType auth_type, + proximity_auth::mojom::AuthType auth_type, const base::string16& initial_value) { lock_screen_->SetAuthType(account_id, auth_type, initial_value); } -void LockScreenClient::LoadUsers(std::unique_ptr<base::ListValue> users_list, - bool show_guest) { +void LockScreenClient::LoadUsers( + std::vector<ash::mojom::LoginUserInfoPtr> users_list, + bool show_guest) { lock_screen_->LoadUsers(std::move(users_list), show_guest); }
diff --git a/chrome/browser/ui/ash/lock_screen_client.h b/chrome/browser/ui/ash/lock_screen_client.h index eb70274..d5f129d 100644 --- a/chrome/browser/ui/ash/lock_screen_client.h +++ b/chrome/browser/ui/ash/lock_screen_client.h
@@ -66,9 +66,10 @@ ash::mojom::UserPodCustomIconOptionsPtr icon); void HideUserPodCustomIcon(const AccountId& account_id); void SetAuthType(const AccountId& account_id, - ash::mojom::AuthType auth_type, + proximity_auth::mojom::AuthType auth_type, const base::string16& initial_value); - void LoadUsers(std::unique_ptr<base::ListValue> users_list, bool show_guest); + void LoadUsers(std::vector<ash::mojom::LoginUserInfoPtr> users_list, + bool show_guest); void SetPinEnabledForUser(const AccountId& account_id, bool is_enabled); void SetDelegate(Delegate* delegate);
diff --git a/chrome/browser/ui/cocoa/first_run_bubble_controller.h b/chrome/browser/ui/cocoa/first_run_bubble_controller.h index ab778f34..a0c8ab1 100644 --- a/chrome/browser/ui/cocoa/first_run_bubble_controller.h +++ b/chrome/browser/ui/cocoa/first_run_bubble_controller.h
@@ -7,10 +7,12 @@ #import <Cocoa/Cocoa.h> +#import "base/mac/scoped_nsobject.h" #import "chrome/browser/ui/cocoa/base_bubble_controller.h" class Browser; class Profile; +@class FirstRunKeyResponder; // Manages the first run bubble. @interface FirstRunBubbleController : BaseBubbleController { @@ -18,6 +20,7 @@ IBOutlet NSTextField* header_; Browser* browser_; Profile* profile_; + base::scoped_nsobject<FirstRunKeyResponder> keyResponder_; } // Creates and shows a first run bubble. |browser| is NULL in unittests.
diff --git a/chrome/browser/ui/cocoa/first_run_bubble_controller.mm b/chrome/browser/ui/cocoa/first_run_bubble_controller.mm index 85915c4..d7d0d5d 100644 --- a/chrome/browser/ui/cocoa/first_run_bubble_controller.mm +++ b/chrome/browser/ui/cocoa/first_run_bubble_controller.mm
@@ -14,6 +14,24 @@ #include "components/search_engines/util.h" #include "ui/base/l10n/l10n_util.h" +@interface FirstRunKeyResponder : NSResponder +@end + +@implementation FirstRunKeyResponder + +- (void)keyDown:(NSEvent*)event { + // Pass the key event along to the browser window's first responder (which is + // the omnibox). + NSWindow* firstRunBubbleWindow = [event window]; + [[[firstRunBubbleWindow parentWindow] firstResponder] keyDown:event]; + + // Remove the first run bubble from the screen and clean up. + [firstRunBubbleWindow orderOut:nil]; + [[firstRunBubbleWindow windowController] close]; +} + +@end + @interface FirstRunBubbleController(Private) - (id)initRelativeToView:(NSView*)view offset:(NSPoint)offset @@ -44,6 +62,12 @@ offset:offset])) { browser_ = browser; profile_ = profile; + + // Add a responder object to catch any key events that are not consumed + // by controls in the bubble, so that user typing dismisses the bubble. + keyResponder_.reset([[FirstRunKeyResponder alloc] init]); + [[self window] setNextResponder:keyResponder_]; + [self showWindow:nil]; // On 10.5, the first run bubble sometimes does not disappear when clicking
diff --git a/chrome/browser/ui/page_info/page_info_infobar_delegate.cc b/chrome/browser/ui/page_info/page_info_infobar_delegate.cc index c577ca9..fa8b1ae 100644 --- a/chrome/browser/ui/page_info/page_info_infobar_delegate.cc +++ b/chrome/browser/ui/page_info/page_info_infobar_delegate.cc
@@ -35,7 +35,7 @@ } const gfx::VectorIcon& PageInfoInfoBarDelegate::GetVectorIcon() const { - return kGlobeIcon; + return kSettingsIcon; } base::string16 PageInfoInfoBarDelegate::GetMessageText() const {
diff --git a/chrome/browser/ui/webui/chromeos/login/signin_userlist_unittest.cc b/chrome/browser/ui/webui/chromeos/login/signin_userlist_unittest.cc index c19b3eb..105c980 100644 --- a/chrome/browser/ui/webui/chromeos/login/signin_userlist_unittest.cc +++ b/chrome/browser/ui/webui/chromeos/login/signin_userlist_unittest.cc
@@ -79,8 +79,7 @@ FakeChromeUserManager* fake_user_manager_; ScopedUserManagerEnabler user_manager_enabler_; std::unique_ptr<TestingProfileManager> profile_manager_; - std::map<std::string, proximity_auth::ScreenlockBridge::LockHandler::AuthType> - user_auth_type_map; + std::map<std::string, proximity_auth::mojom::AuthType> user_auth_type_map; std::unique_ptr<MultiProfileUserController> controller_; DISALLOW_COPY_AND_ASSIGN(SigninPrepareUserListTest);
diff --git a/chrome/browser/ui/webui/chromeos/login/supervised_user_creation_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/supervised_user_creation_screen_handler.cc index 840bb5a..4d410499 100644 --- a/chrome/browser/ui/webui/chromeos/login/supervised_user_creation_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/supervised_user_creation_screen_handler.cc
@@ -234,7 +234,7 @@ auto user_dict = base::MakeUnique<base::DictionaryValue>(); UserSelectionScreen::FillUserDictionary( *it, is_owner, false, /* is_signin_to_add */ - proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, + proximity_auth::mojom::AuthType::OFFLINE_PASSWORD, NULL, /* public_session_recommended_locales */ user_dict.get()); users_list->Append(std::move(user_dict));
diff --git a/chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.cc index 608414a..b21048cc 100644 --- a/chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.cc
@@ -87,7 +87,7 @@ void UserBoardScreenHandler::SetAuthType( const AccountId& account_id, - proximity_auth::ScreenlockBridge::LockHandler::AuthType auth_type, + proximity_auth::mojom::AuthType auth_type, const base::string16& initial_value) { CallJS("login.AccountPickerScreen.setAuthType", account_id, static_cast<int>(auth_type), base::Value(initial_value));
diff --git a/chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.h index 66a697b6..af2a912 100644 --- a/chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.h
@@ -51,10 +51,9 @@ const proximity_auth::ScreenlockBridge::UserPodCustomIconOptions& icon_options) override; void HideUserPodCustomIcon(const AccountId& account_id) override; - void SetAuthType( - const AccountId& account_id, - proximity_auth::ScreenlockBridge::LockHandler::AuthType auth_type, - const base::string16& initial_value) override; + void SetAuthType(const AccountId& account_id, + proximity_auth::mojom::AuthType auth_type, + const base::string16& initial_value) override; void Bind(UserSelectionScreen* screen) override; void Unbind() override; base::WeakPtr<UserBoardView> GetWeakPtr() override;
diff --git a/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc b/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc index d380183b..8ccb608 100644 --- a/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc +++ b/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc
@@ -350,24 +350,25 @@ void UserManagerScreenHandler::SetAuthType( const AccountId& account_id, - proximity_auth::ScreenlockBridge::LockHandler::AuthType auth_type, + proximity_auth::mojom::AuthType auth_type, const base::string16& auth_value) { if (GetAuthType(account_id) == - proximity_auth::ScreenlockBridge::LockHandler::FORCE_OFFLINE_PASSWORD) + proximity_auth::mojom::AuthType::FORCE_OFFLINE_PASSWORD) { return; + } user_auth_type_map_[account_id.GetUserEmail()] = auth_type; web_ui()->CallJavascriptFunctionUnsafe( "login.AccountPickerScreen.setAuthType", - base::Value(account_id.GetUserEmail()), base::Value(auth_type), - base::Value(auth_value)); + base::Value(account_id.GetUserEmail()), + base::Value(static_cast<int>(auth_type)), base::Value(auth_value)); } -proximity_auth::ScreenlockBridge::LockHandler::AuthType -UserManagerScreenHandler::GetAuthType(const AccountId& account_id) const { +proximity_auth::mojom::AuthType UserManagerScreenHandler::GetAuthType( + const AccountId& account_id) const { const auto it = user_auth_type_map_.find(account_id.GetUserEmail()); if (it == user_auth_type_map_.end()) - return proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD; + return proximity_auth::mojom::AuthType::OFFLINE_PASSWORD; return it->second; } @@ -581,10 +582,9 @@ std::string email; CHECK(args->GetString(0, &email)); const AccountId account_id = AccountId::FromUserEmail(email); - SetAuthType( - account_id, - proximity_auth::ScreenlockBridge::LockHandler::FORCE_OFFLINE_PASSWORD, - base::string16()); + SetAuthType(account_id, + proximity_auth::mojom::AuthType::FORCE_OFFLINE_PASSWORD, + base::string16()); HideUserPodCustomIcon(account_id); }
diff --git a/chrome/browser/ui/webui/signin/user_manager_screen_handler.h b/chrome/browser/ui/webui/signin/user_manager_screen_handler.h index 6cd26ef..7c4ad86 100644 --- a/chrome/browser/ui/webui/signin/user_manager_screen_handler.h +++ b/chrome/browser/ui/webui/signin/user_manager_screen_handler.h
@@ -64,11 +64,11 @@ icon_options) override; void HideUserPodCustomIcon(const AccountId& account_id) override; void EnableInput() override; - void SetAuthType( - const AccountId& account_id, - proximity_auth::ScreenlockBridge::LockHandler::AuthType auth_type, - const base::string16& auth_value) override; - AuthType GetAuthType(const AccountId& account_id) const override; + void SetAuthType(const AccountId& account_id, + proximity_auth::mojom::AuthType auth_type, + const base::string16& auth_value) override; + proximity_auth::mojom::AuthType GetAuthType( + const AccountId& account_id) const override; ScreenType GetScreenType() const override; void Unlock(const AccountId& account_id) override; void AttemptEasySignin(const AccountId& account_id, @@ -130,8 +130,7 @@ // URL hash, used to key post-profile actions if present. std::string url_hash_; - typedef std::map<std::string, - proximity_auth::ScreenlockBridge::LockHandler::AuthType> + typedef std::map<std::string, proximity_auth::mojom::AuthType> UserAuthTypeMap; UserAuthTypeMap user_auth_type_map_;
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 0979d615..6ae4d61 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -1347,6 +1347,7 @@ "../browser/ntp_snippets/content_suggestions_service_factory_browsertest.cc", "../browser/page_load_metrics/observers/ads_page_load_metrics_observer_browsertest.cc", "../browser/page_load_metrics/observers/https_engagement_metrics/https_engagement_page_load_metrics_observer_browsertest.cc", + "../browser/page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer_browsertest.cc", "../browser/page_load_metrics/page_load_metrics_browsertest.cc", "../browser/password_manager/credential_manager_browsertest.cc", "../browser/password_manager/password_manager_browsertest.cc", @@ -3163,6 +3164,7 @@ "../browser/page_load_metrics/observers/loading_predictor_page_load_metrics_observer_unittest.cc", "../browser/page_load_metrics/observers/lofi_page_load_metrics_observer_unittest.cc", "../browser/page_load_metrics/observers/media_page_load_metrics_observer_unittest.cc", + "../browser/page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer_unittest.cc", "../browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.cc", "../browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.h", "../browser/page_load_metrics/observers/previews_page_load_metrics_observer_unittest.cc", @@ -3722,6 +3724,7 @@ if (!is_android) { sources += [ + "../browser/devtools/devtools_file_watcher_unittest.cc", "../browser/devtools/devtools_ui_bindings_unittest.cc", "../browser/devtools/serialize_host_descriptions_unittest.cc", "../browser/download/download_dir_policy_handler_unittest.cc",
diff --git a/chrome/test/data/webui/cr_elements/cr_action_menu_test.js b/chrome/test/data/webui/cr_elements/cr_action_menu_test.js index f18dd14..9f3d898 100644 --- a/chrome/test/data/webui/cr_elements/cr_action_menu_test.js +++ b/chrome/test/data/webui/cr_elements/cr_action_menu_test.js
@@ -101,6 +101,26 @@ assertEquals(items[items.length - 1], menu.root.activeElement); }); + test('can navigate to dynamically added items', function() { + // Can modify children after attached() and before showAt(). + var item = document.createElement('button'); + item.classList.add('dropdown-item'); + menu.insertBefore(item, items[0]); + menu.showAt(document.querySelector('#dots')); + + down(); + assertEquals(item, menu.root.activeElement); + down(); + assertEquals(items[0], menu.root.activeElement); + + // Can modify children while menu is open. + menu.removeChild(item); + + up(); + // Focus should have wrapped around to final item. + assertEquals(items[2], menu.root.activeElement); + }); + test('close on resize', function() { menu.showAt(document.querySelector('#dots')); assertTrue(menu.open);
diff --git a/chromecast/base/cast_features.cc b/chromecast/base/cast_features.cc index d65ce5f..236b173 100644 --- a/chromecast/base/cast_features.cc +++ b/chromecast/base/cast_features.cc
@@ -59,12 +59,16 @@ // command line. Here's an exmaple: // // const base::Feature kSuperSecretSauce{ -// "enable-super-secret-sauce", base::FEATURE_DISABLED_BY_DEFAULT}; +// "enable_super_secret_sauce", base::FEATURE_DISABLED_BY_DEFAULT}; // // IMPORTANT NOTE: // The first parameter that you pass in the definition is the feature's name. -// This MUST match the DCS experiement key for this feature. Use dashes (not -// underscores) in the names. +// This MUST match the DCS experiment key for this feature. +// +// While Features elsewhere in Chromium alternatively use dashed-case or +// PascalCase for their names, Chromecast features should use snake_case +// (lowercase letters separated by underscores). This will ensure that DCS +// configs, which are passed around as JSON, remain conformant and readable. // // 2) Using the feature in client code. // Using these features in your code is easy. Here's an example: @@ -95,19 +99,17 @@ // While the server value trumps the default values, the command line trumps // both. Enable features by passing this command line arg to cast_shell: // -// --enable-features=enable-foo,enable-super-secret-sauce +// --enable-features=enable_foo,enable_super_secret_sauce // // Features are separated by commas. Disable features by passing: // -// --disable-features=enable-foo,enable-bar +// --disable-features=enable_foo,enable_bar // // Begin Chromecast Feature definitions. // Enables the use of QUIC in Cast-specific URLRequestContextGetters. See // chromecast/browser/url_request_context_factory.cc for usage. -// NOTE: This feature has a legacy name - do not use it as your convention. -// Dashes, not underscores, should be used in Feature names. const base::Feature kEnableQuic{"enable_quic", base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/chromecast/media/cma/backend/alsa/BUILD.gn b/chromecast/media/cma/backend/alsa/BUILD.gn index 4de9c9a..b87f10a 100644 --- a/chromecast/media/cma/backend/alsa/BUILD.gn +++ b/chromecast/media/cma/backend/alsa/BUILD.gn
@@ -160,6 +160,7 @@ ] deps = [ ":governor", + ":post_processor_test_support", "//base", "//base/test:run_all_unittests", "//media", @@ -180,3 +181,16 @@ ] public_configs = [ "//chromecast/public:public_config" ] } + +source_set("post_processor_test_support") { + testonly = true + sources = [ + "post_processors/post_processor_unittest.cc", + "post_processors/post_processor_unittest.h", + ] + deps = [ + "//base", + "//chromecast/public/media", + "//testing/gtest", + ] +}
diff --git a/chromecast/media/cma/backend/alsa/post_processors/governor_unittest.cc b/chromecast/media/cma/backend/alsa/post_processors/governor_unittest.cc index 201573b..38cac53f 100644 --- a/chromecast/media/cma/backend/alsa/post_processors/governor_unittest.cc +++ b/chromecast/media/cma/backend/alsa/post_processors/governor_unittest.cc
@@ -12,58 +12,35 @@ #include "base/memory/ptr_util.h" #include "base/strings/stringprintf.h" #include "chromecast/media/cma/backend/alsa/post_processors/governor.h" +#include "chromecast/media/cma/backend/alsa/post_processors/post_processor_unittest.h" #include "media/base/audio_bus.h" #include "media/base/audio_sample_types.h" #include "testing/gtest/include/gtest/gtest.h" namespace chromecast { namespace media { +namespace post_processor_test { namespace { const char* kConfigTemplate = R"config({"onset_volume": %f, "clamp_multiplier": %f})config"; -const int kNumChannels = 2; const float kDefaultClamp = 0.6f; const int kNumFrames = 100; -const float kFrequency = 1.0f / kNumFrames; -const int kBytesPerSample = sizeof(int32_t); +const int kFrequency = 2000; const int kSampleRate = 44100; std::string MakeConfigString(float onset_volume, float clamp_multiplier) { return base::StringPrintf(kConfigTemplate, onset_volume, clamp_multiplier); } -// Frequency is in frames (frequency = frequency_in_hz / sample rate) -std::unique_ptr<::media::AudioBus> GetSineData(size_t frames, float frequency) { - auto data = ::media::AudioBus::Create(kNumChannels, frames); - std::vector<int32_t> sine(frames * 2); - for (size_t i = 0; i < frames; ++i) { - sine[i * 2] = sin(static_cast<float>(i) * frequency * 2 * M_PI) * - std::numeric_limits<int32_t>::max(); - sine[i * 2 + 1] = cos(static_cast<float>(i) * frequency * 2 * M_PI) * - std::numeric_limits<int32_t>::max(); - } - data->FromInterleaved(sine.data(), frames, kBytesPerSample); - return data; -} - void ScaleData(float* data, int frames, float scale) { for (int f = 0; f < frames; ++f) { data[f] *= scale; } } -void CompareData(const std::vector<float>& expected, - const std::vector<float>& actual, - int frames) { - ASSERT_EQ(expected.size(), actual.size()); - for (int f = 0; f < frames; ++f) { - EXPECT_FLOAT_EQ(expected[f], actual[f]) << "f: " << f; - } -} - } // namespace class GovernorTest : public ::testing::TestWithParam<float> { @@ -78,24 +55,18 @@ governor_->SetSlewTimeMsForTest(0); governor_->SetSampleRate(kSampleRate); - auto data_bus = GetSineData(kNumFrames, kFrequency); - auto expected_bus = GetSineData(kNumFrames, kFrequency); - data_.resize(kNumFrames * kNumChannels); - expected_.resize(kNumFrames * kNumChannels); - data_bus->ToInterleaved<::media::FloatSampleTypeTraits<float>>( - kNumFrames, data_.data()); - expected_bus->ToInterleaved<::media::FloatSampleTypeTraits<float>>( - kNumFrames, expected_.data()); - } - - void CompareBuffers() { - CompareData(expected_, data_, kNumFrames * kNumChannels); + data_ = GetSineData(kNumFrames, kFrequency, kSampleRate); + expected_ = GetSineData(kNumFrames, kFrequency, kSampleRate); } void ProcessFrames(float volume) { EXPECT_EQ(governor_->ProcessFrames(data_.data(), kNumFrames, volume), 0); } + void CompareBuffers() { + CheckArraysEqual(expected_.data(), data_.data(), expected_.size()); + } + float clamp_; float onset_volume_; std::unique_ptr<Governor> governor_; @@ -139,5 +110,28 @@ GovernorTest, ::testing::Values(0.0f, 0.1f, 0.5f, 0.9f, 1.0f, 1.1f)); +// Default tests from post_processor_test +TEST_P(PostProcessorTest, TestDelay) { + std::string config = MakeConfigString(1.0, 1.0); + auto pp = + base::WrapUnique(AudioPostProcessorShlib_Create(config, kNumChannels)); + TestDelay(pp.get(), sample_rate_); +} + +TEST_P(PostProcessorTest, TestRinging) { + std::string config = MakeConfigString(1.0, 1.0); + auto pp = + base::WrapUnique(AudioPostProcessorShlib_Create(config, kNumChannels)); + TestRingingTime(pp.get(), sample_rate_); +} + +TEST_P(PostProcessorTest, TestPassthrough) { + std::string config = MakeConfigString(1.0, 1.0); + auto pp = + base::WrapUnique(AudioPostProcessorShlib_Create(config, kNumChannels)); + TestPassthrough(pp.get(), sample_rate_); +} + +} // namespace post_processor_test } // namespace media } // namespace chromecast
diff --git a/chromecast/media/cma/backend/alsa/post_processors/post_processor_unittest.cc b/chromecast/media/cma/backend/alsa/post_processors/post_processor_unittest.cc new file mode 100644 index 0000000..bba39b8 --- /dev/null +++ b/chromecast/media/cma/backend/alsa/post_processors/post_processor_unittest.cc
@@ -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. + +#include "chromecast/media/cma/backend/alsa/post_processors/post_processor_unittest.h" + +#include <algorithm> +#include <cmath> +#include <limits> + +#include "base/logging.h" + +namespace chromecast { +namespace media { + +namespace { + +const float kEpsilon = std::numeric_limits<float>::epsilon(); + +} // namespace + +namespace post_processor_test { + +void TestDelay(AudioPostProcessor* pp, int sample_rate) { + EXPECT_TRUE(pp->SetSampleRate(sample_rate)); + + const int kNumFrames = GetMaximumFrames(sample_rate); + const int kSinFreq = 2000; + std::vector<float> data = GetSineData(kNumFrames, kSinFreq, sample_rate); + std::vector<float> expected = GetSineData(kNumFrames, kSinFreq, sample_rate); + + int delay_frames = pp->ProcessFrames(data.data(), kNumFrames, 1.0); + int delayed_frames = 0; + + // PostProcessors that run in dedicated threads may need to delay + // until they get data processed asyncronously. + while (delay_frames >= delayed_frames + kNumFrames) { + delayed_frames += kNumFrames; + for (int i = 0; i < kNumFrames * kNumChannels; ++i) { + EXPECT_EQ(0.0f, data[i]) << i; + } + std::vector<float> data = GetSineData(kNumFrames, kSinFreq, sample_rate); + delay_frames = pp->ProcessFrames(data.data(), kNumFrames, 1.0); + + ASSERT_GE(delay_frames, delayed_frames); + } + + for (int ch = 0; ch < kNumChannels; ++ch) { + ASSERT_NE(expected[ch], 0.0); + + int nonzero_frame = delay_frames - delayed_frames; + for (int f = 0; f < nonzero_frame; ++f) { + EXPECT_EQ(0.0f, data[f * kNumChannels + ch]) << ch << " " << f; + } + EXPECT_NE(0.0f, data[nonzero_frame * kNumChannels + ch]) + << ch << " " << nonzero_frame; + } +} + +void TestRingingTime(AudioPostProcessor* pp, int sample_rate) { + EXPECT_TRUE(pp->SetSampleRate(sample_rate)); + + const int kNumFrames = GetMaximumFrames(sample_rate); + const int kSinFreq = 200; + int ringing_time_frames = pp->GetRingingTimeInFrames(); + std::vector<float> data; + + // Send a second of data to excite the filter. + for (int i = 0; i < sample_rate; i += kNumFrames) { + data = GetSineData(kNumFrames, kSinFreq, sample_rate); + pp->ProcessFrames(data.data(), kNumFrames, 1.0); + } + // Compute the amplitude of the last buffer + float original_amplitude = SineAmplitude(data, kNumChannels); + + EXPECT_GE(original_amplitude, 0) + << "Output of nonzero data is 0; cannot test ringing"; + + // Feed |ringing_time_frames| of silence. + if (ringing_time_frames > 0) { + int frames_remaining = ringing_time_frames; + int frames_to_process = std::min(ringing_time_frames, kNumFrames); + while (frames_remaining > 0) { + frames_to_process = std::min(frames_to_process, frames_remaining); + data.assign(frames_to_process * kNumChannels, 0); + pp->ProcessFrames(data.data(), frames_to_process, 1.0); + frames_remaining -= frames_to_process; + } + } + + // Send a little more data and ensure the amplitude is < 1% the original. + const int probe_frames = 100; + data.assign(probe_frames * kNumChannels, 0); + pp->ProcessFrames(data.data(), probe_frames, 1.0); + + EXPECT_LE(SineAmplitude(data, probe_frames * kNumChannels), + original_amplitude * 0.01); +} + +void TestPassthrough(AudioPostProcessor* pp, int sample_rate) { + EXPECT_TRUE(pp->SetSampleRate(sample_rate)); + + const int kNumFrames = GetMaximumFrames(sample_rate); + const int kSinFreq = 2000; + std::vector<float> data = GetSineData(kNumFrames, kSinFreq, sample_rate); + std::vector<float> expected = GetSineData(kNumFrames, kSinFreq, sample_rate); + + int delay_frames = pp->ProcessFrames(data.data(), kNumFrames, 1.0); + int delayed_frames = 0; + + // PostProcessors that run in dedicated threads may need to delay + // until they get data processed asyncronously. + while (delay_frames >= delayed_frames + kNumFrames) { + delayed_frames += kNumFrames; + for (int i = 0; i < kNumFrames * kNumChannels; ++i) { + EXPECT_EQ(0.0f, data[i]) << i; + } + std::vector<float> data = GetSineData(kNumFrames, kSinFreq, sample_rate); + delay_frames = pp->ProcessFrames(data.data(), kNumFrames, 1.0); + + ASSERT_GE(delay_frames, delayed_frames); + } + + int delay_samples = (delay_frames - delayed_frames) * kNumChannels; + ASSERT_LE(delay_samples, static_cast<int>(data.size())); + + CheckArraysEqual(expected.data(), data.data() + delay_samples, + data.size() - delay_samples); +} + +int GetMaximumFrames(int sample_rate) { + return kMaxAudioWriteTimeMilliseconds * sample_rate / 1000; +} + +template <typename T> +void CheckArraysEqual(T* expected, T* actual, size_t size) { + std::vector<int> differing_values = CompareArray(expected, actual, size); + if (differing_values.empty()) { + return; + } + + size_t size_to_print = + std::min(static_cast<size_t>(differing_values[0] + 8), size); + EXPECT_EQ(differing_values.size(), 0u) + << "Arrays differ at indices " + << ::testing::PrintToString(differing_values) + << "\n Expected: " << ArrayToString(expected, size_to_print) + << "\n Actual: " << ArrayToString(actual, size_to_print); +} + +template <typename T> +std::vector<int> CompareArray(T* expected, T* actual, size_t size) { + std::vector<int> diffs; + for (size_t i = 0; i < size; ++i) { + if (std::abs(expected[i] - actual[i]) > kEpsilon) { + diffs.push_back(i); + } + } + return diffs; +} + +template <typename T> +std::string ArrayToString(T* array, size_t size) { + std::string result; + for (size_t i = 0; i < size; ++i) { + result += ::testing::PrintToString(array[i]) + " "; + } + return result; +} + +template <typename T> +float SineAmplitude(std::vector<T> data, int num_channels) { + double max_power = 0; + int frames = data.size() / num_channels; + for (int ch = 0; ch < kNumChannels; ++ch) { + double power = 0; + for (int f = 0; f < frames; ++f) { + power += std::pow(data[f * num_channels + ch], 2); + } + max_power = std::max(max_power, power); + } + return std::sqrt(max_power / frames) * sqrt(2); +} + +std::vector<float> GetSineData(size_t frames, + float frequency, + int sample_rate) { + std::vector<float> sine(frames * kNumChannels); + for (size_t i = 0; i < frames; ++i) { + // Offset by a little so that first value is non-zero + sine[i * 2] = + sin(static_cast<float>(i + 1) * frequency * 2 * M_PI / sample_rate); + sine[i * 2 + 1] = + cos(static_cast<float>(i) * frequency * 2 * M_PI / sample_rate); + } + return sine; +} + +PostProcessorTest::PostProcessorTest() : sample_rate_(GetParam()) {} +PostProcessorTest::~PostProcessorTest() = default; + +INSTANTIATE_TEST_CASE_P(SampleRates, + PostProcessorTest, + ::testing::Values(44100, 48000)); + +} // namespace post_processor_test +} // namespace media +} // namespace chromecast
diff --git a/chromecast/media/cma/backend/alsa/post_processors/post_processor_unittest.h b/chromecast/media/cma/backend/alsa/post_processors/post_processor_unittest.h new file mode 100644 index 0000000..38149c6 --- /dev/null +++ b/chromecast/media/cma/backend/alsa/post_processors/post_processor_unittest.h
@@ -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. + +#ifndef CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSORS_POST_PROCESSOR_UNITTEST_H_ +#define CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSORS_POST_PROCESSOR_UNITTEST_H_ + +#include <vector> + +#include "chromecast/public/media/audio_post_processor_shlib.h" +#include "testing/gtest/include/gtest/gtest.h" + +// This file contains basic tests for AudioPostProcessors. +// All AudioPostProcessors should run (and pass) the following tests: +// TestDelay (tests return value from ProcessFrames) +// TestRingingTime (from GetRingingTimeFrames) +// Additionally, if it is possible to configure the PostProcessor to be a +// passthrough (no-op), then you should also run +// TestPassthrough (tests data in = data out, accounting for delay). +// +// Usage: +// TEST_P(PostProcessorTest, DelayTest) { +// std::unique_ptr<AudioPostProcessor> my_post_processor( +// AudioPostProcessorShlib_Create(my_config, 2)); +// TestDelay(my_post_processor, sample_rate_); +// } +// (Repeat for TestRingingTime, TestPassthrough). +// +// This will run your test with 44100 and 48000 sample rates. +// You can also make your own tests using the provided helper functions. + +namespace chromecast { +namespace media { +namespace post_processor_test { + +const int kNumChannels = 2; + +void TestDelay(AudioPostProcessor* pp, int sample_rate); +void TestRingingTime(AudioPostProcessor* pp, int sample_rate); +void TestPassthrough(AudioPostProcessor* pp, int sample_rate); + +// Returns the maximum number of frames a PostProcessor may be asked to handle +// in a single call. +int GetMaximumFrames(int sample_rate); + +// Tests that the first |size| elements of |expected| and |actual| are the same. +template <typename T> +void CheckArraysEqual(T* expected, T* actual, size_t size); + +// Returns a list of indexes at which |expected| and |actual| differ. +template <typename T> +std::vector<int> CompareArray(T* expected, T* actual, size_t size); + +// Print the first |size| elemenents of |array| to a string. +template <typename T> +std::string ArrayToString(T* array, size_t size); + +// Compute the amplitude of a sinusoid as power * sqrt(2) +// This is more robust that looking for the maximum value. +template <typename T> +float SineAmplitude(std::vector<T> data, int num_channels); + +// Return a vector of |frames| frames of |kNumChannels| interleaved data. +// |frequency| is in hz. +// Channel 0 will be sin(n) and channel 1 will be cos(n). +std::vector<float> GetSineData(size_t frames, float frequency, int sample_rate); + +class PostProcessorTest : public ::testing::TestWithParam<int> { + protected: + PostProcessorTest(); + ~PostProcessorTest() override; + + int sample_rate_; +}; + +} // namespace post_processor_test +} // namespace media +} // namespace chromecast + +#endif // CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSORS_POST_PROCESSOR_UNITTEST_H_
diff --git a/chromecast/media/cma/backend/alsa/stream_mixer_alsa.cc b/chromecast/media/cma/backend/alsa/stream_mixer_alsa.cc index 830fd0b..daab40ef 100644 --- a/chromecast/media/cma/backend/alsa/stream_mixer_alsa.cc +++ b/chromecast/media/cma/backend/alsa/stream_mixer_alsa.cc
@@ -27,6 +27,7 @@ #include "chromecast/media/cma/backend/alsa/filter_group.h" #include "chromecast/media/cma/backend/alsa/post_processing_pipeline_parser.h" #include "chromecast/media/cma/backend/alsa/stream_mixer_alsa_input_impl.h" +#include "chromecast/public/media/audio_post_processor_shlib.h" #include "media/audio/audio_device_description.h" #include "media/base/audio_bus.h" #include "media/base/audio_sample_types.h" @@ -82,7 +83,6 @@ const int kPreventUnderrunChunkSize = 512; const int kDefaultCheckCloseTimeoutMs = 2000; -const int kMaxWriteSizeMs = 20; // The minimum amount of data that we allow in the ALSA buffer before starting // to skip inputs with no available data. const int kMinBufferedDataMs = 8; @@ -852,7 +852,8 @@ const int min_frames_in_buffer = output_samples_per_second_ * kMinBufferedDataMs / 1000; - int chunk_size = output_samples_per_second_ * kMaxWriteSizeMs / 1000; + int chunk_size = + output_samples_per_second_ * kMaxAudioWriteTimeMilliseconds / 1000; bool is_silence = true; for (auto&& filter_group : filter_groups_) { filter_group->ClearActiveInputs();
diff --git a/chromecast/public/media/audio_post_processor_shlib.h b/chromecast/public/media/audio_post_processor_shlib.h index 35c368e40..41a610ed 100644 --- a/chromecast/public/media/audio_post_processor_shlib.h +++ b/chromecast/public/media/audio_post_processor_shlib.h
@@ -32,6 +32,9 @@ namespace chromecast { namespace media { +// The maximum amount of data that will ever be processed in one call. +const int kMaxAudioWriteTimeMilliseconds = 20; + // Interface for AudioPostProcessors used for applying DSP in StreamMixerAlsa. class AudioPostProcessor { public:
diff --git a/components/arc/instance_holder.h b/components/arc/instance_holder.h index fda056e..3773a219 100644 --- a/components/arc/instance_holder.h +++ b/components/arc/instance_holder.h
@@ -64,8 +64,7 @@ uint32_t min_version, const char method_name_for_logging[]) { if (!instance_) { - VLOG(1) << "Instance for " << T::Name_ << "::" << method_name_for_logging - << " not available."; + VLOG(1) << "Instance " << T::Name_ << " not available."; return nullptr; } if (version_ < min_version) {
diff --git a/components/autofill/core/browser/autofill_experiments.cc b/components/autofill/core/browser/autofill_experiments.cc index e667d89..577edaf 100644 --- a/components/autofill/core/browser/autofill_experiments.cc +++ b/components/autofill/core/browser/autofill_experiments.cc
@@ -29,6 +29,8 @@ "AutofillCreditCardAssist", base::FEATURE_DISABLED_BY_DEFAULT}; const base::Feature kAutofillScanCardholderName{ "AutofillScanCardholderName", base::FEATURE_DISABLED_BY_DEFAULT}; +const base::Feature kAutofillCreditCardBankNameDisplay{ + "AutofillCreditCardBankNameDisplay", base::FEATURE_DISABLED_BY_DEFAULT}; const base::Feature kAutofillCreditCardPopupLayout{ "AutofillCreditCardPopupLayout", base::FEATURE_DISABLED_BY_DEFAULT}; const base::Feature kAutofillCreditCardLastUsedDateDisplay{ @@ -101,6 +103,10 @@ return base::FeatureList::IsEnabled(kAutofillCreditCardLastUsedDateDisplay); } +bool IsAutofillCreditCardBankNameDisplayExperimentEnabled() { + return base::FeatureList::IsEnabled(kAutofillCreditCardBankNameDisplay); +} + // |GetCreditCardPopupParameterUintValue| returns 0 if experiment parameter is // not specified. 0 == |SK_ColorTRANSPARENT|. SkColor GetCreditCardPopupBackgroundColor() {
diff --git a/components/autofill/core/browser/autofill_experiments.h b/components/autofill/core/browser/autofill_experiments.h index 7ed13140..b4f0ecdb 100644 --- a/components/autofill/core/browser/autofill_experiments.h +++ b/components/autofill/core/browser/autofill_experiments.h
@@ -27,6 +27,7 @@ extern const base::Feature kAutofillCreditCardAssist; extern const base::Feature kAutofillScanCardholderName; +extern const base::Feature kAutofillCreditCardBankNameDisplay; extern const base::Feature kAutofillCreditCardPopupLayout; extern const base::Feature kAutofillCreditCardLastUsedDateDisplay; extern const base::Feature kAutofillOfferLocalSaveIfServerCardManuallyEntered; @@ -73,6 +74,9 @@ // Returns whether Autofill credit card last used date shows expiration date. bool ShowExpirationDateInAutofillCreditCardLastUsedDate(); +// Returns whether Autofill credit card bank name display experiment is enabled. +bool IsAutofillCreditCardBankNameDisplayExperimentEnabled(); + // Returns the background color for credit card autofill popup, or // |SK_ColorTRANSPARENT| if the new credit card autofill popup layout experiment // is not enabled.
diff --git a/components/autofill/core/browser/autofill_manager.cc b/components/autofill/core/browser/autofill_manager.cc index 4bb5995..09cfefc22 100644 --- a/components/autofill/core/browser/autofill_manager.cc +++ b/components/autofill/core/browser/autofill_manager.cc
@@ -1998,6 +1998,14 @@ std::vector<Suggestion> suggestions = personal_data_->GetCreditCardSuggestions( type, SanitizeCreditCardFieldValue(field.value)); + const std::vector<CreditCard*> cards_to_suggest = + personal_data_->GetCreditCardsToSuggest(); + for (const CreditCard* credit_card : cards_to_suggest) { + if (!credit_card->bank_name().empty()) { + credit_card_form_event_logger_->SetBankNameAvailable(); + break; + } + } for (size_t i = 0; i < suggestions.size(); i++) { suggestions[i].frontend_id = MakeFrontendID(suggestions[i].backend_id, std::string());
diff --git a/components/autofill/core/browser/autofill_metrics.cc b/components/autofill/core/browser/autofill_metrics.cc index 3039a08..7159c789 100644 --- a/components/autofill/core/browser/autofill_metrics.cc +++ b/components/autofill/core/browser/autofill_metrics.cc
@@ -985,6 +985,7 @@ has_logged_suggestion_filled_(false), has_logged_will_submit_(false), has_logged_submitted_(false), + has_logged_bank_name_available_(false), logged_suggestion_filled_was_server_data_(false), logged_suggestion_filled_was_masked_server_card_(false), form_interactions_ukm_logger_(form_interactions_ukm_logger) {} @@ -1026,6 +1027,10 @@ if (!has_logged_suggestions_shown_) { has_logged_suggestions_shown_ = true; Log(AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE); + if (has_logged_bank_name_available_) { + Log(AutofillMetrics:: + FORM_EVENT_SUGGESTIONS_SHOWN_WITH_BANK_NAME_AVAILABLE_ONCE); + } } if (is_for_credit_card_) { @@ -1074,6 +1079,10 @@ FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_FILLED_ONCE); } else if (credit_card.record_type() == CreditCard::FULL_SERVER_CARD) { Log(AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_FILLED_ONCE); + if (has_logged_bank_name_available_) { + Log(AutofillMetrics:: + FORM_EVENT_SERVER_SUGGESTION_FILLED_WITH_BANK_NAME_AVAILABLE_ONCE); + } } else { Log(AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_FILLED_ONCE); } @@ -1161,6 +1170,10 @@ } } +void AutofillMetrics::FormEventLogger::SetBankNameAvailable() { + has_logged_bank_name_available_ = true; +} + void AutofillMetrics::FormEventLogger::Log(FormEvent event) const { DCHECK_LT(event, NUM_FORM_EVENTS); std::string name("Autofill.FormEvents."); @@ -1192,6 +1205,13 @@ LogUMAHistogramEnumeration(name, event, NUM_FORM_EVENTS); } +void AutofillMetrics::FormEventLogger::Log( + BankNameDisplayedFormEvent event) const { + DCHECK_LT(event, BANK_NAME_NUM_FORM_EVENTS); + std::string name("Autofill.FormEvents.CreditCard.BankNameDisplayed"); + LogUMAHistogramEnumeration(name, event, BANK_NAME_NUM_FORM_EVENTS); +} + AutofillMetrics::FormInteractionsUkmLogger::FormInteractionsUkmLogger( ukm::UkmRecorder* ukm_recorder) : ukm_recorder_(ukm_recorder) {}
diff --git a/components/autofill/core/browser/autofill_metrics.h b/components/autofill/core/browser/autofill_metrics.h index d96e9046..fe20df9 100644 --- a/components/autofill/core/browser/autofill_metrics.h +++ b/components/autofill/core/browser/autofill_metrics.h
@@ -545,10 +545,20 @@ // submitted. If the submission is not interrupted by JavaScript, the "form // submitted" event above will also be logged. FORM_EVENT_SUGGESTION_SHOWN_WILL_SUBMIT_ONCE, - NUM_FORM_EVENTS, }; + // Form Events for autofill with bank name available for display. + enum BankNameDisplayedFormEvent { + // A dropdown with suggestions was shown and at least one suggestion has a + // bank name. Logged at most once per page load. + FORM_EVENT_SUGGESTIONS_SHOWN_WITH_BANK_NAME_AVAILABLE_ONCE = 0, + // A server suggestion was used to fill the form and at least one suggestion + // has a bank name. Logged at most once per page load. + FORM_EVENT_SERVER_SUGGESTION_FILLED_WITH_BANK_NAME_AVAILABLE_ONCE, + BANK_NAME_NUM_FORM_EVENTS, + }; + // Events related to the Unmask Credit Card Prompt. enum UnmaskPromptEvent { // The prompt was shown. @@ -940,8 +950,10 @@ void OnFormSubmitted(); + void SetBankNameAvailable(); private: void Log(FormEvent event) const; + void Log(BankNameDisplayedFormEvent event) const; bool is_for_credit_card_; size_t server_record_type_count_; @@ -953,6 +965,7 @@ bool has_logged_suggestion_filled_; bool has_logged_will_submit_; bool has_logged_submitted_; + bool has_logged_bank_name_available_; bool logged_suggestion_filled_was_server_data_; bool logged_suggestion_filled_was_masked_server_card_;
diff --git a/components/autofill/core/browser/autofill_metrics_unittest.cc b/components/autofill/core/browser/autofill_metrics_unittest.cc index 16df233..90acd4c 100644 --- a/components/autofill/core/browser/autofill_metrics_unittest.cc +++ b/components/autofill/core/browser/autofill_metrics_unittest.cc
@@ -187,6 +187,20 @@ Refresh(); } + // Removes all existing credit cards and creates 1 server card with a bank + // name. + void RecreateServerCreditCardsWithBankName() { + server_credit_cards_.clear(); + std::unique_ptr<CreditCard> credit_card = base::MakeUnique<CreditCard>( + CreditCard::FULL_SERVER_CARD, "server_id"); + test::SetCreditCardInfo(credit_card.get(), "name", "4111111111111111", + "12", "24", "1"); + credit_card->set_guid("10000000-0000-0000-0000-000000000003"); + credit_card->set_bank_name("Chase"); + server_credit_cards_.push_back(std::move(credit_card)); + Refresh(); + } + bool IsAutofillEnabled() const override { return autofill_enabled_; } void CreateAmbiguousProfiles() { @@ -2533,6 +2547,11 @@ histogram_tester.ExpectBucketCount( "Autofill.FormEvents.CreditCard", AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 1); + // Check that the bank name histogram was not recorded. ExpectBucketCount() + // can't be used here because it expects the histogram to exist. + EXPECT_EQ(0, histogram_tester.GetTotalCountsForPrefix( + "Autofill.FormEvents.CreditCard") + ["Autofill.FormEvents.CreditCard.BankNameDisplayed"]); } // Reset the autofill manager state. @@ -2550,6 +2569,11 @@ histogram_tester.ExpectBucketCount( "Autofill.FormEvents.CreditCard", AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 1); + // Check that the bank name histogram was not recorded. ExpectBucketCount() + // can't be used here because it expects the histogram to exist. + EXPECT_EQ(0, histogram_tester.GetTotalCountsForPrefix( + "Autofill.FormEvents.CreditCard") + ["Autofill.FormEvents.CreditCard.BankNameDisplayed"]); } // Reset the autofill manager state. @@ -2567,6 +2591,59 @@ histogram_tester.ExpectBucketCount( "Autofill.FormEvents.CreditCard", AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 0); + // Check that the bank name histogram was not recorded. ExpectBucketCount() + // can't be used here because it expects the histogram to exist. + EXPECT_EQ(0, histogram_tester.GetTotalCountsForPrefix( + "Autofill.FormEvents.CreditCard") + ["Autofill.FormEvents.CreditCard.BankNameDisplayed"]); + } + + // Recreate server cards with bank names. + personal_data_->RecreateServerCreditCardsWithBankName(); + + // Reset the autofill manager state. + autofill_manager_->Reset(); + autofill_manager_->AddSeenForm(form, field_types, field_types); + + { + // Simulating new popup being shown. + base::HistogramTester histogram_tester; + autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); + autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); + histogram_tester.ExpectBucketCount( + "Autofill.FormEvents.CreditCard", + AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN, 1); + histogram_tester.ExpectBucketCount( + "Autofill.FormEvents.CreditCard", + AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 1); + histogram_tester.ExpectBucketCount( + "Autofill.FormEvents.CreditCard.BankNameDisplayed", + AutofillMetrics:: + FORM_EVENT_SUGGESTIONS_SHOWN_WITH_BANK_NAME_AVAILABLE_ONCE, + 1); + } + + // Reset the autofill manager state. + autofill_manager_->Reset(); + autofill_manager_->AddSeenForm(form, field_types, field_types); + + { + // Simulating two popups in the same page load. + base::HistogramTester histogram_tester; + autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); + autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); + autofill_manager_->DidShowSuggestions(true /* is_new_popup */, form, field); + histogram_tester.ExpectBucketCount( + "Autofill.FormEvents.CreditCard", + AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN, 2); + histogram_tester.ExpectBucketCount( + "Autofill.FormEvents.CreditCard", + AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 1); + histogram_tester.ExpectBucketCount( + "Autofill.FormEvents.CreditCard.BankNameDisplayed", + AutofillMetrics:: + FORM_EVENT_SUGGESTIONS_SHOWN_WITH_BANK_NAME_AVAILABLE_ONCE, + 1); } } @@ -2735,6 +2812,11 @@ histogram_tester.ExpectBucketCount( "Autofill.FormEvents.CreditCard", AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_FILLED_ONCE, 1); + // Check that the bank name histogram was not recorded. ExpectBucketCount() + // can't be used here because it expects the histogram to exist. + EXPECT_EQ(0, histogram_tester.GetTotalCountsForPrefix( + "Autofill.FormEvents.CreditCard") + ["Autofill.FormEvents.CreditCard.BankNameDisplayed"]); } // Reset the autofill manager state. @@ -2758,6 +2840,52 @@ "Autofill.FormEvents.CreditCard", AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_FILLED_ONCE, 1); } + + // Recreate server cards with bank names. + personal_data_->RecreateServerCreditCardsWithBankName(); + + // Reset the autofill manager state. + autofill_manager_->Reset(); + autofill_manager_->AddSeenForm(form, field_types, field_types); + + { + // Simulating filling a full card server suggestion. + base::HistogramTester histogram_tester; + std::string guid( + "10000000-0000-0000-0000-000000000003"); // full server card + autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); + autofill_manager_->FillOrPreviewForm( + AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, field, + autofill_manager_->MakeFrontendID(guid, std::string())); + histogram_tester.ExpectBucketCount( + "Autofill.FormEvents.CreditCard.BankNameDisplayed", + AutofillMetrics:: + FORM_EVENT_SERVER_SUGGESTION_FILLED_WITH_BANK_NAME_AVAILABLE_ONCE, + 1); + } + + // Reset the autofill manager state. + autofill_manager_->Reset(); + autofill_manager_->AddSeenForm(form, field_types, field_types); + + { + // Simulating filling multiple times. + base::HistogramTester histogram_tester; + std::string guid( + "10000000-0000-0000-0000-000000000003"); // full server card + autofill_manager_->OnQueryFormFieldAutofill(0, form, field, gfx::RectF()); + autofill_manager_->FillOrPreviewForm( + AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, field, + autofill_manager_->MakeFrontendID(guid, std::string())); + autofill_manager_->FillOrPreviewForm( + AutofillDriver::FORM_DATA_ACTION_FILL, 0, form, field, + autofill_manager_->MakeFrontendID(guid, std::string())); + histogram_tester.ExpectBucketCount( + "Autofill.FormEvents.CreditCard.BankNameDisplayed", + AutofillMetrics:: + FORM_EVENT_SERVER_SUGGESTION_FILLED_WITH_BANK_NAME_AVAILABLE_ONCE, + 1); + } } // Test that we log submitted form events for credit cards. @@ -3451,6 +3579,11 @@ histogram_tester.ExpectBucketCount( "Autofill.FormEvents.Address", AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 1); + // Check that the bank name histogram was not recorded. ExpectBucketCount() + // can't be used here because it expects the histogram to exist. + EXPECT_EQ(0, histogram_tester.GetTotalCountsForPrefix( + "Autofill.FormEvents.CreditCard") + ["Autofill.FormEvents.CreditCard.BankNameDisplayed"]); } // Reset the autofill manager state. @@ -3468,6 +3601,11 @@ histogram_tester.ExpectBucketCount( "Autofill.FormEvents.Address", AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 1); + // Check that the bank name histogram was not recorded. ExpectBucketCount() + // can't be used here because it expects the histogram to exist. + EXPECT_EQ(0, histogram_tester.GetTotalCountsForPrefix( + "Autofill.FormEvents.CreditCard") + ["Autofill.FormEvents.CreditCard.BankNameDisplayed"]); } // Reset the autofill manager state. @@ -3485,6 +3623,11 @@ histogram_tester.ExpectBucketCount( "Autofill.FormEvents.Address", AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE, 0); + // Check that the bank name histogram was not recorded. ExpectBucketCount() + // can't be used here because it expects the histogram to exist. + EXPECT_EQ(0, histogram_tester.GetTotalCountsForPrefix( + "Autofill.FormEvents.CreditCard") + ["Autofill.FormEvents.CreditCard.BankNameDisplayed"]); } }
diff --git a/components/autofill/core/browser/credit_card.cc b/components/autofill/core/browser/credit_card.cc index 33dc123..ee83a82 100644 --- a/components/autofill/core/browser/credit_card.cc +++ b/components/autofill/core/browser/credit_card.cc
@@ -498,6 +498,7 @@ server_id_ = credit_card.server_id_; server_status_ = credit_card.server_status_; billing_address_id_ = credit_card.billing_address_id_; + bank_name_ = credit_card.bank_name_; set_guid(credit_card.guid()); set_origin(credit_card.origin()); @@ -564,6 +565,10 @@ if (comparison != 0) return comparison; + comparison = bank_name_.compare(credit_card.bank_name_); + if (comparison != 0) + return comparison; + if (static_cast<int>(server_status_) < static_cast<int>(credit_card.server_status_)) return -1; @@ -739,6 +744,7 @@ base::string16 CreditCard::NetworkAndLastFourDigits() const { base::string16 network = NetworkForDisplay(); + // TODO(crbug.com/734197): truncate network. base::string16 digits = LastFourDigits(); if (digits.empty()) @@ -748,6 +754,14 @@ return network + base::string16(kMidlineEllipsis) + digits; } +base::string16 CreditCard::BankNameAndLastFourDigits() const { + base::string16 digits = LastFourDigits(); + // TODO(crbug.com/734197): truncate bank name. + if (digits.empty()) + return ASCIIToUTF16(bank_name_); + return ASCIIToUTF16(bank_name_) + base::string16(kMidlineEllipsis) + digits; +} + base::string16 CreditCard::AbbreviatedExpirationDateForDisplay() const { base::string16 month = ExpirationMonthAsString(); base::string16 year = Expiration2DigitYearAsString();
diff --git a/components/autofill/core/browser/credit_card.h b/components/autofill/core/browser/credit_card.h index 4dc8bb9..ef83a56 100644 --- a/components/autofill/core/browser/credit_card.h +++ b/components/autofill/core/browser/credit_card.h
@@ -101,6 +101,9 @@ const std::string& network() const { return network_; } + const std::string& bank_name() const { return bank_name_; } + void set_bank_name(const std::string& bank_name) { bank_name_ = bank_name; } + int expiration_month() const { return expiration_month_; } int expiration_year() const { return expiration_year_; } @@ -209,6 +212,8 @@ base::string16 NetworkForDisplay() const; // A label for this card formatted as 'IssuerNetwork - 2345'. base::string16 NetworkAndLastFourDigits() const; + // A label for this card formatted as 'BankName - 2345'. + base::string16 BankNameAndLastFourDigits() const; // Localized expiration for this card formatted as 'Exp: 06/17'. base::string16 AbbreviatedExpirationDateForDisplay() const; // Returns the date when the card was last used in autofill. @@ -249,6 +254,9 @@ // below. std::string network_; + // The issuer bank name of the card. + std::string bank_name_; + // These members are zero if not present. int expiration_month_; int expiration_year_;
diff --git a/components/autofill/core/browser/credit_card_unittest.cc b/components/autofill/core/browser/credit_card_unittest.cc index 3857613b..c8e873c 100644 --- a/components/autofill/core/browser/credit_card_unittest.cc +++ b/components/autofill/core/browser/credit_card_unittest.cc
@@ -8,6 +8,7 @@ #include "base/macros.h" #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" +#include "base/test/scoped_feature_list.h" #include "base/time/time.h" #include "build/build_config.h" #include "components/autofill/core/browser/autofill_experiments.h" @@ -155,6 +156,37 @@ obfuscated5); } +// Tests credit card bank name and last four digits string generation. +TEST(CreditCardTest, BankNameAndLastFourDigitsStrings) { + // Case 1: Have everything and show bank name. + CreditCard credit_card1(base::GenerateGUID(), "https://www.example.com/"); + test::SetCreditCardInfo(&credit_card1, "John Dillinger", + "5105 1051 0510 5100", "01", "2010", "1"); + credit_card1.set_bank_name("Chase"); + base::string16 obfuscated1 = credit_card1.BankNameAndLastFourDigits(); + EXPECT_FALSE(credit_card1.bank_name().empty()); + EXPECT_EQ(UTF8ToUTF16(std::string("Chase") + kUTF8MidlineEllipsis + "5100"), + obfuscated1); + + // Case 2: Have no bank name and not show bank name. + CreditCard credit_card2(base::GenerateGUID(), "https://www.example.com/"); + test::SetCreditCardInfo(&credit_card2, "John Dillinger", + "5105 1051 0510 5100", "01", "2010", "1"); + base::string16 obfuscated2 = credit_card2.BankNameAndLastFourDigits(); + EXPECT_TRUE(credit_card2.bank_name().empty()); + EXPECT_EQ(UTF8ToUTF16(std::string(kUTF8MidlineEllipsis) + "5100"), + obfuscated2); + + // Case 3: Have bank name but no last four digits, only show bank name. + CreditCard credit_card3(base::GenerateGUID(), "https://www.example.com/"); + test::SetCreditCardInfo(&credit_card3, "John Dillinger", + "", "01", "2010", "1"); + credit_card3.set_bank_name("Chase"); + base::string16 obfuscated3 = credit_card3.BankNameAndLastFourDigits(); + EXPECT_FALSE(credit_card3.bank_name().empty()); + EXPECT_EQ(UTF8ToUTF16(std::string("Chase")), obfuscated3); +} + TEST(CreditCardTest, AssignmentOperator) { CreditCard a(base::GenerateGUID(), "some origin"); test::SetCreditCardInfo(&a, "John Dillinger", "123456789012", "01", "2010",
diff --git a/components/autofill/core/browser/personal_data_manager.cc b/components/autofill/core/browser/personal_data_manager.cc index 8039bc4..1ed3ce5 100644 --- a/components/autofill/core/browser/personal_data_manager.cc +++ b/components/autofill/core/browser/personal_data_manager.cc
@@ -1674,7 +1674,12 @@ // Otherwise the label is the card number, or if that is empty the // cardholder name. The label should never repeat the value. if (type.GetStorableType() == CREDIT_CARD_NUMBER) { - suggestion->value = credit_card->NetworkAndLastFourDigits(); + if (IsAutofillCreditCardBankNameDisplayExperimentEnabled() && + !credit_card->bank_name().empty()) { + suggestion->value = credit_card->BankNameAndLastFourDigits(); + } else { + suggestion->value = credit_card->NetworkAndLastFourDigits(); + } if (IsAutofillCreditCardLastUsedDateDisplayExperimentEnabled()) { suggestion->label = credit_card->GetLastUsedDateForDisplay(app_locale_);
diff --git a/components/autofill/core/browser/personal_data_manager_unittest.cc b/components/autofill/core/browser/personal_data_manager_unittest.cc index 2a1b23d..96e3a83 100644 --- a/components/autofill/core/browser/personal_data_manager_unittest.cc +++ b/components/autofill/core/browser/personal_data_manager_unittest.cc
@@ -24,6 +24,7 @@ #include "base/strings/utf_string_conversions.h" #include "base/synchronization/waitable_event.h" #include "base/test/histogram_tester.h" +#include "base/test/scoped_feature_list.h" #include "base/test/simple_test_clock.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" @@ -3635,8 +3636,8 @@ base::RunLoop().Run(); std::vector<Suggestion> suggestions = - personal_data_->GetCreditCardSuggestions(AutofillType(CREDIT_CARD_NUMBER), - base::ASCIIToUTF16("12345678")); + personal_data_->GetCreditCardSuggestions( + AutofillType(CREDIT_CARD_NUMBER), base::ASCIIToUTF16("12345678")); // There should be no suggestions. ASSERT_EQ(0U, suggestions.size()); @@ -3923,6 +3924,74 @@ ASSERT_EQ(3U, suggestions.size()); } +// Tests that server cards will shown bank name when bank name available and +// feature flag on. +TEST_F(PersonalDataManagerTest, + GetCreditCardSuggestions_ShowBankNameOfServerCards) { + // Turn on feature flag. + base::test::ScopedFeatureList scoped_feature_list_; + scoped_feature_list_.InitAndEnableFeature(kAutofillCreditCardBankNameDisplay); + + EnableWalletCardImport(); + + // Add a local card. + CreditCard credit_card0("287151C8-6AB1-487C-9095-28E80BE5DA15", + "https://www.example.com"); + test::SetCreditCardInfo(&credit_card0, "Clyde Barrow", + "347666888555" /* American Express */, "04", "2999", + "1"); + credit_card0.set_use_count(3); + credit_card0.set_use_date(AutofillClock::Now() - + base::TimeDelta::FromDays(1)); + personal_data_->AddCreditCard(credit_card0); + + std::vector<CreditCard> server_cards; + + // Add a server card without bank name. + server_cards.push_back(CreditCard(CreditCard::MASKED_SERVER_CARD, "b459")); + test::SetCreditCardInfo(&server_cards.back(), "Emmet Dalton", "2110", "12", + "2999", "1"); + server_cards.back().set_use_count(2); + server_cards.back().set_use_date(AutofillClock::Now() - + base::TimeDelta::FromDays(1)); + server_cards.back().SetNetworkForMaskedCard(kVisaCard); + + // Add a server card with bank name. + server_cards.push_back(CreditCard(CreditCard::MASKED_SERVER_CARD, "b460")); + test::SetCreditCardInfo(&server_cards.back(), "Emmet Dalton", "2111", "12", + "2999", "1"); + server_cards.back().set_use_count(1); + server_cards.back().set_use_date(AutofillClock::Now() - + base::TimeDelta::FromDays(1)); + server_cards.back().SetNetworkForMaskedCard(kVisaCard); + server_cards.back().set_bank_name("Chase"); + + test::SetServerCreditCards(autofill_table_, server_cards); + + EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) + .WillOnce(QuitMainMessageLoop()); + base::RunLoop().Run(); + + std::vector<Suggestion> suggestions = + personal_data_->GetCreditCardSuggestions( + AutofillType(CREDIT_CARD_NUMBER), + /* field_contents= */ base::string16()); + ASSERT_EQ(3U, suggestions.size()); + + // Local cards will show network. + EXPECT_EQ( + base::UTF8ToUTF16(std::string("Amex") + kUTF8MidlineEllipsis + "8555"), + suggestions[0].value); + // Server card without bank name will show network. + EXPECT_EQ( + base::UTF8ToUTF16(std::string("Visa") + kUTF8MidlineEllipsis + "2110"), + suggestions[1].value); + // Server card with bank name will show bank name. + EXPECT_EQ( + base::UTF8ToUTF16(std::string("Chase") + kUTF8MidlineEllipsis + "2111"), + suggestions[2].value); +} + // Tests that only the full server card is kept when deduping with a local // duplicate of it. TEST_F(PersonalDataManagerTest,
diff --git a/components/autofill/core/browser/webdata/autofill_table.cc b/components/autofill/core/browser/webdata/autofill_table.cc index d98db89..1cf28e6 100644 --- a/components/autofill/core/browser/webdata/autofill_table.cc +++ b/components/autofill/core/browser/webdata/autofill_table.cc
@@ -193,6 +193,7 @@ base::Time::FromTimeT(s.ColumnInt64(index++))); credit_card->set_origin(s.ColumnString(index++)); credit_card->set_billing_address_id(s.ColumnString(index++)); + credit_card->set_bank_name(s.ColumnString(index++)); return credit_card; } @@ -472,6 +473,9 @@ case 72: *update_compatible_version = true; return MigrateToVersion72RenameCardTypeToIssuerNetwork(); + case 73: + *update_compatible_version = false; + return MigrateToVersion73AddMaskedCardBankName(); } return true; } @@ -1219,7 +1223,8 @@ "name_on_card," // 7 "exp_month," // 8 "exp_year," // 9 - "metadata.billing_address_id " // 10 + "metadata.billing_address_id," // 10 + "bank_name " // 11 "FROM masked_credit_cards masked " "LEFT OUTER JOIN unmasked_credit_cards USING (id) " "LEFT OUTER JOIN server_card_metadata metadata USING (id)")); @@ -1261,6 +1266,7 @@ card->SetRawInfo(CREDIT_CARD_EXP_MONTH, s.ColumnString16(index++)); card->SetRawInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR, s.ColumnString16(index++)); card->set_billing_address_id(s.ColumnString(index++)); + card->set_bank_name(s.ColumnString(index++)); credit_cards->push_back(std::move(card)); } return s.Succeeded(); @@ -1277,8 +1283,9 @@ "name_on_card," // 3 "last_four," // 4 "exp_month," // 5 - "exp_year)" // 6 - "VALUES (?,?,?,?,?,?,?)")); + "exp_year," // 6 + "bank_name)" // 7 + "VALUES (?,?,?,?,?,?,?,?)")); for (const CreditCard& card : credit_cards) { DCHECK_EQ(CreditCard::MASKED_SERVER_CARD, card.record_type()); masked_insert.BindString(0, card.server_id()); @@ -1290,7 +1297,7 @@ masked_insert.BindString16(5, card.GetRawInfo(CREDIT_CARD_EXP_MONTH)); masked_insert.BindString16(6, card.GetRawInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR)); - + masked_insert.BindString(7, card.bank_name()); masked_insert.Run(); masked_insert.Reset(true); @@ -1956,7 +1963,8 @@ "network VARCHAR," "last_four VARCHAR," "exp_month INTEGER DEFAULT 0," - "exp_year INTEGER DEFAULT 0)")) { + "exp_year INTEGER DEFAULT 0, " + "bank_name VARCHAR)")) { NOTREACHED(); return false; } @@ -2599,4 +2607,19 @@ transaction.Commit(); } +bool AutofillTable::MigrateToVersion73AddMaskedCardBankName() { + sql::Transaction transaction(db_); + if (!transaction.Begin()) + return false; + + // Add the new bank_name column to the masked_credit_cards table. + if (!db_->DoesColumnExist("masked_credit_cards", "bank_name") && + !db_->Execute("ALTER TABLE masked_credit_cards ADD COLUMN " + "bank_name VARCHAR")) { + return false; + } + + return transaction.Commit(); +} + } // namespace autofill
diff --git a/components/autofill/core/browser/webdata/autofill_table.h b/components/autofill/core/browser/webdata/autofill_table.h index 161b033f..22625148 100644 --- a/components/autofill/core/browser/webdata/autofill_table.h +++ b/components/autofill/core/browser/webdata/autofill_table.h
@@ -166,6 +166,7 @@ // with locally stored cards and generating descriptions. // exp_month Expiration month: 1-12 // exp_year Four-digit year: 2017 +// bank_name Issuer bank name of the credit card. // // unmasked_credit_cards // When a masked credit credit card is unmasked and the @@ -464,6 +465,7 @@ bool MigrateToVersion70AddSyncMetadata(); bool MigrateToVersion71AddHasConvertedAndBillingAddressIdMetadata(); bool MigrateToVersion72RenameCardTypeToIssuerNetwork(); + bool MigrateToVersion73AddMaskedCardBankName(); // Max data length saved in the table, AKA the maximum length allowed for // form data.
diff --git a/components/autofill/core/browser/webdata/autofill_table_unittest.cc b/components/autofill/core/browser/webdata/autofill_table_unittest.cc index 1930216..4e92e5c7 100644 --- a/components/autofill/core/browser/webdata/autofill_table_unittest.cc +++ b/components/autofill/core/browser/webdata/autofill_table_unittest.cc
@@ -1762,6 +1762,28 @@ outputs.clear(); } +TEST_F(AutofillTableTest, ServerCardBankName) { + // Add a masked card. + CreditCard masked_card(CreditCard::MASKED_SERVER_CARD, "a123"); + masked_card.SetRawInfo(CREDIT_CARD_NAME_FULL, + ASCIIToUTF16("Paul F. Tompkins")); + masked_card.SetRawInfo(CREDIT_CARD_EXP_MONTH, ASCIIToUTF16("1")); + masked_card.SetRawInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR, ASCIIToUTF16("2020")); + masked_card.SetRawInfo(CREDIT_CARD_NUMBER, ASCIIToUTF16("1111")); + masked_card.SetNetworkForMaskedCard(kVisaCard); + masked_card.set_bank_name("Chase"); + + // Set server credit cards + std::vector<CreditCard> inputs = {masked_card}; + test::SetServerCreditCards(table_.get(), inputs); + + // Get server credit cards and check bank names equal + std::vector<std::unique_ptr<CreditCard>> outputs; + table_->GetServerCreditCards(&outputs); + ASSERT_EQ(1u, outputs.size()); + EXPECT_EQ("Chase", outputs[0]->bank_name()); +} + TEST_F(AutofillTableTest, SetServerCardUpdateUsageStatsAndBillingAddress) { // Add a masked card. CreditCard masked_card(CreditCard::MASKED_SERVER_CARD, "a123");
diff --git a/components/autofill/core/browser/webdata/autofill_wallet_syncable_service.cc b/components/autofill/core/browser/webdata/autofill_wallet_syncable_service.cc index 54e8be78..af81aeaa 100644 --- a/components/autofill/core/browser/webdata/autofill_wallet_syncable_service.cc +++ b/components/autofill/core/browser/webdata/autofill_wallet_syncable_service.cc
@@ -82,6 +82,7 @@ result.SetExpirationMonth(card.exp_month()); result.SetExpirationYear(card.exp_year()); result.set_billing_address_id(card.billing_address_id()); + result.set_bank_name(card.bank_name()); return result; }
diff --git a/components/exo/BUILD.gn b/components/exo/BUILD.gn index 1829941..3981a9a 100644 --- a/components/exo/BUILD.gn +++ b/components/exo/BUILD.gn
@@ -10,8 +10,6 @@ sources = [ "buffer.cc", "buffer.h", - "compositor_frame_sink_holder.cc", - "compositor_frame_sink_holder.h", "display.cc", "display.h", "gaming_seat.h", @@ -19,6 +17,8 @@ "keyboard.h", "keyboard_delegate.h", "keyboard_device_configuration_delegate.h", + "layer_tree_frame_sink_holder.cc", + "layer_tree_frame_sink_holder.h", "notification_surface.cc", "notification_surface.h", "notification_surface_manager.h",
diff --git a/components/exo/buffer.cc b/components/exo/buffer.cc index 94dd9d1..56bdd0ee 100644 --- a/components/exo/buffer.cc +++ b/components/exo/buffer.cc
@@ -24,7 +24,7 @@ #include "cc/output/context_provider.h" #include "cc/resources/single_release_callback.h" #include "cc/resources/texture_mailbox.h" -#include "components/exo/compositor_frame_sink_holder.h" +#include "components/exo/layer_tree_frame_sink_holder.h" #include "gpu/command_buffer/client/context_support.h" #include "gpu/command_buffer/client/gles2_interface.h" #include "ui/aura/env.h" @@ -408,7 +408,7 @@ Buffer::~Buffer() {} bool Buffer::ProduceTransferableResource( - CompositorFrameSinkHolder* compositor_frame_sink_holder, + LayerTreeFrameSinkHolder* layer_tree_frame_sink_holder, cc::ResourceId resource_id, bool secure_output_only, bool client_usage, @@ -470,7 +470,7 @@ // The contents texture will be released when no longer used by the // compositor. - compositor_frame_sink_holder->SetResourceReleaseCallback( + layer_tree_frame_sink_holder->SetResourceReleaseCallback( resource_id, base::Bind(&Buffer::Texture::ReleaseTexImage, base::Unretained(contents_texture), @@ -500,7 +500,7 @@ // The mailbox texture will be released when no longer used by the // compositor. - compositor_frame_sink_holder->SetResourceReleaseCallback( + layer_tree_frame_sink_holder->SetResourceReleaseCallback( resource_id, base::Bind(&Buffer::Texture::Release, base::Unretained(texture), base::Bind(&Buffer::ReleaseTexture, AsWeakPtr(),
diff --git a/components/exo/buffer.h b/components/exo/buffer.h index 54097d3..890edf4 100644 --- a/components/exo/buffer.h +++ b/components/exo/buffer.h
@@ -26,7 +26,7 @@ namespace exo { -class CompositorFrameSinkHolder; +class LayerTreeFrameSinkHolder; // This class provides the content for a Surface. The mechanism by which a // client provides and updates the contents is the responsibility of the client @@ -53,7 +53,7 @@ // be called before a new texture mailbox can be acquired unless // |non_client_usage| is true. bool ProduceTransferableResource( - CompositorFrameSinkHolder* compositor_frame_sink_holder, + LayerTreeFrameSinkHolder* layer_tree_frame_sink_holder, cc::ResourceId resource_id, bool secure_output_only, bool client_usage,
diff --git a/components/exo/buffer_unittest.cc b/components/exo/buffer_unittest.cc index 9fa7379..69e187af 100644 --- a/components/exo/buffer_unittest.cc +++ b/components/exo/buffer_unittest.cc
@@ -33,8 +33,8 @@ new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); std::unique_ptr<Surface> surface(new Surface); const cc::FrameSinkId arbitrary_frame_sink_id(1, 1); - CompositorFrameSinkHolder* compositor_frame_sink_holder = - surface->compositor_frame_sink_holder(); + LayerTreeFrameSinkHolder* layer_tree_frame_sink_holder = + surface->layer_tree_frame_sink_holder(); // Set the release callback. int release_call_count = 0; @@ -44,7 +44,7 @@ buffer->OnAttach(); cc::TransferableResource resource; // Produce a transferable resource for the contents of the buffer. - bool rv = buffer->ProduceTransferableResource(compositor_frame_sink_holder, 0, + bool rv = buffer->ProduceTransferableResource(layer_tree_frame_sink_holder, 0, false, true, &resource); ASSERT_TRUE(rv); @@ -54,7 +54,7 @@ returned_resource.sync_token = resource.mailbox_holder.sync_token; returned_resource.lost = false; cc::ReturnedResourceArray resources = {returned_resource}; - compositor_frame_sink_holder->ReclaimResources(resources); + layer_tree_frame_sink_holder->ReclaimResources(resources); RunAllPendingInMessageLoop(); ASSERT_EQ(release_call_count, 0); @@ -71,15 +71,15 @@ new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); const cc::FrameSinkId arbitrary_frame_sink_id(1, 1); std::unique_ptr<Surface> surface(new Surface); - CompositorFrameSinkHolder* compositor_frame_sink_holder = - surface->compositor_frame_sink_holder(); + LayerTreeFrameSinkHolder* layer_tree_frame_sink_holder = + surface->layer_tree_frame_sink_holder(); cc::ResourceId resource_id = 0; buffer->OnAttach(); // Acquire a texture transferable resource for the contents of the buffer. cc::TransferableResource resource; bool rv = buffer->ProduceTransferableResource( - compositor_frame_sink_holder, resource_id, false, true, &resource); + layer_tree_frame_sink_holder, resource_id, false, true, &resource); ASSERT_TRUE(rv); scoped_refptr<cc::ContextProvider> context_provider = @@ -99,7 +99,7 @@ returned_resource.sync_token = gpu::SyncToken(); returned_resource.lost = is_lost; cc::ReturnedResourceArray resources = {returned_resource}; - compositor_frame_sink_holder->ReclaimResources(resources); + layer_tree_frame_sink_holder->ReclaimResources(resources); RunAllPendingInMessageLoop(); // Producing a new texture transferable resource for the contents of the @@ -107,7 +107,7 @@ ++resource_id; cc::TransferableResource new_resource; rv = buffer->ProduceTransferableResource( - compositor_frame_sink_holder, resource_id, false, false, &new_resource); + layer_tree_frame_sink_holder, resource_id, false, false, &new_resource); ASSERT_TRUE(rv); buffer->OnDetach(); @@ -116,7 +116,7 @@ returned_resource2.sync_token = gpu::SyncToken(); returned_resource2.lost = false; cc::ReturnedResourceArray resources2 = {returned_resource2}; - compositor_frame_sink_holder->ReclaimResources(resources2); + layer_tree_frame_sink_holder->ReclaimResources(resources2); RunAllPendingInMessageLoop(); }
diff --git a/components/exo/compositor_frame_sink_holder.cc b/components/exo/layer_tree_frame_sink_holder.cc similarity index 68% rename from components/exo/compositor_frame_sink_holder.cc rename to components/exo/layer_tree_frame_sink_holder.cc index f63c358b..a71950a 100644 --- a/components/exo/compositor_frame_sink_holder.cc +++ b/components/exo/layer_tree_frame_sink_holder.cc
@@ -2,20 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/exo/compositor_frame_sink_holder.h" +#include "components/exo/layer_tree_frame_sink_holder.h" -#include "cc/output/compositor_frame_sink.h" +#include "cc/output/layer_tree_frame_sink.h" #include "cc/resources/returned_resource.h" #include "components/exo/surface.h" namespace exo { //////////////////////////////////////////////////////////////////////////////// -// CompositorFrameSinkHolder, public: +// LayerTreeFrameSinkHolder, public: -CompositorFrameSinkHolder::CompositorFrameSinkHolder( +LayerTreeFrameSinkHolder::LayerTreeFrameSinkHolder( Surface* surface, - std::unique_ptr<cc::CompositorFrameSink> frame_sink) + std::unique_ptr<cc::LayerTreeFrameSink> frame_sink) : surface_(surface), frame_sink_(std::move(frame_sink)), weak_factory_(this) { @@ -23,22 +23,22 @@ frame_sink_->BindToClient(this); } -CompositorFrameSinkHolder::~CompositorFrameSinkHolder() { +LayerTreeFrameSinkHolder::~LayerTreeFrameSinkHolder() { frame_sink_->DetachFromClient(); if (surface_) surface_->RemoveSurfaceObserver(this); - // Release all resources which aren't returned from CompositorFrameSink. + // Release all resources which aren't returned from LayerTreeFrameSink. for (auto& callback : release_callbacks_) callback.second.Run(gpu::SyncToken(), false); } -bool CompositorFrameSinkHolder::HasReleaseCallbackForResource( +bool LayerTreeFrameSinkHolder::HasReleaseCallbackForResource( cc::ResourceId id) { return release_callbacks_.find(id) != release_callbacks_.end(); } -void CompositorFrameSinkHolder::SetResourceReleaseCallback( +void LayerTreeFrameSinkHolder::SetResourceReleaseCallback( cc::ResourceId id, const cc::ReleaseCallback& callback) { DCHECK(!callback.is_null()); @@ -46,15 +46,15 @@ } //////////////////////////////////////////////////////////////////////////////// -// cc::CompositorFrameSinkClient overrides: +// cc::LayerTreeFrameSinkClient overrides: -void CompositorFrameSinkHolder::SetBeginFrameSource( +void LayerTreeFrameSinkHolder::SetBeginFrameSource( cc::BeginFrameSource* source) { if (surface_) surface_->SetBeginFrameSource(source); } -void CompositorFrameSinkHolder::ReclaimResources( +void LayerTreeFrameSinkHolder::ReclaimResources( const cc::ReturnedResourceArray& resources) { for (auto& resource : resources) { auto it = release_callbacks_.find(resource.id); @@ -66,7 +66,7 @@ } } -void CompositorFrameSinkHolder::DidReceiveCompositorFrameAck() { +void LayerTreeFrameSinkHolder::DidReceiveCompositorFrameAck() { if (surface_) surface_->DidReceiveCompositorFrameAck(); } @@ -74,7 +74,7 @@ //////////////////////////////////////////////////////////////////////////////// // SurfaceObserver overrides: -void CompositorFrameSinkHolder::OnSurfaceDestroying(Surface* surface) { +void LayerTreeFrameSinkHolder::OnSurfaceDestroying(Surface* surface) { surface_->RemoveSurfaceObserver(this); surface_ = nullptr; }
diff --git a/components/exo/compositor_frame_sink_holder.h b/components/exo/layer_tree_frame_sink_holder.h similarity index 65% rename from components/exo/compositor_frame_sink_holder.h rename to components/exo/layer_tree_frame_sink_holder.h index 5325561..f3e7f87c 100644 --- a/components/exo/compositor_frame_sink_holder.h +++ b/components/exo/layer_tree_frame_sink_holder.h
@@ -2,18 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_EXO_COMPOSITOR_FRAME_SINK_HOLDER_H_ -#define COMPONENTS_EXO_COMPOSITOR_FRAME_SINK_HOLDER_H_ +#ifndef COMPONENTS_EXO_LAYER_TREE_FRAME_SINK_HOLDER_H_ +#define COMPONENTS_EXO_LAYER_TREE_FRAME_SINK_HOLDER_H_ #include <memory> #include "base/containers/flat_map.h" -#include "cc/output/compositor_frame_sink_client.h" +#include "cc/output/layer_tree_frame_sink_client.h" #include "cc/resources/release_callback.h" #include "components/exo/surface_observer.h" namespace cc { -class CompositorFrameSink; +class LayerTreeFrameSink; } namespace exo { @@ -23,32 +23,29 @@ // the contents of Buffers. It's keeped alive by references from // release_callbacks_. It's destroyed when its owning Surface is destroyed and // the last outstanding release callback is called. -class CompositorFrameSinkHolder : public cc::CompositorFrameSinkClient, - public SurfaceObserver { +class LayerTreeFrameSinkHolder : public cc::LayerTreeFrameSinkClient, + public SurfaceObserver { public: - CompositorFrameSinkHolder( - Surface* surface, - std::unique_ptr<cc::CompositorFrameSink> frame_sink); - ~CompositorFrameSinkHolder() override; + LayerTreeFrameSinkHolder(Surface* surface, + std::unique_ptr<cc::LayerTreeFrameSink> frame_sink); + ~LayerTreeFrameSinkHolder() override; bool HasReleaseCallbackForResource(cc::ResourceId id); void SetResourceReleaseCallback(cc::ResourceId id, const cc::ReleaseCallback& callback); - cc::CompositorFrameSink* GetCompositorFrameSink() { - return frame_sink_.get(); - } + cc::LayerTreeFrameSink* GetLayerTreeFrameSink() { return frame_sink_.get(); } - base::WeakPtr<CompositorFrameSinkHolder> GetWeakPtr() { + base::WeakPtr<LayerTreeFrameSinkHolder> GetWeakPtr() { return weak_factory_.GetWeakPtr(); } - // Overridden from cc::CompositorFrameSinkClient: + // Overridden from cc::LayerTreeFrameSinkClient: void SetBeginFrameSource(cc::BeginFrameSource* source) override; void ReclaimResources(const cc::ReturnedResourceArray& resources) override; void SetTreeActivationCallback(const base::Closure& callback) override {} void DidReceiveCompositorFrameAck() override; - void DidLoseCompositorFrameSink() override {} + void DidLoseLayerTreeFrameSink() override {} void OnDraw(const gfx::Transform& transform, const gfx::Rect& viewport, bool resourceless_software_draw) override {} @@ -61,19 +58,18 @@ void OnSurfaceDestroying(Surface* surface) override; private: - // A collection of callbacks used to release resources. using ResourceReleaseCallbackMap = base::flat_map<int, cc::ReleaseCallback>; ResourceReleaseCallbackMap release_callbacks_; Surface* surface_; - std::unique_ptr<cc::CompositorFrameSink> frame_sink_; + std::unique_ptr<cc::LayerTreeFrameSink> frame_sink_; - base::WeakPtrFactory<CompositorFrameSinkHolder> weak_factory_; + base::WeakPtrFactory<LayerTreeFrameSinkHolder> weak_factory_; - DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkHolder); + DISALLOW_COPY_AND_ASSIGN(LayerTreeFrameSinkHolder); }; } // namespace exo -#endif // COMPONENTS_EXO_COMPOSITOR_FRAME_SINK_HOLDER_H_ +#endif // COMPONENTS_EXO_LAYER_TREE_FRAME_SINK_HOLDER_H_
diff --git a/components/exo/surface.cc b/components/exo/surface.cc index c83338c..5184110 100644 --- a/components/exo/surface.cc +++ b/components/exo/surface.cc
@@ -12,7 +12,7 @@ #include "base/memory/ptr_util.h" #include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event_argument.h" -#include "cc/output/compositor_frame_sink.h" +#include "cc/output/layer_tree_frame_sink.h" #include "cc/quads/render_pass.h" #include "cc/quads/shared_quad_state.h" #include "cc/quads/solid_color_draw_quad.h" @@ -194,8 +194,8 @@ window_->set_owned_by_parent(false); window_->AddObserver(this); aura::Env::GetInstance()->context_factory()->AddObserver(this); - compositor_frame_sink_holder_ = base::MakeUnique<CompositorFrameSinkHolder>( - this, window_->CreateCompositorFrameSink()); + layer_tree_frame_sink_holder_ = base::MakeUnique<LayerTreeFrameSinkHolder>( + this, window_->CreateLayerTreeFrameSink()); } Surface::~Surface() { @@ -447,7 +447,7 @@ if (current_begin_frame_ack_.sequence_number != cc::BeginFrameArgs::kInvalidFrameNumber) { if (!current_begin_frame_ack_.has_damage) { - compositor_frame_sink_holder_->GetCompositorFrameSink() + layer_tree_frame_sink_holder_->GetLayerTreeFrameSink() ->DidNotProduceFrame(current_begin_frame_ack_); } current_begin_frame_ack_.sequence_number = @@ -491,7 +491,7 @@ // Reset damage. pending_damage_.setEmpty(); DCHECK(!current_resource_.id || - compositor_frame_sink_holder_->HasReleaseCallbackForResource( + layer_tree_frame_sink_holder_->HasReleaseCallbackForResource( current_resource_.id)); // Synchronize window hierarchy. This will position and update the stacking @@ -744,7 +744,7 @@ void Surface::UpdateResource(bool client_usage) { if (current_buffer_.buffer() && current_buffer_.buffer()->ProduceTransferableResource( - compositor_frame_sink_holder_.get(), next_resource_id_++, + layer_tree_frame_sink_holder_.get(), next_resource_id_++, state_.only_visible_on_secure_output, client_usage, ¤t_resource_)) { current_resource_has_alpha_ = @@ -776,7 +776,7 @@ content_size_ = layer_size; // We need update window_'s bounds with content size, because the - // CompositorFrameSink may not update the window's size base the size of + // LayerTreeFrameSink may not update the window's size base the size of // the lastest submitted CompositorFrame. window_->SetBounds(gfx::Rect(window_->bounds().origin(), content_size_)); // TODO(jbauman): Figure out how this interacts with the pixel size of @@ -859,8 +859,8 @@ } frame.render_pass_list.push_back(std::move(render_pass)); - compositor_frame_sink_holder_->GetCompositorFrameSink() - ->SubmitCompositorFrame(std::move(frame)); + layer_tree_frame_sink_holder_->GetLayerTreeFrameSink()->SubmitCompositorFrame( + std::move(frame)); } } // namespace exo
diff --git a/components/exo/surface.h b/components/exo/surface.h index d0d5974..7dabdda 100644 --- a/components/exo/surface.h +++ b/components/exo/surface.h
@@ -16,7 +16,7 @@ #include "base/observer_list.h" #include "cc/resources/transferable_resource.h" #include "cc/scheduler/begin_frame_source.h" -#include "components/exo/compositor_frame_sink_holder.h" +#include "components/exo/layer_tree_frame_sink_holder.h" #include "third_party/skia/include/core/SkBlendMode.h" #include "third_party/skia/include/core/SkRegion.h" #include "ui/aura/window.h" @@ -70,8 +70,8 @@ cc::SurfaceId GetSurfaceId() const; - CompositorFrameSinkHolder* compositor_frame_sink_holder() { - return compositor_frame_sink_holder_.get(); + LayerTreeFrameSinkHolder* layer_tree_frame_sink_holder() { + return layer_tree_frame_sink_holder_.get(); } // Set a buffer as the content of this surface. A buffer can only be attached @@ -302,7 +302,7 @@ // The device scale factor sent in CompositorFrames. float device_scale_factor_ = 1.0f; - std::unique_ptr<CompositorFrameSinkHolder> compositor_frame_sink_holder_; + std::unique_ptr<LayerTreeFrameSinkHolder> layer_tree_frame_sink_holder_; // The next resource id the buffer will be attached to. int next_resource_id_ = 1;
diff --git a/components/exo/surface_unittest.cc b/components/exo/surface_unittest.cc index 7e9ad52..dc79726 100644 --- a/components/exo/surface_unittest.cc +++ b/components/exo/surface_unittest.cc
@@ -52,7 +52,7 @@ // attached buffer. surface->Attach(nullptr); surface->Commit(); - // CompositorFrameSinkHolder::ReclaimResources() gets called via + // LayerTreeFrameSinkHolder::ReclaimResources() gets called via // MojoCompositorFrameSinkClient interface. We need to wait here for the mojo // call to finish so that the release callback finishes running before // the assertion below.
diff --git a/components/page_info_strings.grdp b/components/page_info_strings.grdp index 93a112f..22d9aeeb 100644 --- a/components/page_info_strings.grdp +++ b/components/page_info_strings.grdp
@@ -309,7 +309,7 @@ <!-- Permission change infobar. --> <if expr="not is_android"> <message name="IDS_PAGE_INFO_INFOBAR_TEXT" desc="The string shown in the infobar after the user has changed site permissions settings, reminding them to reload the page in order for the new settings to take effect."> - New site permissions settings will take effect after reloading the page. + To apply your updated settings to this site, reload this page </message> <message name="IDS_PAGE_INFO_INFOBAR_BUTTON" desc="The string used in the infobar button allowing the user to reload the page directly from the infobar."> Reload
diff --git a/components/proximity_auth/BUILD.gn b/components/proximity_auth/BUILD.gn index 3f4a2a4..db7d253 100644 --- a/components/proximity_auth/BUILD.gn +++ b/components/proximity_auth/BUILD.gn
@@ -57,6 +57,7 @@ "//components/cryptauth/ble", "//components/prefs", "//components/proximity_auth/logging", + "//components/proximity_auth/public/interfaces", "//components/signin/core/account_id:account_id", "//device/bluetooth", "//net",
diff --git a/components/proximity_auth/fake_lock_handler.cc b/components/proximity_auth/fake_lock_handler.cc index d0dcefc..56002bf6 100644 --- a/components/proximity_auth/fake_lock_handler.cc +++ b/components/proximity_auth/fake_lock_handler.cc
@@ -21,12 +21,12 @@ void FakeLockHandler::EnableInput() {} void FakeLockHandler::SetAuthType(const AccountId& account_id, - FakeLockHandler::AuthType auth_type, + mojom::AuthType auth_type, const base::string16& auth_value) {} -FakeLockHandler::AuthType FakeLockHandler::GetAuthType( +mojom::AuthType FakeLockHandler::GetAuthType( const AccountId& account_id) const { - return USER_CLICK; + return mojom::AuthType::USER_CLICK; } FakeLockHandler::ScreenType FakeLockHandler::GetScreenType() const {
diff --git a/components/proximity_auth/fake_lock_handler.h b/components/proximity_auth/fake_lock_handler.h index 701b4f98..b343b23 100644 --- a/components/proximity_auth/fake_lock_handler.h +++ b/components/proximity_auth/fake_lock_handler.h
@@ -23,9 +23,9 @@ void HideUserPodCustomIcon(const AccountId& account_id) override; void EnableInput() override; void SetAuthType(const AccountId& account_id, - AuthType auth_type, + mojom::AuthType auth_type, const base::string16& auth_value) override; - AuthType GetAuthType(const AccountId& account_id) const override; + mojom::AuthType GetAuthType(const AccountId& account_id) const override; ScreenType GetScreenType() const override; void Unlock(const AccountId& account_id) override; void AttemptEasySignin(const AccountId& account_id,
diff --git a/components/proximity_auth/proximity_auth_system.cc b/components/proximity_auth/proximity_auth_system.cc index d44381e..1129cba3 100644 --- a/components/proximity_auth/proximity_auth_system.cc +++ b/components/proximity_auth/proximity_auth_system.cc
@@ -96,7 +96,7 @@ void ProximityAuthSystem::OnAuthAttempted(const AccountId& /* account_id */) { // TODO(tengs): There is no reason to pass the |account_id| argument anymore. - unlock_manager_->OnAuthAttempted(ScreenlockBridge::LockHandler::USER_CLICK); + unlock_manager_->OnAuthAttempted(mojom::AuthType::USER_CLICK); } void ProximityAuthSystem::OnSuspend() {
diff --git a/components/proximity_auth/proximity_auth_system_unittest.cc b/components/proximity_auth/proximity_auth_system_unittest.cc index 774b521..1bd8c716 100644 --- a/components/proximity_auth/proximity_auth_system_unittest.cc +++ b/components/proximity_auth/proximity_auth_system_unittest.cc
@@ -64,7 +64,7 @@ MOCK_METHOD0(IsUnlockAllowed, bool()); MOCK_METHOD1(SetRemoteDeviceLifeCycle, void(RemoteDeviceLifeCycle*)); MOCK_METHOD0(OnLifeCycleStateChanged, void()); - MOCK_METHOD1(OnAuthAttempted, void(ScreenlockBridge::LockHandler::AuthType)); + MOCK_METHOD1(OnAuthAttempted, void(mojom::AuthType)); private: DISALLOW_COPY_AND_ASSIGN(MockUnlockManager);
diff --git a/components/proximity_auth/public/interfaces/BUILD.gn b/components/proximity_auth/public/interfaces/BUILD.gn new file mode 100644 index 0000000..00e24008 --- /dev/null +++ b/components/proximity_auth/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 = [ + "auth_type.mojom", + ] +}
diff --git a/components/proximity_auth/public/interfaces/OWNERS b/components/proximity_auth/public/interfaces/OWNERS new file mode 100644 index 0000000..08850f4 --- /dev/null +++ b/components/proximity_auth/public/interfaces/OWNERS
@@ -0,0 +1,2 @@ +per-file *.mojom=set noparent +per-file *.mojom=file://ipc/SECURITY_OWNERS
diff --git a/components/proximity_auth/public/interfaces/auth_type.mojom b/components/proximity_auth/public/interfaces/auth_type.mojom new file mode 100644 index 0000000..12ad61f --- /dev/null +++ b/components/proximity_auth/public/interfaces/auth_type.mojom
@@ -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. + +module proximity_auth.mojom; + +// Supported authentication types. +enum AuthType { + // Password is used to authenticate. + OFFLINE_PASSWORD, + + // Online authentication against GAIA. + ONLINE_SIGN_IN, + + // Pin is used to authenticate. + NUMERIC_PIN, + + // Click on the user pod to unlock/sign-in. + USER_CLICK, + + // Used for public session. Click on the user pod would expand the pod and + // allow a click to sign-in. + EXPAND_THEN_USER_CLICK, + + // Forced to use password to authenticate. + // Unlike OFFLINE_PASSWORD, this can't be changed to any other. + FORCE_OFFLINE_PASSWORD, +};
diff --git a/components/proximity_auth/screenlock_bridge.h b/components/proximity_auth/screenlock_bridge.h index 40d1c44..de23dba 100644 --- a/components/proximity_auth/screenlock_bridge.h +++ b/components/proximity_auth/screenlock_bridge.h
@@ -13,6 +13,7 @@ #include "base/observer_list.h" #include "base/strings/string16.h" #include "base/values.h" +#include "components/proximity_auth/public/interfaces/auth_type.mojom.h" #include "components/signin/core/account_id/account_id.h" namespace proximity_auth { @@ -99,17 +100,6 @@ class LockHandler { public: - // Supported authentication types. Keep in sync with the enum in - // user_pod_row.js. - enum AuthType { - OFFLINE_PASSWORD = 0, - ONLINE_SIGN_IN = 1, - NUMERIC_PIN = 2, - USER_CLICK = 3, - EXPAND_THEN_USER_CLICK = 4, - FORCE_OFFLINE_PASSWORD = 5 - }; - enum ScreenType { SIGNIN_SCREEN = 0, LOCK_SCREEN = 1, OTHER_SCREEN = 2 }; // Displays |message| in a banner on the lock screen. @@ -128,11 +118,12 @@ // Set the authentication type to be used on the lock screen. virtual void SetAuthType(const AccountId& account_id, - AuthType auth_type, + proximity_auth::mojom::AuthType auth_type, const base::string16& auth_value) = 0; // Returns the authentication type used for a user. - virtual AuthType GetAuthType(const AccountId& account_id) const = 0; + virtual proximity_auth::mojom::AuthType GetAuthType( + const AccountId& account_id) const = 0; // Returns the type of the screen -- a signin or a lock screen. virtual ScreenType GetScreenType() const = 0;
diff --git a/components/proximity_auth/unlock_manager.h b/components/proximity_auth/unlock_manager.h index 7033906..86b3113 100644 --- a/components/proximity_auth/unlock_manager.h +++ b/components/proximity_auth/unlock_manager.h
@@ -31,8 +31,7 @@ // Called when the user pod is clicked for an authentication attempt of type // |auth_type|. // Exposed for testing. - virtual void OnAuthAttempted( - ScreenlockBridge::LockHandler::AuthType auth_type) = 0; + virtual void OnAuthAttempted(mojom::AuthType auth_type) = 0; }; } // namespace proximity_auth
diff --git a/components/proximity_auth/unlock_manager_impl.cc b/components/proximity_auth/unlock_manager_impl.cc index ffce50a..92afbace 100644 --- a/components/proximity_auth/unlock_manager_impl.cc +++ b/components/proximity_auth/unlock_manager_impl.cc
@@ -283,14 +283,13 @@ } #endif // defined(OS_CHROMEOS) -void UnlockManagerImpl::OnAuthAttempted( - ScreenlockBridge::LockHandler::AuthType auth_type) { +void UnlockManagerImpl::OnAuthAttempted(mojom::AuthType auth_type) { if (is_attempting_auth_) { PA_LOG(INFO) << "Already attempting auth."; return; } - if (auth_type != ScreenlockBridge::LockHandler::USER_CLICK) + if (auth_type != mojom::AuthType::USER_CLICK) return; is_attempting_auth_ = true;
diff --git a/components/proximity_auth/unlock_manager_impl.h b/components/proximity_auth/unlock_manager_impl.h index 6049e86..c880844 100644 --- a/components/proximity_auth/unlock_manager_impl.h +++ b/components/proximity_auth/unlock_manager_impl.h
@@ -50,8 +50,7 @@ bool IsUnlockAllowed() override; void SetRemoteDeviceLifeCycle(RemoteDeviceLifeCycle* life_cycle) override; void OnLifeCycleStateChanged() override; - void OnAuthAttempted( - ScreenlockBridge::LockHandler::AuthType auth_type) override; + void OnAuthAttempted(mojom::AuthType auth_type) override; protected: // Creates a ProximityMonitor instance for the given |connection|.
diff --git a/components/proximity_auth/unlock_manager_impl_unittest.cc b/components/proximity_auth/unlock_manager_impl_unittest.cc index bc88d7c..9dc836f 100644 --- a/components/proximity_auth/unlock_manager_impl_unittest.cc +++ b/components/proximity_auth/unlock_manager_impl_unittest.cc
@@ -640,7 +640,7 @@ unlock_manager_->SetRemoteDeviceLifeCycle(nullptr); EXPECT_CALL(proximity_auth_client_, FinalizeUnlock(false)); - unlock_manager_->OnAuthAttempted(ScreenlockBridge::LockHandler::USER_CLICK); + unlock_manager_->OnAuthAttempted(mojom::AuthType::USER_CLICK); } TEST_F(ProximityAuthUnlockManagerImplTest, OnAuthAttempted_UnlockNotAllowed) { @@ -650,7 +650,7 @@ ON_CALL(*proximity_monitor(), IsUnlockAllowed()).WillByDefault(Return(false)); EXPECT_CALL(proximity_auth_client_, FinalizeUnlock(false)); - unlock_manager_->OnAuthAttempted(ScreenlockBridge::LockHandler::USER_CLICK); + unlock_manager_->OnAuthAttempted(mojom::AuthType::USER_CLICK); } TEST_F(ProximityAuthUnlockManagerImplTest, OnAuthAttempted_NotUserClick) { @@ -658,8 +658,7 @@ SimulateUserPresentState(); EXPECT_CALL(proximity_auth_client_, FinalizeUnlock(_)).Times(0); - unlock_manager_->OnAuthAttempted( - ScreenlockBridge::LockHandler::EXPAND_THEN_USER_CLICK); + unlock_manager_->OnAuthAttempted(mojom::AuthType::EXPAND_THEN_USER_CLICK); } TEST_F(ProximityAuthUnlockManagerImplTest, OnAuthAttempted_DuplicateCall) { @@ -667,17 +666,17 @@ SimulateUserPresentState(); EXPECT_CALL(messenger_, RequestUnlock()); - unlock_manager_->OnAuthAttempted(ScreenlockBridge::LockHandler::USER_CLICK); + unlock_manager_->OnAuthAttempted(mojom::AuthType::USER_CLICK); EXPECT_CALL(messenger_, RequestUnlock()).Times(0); - unlock_manager_->OnAuthAttempted(ScreenlockBridge::LockHandler::USER_CLICK); + unlock_manager_->OnAuthAttempted(mojom::AuthType::USER_CLICK); } TEST_F(ProximityAuthUnlockManagerImplTest, OnAuthAttempted_TimesOut) { CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK); SimulateUserPresentState(); - unlock_manager_->OnAuthAttempted(ScreenlockBridge::LockHandler::USER_CLICK); + unlock_manager_->OnAuthAttempted(mojom::AuthType::USER_CLICK); // Simulate the timeout period elapsing. EXPECT_CALL(proximity_auth_client_, FinalizeUnlock(false)); @@ -689,7 +688,7 @@ CreateUnlockManager(ProximityAuthSystem::SESSION_LOCK); SimulateUserPresentState(); - unlock_manager_->OnAuthAttempted(ScreenlockBridge::LockHandler::USER_CLICK); + unlock_manager_->OnAuthAttempted(mojom::AuthType::USER_CLICK); EXPECT_CALL(proximity_auth_client_, FinalizeUnlock(_)); unlock_manager_->OnUnlockResponse(false); @@ -706,7 +705,7 @@ SimulateUserPresentState(); EXPECT_CALL(messenger_, RequestUnlock()); - unlock_manager_->OnAuthAttempted(ScreenlockBridge::LockHandler::USER_CLICK); + unlock_manager_->OnAuthAttempted(mojom::AuthType::USER_CLICK); EXPECT_CALL(proximity_auth_client_, FinalizeUnlock(false)); unlock_manager_->OnUnlockResponse(false); @@ -719,7 +718,7 @@ SimulateUserPresentState(); EXPECT_CALL(messenger_, RequestUnlock()); - unlock_manager_->OnAuthAttempted(ScreenlockBridge::LockHandler::USER_CLICK); + unlock_manager_->OnAuthAttempted(mojom::AuthType::USER_CLICK); EXPECT_CALL(messenger_, DispatchUnlockEvent()); unlock_manager_->OnUnlockResponse(true); @@ -735,7 +734,7 @@ SimulateUserPresentState(); EXPECT_CALL(messenger_, RequestUnlock()); - unlock_manager_->OnAuthAttempted(ScreenlockBridge::LockHandler::USER_CLICK); + unlock_manager_->OnAuthAttempted(mojom::AuthType::USER_CLICK); EXPECT_CALL(messenger_, DispatchUnlockEvent()); unlock_manager_->OnUnlockResponse(true); @@ -751,7 +750,7 @@ SimulateUserPresentState(); EXPECT_CALL(messenger_, DispatchUnlockEvent()); - unlock_manager_->OnAuthAttempted(ScreenlockBridge::LockHandler::USER_CLICK); + unlock_manager_->OnAuthAttempted(mojom::AuthType::USER_CLICK); EXPECT_CALL(proximity_auth_client_, FinalizeUnlock(false)); unlock_manager_->OnUnlockEventSent(false); @@ -764,7 +763,7 @@ SimulateUserPresentState(); EXPECT_CALL(messenger_, DispatchUnlockEvent()); - unlock_manager_->OnAuthAttempted(ScreenlockBridge::LockHandler::USER_CLICK); + unlock_manager_->OnAuthAttempted(mojom::AuthType::USER_CLICK); EXPECT_CALL(proximity_auth_client_, FinalizeUnlock(true)); unlock_manager_->OnUnlockEventSent(true); @@ -788,7 +787,7 @@ })); EXPECT_CALL(messenger_, RequestDecryption(kChallenge)); - unlock_manager_->OnAuthAttempted(ScreenlockBridge::LockHandler::USER_CLICK); + unlock_manager_->OnAuthAttempted(mojom::AuthType::USER_CLICK); EXPECT_CALL(messenger_, DispatchUnlockEvent()); unlock_manager_->OnDecryptResponse(kSignInSecret); @@ -816,7 +815,7 @@ })); EXPECT_CALL(messenger_, RequestDecryption(kChallenge)); - unlock_manager_->OnAuthAttempted(ScreenlockBridge::LockHandler::USER_CLICK); + unlock_manager_->OnAuthAttempted(mojom::AuthType::USER_CLICK); EXPECT_CALL(messenger_, DispatchUnlockEvent()); unlock_manager_->OnDecryptResponse(kSignInSecret); @@ -844,7 +843,7 @@ })); EXPECT_CALL(messenger_, RequestDecryption(kChallenge)); - unlock_manager_->OnAuthAttempted(ScreenlockBridge::LockHandler::USER_CLICK); + unlock_manager_->OnAuthAttempted(mojom::AuthType::USER_CLICK); EXPECT_CALL(proximity_auth_client_, FinalizeSignin(std::string())); unlock_manager_->OnDecryptResponse(std::string());
diff --git a/components/test/data/web_database/version_72.sql b/components/test/data/web_database/version_72.sql new file mode 100644 index 0000000..f1904a76 --- /dev/null +++ b/components/test/data/web_database/version_72.sql
@@ -0,0 +1,32 @@ +PRAGMA foreign_keys=OFF; +BEGIN TRANSACTION; +CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, value LONGVARCHAR); +INSERT INTO "meta" VALUES('mmap_status','-1'); +INSERT INTO "meta" VALUES('version','72'); +INSERT INTO "meta" VALUES('last_compatible_version','72'); +INSERT INTO "meta" VALUES('Builtin Keyword Version','98'); +CREATE TABLE token_service (service VARCHAR PRIMARY KEY NOT NULL,encrypted_token BLOB); +CREATE TABLE keywords (id INTEGER PRIMARY KEY,short_name VARCHAR NOT NULL,keyword VARCHAR NOT NULL,favicon_url VARCHAR NOT NULL,url VARCHAR NOT NULL,safe_for_autoreplace INTEGER,originating_url VARCHAR,date_created INTEGER DEFAULT 0,usage_count INTEGER DEFAULT 0,input_encodings VARCHAR,suggest_url VARCHAR,prepopulate_id INTEGER DEFAULT 0,created_by_policy INTEGER DEFAULT 0,instant_url VARCHAR,last_modified INTEGER DEFAULT 0,sync_guid VARCHAR,alternate_urls VARCHAR,search_terms_replacement_key VARCHAR,image_url VARCHAR,search_url_post_params VARCHAR,suggest_url_post_params VARCHAR,instant_url_post_params VARCHAR,image_url_post_params VARCHAR,new_tab_url VARCHAR, last_visited INTEGER DEFAULT 0); +INSERT INTO "keywords" VALUES(2,'Google','google.com','http://www.google.com/favicon.ico','{google:baseURL}search?q={searchTerms}&{google:RLZ}{google:originalQueryForSuggestion}{google:assistedQueryStats}{google:searchFieldtrialParameter}{google:iOSSearchLanguage}{google:searchClient}{google:sourceId}{google:instantExtendedEnabledParameter}{google:contextualSearchVersion}ie={inputEncoding}',1,'',0,0,'UTF-8','{google:baseSuggestURL}search?{google:searchFieldtrialParameter}client={google:suggestClient}&gs_ri={google:suggestRid}&xssi=t&q={searchTerms}&{google:inputType}{google:cursorPosition}{google:currentPageUrl}{google:pageClassification}{google:searchVersion}{google:sessionToken}{google:prefetchQuery}sugkey={google:suggestAPIKeyParameter}',1,0,'{google:baseURL}webhp?sourceid=chrome-instant&{google:RLZ}{google:forceInstantResults}{google:instantExtendedEnabledParameter}ie={inputEncoding}',0,'746c326c-775a-4149-9777-6ea8d5cba42e','["{google:baseURL}#q={searchTerms}","{google:baseURL}search#q={searchTerms}","{google:baseURL}webhp#q={searchTerms}","{google:baseURL}s#q={searchTerms}","{google:baseURL}s?q={searchTerms}"]','espv','{google:baseURL}searchbyimage/upload','','','','encoded_image={google:imageThumbnail},image_url={google:imageURL},sbisrc={google:imageSearchSource},original_width={google:imageOriginalWidth},original_height={google:imageOriginalHeight}','{google:baseURL}_/chrome/newtab?{google:RLZ}{google:instantExtendedEnabledParameter}ie={inputEncoding}',0); +INSERT INTO "keywords" VALUES(3,'Bing','bing.com','https://www.bing.com/s/a/bing_p.ico','https://www.bing.com/search?q={searchTerms}&PC=U316&FORM=CHROMN',1,'',0,0,'UTF-8','https://www.bing.com/osjson.aspx?query={searchTerms}&language={language}&PC=U316',3,0,'',0,'7563284f-dade-4e03-b164-17a6122ae635','[]','','https://www.bing.com/images/detail/search?iss=sbi&FORM=CHROMI#enterInsights','','','','imgurl={google:imageURL}','https://www.bing.com/chrome/newtab',0); +INSERT INTO "keywords" VALUES(4,'Yahoo!','yahoo.com','https://search.yahoo.com/favicon.ico','https://search.yahoo.com/search?ei={inputEncoding}&fr=crmas&p={searchTerms}',1,'',0,0,'UTF-8','https://search.yahoo.com/sugg/chrome?output=fxjson&appid=crmas&command={searchTerms}',2,0,'',0,'5e79ca4c-0483-42c7-a217-3638ced8f6cd','[]','','','','','','','',0); +INSERT INTO "keywords" VALUES(5,'AOL','aol.com','https://search.aol.com/favicon.ico','https://search.aol.com/aol/search?q={searchTerms}',1,'',0,0,'UTF-8','http://autocomplete.search.aol.com/autocomplete/get?output=json&it=&q={searchTerms}',35,0,'',0,'f0676c78-9a85-4720-bd74-110e473ce6e7','[]','','','','','','','',0); +INSERT INTO "keywords" VALUES(6,'Ask','ask.com','http://sp.ask.com/sh/i/a16/favicon/favicon.ico','http://www.ask.com/web?q={searchTerms}',1,'',0,0,'UTF-8','http://ss.ask.com/query?q={searchTerms}&li=ff',4,0,'',0,'5005f7aa-40a2-44ae-b8d5-363892f5f39d','[]','','','','','','','',0); +CREATE TABLE autofill (name VARCHAR, value VARCHAR, value_lower VARCHAR, date_created INTEGER DEFAULT 0, date_last_used INTEGER DEFAULT 0, count INTEGER DEFAULT 1, PRIMARY KEY (name, value)); +CREATE TABLE credit_cards ( guid VARCHAR PRIMARY KEY, name_on_card VARCHAR, expiration_month INTEGER, expiration_year INTEGER, card_number_encrypted BLOB, date_modified INTEGER NOT NULL DEFAULT 0, origin VARCHAR DEFAULT '', use_count INTEGER NOT NULL DEFAULT 0, use_date INTEGER NOT NULL DEFAULT 0, billing_address_id VARCHAR); +CREATE TABLE autofill_profiles ( guid VARCHAR PRIMARY KEY, company_name VARCHAR, street_address VARCHAR, dependent_locality VARCHAR, city VARCHAR, state VARCHAR, zipcode VARCHAR, sorting_code VARCHAR, country_code VARCHAR, date_modified INTEGER NOT NULL DEFAULT 0, origin VARCHAR DEFAULT '', language_code VARCHAR, use_count INTEGER NOT NULL DEFAULT 0, use_date INTEGER NOT NULL DEFAULT 0); +CREATE TABLE autofill_profile_names ( guid VARCHAR, first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR, full_name VARCHAR); +CREATE TABLE autofill_profile_emails ( guid VARCHAR, email VARCHAR); +CREATE TABLE autofill_profile_phones ( guid VARCHAR, number VARCHAR); +CREATE TABLE autofill_profiles_trash ( guid VARCHAR); +CREATE TABLE masked_credit_cards (id VARCHAR,status VARCHAR,name_on_card VARCHAR,network VARCHAR,last_four VARCHAR,exp_month INTEGER DEFAULT 0,exp_year INTEGER DEFAULT 0); +INSERT INTO "masked_credit_cards" VALUES('card_1','status','bob','VISA','1234',12,2050); +CREATE TABLE unmasked_credit_cards (id VARCHAR,card_number_encrypted VARCHAR, use_count INTEGER NOT NULL DEFAULT 0, use_date INTEGER NOT NULL DEFAULT 0, unmask_date INTEGER NOT NULL DEFAULT 0); +CREATE TABLE server_card_metadata (id VARCHAR NOT NULL,use_count INTEGER NOT NULL DEFAULT 0, use_date INTEGER NOT NULL DEFAULT 0, billing_address_id VARCHAR); +CREATE TABLE server_addresses (id VARCHAR,company_name VARCHAR,street_address VARCHAR,address_1 VARCHAR,address_2 VARCHAR,address_3 VARCHAR,address_4 VARCHAR,postal_code VARCHAR,sorting_code VARCHAR,country_code VARCHAR,language_code VARCHAR, recipient_name VARCHAR, phone_number VARCHAR); +CREATE TABLE server_address_metadata (id VARCHAR NOT NULL,use_count INTEGER NOT NULL DEFAULT 0, use_date INTEGER NOT NULL DEFAULT 0, has_converted BOOL NOT NULL DEFAULT FALSE); +CREATE TABLE autofill_sync_metadata (storage_key VARCHAR PRIMARY KEY NOT NULL,value BLOB); +CREATE TABLE autofill_model_type_state (id INTEGER PRIMARY KEY, value BLOB); +CREATE INDEX autofill_name ON autofill (name); +CREATE INDEX autofill_name_value_lower ON autofill (name, value_lower); +COMMIT;
diff --git a/components/viz/client/BUILD.gn b/components/viz/client/BUILD.gn index 1e73b925..bde56a9 100644 --- a/components/viz/client/BUILD.gn +++ b/components/viz/client/BUILD.gn
@@ -4,8 +4,8 @@ source_set("client") { sources = [ - "client_compositor_frame_sink.cc", - "client_compositor_frame_sink.h", + "client_layer_tree_frame_sink.cc", + "client_layer_tree_frame_sink.h", "local_surface_id_provider.cc", "local_surface_id_provider.h", ]
diff --git a/components/viz/client/client_compositor_frame_sink.cc b/components/viz/client/client_layer_tree_frame_sink.cc similarity index 76% rename from components/viz/client/client_compositor_frame_sink.cc rename to components/viz/client/client_layer_tree_frame_sink.cc index 9c9299a..60b27d3 100644 --- a/components/viz/client/client_compositor_frame_sink.cc +++ b/components/viz/client/client_layer_tree_frame_sink.cc
@@ -2,18 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/viz/client/client_compositor_frame_sink.h" +#include "components/viz/client/client_layer_tree_frame_sink.h" #include "base/bind.h" #include "base/memory/ptr_util.h" #include "cc/output/begin_frame_args.h" #include "cc/output/compositor_frame.h" -#include "cc/output/compositor_frame_sink_client.h" +#include "cc/output/layer_tree_frame_sink_client.h" #include "components/viz/client/local_surface_id_provider.h" namespace viz { -ClientCompositorFrameSink::ClientCompositorFrameSink( +ClientLayerTreeFrameSink::ClientLayerTreeFrameSink( scoped_refptr<cc::ContextProvider> context_provider, scoped_refptr<cc::ContextProvider> worker_context_provider, gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, @@ -23,10 +23,10 @@ cc::mojom::MojoCompositorFrameSinkClientRequest client_request, std::unique_ptr<LocalSurfaceIdProvider> local_surface_id_provider, bool enable_surface_synchronization) - : cc::CompositorFrameSink(std::move(context_provider), - std::move(worker_context_provider), - gpu_memory_buffer_manager, - shared_bitmap_manager), + : cc::LayerTreeFrameSink(std::move(context_provider), + std::move(worker_context_provider), + gpu_memory_buffer_manager, + shared_bitmap_manager), local_surface_id_provider_(std::move(local_surface_id_provider)), synthetic_begin_frame_source_(std::move(synthetic_begin_frame_source)), compositor_frame_sink_info_(std::move(compositor_frame_sink_info)), @@ -37,14 +37,14 @@ DETACH_FROM_THREAD(thread_checker_); } -ClientCompositorFrameSink::ClientCompositorFrameSink( +ClientLayerTreeFrameSink::ClientLayerTreeFrameSink( scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider, std::unique_ptr<cc::SyntheticBeginFrameSource> synthetic_begin_frame_source, cc::mojom::MojoCompositorFrameSinkPtrInfo compositor_frame_sink_info, cc::mojom::MojoCompositorFrameSinkClientRequest client_request, std::unique_ptr<LocalSurfaceIdProvider> local_surface_id_provider, bool enable_surface_synchronization) - : cc::CompositorFrameSink(std::move(vulkan_context_provider)), + : cc::LayerTreeFrameSink(std::move(vulkan_context_provider)), local_surface_id_provider_(std::move(local_surface_id_provider)), synthetic_begin_frame_source_(std::move(synthetic_begin_frame_source)), compositor_frame_sink_info_(std::move(compositor_frame_sink_info)), @@ -55,24 +55,23 @@ DETACH_FROM_THREAD(thread_checker_); } -ClientCompositorFrameSink::~ClientCompositorFrameSink() {} +ClientLayerTreeFrameSink::~ClientLayerTreeFrameSink() {} -base::WeakPtr<ClientCompositorFrameSink> -ClientCompositorFrameSink::GetWeakPtr() { +base::WeakPtr<ClientLayerTreeFrameSink> ClientLayerTreeFrameSink::GetWeakPtr() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); return weak_factory_.GetWeakPtr(); } -bool ClientCompositorFrameSink::BindToClient( - cc::CompositorFrameSinkClient* client) { +bool ClientLayerTreeFrameSink::BindToClient( + cc::LayerTreeFrameSinkClient* client) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - if (!cc::CompositorFrameSink::BindToClient(client)) + if (!cc::LayerTreeFrameSink::BindToClient(client)) return false; compositor_frame_sink_.Bind(std::move(compositor_frame_sink_info_)); compositor_frame_sink_.set_connection_error_with_reason_handler( - base::Bind(ClientCompositorFrameSink::OnMojoConnectionError)); + base::Bind(ClientLayerTreeFrameSink::OnMojoConnectionError)); client_binding_.Bind(std::move(client_request_)); if (synthetic_begin_frame_source_) { @@ -85,17 +84,17 @@ return true; } -void ClientCompositorFrameSink::DetachFromClient() { +void ClientLayerTreeFrameSink::DetachFromClient() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); client_->SetBeginFrameSource(nullptr); begin_frame_source_.reset(); synthetic_begin_frame_source_.reset(); client_binding_.Close(); compositor_frame_sink_.reset(); - cc::CompositorFrameSink::DetachFromClient(); + cc::LayerTreeFrameSink::DetachFromClient(); } -void ClientCompositorFrameSink::SetLocalSurfaceId( +void ClientLayerTreeFrameSink::SetLocalSurfaceId( const cc::LocalSurfaceId& local_surface_id) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(local_surface_id.is_valid()); @@ -103,7 +102,7 @@ local_surface_id_ = local_surface_id; } -void ClientCompositorFrameSink::SubmitCompositorFrame( +void ClientLayerTreeFrameSink::SubmitCompositorFrame( cc::CompositorFrame frame) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(frame.metadata.begin_frame_ack.has_damage); @@ -119,38 +118,38 @@ std::move(frame)); } -void ClientCompositorFrameSink::DidNotProduceFrame( +void ClientLayerTreeFrameSink::DidNotProduceFrame( const cc::BeginFrameAck& ack) { DCHECK(!ack.has_damage); DCHECK_LE(cc::BeginFrameArgs::kStartingFrameNumber, ack.sequence_number); compositor_frame_sink_->DidNotProduceFrame(ack); } -void ClientCompositorFrameSink::DidReceiveCompositorFrameAck( +void ClientLayerTreeFrameSink::DidReceiveCompositorFrameAck( const cc::ReturnedResourceArray& resources) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); client_->ReclaimResources(resources); client_->DidReceiveCompositorFrameAck(); } -void ClientCompositorFrameSink::OnBeginFrame( +void ClientLayerTreeFrameSink::OnBeginFrame( const cc::BeginFrameArgs& begin_frame_args) { if (begin_frame_source_) begin_frame_source_->OnBeginFrame(begin_frame_args); } -void ClientCompositorFrameSink::ReclaimResources( +void ClientLayerTreeFrameSink::ReclaimResources( const cc::ReturnedResourceArray& resources) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); client_->ReclaimResources(resources); } -void ClientCompositorFrameSink::OnNeedsBeginFrames(bool needs_begin_frames) { +void ClientLayerTreeFrameSink::OnNeedsBeginFrames(bool needs_begin_frames) { compositor_frame_sink_->SetNeedsBeginFrame(needs_begin_frames); } // static -void ClientCompositorFrameSink::OnMojoConnectionError( +void ClientLayerTreeFrameSink::OnMojoConnectionError( uint32_t custom_reason, const std::string& description) { if (custom_reason)
diff --git a/components/viz/client/client_compositor_frame_sink.h b/components/viz/client/client_layer_tree_frame_sink.h similarity index 81% rename from components/viz/client/client_compositor_frame_sink.h rename to components/viz/client/client_layer_tree_frame_sink.h index c866188..bbc6e37 100644 --- a/components/viz/client/client_compositor_frame_sink.h +++ b/components/viz/client/client_layer_tree_frame_sink.h
@@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_VIZ_CLIENT_CLIENT_COMPOSITOR_FRAME_SINK_H_ -#define COMPONENTS_VIZ_CLIENT_CLIENT_COMPOSITOR_FRAME_SINK_H_ +#ifndef COMPONENTS_VIZ_CLIENT_CLIENT_LAYER_TREE_FRAME_SINK_H_ +#define COMPONENTS_VIZ_CLIENT_CLIENT_LAYER_TREE_FRAME_SINK_H_ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "cc/ipc/mojo_compositor_frame_sink.mojom.h" -#include "cc/output/compositor_frame_sink.h" #include "cc/output/context_provider.h" +#include "cc/output/layer_tree_frame_sink.h" #include "cc/scheduler/begin_frame_source.h" #include "cc/surfaces/local_surface_id_allocator.h" #include "cc/surfaces/surface_id.h" @@ -19,12 +19,12 @@ class LocalSurfaceIdProvider; -class ClientCompositorFrameSink - : public cc::CompositorFrameSink, +class ClientLayerTreeFrameSink + : public cc::LayerTreeFrameSink, public cc::mojom::MojoCompositorFrameSinkClient, public cc::ExternalBeginFrameSourceClient { public: - ClientCompositorFrameSink( + ClientLayerTreeFrameSink( scoped_refptr<cc::ContextProvider> context_provider, scoped_refptr<cc::ContextProvider> worker_context_provider, gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, @@ -36,7 +36,7 @@ std::unique_ptr<LocalSurfaceIdProvider> local_surface_id_provider, bool enable_surface_synchronization); - ClientCompositorFrameSink( + ClientLayerTreeFrameSink( scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider, std::unique_ptr<cc::SyntheticBeginFrameSource> synthetic_begin_frame_source, @@ -45,12 +45,12 @@ std::unique_ptr<LocalSurfaceIdProvider> local_surface_id_provider, bool enable_surface_synchronization); - ~ClientCompositorFrameSink() override; + ~ClientLayerTreeFrameSink() override; - base::WeakPtr<ClientCompositorFrameSink> GetWeakPtr(); + base::WeakPtr<ClientLayerTreeFrameSink> GetWeakPtr(); - // cc::CompositorFrameSink implementation. - bool BindToClient(cc::CompositorFrameSinkClient* client) override; + // cc::LayerTreeFrameSink implementation. + bool BindToClient(cc::LayerTreeFrameSinkClient* client) override; void DetachFromClient() override; void SetLocalSurfaceId(const cc::LocalSurfaceId& local_surface_id) override; void SubmitCompositorFrame(cc::CompositorFrame frame) override; @@ -80,11 +80,11 @@ THREAD_CHECKER(thread_checker_); const bool enable_surface_synchronization_; - base::WeakPtrFactory<ClientCompositorFrameSink> weak_factory_; + base::WeakPtrFactory<ClientLayerTreeFrameSink> weak_factory_; - DISALLOW_COPY_AND_ASSIGN(ClientCompositorFrameSink); + DISALLOW_COPY_AND_ASSIGN(ClientLayerTreeFrameSink); }; } // namespace viz -#endif // COMPONENTS_VIZ_CLIENT_CLIENT_COMPOSITOR_FRAME_SINK_H_ +#endif // COMPONENTS_VIZ_CLIENT_CLIENT_LAYER_TREE_FRAME_SINK_H_
diff --git a/components/webdata/common/BUILD.gn b/components/webdata/common/BUILD.gn index 1fe0781..c107b5a 100644 --- a/components/webdata/common/BUILD.gn +++ b/components/webdata/common/BUILD.gn
@@ -58,6 +58,7 @@ "//components/test/data/web_database/version_69.sql", "//components/test/data/web_database/version_70.sql", "//components/test/data/web_database/version_71.sql", + "//components/test/data/web_database/version_72.sql", ] outputs = [ "{{bundle_resources_dir}}/" +
diff --git a/components/webdata/common/web_database.cc b/components/webdata/common/web_database.cc index 072f025..a58004c 100644 --- a/components/webdata/common/web_database.cc +++ b/components/webdata/common/web_database.cc
@@ -13,7 +13,7 @@ // corresponding changes must happen in the unit tests, and new migration test // added. See |WebDatabaseMigrationTest::kCurrentTestedVersionNumber|. // static -const int WebDatabase::kCurrentVersionNumber = 72; +const int WebDatabase::kCurrentVersionNumber = 73; const int WebDatabase::kDeprecatedVersionNumber = 51;
diff --git a/components/webdata/common/web_database_migration_unittest.cc b/components/webdata/common/web_database_migration_unittest.cc index 4417725..ac54bd8 100644 --- a/components/webdata/common/web_database_migration_unittest.cc +++ b/components/webdata/common/web_database_migration_unittest.cc
@@ -130,7 +130,7 @@ DISALLOW_COPY_AND_ASSIGN(WebDatabaseMigrationTest); }; -const int WebDatabaseMigrationTest::kCurrentTestedVersionNumber = 72; +const int WebDatabaseMigrationTest::kCurrentTestedVersionNumber = 73; void WebDatabaseMigrationTest::LoadDatabase( const base::FilePath::StringType& file) { @@ -1287,3 +1287,42 @@ EXPECT_EQ("VISA", s_cards_metadata.ColumnString(1)); } } + +// Tests addition of bank_name to masked_credit_cards +TEST_F(WebDatabaseMigrationTest, MigrateVersion72ToCurrent) { + ASSERT_NO_FATAL_FAILURE(LoadDatabase(FILE_PATH_LITERAL("version_72.sql"))); + + // Verify pre-conditions. + { + sql::Connection connection; + ASSERT_TRUE(connection.Open(GetDatabasePath())); + ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection)); + + sql::MetaTable meta_table; + ASSERT_TRUE(meta_table.Init(&connection, 72, 72)); + + EXPECT_FALSE( + connection.DoesColumnExist("masked_credit_cards", "bank_name")); + } + + DoMigration(); + + // Verify post-conditions. + { + sql::Connection connection; + ASSERT_TRUE(connection.Open(GetDatabasePath())); + ASSERT_TRUE(sql::MetaTable::DoesTableExist(&connection)); + + // Check version. + EXPECT_EQ(kCurrentTestedVersionNumber, VersionFromConnection(&connection)); + + // The bank_name column should exist. + EXPECT_TRUE(connection.DoesColumnExist("masked_credit_cards", "bank_name")); + + // Make sure that the default bank name value is empty. + sql::Statement s_masked_cards(connection.GetUniqueStatement( + "SELECT bank_name FROM masked_credit_cards")); + ASSERT_TRUE(s_masked_cards.Step()); + EXPECT_EQ("", s_masked_cards.ColumnString(0)); + } +}
diff --git a/content/browser/android/synchronous_compositor_browser_filter.cc b/content/browser/android/synchronous_compositor_browser_filter.cc index c04a4fb3..74c4dc12 100644 --- a/content/browser/android/synchronous_compositor_browser_filter.cc +++ b/content/browser/android/synchronous_compositor_browser_filter.cc
@@ -85,7 +85,7 @@ } auto frame_ptr = base::MakeUnique<SynchronousCompositor::Frame>(); - frame_ptr->compositor_frame_sink_id = std::get<0>(param); + frame_ptr->layer_tree_frame_sink_id = std::get<0>(param); base::Optional<cc::CompositorFrame>& compositor_frame = std::get<1>(param); if (compositor_frame) { BrowserThread::PostTask(
diff --git a/content/browser/android/synchronous_compositor_host.cc b/content/browser/android/synchronous_compositor_host.cc index 257a3a52..c99d24c8 100644 --- a/content/browser/android/synchronous_compositor_host.cc +++ b/content/browser/android/synchronous_compositor_host.cc
@@ -73,8 +73,8 @@ bool SynchronousCompositorHost::OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(SynchronousCompositorHost, message) - IPC_MESSAGE_HANDLER(SyncCompositorHostMsg_CompositorFrameSinkCreated, - CompositorFrameSinkCreated) + IPC_MESSAGE_HANDLER(SyncCompositorHostMsg_LayerTreeFrameSinkCreated, + LayerTreeFrameSinkCreated) IPC_MESSAGE_HANDLER(SyncCompositorHostMsg_UpdateState, ProcessCommonParams) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() @@ -119,7 +119,7 @@ SyncCompositorDemandDrawHwParams params(viewport_size, viewport_rect_for_tile_priority, transform_for_tile_priority); - uint32_t compositor_frame_sink_id; + uint32_t layer_tree_frame_sink_id; base::Optional<cc::CompositorFrame> compositor_frame; SyncCompositorCommonRendererParams common_renderer_params; @@ -127,7 +127,7 @@ base::ThreadRestrictions::ScopedAllowWait wait; if (!sender_->Send(new SyncCompositorMsg_DemandDrawHw( routing_id_, params, &common_renderer_params, - &compositor_frame_sink_id, &compositor_frame))) { + &layer_tree_frame_sink_id, &compositor_frame))) { return SynchronousCompositor::Frame(); } } @@ -139,7 +139,7 @@ SynchronousCompositor::Frame frame; frame.frame.reset(new cc::CompositorFrame); - frame.compositor_frame_sink_id = compositor_frame_sink_id; + frame.layer_tree_frame_sink_id = layer_tree_frame_sink_id; *frame.frame = std::move(*compositor_frame); UpdateFrameMetaData(frame.frame->metadata.Clone()); return frame; @@ -313,11 +313,11 @@ } void SynchronousCompositorHost::ReturnResources( - uint32_t compositor_frame_sink_id, + uint32_t layer_tree_frame_sink_id, const cc::ReturnedResourceArray& resources) { DCHECK(!resources.empty()); sender_->Send(new SyncCompositorMsg_ReclaimResources( - routing_id_, compositor_frame_sink_id, resources)); + routing_id_, layer_tree_frame_sink_id, resources)); } void SynchronousCompositorHost::SetMemoryPolicy(size_t bytes_limit) { @@ -378,8 +378,8 @@ filter->SyncStateAfterVSync(window_android, this); } -void SynchronousCompositorHost::CompositorFrameSinkCreated() { - // New CompositorFrameSink is not aware of state from Browser side. So need to +void SynchronousCompositorHost::LayerTreeFrameSinkCreated() { + // New LayerTreeFrameSink is not aware of state from Browser side. So need to // re-send all browser side state here. sender_->Send( new SyncCompositorMsg_SetMemoryPolicy(routing_id_, bytes_limit_));
diff --git a/content/browser/android/synchronous_compositor_host.h b/content/browser/android/synchronous_compositor_host.h index ec206c60..1ac04e5 100644 --- a/content/browser/android/synchronous_compositor_host.h +++ b/content/browser/android/synchronous_compositor_host.h
@@ -54,7 +54,7 @@ const gfx::Rect& viewport_rect_for_tile_priority, const gfx::Transform& transform_for_tile_priority) override; bool DemandDrawSw(SkCanvas* canvas) override; - void ReturnResources(uint32_t compositor_frame_sink_id, + void ReturnResources(uint32_t layer_tree_frame_sink_id, const cc::ReturnedResourceArray& resources) override; void SetMemoryPolicy(size_t bytes_limit) override; void DidChangeRootLayerScrollOffset( @@ -81,7 +81,7 @@ SynchronousCompositorHost(RenderWidgetHostViewAndroid* rwhva, bool use_in_proc_software_draw); - void CompositorFrameSinkCreated(); + void LayerTreeFrameSinkCreated(); bool DemandDrawSwInProc(SkCanvas* canvas); void SetSoftwareDrawSharedMemoryIfNeeded(size_t stride, size_t buffer_size); void SendZeroMemory();
diff --git a/content/browser/compositor/gpu_process_transport_factory.cc b/content/browser/compositor/gpu_process_transport_factory.cc index bef5b54..c7fbe80 100644 --- a/content/browser/compositor/gpu_process_transport_factory.cc +++ b/content/browser/compositor/gpu_process_transport_factory.cc
@@ -26,7 +26,7 @@ #include "cc/raster/task_graph_runner.h" #include "cc/scheduler/begin_frame_source.h" #include "cc/scheduler/delay_based_time_source.h" -#include "cc/surfaces/direct_compositor_frame_sink.h" +#include "cc/surfaces/direct_layer_tree_frame_sink.h" #include "cc/surfaces/display.h" #include "cc/surfaces/display_scheduler.h" #include "cc/surfaces/surface_manager.h" @@ -302,7 +302,7 @@ return validator; } -static bool ShouldCreateGpuCompositorFrameSink(ui::Compositor* compositor) { +static bool ShouldCreateGpuLayerTreeFrameSink(ui::Compositor* compositor) { #if defined(OS_CHROMEOS) // Software fallback does not happen on Chrome OS. return true; @@ -316,7 +316,7 @@ return GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor(); } -void GpuProcessTransportFactory::CreateCompositorFrameSink( +void GpuProcessTransportFactory::CreateLayerTreeFrameSink( base::WeakPtr<ui::Compositor> compositor) { DCHECK(!!compositor); PerCompositorData* data = per_compositor_data_[compositor.get()].get(); @@ -325,7 +325,7 @@ } else { // TODO(danakj): We can destroy the |data->display| and // |data->begin_frame_source| here when the compositor destroys its - // CompositorFrameSink before calling back here. + // LayerTreeFrameSink before calling back here. data->display_output_surface = nullptr; } @@ -336,7 +336,7 @@ const bool use_vulkan = static_cast<bool>(SharedVulkanContextProvider()); const bool create_gpu_output_surface = - ShouldCreateGpuCompositorFrameSink(compositor.get()); + ShouldCreateGpuLayerTreeFrameSink(compositor.get()); if (create_gpu_output_surface && !use_vulkan) { gpu::GpuChannelEstablishedCallback callback( base::Bind(&GpuProcessTransportFactory::EstablishedGpuChannel, @@ -618,21 +618,21 @@ // The |delegated_output_surface| is given back to the compositor, it // delegates to the Display as its root surface. Importantly, it shares the // same ContextProvider as the Display's output surface. - auto compositor_frame_sink = + auto layer_tree_frame_sink = vulkan_context_provider - ? base::MakeUnique<cc::DirectCompositorFrameSink>( + ? base::MakeUnique<cc::DirectLayerTreeFrameSink>( compositor->frame_sink_id(), GetSurfaceManager(), data->display.get(), static_cast<scoped_refptr<cc::VulkanContextProvider>>( vulkan_context_provider)) - : base::MakeUnique<cc::DirectCompositorFrameSink>( + : base::MakeUnique<cc::DirectLayerTreeFrameSink>( compositor->frame_sink_id(), GetSurfaceManager(), data->display.get(), context_provider, shared_worker_context_provider_, GetGpuMemoryBufferManager(), viz::HostSharedBitmapManager::current()); data->display->Resize(compositor->size()); data->display->SetOutputIsSecure(data->output_is_secure); - compositor->SetCompositorFrameSink(std::move(compositor_frame_sink)); + compositor->SetLayerTreeFrameSink(std::move(layer_tree_frame_sink)); } std::unique_ptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector(
diff --git a/content/browser/compositor/gpu_process_transport_factory.h b/content/browser/compositor/gpu_process_transport_factory.h index 2669561d..201240dc 100644 --- a/content/browser/compositor/gpu_process_transport_factory.h +++ b/content/browser/compositor/gpu_process_transport_factory.h
@@ -47,7 +47,7 @@ ~GpuProcessTransportFactory() override; // ui::ContextFactory implementation. - void CreateCompositorFrameSink( + void CreateLayerTreeFrameSink( base::WeakPtr<ui::Compositor> compositor) override; scoped_refptr<cc::ContextProvider> SharedMainThreadContextProvider() override; double GetRefreshRate() const override;
diff --git a/content/browser/presentation/presentation_service_impl.cc b/content/browser/presentation/presentation_service_impl.cc index b68f88a3..f8bf71e 100644 --- a/content/browser/presentation/presentation_service_impl.cc +++ b/content/browser/presentation/presentation_service_impl.cc
@@ -500,11 +500,6 @@ availability); } -void PresentationServiceImpl::ScreenAvailabilityListenerImpl -::OnScreenAvailabilityNotSupported() { - service_->client_->OnScreenAvailabilityNotSupported(availability_url_); -} - PresentationServiceImpl::NewPresentationCallbackWrapper:: NewPresentationCallbackWrapper(NewPresentationCallback callback) : callback_(std::move(callback)) {}
diff --git a/content/browser/presentation/presentation_service_impl.h b/content/browser/presentation/presentation_service_impl.h index 85f1f4bf..0ac6fc33 100644 --- a/content/browser/presentation/presentation_service_impl.h +++ b/content/browser/presentation/presentation_service_impl.h
@@ -127,7 +127,6 @@ GURL GetAvailabilityUrl() const override; void OnScreenAvailabilityChanged( blink::mojom::ScreenAvailability availability) override; - void OnScreenAvailabilityNotSupported() override; private: const GURL availability_url_;
diff --git a/content/browser/presentation/presentation_service_impl_unittest.cc b/content/browser/presentation/presentation_service_impl_unittest.cc index 659f2f6a..b20a62d 100644 --- a/content/browser/presentation/presentation_service_impl_unittest.cc +++ b/content/browser/presentation/presentation_service_impl_unittest.cc
@@ -76,8 +76,9 @@ int render_process_id, int routing_id, PresentationScreenAvailabilityListener* listener) override { - if (!screen_availability_listening_supported_) - listener->OnScreenAvailabilityNotSupported(); + if (!screen_availability_listening_supported_) { + listener->OnScreenAvailabilityChanged(ScreenAvailability::DISABLED); + } return AddScreenAvailabilityListener(); } @@ -212,7 +213,6 @@ void(const PresentationInfo& connection, PresentationConnectionCloseReason reason, const std::string& message)); - MOCK_METHOD1(OnScreenAvailabilityNotSupported, void(const GURL& url)); // PresentationConnectionMessage is move-only. void OnConnectionMessagesReceived( const PresentationInfo& presentation_info, @@ -345,7 +345,8 @@ TEST_F(PresentationServiceImplTest, ScreenAvailabilityNotSupported) { mock_delegate_.set_screen_availability_listening_supported(false); EXPECT_CALL(mock_client_, - OnScreenAvailabilityNotSupported(presentation_url1_)); + OnScreenAvailabilityUpdated(presentation_url1_, + ScreenAvailability::DISABLED)); ListenForScreenAvailabilityAndWait(presentation_url1_, false); base::RunLoop().RunUntilIdle(); }
diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc index 0a2276fb..1fe7626 100644 --- a/content/browser/renderer_host/compositor_impl_android.cc +++ b/content/browser/renderer_host/compositor_impl_android.cc
@@ -40,7 +40,7 @@ #include "cc/output/vulkan_in_process_context_provider.h" #include "cc/raster/single_thread_task_graph_runner.h" #include "cc/resources/ui_resource_manager.h" -#include "cc/surfaces/direct_compositor_frame_sink.h" +#include "cc/surfaces/direct_layer_tree_frame_sink.h" #include "cc/surfaces/display.h" #include "cc/surfaces/display_scheduler.h" #include "cc/surfaces/frame_sink_id_allocator.h" @@ -445,7 +445,7 @@ needs_animate_(false), pending_frames_(0U), num_successive_context_creation_failures_(0), - compositor_frame_sink_request_pending_(false), + layer_tree_frame_sink_request_pending_(false), weak_factory_(this) { GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_); DCHECK(client); @@ -516,7 +516,7 @@ if (window) { window_ = window; ANativeWindow_acquire(window); - // Register first, SetVisible() might create a CompositorFrameSink. + // Register first, SetVisible() might create a LayerTreeFrameSink. surface_handle_ = tracker->AddSurfaceForNativeWidget( gpu::GpuSurfaceTracker::SurfaceRecord(window, surface)); SetVisible(true); @@ -569,8 +569,8 @@ display_->ForceImmediateDrawAndSwapIfPossible(); host_->SetVisible(false); - host_->ReleaseCompositorFrameSink(); - has_compositor_frame_sink_ = false; + host_->ReleaseLayerTreeFrameSink(); + has_layer_tree_frame_sink_ = false; pending_frames_ = 0; if (display_) { GetSurfaceManager()->UnregisterBeginFrameSource( @@ -579,8 +579,8 @@ display_.reset(); } else { host_->SetVisible(true); - if (compositor_frame_sink_request_pending_) - HandlePendingCompositorFrameSinkRequest(); + if (layer_tree_frame_sink_request_pending_) + HandlePendingLayerTreeFrameSinkRequest(); } } @@ -631,31 +631,31 @@ } } -void CompositorImpl::RequestNewCompositorFrameSink() { - DCHECK(!compositor_frame_sink_request_pending_) - << "Output Surface Request is already pending?"; +void CompositorImpl::RequestNewLayerTreeFrameSink() { + DCHECK(!layer_tree_frame_sink_request_pending_) + << "LayerTreeFrameSink request is already pending?"; - compositor_frame_sink_request_pending_ = true; - HandlePendingCompositorFrameSinkRequest(); + layer_tree_frame_sink_request_pending_ = true; + HandlePendingLayerTreeFrameSinkRequest(); } -void CompositorImpl::DidInitializeCompositorFrameSink() { - compositor_frame_sink_request_pending_ = false; - has_compositor_frame_sink_ = true; +void CompositorImpl::DidInitializeLayerTreeFrameSink() { + layer_tree_frame_sink_request_pending_ = false; + has_layer_tree_frame_sink_ = true; for (auto& frame_sink_id : pending_child_frame_sink_ids_) AddChildFrameSink(frame_sink_id); pending_child_frame_sink_ids_.clear(); } -void CompositorImpl::DidFailToInitializeCompositorFrameSink() { +void CompositorImpl::DidFailToInitializeLayerTreeFrameSink() { // The context is bound/initialized before handing it to the - // CompositorFrameSink. + // LayerTreeFrameSink. NOTREACHED(); } -void CompositorImpl::HandlePendingCompositorFrameSinkRequest() { - DCHECK(compositor_frame_sink_request_pending_); +void CompositorImpl::HandlePendingLayerTreeFrameSinkRequest() { + DCHECK(layer_tree_frame_sink_request_pending_); // We might have been made invisible now. if (!host_->IsVisible()) @@ -719,13 +719,13 @@ establish_gpu_channel_timeout_.Stop(); // We might end up queing multiple GpuChannel requests for the same - // CompositorFrameSink request as the visibility of the compositor changes, so - // the CompositorFrameSink request could have been handled already. - if (!compositor_frame_sink_request_pending_) + // LayerTreeFrameSink request as the visibility of the compositor changes, so + // the LayerTreeFrameSink request could have been handled already. + if (!layer_tree_frame_sink_request_pending_) return; if (!gpu_channel_host) { - HandlePendingCompositorFrameSinkRequest(); + HandlePendingLayerTreeFrameSinkRequest(); return; } @@ -758,7 +758,7 @@ LOG(ERROR) << "Failed to init ContextProvider for compositor."; LOG_IF(FATAL, ++num_successive_context_creation_failures_ >= 2) << "Too many context creation failures. Giving up... "; - HandlePendingCompositorFrameSinkRequest(); + HandlePendingLayerTreeFrameSinkRequest(); return; } @@ -774,7 +774,7 @@ std::unique_ptr<cc::OutputSurface> display_output_surface, scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider, scoped_refptr<cc::ContextProvider> context_provider) { - DCHECK(compositor_frame_sink_request_pending_); + DCHECK(layer_tree_frame_sink_request_pending_); pending_frames_ = 0; num_successive_context_creation_failures_ = 0; @@ -800,12 +800,12 @@ frame_sink_id_, std::move(display_output_surface), std::move(scheduler), base::MakeUnique<cc::TextureMailboxDeleter>(task_runner))); - auto compositor_frame_sink = + auto layer_tree_frame_sink = vulkan_context_provider - ? base::MakeUnique<cc::DirectCompositorFrameSink>( + ? base::MakeUnique<cc::DirectLayerTreeFrameSink>( frame_sink_id_, manager, display_.get(), vulkan_context_provider) - : base::MakeUnique<cc::DirectCompositorFrameSink>( + : base::MakeUnique<cc::DirectLayerTreeFrameSink>( frame_sink_id_, manager, display_.get(), context_provider, nullptr, BrowserGpuMemoryBufferManager::current(), viz::HostSharedBitmapManager::current()); @@ -814,7 +814,7 @@ display_->Resize(size_); GetSurfaceManager()->RegisterBeginFrameSource( root_window_->GetBeginFrameSource(), frame_sink_id_); - host_->SetCompositorFrameSink(std::move(compositor_frame_sink)); + host_->SetLayerTreeFrameSink(std::move(layer_tree_frame_sink)); } void CompositorImpl::DidSwapBuffers() { @@ -848,9 +848,9 @@ client_->DidSwapFrame(pending_frames_); } -void CompositorImpl::DidLoseCompositorFrameSink() { - TRACE_EVENT0("compositor", "CompositorImpl::DidLoseCompositorFrameSink"); - has_compositor_frame_sink_ = false; +void CompositorImpl::DidLoseLayerTreeFrameSink() { + TRACE_EVENT0("compositor", "CompositorImpl::DidLoseLayerTreeFrameSink"); + has_layer_tree_frame_sink_ = false; client_->DidSwapFrame(0); } @@ -881,7 +881,7 @@ } void CompositorImpl::AddChildFrameSink(const cc::FrameSinkId& frame_sink_id) { - if (has_compositor_frame_sink_) { + if (has_layer_tree_frame_sink_) { GetSurfaceManager()->RegisterFrameSinkHierarchy(frame_sink_id_, frame_sink_id); } else {
diff --git a/content/browser/renderer_host/compositor_impl_android.h b/content/browser/renderer_host/compositor_impl_android.h index 2488823..f4c897a2 100644 --- a/content/browser/renderer_host/compositor_impl_android.h +++ b/content/browser/renderer_host/compositor_impl_android.h
@@ -97,9 +97,9 @@ float top_controls_delta) override {} void RecordWheelAndTouchScrollingCount(bool has_scrolled_by_wheel, bool has_scrolled_by_touch) override {} - void RequestNewCompositorFrameSink() override; - void DidInitializeCompositorFrameSink() override; - void DidFailToInitializeCompositorFrameSink() override; + void RequestNewLayerTreeFrameSink() override; + void DidInitializeLayerTreeFrameSink() override; + void DidFailToInitializeLayerTreeFrameSink() override; void WillCommit() override {} void DidCommit() override; void DidCommitAndDrawFrame() override {} @@ -109,7 +109,7 @@ // LayerTreeHostSingleThreadClient implementation. void DidSubmitCompositorFrame() override; - void DidLoseCompositorFrameSink() override; + void DidLoseLayerTreeFrameSink() override; // WindowAndroidCompositor implementation. void AttachLayerForReadback(scoped_refptr<cc::Layer> layer) override; @@ -123,7 +123,7 @@ void SetVisible(bool visible); void CreateLayerTreeHost(); - void HandlePendingCompositorFrameSinkRequest(); + void HandlePendingLayerTreeFrameSinkRequest(); #if BUILDFLAG(ENABLE_VULKAN) void CreateVulkanOutputSurface(); @@ -177,14 +177,14 @@ base::OneShotTimer establish_gpu_channel_timeout_; - // Whether there is an CompositorFrameSink request pending from the current - // |host_|. Becomes |true| if RequestNewCompositorFrameSink is called, and + // Whether there is a LayerTreeFrameSink request pending from the current + // |host_|. Becomes |true| if RequestNewLayerTreeFrameSink is called, and // |false| if |host_| is deleted or we succeed in creating *and* initializing - // a CompositorFrameSink (which is essentially the contract with cc). - bool compositor_frame_sink_request_pending_; + // a LayerTreeFrameSink (which is essentially the contract with cc). + bool layer_tree_frame_sink_request_pending_; gpu::Capabilities gpu_capabilities_; - bool has_compositor_frame_sink_ = false; + bool has_layer_tree_frame_sink_ = false; std::unordered_set<cc::FrameSinkId, cc::FrameSinkIdHash> pending_child_frame_sink_ids_; base::WeakPtrFactory<CompositorImpl> weak_factory_;
diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc index e4b3872a..bee86223 100644 --- a/content/browser/site_per_process_browsertest.cc +++ b/content/browser/site_per_process_browsertest.cc
@@ -9668,8 +9668,8 @@ // the fullscreen feature. Since there are no HTTP header policies involved, // this verifies the presence of the container policy in the iframe. // https://crbug.com/703703 -// TODO(lunalu): Currently feature policy is shipped without fullscreen (e.g., -// the implementation of allowfullscreen does not use feature policy +// TODO(loonybear): Currently feature policy is shipped without fullscreen +// (e.g., the implementation of allowfullscreen does not use feature policy // information). Once allowfullscreen is controlled by feature policy, re-enable // this test. IN_PROC_BROWSER_TEST_F(SitePerProcessFeaturePolicyBrowserTest,
diff --git a/content/common/android/sync_compositor_messages.h b/content/common/android/sync_compositor_messages.h index 4283fe0b..d370ed4 100644 --- a/content/common/android/sync_compositor_messages.h +++ b/content/common/android/sync_compositor_messages.h
@@ -131,7 +131,7 @@ IPC_SYNC_MESSAGE_ROUTED1_3(SyncCompositorMsg_DemandDrawHw, content::SyncCompositorDemandDrawHwParams, content::SyncCompositorCommonRendererParams, - uint32_t /* compositor_frame_sink_id */, + uint32_t /* layer_tree_frame_sink_id */, base::Optional<cc::CompositorFrame>); IPC_SYNC_MESSAGE_ROUTED1_2(SyncCompositorMsg_SetSharedMemory, @@ -155,7 +155,7 @@ uint32_t /* bytes_limit */); IPC_MESSAGE_ROUTED2(SyncCompositorMsg_ReclaimResources, - uint32_t /* compositor_frame_sink_id */, + uint32_t /* layer_tree_frame_sink_id */, cc::ReturnedResourceArray /* resources */); IPC_MESSAGE_ROUTED1(SyncCompositorMsg_SetScroll, gfx::ScrollOffset); @@ -163,11 +163,11 @@ // ----------------------------------------------------------------------------- // Messages sent from the renderer to the browser. -IPC_MESSAGE_ROUTED0(SyncCompositorHostMsg_CompositorFrameSinkCreated); +IPC_MESSAGE_ROUTED0(SyncCompositorHostMsg_LayerTreeFrameSinkCreated); IPC_MESSAGE_ROUTED1(SyncCompositorHostMsg_UpdateState, content::SyncCompositorCommonRendererParams) IPC_MESSAGE_ROUTED2(SyncCompositorHostMsg_ReturnFrame, - uint32_t /* compositor_frame_sink_id */, + uint32_t /* layer_tree_frame_sink_id */, base::Optional<cc::CompositorFrame>);
diff --git a/content/public/browser/android/synchronous_compositor.cc b/content/public/browser/android/synchronous_compositor.cc index f1fdfee..76c820d5 100644 --- a/content/public/browser/android/synchronous_compositor.cc +++ b/content/public/browser/android/synchronous_compositor.cc
@@ -11,12 +11,12 @@ namespace content { -SynchronousCompositor::Frame::Frame() : compositor_frame_sink_id(0u) {} +SynchronousCompositor::Frame::Frame() : layer_tree_frame_sink_id(0u) {} SynchronousCompositor::Frame::~Frame() {} SynchronousCompositor::Frame::Frame(Frame&& rhs) - : compositor_frame_sink_id(rhs.compositor_frame_sink_id), + : layer_tree_frame_sink_id(rhs.layer_tree_frame_sink_id), frame(std::move(rhs.frame)) {} SynchronousCompositor::FrameFuture::FrameFuture() @@ -44,7 +44,7 @@ SynchronousCompositor::Frame& SynchronousCompositor::Frame::operator=( Frame&& rhs) { - compositor_frame_sink_id = rhs.compositor_frame_sink_id; + layer_tree_frame_sink_id = rhs.layer_tree_frame_sink_id; frame = std::move(rhs.frame); return *this; }
diff --git a/content/public/browser/android/synchronous_compositor.h b/content/public/browser/android/synchronous_compositor.h index 9a133589..c9de9136 100644 --- a/content/public/browser/android/synchronous_compositor.h +++ b/content/public/browser/android/synchronous_compositor.h
@@ -52,7 +52,7 @@ Frame(Frame&& rhs); Frame& operator=(Frame&& rhs); - uint32_t compositor_frame_sink_id; + uint32_t layer_tree_frame_sink_id; std::unique_ptr<cc::CompositorFrame> frame; private: @@ -93,7 +93,7 @@ // For delegated rendering, return resources from parent compositor to this. // Note that all resources must be returned before ReleaseHwDraw. - virtual void ReturnResources(uint32_t compositor_frame_sink_id, + virtual void ReturnResources(uint32_t layer_tree_frame_sink_id, const cc::ReturnedResourceArray& resources) = 0; // "On demand" SW draw, into the supplied canvas (observing the transform
diff --git a/content/public/browser/presentation_screen_availability_listener.h b/content/public/browser/presentation_screen_availability_listener.h index e37ddef..ef27d766 100644 --- a/content/public/browser/presentation_screen_availability_listener.h +++ b/content/public/browser/presentation_screen_availability_listener.h
@@ -29,11 +29,6 @@ // changed to |availability|. virtual void OnScreenAvailabilityChanged( blink::mojom::ScreenAvailability availability) = 0; - - // Called when screen availability monitoring is not supported by the - // implementation because of system limitations like running low on battery or - // having resource constraints. - virtual void OnScreenAvailabilityNotSupported() = 0; }; } // namespace content
diff --git a/content/public/test/test_synchronous_compositor_android.cc b/content/public/test/test_synchronous_compositor_android.cc index 4f33490..c368865c 100644 --- a/content/public/test/test_synchronous_compositor_android.cc +++ b/content/public/test/test_synchronous_compositor_android.cc
@@ -42,10 +42,10 @@ } void TestSynchronousCompositor::ReturnResources( - uint32_t compositor_frame_sink_id, + uint32_t layer_tree_frame_sink_id, const cc::ReturnedResourceArray& resources) { ReturnedResources returned_resources; - returned_resources.compositor_frame_sink_id = compositor_frame_sink_id; + returned_resources.layer_tree_frame_sink_id = layer_tree_frame_sink_id; returned_resources.resources = resources; frame_ack_array_.push_back(returned_resources); } @@ -61,14 +61,14 @@ } void TestSynchronousCompositor::SetHardwareFrame( - uint32_t compositor_frame_sink_id, + uint32_t layer_tree_frame_sink_id, std::unique_ptr<cc::CompositorFrame> frame) { - hardware_frame_.compositor_frame_sink_id = compositor_frame_sink_id; + hardware_frame_.layer_tree_frame_sink_id = layer_tree_frame_sink_id; hardware_frame_.frame = std::move(frame); } TestSynchronousCompositor::ReturnedResources::ReturnedResources() - : compositor_frame_sink_id(0u) {} + : layer_tree_frame_sink_id(0u) {} TestSynchronousCompositor::ReturnedResources::ReturnedResources( const ReturnedResources& other) = default;
diff --git a/content/public/test/test_synchronous_compositor_android.h b/content/public/test/test_synchronous_compositor_android.h index 7e24dcb..8bc14bbd 100644 --- a/content/public/test/test_synchronous_compositor_android.h +++ b/content/public/test/test_synchronous_compositor_android.h
@@ -32,7 +32,7 @@ const gfx::Size& viewport_size, const gfx::Rect& viewport_rect_for_tile_priority, const gfx::Transform& transform_for_tile_priority) override; - void ReturnResources(uint32_t compositor_frame_sink_id, + void ReturnResources(uint32_t layer_tree_frame_sink_id, const cc::ReturnedResourceArray& resources) override; bool DemandDrawSw(SkCanvas* canvas) override; void SetMemoryPolicy(size_t bytes_limit) override {} @@ -42,7 +42,7 @@ const gfx::Point& anchor) override {} void OnComputeScroll(base::TimeTicks animate_time) override {} - void SetHardwareFrame(uint32_t compositor_frame_sink_id, + void SetHardwareFrame(uint32_t layer_tree_frame_sink_id, std::unique_ptr<cc::CompositorFrame> frame); struct ReturnedResources { @@ -50,7 +50,7 @@ ReturnedResources(const ReturnedResources& other); ~ReturnedResources(); - uint32_t compositor_frame_sink_id; + uint32_t layer_tree_frame_sink_id; cc::ReturnedResourceArray resources; }; using FrameAckArray = std::vector<ReturnedResources>;
diff --git a/content/renderer/BUILD.gn b/content/renderer/BUILD.gn index faf32e5f..3d5b36b53 100644 --- a/content/renderer/BUILD.gn +++ b/content/renderer/BUILD.gn
@@ -41,11 +41,11 @@ "android/renderer_date_time_picker.h", "android/synchronous_compositor_filter.cc", "android/synchronous_compositor_filter.h", - "android/synchronous_compositor_frame_sink.cc", - "android/synchronous_compositor_frame_sink.h", "android/synchronous_compositor_proxy.cc", "android/synchronous_compositor_proxy.h", "android/synchronous_compositor_registry.h", + "android/synchronous_layer_tree_frame_sink.cc", + "android/synchronous_layer_tree_frame_sink.h", "browser_plugin/browser_plugin.cc", "browser_plugin/browser_plugin.h", "browser_plugin/browser_plugin_manager.cc",
diff --git a/content/renderer/android/synchronous_compositor_filter.cc b/content/renderer/android/synchronous_compositor_filter.cc index 98ede7b..d045e9c 100644 --- a/content/renderer/android/synchronous_compositor_filter.cc +++ b/content/renderer/android/synchronous_compositor_filter.cc
@@ -132,27 +132,27 @@ DCHECK(entry_pair.second); int routing_id = entry_pair.first; CreateSynchronousCompositorProxy(routing_id, entry_pair.second); - auto compositor_frame_sink_entry = - compositor_frame_sink_map_.find(routing_id); - if (compositor_frame_sink_entry != compositor_frame_sink_map_.end()) { - SetProxyCompositorFrameSink(routing_id, - compositor_frame_sink_entry->second); + auto layer_tree_frame_sink_entry = + layer_tree_frame_sink_map_.find(routing_id); + if (layer_tree_frame_sink_entry != layer_tree_frame_sink_map_.end()) { + SetProxyLayerTreeFrameSink(routing_id, + layer_tree_frame_sink_entry->second); } } } -void SynchronousCompositorFilter::RegisterCompositorFrameSink( +void SynchronousCompositorFilter::RegisterLayerTreeFrameSink( int routing_id, - SynchronousCompositorFrameSink* compositor_frame_sink) { + SynchronousLayerTreeFrameSink* layer_tree_frame_sink) { DCHECK(compositor_task_runner_->BelongsToCurrentThread()); - DCHECK(compositor_frame_sink); + DCHECK(layer_tree_frame_sink); SynchronousCompositorProxy* proxy = FindProxy(routing_id); if (proxy) { - proxy->SetCompositorFrameSink(compositor_frame_sink); + proxy->SetLayerTreeFrameSink(layer_tree_frame_sink); } else { - DCHECK(compositor_frame_sink_map_.find(routing_id) == - compositor_frame_sink_map_.end()); - compositor_frame_sink_map_[routing_id] = compositor_frame_sink; + DCHECK(layer_tree_frame_sink_map_.find(routing_id) == + layer_tree_frame_sink_map_.end()); + layer_tree_frame_sink_map_[routing_id] = layer_tree_frame_sink; } } @@ -168,18 +168,18 @@ } } -void SynchronousCompositorFilter::UnregisterCompositorFrameSink( +void SynchronousCompositorFilter::UnregisterLayerTreeFrameSink( int routing_id, - SynchronousCompositorFrameSink* compositor_frame_sink) { + SynchronousLayerTreeFrameSink* layer_tree_frame_sink) { DCHECK(compositor_task_runner_->BelongsToCurrentThread()); - DCHECK(compositor_frame_sink); + DCHECK(layer_tree_frame_sink); SynchronousCompositorProxy* proxy = FindProxy(routing_id); if (proxy) { - proxy->SetCompositorFrameSink(nullptr); + proxy->SetLayerTreeFrameSink(nullptr); } - auto entry = compositor_frame_sink_map_.find(routing_id); - if (entry != compositor_frame_sink_map_.end()) - compositor_frame_sink_map_.erase(entry); + auto entry = layer_tree_frame_sink_map_.find(routing_id); + if (entry != layer_tree_frame_sink_map_.end()) + layer_tree_frame_sink_map_.erase(entry); } void SynchronousCompositorFilter::CreateSynchronousCompositorProxy( @@ -192,13 +192,13 @@ sync_compositor_map_[routing_id] = std::move(proxy); } -void SynchronousCompositorFilter::SetProxyCompositorFrameSink( +void SynchronousCompositorFilter::SetProxyLayerTreeFrameSink( int routing_id, - SynchronousCompositorFrameSink* compositor_frame_sink) { - DCHECK(compositor_frame_sink); + SynchronousLayerTreeFrameSink* layer_tree_frame_sink) { + DCHECK(layer_tree_frame_sink); SynchronousCompositorProxy* proxy = FindProxy(routing_id); DCHECK(proxy); - proxy->SetCompositorFrameSink(compositor_frame_sink); + proxy->SetLayerTreeFrameSink(layer_tree_frame_sink); } void SynchronousCompositorFilter::DidAddSynchronousHandlerProxy( @@ -209,9 +209,9 @@ if (filter_ready_) { CreateSynchronousCompositorProxy(routing_id, synchronous_input_handler_proxy); - auto entry = compositor_frame_sink_map_.find(routing_id); - if (entry != compositor_frame_sink_map_.end()) - SetProxyCompositorFrameSink(routing_id, entry->second); + auto entry = layer_tree_frame_sink_map_.find(routing_id); + if (entry != layer_tree_frame_sink_map_.end()) + SetProxyLayerTreeFrameSink(routing_id, entry->second); } else { auto*& mapped_synchronous_input_handler_proxy = synchronous_input_handler_proxy_map_[routing_id];
diff --git a/content/renderer/android/synchronous_compositor_filter.h b/content/renderer/android/synchronous_compositor_filter.h index 1e973bdd8..57a2a6d 100644 --- a/content/renderer/android/synchronous_compositor_filter.h +++ b/content/renderer/android/synchronous_compositor_filter.h
@@ -48,12 +48,12 @@ bool Send(IPC::Message* message) override; // SynchronousCompositorRegistry overrides. - void RegisterCompositorFrameSink( + void RegisterLayerTreeFrameSink( int routing_id, - SynchronousCompositorFrameSink* compositor_frame_sink) override; - void UnregisterCompositorFrameSink( + SynchronousLayerTreeFrameSink* layer_tree_frame_sink) override; + void UnregisterLayerTreeFrameSink( int routing_id, - SynchronousCompositorFrameSink* compositor_frame_sink) override; + SynchronousLayerTreeFrameSink* layer_tree_frame_sink) override; // SynchronousInputHandlerProxyClient overrides. void DidAddSynchronousHandlerProxy( @@ -74,9 +74,9 @@ void CreateSynchronousCompositorProxy( int routing_id, ui::SynchronousInputHandlerProxy* synchronous_input_handler_proxy); - void SetProxyCompositorFrameSink( + void SetProxyLayerTreeFrameSink( int routing_id, - SynchronousCompositorFrameSink* compositor_frame_sink); + SynchronousLayerTreeFrameSink* layer_tree_frame_sink); void UnregisterObjects(int routing_id); void RemoveEntryIfNeeded(int routing_id); SynchronousCompositorProxy* FindProxy(int routing_id); @@ -99,14 +99,14 @@ bool filter_ready_; using SynchronousInputHandlerProxyMap = base::hash_map<int, ui::SynchronousInputHandlerProxy*>; - using CompositorFrameSinkMap = - base::hash_map<int, SynchronousCompositorFrameSink*>; + using LayerTreeFrameSinkMap = + base::hash_map<int, SynchronousLayerTreeFrameSink*>; // This is only used before FilterReadyOnCompositorThread. SynchronousInputHandlerProxyMap synchronous_input_handler_proxy_map_; // This is only used if input_handler_proxy has not been registered. - CompositorFrameSinkMap compositor_frame_sink_map_; + LayerTreeFrameSinkMap layer_tree_frame_sink_map_; DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorFilter); };
diff --git a/content/renderer/android/synchronous_compositor_proxy.cc b/content/renderer/android/synchronous_compositor_proxy.cc index 8f5bcd4..091ec0f 100644 --- a/content/renderer/android/synchronous_compositor_proxy.cc +++ b/content/renderer/android/synchronous_compositor_proxy.cc
@@ -31,7 +31,7 @@ use_in_process_zero_copy_software_draw_( base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kSingleProcess)), - compositor_frame_sink_(nullptr), + layer_tree_frame_sink_(nullptr), inside_receive_(false), hardware_draw_reply_(nullptr), software_draw_reply_(nullptr), @@ -48,21 +48,21 @@ } SynchronousCompositorProxy::~SynchronousCompositorProxy() { - // The CompositorFrameSink is destroyed/removed by the compositor before + // The LayerTreeFrameSink is destroyed/removed by the compositor before // shutting down everything. - DCHECK_EQ(compositor_frame_sink_, nullptr); + DCHECK_EQ(layer_tree_frame_sink_, nullptr); input_handler_proxy_->SetOnlySynchronouslyAnimateRootFlings(nullptr); } -void SynchronousCompositorProxy::SetCompositorFrameSink( - SynchronousCompositorFrameSink* compositor_frame_sink) { - DCHECK_NE(compositor_frame_sink_, compositor_frame_sink); - if (compositor_frame_sink_) { - compositor_frame_sink_->SetSyncClient(nullptr); +void SynchronousCompositorProxy::SetLayerTreeFrameSink( + SynchronousLayerTreeFrameSink* layer_tree_frame_sink) { + DCHECK_NE(layer_tree_frame_sink_, layer_tree_frame_sink); + if (layer_tree_frame_sink_) { + layer_tree_frame_sink_->SetSyncClient(nullptr); } - compositor_frame_sink_ = compositor_frame_sink; - if (compositor_frame_sink_) { - compositor_frame_sink_->SetSyncClient(this); + layer_tree_frame_sink_ = layer_tree_frame_sink; + if (layer_tree_frame_sink_) { + layer_tree_frame_sink_->SetSyncClient(this); } } @@ -129,8 +129,8 @@ void SynchronousCompositorProxy::OnMessageReceived( const IPC::Message& message) { - if (compositor_frame_sink_ && - compositor_frame_sink_->OnMessageReceived(message)) + if (layer_tree_frame_sink_ && + layer_tree_frame_sink_->OnMessageReceived(message)) return; IPC_BEGIN_MESSAGE_MAP(SynchronousCompositorProxy, message) @@ -169,17 +169,17 @@ DCHECK(!inside_receive_); inside_receive_ = true; - if (compositor_frame_sink_) { + if (layer_tree_frame_sink_) { if (!reply_message) { base::AutoReset<bool> scoped_hardware_draw_reply_async( &hardware_draw_reply_async_, true); - compositor_frame_sink_->DemandDrawHw( + layer_tree_frame_sink_->DemandDrawHw( params.viewport_size, params.viewport_rect_for_tile_priority, params.transform_for_tile_priority); } else { base::AutoReset<IPC::Message*> scoped_hardware_draw_reply( &hardware_draw_reply_, reply_message); - compositor_frame_sink_->DemandDrawHw( + layer_tree_frame_sink_->DemandDrawHw( params.viewport_size, params.viewport_rect_for_tile_priority, params.transform_for_tile_priority); } @@ -197,39 +197,39 @@ } void SynchronousCompositorProxy::SubmitCompositorFrameHwAsync( - uint32_t compositor_frame_sink_id, + uint32_t layer_tree_frame_sink_id, cc::CompositorFrame frame) { DCHECK(inside_receive_); DCHECK(hardware_draw_reply_async_); - SendDemandDrawHwReplyAsync(std::move(frame), compositor_frame_sink_id); + SendDemandDrawHwReplyAsync(std::move(frame), layer_tree_frame_sink_id); inside_receive_ = false; } void SynchronousCompositorProxy::SubmitCompositorFrameHw( - uint32_t compositor_frame_sink_id, + uint32_t layer_tree_frame_sink_id, cc::CompositorFrame frame) { DCHECK(inside_receive_); DCHECK(hardware_draw_reply_); - SendDemandDrawHwReply(std::move(frame), compositor_frame_sink_id, + SendDemandDrawHwReply(std::move(frame), layer_tree_frame_sink_id, hardware_draw_reply_); inside_receive_ = false; } void SynchronousCompositorProxy::SendDemandDrawHwReplyAsync( base::Optional<cc::CompositorFrame> frame, - uint32_t compositor_frame_sink_id) { + uint32_t layer_tree_frame_sink_id) { Send(new SyncCompositorHostMsg_ReturnFrame(routing_id_, - compositor_frame_sink_id, frame)); + layer_tree_frame_sink_id, frame)); } void SynchronousCompositorProxy::SendDemandDrawHwReply( base::Optional<cc::CompositorFrame> frame, - uint32_t compositor_frame_sink_id, + uint32_t layer_tree_frame_sink_id, IPC::Message* reply_message) { SyncCompositorCommonRendererParams common_renderer_params; PopulateCommonParams(&common_renderer_params); SyncCompositorMsg_DemandDrawHw::WriteReplyParams( - reply_message, common_renderer_params, compositor_frame_sink_id, frame); + reply_message, common_renderer_params, layer_tree_frame_sink_id, frame); Send(reply_message); } @@ -264,7 +264,7 @@ void SynchronousCompositorProxy::ZeroSharedMemory() { // It is possible for this to get called twice, eg. if draw is called before - // the CompositorFrameSink is ready. Just ignore duplicated calls rather than + // the LayerTreeFrameSink is ready. Just ignore duplicated calls rather than // inventing a complicated system to avoid it. if (software_draw_shm_->zeroed) return; @@ -278,13 +278,13 @@ IPC::Message* reply_message) { DCHECK(!inside_receive_); inside_receive_ = true; - if (compositor_frame_sink_) { + if (layer_tree_frame_sink_) { base::AutoReset<IPC::Message*> scoped_software_draw_reply( &software_draw_reply_, reply_message); SkCanvas* sk_canvas_for_draw = SynchronousCompositorGetSkCanvas(); if (use_in_process_zero_copy_software_draw_) { DCHECK(sk_canvas_for_draw); - compositor_frame_sink_->DemandDrawSw(sk_canvas_for_draw); + layer_tree_frame_sink_->DemandDrawSw(sk_canvas_for_draw); } else { DCHECK(!sk_canvas_for_draw); DoDemandDrawSw(params); @@ -299,7 +299,7 @@ void SynchronousCompositorProxy::DoDemandDrawSw( const SyncCompositorDemandDrawSwParams& params) { - DCHECK(compositor_frame_sink_); + DCHECK(layer_tree_frame_sink_); DCHECK(software_draw_shm_->zeroed); software_draw_shm_->zeroed = false; @@ -316,7 +316,7 @@ canvas.clipRect(gfx::RectToSkRect(params.clip)); canvas.concat(params.transform.matrix()); - compositor_frame_sink_->DemandDrawSw(&canvas); + layer_tree_frame_sink_->DemandDrawSw(&canvas); } void SynchronousCompositorProxy::SubmitCompositorFrameSw( @@ -338,7 +338,7 @@ } void SynchronousCompositorProxy::SubmitCompositorFrame( - uint32_t compositor_frame_sink_id, + uint32_t layer_tree_frame_sink_id, cc::CompositorFrame frame) { // Verify that exactly one of these is true. DCHECK(hardware_draw_reply_async_ || hardware_draw_reply_ || @@ -347,9 +347,9 @@ (hardware_draw_reply_ && hardware_draw_reply_async_) || (software_draw_reply_ && hardware_draw_reply_async_))); if (hardware_draw_reply_async_) { - SubmitCompositorFrameHwAsync(compositor_frame_sink_id, std::move(frame)); + SubmitCompositorFrameHwAsync(layer_tree_frame_sink_id, std::move(frame)); } else if (hardware_draw_reply_) { - SubmitCompositorFrameHw(compositor_frame_sink_id, std::move(frame)); + SubmitCompositorFrameHw(layer_tree_frame_sink_id, std::move(frame)); } else if (software_draw_reply_) { SubmitCompositorFrameSw(std::move(frame)); }
diff --git a/content/renderer/android/synchronous_compositor_proxy.h b/content/renderer/android/synchronous_compositor_proxy.h index cc09074..2036a5af 100644 --- a/content/renderer/android/synchronous_compositor_proxy.h +++ b/content/renderer/android/synchronous_compositor_proxy.h
@@ -11,7 +11,7 @@ #include "base/macros.h" #include "base/optional.h" #include "content/common/input/input_event_ack_state.h" -#include "content/renderer/android/synchronous_compositor_frame_sink.h" +#include "content/renderer/android/synchronous_layer_tree_frame_sink.h" #include "ui/events/blink/synchronous_input_handler_proxy.h" #include "ui/gfx/geometry/scroll_offset.h" #include "ui/gfx/geometry/size_f.h" @@ -27,14 +27,14 @@ namespace content { -class SynchronousCompositorFrameSink; +class SynchronousLayerTreeFrameSink; struct SyncCompositorCommonRendererParams; struct SyncCompositorDemandDrawHwParams; struct SyncCompositorDemandDrawSwParams; struct SyncCompositorSetSharedMemoryParams; class SynchronousCompositorProxy : public ui::SynchronousInputHandler, - public SynchronousCompositorFrameSinkClient { + public SynchronousLayerTreeFrameSinkClient { public: SynchronousCompositorProxy( int routing_id, @@ -51,14 +51,14 @@ float min_page_scale_factor, float max_page_scale_factor) override; - // SynchronousCompositorFrameSinkClient overrides. + // SynchronousLayerTreeFrameSinkClient overrides. void DidActivatePendingTree() override; void Invalidate() override; - void SubmitCompositorFrame(uint32_t compositor_frame_sink_id, + void SubmitCompositorFrame(uint32_t layer_tree_frame_sink_id, cc::CompositorFrame frame) override; - void SetCompositorFrameSink( - SynchronousCompositorFrameSink* compositor_frame_sink); + void SetLayerTreeFrameSink( + SynchronousLayerTreeFrameSink* layer_tree_frame_sink); void OnMessageReceived(const IPC::Message& message); bool Send(IPC::Message* message); void PopulateCommonParams(SyncCompositorCommonRendererParams* params) const; @@ -84,15 +84,15 @@ SyncCompositorCommonRendererParams* common_renderer_params); void SetScroll(const gfx::ScrollOffset& total_scroll_offset); - void SubmitCompositorFrameHwAsync(uint32_t compositor_frame_sink_id, + void SubmitCompositorFrameHwAsync(uint32_t layer_tree_frame_sink_id, cc::CompositorFrame frame); - void SubmitCompositorFrameHw(uint32_t compositor_frame_sink_id, + void SubmitCompositorFrameHw(uint32_t layer_tree_frame_sink_id, cc::CompositorFrame frame); void SendDemandDrawHwReply(base::Optional<cc::CompositorFrame> frame, - uint32_t compositor_frame_sink_id, + uint32_t layer_tree_frame_sink_id, IPC::Message* reply_message); void SendDemandDrawHwReplyAsync(base::Optional<cc::CompositorFrame> frame, - uint32_t compositor_frame_sink_id); + uint32_t layer_tree_frame_sink_id); void DoDemandDrawSw(const SyncCompositorDemandDrawSwParams& params); void SubmitCompositorFrameSw(cc::CompositorFrame frame); void SendDemandDrawSwReply( @@ -106,7 +106,7 @@ IPC::Sender* const sender_; ui::SynchronousInputHandlerProxy* const input_handler_proxy_; const bool use_in_process_zero_copy_software_draw_; - SynchronousCompositorFrameSink* compositor_frame_sink_; + SynchronousLayerTreeFrameSink* layer_tree_frame_sink_; bool inside_receive_; IPC::Message* hardware_draw_reply_; IPC::Message* software_draw_reply_;
diff --git a/content/renderer/android/synchronous_compositor_registry.h b/content/renderer/android/synchronous_compositor_registry.h index 52995bc..588343c 100644 --- a/content/renderer/android/synchronous_compositor_registry.h +++ b/content/renderer/android/synchronous_compositor_registry.h
@@ -7,16 +7,16 @@ namespace content { -class SynchronousCompositorFrameSink; +class SynchronousLayerTreeFrameSink; class SynchronousCompositorRegistry { public: - virtual void RegisterCompositorFrameSink( + virtual void RegisterLayerTreeFrameSink( int routing_id, - SynchronousCompositorFrameSink* compositor_frame_sink) = 0; - virtual void UnregisterCompositorFrameSink( + SynchronousLayerTreeFrameSink* layer_tree_frame_sink) = 0; + virtual void UnregisterLayerTreeFrameSink( int routing_id, - SynchronousCompositorFrameSink* compositor_frame_sink) = 0; + SynchronousLayerTreeFrameSink* layer_tree_frame_sink) = 0; protected: virtual ~SynchronousCompositorRegistry() {}
diff --git a/content/renderer/android/synchronous_compositor_frame_sink.cc b/content/renderer/android/synchronous_layer_tree_frame_sink.cc similarity index 85% rename from content/renderer/android/synchronous_compositor_frame_sink.cc rename to content/renderer/android/synchronous_layer_tree_frame_sink.cc index 18fc97375..2237321 100644 --- a/content/renderer/android/synchronous_compositor_frame_sink.cc +++ b/content/renderer/android/synchronous_layer_tree_frame_sink.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/renderer/android/synchronous_compositor_frame_sink.h" +#include "content/renderer/android/synchronous_layer_tree_frame_sink.h" #include <vector> @@ -14,8 +14,8 @@ #include "base/single_thread_task_runner.h" #include "base/threading/thread_task_runner_handle.h" #include "cc/output/compositor_frame.h" -#include "cc/output/compositor_frame_sink_client.h" #include "cc/output/context_provider.h" +#include "cc/output/layer_tree_frame_sink_client.h" #include "cc/output/output_surface.h" #include "cc/output/output_surface_frame.h" #include "cc/output/renderer_settings.h" @@ -76,7 +76,7 @@ } // namespace -class SynchronousCompositorFrameSink::SoftwareOutputSurface +class SynchronousLayerTreeFrameSink::SoftwareOutputSurface : public cc::OutputSurface { public: SoftwareOutputSurface(std::unique_ptr<SoftwareDevice> software_device) @@ -105,22 +105,22 @@ void ApplyExternalStencil() override {} }; -SynchronousCompositorFrameSink::SynchronousCompositorFrameSink( +SynchronousLayerTreeFrameSink::SynchronousLayerTreeFrameSink( scoped_refptr<cc::ContextProvider> context_provider, scoped_refptr<cc::ContextProvider> worker_context_provider, gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, cc::SharedBitmapManager* shared_bitmap_manager, int routing_id, - uint32_t compositor_frame_sink_id, + uint32_t layer_tree_frame_sink_id, std::unique_ptr<cc::BeginFrameSource> begin_frame_source, SynchronousCompositorRegistry* registry, scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue) - : cc::CompositorFrameSink(std::move(context_provider), - std::move(worker_context_provider), - gpu_memory_buffer_manager, - nullptr), + : cc::LayerTreeFrameSink(std::move(context_provider), + std::move(worker_context_provider), + gpu_memory_buffer_manager, + nullptr), routing_id_(routing_id), - compositor_frame_sink_id_(compositor_frame_sink_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()), @@ -137,20 +137,20 @@ gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE; } -SynchronousCompositorFrameSink::~SynchronousCompositorFrameSink() = default; +SynchronousLayerTreeFrameSink::~SynchronousLayerTreeFrameSink() = default; -void SynchronousCompositorFrameSink::SetSyncClient( - SynchronousCompositorFrameSinkClient* compositor) { +void SynchronousLayerTreeFrameSink::SetSyncClient( + SynchronousLayerTreeFrameSinkClient* compositor) { DCHECK(CalledOnValidThread()); sync_client_ = compositor; if (sync_client_) - Send(new SyncCompositorHostMsg_CompositorFrameSinkCreated(routing_id_)); + Send(new SyncCompositorHostMsg_LayerTreeFrameSinkCreated(routing_id_)); } -bool SynchronousCompositorFrameSink::OnMessageReceived( +bool SynchronousLayerTreeFrameSink::OnMessageReceived( const IPC::Message& message) { bool handled = true; - IPC_BEGIN_MESSAGE_MAP(SynchronousCompositorFrameSink, message) + IPC_BEGIN_MESSAGE_MAP(SynchronousLayerTreeFrameSink, message) IPC_MESSAGE_HANDLER(SyncCompositorMsg_SetMemoryPolicy, SetMemoryPolicy) IPC_MESSAGE_HANDLER(SyncCompositorMsg_ReclaimResources, OnReclaimResources) IPC_MESSAGE_UNHANDLED(handled = false) @@ -158,19 +158,19 @@ return handled; } -bool SynchronousCompositorFrameSink::BindToClient( - cc::CompositorFrameSinkClient* sink_client) { +bool SynchronousLayerTreeFrameSink::BindToClient( + cc::LayerTreeFrameSinkClient* sink_client) { DCHECK(CalledOnValidThread()); - if (!cc::CompositorFrameSink::BindToClient(sink_client)) + if (!cc::LayerTreeFrameSink::BindToClient(sink_client)) return false; DCHECK(begin_frame_source_); client_->SetBeginFrameSource(begin_frame_source_.get()); client_->SetMemoryPolicy(memory_policy_); client_->SetTreeActivationCallback( - base::Bind(&SynchronousCompositorFrameSink::DidActivatePendingTree, + base::Bind(&SynchronousLayerTreeFrameSink::DidActivatePendingTree, base::Unretained(this))); - registry_->RegisterCompositorFrameSink(routing_id_, this); + registry_->RegisterLayerTreeFrameSink(routing_id_, this); constexpr bool root_support_is_root = true; constexpr bool child_support_is_root = false; @@ -205,12 +205,12 @@ return true; } -void SynchronousCompositorFrameSink::DetachFromClient() { +void SynchronousLayerTreeFrameSink::DetachFromClient() { DCHECK(CalledOnValidThread()); client_->SetBeginFrameSource(nullptr); // Destroy the begin frame source on the same thread it was bound on. begin_frame_source_ = nullptr; - registry_->UnregisterCompositorFrameSink(routing_id_, this); + registry_->UnregisterLayerTreeFrameSink(routing_id_, this); client_->SetTreeActivationCallback(base::Closure()); root_support_.reset(); child_support_.reset(); @@ -218,11 +218,11 @@ display_ = nullptr; local_surface_id_allocator_ = nullptr; surface_manager_ = nullptr; - cc::CompositorFrameSink::DetachFromClient(); + cc::LayerTreeFrameSink::DetachFromClient(); CancelFallbackTick(); } -void SynchronousCompositorFrameSink::SubmitCompositorFrame( +void SynchronousLayerTreeFrameSink::SubmitCompositorFrame( cc::CompositorFrame frame) { DCHECK(CalledOnValidThread()); DCHECK(sync_client_); @@ -279,7 +279,7 @@ // Make a root frame that embeds the frame coming from the layer compositor // and positions it based on the provided viewport. // TODO(danakj): We could apply the transform here instead of passing it to - // the CompositorFrameSink client too? (We'd have to do the same for + // the LayerTreeFrameSink client too? (We'd have to do the same for // hardware frames in SurfacesInstance?) cc::CompositorFrame embed_frame; embed_frame.metadata.begin_frame_ack = frame.metadata.begin_frame_ack; @@ -320,26 +320,26 @@ submit_frame = std::move(frame); } - sync_client_->SubmitCompositorFrame(compositor_frame_sink_id_, + sync_client_->SubmitCompositorFrame(layer_tree_frame_sink_id_, std::move(submit_frame)); did_submit_frame_ = true; } -void SynchronousCompositorFrameSink::DidNotProduceFrame( +void SynchronousLayerTreeFrameSink::DidNotProduceFrame( const cc::BeginFrameAck& ack) { DCHECK(!ack.has_damage); DCHECK_LE(cc::BeginFrameArgs::kStartingFrameNumber, ack.sequence_number); Send(new ViewHostMsg_DidNotProduceFrame(routing_id_, ack)); } -void SynchronousCompositorFrameSink::CancelFallbackTick() { +void SynchronousLayerTreeFrameSink::CancelFallbackTick() { fallback_tick_.Cancel(); fallback_tick_pending_ = false; } -void SynchronousCompositorFrameSink::FallbackTickFired() { +void SynchronousLayerTreeFrameSink::FallbackTickFired() { DCHECK(CalledOnValidThread()); - TRACE_EVENT0("renderer", "SynchronousCompositorFrameSink::FallbackTickFired"); + TRACE_EVENT0("renderer", "SynchronousLayerTreeFrameSink::FallbackTickFired"); base::AutoReset<bool> in_fallback_tick(&fallback_tick_running_, true); frame_swap_message_queue_->NotifyFramesAreDiscarded(true); SkBitmap bitmap; @@ -351,14 +351,14 @@ frame_swap_message_queue_->NotifyFramesAreDiscarded(false); } -void SynchronousCompositorFrameSink::Invalidate() { +void SynchronousLayerTreeFrameSink::Invalidate() { DCHECK(CalledOnValidThread()); if (sync_client_) sync_client_->Invalidate(); if (!fallback_tick_pending_) { fallback_tick_.Reset( - base::Bind(&SynchronousCompositorFrameSink::FallbackTickFired, + base::Bind(&SynchronousLayerTreeFrameSink::FallbackTickFired, base::Unretained(this))); base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, fallback_tick_.callback(), @@ -367,7 +367,7 @@ } } -void SynchronousCompositorFrameSink::DemandDrawHw( +void SynchronousLayerTreeFrameSink::DemandDrawHw( const gfx::Size& viewport_size, const gfx::Rect& viewport_rect_for_tile_priority, const gfx::Transform& transform_for_tile_priority) { @@ -381,7 +381,7 @@ InvokeComposite(gfx::Transform(), gfx::Rect(viewport_size)); } -void SynchronousCompositorFrameSink::DemandDrawSw(SkCanvas* canvas) { +void SynchronousLayerTreeFrameSink::DemandDrawSw(SkCanvas* canvas) { DCHECK(CalledOnValidThread()); DCHECK(canvas); DCHECK(!current_sw_canvas_); @@ -403,7 +403,7 @@ InvokeComposite(transform, viewport); } -void SynchronousCompositorFrameSink::InvokeComposite( +void SynchronousLayerTreeFrameSink::InvokeComposite( const gfx::Transform& transform, const gfx::Rect& viewport) { did_submit_frame_ = false; @@ -425,17 +425,17 @@ } } -void SynchronousCompositorFrameSink::OnReclaimResources( - uint32_t compositor_frame_sink_id, +void SynchronousLayerTreeFrameSink::OnReclaimResources( + uint32_t layer_tree_frame_sink_id, const cc::ReturnedResourceArray& resources) { // Ignore message if it's a stale one coming from a different output surface // (e.g. after a lost context). - if (compositor_frame_sink_id != compositor_frame_sink_id_) + if (layer_tree_frame_sink_id != layer_tree_frame_sink_id_) return; client_->ReclaimResources(resources); } -void SynchronousCompositorFrameSink::SetMemoryPolicy(size_t bytes_limit) { +void SynchronousLayerTreeFrameSink::SetMemoryPolicy(size_t bytes_limit) { DCHECK(CalledOnValidThread()); bool became_zero = memory_policy_.bytes_limit_when_visible && !bytes_limit; bool became_non_zero = @@ -457,14 +457,14 @@ } } -void SynchronousCompositorFrameSink::DidActivatePendingTree() { +void SynchronousLayerTreeFrameSink::DidActivatePendingTree() { DCHECK(CalledOnValidThread()); if (sync_client_) sync_client_->DidActivatePendingTree(); DeliverMessages(); } -void SynchronousCompositorFrameSink::DeliverMessages() { +void SynchronousLayerTreeFrameSink::DeliverMessages() { std::vector<std::unique_ptr<IPC::Message>> messages; std::unique_ptr<FrameSwapMessageQueue::SendMessageScope> send_message_scope = frame_swap_message_queue_->AcquireSendMessageScope(); @@ -474,30 +474,30 @@ } } -bool SynchronousCompositorFrameSink::Send(IPC::Message* message) { +bool SynchronousLayerTreeFrameSink::Send(IPC::Message* message) { DCHECK(CalledOnValidThread()); return sender_->Send(message); } -bool SynchronousCompositorFrameSink::CalledOnValidThread() const { +bool SynchronousLayerTreeFrameSink::CalledOnValidThread() const { return thread_checker_.CalledOnValidThread(); } -void SynchronousCompositorFrameSink::DidReceiveCompositorFrameAck( +void SynchronousLayerTreeFrameSink::DidReceiveCompositorFrameAck( const cc::ReturnedResourceArray& resources) { ReclaimResources(resources); } -void SynchronousCompositorFrameSink::OnBeginFrame( +void SynchronousLayerTreeFrameSink::OnBeginFrame( const cc::BeginFrameArgs& args) {} -void SynchronousCompositorFrameSink::ReclaimResources( +void SynchronousLayerTreeFrameSink::ReclaimResources( const cc::ReturnedResourceArray& resources) { DCHECK(resources.empty()); client_->ReclaimResources(resources); } -void SynchronousCompositorFrameSink::WillDrawSurface( +void SynchronousLayerTreeFrameSink::WillDrawSurface( const cc::LocalSurfaceId& local_surface_id, const gfx::Rect& damage_rect) {}
diff --git a/content/renderer/android/synchronous_compositor_frame_sink.h b/content/renderer/android/synchronous_layer_tree_frame_sink.h similarity index 80% rename from content/renderer/android/synchronous_compositor_frame_sink.h rename to content/renderer/android/synchronous_layer_tree_frame_sink.h index d906795..cef49ac 100644 --- a/content/renderer/android/synchronous_compositor_frame_sink.h +++ b/content/renderer/android/synchronous_layer_tree_frame_sink.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_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_FRAME_SINK_H_ -#define CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_FRAME_SINK_H_ +#ifndef CONTENT_RENDERER_ANDROID_SYNCHRONOUS_LAYER_TREE_FRAME_SINK_H_ +#define CONTENT_RENDERER_ANDROID_SYNCHRONOUS_LAYER_TREE_FRAME_SINK_H_ #include <stddef.h> @@ -16,7 +16,7 @@ #include "base/memory/ref_counted.h" #include "base/threading/thread_checker.h" #include "cc/output/compositor_frame.h" -#include "cc/output/compositor_frame_sink.h" +#include "cc/output/layer_tree_frame_sink.h" #include "cc/output/managed_memory_policy.h" #include "cc/surfaces/compositor_frame_sink_support_client.h" #include "cc/surfaces/display_client.h" @@ -32,58 +32,58 @@ class Display; class LocalSurfaceIdAllocator; class SurfaceManager; -} +} // namespace cc namespace IPC { class Message; class Sender; -} +} // namespace IPC namespace content { class FrameSwapMessageQueue; class SynchronousCompositorRegistry; -class SynchronousCompositorFrameSinkClient { +class SynchronousLayerTreeFrameSinkClient { public: virtual void DidActivatePendingTree() = 0; virtual void Invalidate() = 0; - virtual void SubmitCompositorFrame(uint32_t compositor_frame_sink_id, + virtual void SubmitCompositorFrame(uint32_t layer_tree_frame_sink_id, cc::CompositorFrame frame) = 0; protected: - virtual ~SynchronousCompositorFrameSinkClient() {} + virtual ~SynchronousLayerTreeFrameSinkClient() {} }; // Specialization of the output surface that adapts it to implement the // content::SynchronousCompositor public API. This class effects an "inversion // of control" - enabling drawing to be orchestrated by the embedding // layer, instead of driven by the compositor internals - hence it holds two -// 'client' pointers (|client_| in the CompositorFrameSink baseclass and +// 'client' pointers (|client_| in the LayerTreeFrameSink baseclass and // |delegate_|) which represent the consumers of the two roles in plays. // This class can be created only on the main thread, but then becomes pinned // to a fixed thread when BindToClient is called. -class SynchronousCompositorFrameSink - : NON_EXPORTED_BASE(public cc::CompositorFrameSink), +class SynchronousLayerTreeFrameSink + : NON_EXPORTED_BASE(public cc::LayerTreeFrameSink), public cc::CompositorFrameSinkSupportClient { public: - SynchronousCompositorFrameSink( + SynchronousLayerTreeFrameSink( scoped_refptr<cc::ContextProvider> context_provider, scoped_refptr<cc::ContextProvider> worker_context_provider, gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, cc::SharedBitmapManager* shared_bitmap_manager, int routing_id, - uint32_t compositor_frame_sink_id, + uint32_t layer_tree_frame_sink_id, std::unique_ptr<cc::BeginFrameSource> begin_frame_source, SynchronousCompositorRegistry* registry, scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue); - ~SynchronousCompositorFrameSink() override; + ~SynchronousLayerTreeFrameSink() override; - void SetSyncClient(SynchronousCompositorFrameSinkClient* compositor); + void SetSyncClient(SynchronousLayerTreeFrameSinkClient* compositor); bool OnMessageReceived(const IPC::Message& message); - // cc::CompositorFrameSink implementation. - bool BindToClient(cc::CompositorFrameSinkClient* sink_client) override; + // cc::LayerTreeFrameSink implementation. + bool BindToClient(cc::LayerTreeFrameSinkClient* sink_client) override; void DetachFromClient() override; void SubmitCompositorFrame(cc::CompositorFrame frame) override; void DidNotProduceFrame(const cc::BeginFrameAck& ack) override; @@ -118,17 +118,17 @@ // IPC handlers. void SetMemoryPolicy(size_t bytes_limit); - void OnReclaimResources(uint32_t compositor_frame_sink_id, + void OnReclaimResources(uint32_t layer_tree_frame_sink_id, const cc::ReturnedResourceArray& resources); const int routing_id_; - const uint32_t compositor_frame_sink_id_; - SynchronousCompositorRegistry* const registry_; // Not owned. + const uint32_t layer_tree_frame_sink_id_; + SynchronousCompositorRegistry* const registry_; // Not owned. cc::SharedBitmapManager* const shared_bitmap_manager_; // Not owned. - IPC::Sender* const sender_; // Not owned. + IPC::Sender* const sender_; // Not owned. // Not owned. - SynchronousCompositorFrameSinkClient* sync_client_ = nullptr; + SynchronousLayerTreeFrameSinkClient* sync_client_ = nullptr; // Only valid (non-NULL) during a DemandDrawSw() call. SkCanvas* current_sw_canvas_ = nullptr; @@ -174,9 +174,9 @@ base::ThreadChecker thread_checker_; - DISALLOW_COPY_AND_ASSIGN(SynchronousCompositorFrameSink); + DISALLOW_COPY_AND_ASSIGN(SynchronousLayerTreeFrameSink); }; } // namespace content -#endif // CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_FRAME_SINK_H_ +#endif // CONTENT_RENDERER_ANDROID_SYNCHRONOUS_LAYER_TREE_FRAME_SINK_H_
diff --git a/content/renderer/gpu/render_widget_compositor.cc b/content/renderer/gpu/render_widget_compositor.cc index 68172ceb..c2c1b3f 100644 --- a/content/renderer/gpu/render_widget_compositor.cc +++ b/content/renderer/gpu/render_widget_compositor.cc
@@ -971,13 +971,13 @@ } } -void RenderWidgetCompositor::SetCompositorFrameSink( - std::unique_ptr<cc::CompositorFrameSink> compositor_frame_sink) { - if (!compositor_frame_sink) { - DidFailToInitializeCompositorFrameSink(); +void RenderWidgetCompositor::SetLayerTreeFrameSink( + std::unique_ptr<cc::LayerTreeFrameSink> layer_tree_frame_sink) { + if (!layer_tree_frame_sink) { + DidFailToInitializeLayerTreeFrameSink(); return; } - layer_tree_host_->SetCompositorFrameSink(std::move(compositor_frame_sink)); + layer_tree_host_->SetLayerTreeFrameSink(std::move(layer_tree_frame_sink)); } void RenderWidgetCompositor::LayoutAndUpdateLayers() { @@ -1151,40 +1151,40 @@ has_scrolled_by_touch); } -void RenderWidgetCompositor::RequestNewCompositorFrameSink() { +void RenderWidgetCompositor::RequestNewLayerTreeFrameSink() { // If the host is closing, then no more compositing is possible. This // prevents shutdown races between handling the close message and - // the CreateCompositorFrameSink task. + // the CreateLayerTreeFrameSink task. if (delegate_->IsClosing()) return; bool fallback = num_failed_recreate_attempts_ >= - COMPOSITOR_FRAME_SINK_RETRIES_BEFORE_FALLBACK; + LAYER_TREE_FRAME_SINK_RETRIES_BEFORE_FALLBACK; #ifdef OS_ANDROID LOG_IF(FATAL, fallback) << "Android does not support fallback frame sinks."; #endif - delegate_->RequestNewCompositorFrameSink( - fallback, base::Bind(&RenderWidgetCompositor::SetCompositorFrameSink, + delegate_->RequestNewLayerTreeFrameSink( + fallback, base::Bind(&RenderWidgetCompositor::SetLayerTreeFrameSink, weak_factory_.GetWeakPtr())); } -void RenderWidgetCompositor::DidInitializeCompositorFrameSink() { +void RenderWidgetCompositor::DidInitializeLayerTreeFrameSink() { num_failed_recreate_attempts_ = 0; } -void RenderWidgetCompositor::DidFailToInitializeCompositorFrameSink() { +void RenderWidgetCompositor::DidFailToInitializeLayerTreeFrameSink() { ++num_failed_recreate_attempts_; // Tolerate a certain number of recreation failures to work around races // in the output-surface-lost machinery. LOG_IF(FATAL, - (num_failed_recreate_attempts_ >= MAX_COMPOSITOR_FRAME_SINK_RETRIES)) - << "Failed to create a fallback CompositorFrameSink."; + (num_failed_recreate_attempts_ >= MAX_LAYER_TREE_FRAME_SINK_RETRIES)) + << "Failed to create a fallback LayerTreeFrameSink."; base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, - base::Bind(&RenderWidgetCompositor::RequestNewCompositorFrameSink, + base::Bind(&RenderWidgetCompositor::RequestNewLayerTreeFrameSink, weak_factory_.GetWeakPtr())); } @@ -1219,7 +1219,7 @@ void RenderWidgetCompositor::DidSubmitCompositorFrame() {} -void RenderWidgetCompositor::DidLoseCompositorFrameSink() {} +void RenderWidgetCompositor::DidLoseLayerTreeFrameSink() {} void RenderWidgetCompositor::SetFrameSinkId( const cc::FrameSinkId& frame_sink_id) {
diff --git a/content/renderer/gpu/render_widget_compositor.h b/content/renderer/gpu/render_widget_compositor.h index 7afa1a68..84e8a29 100644 --- a/content/renderer/gpu/render_widget_compositor.h +++ b/content/renderer/gpu/render_widget_compositor.h
@@ -32,6 +32,7 @@ class AnimationHost; class InputHandler; class Layer; +class LayerTreeFrameSink; class LayerTreeHost; class MutatorHost; } @@ -199,9 +200,9 @@ float top_controls_delta) override; void RecordWheelAndTouchScrollingCount(bool has_scrolled_by_wheel, bool has_scrolled_by_touch) override; - void RequestNewCompositorFrameSink() override; - void DidInitializeCompositorFrameSink() override; - void DidFailToInitializeCompositorFrameSink() override; + void RequestNewLayerTreeFrameSink() override; + void DidInitializeLayerTreeFrameSink() override; + void DidFailToInitializeLayerTreeFrameSink() override; void WillCommit() override; void DidCommit() override; void DidCommitAndDrawFrame() override; @@ -212,12 +213,12 @@ // cc::LayerTreeHostSingleThreadClient implementation. void RequestScheduleAnimation() override; void DidSubmitCompositorFrame() override; - void DidLoseCompositorFrameSink() override; + void DidLoseLayerTreeFrameSink() override; void RequestBeginMainFrameNotExpected(bool new_state) override; enum { - COMPOSITOR_FRAME_SINK_RETRIES_BEFORE_FALLBACK = 4, - MAX_COMPOSITOR_FRAME_SINK_RETRIES = 5, + LAYER_TREE_FRAME_SINK_RETRIES_BEFORE_FALLBACK = 4, + MAX_LAYER_TREE_FRAME_SINK_RETRIES = 5, }; protected: @@ -229,8 +230,8 @@ cc::LayerTreeHost* layer_tree_host() { return layer_tree_host_.get(); } private: - void SetCompositorFrameSink( - std::unique_ptr<cc::CompositorFrameSink> compositor_frame_sink); + void SetLayerTreeFrameSink( + std::unique_ptr<cc::LayerTreeFrameSink> layer_tree_frame_sink); void LayoutAndUpdateLayers(); void InvokeLayoutAndPaintCallback(); bool CompositeIsSynchronous() const;
diff --git a/content/renderer/gpu/render_widget_compositor_delegate.h b/content/renderer/gpu/render_widget_compositor_delegate.h index a9e7392..8683cef1 100644 --- a/content/renderer/gpu/render_widget_compositor_delegate.h +++ b/content/renderer/gpu/render_widget_compositor_delegate.h
@@ -13,7 +13,7 @@ namespace cc { class CopyOutputRequest; -class CompositorFrameSink; +class LayerTreeFrameSink; class SwapPromise; } @@ -23,8 +23,8 @@ namespace content { -using CompositorFrameSinkCallback = - base::Callback<void(std::unique_ptr<cc::CompositorFrameSink>)>; +using LayerTreeFrameSinkCallback = + base::Callback<void(std::unique_ptr<cc::LayerTreeFrameSink>)>; // Consumers of RenderWidgetCompositor implement this delegate in order to // transport compositing information across processes. @@ -48,10 +48,10 @@ // Notifies that the compositor has issed a BeginMainFrame. virtual void BeginMainFrame(double frame_time_sec) = 0; - // Requests a CompositorFrameSink to submit CompositorFrames to. - virtual void RequestNewCompositorFrameSink( + // Requests a LayerTreeFrameSink to submit CompositorFrames to. + virtual void RequestNewLayerTreeFrameSink( bool fallback, - const CompositorFrameSinkCallback& callback) = 0; + const LayerTreeFrameSinkCallback& callback) = 0; // Notifies that the draw commands for a committed frame have been issued. virtual void DidCommitAndDrawCompositorFrame() = 0;
diff --git a/content/renderer/gpu/render_widget_compositor_unittest.cc b/content/renderer/gpu/render_widget_compositor_unittest.cc index eeb3e29..007194b 100644 --- a/content/renderer/gpu/render_widget_compositor_unittest.cc +++ b/content/renderer/gpu/render_widget_compositor_unittest.cc
@@ -16,7 +16,7 @@ #include "cc/animation/animation_host.h" #include "cc/output/begin_frame_args.h" #include "cc/output/copy_output_request.h" -#include "cc/test/fake_compositor_frame_sink.h" +#include "cc/test/fake_layer_tree_frame_sink.h" #include "cc/test/test_context_provider.h" #include "cc/test/test_web_graphics_context_3d.h" #include "cc/trees/layer_tree_host.h" @@ -46,9 +46,9 @@ void RecordWheelAndTouchScrollingCount(bool has_scrolled_by_wheel, bool has_scrolled_by_touch) override {} void BeginMainFrame(double frame_time_sec) override {} - void RequestNewCompositorFrameSink( + void RequestNewLayerTreeFrameSink( bool fallback, - const CompositorFrameSinkCallback& callback) override { + const LayerTreeFrameSinkCallback& callback) override { callback.Run(nullptr); } void DidCommitAndDrawCompositorFrame() override {} @@ -70,18 +70,18 @@ public: FakeRenderWidgetCompositorDelegate() = default; - void RequestNewCompositorFrameSink( + void RequestNewLayerTreeFrameSink( bool fallback, - const CompositorFrameSinkCallback& callback) override { + const LayerTreeFrameSinkCallback& callback) override { EXPECT_EQ(num_requests_since_last_success_ > RenderWidgetCompositor:: - COMPOSITOR_FRAME_SINK_RETRIES_BEFORE_FALLBACK, + LAYER_TREE_FRAME_SINK_RETRIES_BEFORE_FALLBACK, fallback); last_create_was_fallback_ = fallback; bool success = num_failures_ >= num_failures_before_success_; - if (!success && use_null_compositor_frame_sink_) { - callback.Run(std::unique_ptr<cc::CompositorFrameSink>()); + if (!success && use_null_layer_tree_frame_sink_) { + callback.Run(std::unique_ptr<cc::LayerTreeFrameSink>()); return; } @@ -91,7 +91,7 @@ GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB); } callback.Run( - cc::FakeCompositorFrameSink::Create3d(std::move(context_provider))); + cc::FakeLayerTreeFrameSink::Create3d(std::move(context_provider))); } void add_success() { @@ -120,11 +120,11 @@ return num_failures_before_success_; } - void set_use_null_compositor_frame_sink(bool u) { - use_null_compositor_frame_sink_ = u; + void set_use_null_layer_tree_frame_sink(bool u) { + use_null_layer_tree_frame_sink_ = u; } - bool use_null_compositor_frame_sink() const { - return use_null_compositor_frame_sink_; + bool use_null_layer_tree_frame_sink() const { + return use_null_layer_tree_frame_sink_; } private: @@ -135,7 +135,7 @@ int num_fallback_successes_ = 0; int num_successes_ = 0; bool last_create_was_fallback_ = false; - bool use_null_compositor_frame_sink_ = true; + bool use_null_layer_tree_frame_sink_ = true; DISALLOW_COPY_AND_ASSIGN(FakeRenderWidgetCompositorDelegate); }; @@ -146,10 +146,10 @@ // The use null output surface parameter allows testing whether failures // from RenderWidget (couldn't create an output surface) vs failures from // the compositor (couldn't bind the output surface) are handled identically. -class RenderWidgetCompositorFrameSink : public RenderWidgetCompositor { +class RenderWidgetLayerTreeFrameSink : public RenderWidgetCompositor { public: - RenderWidgetCompositorFrameSink(FakeRenderWidgetCompositorDelegate* delegate, - CompositorDependencies* compositor_deps) + RenderWidgetLayerTreeFrameSink(FakeRenderWidgetCompositorDelegate* delegate, + CompositorDependencies* compositor_deps) : RenderWidgetCompositor(delegate, compositor_deps), delegate_(delegate) {} @@ -158,41 +158,41 @@ // Force a new output surface to be created. void SynchronousComposite() { layer_tree_host()->SetVisible(false); - layer_tree_host()->ReleaseCompositorFrameSink(); + layer_tree_host()->ReleaseLayerTreeFrameSink(); layer_tree_host()->SetVisible(true); base::TimeTicks some_time; layer_tree_host()->Composite(some_time); } - void RequestNewCompositorFrameSink() override { + void RequestNewLayerTreeFrameSink() override { delegate_->add_request(); - RenderWidgetCompositor::RequestNewCompositorFrameSink(); + RenderWidgetCompositor::RequestNewLayerTreeFrameSink(); } - void DidInitializeCompositorFrameSink() override { + void DidInitializeLayerTreeFrameSink() override { delegate_->add_success(); if (delegate_->num_requests() == expected_requests_) { EndTest(); } else { - RenderWidgetCompositor::DidInitializeCompositorFrameSink(); + RenderWidgetCompositor::DidInitializeLayerTreeFrameSink(); // Post the synchronous composite task so that it is not called - // reentrantly as a part of RequestNewCompositorFrameSink. + // reentrantly as a part of RequestNewLayerTreeFrameSink. base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, - base::Bind(&RenderWidgetCompositorFrameSink::SynchronousComposite, + base::Bind(&RenderWidgetLayerTreeFrameSink::SynchronousComposite, base::Unretained(this))); } } - void DidFailToInitializeCompositorFrameSink() override { + void DidFailToInitializeLayerTreeFrameSink() override { delegate_->add_failure(); if (delegate_->num_requests() == expected_requests_) { EndTest(); return; } - RenderWidgetCompositor::DidFailToInitializeCompositorFrameSink(); + RenderWidgetCompositor::DidFailToInitializeLayerTreeFrameSink(); } void SetUp(int expected_successes, int expected_fallback_succeses) { @@ -219,12 +219,12 @@ int expected_fallback_successes_ = 0; int expected_requests_ = 0; - DISALLOW_COPY_AND_ASSIGN(RenderWidgetCompositorFrameSink); + DISALLOW_COPY_AND_ASSIGN(RenderWidgetLayerTreeFrameSink); }; -class RenderWidgetCompositorFrameSinkTest : public testing::Test { +class RenderWidgetLayerTreeFrameSinkTest : public testing::Test { public: - RenderWidgetCompositorFrameSinkTest() + RenderWidgetLayerTreeFrameSinkTest() : render_widget_compositor_(&compositor_delegate_, &compositor_deps_) { auto animation_host = cc::AnimationHost::CreateMainInstance(); @@ -239,12 +239,12 @@ std::move(animation_host)); } - void RunTest(bool use_null_compositor_frame_sink, + void RunTest(bool use_null_layer_tree_frame_sink, int num_failures_before_success, int expected_successes, int expected_fallback_succeses) { - compositor_delegate_.set_use_null_compositor_frame_sink( - use_null_compositor_frame_sink); + compositor_delegate_.set_use_null_layer_tree_frame_sink( + use_null_layer_tree_frame_sink); compositor_delegate_.set_num_failures_before_success( num_failures_before_success); render_widget_compositor_.SetUp(expected_successes, @@ -252,7 +252,7 @@ render_widget_compositor_.SetVisible(true); base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, - base::Bind(&RenderWidgetCompositorFrameSink::SynchronousComposite, + base::Bind(&RenderWidgetLayerTreeFrameSink::SynchronousComposite, base::Unretained(&render_widget_compositor_))); base::RunLoop().Run(); render_widget_compositor_.AfterTest(); @@ -263,31 +263,31 @@ MockRenderThread render_thread_; FakeCompositorDependencies compositor_deps_; FakeRenderWidgetCompositorDelegate compositor_delegate_; - RenderWidgetCompositorFrameSink render_widget_compositor_; + RenderWidgetLayerTreeFrameSink render_widget_compositor_; private: - DISALLOW_COPY_AND_ASSIGN(RenderWidgetCompositorFrameSinkTest); + DISALLOW_COPY_AND_ASSIGN(RenderWidgetLayerTreeFrameSinkTest); }; -TEST_F(RenderWidgetCompositorFrameSinkTest, SucceedOnce) { +TEST_F(RenderWidgetLayerTreeFrameSinkTest, SucceedOnce) { RunTest(false, 0, 1, 0); } -TEST_F(RenderWidgetCompositorFrameSinkTest, SucceedTwice) { +TEST_F(RenderWidgetLayerTreeFrameSinkTest, SucceedTwice) { RunTest(false, 0, 2, 0); } -TEST_F(RenderWidgetCompositorFrameSinkTest, FailOnceNull) { +TEST_F(RenderWidgetLayerTreeFrameSinkTest, FailOnceNull) { static_assert( - RenderWidgetCompositor::COMPOSITOR_FRAME_SINK_RETRIES_BEFORE_FALLBACK >= + RenderWidgetCompositor::LAYER_TREE_FRAME_SINK_RETRIES_BEFORE_FALLBACK >= 2, "Adjust the values of this test if this fails"); RunTest(true, 1, 1, 0); } -TEST_F(RenderWidgetCompositorFrameSinkTest, FailOnceBind) { +TEST_F(RenderWidgetLayerTreeFrameSinkTest, FailOnceBind) { static_assert( - RenderWidgetCompositor::COMPOSITOR_FRAME_SINK_RETRIES_BEFORE_FALLBACK >= + RenderWidgetCompositor::LAYER_TREE_FRAME_SINK_RETRIES_BEFORE_FALLBACK >= 2, "Adjust the values of this test if this fails"); RunTest(false, 1, 1, 0); @@ -295,22 +295,22 @@ // Android doesn't support fallback frame sinks. (crbug.com/721102) #ifndef OS_ANDROID -TEST_F(RenderWidgetCompositorFrameSinkTest, FallbackSuccessNull) { +TEST_F(RenderWidgetLayerTreeFrameSinkTest, FallbackSuccessNull) { RunTest(true, - RenderWidgetCompositor::COMPOSITOR_FRAME_SINK_RETRIES_BEFORE_FALLBACK, + RenderWidgetCompositor::LAYER_TREE_FRAME_SINK_RETRIES_BEFORE_FALLBACK, 0, 1); } -TEST_F(RenderWidgetCompositorFrameSinkTest, FallbackSuccessBind) { +TEST_F(RenderWidgetLayerTreeFrameSinkTest, FallbackSuccessBind) { RunTest(false, - RenderWidgetCompositor::COMPOSITOR_FRAME_SINK_RETRIES_BEFORE_FALLBACK, + RenderWidgetCompositor::LAYER_TREE_FRAME_SINK_RETRIES_BEFORE_FALLBACK, 0, 1); } -TEST_F(RenderWidgetCompositorFrameSinkTest, FallbackSuccessNormalSuccess) { +TEST_F(RenderWidgetLayerTreeFrameSinkTest, FallbackSuccessNormalSuccess) { // The first success is a fallback, but the next should not be a fallback. RunTest(false, - RenderWidgetCompositor::COMPOSITOR_FRAME_SINK_RETRIES_BEFORE_FALLBACK, + RenderWidgetCompositor::LAYER_TREE_FRAME_SINK_RETRIES_BEFORE_FALLBACK, 1, 1); } #endif
diff --git a/content/renderer/layout_test_dependencies.h b/content/renderer/layout_test_dependencies.h index 471cdca..df8feef 100644 --- a/content/renderer/layout_test_dependencies.h +++ b/content/renderer/layout_test_dependencies.h
@@ -13,7 +13,7 @@ namespace cc { class ContextProvider; class CopyOutputRequest; -class CompositorFrameSink; +class LayerTreeFrameSink; class SwapPromise; } @@ -29,7 +29,7 @@ // RenderThreadImpl. class LayoutTestDependencies { public: - virtual std::unique_ptr<cc::CompositorFrameSink> CreateCompositorFrameSink( + virtual std::unique_ptr<cc::LayerTreeFrameSink> CreateLayerTreeFrameSink( int32_t routing_id, scoped_refptr<gpu::GpuChannelHost> gpu_channel, scoped_refptr<cc::ContextProvider> compositor_context_provider,
diff --git a/content/renderer/mus/renderer_window_tree_client.cc b/content/renderer/mus/renderer_window_tree_client.cc index 59b6a8b..5955dae 100644 --- a/content/renderer/mus/renderer_window_tree_client.cc +++ b/content/renderer/mus/renderer_window_tree_client.cc
@@ -9,7 +9,7 @@ #include "base/command_line.h" #include "base/lazy_instance.h" #include "cc/base/switches.h" -#include "components/viz/client/client_compositor_frame_sink.h" +#include "components/viz/client/client_layer_tree_frame_sink.h" #include "components/viz/client/local_surface_id_provider.h" namespace content { @@ -49,20 +49,20 @@ binding_.Bind(std::move(request)); } -void RendererWindowTreeClient::RequestCompositorFrameSink( +void RendererWindowTreeClient::RequestLayerTreeFrameSink( scoped_refptr<cc::ContextProvider> context_provider, gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, - const CompositorFrameSinkCallback& callback) { - DCHECK(pending_compositor_frame_sink_callback_.is_null()); + const LayerTreeFrameSinkCallback& callback) { + DCHECK(pending_layer_tree_frame_sink_callback_.is_null()); if (tree_) { - RequestCompositorFrameSinkInternal(std::move(context_provider), - gpu_memory_buffer_manager, callback); + RequestLayerTreeFrameSinkInternal(std::move(context_provider), + gpu_memory_buffer_manager, callback); return; } pending_context_provider_ = std::move(context_provider); pending_gpu_memory_buffer_manager_ = gpu_memory_buffer_manager; - pending_compositor_frame_sink_callback_ = callback; + pending_layer_tree_frame_sink_callback_ = callback; } RendererWindowTreeClient::RendererWindowTreeClient(int routing_id) @@ -73,10 +73,10 @@ g_connections.Get().erase(routing_id_); } -void RendererWindowTreeClient::RequestCompositorFrameSinkInternal( +void RendererWindowTreeClient::RequestLayerTreeFrameSinkInternal( scoped_refptr<cc::ContextProvider> context_provider, gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, - const CompositorFrameSinkCallback& callback) { + const LayerTreeFrameSinkCallback& callback) { cc::mojom::MojoCompositorFrameSinkPtrInfo sink_info; cc::mojom::MojoCompositorFrameSinkRequest sink_request = mojo::MakeRequest(&sink_info); @@ -84,7 +84,7 @@ cc::mojom::MojoCompositorFrameSinkClientRequest client_request = mojo::MakeRequest(&client); constexpr bool enable_surface_synchronization = true; - auto frame_sink = base::MakeUnique<viz::ClientCompositorFrameSink>( + auto frame_sink = base::MakeUnique<viz::ClientLayerTreeFrameSink>( std::move(context_provider), nullptr /* worker_context_provider */, gpu_memory_buffer_manager, nullptr /* shared_bitmap_manager */, nullptr /* synthetic_begin_frame_source */, std::move(sink_info), @@ -110,13 +110,13 @@ const base::Optional<cc::LocalSurfaceId>& local_surface_id) { root_window_id_ = root->window_id; tree_ = std::move(tree); - if (!pending_compositor_frame_sink_callback_.is_null()) { - RequestCompositorFrameSinkInternal(std::move(pending_context_provider_), - pending_gpu_memory_buffer_manager_, - pending_compositor_frame_sink_callback_); + if (!pending_layer_tree_frame_sink_callback_.is_null()) { + RequestLayerTreeFrameSinkInternal(std::move(pending_context_provider_), + pending_gpu_memory_buffer_manager_, + pending_layer_tree_frame_sink_callback_); pending_context_provider_ = nullptr; pending_gpu_memory_buffer_manager_ = nullptr; - pending_compositor_frame_sink_callback_.Reset(); + pending_layer_tree_frame_sink_callback_.Reset(); } }
diff --git a/content/renderer/mus/renderer_window_tree_client.h b/content/renderer/mus/renderer_window_tree_client.h index 271d162..f2c56fba 100644 --- a/content/renderer/mus/renderer_window_tree_client.h +++ b/content/renderer/mus/renderer_window_tree_client.h
@@ -11,7 +11,7 @@ #include "services/ui/public/interfaces/window_tree.mojom.h" namespace cc { -class CompositorFrameSink; +class LayerTreeFrameSink; class ContextProvider; } @@ -40,21 +40,21 @@ void Bind(ui::mojom::WindowTreeClientRequest request); - using CompositorFrameSinkCallback = - base::Callback<void(std::unique_ptr<cc::CompositorFrameSink>)>; - void RequestCompositorFrameSink( + using LayerTreeFrameSinkCallback = + base::Callback<void(std::unique_ptr<cc::LayerTreeFrameSink>)>; + void RequestLayerTreeFrameSink( scoped_refptr<cc::ContextProvider> context_provider, gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, - const CompositorFrameSinkCallback& callback); + const LayerTreeFrameSinkCallback& callback); private: explicit RendererWindowTreeClient(int routing_id); ~RendererWindowTreeClient() override; - void RequestCompositorFrameSinkInternal( + void RequestLayerTreeFrameSinkInternal( scoped_refptr<cc::ContextProvider> context_provider, gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, - const CompositorFrameSinkCallback& callback); + const LayerTreeFrameSinkCallback& callback); void DestroySelf(); @@ -162,7 +162,7 @@ ui::Id root_window_id_; scoped_refptr<cc::ContextProvider> pending_context_provider_; gpu::GpuMemoryBufferManager* pending_gpu_memory_buffer_manager_ = nullptr; - CompositorFrameSinkCallback pending_compositor_frame_sink_callback_; + LayerTreeFrameSinkCallback pending_layer_tree_frame_sink_callback_; ui::mojom::WindowTreePtr tree_; mojo::Binding<ui::mojom::WindowTreeClient> binding_;
diff --git a/content/renderer/presentation/presentation_dispatcher.cc b/content/renderer/presentation/presentation_dispatcher.cc index 2fe4361..4c24fff 100644 --- a/content/renderer/presentation/presentation_dispatcher.cc +++ b/content/renderer/presentation/presentation_dispatcher.cc
@@ -439,22 +439,33 @@ listening_status->last_known_availability = availability; + static const blink::WebString& not_supported_error = + blink::WebString::FromUTF8( + "getAvailability() isn't supported at the moment. It can be due to " + "a permanent or temporary system limitation. It is recommended to " + "try to blindly start a presentation in that case."); + std::set<AvailabilityListener*> modified_listeners; for (auto& listener : availability_set_) { if (!base::ContainsValue(listener->urls, url)) continue; auto screen_availability = GetScreenAvailability(listener->urls); - DCHECK(screen_availability != blink::mojom::ScreenAvailability::UNKNOWN && - screen_availability != blink::mojom::ScreenAvailability::DISABLED); + DCHECK(screen_availability != blink::mojom::ScreenAvailability::UNKNOWN); for (auto* observer : listener->availability_observers) observer->AvailabilityChanged(screen_availability); for (AvailabilityCallbacksMap::iterator iter( &listener->availability_callbacks); !iter.IsAtEnd(); iter.Advance()) { - iter.GetCurrentValue()->OnSuccess( - screen_availability == blink::mojom::ScreenAvailability::AVAILABLE); + if (screen_availability == blink::mojom::ScreenAvailability::DISABLED) { + iter.GetCurrentValue()->OnError(blink::WebPresentationError( + blink::WebPresentationError::kErrorTypeAvailabilityNotSupported, + not_supported_error)); + } else { + iter.GetCurrentValue()->OnSuccess( + screen_availability == blink::mojom::ScreenAvailability::AVAILABLE); + } } listener->availability_callbacks.Clear(); @@ -468,63 +479,6 @@ TryRemoveAvailabilityListener(listener); } -void PresentationDispatcher::OnScreenAvailabilityNotSupported(const GURL& url) { - auto* listening_status = GetListeningStatus(url); - if (!listening_status) - return; - - if (listening_status->listening_state == ListeningState::WAITING) - listening_status->listening_state = ListeningState::ACTIVE; - - if (listening_status->last_known_availability == - blink::mojom::ScreenAvailability::DISABLED) { - return; - } - - listening_status->last_known_availability = - blink::mojom::ScreenAvailability::DISABLED; - - const blink::WebString& not_supported_error = blink::WebString::FromUTF8( - "getAvailability() isn't supported at the moment. It can be due to " - "a permanent or temporary system limitation. It is recommended to " - "try to blindly start a presentation in that case."); - - std::set<AvailabilityListener*> modified_listeners; - for (auto& listener : availability_set_) { - if (!base::ContainsValue(listener->urls, url)) - continue; - - // ScreenAvailabilityNotSupported should be a browser side setting, which - // means all urls in PresentationAvailability should report NotSupported. - // It is not possible to change listening status from AVAILABLE or - // UNAVAILABLE to DISABLED. - auto screen_availability = GetScreenAvailability(listener->urls); - DCHECK_EQ(screen_availability, blink::mojom::ScreenAvailability::DISABLED); - - // RemotePlayback is using a listener but doesn't use callbacks. - // So update observers even though it's not necessary for Presentation API. - for (auto* observer : listener->availability_observers) - observer->AvailabilityChanged(screen_availability); - - for (AvailabilityCallbacksMap::iterator iter( - &listener->availability_callbacks); - !iter.IsAtEnd(); iter.Advance()) { - iter.GetCurrentValue()->OnError(blink::WebPresentationError( - blink::WebPresentationError::kErrorTypeAvailabilityNotSupported, - not_supported_error)); - } - listener->availability_callbacks.Clear(); - - for (const auto& availability_url : listener->urls) - MaybeStopListeningToURL(availability_url); - - modified_listeners.insert(listener.get()); - } - - for (auto* listener : modified_listeners) - TryRemoveAvailabilityListener(listener); -} - void PresentationDispatcher::OnDefaultPresentationStarted( const PresentationInfo& presentation_info) { if (!controller_)
diff --git a/content/renderer/presentation/presentation_dispatcher.h b/content/renderer/presentation/presentation_dispatcher.h index 57721b0..deea3ec3 100644 --- a/content/renderer/presentation/presentation_dispatcher.h +++ b/content/renderer/presentation/presentation_dispatcher.h
@@ -158,7 +158,6 @@ void WidgetWillClose() override; // blink::mojom::PresentationServiceClient - void OnScreenAvailabilityNotSupported(const GURL& url) override; void OnScreenAvailabilityUpdated( const GURL& url, blink::mojom::ScreenAvailability availability) override;
diff --git a/content/renderer/presentation/presentation_dispatcher_unittest.cc b/content/renderer/presentation/presentation_dispatcher_unittest.cc index f2becd5..9ab1ef2 100644 --- a/content/renderer/presentation/presentation_dispatcher_unittest.cc +++ b/content/renderer/presentation/presentation_dispatcher_unittest.cc
@@ -273,7 +273,8 @@ url, ScreenAvailability::UNAVAILABLE); break; case ScreenAvailability::DISABLED: - dispatcher_.OnScreenAvailabilityNotSupported(url); + dispatcher_.OnScreenAvailabilityUpdated(url, + ScreenAvailability::DISABLED); break; case ScreenAvailability::UNKNOWN: break;
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index 25bfb8b..f8e4685a 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc
@@ -46,8 +46,8 @@ #include "cc/base/switches.h" #include "cc/blink/web_layer_impl.h" #include "cc/output/buffer_to_texture_target_map.h" -#include "cc/output/compositor_frame_sink.h" #include "cc/output/copy_output_request.h" +#include "cc/output/layer_tree_frame_sink.h" #include "cc/output/vulkan_in_process_context_provider.h" #include "cc/raster/task_graph_runner.h" #include "cc/trees/layer_tree_host_common.h" @@ -55,7 +55,7 @@ #include "components/discardable_memory/client/client_discardable_shared_memory_manager.h" #include "components/metrics/public/interfaces/single_sample_metrics.mojom.h" #include "components/metrics/single_sample_metrics.h" -#include "components/viz/client/client_compositor_frame_sink.h" +#include "components/viz/client/client_layer_tree_frame_sink.h" #include "components/viz/client/local_surface_id_provider.h" #include "content/child/appcache/appcache_dispatcher.h" #include "content/child/appcache/appcache_frontend_impl.h" @@ -182,7 +182,7 @@ #if defined(OS_ANDROID) #include <cpu-features.h> #include "content/renderer/android/synchronous_compositor_filter.h" -#include "content/renderer/android/synchronous_compositor_frame_sink.h" +#include "content/renderer/android/synchronous_layer_tree_frame_sink.h" #include "content/renderer/media/android/stream_texture_factory.h" #include "media/base/android/media_codec_util.h" #endif @@ -261,7 +261,7 @@ #if defined(OS_ANDROID) // Unique identifier for each output surface created. -uint32_t g_next_compositor_frame_sink_id = 1; +uint32_t g_next_layer_tree_frame_sink_id = 1; #endif // An implementation of mojom::RenderMessageFilter which can be mocked out @@ -1917,12 +1917,12 @@ return gpu_channel_; } -void RenderThreadImpl::RequestNewCompositorFrameSink( +void RenderThreadImpl::RequestNewLayerTreeFrameSink( bool use_software, int routing_id, scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue, const GURL& url, - const CompositorFrameSinkCallback& callback) { + const LayerTreeFrameSinkCallback& callback) { const base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); if (command_line.HasSwitch(switches::kDisableGpuCompositing)) @@ -1949,7 +1949,7 @@ return; } RendererWindowTreeClient::Get(routing_id) - ->RequestCompositorFrameSink( + ->RequestLayerTreeFrameSink( gpu_->CreateContextProvider(std::move(channel)), GetGpuMemoryBufferManager(), callback); return; @@ -1970,7 +1970,7 @@ DCHECK(!layout_test_mode()); frame_sink_provider_->CreateForWidget(routing_id, std::move(sink_request), std::move(client)); - callback.Run(base::MakeUnique<viz::ClientCompositorFrameSink>( + callback.Run(base::MakeUnique<viz::ClientLayerTreeFrameSink>( std::move(vulkan_context_provider), std::move(synthetic_begin_frame_source), std::move(sink_info), std::move(client_request), @@ -2000,7 +2000,7 @@ DCHECK(!layout_test_mode()); frame_sink_provider_->CreateForWidget(routing_id, std::move(sink_request), std::move(client)); - callback.Run(base::MakeUnique<viz::ClientCompositorFrameSink>( + callback.Run(base::MakeUnique<viz::ClientLayerTreeFrameSink>( nullptr, nullptr, nullptr, shared_bitmap_manager(), std::move(synthetic_begin_frame_source), std::move(sink_info), std::move(client_request), @@ -2051,7 +2051,7 @@ ui::command_buffer_metrics::RENDER_COMPOSITOR_CONTEXT)); if (layout_test_deps_) { - callback.Run(layout_test_deps_->CreateCompositorFrameSink( + callback.Run(layout_test_deps_->CreateLayerTreeFrameSink( routing_id, std::move(gpu_channel_host), std::move(context_provider), std::move(worker_context_provider), GetGpuMemoryBufferManager(), this)); return; @@ -2063,10 +2063,10 @@ synthetic_begin_frame_source ? std::move(synthetic_begin_frame_source) : CreateExternalBeginFrameSource(routing_id); - callback.Run(base::MakeUnique<SynchronousCompositorFrameSink>( + callback.Run(base::MakeUnique<SynchronousLayerTreeFrameSink>( std::move(context_provider), std::move(worker_context_provider), GetGpuMemoryBufferManager(), shared_bitmap_manager(), routing_id, - g_next_compositor_frame_sink_id++, std::move(begin_frame_source), + g_next_layer_tree_frame_sink_id++, std::move(begin_frame_source), sync_compositor_message_filter_.get(), std::move(frame_swap_message_queue))); return; @@ -2074,7 +2074,7 @@ #endif frame_sink_provider_->CreateForWidget(routing_id, std::move(sink_request), std::move(client)); - callback.Run(base::MakeUnique<viz::ClientCompositorFrameSink>( + callback.Run(base::MakeUnique<viz::ClientLayerTreeFrameSink>( std::move(context_provider), std::move(worker_context_provider), GetGpuMemoryBufferManager(), nullptr, std::move(synthetic_begin_frame_source), std::move(sink_info),
diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h index 23f3aee7..8520704 100644 --- a/content/renderer/render_thread_impl.h +++ b/content/renderer/render_thread_impl.h
@@ -81,7 +81,7 @@ namespace cc { class BeginFrameSource; -class CompositorFrameSink; +class LayerTreeFrameSink; class SyntheticBeginFrameSource; class TaskGraphRunner; } @@ -266,14 +266,14 @@ gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager(); - using CompositorFrameSinkCallback = - base::Callback<void(std::unique_ptr<cc::CompositorFrameSink>)>; - void RequestNewCompositorFrameSink( + using LayerTreeFrameSinkCallback = + base::Callback<void(std::unique_ptr<cc::LayerTreeFrameSink>)>; + void RequestNewLayerTreeFrameSink( bool use_software, int routing_id, scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue, const GURL& url, - const CompositorFrameSinkCallback& callback); + const LayerTreeFrameSinkCallback& callback); AssociatedInterfaceRegistry* GetAssociatedInterfaceRegistry();
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc index 0577102e..2467953 100644 --- a/content/renderer/render_widget.cc +++ b/content/renderer/render_widget.cc
@@ -26,8 +26,8 @@ #include "build/build_config.h" #include "cc/animation/animation_host.h" #include "cc/input/touch_action.h" -#include "cc/output/compositor_frame_sink.h" #include "cc/output/copy_output_request.h" +#include "cc/output/layer_tree_frame_sink.h" #include "cc/scheduler/begin_frame_source.h" #include "cc/trees/layer_tree_host.h" #include "content/common/content_switches_internal.h" @@ -910,14 +910,14 @@ GetWebWidget()->BeginFrame(frame_time_sec); } -void RenderWidget::RequestNewCompositorFrameSink( +void RenderWidget::RequestNewLayerTreeFrameSink( bool fallback, - const CompositorFrameSinkCallback& callback) { + const LayerTreeFrameSinkCallback& callback) { DCHECK(GetWebWidget()); // For widgets that are never visible, we don't start the compositor, so we - // never get a request for a cc::CompositorFrameSink. + // never get a request for a cc::LayerTreeFrameSink. DCHECK(!compositor_never_visible_); - RenderThreadImpl::current()->RequestNewCompositorFrameSink( + RenderThreadImpl::current()->RequestNewLayerTreeFrameSink( fallback, routing_id_, frame_swap_message_queue_, GetURLForGraphicsContext3D(), callback); } @@ -1320,7 +1320,7 @@ compositor_->SetContentSourceId(current_content_source_id_); compositor_->SetLocalSurfaceId(local_surface_id_); // For background pages and certain tests, we don't want to trigger - // CompositorFrameSink creation. + // LayerTreeFrameSink creation. bool should_generate_frame_sink = !compositor_never_visible_ && RenderThreadImpl::current(); if (!should_generate_frame_sink)
diff --git a/content/renderer/render_widget.h b/content/renderer/render_widget.h index ac63c77..68706214 100644 --- a/content/renderer/render_widget.h +++ b/content/renderer/render_widget.h
@@ -241,9 +241,9 @@ void RecordWheelAndTouchScrollingCount(bool has_scrolled_by_wheel, bool has_scrolled_by_touch) override; void BeginMainFrame(double frame_time_sec) override; - void RequestNewCompositorFrameSink( + void RequestNewLayerTreeFrameSink( bool fallback, - const CompositorFrameSinkCallback& callback) override; + const LayerTreeFrameSinkCallback& callback) override; void DidCommitAndDrawCompositorFrame() override; void DidCommitCompositorFrame() override; void DidCompletePageScaleAnimation() override;
diff --git a/content/renderer/screen_orientation/screen_orientation_dispatcher_browsertest.cc b/content/renderer/screen_orientation/screen_orientation_dispatcher_browsertest.cc index 9f273ca5..5fec7fb 100644 --- a/content/renderer/screen_orientation/screen_orientation_dispatcher_browsertest.cc +++ b/content/renderer/screen_orientation/screen_orientation_dispatcher_browsertest.cc
@@ -51,7 +51,7 @@ LockOrientationResultHolder* results_; }; -// TODO(lunalu): When available, test mojo service without needing a +// TODO(loonybear): When available, test mojo service without needing a // RenderViewTest. class ScreenOrientationDispatcherTest : public RenderViewTest { protected:
diff --git a/content/test/layouttest_support.cc b/content/test/layouttest_support.cc index a3aa9a0..64cbf87 100644 --- a/content/test/layouttest_support.cc +++ b/content/test/layouttest_support.cc
@@ -16,7 +16,7 @@ #include "cc/base/switches.h" #include "cc/output/copy_output_request.h" #include "cc/test/pixel_test_output_surface.h" -#include "cc/test/test_compositor_frame_sink.h" +#include "cc/test/test_layer_tree_frame_sink.h" #include "content/browser/bluetooth/bluetooth_device_chooser_controller.h" #include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_widget_host_impl.h" @@ -286,24 +286,24 @@ // request at SwapBuffers time. class CopyRequestSwapPromise : public cc::SwapPromise { public: - using FindCompositorFrameSinkCallback = - base::Callback<cc::TestCompositorFrameSink*()>; + using FindLayerTreeFrameSinkCallback = + base::Callback<cc::TestLayerTreeFrameSink*()>; CopyRequestSwapPromise( std::unique_ptr<cc::CopyOutputRequest> request, - FindCompositorFrameSinkCallback find_compositor_frame_sink_callback) + FindLayerTreeFrameSinkCallback find_layer_tree_frame_sink_callback) : copy_request_(std::move(request)), - find_compositor_frame_sink_callback_( - std::move(find_compositor_frame_sink_callback)) {} + find_layer_tree_frame_sink_callback_( + std::move(find_layer_tree_frame_sink_callback)) {} // cc::SwapPromise implementation. void OnCommit() override { - compositor_frame_sink_from_commit_ = - find_compositor_frame_sink_callback_.Run(); - DCHECK(compositor_frame_sink_from_commit_); + layer_tree_frame_sink_from_commit_ = + find_layer_tree_frame_sink_callback_.Run(); + DCHECK(layer_tree_frame_sink_from_commit_); } void DidActivate() override {} void WillSwap(cc::CompositorFrameMetadata*) override { - compositor_frame_sink_from_commit_->RequestCopyOfOutput( + layer_tree_frame_sink_from_commit_->RequestCopyOfOutput( std::move(copy_request_)); } void DidSwap() override {} @@ -316,25 +316,25 @@ private: std::unique_ptr<cc::CopyOutputRequest> copy_request_; - FindCompositorFrameSinkCallback find_compositor_frame_sink_callback_; - cc::TestCompositorFrameSink* compositor_frame_sink_from_commit_ = nullptr; + FindLayerTreeFrameSinkCallback find_layer_tree_frame_sink_callback_; + cc::TestLayerTreeFrameSink* layer_tree_frame_sink_from_commit_ = nullptr; }; } // namespace class LayoutTestDependenciesImpl : public LayoutTestDependencies, - public cc::TestCompositorFrameSinkClient { + public cc::TestLayerTreeFrameSinkClient { public: - std::unique_ptr<cc::CompositorFrameSink> CreateCompositorFrameSink( + std::unique_ptr<cc::LayerTreeFrameSink> CreateLayerTreeFrameSink( int32_t routing_id, scoped_refptr<gpu::GpuChannelHost> gpu_channel, scoped_refptr<cc::ContextProvider> compositor_context_provider, scoped_refptr<cc::ContextProvider> worker_context_provider, gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, CompositorDependencies* deps) override { - // This could override the GpuChannel for a CompositorFrameSink that was + // This could override the GpuChannel for a LayerTreeFrameSink that was // previously being created but in that case the old GpuChannel would be - // lost as would the CompositorFrameSink. + // lost as would the LayerTreeFrameSink. gpu_channel_ = gpu_channel; auto* task_runner = deps->GetCompositorImplThreadTaskRunner().get(); @@ -352,33 +352,33 @@ constexpr bool disable_display_vsync = false; constexpr double refresh_rate = 60.0; - auto compositor_frame_sink = base::MakeUnique<cc::TestCompositorFrameSink>( + auto layer_tree_frame_sink = base::MakeUnique<cc::TestLayerTreeFrameSink>( std::move(compositor_context_provider), std::move(worker_context_provider), nullptr /* shared_bitmap_manager */, gpu_memory_buffer_manager, renderer_settings, task_runner, synchronous_composite, disable_display_vsync, refresh_rate); - compositor_frame_sink->SetClient(this); - compositor_frame_sinks_[routing_id] = compositor_frame_sink.get(); - return std::move(compositor_frame_sink); + layer_tree_frame_sink->SetClient(this); + layer_tree_frame_sinks_[routing_id] = layer_tree_frame_sink.get(); + return std::move(layer_tree_frame_sink); } std::unique_ptr<cc::SwapPromise> RequestCopyOfOutput( int32_t routing_id, std::unique_ptr<cc::CopyOutputRequest> request) override { - // Note that we can't immediately check compositor_frame_sinks_, since it + // Note that we can't immediately check layer_tree_frame_sinks_, since it // may not have been created yet. Instead, we wait until OnCommit to find - // the currently active CompositorFrameSink for the given RenderWidget + // the currently active LayerTreeFrameSink for the given RenderWidget // routing_id. return base::MakeUnique<CopyRequestSwapPromise>( std::move(request), base::Bind( - &LayoutTestDependenciesImpl::FindCompositorFrameSink, + &LayoutTestDependenciesImpl::FindLayerTreeFrameSink, // |this| will still be valid, because its lifetime is tied to // RenderThreadImpl, which outlives layout test execution. base::Unretained(this), routing_id)); } - // TestCompositorFrameSinkClient implementation. + // TestLayerTreeFrameSinkClient implementation. std::unique_ptr<cc::OutputSurface> CreateDisplayOutputSurface( scoped_refptr<cc::ContextProvider> compositor_context_provider) override { // This is for an offscreen context for the compositor. So the default @@ -419,17 +419,17 @@ void DisplayDidDrawAndSwap() override {} private: - cc::TestCompositorFrameSink* FindCompositorFrameSink(int32_t routing_id) { - auto it = compositor_frame_sinks_.find(routing_id); - return it == compositor_frame_sinks_.end() ? nullptr : it->second; + cc::TestLayerTreeFrameSink* FindLayerTreeFrameSink(int32_t routing_id) { + auto it = layer_tree_frame_sinks_.find(routing_id); + return it == layer_tree_frame_sinks_.end() ? nullptr : it->second; } // Entries are not removed, so this map can grow. However, it is only used in // layout tests, so this memory usage does not occur in production. // Entries in this map will outlive the output surface, because this object is // owned by RenderThreadImpl, which outlives layout test execution. - std::unordered_map<int32_t, cc::TestCompositorFrameSink*> - compositor_frame_sinks_; + std::unordered_map<int32_t, cc::TestLayerTreeFrameSink*> + layer_tree_frame_sinks_; scoped_refptr<gpu::GpuChannelHost> gpu_channel_; };
diff --git a/google_apis/google_api_keys.cc b/google_apis/google_api_keys.cc index 015b254..2e8437ed 100644 --- a/google_apis/google_api_keys.cc +++ b/google_apis/google_api_keys.cc
@@ -34,10 +34,6 @@ #define GOOGLE_API_KEY DUMMY_API_TOKEN #endif -#if !defined(GOOGLE_API_KEY_REMOTING) -#define GOOGLE_API_KEY_REMOTING DUMMY_API_TOKEN -#endif - #if !defined(GOOGLE_CLIENT_ID_MAIN) #define GOOGLE_CLIENT_ID_MAIN DUMMY_API_TOKEN #endif @@ -115,14 +111,6 @@ api_key_non_stable_ = api_key_; #endif - api_key_remoting_ = - CalculateKeyValue(GOOGLE_API_KEY_REMOTING, - STRINGIZE_NO_EXPANSION(GOOGLE_API_KEY_REMOTING), - NULL, - std::string(), - environment.get(), - command_line); - std::string default_client_id = CalculateKeyValue(GOOGLE_DEFAULT_CLIENT_ID, STRINGIZE_NO_EXPANSION(GOOGLE_DEFAULT_CLIENT_ID), @@ -210,7 +198,6 @@ void set_api_key(const std::string& api_key) { api_key_ = api_key; } #endif std::string api_key_non_stable() const { return api_key_non_stable_; } - std::string api_key_remoting() const { return api_key_remoting_; } std::string GetClientID(OAuth2Client client) const { DCHECK_LT(client, CLIENT_NUM_ITEMS); @@ -306,7 +293,6 @@ std::string api_key_; std::string api_key_non_stable_; - std::string api_key_remoting_; std::string client_ids_[CLIENT_NUM_ITEMS]; std::string client_secrets_[CLIENT_NUM_ITEMS]; }; @@ -337,10 +323,6 @@ return g_api_key_cache.Get().api_key_non_stable(); } -std::string GetRemotingAPIKey() { - return g_api_key_cache.Get().api_key_remoting(); -} - #if defined(OS_IOS) void SetAPIKey(const std::string& api_key) { g_api_key_cache.Get().set_api_key(api_key);
diff --git a/google_apis/google_api_keys.h b/google_apis/google_api_keys.h index fb92868..997590a5 100644 --- a/google_apis/google_api_keys.h +++ b/google_apis/google_api_keys.h
@@ -71,8 +71,6 @@ // Non-stable channels may have a different Google API key. std::string GetNonStableAPIKey(); -std::string GetRemotingAPIKey(); - #if defined(OS_IOS) // Sets the API key. This should be called as early as possible before this // API key is even accessed.
diff --git a/google_apis/google_api_keys.py b/google_apis/google_api_keys.py index 0f98c79..8e528f2a 100755 --- a/google_apis/google_api_keys.py +++ b/google_apis/google_api_keys.py
@@ -75,11 +75,6 @@ return _GetToken('GOOGLE_API_KEY_PHYSICAL_WEB_TEST') -def GetAPIKeyRemoting(): - """Returns the simple API key.""" - return _GetToken('GOOGLE_API_KEY_REMOTING') - - def GetClientID(client_name): """Returns the OAuth 2.0 client ID for the client of the given name.""" return _GetToken('GOOGLE_CLIENT_ID_%s' % client_name) @@ -92,7 +87,6 @@ if __name__ == "__main__": print 'GOOGLE_API_KEY=%s' % GetAPIKey() - print 'GOOGLE_API_KEY_REMOTING=%s' % GetAPIKeyRemoting() print 'GOOGLE_CLIENT_ID_MAIN=%s' % GetClientID('MAIN') print 'GOOGLE_CLIENT_SECRET_MAIN=%s' % GetClientSecret('MAIN') print 'GOOGLE_CLIENT_ID_CLOUD_PRINT=%s' % GetClientID('CLOUD_PRINT')
diff --git a/gpu/command_buffer/service/context_state.cc b/gpu/command_buffer/service/context_state.cc index 3c71d38..640901ab 100644 --- a/gpu/command_buffer/service/context_state.cc +++ b/gpu/command_buffer/service/context_state.cc
@@ -285,10 +285,12 @@ const ContextState* prev_state) const { if (!feature_info_->IsES3Capable()) return; + CHECK_LT(unit, sampler_units.size()); const scoped_refptr<Sampler>& cur_sampler = sampler_units[unit]; GLuint cur_id = cur_sampler ? cur_sampler->service_id() : 0; GLuint prev_id = 0; if (prev_state) { + CHECK_LT(unit, prev_state->sampler_units.size()); const scoped_refptr<Sampler>& prev_sampler = prev_state->sampler_units[unit]; prev_id = prev_sampler ? prev_sampler->service_id() : 0;
diff --git a/ios/chrome/app/strings/ios_strings.grd b/ios/chrome/app/strings/ios_strings.grd index b1f5fb2..4d53719 100644 --- a/ios/chrome/app/strings/ios_strings.grd +++ b/ios/chrome/app/strings/ios_strings.grd
@@ -1426,6 +1426,9 @@ <message name="IDS_IOS_TOOLBAR_SHOW_TABS" desc="The accessibility label for the toolbar show tabs button [iOS only]."> Show Tabs </message> + <message name="IDS_IOS_TOOLBAR_SHOW_TAB_GRID" desc="The accessibility label for the toolbar show tab grid button [iOS only]."> + Show Tab Grid + </message> <message name="IDS_IOS_TOOLS_MENU" desc="The accessibility label for the iOS tools menu [iOS only]"> Tools Menu </message>
diff --git a/ios/clean/chrome/browser/ui/toolbar/BUILD.gn b/ios/clean/chrome/browser/ui/toolbar/BUILD.gn index af92896..bf72de3 100644 --- a/ios/clean/chrome/browser/ui/toolbar/BUILD.gn +++ b/ios/clean/chrome/browser/ui/toolbar/BUILD.gn
@@ -59,8 +59,11 @@ ] deps = [ "//base", + "//components/strings", + "//ios/chrome/app/strings", "//ios/chrome/app/theme", "//ios/chrome/browser/ui", + "//ui/base", ] libs = [ "UIKit.framework" ] configs += [ "//build/config/compiler:enable_arc" ]
diff --git a/ios/clean/chrome/browser/ui/toolbar/toolbar_button+factory.mm b/ios/clean/chrome/browser/ui/toolbar/toolbar_button+factory.mm index adfc4ce..ba328798 100644 --- a/ios/clean/chrome/browser/ui/toolbar/toolbar_button+factory.mm +++ b/ios/clean/chrome/browser/ui/toolbar/toolbar_button+factory.mm
@@ -4,9 +4,12 @@ #import "ios/clean/chrome/browser/ui/toolbar/toolbar_button+factory.h" +#include "components/strings/grit/components_strings.h" #import "ios/chrome/browser/ui/rtl_geometry.h" #import "ios/chrome/browser/ui/uikit_ui_util.h" +#include "ios/chrome/grit/ios_strings.h" #include "ios/chrome/grit/ios_theme_resources.h" +#include "ui/base/l10n/l10n_util.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -26,6 +29,7 @@ imageForDisabledState: NativeReversableImage( IDR_IOS_TOOLBAR_LIGHT_BACK_DISABLED, YES)]; + backButton.accessibilityLabel = l10n_util::GetNSString(IDS_ACCNAME_BACK); return backButton; } @@ -40,6 +44,8 @@ imageForDisabledState: NativeReversableImage( IDR_IOS_TOOLBAR_LIGHT_FORWARD_DISABLED, YES)]; + forwardButton.accessibilityLabel = + l10n_util::GetNSString(IDS_ACCNAME_FORWARD); return forwardButton; } @@ -51,6 +57,8 @@ NativeImage(IDR_IOS_TOOLBAR_LIGHT_OVERVIEW_PRESSED) imageForDisabledState: NativeImage(IDR_IOS_TOOLBAR_LIGHT_OVERVIEW_DISABLED)]; + tabSwitcherStripButton.accessibilityLabel = + l10n_util::GetNSString(IDS_IOS_TOOLBAR_SHOW_TABS); return tabSwitcherStripButton; } @@ -60,6 +68,8 @@ [UIImage imageNamed:@"tabswitcher_tab_switcher_button"] imageForHighlightedState:nil imageForDisabledState:nil]; + tabSwitcherGridButton.accessibilityLabel = + l10n_util::GetNSString(IDS_IOS_TOOLBAR_SHOW_TAB_GRID); return tabSwitcherGridButton; } @@ -71,6 +81,8 @@ NativeImage(IDR_IOS_TOOLBAR_LIGHT_TOOLS_PRESSED) imageForDisabledState:nil]; [toolsMenuButton setImageEdgeInsets:UIEdgeInsetsMakeDirected(0, -3, 0, 0)]; + toolsMenuButton.accessibilityLabel = + l10n_util::GetNSString(IDS_IOS_TOOLBAR_SETTINGS); return toolsMenuButton; } @@ -82,6 +94,8 @@ NativeImage(IDR_IOS_TOOLBAR_LIGHT_SHARE_PRESSED) imageForDisabledState: NativeImage(IDR_IOS_TOOLBAR_LIGHT_SHARE_DISABLED)]; + shareButton.accessibilityLabel = + l10n_util::GetNSString(IDS_IOS_TOOLS_MENU_SHARE); return shareButton; } @@ -96,6 +110,8 @@ imageForDisabledState: NativeReversableImage( IDR_IOS_TOOLBAR_LIGHT_RELOAD_DISABLED, YES)]; + reloadButton.accessibilityLabel = + l10n_util::GetNSString(IDS_IOS_ACCNAME_RELOAD); return reloadButton; } @@ -107,6 +123,7 @@ NativeImage(IDR_IOS_TOOLBAR_LIGHT_STOP_PRESSED) imageForDisabledState: NativeImage(IDR_IOS_TOOLBAR_LIGHT_STOP_DISABLED)]; + stopButton.accessibilityLabel = l10n_util::GetNSString(IDS_IOS_ACCNAME_STOP); return stopButton; } @@ -117,6 +134,7 @@ imageForHighlightedState: NativeImage(IDR_IOS_TOOLBAR_LIGHT_STAR_PRESSED) imageForDisabledState:nil]; + starButton.accessibilityLabel = l10n_util::GetNSString(IDS_TOOLTIP_STAR); return starButton; }
diff --git a/ios/showcase/BUILD.gn b/ios/showcase/BUILD.gn index 7b349e7..a086611c 100644 --- a/ios/showcase/BUILD.gn +++ b/ios/showcase/BUILD.gn
@@ -60,6 +60,7 @@ "//ios/showcase/root:eg_tests", "//ios/showcase/tab:eg_tests", "//ios/showcase/tab_grid:eg_tests", + "//ios/showcase/toolbar:eg_tests", # All shared libraries must have the sanitizer deps to properly link in # asan mode (this target will be empty in other cases).
diff --git a/ios/showcase/toolbar/BUILD.gn b/ios/showcase/toolbar/BUILD.gn index 223a3d11..c007f41c 100644 --- a/ios/showcase/toolbar/BUILD.gn +++ b/ios/showcase/toolbar/BUILD.gn
@@ -15,3 +15,20 @@ libs = [ "UIKit.framework" ] configs += [ "//build/config/compiler:enable_arc" ] } + +source_set("eg_tests") { + testonly = true + sources = [ + "sc_toolbar_egtest.mm", + ] + deps = [ + "//components/strings", + "//ios/chrome/app/strings", + "//ios/chrome/browser/ui", + "//ios/chrome/test/earl_grey:test_support", + "//ios/showcase/test", + "//ios/third_party/earl_grey", + "//ui/base", + ] + configs += [ "//build/config/compiler:enable_arc" ] +}
diff --git a/ios/showcase/toolbar/sc_toolbar_coordinator.mm b/ios/showcase/toolbar/sc_toolbar_coordinator.mm index 20de4f8..23fbaf2 100644 --- a/ios/showcase/toolbar/sc_toolbar_coordinator.mm +++ b/ios/showcase/toolbar/sc_toolbar_coordinator.mm
@@ -44,11 +44,11 @@ containerView.backgroundColor = [UIColor redColor]; containerView.translatesAutoresizingMaskIntoConstraints = NO; - ToolbarViewController* toolbarViewController = - [[ToolbarViewController alloc] init]; - toolbarViewController.dispatcher = + id dispatcher = static_cast<id<NavigationCommands, TabGridCommands, TabStripCommands, ToolsMenuCommands>>(self.alerter); + ToolbarViewController* toolbarViewController = + [[ToolbarViewController alloc] initWithDispatcher:dispatcher]; [containerViewController addChildViewController:toolbarViewController]; toolbarViewController.view.frame = containerView.frame; [containerView addSubview:toolbarViewController.view];
diff --git a/ios/showcase/toolbar/sc_toolbar_egtest.mm b/ios/showcase/toolbar/sc_toolbar_egtest.mm new file mode 100644 index 0000000..d5808b3d --- /dev/null +++ b/ios/showcase/toolbar/sc_toolbar_egtest.mm
@@ -0,0 +1,214 @@ +// 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 <EarlGrey/EarlGrey.h> + +#include "components/strings/grit/components_strings.h" +#import "ios/chrome/browser/ui/uikit_ui_util.h" +#include "ios/chrome/grit/ios_strings.h" +#import "ios/chrome/test/earl_grey/accessibility_util.h" +#import "ios/showcase/test/showcase_eg_utils.h" +#import "ios/showcase/test/showcase_test_case.h" +#include "ui/base/l10n/l10n_util.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +namespace { +using ::showcase_utils::Open; +using ::showcase_utils::Close; +} + +// Tests for the toolbar view controller. +@interface SCToolbarTestCase : ShowcaseTestCase +@end + +@implementation SCToolbarTestCase + +- (void)setUp { + [super setUp]; + Open(@"ToolbarViewController"); +} + +- (void)tearDown { + Close(); + if ([UIDevice currentDevice].orientation != UIDeviceOrientationPortrait) { + [EarlGrey rotateDeviceToOrientation:UIDeviceOrientationPortrait + errorOrNil:nil]; + } + [super tearDown]; +} + +// Tests if the Toolbar buttons have the right accessibility labels and +// commands. +- (void)testVerifyToolbarButtonsLabelAndAction { + // Buttons displayed in both Regular and Compact SizeClasses. + // Back Button. + [[EarlGrey + selectElementWithMatcher:grey_accessibilityLabel( + l10n_util::GetNSString(IDS_ACCNAME_BACK))] + performAction:grey_tap()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"goBack")] + assertWithMatcher:grey_notNil()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel( + @"protocol_alerter_done")] + performAction:grey_tap()]; + + // Forward Button. + [[EarlGrey + selectElementWithMatcher:grey_accessibilityLabel( + l10n_util::GetNSString(IDS_ACCNAME_FORWARD))] + performAction:grey_tap()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"goForward")] + assertWithMatcher:grey_notNil()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel( + @"protocol_alerter_done")] + performAction:grey_tap()]; + + // ShowTabStrip Button. + [[EarlGrey + selectElementWithMatcher:grey_accessibilityLabel(l10n_util::GetNSString( + IDS_IOS_TOOLBAR_SHOW_TABS))] + performAction:grey_tap()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"showTabStrip")] + assertWithMatcher:grey_notNil()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel( + @"protocol_alerter_done")] + performAction:grey_tap()]; + + // Menu Button. + [[EarlGrey + selectElementWithMatcher:grey_accessibilityLabel(l10n_util::GetNSString( + IDS_IOS_TOOLBAR_SETTINGS))] + performAction:grey_tap()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"showToolsMenu")] + assertWithMatcher:grey_notNil()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel( + @"protocol_alerter_done")] + performAction:grey_tap()]; + + // Buttons displayed only in Regular SizeClass. + if (!IsCompact()) { + // Share Button. + [[EarlGrey + selectElementWithMatcher:grey_accessibilityLabel(l10n_util::GetNSString( + IDS_IOS_TOOLS_MENU_SHARE))] + assertWithMatcher:grey_notNil()]; + + // Reload Button. + [[EarlGrey + selectElementWithMatcher:grey_accessibilityLabel(l10n_util::GetNSString( + IDS_IOS_ACCNAME_RELOAD))] + performAction:grey_tap()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"reloadPage")] + assertWithMatcher:grey_notNil()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel( + @"protocol_alerter_done")] + performAction:grey_tap()]; + + // Stop Button. + [[EarlGrey + selectElementWithMatcher:grey_accessibilityLabel(l10n_util::GetNSString( + IDS_IOS_ACCNAME_STOP))] + performAction:grey_tap()]; + [[EarlGrey + selectElementWithMatcher:grey_accessibilityLabel(@"stopLoadingPage")] + assertWithMatcher:grey_notNil()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel( + @"protocol_alerter_done")] + performAction:grey_tap()]; + } +} + +// Tests that the Menu will be closed on rotation from portrait to landscape and +// viceversa. +- (void)testRotation { + // TODO(crbug.com/652464): Enable the test for iPad when rotation bug is + // fixed. + if (IsIPadIdiom()) { + EARL_GREY_TEST_DISABLED(@"Disabled for iPad due to device rotation bug."); + } + + // Rotate from portrait to landscape. + if ([EarlGrey rotateDeviceToOrientation:UIDeviceOrientationLandscapeRight + errorOrNil:nil]) { + [[EarlGrey + selectElementWithMatcher:grey_accessibilityLabel(@"closeToolsMenu")] + assertWithMatcher:grey_notNil()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel( + @"protocol_alerter_done")] + performAction:grey_tap()]; + + // If successful rotate back from landscape to portrait. + if ([EarlGrey rotateDeviceToOrientation:UIDeviceOrientationPortrait + errorOrNil:nil]) { + [[EarlGrey + selectElementWithMatcher:grey_accessibilityLabel(@"closeToolsMenu")] + assertWithMatcher:grey_notNil()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel( + @"protocol_alerter_done")] + performAction:grey_tap()]; + } + } +} + +// Tests that the Regular SizeClass buttons appear when a rotation causes a +// SizeClass change from Compact to Regular. E.g. iPhone Plus rotation from +// portrait to landscape and viceversa. +- (void)testRotationSizeClassChange { + // TODO(crbug.com/652464): Enable the test for iPad when rotation bug is + // fixed. + if (IsIPadIdiom()) { + EARL_GREY_TEST_DISABLED(@"Disabled for iPad due to device rotation bug."); + } + + // If currently on compact rotate to check if SizeClass changes to regular. + if (IsCompact()) { + if ([EarlGrey rotateDeviceToOrientation:UIDeviceOrientationLandscapeRight + errorOrNil:nil]) { + [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel( + @"protocol_alerter_done")] + performAction:grey_tap()]; + // If SizeClass is not compact after rotation, confirm that some + // ToolbarButtons are now visible. + if (!IsCompact()) { + [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel( + l10n_util::GetNSString( + IDS_IOS_TOOLS_MENU_SHARE))] + assertWithMatcher:grey_notNil()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel( + l10n_util::GetNSString( + IDS_IOS_ACCNAME_RELOAD))] + assertWithMatcher:grey_notNil()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel( + l10n_util::GetNSString( + IDS_IOS_ACCNAME_STOP))] + assertWithMatcher:grey_notNil()]; + // Going back to Compact Width. + if ([EarlGrey rotateDeviceToOrientation:UIDeviceOrientationPortrait + errorOrNil:nil]) { + [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel( + @"protocol_alerter_done")] + performAction:grey_tap()]; + [[EarlGrey + selectElementWithMatcher:grey_accessibilityLabel( + l10n_util::GetNSString( + IDS_IOS_TOOLS_MENU_SHARE))] + assertWithMatcher:grey_nil()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel( + l10n_util::GetNSString( + IDS_IOS_ACCNAME_RELOAD))] + assertWithMatcher:grey_nil()]; + [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel( + l10n_util::GetNSString( + IDS_IOS_ACCNAME_STOP))] + assertWithMatcher:grey_nil()]; + } + } + } + } +} + +@end
diff --git a/media/gpu/ipc/service/BUILD.gn b/media/gpu/ipc/service/BUILD.gn index 776b2e3..abb8396 100644 --- a/media/gpu/ipc/service/BUILD.gn +++ b/media/gpu/ipc/service/BUILD.gn
@@ -18,6 +18,8 @@ sources = [ "gpu_jpeg_decode_accelerator.cc", "gpu_jpeg_decode_accelerator.h", + "gpu_jpeg_decode_accelerator_factory_provider.cc", + "gpu_jpeg_decode_accelerator_factory_provider.h", "gpu_video_decode_accelerator.cc", "gpu_video_decode_accelerator.h", "gpu_video_encode_accelerator.cc",
diff --git a/media/gpu/ipc/service/gpu_jpeg_decode_accelerator.cc b/media/gpu/ipc/service/gpu_jpeg_decode_accelerator.cc index d1a64d7..1447fb8 100644 --- a/media/gpu/ipc/service/gpu_jpeg_decode_accelerator.cc +++ b/media/gpu/ipc/service/gpu_jpeg_decode_accelerator.cc
@@ -22,54 +22,11 @@ #include "gpu/ipc/service/gpu_channel.h" #include "ipc/ipc_message_macros.h" #include "ipc/message_filter.h" -#include "media/base/media_switches.h" -#include "media/filters/jpeg_parser.h" -#include "media/gpu/fake_jpeg_decode_accelerator.h" #include "media/gpu/ipc/common/media_messages.h" #include "ui/gfx/geometry/size.h" -#if defined(OS_CHROMEOS) -#if defined(ARCH_CPU_X86_FAMILY) -#include "media/gpu/vaapi_jpeg_decode_accelerator.h" -#endif -#if defined(USE_V4L2_CODEC) && defined(ARCH_CPU_ARM_FAMILY) -#include "media/gpu/v4l2_device.h" -#include "media/gpu/v4l2_jpeg_decode_accelerator.h" -#endif - -#endif - namespace { -std::unique_ptr<media::JpegDecodeAccelerator> CreateV4L2JDA( - scoped_refptr<base::SingleThreadTaskRunner> io_task_runner) { - std::unique_ptr<media::JpegDecodeAccelerator> decoder; -#if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) && \ - defined(ARCH_CPU_ARM_FAMILY) - scoped_refptr<media::V4L2Device> device = media::V4L2Device::Create(); - if (device) - decoder.reset(new media::V4L2JpegDecodeAccelerator( - device, std::move(io_task_runner))); -#endif - return decoder; -} - -std::unique_ptr<media::JpegDecodeAccelerator> CreateVaapiJDA( - scoped_refptr<base::SingleThreadTaskRunner> io_task_runner) { - std::unique_ptr<media::JpegDecodeAccelerator> decoder; -#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) - decoder.reset( - new media::VaapiJpegDecodeAccelerator(std::move(io_task_runner))); -#endif - return decoder; -} - -std::unique_ptr<media::JpegDecodeAccelerator> CreateFakeJDA( - scoped_refptr<base::SingleThreadTaskRunner> io_task_runner) { - return base::MakeUnique<media::FakeJpegDecodeAccelerator>( - std::move(io_task_runner)); -} - void DecodeFinished(std::unique_ptr<base::SharedMemory> shm) { // Do nothing. Because VideoFrame is backed by |shm|, the purpose of this // function is to just keep reference of |shm| to make sure it lives until @@ -332,34 +289,6 @@ ClientMap client_map_; }; -// static -bool GpuJpegDecodeAcceleratorFactoryProvider:: - IsAcceleratedJpegDecodeSupported() { - auto accelerator_factory_functions = GetAcceleratorFactories(); - for (const auto& create_jda_function : accelerator_factory_functions) { - std::unique_ptr<JpegDecodeAccelerator> accelerator = - create_jda_function.Run(base::ThreadTaskRunnerHandle::Get()); - if (accelerator && accelerator->IsSupported()) - return true; - } - return false; -} - -// static -std::vector<GpuJpegDecodeAcceleratorFactoryProvider::CreateAcceleratorCB> -GpuJpegDecodeAcceleratorFactoryProvider::GetAcceleratorFactories() { - // This list is ordered by priority of use. - std::vector<CreateAcceleratorCB> result; - if (base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kUseFakeJpegDecodeAccelerator)) { - result.push_back(base::Bind(&CreateFakeJDA)); - } else { - result.push_back(base::Bind(&CreateV4L2JDA)); - result.push_back(base::Bind(&CreateVaapiJDA)); - } - return result; -} - GpuJpegDecodeAccelerator::GpuJpegDecodeAccelerator( gpu::FilteredSender* channel, scoped_refptr<base::SingleThreadTaskRunner> io_task_runner)
diff --git a/media/gpu/ipc/service/gpu_jpeg_decode_accelerator.h b/media/gpu/ipc/service/gpu_jpeg_decode_accelerator.h index 811ad6e..736cb27 100644 --- a/media/gpu/ipc/service/gpu_jpeg_decode_accelerator.h +++ b/media/gpu/ipc/service/gpu_jpeg_decode_accelerator.h
@@ -16,6 +16,7 @@ #include "base/synchronization/waitable_event.h" #include "ipc/ipc_listener.h" #include "ipc/ipc_sender.h" +#include "media/gpu/ipc/service/gpu_jpeg_decode_accelerator_factory_provider.h" #include "media/gpu/mojo/jpeg_decoder.mojom.h" #include "media/video/jpeg_decode_accelerator.h" @@ -29,19 +30,6 @@ namespace media { -class GpuJpegDecodeAcceleratorFactoryProvider { - public: - using CreateAcceleratorCB = - base::Callback<std::unique_ptr<JpegDecodeAccelerator>( - scoped_refptr<base::SingleThreadTaskRunner>)>; - - // Static query for JPEG supported. This query calls the appropriate - // platform-specific version. - static bool IsAcceleratedJpegDecodeSupported(); - - static std::vector<CreateAcceleratorCB> GetAcceleratorFactories(); -}; - // TODO(c.padhi): Move GpuJpegDecodeAccelerator to media/gpu/mojo, see // http://crbug.com/699255. class GpuJpegDecodeAccelerator
diff --git a/media/gpu/ipc/service/gpu_jpeg_decode_accelerator_factory_provider.cc b/media/gpu/ipc/service/gpu_jpeg_decode_accelerator_factory_provider.cc new file mode 100644 index 0000000..710e4be --- /dev/null +++ b/media/gpu/ipc/service/gpu_jpeg_decode_accelerator_factory_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/gpu/ipc/service/gpu_jpeg_decode_accelerator_factory_provider.h" + +#include "base/bind.h" +#include "base/command_line.h" +#include "base/threading/thread_task_runner_handle.h" +#include "media/base/media_switches.h" +#include "media/gpu/fake_jpeg_decode_accelerator.h" + +#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) +#define USE_VAAPI_JDA +#endif + +#if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) && \ + defined(ARCH_CPU_ARM_FAMILY) +#define USE_V4L2_JDA +#endif + +#if defined(USE_VAAPI_JDA) +#include "media/gpu/vaapi_jpeg_decode_accelerator.h" +#endif + +#if defined(USE_V4L2_JDA) +#include "media/gpu/v4l2_device.h" +#include "media/gpu/v4l2_jpeg_decode_accelerator.h" +#endif + +namespace media { + +namespace { + +#if defined(USE_V4L2_JDA) +std::unique_ptr<JpegDecodeAccelerator> CreateV4L2JDA( + scoped_refptr<base::SingleThreadTaskRunner> io_task_runner) { + std::unique_ptr<JpegDecodeAccelerator> decoder; + scoped_refptr<V4L2Device> device = V4L2Device::Create(); + if (device) { + decoder.reset( + new V4L2JpegDecodeAccelerator(device, std::move(io_task_runner))); + } + return decoder; +} +#endif + +#if defined(USE_VAAPI_JDA) +std::unique_ptr<JpegDecodeAccelerator> CreateVaapiJDA( + scoped_refptr<base::SingleThreadTaskRunner> io_task_runner) { + return base::MakeUnique<VaapiJpegDecodeAccelerator>( + std::move(io_task_runner)); +} +#endif + +std::unique_ptr<JpegDecodeAccelerator> CreateFakeJDA( + scoped_refptr<base::SingleThreadTaskRunner> io_task_runner) { + return base::MakeUnique<FakeJpegDecodeAccelerator>(std::move(io_task_runner)); +} + +} // namespace + +// static +bool GpuJpegDecodeAcceleratorFactoryProvider:: + IsAcceleratedJpegDecodeSupported() { + auto accelerator_factory_functions = GetAcceleratorFactories(); + for (const auto& create_jda_function : accelerator_factory_functions) { + std::unique_ptr<JpegDecodeAccelerator> accelerator = + create_jda_function.Run(base::ThreadTaskRunnerHandle::Get()); + if (accelerator && accelerator->IsSupported()) + return true; + } + return false; +} + +// static +std::vector<GpuJpegDecodeAcceleratorFactoryProvider::CreateAcceleratorCB> +GpuJpegDecodeAcceleratorFactoryProvider::GetAcceleratorFactories() { + // This list is ordered by priority of use. + std::vector<CreateAcceleratorCB> result; + if (base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kUseFakeJpegDecodeAccelerator)) { + result.push_back(base::Bind(&CreateFakeJDA)); + } else { +#if defined(USE_V4L2_JDA) + result.push_back(base::Bind(&CreateV4L2JDA)); +#endif +#if defined(USE_VAAPI_JDA) + result.push_back(base::Bind(&CreateVaapiJDA)); +#endif + } + return result; +} + +} // namespace media
diff --git a/media/gpu/ipc/service/gpu_jpeg_decode_accelerator_factory_provider.h b/media/gpu/ipc/service/gpu_jpeg_decode_accelerator_factory_provider.h new file mode 100644 index 0000000..5d51d350 --- /dev/null +++ b/media/gpu/ipc/service/gpu_jpeg_decode_accelerator_factory_provider.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 MEDIA_GPU_IPC_SERVICE_GPU_JPEG_DECODE_ACCELERATOR_FACTORY_PROVIDER_H_ +#define MEDIA_GPU_IPC_SERVICE_GPU_JPEG_DECODE_ACCELERATOR_FACTORY_PROVIDER_H_ + +#include "base/memory/ref_counted.h" +#include "media/video/jpeg_decode_accelerator.h" + +namespace base { +class SingleThreadTaskRunner; +} + +namespace media { + +class GpuJpegDecodeAcceleratorFactoryProvider { + public: + using CreateAcceleratorCB = + base::Callback<std::unique_ptr<JpegDecodeAccelerator>( + scoped_refptr<base::SingleThreadTaskRunner>)>; + + // Static query for JPEG supported. This query calls the appropriate + // platform-specific version. + static bool IsAcceleratedJpegDecodeSupported(); + + static std::vector<CreateAcceleratorCB> GetAcceleratorFactories(); +}; + +} // namespace media + +#endif // MEDIA_GPU_IPC_SERVICE_GPU_JPEG_DECODE_ACCELERATOR_FACTORY_PROVIDER_H_ \ No newline at end of file
diff --git a/remoting/webapp/build-webapp.py b/remoting/webapp/build-webapp.py index 3df0f21..62b06896 100755 --- a/remoting/webapp/build-webapp.py +++ b/remoting/webapp/build-webapp.py
@@ -293,7 +293,6 @@ # For overriding the client ID/secret via env vars, see google_api_keys.py. apiClientId = google_api_keys.GetClientID('REMOTING') apiClientSecret = google_api_keys.GetClientSecret('REMOTING') - apiKey = google_api_keys.GetAPIKeyRemoting() apiClientIdV2 = os.environ.get( 'REMOTING_IDENTITY_API_CLIENT_ID', @@ -301,7 +300,6 @@ replaceString(destination, 'API_CLIENT_ID', apiClientId) replaceString(destination, 'API_CLIENT_SECRET', apiClientSecret) - replaceString(destination, 'API_KEY', apiKey) # Use a fixed key in the app manifest. For dev builds, this ensures that the # app can be run directly from the output directory. For official CRD builds,
diff --git a/services/resource_coordinator/BUILD.gn b/services/resource_coordinator/BUILD.gn index ab57a3c8..3abc921 100644 --- a/services/resource_coordinator/BUILD.gn +++ b/services/resource_coordinator/BUILD.gn
@@ -14,6 +14,8 @@ sources = [ "coordination_unit/coordination_unit_factory.cc", "coordination_unit/coordination_unit_factory.h", + "coordination_unit/coordination_unit_graph_observer.cc", + "coordination_unit/coordination_unit_graph_observer.h", "coordination_unit/coordination_unit_impl.cc", "coordination_unit/coordination_unit_impl.h", "coordination_unit/coordination_unit_manager.cc", @@ -58,6 +60,7 @@ testonly = true sources = [ + "coordination_unit/coordination_unit_graph_observer_unittest.cc", "coordination_unit/coordination_unit_impl_unittest.cc", "coordination_unit/coordination_unit_impl_unittest_util.cc", "coordination_unit/coordination_unit_impl_unittest_util.h",
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.cc b/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.cc new file mode 100644 index 0000000..fc69dab --- /dev/null +++ b/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.cc
@@ -0,0 +1,15 @@ +// 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 "services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h" + +#include "services/resource_coordinator/public/cpp/coordination_unit_types.h" + +namespace resource_coordinator { + +CoordinationUnitGraphObserver::CoordinationUnitGraphObserver() = default; + +CoordinationUnitGraphObserver::~CoordinationUnitGraphObserver() = default; + +} // namespace resource_coordinator
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h b/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h new file mode 100644 index 0000000..9f33e8d --- /dev/null +++ b/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h
@@ -0,0 +1,85 @@ +// 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 SERVICES_RESOURCE_COORDINATOR_COORDINATION_UNIT_COORDINATION_UNIT_GRAPH_OBSERVER_H_ +#define SERVICES_RESOURCE_COORDINATOR_COORDINATION_UNIT_COORDINATION_UNIT_GRAPH_OBSERVER_H_ + +#include <memory> +#include <unordered_map> + +#include "base/macros.h" +#include "services/resource_coordinator/coordination_unit/coordination_unit_impl.h" +#include "services/resource_coordinator/public/cpp/coordination_unit_id.h" +#include "services/resource_coordinator/public/cpp/coordination_unit_types.h" +#include "services/resource_coordinator/public/interfaces/coordination_unit.mojom.h" + +namespace resource_coordinator { + +// An observer API for the coordination unit graph maintained by GRC. +// +// Observers are instantiated when the resource_coordinator service +// is created and are destroyed when the resource_coordinator service +// is destroyed. Therefore observers are guaranteed to be alive before +// any coordination unit is created and will be alive after any +// coordination unit is destroyed. Additionally, any +// Coordination Unit reachable within a callback will always be +// initialized and valid. +// +// To create and install a new observer: +// (1) derive from this class +// (2) register in CoordinationUnitManager::RegisterObserver +// inside of CoordinationUnitManager::CoordinationUnitManager +class CoordinationUnitGraphObserver { + public: + CoordinationUnitGraphObserver(); + virtual ~CoordinationUnitGraphObserver(); + + // Determines whether or not the observer should be registered with, and + // invoked for, the |coordination_unit|. + virtual bool ShouldObserve(const CoordinationUnitImpl* coordination_unit) = 0; + + // Called whenever a CoordinationUnit is created. + virtual void OnCoordinationUnitCreated( + const CoordinationUnitImpl* coordination_unit) {} + + // Called whenever a new parent-child relationship occurs where the + // |coordination_unit| is the parent of |child_coordination_unit| + virtual void OnChildAdded( + const CoordinationUnitImpl* coordination_unit, + const CoordinationUnitImpl* child_coordination_unit) {} + + // Called whenever a new parent-child relationship occurs where the + // |coordination_unit| is the child of |parent_coordination_unit|. + virtual void OnParentAdded( + const CoordinationUnitImpl* coordination_unit, + const CoordinationUnitImpl* parent_coordination_unit) {} + + // Called whenever a |property| within the |coordination_unit|'s + // internal property store has changed. + virtual void OnPropertyChanged(const CoordinationUnitImpl* coordination_unit, + mojom::PropertyType property) {} + + // Called whenever parent-child relationship ends where the + // |coordination_unit| was the parent and the |child_coordination_unit|. + virtual void OnChildRemoved( + const CoordinationUnitImpl* coordination_unit, + const CoordinationUnitImpl* child_coordination_unit) {} + + // Called whenever parent-child relationship ends where the + // |coordination_unit| was the child and the |child_coordination_unit|. + virtual void OnParentRemoved( + const CoordinationUnitImpl* coordination_unit, + const CoordinationUnitImpl* parent_coordination_unit) {} + + // Called when the |coordination_unit| is about to be destroyed. + virtual void OnCoordinationUnitWillBeDestroyed( + const CoordinationUnitImpl* coordination_unit) {} + + private: + DISALLOW_COPY_AND_ASSIGN(CoordinationUnitGraphObserver); +}; + +} // namespace resource_coordinator + +#endif // SERVICES_RESOURCE_COORDINATOR_COORDINATION_UNIT_COORDINATION_UNIT_GRAPH_OBSERVER_H_
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer_unittest.cc b/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer_unittest.cc new file mode 100644 index 0000000..9d3e4be --- /dev/null +++ b/services/resource_coordinator/coordination_unit/coordination_unit_graph_observer_unittest.cc
@@ -0,0 +1,179 @@ +// 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 <string> +#include <utility> + +#include "base/memory/ptr_util.h" +#include "base/process/process_handle.h" +#include "base/run_loop.h" +#include "services/resource_coordinator/coordination_unit/coordination_unit_factory.h" +#include "services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h" +#include "services/resource_coordinator/coordination_unit/coordination_unit_impl.h" +#include "services/resource_coordinator/coordination_unit/coordination_unit_impl_unittest_util.h" +#include "services/resource_coordinator/coordination_unit/coordination_unit_manager.h" +#include "services/resource_coordinator/public/cpp/coordination_unit_id.h" +#include "services/resource_coordinator/public/cpp/coordination_unit_types.h" +#include "services/resource_coordinator/public/interfaces/coordination_unit.mojom.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace resource_coordinator { + +namespace { + +class CoordinationUnitGraphObserverTest : public CoordinationUnitImplTestBase { +}; + +class TestCoordinationUnitGraphObserver : public CoordinationUnitGraphObserver { + public: + TestCoordinationUnitGraphObserver() + : on_child_added_count_(0u), + on_parent_added_count_(0u), + on_coordination_unit_created_count_(0u), + on_property_changed_count_(0u), + on_child_removed_count_(0u), + on_parent_removed_count_(0u), + on_coordination_unit_will_be_destroyed_count_(0u) {} + + size_t on_child_added_count() { return on_child_added_count_; } + size_t on_parent_added_count() { return on_parent_added_count_; } + size_t on_coordination_unit_created_count() { + return on_coordination_unit_created_count_; + } + size_t on_property_changed_count() { return on_property_changed_count_; } + size_t on_child_removed_count() { return on_child_removed_count_; } + size_t on_parent_removed_count() { return on_parent_removed_count_; } + size_t on_coordination_unit_will_be_destroyed_count() { + return on_coordination_unit_will_be_destroyed_count_; + } + + // Overridden from CoordinationUnitGraphObserver. + bool ShouldObserve(const CoordinationUnitImpl* coordination_unit) override { + return coordination_unit->id().type == CoordinationUnitType::kFrame; + } + void OnCoordinationUnitCreated( + const CoordinationUnitImpl* coordination_unit) override { + ++on_coordination_unit_created_count_; + } + void OnChildAdded( + const CoordinationUnitImpl* coordination_unit, + const CoordinationUnitImpl* child_coordination_unit) override { + ++on_child_added_count_; + } + void OnParentAdded( + const CoordinationUnitImpl* coordination_unit, + const CoordinationUnitImpl* parent_coordination_unit) override { + ++on_parent_added_count_; + } + void OnPropertyChanged(const CoordinationUnitImpl* coordination_unit, + mojom::PropertyType property) override { + ++on_property_changed_count_; + } + void OnChildRemoved( + const CoordinationUnitImpl* coordination_unit, + const CoordinationUnitImpl* former_child_coordination_unit) override { + ++on_child_removed_count_; + } + void OnParentRemoved( + const CoordinationUnitImpl* coordination_unit, + const CoordinationUnitImpl* former_parent_coordination_unit) override { + ++on_parent_removed_count_; + } + void OnCoordinationUnitWillBeDestroyed( + const CoordinationUnitImpl* coordination_unit) override { + ++on_coordination_unit_will_be_destroyed_count_; + } + + private: + size_t on_child_added_count_; + size_t on_parent_added_count_; + size_t on_coordination_unit_created_count_; + size_t on_property_changed_count_; + size_t on_child_removed_count_; + size_t on_parent_removed_count_; + size_t on_coordination_unit_will_be_destroyed_count_; +}; + +} // namespace + +TEST_F(CoordinationUnitGraphObserverTest, CallbacksInvokedNoFilters) { + EXPECT_TRUE(coordination_unit_manager().observers_for_testing().empty()); + coordination_unit_manager().RegisterObserver( + base::MakeUnique<TestCoordinationUnitGraphObserver>()); + EXPECT_EQ(1u, coordination_unit_manager().observers_for_testing().size()); + + TestCoordinationUnitGraphObserver* observer = + static_cast<TestCoordinationUnitGraphObserver*>( + coordination_unit_manager().observers_for_testing()[0].get()); + + CoordinationUnitID process_cu_id(CoordinationUnitType::kProcess, + std::string()); + CoordinationUnitID root_frame_cu_id(CoordinationUnitType::kFrame, + std::string()); + CoordinationUnitID frame_cu_id(CoordinationUnitType::kFrame, std::string()); + + std::unique_ptr<CoordinationUnitImpl> process_coordination_unit = + coordination_unit_factory::CreateCoordinationUnit( + process_cu_id, service_context_ref_factory()->CreateRef()); + std::unique_ptr<CoordinationUnitImpl> root_frame_coordination_unit = + coordination_unit_factory::CreateCoordinationUnit( + root_frame_cu_id, service_context_ref_factory()->CreateRef()); + std::unique_ptr<CoordinationUnitImpl> frame_coordination_unit = + coordination_unit_factory::CreateCoordinationUnit( + frame_cu_id, service_context_ref_factory()->CreateRef()); + + coordination_unit_manager().OnCoordinationUnitCreated( + process_coordination_unit.get()); + coordination_unit_manager().OnCoordinationUnitCreated( + root_frame_coordination_unit.get()); + coordination_unit_manager().OnCoordinationUnitCreated( + frame_coordination_unit.get()); + EXPECT_EQ(2u, observer->on_coordination_unit_created_count()); + + // The registered observer will only observe the events that happen to + // |root_frame_coordination_unit| and |frame_coordination_unit| because + // they are CoordinationUnitType::kFrame. + // OnAddParent will called for |root_frame_coordination_unit|. + process_coordination_unit->AddChild(root_frame_coordination_unit->id()); + // OnAddParent will called for |frame_coordination_unit|. + process_coordination_unit->AddChild(frame_coordination_unit->id()); + // OnAddChild will called for |root_frame_coordination_unit| and + // OnAddParent will called for |frame_coordination_unit|. + root_frame_coordination_unit->AddChild(frame_coordination_unit->id()); + EXPECT_EQ(1u, observer->on_child_added_count()); + EXPECT_EQ(3u, observer->on_parent_added_count()); + + // The registered observer will only observe the events that happen to + // |root_frame_coordination_unit| and |frame_coordination_unit| because + // they are CoordinationUnitType::kFrame. + // OnRemoveParent will called for |root_frame_coordination_unit|. + process_coordination_unit->RemoveChild(root_frame_coordination_unit->id()); + // OnRemoveParent will called for |frame_coordination_unit|. + process_coordination_unit->RemoveChild(frame_coordination_unit->id()); + // OnRemoveChild will called for |root_frame_coordination_unit| and + // OnRemoveParent will called for |frame_coordination_unit|. + root_frame_coordination_unit->RemoveChild(frame_coordination_unit->id()); + EXPECT_EQ(1u, observer->on_child_removed_count()); + EXPECT_EQ(3u, observer->on_parent_removed_count()); + + // The registered observer will only observe the events that happen to + // |root_frame_coordination_unit| and |frame_coordination_unit| because + // they are CoordinationUnitType::kFrame, so OnPropertyChanged + // will only be called for |root_frame_coordination_unit|. + root_frame_coordination_unit->SetProperty(mojom::PropertyType::kTest, + base::Value(42)); + process_coordination_unit->SetProperty(mojom::PropertyType::kTest, + base::Value(42)); + EXPECT_EQ(1u, observer->on_property_changed_count()); + + coordination_unit_manager().OnCoordinationUnitWillBeDestroyed( + process_coordination_unit.get()); + coordination_unit_manager().OnCoordinationUnitWillBeDestroyed( + root_frame_coordination_unit.get()); + coordination_unit_manager().OnCoordinationUnitWillBeDestroyed( + frame_coordination_unit.get()); + EXPECT_EQ(2u, observer->on_coordination_unit_will_be_destroyed_count()); +} + +} // namespace resource_coordinator
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_impl.cc b/services/resource_coordinator/coordination_unit/coordination_unit_impl.cc index b50d98fc..277e110 100644 --- a/services/resource_coordinator/coordination_unit/coordination_unit_impl.cc +++ b/services/resource_coordinator/coordination_unit/coordination_unit_impl.cc
@@ -10,6 +10,7 @@ #include "base/strings/string_number_conversions.h" #include "mojo/public/cpp/bindings/strong_binding.h" +#include "services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h" #include "services/resource_coordinator/public/cpp/coordination_unit_id.h" namespace resource_coordinator { @@ -157,7 +158,16 @@ // We don't recalculate the policy here as policies are only dependent // on the current CU or its parents, not its children. In other words, // policies only bubble down. - return children_.count(child) ? false : children_.insert(child).second; + bool success = + children_.count(child) ? false : children_.insert(child).second; + + if (success) { + for (auto& observer : observers_) { + observer.OnChildAdded(this, child); + } + } + + return success; } void CoordinationUnitImpl::RemoveChild(const CoordinationUnitID& child_id) { @@ -181,13 +191,25 @@ bool CoordinationUnitImpl::RemoveChild(CoordinationUnitImpl* child) { size_t children_removed = children_.erase(child); - return children_removed > 0; + bool success = children_removed > 0; + + if (success) { + for (auto& observer : observers_) { + observer.OnChildRemoved(this, child); + } + } + + return success; } void CoordinationUnitImpl::AddParent(CoordinationUnitImpl* parent) { DCHECK_EQ(0u, parents_.count(parent)); parents_.insert(parent); + for (auto& observer : observers_) { + observer.OnParentAdded(this, parent); + } + RecalcCoordinationPolicy(); } @@ -195,6 +217,12 @@ size_t parents_removed = parents_.erase(parent); DCHECK_EQ(1u, parents_removed); + // TODO(matthalp, oysteine) should this go before or + // after RecalcCoordinationPolicy? + for (auto& observer : observers_) { + observer.OnParentRemoved(this, parent); + } + RecalcCoordinationPolicy(); } @@ -238,7 +266,8 @@ return kCPUUsageUnmeasuredForTesting; } -base::Value CoordinationUnitImpl::GetProperty(mojom::PropertyType property) { +base::Value CoordinationUnitImpl::GetProperty( + mojom::PropertyType property) const { auto value_it = property_store_.find(property); return value_it != property_store_.end() ? value_it->second : base::Value(); @@ -262,6 +291,26 @@ } property_store_[property] = value; + + for (auto& observer : observers_) { + observer.OnPropertyChanged(this, property); + } +} + +void CoordinationUnitImpl::WillBeDestroyed() { + for (auto& observer : observers_) { + observer.OnCoordinationUnitWillBeDestroyed(this); + } +} + +void CoordinationUnitImpl::AddObserver( + CoordinationUnitGraphObserver* observer) { + observers_.AddObserver(observer); +} + +void CoordinationUnitImpl::RemoveObserver( + CoordinationUnitGraphObserver* observer) { + observers_.RemoveObserver(observer); } } // namespace resource_coordinator
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_impl.h b/services/resource_coordinator/coordination_unit/coordination_unit_impl.h index 94ebb044..af6e92fff 100644 --- a/services/resource_coordinator/coordination_unit/coordination_unit_impl.h +++ b/services/resource_coordinator/coordination_unit/coordination_unit_impl.h
@@ -6,23 +6,30 @@ #define SERVICES_RESOURCE_COORDINATOR_COORDINATION_UNIT_COORDINATION_UNIT_IMPL_H_ #include <list> +#include <map> #include <memory> #include <set> #include <unordered_map> #include <utility> +#include <vector> +#include "base/callback.h" +#include "base/observer_list.h" #include "base/optional.h" #include "base/values.h" #include "mojo/public/cpp/bindings/binding_set.h" #include "mojo/public/cpp/bindings/interface_request.h" #include "mojo/public/cpp/bindings/strong_binding.h" #include "services/resource_coordinator/public/cpp/coordination_unit_id.h" +#include "services/resource_coordinator/public/cpp/coordination_unit_types.h" #include "services/resource_coordinator/public/interfaces/coordination_unit.mojom.h" #include "services/resource_coordinator/public/interfaces/coordination_unit_provider.mojom.h" #include "services/service_manager/public/cpp/service_context_ref.h" namespace resource_coordinator { +class CoordinationUnitGraphObserver; + class CoordinationUnitImpl : public mojom::CoordinationUnit { public: CoordinationUnitImpl( @@ -55,10 +62,14 @@ // Clear property from internal key-value store void ClearProperty(mojom::PropertyType property); // Retrieve property from internal key-value store - base::Value GetProperty(mojom::PropertyType property); + base::Value GetProperty(mojom::PropertyType property) const; // Set property from internal key-value store void SetProperty(mojom::PropertyType property, base::Value value); + void WillBeDestroyed(); + void AddObserver(CoordinationUnitGraphObserver* observer); + void RemoveObserver(CoordinationUnitGraphObserver* observer); + protected: const CoordinationUnitID id_; std::set<CoordinationUnitImpl*> children_; @@ -92,6 +103,8 @@ mojom::CoordinationPolicyCallbackPtr policy_callback_; mojom::CoordinationPolicyPtr current_policy_; + base::ObserverList<CoordinationUnitGraphObserver> observers_; + base::Optional<bool> state_flags_[kNumStateFlags]; DISALLOW_COPY_AND_ASSIGN(CoordinationUnitImpl);
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_impl_unittest_util.cc b/services/resource_coordinator/coordination_unit/coordination_unit_impl_unittest_util.cc index c210b96..fc46579 100644 --- a/services/resource_coordinator/coordination_unit/coordination_unit_impl_unittest_util.cc +++ b/services/resource_coordinator/coordination_unit/coordination_unit_impl_unittest_util.cc
@@ -20,7 +20,7 @@ CoordinationUnitImplTestBase::CoordinationUnitImplTestBase() : service_ref_factory_(base::Bind(&OnLastServiceRefDestroyed)), - provider_(&service_ref_factory_) {} + provider_(&service_ref_factory_, &coordination_unit_manager_) {} CoordinationUnitImplTestBase::~CoordinationUnitImplTestBase() = default;
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_impl_unittest_util.h b/services/resource_coordinator/coordination_unit/coordination_unit_impl_unittest_util.h index d3d79df..70c8626 100644 --- a/services/resource_coordinator/coordination_unit/coordination_unit_impl_unittest_util.h +++ b/services/resource_coordinator/coordination_unit/coordination_unit_impl_unittest_util.h
@@ -6,6 +6,7 @@ #define SERVICES_RESOURCE_COORDINATOR_COORDINATION_UNIT_COORDINATION_UNIT_IMPL_UNITTEST_UTIL_H_ #include "base/message_loop/message_loop.h" +#include "services/resource_coordinator/coordination_unit/coordination_unit_manager.h" #include "services/resource_coordinator/coordination_unit/coordination_unit_provider_impl.h" #include "services/service_manager/public/cpp/service_context_ref.h" #include "testing/gtest/include/gtest/gtest.h" @@ -24,11 +25,15 @@ service_manager::ServiceContextRefFactory* service_context_ref_factory() { return &service_ref_factory_; } + CoordinationUnitManager& coordination_unit_manager() { + return coordination_unit_manager_; + } CoordinationUnitProviderImpl* provider() { return &provider_; } private: base::MessageLoop message_loop_; service_manager::ServiceContextRefFactory service_ref_factory_; + CoordinationUnitManager coordination_unit_manager_; CoordinationUnitProviderImpl provider_; };
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_manager.cc b/services/resource_coordinator/coordination_unit/coordination_unit_manager.cc index 714313c..42e8d3a9 100644 --- a/services/resource_coordinator/coordination_unit/coordination_unit_manager.cc +++ b/services/resource_coordinator/coordination_unit/coordination_unit_manager.cc
@@ -4,15 +4,20 @@ #include "services/resource_coordinator/coordination_unit/coordination_unit_manager.h" +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" +#include "base/macros.h" +#include "services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h" +#include "services/resource_coordinator/coordination_unit/coordination_unit_impl.h" #include "services/resource_coordinator/coordination_unit/coordination_unit_provider_impl.h" +#include "services/resource_coordinator/public/cpp/coordination_unit_types.h" +#include "services/service_manager/public/cpp/binder_registry.h" #include "services/service_manager/public/cpp/service_context.h" namespace resource_coordinator { -class CoordinationUnitImpl; - CoordinationUnitManager::CoordinationUnitManager() = default; CoordinationUnitManager::~CoordinationUnitManager() = default; @@ -21,7 +26,28 @@ service_manager::BinderRegistry* registry, service_manager::ServiceContextRefFactory* service_ref_factory) { registry->AddInterface(base::Bind(&CoordinationUnitProviderImpl::Create, - base::Unretained(service_ref_factory))); + base::Unretained(service_ref_factory), + base::Unretained(this))); +} + +void CoordinationUnitManager::RegisterObserver( + std::unique_ptr<CoordinationUnitGraphObserver> observer) { + observers_.push_back(std::move(observer)); +} + +void CoordinationUnitManager::OnCoordinationUnitCreated( + CoordinationUnitImpl* coordination_unit) { + for (auto& observer : observers_) { + if (observer->ShouldObserve(coordination_unit)) { + coordination_unit->AddObserver(observer.get()); + observer->OnCoordinationUnitCreated(coordination_unit); + } + } +} + +void CoordinationUnitManager::OnCoordinationUnitWillBeDestroyed( + CoordinationUnitImpl* coordination_unit) { + coordination_unit->WillBeDestroyed(); } } // namespace resource_coordinator
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_manager.h b/services/resource_coordinator/coordination_unit/coordination_unit_manager.h index 4b10fcd0..d558870 100644 --- a/services/resource_coordinator/coordination_unit/coordination_unit_manager.h +++ b/services/resource_coordinator/coordination_unit/coordination_unit_manager.h
@@ -5,6 +5,9 @@ #ifndef SERVICES_RESOURCE_COORDINATOR_COORDINATION_UNIT_COORDINATION_UNIT_MANAGER_H_ #define SERVICES_RESOURCE_COORDINATOR_COORDINATION_UNIT_COORDINATION_UNIT_MANAGER_H_ +#include <memory> +#include <vector> + #include "base/macros.h" #include "services/service_manager/public/cpp/binder_registry.h" @@ -14,8 +17,11 @@ namespace resource_coordinator { +class CoordinationUnitImpl; +class CoordinationUnitGraphObserver; + // The CoordinationUnitManager is a singleton that encapsulates all -// aspects of Coordination Units within the ResourceCoordinatorService. +// aspects of Coordination Units within the resource_coordinator service. // All functionality for dealing with CoordinationUnits should be contained // within this class or classes that are owned by it class CoordinationUnitManager { @@ -25,8 +31,20 @@ void OnStart(service_manager::BinderRegistry* registry, service_manager::ServiceContextRefFactory* service_ref_factory); + void RegisterObserver( + std::unique_ptr<CoordinationUnitGraphObserver> observer); + void OnCoordinationUnitCreated(CoordinationUnitImpl* coordination_unit); + void OnCoordinationUnitWillBeDestroyed( + CoordinationUnitImpl* coordination_unit); + + std::vector<std::unique_ptr<CoordinationUnitGraphObserver>>& + observers_for_testing() { + return observers_; + } private: + std::vector<std::unique_ptr<CoordinationUnitGraphObserver>> observers_; + static void Create( service_manager::ServiceContextRefFactory* service_ref_factory);
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_provider_impl.cc b/services/resource_coordinator/coordination_unit/coordination_unit_provider_impl.cc index bbc72b6..845ec91a6 100644 --- a/services/resource_coordinator/coordination_unit/coordination_unit_provider_impl.cc +++ b/services/resource_coordinator/coordination_unit/coordination_unit_provider_impl.cc
@@ -10,14 +10,17 @@ #include "base/macros.h" #include "mojo/public/cpp/bindings/strong_binding.h" #include "services/resource_coordinator/coordination_unit/coordination_unit_factory.h" +#include "services/resource_coordinator/coordination_unit/coordination_unit_graph_observer.h" #include "services/resource_coordinator/coordination_unit/coordination_unit_impl.h" #include "services/service_manager/public/cpp/service_context_ref.h" namespace resource_coordinator { CoordinationUnitProviderImpl::CoordinationUnitProviderImpl( - service_manager::ServiceContextRefFactory* service_ref_factory) - : service_ref_factory_(service_ref_factory) { + service_manager::ServiceContextRefFactory* service_ref_factory, + CoordinationUnitManager* coordination_unit_manager) + : service_ref_factory_(service_ref_factory), + coordination_unit_manager_(coordination_unit_manager) { DCHECK(service_ref_factory); service_ref_ = service_ref_factory->CreateRef(); } @@ -31,17 +34,28 @@ coordination_unit_factory::CreateCoordinationUnit( id, service_ref_factory_->CreateRef()); - mojo::MakeStrongBinding(std::move(coordination_unit), std::move(request)); + CoordinationUnitImpl* coordination_unit_impl = coordination_unit.get(); + + auto coordination_unit_binding = + mojo::MakeStrongBinding(std::move(coordination_unit), std::move(request)); + + coordination_unit_manager_->OnCoordinationUnitCreated(coordination_unit_impl); + + coordination_unit_binding->set_connection_error_handler( + base::Bind(&CoordinationUnitManager::OnCoordinationUnitWillBeDestroyed, + base::Unretained(coordination_unit_manager_), + base::Unretained(coordination_unit_impl))); } // static void CoordinationUnitProviderImpl::Create( service_manager::ServiceContextRefFactory* service_ref_factory, + CoordinationUnitManager* coordination_unit_manager, const service_manager::BindSourceInfo& source_info, resource_coordinator::mojom::CoordinationUnitProviderRequest request) { - mojo::MakeStrongBinding( - base::MakeUnique<CoordinationUnitProviderImpl>(service_ref_factory), - std::move(request)); + mojo::MakeStrongBinding(base::MakeUnique<CoordinationUnitProviderImpl>( + service_ref_factory, coordination_unit_manager), + std::move(request)); } } // namespace resource_coordinator
diff --git a/services/resource_coordinator/coordination_unit/coordination_unit_provider_impl.h b/services/resource_coordinator/coordination_unit/coordination_unit_provider_impl.h index c71ea1c..6371200 100644 --- a/services/resource_coordinator/coordination_unit/coordination_unit_provider_impl.h +++ b/services/resource_coordinator/coordination_unit/coordination_unit_provider_impl.h
@@ -6,9 +6,11 @@ #define SERVICES_RESOURCE_COORDINATOR_COORDINATION_UNIT_COORDINATION_UNIT_PROVIDER_IMPL_H_ #include <memory> +#include <vector> #include "mojo/public/cpp/bindings/interface_request.h" #include "mojo/public/cpp/bindings/strong_binding.h" +#include "services/resource_coordinator/coordination_unit/coordination_unit_manager.h" #include "services/resource_coordinator/public/interfaces/coordination_unit_provider.mojom.h" #include "services/service_manager/public/cpp/bind_source_info.h" @@ -22,11 +24,13 @@ class CoordinationUnitProviderImpl : public mojom::CoordinationUnitProvider { public: CoordinationUnitProviderImpl( - service_manager::ServiceContextRefFactory* service_ref_factory); + service_manager::ServiceContextRefFactory* service_ref_factory, + CoordinationUnitManager* coordination_unit_manager); ~CoordinationUnitProviderImpl() override; static void Create( service_manager::ServiceContextRefFactory* service_ref_factory, + CoordinationUnitManager* coordination_unit_manager, const service_manager::BindSourceInfo& source_info, resource_coordinator::mojom::CoordinationUnitProviderRequest request); @@ -38,6 +42,7 @@ private: service_manager::ServiceContextRefFactory* service_ref_factory_; std::unique_ptr<service_manager::ServiceContextRef> service_ref_; + CoordinationUnitManager* coordination_unit_manager_; DISALLOW_COPY_AND_ASSIGN(CoordinationUnitProviderImpl); };
diff --git a/services/ui/gpu/gpu_service.cc b/services/ui/gpu/gpu_service.cc index 0330a13..92d8b64 100644 --- a/services/ui/gpu/gpu_service.cc +++ b/services/ui/gpu/gpu_service.cc
@@ -29,7 +29,7 @@ #include "ipc/ipc_channel_handle.h" #include "ipc/ipc_sync_channel.h" #include "ipc/ipc_sync_message_filter.h" -#include "media/gpu/ipc/service/gpu_jpeg_decode_accelerator.h" +#include "media/gpu/ipc/service/gpu_jpeg_decode_accelerator_factory_provider.h" #include "media/gpu/ipc/service/gpu_video_decode_accelerator.h" #include "media/gpu/ipc/service/gpu_video_encode_accelerator.h" #include "media/gpu/ipc/service/media_gpu_channel_manager.h"
diff --git a/services/ui/ws/frame_generator.cc b/services/ui/ws/frame_generator.cc index 4b72293..ca5b7c0 100644 --- a/services/ui/ws/frame_generator.cc +++ b/services/ui/ws/frame_generator.cc
@@ -8,7 +8,6 @@ #include <vector> #include "cc/output/compositor_frame.h" -#include "cc/output/compositor_frame_sink.h" #include "cc/quads/render_pass.h" #include "cc/quads/render_pass_draw_quad.h" #include "cc/quads/shared_quad_state.h"
diff --git a/services/ui/ws/frame_generator_unittest.cc b/services/ui/ws/frame_generator_unittest.cc index 5ebd12d..ac156edf 100644 --- a/services/ui/ws/frame_generator_unittest.cc +++ b/services/ui/ws/frame_generator_unittest.cc
@@ -5,7 +5,6 @@ #include "services/ui/ws/frame_generator.h" #include "base/macros.h" -#include "cc/output/compositor_frame_sink.h" #include "cc/quads/render_pass.h" #include "cc/scheduler/begin_frame_source.h" #include "cc/test/begin_frame_args_test.h"
diff --git a/testing/buildbot/filters/fuchsia.base_unittests.filter b/testing/buildbot/filters/fuchsia.base_unittests.filter index 914a6ff..e2f8f85 100644 --- a/testing/buildbot/filters/fuchsia.base_unittests.filter +++ b/testing/buildbot/filters/fuchsia.base_unittests.filter
@@ -162,7 +162,6 @@ -ProcessUtilTest.LaunchProcess -ProcessUtilTest.PreExecHook -ProcessUtilTest.SpawnChild --RTLTest.WrapPathWithLTRFormatting -RedirectionToTaskScheduler/SequencedWorkerPoolTest.AvoidsDeadlockOnShutdown/0 -RedirectionToTaskScheduler/SequencedWorkerPoolTest.AvoidsDeadlockOnShutdownWithSequencedBlockingTasks/0 -RedirectionToTaskScheduler/SequencedWorkerPoolTest.ContinueOnShutdown/0
diff --git a/testing/buildbot/filters/mojo.fyi.network_content_browsertests.filter b/testing/buildbot/filters/mojo.fyi.network_content_browsertests.filter index b06a961..60b106c 100644 --- a/testing/buildbot/filters/mojo.fyi.network_content_browsertests.filter +++ b/testing/buildbot/filters/mojo.fyi.network_content_browsertests.filter
@@ -39,9 +39,6 @@ # http://crbug.com/721398 -ClearSiteDataThrottleBrowserTest.* -# https://crbug.com/734670 --RenderProcessHostTest.KillProcessZerosAudioStreams - -AsyncResourceHandlerBrowserTest/AsyncResourceHandlerBrowserTest.UploadProgress* -BrowserSideNavigationBrowserTest.FailedNavigation -CrossSiteResourceHandlerTest.NoDeliveryToDetachedFrame @@ -140,7 +137,6 @@ -TouchInputBrowserTest.MultiPointTouchPress -TouchInputBrowserTest.TouchHandlerNoConsume -WebContentsImplBrowserTest.ClearNonVisiblePendingOnFail --WebContentsImplBrowserTest.DismissingBeforeUnloadDialogInvalidatesUrl -WebContentsImplBrowserTest.DownloadImage_Deny_FileImage -WebContentsImplBrowserTest.GetSizeForNewRenderView -WebContentsImplBrowserTest.UserAgentOverride
diff --git a/third_party/WebKit/LayoutTests/SmokeTests b/third_party/WebKit/LayoutTests/SmokeTests index 1edea09..94292fe4 100644 --- a/third_party/WebKit/LayoutTests/SmokeTests +++ b/third_party/WebKit/LayoutTests/SmokeTests
@@ -956,7 +956,6 @@ transforms/3d/hit-testing/composited-hit-test.html transforms/3d/hit-testing/rotated-hit-test-with-child.html transforms/container-transform-crash.html -transforms/cssmatrix-crash.html transforms/focus-on-transformed-node.html transforms/no_transform_hit_testing.html transforms/topmost-becomes-bottomost-for-scrolling.html
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index 88b935d6..c5f934ba 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -366,11 +366,8 @@ crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/clear-applies-to-015.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/float-applies-to-008.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/float-applies-to-012.xht [ Failure ] -crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/float-non-replaced-width-002.xht [ Failure ] -crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/float-non-replaced-width-004.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/float-replaced-height-001.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/float-replaced-width-002.xht [ Failure ] -crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/float-replaced-width-004.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floating-replaced-height-008.xht [ Skip ] crbug.com/719615 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-001.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-005.xht [ Failure ] @@ -386,7 +383,6 @@ crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-108.xht [ Skip ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-109.xht [ Skip ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-110.xht [ Skip ] -crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-113.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-126.xht [ Skip ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-127.xht [ Skip ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/floats-clear/floats-128.xht [ Skip ] @@ -435,7 +431,6 @@ crbug.com/636993 virtual/layout_ng/external/wpt/css/CSS2/linebox/inline-formatting-context-012.xht [ Failure ] crbug.com/636993 virtual/layout_ng/external/wpt/css/CSS2/linebox/inline-formatting-context-023.xht [ Failure ] crbug.com/636993 [ Mac ] virtual/layout_ng/external/wpt/css/CSS2/linebox/line-height-129.xht [ Failure ] -crbug.com/636993 virtual/layout_ng/external/wpt/css/CSS2/linebox/vertical-align-121.xht [ Failure ] crbug.com/636993 virtual/layout_ng/external/wpt/css/CSS2/linebox/vertical-align-baseline-004a.xht [ Failure ] crbug.com/636993 virtual/layout_ng/external/wpt/css/CSS2/linebox/vertical-align-baseline-005a.xht [ Failure ] crbug.com/636993 virtual/layout_ng/external/wpt/css/CSS2/linebox/vertical-align-sub-001.xht [ Failure ] @@ -452,7 +447,6 @@ crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/block-in-inline-remove-005.xht [ Failure Pass ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/block-non-replaced-height-005.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/block-non-replaced-width-007.xht [ Failure ] -crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/block-replaced-width-006.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/blocks-017.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/blocks-025.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/height-114.xht [ Failure Crash ] @@ -494,11 +488,6 @@ crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/width-applies-to-012.xht [ Failure ] ### virtual/layout_ng/external/wpt/css/CSS2/positioning -crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/absolute-non-replaced-width-015.xht [ Failure ] -crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/absolute-non-replaced-width-021.xht [ Failure ] -crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/absolute-non-replaced-width-022.xht [ Failure ] -crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/absolute-non-replaced-width-023.xht [ Failure ] -crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/absolute-non-replaced-width-024.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/absolute-non-replaced-width-025.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/absolute-non-replaced-width-026.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/absolute-replaced-height-004.xht [ Failure ] @@ -533,7 +522,6 @@ crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/abspos-012.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/abspos-019.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/abspos-020.xht [ Failure ] -crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/abspos-024.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/abspos-containing-block-001.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/abspos-containing-block-002.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/abspos-containing-block-007.xht [ Failure ] @@ -545,8 +533,6 @@ crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/abspos-inline-006.xht [ Skip ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/abspos-paged-001.xht [ Skip ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/abspos-paged-002.xht [ Skip ] -crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/left-offset-003.xht [ Failure ] -crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/left-offset-percentage-001.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/position-004.xht [ Skip ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/position-fixed-003.xht [ Skip ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/position-fixed-004.xht [ Skip ] @@ -610,7 +596,6 @@ crbug.com/635619 virtual/layout_ng/fast/block/float/013.html [ Failure ] crbug.com/635619 virtual/layout_ng/fast/block/float/014.html [ Failure Crash ] crbug.com/635619 virtual/layout_ng/fast/block/float/015.html [ Failure ] -crbug.com/635619 virtual/layout_ng/fast/block/float/016.html [ Failure ] crbug.com/635619 virtual/layout_ng/fast/block/float/017.html [ Failure ] crbug.com/635619 virtual/layout_ng/fast/block/float/018.html [ Failure ] crbug.com/635619 virtual/layout_ng/fast/block/float/019.html [ Failure ] @@ -795,7 +780,7 @@ crbug.com/538697 [ Win7 Debug ] printing/webgl-oversized-printing.html [ Failure Crash ] # ====== Fullscreen tests failing with feature policy ====== -# TODO(lunalu): Turn tests on once feature policy implements allowfullscreen. +# TODO(loonybear): Turn tests on once feature policy implements allowfullscreen. crbug.com/666761 virtual/feature-policy/http/tests/feature-policy/fullscreen-allowed-by-container-policy-relocate.html [ Failure ] crbug.com/666761 virtual/feature-policy/http/tests/feature-policy/fullscreen-allowed-by-container-policy.html [ Failure ] crbug.com/666761 virtual/feature-policy/http/tests/feature-policy/fullscreen-disabled.php [ Failure ] @@ -917,6 +902,9 @@ crbug.com/734793 http/tests/inspector/indexeddb/database-names.html [ Pass Failure Timeout ] crbug.com/734793 virtual/mojo-loading/http/tests/inspector/indexeddb/database-names.html [ Pass Failure Timeout ] +crbug.com/735259 http/tests/inspector/indexeddb/upgrade-events.html [ Pass Failure ] +crbug.com/735259 virtual/mojo-loading/http/tests/inspector/indexeddb/upgrade-events.html [ Pass Failure ] + # Will be re-enabled and rebaselined once we remove the '--enable-file-cookies' flag. crbug.com/470482 fast/cookies/local-file-can-set-cookies.html [ Skip ] @@ -1278,8 +1266,6 @@ crbug.com/658305 css3/filters/effect-reference-zoom-hw.html [ Failure Pass ] crbug.com/658305 css3/filters/filter-effect-removed.html [ Failure Pass ] -crbug.com/734733 css3/blending/background-blend-mode-gif-color-2.html [ Failure Pass ] - crbug.com/267206 [ Mac ] fast/scrolling/scrollbar-tickmarks-hittest.html [ Timeout ] crbug.com/267206 [ Mac ] virtual/scroll_customization/fast/scrolling/scrollbar-tickmarks-hittest.html [ Timeout ]
diff --git a/third_party/WebKit/LayoutTests/css3/blending/background-blend-mode-gif-color-2-expected.png b/third_party/WebKit/LayoutTests/css3/blending/background-blend-mode-gif-color-2-expected.png index 60746df..4a7c8a9 100644 --- a/third_party/WebKit/LayoutTests/css3/blending/background-blend-mode-gif-color-2-expected.png +++ b/third_party/WebKit/LayoutTests/css3/blending/background-blend-mode-gif-color-2-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/css3/blending/background-blend-mode-gif-color-2.html b/third_party/WebKit/LayoutTests/css3/blending/background-blend-mode-gif-color-2.html index 7455b7a5..3035030c 100644 --- a/third_party/WebKit/LayoutTests/css3/blending/background-blend-mode-gif-color-2.html +++ b/third_party/WebKit/LayoutTests/css3/blending/background-blend-mode-gif-color-2.html
@@ -10,16 +10,7 @@ margin: 5px; } </style> -<script type="text/javascript"> - if (window.testRunner) - window.testRunner.waitUntilDone(); - function done() { - if (window.testRunner) - window.testRunner.notifyDone(); - } - -</script> </head> <!-- This file should contain a gif on top of a background color with every type of blending. --> <body> @@ -38,8 +29,23 @@ <div style="background-blend-mode: saturation, normal"></div> <div style="background-blend-mode: color, normal"></div> <div style="background-blend-mode: luminosity, normal"></div> + + <img id='image' style='display: none'> + <script type="text/javascript"> - window.setTimeout("done()", 400); + onload = function() { + if (window.testRunner) + testRunner.waitUntilDone(); + + // use a parallel instance to drive the animation + image.src = 'resources/squares.gif'; + image.onload = function() { + if (window.testRunner) { + internals.advanceImageAnimation(image); + testRunner.notifyDone(); + } + }; + }; </script> </body> </html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/geometry-1/DOMMatrix-stringifier-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/css/geometry-1/DOMMatrix-stringifier-expected.txt deleted file mode 100644 index 22ad39c5..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/css/geometry-1/DOMMatrix-stringifier-expected.txt +++ /dev/null
@@ -1,82 +0,0 @@ -This is a testharness.js-based test. -Found 78 tests; 54 PASS, 24 FAIL, 0 TIMEOUT, 0 NOTRUN. -PASS DOMMatrix stringifier: identity (2d) -PASS DOMMatrix stringifier: identity (3d) -PASS DOMMatrix stringifier: NaN (2d) -PASS DOMMatrix stringifier: NaN (3d) -PASS DOMMatrix stringifier: Infinity (2d) -PASS DOMMatrix stringifier: Infinity (3d) -PASS DOMMatrix stringifier: -Infinity (2d) -PASS DOMMatrix stringifier: -Infinity (3d) -PASS DOMMatrix stringifier: 1/3 (2d) -PASS DOMMatrix stringifier: 1/3 (3d) -PASS DOMMatrix stringifier: 1/300000 (2d) -PASS DOMMatrix stringifier: 1/300000 (3d) -PASS DOMMatrix stringifier: 1/300000000 (2d) -PASS DOMMatrix stringifier: 1/300000000 (3d) -PASS DOMMatrix stringifier: 100000 + (1/3) (2d) -PASS DOMMatrix stringifier: 100000 + (1/3) (3d) -PASS DOMMatrix stringifier: Math.pow(2, 53) + 1 (2d) -PASS DOMMatrix stringifier: Math.pow(2, 53) + 1 (3d) -PASS DOMMatrix stringifier: Math.pow(2, 53) + 2 (2d) -PASS DOMMatrix stringifier: Math.pow(2, 53) + 2 (3d) -PASS DOMMatrix stringifier: Number.MAX_VALUE (2d) -PASS DOMMatrix stringifier: Number.MAX_VALUE (3d) -PASS DOMMatrix stringifier: Number.MIN_VALUE (2d) -PASS DOMMatrix stringifier: Number.MIN_VALUE (3d) -PASS DOMMatrix stringifier: throwing getters (2d) -PASS DOMMatrix stringifier: throwing getters (3d) -PASS DOMMatrixReadOnly stringifier: identity (2d) -PASS DOMMatrixReadOnly stringifier: identity (3d) -PASS DOMMatrixReadOnly stringifier: NaN (2d) -PASS DOMMatrixReadOnly stringifier: NaN (3d) -PASS DOMMatrixReadOnly stringifier: Infinity (2d) -PASS DOMMatrixReadOnly stringifier: Infinity (3d) -PASS DOMMatrixReadOnly stringifier: -Infinity (2d) -PASS DOMMatrixReadOnly stringifier: -Infinity (3d) -PASS DOMMatrixReadOnly stringifier: 1/3 (2d) -PASS DOMMatrixReadOnly stringifier: 1/3 (3d) -PASS DOMMatrixReadOnly stringifier: 1/300000 (2d) -PASS DOMMatrixReadOnly stringifier: 1/300000 (3d) -PASS DOMMatrixReadOnly stringifier: 1/300000000 (2d) -PASS DOMMatrixReadOnly stringifier: 1/300000000 (3d) -PASS DOMMatrixReadOnly stringifier: 100000 + (1/3) (2d) -PASS DOMMatrixReadOnly stringifier: 100000 + (1/3) (3d) -PASS DOMMatrixReadOnly stringifier: Math.pow(2, 53) + 1 (2d) -PASS DOMMatrixReadOnly stringifier: Math.pow(2, 53) + 1 (3d) -PASS DOMMatrixReadOnly stringifier: Math.pow(2, 53) + 2 (2d) -PASS DOMMatrixReadOnly stringifier: Math.pow(2, 53) + 2 (3d) -PASS DOMMatrixReadOnly stringifier: Number.MAX_VALUE (2d) -PASS DOMMatrixReadOnly stringifier: Number.MAX_VALUE (3d) -PASS DOMMatrixReadOnly stringifier: Number.MIN_VALUE (2d) -PASS DOMMatrixReadOnly stringifier: Number.MIN_VALUE (3d) -PASS DOMMatrixReadOnly stringifier: throwing getters (2d) -PASS DOMMatrixReadOnly stringifier: throwing getters (3d) -PASS WebKitCSSMatrix stringifier: identity (2d) -FAIL WebKitCSSMatrix stringifier: identity (3d) self[constr].fromMatrix is not a function -FAIL WebKitCSSMatrix stringifier: NaN (2d) Failed to construct 'WebKitCSSMatrix': Failed to parse '1,0,0,1,0,NaN'. -FAIL WebKitCSSMatrix stringifier: NaN (3d) Failed to construct 'WebKitCSSMatrix': Failed to parse '1,0,0,0,0,1,0,0,0,0,1,0,0,NaN,0,1'. -FAIL WebKitCSSMatrix stringifier: Infinity (2d) Failed to construct 'WebKitCSSMatrix': Failed to parse '1,0,0,1,0,Infinity'. -FAIL WebKitCSSMatrix stringifier: Infinity (3d) Failed to construct 'WebKitCSSMatrix': Failed to parse '1,0,0,0,0,1,0,0,0,0,1,0,0,Infinity,0,1'. -FAIL WebKitCSSMatrix stringifier: -Infinity (2d) Failed to construct 'WebKitCSSMatrix': Failed to parse '1,0,0,1,0,-Infinity'. -FAIL WebKitCSSMatrix stringifier: -Infinity (3d) Failed to construct 'WebKitCSSMatrix': Failed to parse '1,0,0,0,0,1,0,0,0,0,1,0,0,-Infinity,0,1'. -FAIL WebKitCSSMatrix stringifier: 1/3 (2d) Failed to construct 'WebKitCSSMatrix': Failed to parse '1,0,0,1,0,0.3333333333333333'. -FAIL WebKitCSSMatrix stringifier: 1/3 (3d) Failed to construct 'WebKitCSSMatrix': Failed to parse '1,0,0,0,0,1,0,0,0,0,1,0,0,0.3333333333333333,0,1'. -FAIL WebKitCSSMatrix stringifier: 1/300000 (2d) Failed to construct 'WebKitCSSMatrix': Failed to parse '1,0,0,1,0,0.0000033333333333333333'. -FAIL WebKitCSSMatrix stringifier: 1/300000 (3d) Failed to construct 'WebKitCSSMatrix': Failed to parse '1,0,0,0,0,1,0,0,0,0,1,0,0,0.0000033333333333333333,0,1'. -FAIL WebKitCSSMatrix stringifier: 1/300000000 (2d) Failed to construct 'WebKitCSSMatrix': Failed to parse '1,0,0,1,0,3.3333333333333334e-9'. -FAIL WebKitCSSMatrix stringifier: 1/300000000 (3d) Failed to construct 'WebKitCSSMatrix': Failed to parse '1,0,0,0,0,1,0,0,0,0,1,0,0,3.3333333333333334e-9,0,1'. -FAIL WebKitCSSMatrix stringifier: 100000 + (1/3) (2d) Failed to construct 'WebKitCSSMatrix': Failed to parse '1,0,0,1,0,100000.33333333333'. -FAIL WebKitCSSMatrix stringifier: 100000 + (1/3) (3d) Failed to construct 'WebKitCSSMatrix': Failed to parse '1,0,0,0,0,1,0,0,0,0,1,0,0,100000.33333333333,0,1'. -FAIL WebKitCSSMatrix stringifier: Math.pow(2, 53) + 1 (2d) Failed to construct 'WebKitCSSMatrix': Failed to parse '1,0,0,1,0,9007199254740992'. -FAIL WebKitCSSMatrix stringifier: Math.pow(2, 53) + 1 (3d) Failed to construct 'WebKitCSSMatrix': Failed to parse '1,0,0,0,0,1,0,0,0,0,1,0,0,9007199254740992,0,1'. -FAIL WebKitCSSMatrix stringifier: Math.pow(2, 53) + 2 (2d) Failed to construct 'WebKitCSSMatrix': Failed to parse '1,0,0,1,0,9007199254740994'. -FAIL WebKitCSSMatrix stringifier: Math.pow(2, 53) + 2 (3d) Failed to construct 'WebKitCSSMatrix': Failed to parse '1,0,0,0,0,1,0,0,0,0,1,0,0,9007199254740994,0,1'. -FAIL WebKitCSSMatrix stringifier: Number.MAX_VALUE (2d) Failed to construct 'WebKitCSSMatrix': Failed to parse '1,0,0,1,0,1.7976931348623157e+308'. -FAIL WebKitCSSMatrix stringifier: Number.MAX_VALUE (3d) Failed to construct 'WebKitCSSMatrix': Failed to parse '1,0,0,0,0,1,0,0,0,0,1,0,0,1.7976931348623157e+308,0,1'. -FAIL WebKitCSSMatrix stringifier: Number.MIN_VALUE (2d) Failed to construct 'WebKitCSSMatrix': Failed to parse '1,0,0,1,0,5e-324'. -FAIL WebKitCSSMatrix stringifier: Number.MIN_VALUE (3d) Failed to construct 'WebKitCSSMatrix': Failed to parse '1,0,0,0,0,1,0,0,0,0,1,0,0,5e-324,0,1'. -PASS WebKitCSSMatrix stringifier: throwing getters (2d) -FAIL WebKitCSSMatrix stringifier: throwing getters (3d) self[constr].fromMatrix is not a function -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/geometry-1/WebKitCSSMatrix-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/css/geometry-1/WebKitCSSMatrix-expected.txt deleted file mode 100644 index dd0272a..0000000 --- a/third_party/WebKit/LayoutTests/external/wpt/css/geometry-1/WebKitCSSMatrix-expected.txt +++ /dev/null
@@ -1,6 +0,0 @@ -This is a testharness.js-based test. -FAIL Equivalence test assert_equals: interface object expected function "function DOMMatrix() { [native code] }" but got function "function WebKitCSSMatrix() { [native code] }" -PASS Property descriptor for WebKitCSSMatrix -PASS Property descriptor for DOMMatrix -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Window/custom-constructors-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/Window/custom-constructors-expected.txt index 7d0014c..294eef2 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/Window/custom-constructors-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/dom/Window/custom-constructors-expected.txt
@@ -7,7 +7,7 @@ PASS Option.prototype.toString.call(new Option) is '[object HTMLOptionElement]' PASS WebKitCSSMatrix.prototype.toString.call(new WebKitCSSMatrix) is 'matrix(1, 0, 0, 1, 0, 0)' PASS WebKitCSSMatrix.prototype.toString.call(new WebKitCSSMatrix()) is 'matrix(1, 0, 0, 1, 0, 0)' -PASS new WebKitCSSMatrix(null) threw exception SyntaxError: Failed to construct 'WebKitCSSMatrix': Failed to parse 'null'.. +PASS new WebKitCSSMatrix(null) threw exception SyntaxError: Failed to construct 'DOMMatrix': Failed to parse 'null'.. FAIL new WebKitCSSMatrix(undefined) should throw an exception. Was matrix(1, 0, 0, 1, 0, 0). PASS XMLHttpRequest.prototype.toString.call(new XMLHttpRequest) is '[object XMLHttpRequest]' PASS XSLTProcessor.prototype.toString.call(new XSLTProcessor) is '[object XSLTProcessor]'
diff --git a/third_party/WebKit/LayoutTests/fast/dom/call-a-constructor-as-a-function-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/call-a-constructor-as-a-function-expected.txt index bcd6af3..d91c597 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/call-a-constructor-as-a-function-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/dom/call-a-constructor-as-a-function-expected.txt
@@ -22,7 +22,7 @@ PASS Uint16Array() threw exception TypeError: Constructor Uint16Array requires 'new'. PASS Uint32Array() threw exception TypeError: Constructor Uint32Array requires 'new'. PASS Uint8Array() threw exception TypeError: Constructor Uint8Array requires 'new'. -PASS WebKitCSSMatrix() threw exception TypeError: Failed to construct 'WebKitCSSMatrix': Please use the 'new' operator, this DOM object constructor cannot be called as a function.. +PASS WebKitCSSMatrix() threw exception TypeError: Failed to construct 'DOMMatrix': Please use the 'new' operator, this DOM object constructor cannot be called as a function.. PASS WebSocket() threw exception TypeError: Failed to construct 'WebSocket': Please use the 'new' operator, this DOM object constructor cannot be called as a function.. PASS Worker() threw exception TypeError: Failed to construct 'Worker': Please use the 'new' operator, this DOM object constructor cannot be called as a function.. PASS XMLHttpRequest() threw exception TypeError: Failed to construct 'XMLHttpRequest': Please use the 'new' operator, this DOM object constructor cannot be called as a function..
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt index 9986eee..8fbf1b8d 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
@@ -113,6 +113,168 @@ getter name method constructor method toString +interface DOMMatrix : DOMMatrixReadOnly + attribute @@toStringTag + getter a + getter b + getter c + getter d + getter e + getter f + getter m11 + getter m12 + getter m13 + getter m14 + getter m21 + getter m22 + getter m23 + getter m24 + getter m31 + getter m32 + getter m33 + getter m34 + getter m41 + getter m42 + getter m43 + getter m44 + method constructor + method invertSelf + method multiplySelf + method preMultiplySelf + method rotateAxisAngleSelf + method rotateFromVectorSelf + method rotateSelf + method scale3dSelf + method scaleSelf + method setMatrixValue + method skewXSelf + method skewYSelf + method translateSelf + setter a + setter b + setter c + setter d + setter e + setter f + setter m11 + setter m12 + setter m13 + setter m14 + setter m21 + setter m22 + setter m23 + setter m24 + setter m31 + setter m32 + setter m33 + setter m34 + setter m41 + setter m42 + setter m43 + setter m44 +interface DOMMatrixReadOnly + static method fromFloat32Array + static method fromFloat64Array + static method fromMatrix + attribute @@toStringTag + getter a + getter b + getter c + getter d + getter e + getter f + getter is2D + getter isIdentity + getter m11 + getter m12 + getter m13 + getter m14 + getter m21 + getter m22 + getter m23 + getter m24 + getter m31 + getter m32 + getter m33 + getter m34 + getter m41 + getter m42 + getter m43 + getter m44 + method constructor + method flipX + method flipY + method inverse + method multiply + method rotate + method rotateAxisAngle + method rotateFromVector + method scale + method scale3d + method skewX + method skewY + method toFloat32Array + method toFloat64Array + method toJSON + method toString + method transformPoint + method translate +interface DOMPoint : DOMPointReadOnly + attribute @@toStringTag + getter w + getter x + getter y + getter z + method constructor + setter w + setter x + setter y + setter z +interface DOMPointReadOnly + static method fromPoint + attribute @@toStringTag + getter w + getter x + getter y + getter z + method constructor + method matrixTransform + method toJSON +interface DOMQuad + static method fromQuad + static method fromRect + attribute @@toStringTag + getter p1 + getter p2 + getter p3 + getter p4 + method constructor + method getBounds + method toJSON +interface DOMRect : DOMRectReadOnly + attribute @@toStringTag + getter height + getter width + getter x + getter y + method constructor + setter height + setter width + setter x + setter y +interface DOMRectReadOnly + static method fromRect + attribute @@toStringTag + getter bottom + getter height + getter left + getter right + getter top + getter width + getter x + getter y + method constructor + method toJSON interface DOMStringList attribute @@toStringTag getter length
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt index e54d292..ddee30a 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt
@@ -104,6 +104,168 @@ [Worker] getter name [Worker] method constructor [Worker] method toString +[Worker] interface DOMMatrix : DOMMatrixReadOnly +[Worker] attribute @@toStringTag +[Worker] getter a +[Worker] getter b +[Worker] getter c +[Worker] getter d +[Worker] getter e +[Worker] getter f +[Worker] getter m11 +[Worker] getter m12 +[Worker] getter m13 +[Worker] getter m14 +[Worker] getter m21 +[Worker] getter m22 +[Worker] getter m23 +[Worker] getter m24 +[Worker] getter m31 +[Worker] getter m32 +[Worker] getter m33 +[Worker] getter m34 +[Worker] getter m41 +[Worker] getter m42 +[Worker] getter m43 +[Worker] getter m44 +[Worker] method constructor +[Worker] method invertSelf +[Worker] method multiplySelf +[Worker] method preMultiplySelf +[Worker] method rotateAxisAngleSelf +[Worker] method rotateFromVectorSelf +[Worker] method rotateSelf +[Worker] method scale3dSelf +[Worker] method scaleSelf +[Worker] method setMatrixValue +[Worker] method skewXSelf +[Worker] method skewYSelf +[Worker] method translateSelf +[Worker] setter a +[Worker] setter b +[Worker] setter c +[Worker] setter d +[Worker] setter e +[Worker] setter f +[Worker] setter m11 +[Worker] setter m12 +[Worker] setter m13 +[Worker] setter m14 +[Worker] setter m21 +[Worker] setter m22 +[Worker] setter m23 +[Worker] setter m24 +[Worker] setter m31 +[Worker] setter m32 +[Worker] setter m33 +[Worker] setter m34 +[Worker] setter m41 +[Worker] setter m42 +[Worker] setter m43 +[Worker] setter m44 +[Worker] interface DOMMatrixReadOnly +[Worker] static method fromFloat32Array +[Worker] static method fromFloat64Array +[Worker] static method fromMatrix +[Worker] attribute @@toStringTag +[Worker] getter a +[Worker] getter b +[Worker] getter c +[Worker] getter d +[Worker] getter e +[Worker] getter f +[Worker] getter is2D +[Worker] getter isIdentity +[Worker] getter m11 +[Worker] getter m12 +[Worker] getter m13 +[Worker] getter m14 +[Worker] getter m21 +[Worker] getter m22 +[Worker] getter m23 +[Worker] getter m24 +[Worker] getter m31 +[Worker] getter m32 +[Worker] getter m33 +[Worker] getter m34 +[Worker] getter m41 +[Worker] getter m42 +[Worker] getter m43 +[Worker] getter m44 +[Worker] method constructor +[Worker] method flipX +[Worker] method flipY +[Worker] method inverse +[Worker] method multiply +[Worker] method rotate +[Worker] method rotateAxisAngle +[Worker] method rotateFromVector +[Worker] method scale +[Worker] method scale3d +[Worker] method skewX +[Worker] method skewY +[Worker] method toFloat32Array +[Worker] method toFloat64Array +[Worker] method toJSON +[Worker] method toString +[Worker] method transformPoint +[Worker] method translate +[Worker] interface DOMPoint : DOMPointReadOnly +[Worker] attribute @@toStringTag +[Worker] getter w +[Worker] getter x +[Worker] getter y +[Worker] getter z +[Worker] method constructor +[Worker] setter w +[Worker] setter x +[Worker] setter y +[Worker] setter z +[Worker] interface DOMPointReadOnly +[Worker] static method fromPoint +[Worker] attribute @@toStringTag +[Worker] getter w +[Worker] getter x +[Worker] getter y +[Worker] getter z +[Worker] method constructor +[Worker] method matrixTransform +[Worker] method toJSON +[Worker] interface DOMQuad +[Worker] static method fromQuad +[Worker] static method fromRect +[Worker] attribute @@toStringTag +[Worker] getter p1 +[Worker] getter p2 +[Worker] getter p3 +[Worker] getter p4 +[Worker] method constructor +[Worker] method getBounds +[Worker] method toJSON +[Worker] interface DOMRect : DOMRectReadOnly +[Worker] attribute @@toStringTag +[Worker] getter height +[Worker] getter width +[Worker] getter x +[Worker] getter y +[Worker] method constructor +[Worker] setter height +[Worker] setter width +[Worker] setter x +[Worker] setter y +[Worker] interface DOMRectReadOnly +[Worker] static method fromRect +[Worker] attribute @@toStringTag +[Worker] getter bottom +[Worker] getter height +[Worker] getter left +[Worker] getter right +[Worker] getter top +[Worker] getter width +[Worker] getter x +[Worker] getter y +[Worker] method constructor +[Worker] method toJSON [Worker] interface DOMStringList [Worker] attribute @@toStringTag [Worker] getter length
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-expected.txt index 79308f7..f0840dd2 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-expected.txt
@@ -727,10 +727,172 @@ method createDocumentType method createHTMLDocument method hasFeature +interface DOMMatrix : DOMMatrixReadOnly + attribute @@toStringTag + getter a + getter b + getter c + getter d + getter e + getter f + getter m11 + getter m12 + getter m13 + getter m14 + getter m21 + getter m22 + getter m23 + getter m24 + getter m31 + getter m32 + getter m33 + getter m34 + getter m41 + getter m42 + getter m43 + getter m44 + method constructor + method invertSelf + method multiplySelf + method preMultiplySelf + method rotateAxisAngleSelf + method rotateFromVectorSelf + method rotateSelf + method scale3dSelf + method scaleSelf + method setMatrixValue + method skewXSelf + method skewYSelf + method translateSelf + setter a + setter b + setter c + setter d + setter e + setter f + setter m11 + setter m12 + setter m13 + setter m14 + setter m21 + setter m22 + setter m23 + setter m24 + setter m31 + setter m32 + setter m33 + setter m34 + setter m41 + setter m42 + setter m43 + setter m44 +interface DOMMatrixReadOnly + static method fromFloat32Array + static method fromFloat64Array + static method fromMatrix + attribute @@toStringTag + getter a + getter b + getter c + getter d + getter e + getter f + getter is2D + getter isIdentity + getter m11 + getter m12 + getter m13 + getter m14 + getter m21 + getter m22 + getter m23 + getter m24 + getter m31 + getter m32 + getter m33 + getter m34 + getter m41 + getter m42 + getter m43 + getter m44 + method constructor + method flipX + method flipY + method inverse + method multiply + method rotate + method rotateAxisAngle + method rotateFromVector + method scale + method scale3d + method skewX + method skewY + method toFloat32Array + method toFloat64Array + method toJSON + method toString + method transformPoint + method translate interface DOMParser attribute @@toStringTag method constructor method parseFromString +interface DOMPoint : DOMPointReadOnly + attribute @@toStringTag + getter w + getter x + getter y + getter z + method constructor + setter w + setter x + setter y + setter z +interface DOMPointReadOnly + static method fromPoint + attribute @@toStringTag + getter w + getter x + getter y + getter z + method constructor + method matrixTransform + method toJSON +interface DOMQuad + static method fromQuad + static method fromRect + attribute @@toStringTag + getter p1 + getter p2 + getter p3 + getter p4 + method constructor + method getBounds + method toJSON +interface DOMRect : DOMRectReadOnly + attribute @@toStringTag + getter height + getter width + getter x + getter y + method constructor + setter height + setter width + setter x + setter y +interface DOMRectReadOnly + static method fromRect + attribute @@toStringTag + getter bottom + getter height + getter left + getter right + getter top + getter width + getter x + getter y + method constructor + method toJSON interface DOMStringList attribute @@toStringTag getter length @@ -7373,7 +7535,7 @@ getter animationName getter elapsedTime method constructor -interface WebKitCSSMatrix +interface WebKitCSSMatrix : DOMMatrixReadOnly attribute @@toStringTag getter a getter b @@ -7398,16 +7560,18 @@ getter m43 getter m44 method constructor - method inverse - method multiply - method rotate - method rotateAxisAngle - method scale + method invertSelf + method multiplySelf + method preMultiplySelf + method rotateAxisAngleSelf + method rotateFromVectorSelf + method rotateSelf + method scale3dSelf + method scaleSelf method setMatrixValue - method skewX - method skewY - method toString - method translate + method skewXSelf + method skewYSelf + method translateSelf setter a setter b setter c
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt index 02ea461f..ed48080 100644 --- a/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt
@@ -104,6 +104,168 @@ [Worker] getter name [Worker] method constructor [Worker] method toString +[Worker] interface DOMMatrix : DOMMatrixReadOnly +[Worker] attribute @@toStringTag +[Worker] getter a +[Worker] getter b +[Worker] getter c +[Worker] getter d +[Worker] getter e +[Worker] getter f +[Worker] getter m11 +[Worker] getter m12 +[Worker] getter m13 +[Worker] getter m14 +[Worker] getter m21 +[Worker] getter m22 +[Worker] getter m23 +[Worker] getter m24 +[Worker] getter m31 +[Worker] getter m32 +[Worker] getter m33 +[Worker] getter m34 +[Worker] getter m41 +[Worker] getter m42 +[Worker] getter m43 +[Worker] getter m44 +[Worker] method constructor +[Worker] method invertSelf +[Worker] method multiplySelf +[Worker] method preMultiplySelf +[Worker] method rotateAxisAngleSelf +[Worker] method rotateFromVectorSelf +[Worker] method rotateSelf +[Worker] method scale3dSelf +[Worker] method scaleSelf +[Worker] method setMatrixValue +[Worker] method skewXSelf +[Worker] method skewYSelf +[Worker] method translateSelf +[Worker] setter a +[Worker] setter b +[Worker] setter c +[Worker] setter d +[Worker] setter e +[Worker] setter f +[Worker] setter m11 +[Worker] setter m12 +[Worker] setter m13 +[Worker] setter m14 +[Worker] setter m21 +[Worker] setter m22 +[Worker] setter m23 +[Worker] setter m24 +[Worker] setter m31 +[Worker] setter m32 +[Worker] setter m33 +[Worker] setter m34 +[Worker] setter m41 +[Worker] setter m42 +[Worker] setter m43 +[Worker] setter m44 +[Worker] interface DOMMatrixReadOnly +[Worker] static method fromFloat32Array +[Worker] static method fromFloat64Array +[Worker] static method fromMatrix +[Worker] attribute @@toStringTag +[Worker] getter a +[Worker] getter b +[Worker] getter c +[Worker] getter d +[Worker] getter e +[Worker] getter f +[Worker] getter is2D +[Worker] getter isIdentity +[Worker] getter m11 +[Worker] getter m12 +[Worker] getter m13 +[Worker] getter m14 +[Worker] getter m21 +[Worker] getter m22 +[Worker] getter m23 +[Worker] getter m24 +[Worker] getter m31 +[Worker] getter m32 +[Worker] getter m33 +[Worker] getter m34 +[Worker] getter m41 +[Worker] getter m42 +[Worker] getter m43 +[Worker] getter m44 +[Worker] method constructor +[Worker] method flipX +[Worker] method flipY +[Worker] method inverse +[Worker] method multiply +[Worker] method rotate +[Worker] method rotateAxisAngle +[Worker] method rotateFromVector +[Worker] method scale +[Worker] method scale3d +[Worker] method skewX +[Worker] method skewY +[Worker] method toFloat32Array +[Worker] method toFloat64Array +[Worker] method toJSON +[Worker] method toString +[Worker] method transformPoint +[Worker] method translate +[Worker] interface DOMPoint : DOMPointReadOnly +[Worker] attribute @@toStringTag +[Worker] getter w +[Worker] getter x +[Worker] getter y +[Worker] getter z +[Worker] method constructor +[Worker] setter w +[Worker] setter x +[Worker] setter y +[Worker] setter z +[Worker] interface DOMPointReadOnly +[Worker] static method fromPoint +[Worker] attribute @@toStringTag +[Worker] getter w +[Worker] getter x +[Worker] getter y +[Worker] getter z +[Worker] method constructor +[Worker] method matrixTransform +[Worker] method toJSON +[Worker] interface DOMQuad +[Worker] static method fromQuad +[Worker] static method fromRect +[Worker] attribute @@toStringTag +[Worker] getter p1 +[Worker] getter p2 +[Worker] getter p3 +[Worker] getter p4 +[Worker] method constructor +[Worker] method getBounds +[Worker] method toJSON +[Worker] interface DOMRect : DOMRectReadOnly +[Worker] attribute @@toStringTag +[Worker] getter height +[Worker] getter width +[Worker] getter x +[Worker] getter y +[Worker] method constructor +[Worker] setter height +[Worker] setter width +[Worker] setter x +[Worker] setter y +[Worker] interface DOMRectReadOnly +[Worker] static method fromRect +[Worker] attribute @@toStringTag +[Worker] getter bottom +[Worker] getter height +[Worker] getter left +[Worker] getter right +[Worker] getter top +[Worker] getter width +[Worker] getter x +[Worker] getter y +[Worker] method constructor +[Worker] method toJSON [Worker] interface DOMStringList [Worker] attribute @@toStringTag [Worker] getter length
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/stable/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/stable/webexposed/global-interface-listing-expected.txt index 1829439..8fe4d5d 100644 --- a/third_party/WebKit/LayoutTests/platform/win/virtual/stable/webexposed/global-interface-listing-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/win/virtual/stable/webexposed/global-interface-listing-expected.txt
@@ -656,10 +656,172 @@ method createDocumentType method createHTMLDocument method hasFeature +interface DOMMatrix : DOMMatrixReadOnly + attribute @@toStringTag + getter a + getter b + getter c + getter d + getter e + getter f + getter m11 + getter m12 + getter m13 + getter m14 + getter m21 + getter m22 + getter m23 + getter m24 + getter m31 + getter m32 + getter m33 + getter m34 + getter m41 + getter m42 + getter m43 + getter m44 + method constructor + method invertSelf + method multiplySelf + method preMultiplySelf + method rotateAxisAngleSelf + method rotateFromVectorSelf + method rotateSelf + method scale3dSelf + method scaleSelf + method setMatrixValue + method skewXSelf + method skewYSelf + method translateSelf + setter a + setter b + setter c + setter d + setter e + setter f + setter m11 + setter m12 + setter m13 + setter m14 + setter m21 + setter m22 + setter m23 + setter m24 + setter m31 + setter m32 + setter m33 + setter m34 + setter m41 + setter m42 + setter m43 + setter m44 +interface DOMMatrixReadOnly + static method fromFloat32Array + static method fromFloat64Array + static method fromMatrix + attribute @@toStringTag + getter a + getter b + getter c + getter d + getter e + getter f + getter is2D + getter isIdentity + getter m11 + getter m12 + getter m13 + getter m14 + getter m21 + getter m22 + getter m23 + getter m24 + getter m31 + getter m32 + getter m33 + getter m34 + getter m41 + getter m42 + getter m43 + getter m44 + method constructor + method flipX + method flipY + method inverse + method multiply + method rotate + method rotateAxisAngle + method rotateFromVector + method scale + method scale3d + method skewX + method skewY + method toFloat32Array + method toFloat64Array + method toJSON + method toString + method transformPoint + method translate interface DOMParser attribute @@toStringTag method constructor method parseFromString +interface DOMPoint : DOMPointReadOnly + attribute @@toStringTag + getter w + getter x + getter y + getter z + method constructor + setter w + setter x + setter y + setter z +interface DOMPointReadOnly + static method fromPoint + attribute @@toStringTag + getter w + getter x + getter y + getter z + method constructor + method matrixTransform + method toJSON +interface DOMQuad + static method fromQuad + static method fromRect + attribute @@toStringTag + getter p1 + getter p2 + getter p3 + getter p4 + method constructor + method getBounds + method toJSON +interface DOMRect : DOMRectReadOnly + attribute @@toStringTag + getter height + getter width + getter x + getter y + method constructor + setter height + setter width + setter x + setter y +interface DOMRectReadOnly + static method fromRect + attribute @@toStringTag + getter bottom + getter height + getter left + getter right + getter top + getter width + getter x + getter y + method constructor + method toJSON interface DOMStringList attribute @@toStringTag getter length @@ -7302,7 +7464,7 @@ getter animationName getter elapsedTime method constructor -interface WebKitCSSMatrix +interface WebKitCSSMatrix : DOMMatrixReadOnly attribute @@toStringTag getter a getter b @@ -7327,16 +7489,18 @@ getter m43 getter m44 method constructor - method inverse - method multiply - method rotate - method rotateAxisAngle - method scale + method invertSelf + method multiplySelf + method preMultiplySelf + method rotateAxisAngleSelf + method rotateFromVectorSelf + method rotateSelf + method scale3dSelf + method scaleSelf method setMatrixValue - method skewX - method skewY - method toString - method translate + method skewXSelf + method skewYSelf + method translateSelf setter a setter b setter c
diff --git a/third_party/WebKit/LayoutTests/transforms/3d/general/cssmatrix-3d-zoom-expected.png b/third_party/WebKit/LayoutTests/transforms/3d/general/cssmatrix-3d-zoom-expected.png index cdd5578c..ba6d122 100644 --- a/third_party/WebKit/LayoutTests/transforms/3d/general/cssmatrix-3d-zoom-expected.png +++ b/third_party/WebKit/LayoutTests/transforms/3d/general/cssmatrix-3d-zoom-expected.png Binary files differ
diff --git a/third_party/WebKit/LayoutTests/transforms/cssmatrix-2d-interface-expected.txt b/third_party/WebKit/LayoutTests/transforms/cssmatrix-2d-interface-expected.txt index fb5cb01..66b3e49c 100644 --- a/third_party/WebKit/LayoutTests/transforms/cssmatrix-2d-interface-expected.txt +++ b/third_party/WebKit/LayoutTests/transforms/cssmatrix-2d-interface-expected.txt
@@ -23,7 +23,7 @@ PASS a3[1] is "" Test bad input to string constructor -PASS new WebKitCSSMatrix("banana") threw exception SyntaxError: Failed to construct 'WebKitCSSMatrix': Failed to parse 'banana'.. +PASS new WebKitCSSMatrix("banana") threw exception SyntaxError: Failed to construct 'DOMMatrix': Failed to parse 'banana'.. Test attributes on default matrix PASS m.a is 1 @@ -58,9 +58,9 @@ PASS m.f is 20 Test throwing exception from setMatrixValue -PASS m.setMatrixValue("banana") threw exception SyntaxError: Failed to execute 'setMatrixValue' on 'WebKitCSSMatrix': Failed to parse 'banana'.. -PASS m.setMatrixValue("translate(10em, 20%)") threw exception SyntaxError: Failed to execute 'setMatrixValue' on 'WebKitCSSMatrix': The transformation depends on the box size, which is not supported.. -PASS m.setMatrixValue("translate(10px, 20px) scale()") threw exception SyntaxError: Failed to execute 'setMatrixValue' on 'WebKitCSSMatrix': Failed to parse 'translate(10px, 20px) scale()'.. +PASS m.setMatrixValue("banana") threw exception SyntaxError: Failed to execute 'setMatrixValue' on 'DOMMatrix': Failed to parse 'banana'.. +PASS m.setMatrixValue("translate(10em, 20%)") threw exception SyntaxError: Failed to execute 'setMatrixValue' on 'DOMMatrix': Lengths must be absolute, not relative. +PASS m.setMatrixValue("translate(10px, 20px) scale()") threw exception SyntaxError: Failed to execute 'setMatrixValue' on 'DOMMatrix': Failed to parse 'translate(10px, 20px) scale()'.. Test attributes on translate() and accumulation PASS m2.a is 1 @@ -189,7 +189,12 @@ PASS sx.f is 0 Test multiply with missing argument -PASS m2 is null +PASS m2.a is 1 +PASS m2.b is 2 +PASS m2.c is 3 +PASS m2.d is 4 +PASS m2.e is 5 +PASS m2.f is 6 Test inverse PASS parseFloat(m2.a) is 0.5 @@ -207,8 +212,21 @@ PASS parseFloat(m.e) is 10 PASS parseFloat(m.f) is 20 -Test throwing exception from inverse -PASS m.inverse() threw exception NotSupportedError: Failed to execute 'inverse' on 'WebKitCSSMatrix': The matrix is not invertable.. +Test not invertible matrix +PASS m2.a is NaN +PASS m2.b is NaN +PASS m2.c is NaN +PASS m2.d is NaN +PASS m2.e is NaN +PASS m2.f is NaN + +Test immutability of inverse +PASS m.a is 0 +PASS m.b is 0 +PASS m.c is 0 +PASS m.d is 0 +PASS m.e is 0 +PASS m.f is 0 PASS successfullyParsed is true
diff --git a/third_party/WebKit/LayoutTests/transforms/cssmatrix-2d-interface.xhtml b/third_party/WebKit/LayoutTests/transforms/cssmatrix-2d-interface.xhtml index cc85536..ed7b00c 100644 --- a/third_party/WebKit/LayoutTests/transforms/cssmatrix-2d-interface.xhtml +++ b/third_party/WebKit/LayoutTests/transforms/cssmatrix-2d-interface.xhtml
@@ -255,7 +255,12 @@ debug("Test multiply with missing argument"); m = new WebKitCSSMatrix("matrix(1, 2, 3, 4, 5, 6)"); m2 = m.multiply(); -shouldBe('m2', 'null'); +shouldBe('m2.a', '1'); +shouldBe('m2.b', '2'); +shouldBe('m2.c', '3'); +shouldBe('m2.d', '4'); +shouldBe('m2.e', '5'); +shouldBe('m2.f', '6'); debug(""); debug("Test inverse"); @@ -279,9 +284,25 @@ shouldBe('parseFloat(m.f)', '20'); debug(""); -debug("Test throwing exception from inverse"); +debug("Test not invertible matrix"); m = new WebKitCSSMatrix("matrix(0, 0, 0, 0, 0, 0)"); // not invertible -shouldThrow('m.inverse()'); +m2 = m.inverse(); + +shouldBeNaN('m2.a'); +shouldBeNaN('m2.b'); +shouldBeNaN('m2.c'); +shouldBeNaN('m2.d'); +shouldBeNaN('m2.e'); +shouldBeNaN('m2.f'); + +debug(""); +debug("Test immutability of inverse"); +shouldBe('m.a', '0'); +shouldBe('m.b', '0'); +shouldBe('m.c', '0'); +shouldBe('m.d', '0'); +shouldBe('m.e', '0'); +shouldBe('m.f', '0'); debug("");
diff --git a/third_party/WebKit/LayoutTests/transforms/cssmatrix-3d-interface-expected.txt b/third_party/WebKit/LayoutTests/transforms/cssmatrix-3d-interface-expected.txt index 247a66d..3563c33 100644 --- a/third_party/WebKit/LayoutTests/transforms/cssmatrix-3d-interface-expected.txt +++ b/third_party/WebKit/LayoutTests/transforms/cssmatrix-3d-interface-expected.txt
@@ -29,7 +29,7 @@ PASS a3[1] is "" Test bad input to string constructor -PASS new WebKitCSSMatrix("banana") threw exception SyntaxError: Failed to construct 'WebKitCSSMatrix': Failed to parse 'banana'.. +PASS new WebKitCSSMatrix("banana") threw exception SyntaxError: Failed to construct 'DOMMatrix': Failed to parse 'banana'.. Test attributes on default matrix PASS m.m11 is 1 @@ -104,9 +104,9 @@ PASS m.m44 is 1 Test throwing exception from setMatrixValue -PASS m.setMatrixValue("banana") threw exception SyntaxError: Failed to execute 'setMatrixValue' on 'WebKitCSSMatrix': Failed to parse 'banana'.. -PASS m.setMatrixValue("translate3d(10em, 20%, 40)") threw exception SyntaxError: Failed to execute 'setMatrixValue' on 'WebKitCSSMatrix': Failed to parse 'translate3d(10em, 20%, 40)'.. -PASS m.setMatrixValue("translate3d(10px, 20px, 30px) scale3d()") threw exception SyntaxError: Failed to execute 'setMatrixValue' on 'WebKitCSSMatrix': Failed to parse 'translate3d(10px, 20px, 30px) scale3d()'.. +PASS m.setMatrixValue("banana") threw exception SyntaxError: Failed to execute 'setMatrixValue' on 'DOMMatrix': Failed to parse 'banana'.. +PASS m.setMatrixValue("translate3d(10em, 20%, 40)") threw exception SyntaxError: Failed to execute 'setMatrixValue' on 'DOMMatrix': Failed to parse 'translate3d(10em, 20%, 40)'.. +PASS m.setMatrixValue("translate3d(10px, 20px, 30px) scale3d()") threw exception SyntaxError: Failed to execute 'setMatrixValue' on 'DOMMatrix': Failed to parse 'translate3d(10px, 20px, 30px) scale3d()'.. Test multiply PASS parseFloat(m3.m11) is 538 @@ -216,8 +216,41 @@ PASS parseFloat(m.m43) is 30 PASS parseFloat(m.m44) is 1 -Test throwing exception from inverse -PASS m.inverse() threw exception NotSupportedError: Failed to execute 'inverse' on 'WebKitCSSMatrix': The matrix is not invertable.. +Test not invertible 3d matrix +PASS m2.m11 is NaN +PASS m2.m12 is NaN +PASS m2.m13 is NaN +PASS m2.m14 is NaN +PASS m2.m21 is NaN +PASS m2.m22 is NaN +PASS m2.m23 is NaN +PASS m2.m24 is NaN +PASS m2.m31 is NaN +PASS m2.m32 is NaN +PASS m2.m33 is NaN +PASS m2.m34 is NaN +PASS m2.m41 is NaN +PASS m2.m42 is NaN +PASS m2.m43 is NaN +PASS m2.m44 is NaN + +Test immutability of inverse +PASS m.m11 is 0 +PASS m.m12 is 0 +PASS m.m13 is 0 +PASS m.m14 is 0 +PASS m.m21 is 0 +PASS m.m22 is 0 +PASS m.m23 is 0 +PASS m.m24 is 0 +PASS m.m31 is 0 +PASS m.m32 is 0 +PASS m.m33 is 0 +PASS m.m34 is 0 +PASS m.m41 is 0 +PASS m.m42 is 0 +PASS m.m43 is 0 +PASS m.m44 is 0 Test translate PASS m2.m11 is 1
diff --git a/third_party/WebKit/LayoutTests/transforms/cssmatrix-3d-interface.xhtml b/third_party/WebKit/LayoutTests/transforms/cssmatrix-3d-interface.xhtml index 392949f..2ea85b43 100644 --- a/third_party/WebKit/LayoutTests/transforms/cssmatrix-3d-interface.xhtml +++ b/third_party/WebKit/LayoutTests/transforms/cssmatrix-3d-interface.xhtml
@@ -277,9 +277,45 @@ shouldBe('parseFloat(m.m44)', '1'); debug(""); -debug("Test throwing exception from inverse"); +debug("Test not invertible 3d matrix"); m = new WebKitCSSMatrix("matrix3d(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)"); // not invertible -shouldThrow('m.inverse()'); +m2 = m.inverse(); + +shouldBeNaN('m2.m11'); +shouldBeNaN('m2.m12'); +shouldBeNaN('m2.m13'); +shouldBeNaN('m2.m14'); +shouldBeNaN('m2.m21'); +shouldBeNaN('m2.m22'); +shouldBeNaN('m2.m23'); +shouldBeNaN('m2.m24'); +shouldBeNaN('m2.m31'); +shouldBeNaN('m2.m32'); +shouldBeNaN('m2.m33'); +shouldBeNaN('m2.m34'); +shouldBeNaN('m2.m41'); +shouldBeNaN('m2.m42'); +shouldBeNaN('m2.m43'); +shouldBeNaN('m2.m44'); + +debug(""); +debug("Test immutability of inverse"); +shouldBe('m.m11', '0'); +shouldBe('m.m12', '0'); +shouldBe('m.m13', '0'); +shouldBe('m.m14', '0'); +shouldBe('m.m21', '0'); +shouldBe('m.m22', '0'); +shouldBe('m.m23', '0'); +shouldBe('m.m24', '0'); +shouldBe('m.m31', '0'); +shouldBe('m.m32', '0'); +shouldBe('m.m33', '0'); +shouldBe('m.m34', '0'); +shouldBe('m.m41', '0'); +shouldBe('m.m42', '0'); +shouldBe('m.m43', '0'); +shouldBe('m.m44', '0'); debug(""); debug("Test translate");
diff --git a/third_party/WebKit/LayoutTests/transforms/cssmatrix-crash-expected.txt b/third_party/WebKit/LayoutTests/transforms/cssmatrix-crash-expected.txt deleted file mode 100644 index ddad5eaf..0000000 --- a/third_party/WebKit/LayoutTests/transforms/cssmatrix-crash-expected.txt +++ /dev/null
@@ -1 +0,0 @@ -PASS if no crash
diff --git a/third_party/WebKit/LayoutTests/transforms/cssmatrix-crash.html b/third_party/WebKit/LayoutTests/transforms/cssmatrix-crash.html deleted file mode 100644 index ad928d2..0000000 --- a/third_party/WebKit/LayoutTests/transforms/cssmatrix-crash.html +++ /dev/null
@@ -1,9 +0,0 @@ -<!DOCTYPE html> -<script> -if (window.testRunner) - testRunner.dumpAsText(); - -new WebKitCSSMatrix("translateX(1ex)"); -new WebKitCSSMatrix("translateX(1ch)"); -</script> -<p>PASS if no crash</p>
diff --git a/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/webexposed/global-interface-listing-expected.txt index 03b8ea1..6e2f7880 100644 --- a/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/webexposed/global-interface-listing-expected.txt +++ b/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/webexposed/global-interface-listing-expected.txt
@@ -8499,7 +8499,7 @@ getter animationName getter elapsedTime method constructor -interface WebKitCSSMatrix +interface WebKitCSSMatrix : DOMMatrixReadOnly attribute @@toStringTag getter a getter b @@ -8524,16 +8524,18 @@ getter m43 getter m44 method constructor - method inverse - method multiply - method rotate - method rotateAxisAngle - method scale + method invertSelf + method multiplySelf + method preMultiplySelf + method rotateAxisAngleSelf + method rotateFromVectorSelf + method rotateSelf + method scale3dSelf + method scaleSelf method setMatrixValue - method skewX - method skewY - method toString - method translate + method skewXSelf + method skewYSelf + method translateSelf setter a setter b setter c
diff --git a/third_party/WebKit/LayoutTests/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt b/third_party/WebKit/LayoutTests/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt index c2426aa..8cbddb99 100644 --- a/third_party/WebKit/LayoutTests/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt +++ b/third_party/WebKit/LayoutTests/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
@@ -113,6 +113,168 @@ getter name method constructor method toString +interface DOMMatrix : DOMMatrixReadOnly + attribute @@toStringTag + getter a + getter b + getter c + getter d + getter e + getter f + getter m11 + getter m12 + getter m13 + getter m14 + getter m21 + getter m22 + getter m23 + getter m24 + getter m31 + getter m32 + getter m33 + getter m34 + getter m41 + getter m42 + getter m43 + getter m44 + method constructor + method invertSelf + method multiplySelf + method preMultiplySelf + method rotateAxisAngleSelf + method rotateFromVectorSelf + method rotateSelf + method scale3dSelf + method scaleSelf + method setMatrixValue + method skewXSelf + method skewYSelf + method translateSelf + setter a + setter b + setter c + setter d + setter e + setter f + setter m11 + setter m12 + setter m13 + setter m14 + setter m21 + setter m22 + setter m23 + setter m24 + setter m31 + setter m32 + setter m33 + setter m34 + setter m41 + setter m42 + setter m43 + setter m44 +interface DOMMatrixReadOnly + static method fromFloat32Array + static method fromFloat64Array + static method fromMatrix + attribute @@toStringTag + getter a + getter b + getter c + getter d + getter e + getter f + getter is2D + getter isIdentity + getter m11 + getter m12 + getter m13 + getter m14 + getter m21 + getter m22 + getter m23 + getter m24 + getter m31 + getter m32 + getter m33 + getter m34 + getter m41 + getter m42 + getter m43 + getter m44 + method constructor + method flipX + method flipY + method inverse + method multiply + method rotate + method rotateAxisAngle + method rotateFromVector + method scale + method scale3d + method skewX + method skewY + method toFloat32Array + method toFloat64Array + method toJSON + method toString + method transformPoint + method translate +interface DOMPoint : DOMPointReadOnly + attribute @@toStringTag + getter w + getter x + getter y + getter z + method constructor + setter w + setter x + setter y + setter z +interface DOMPointReadOnly + static method fromPoint + attribute @@toStringTag + getter w + getter x + getter y + getter z + method constructor + method matrixTransform + method toJSON +interface DOMQuad + static method fromQuad + static method fromRect + attribute @@toStringTag + getter p1 + getter p2 + getter p3 + getter p4 + method constructor + method getBounds + method toJSON +interface DOMRect : DOMRectReadOnly + attribute @@toStringTag + getter height + getter width + getter x + getter y + method constructor + setter height + setter width + setter x + setter y +interface DOMRectReadOnly + static method fromRect + attribute @@toStringTag + getter bottom + getter height + getter left + getter right + getter top + getter width + getter x + getter y + method constructor + method toJSON interface DOMStringList attribute @@toStringTag getter length
diff --git a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt index 5ce8f219..b5886b3 100644 --- a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt +++ b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt
@@ -104,6 +104,168 @@ [Worker] getter name [Worker] method constructor [Worker] method toString +[Worker] interface DOMMatrix : DOMMatrixReadOnly +[Worker] attribute @@toStringTag +[Worker] getter a +[Worker] getter b +[Worker] getter c +[Worker] getter d +[Worker] getter e +[Worker] getter f +[Worker] getter m11 +[Worker] getter m12 +[Worker] getter m13 +[Worker] getter m14 +[Worker] getter m21 +[Worker] getter m22 +[Worker] getter m23 +[Worker] getter m24 +[Worker] getter m31 +[Worker] getter m32 +[Worker] getter m33 +[Worker] getter m34 +[Worker] getter m41 +[Worker] getter m42 +[Worker] getter m43 +[Worker] getter m44 +[Worker] method constructor +[Worker] method invertSelf +[Worker] method multiplySelf +[Worker] method preMultiplySelf +[Worker] method rotateAxisAngleSelf +[Worker] method rotateFromVectorSelf +[Worker] method rotateSelf +[Worker] method scale3dSelf +[Worker] method scaleSelf +[Worker] method setMatrixValue +[Worker] method skewXSelf +[Worker] method skewYSelf +[Worker] method translateSelf +[Worker] setter a +[Worker] setter b +[Worker] setter c +[Worker] setter d +[Worker] setter e +[Worker] setter f +[Worker] setter m11 +[Worker] setter m12 +[Worker] setter m13 +[Worker] setter m14 +[Worker] setter m21 +[Worker] setter m22 +[Worker] setter m23 +[Worker] setter m24 +[Worker] setter m31 +[Worker] setter m32 +[Worker] setter m33 +[Worker] setter m34 +[Worker] setter m41 +[Worker] setter m42 +[Worker] setter m43 +[Worker] setter m44 +[Worker] interface DOMMatrixReadOnly +[Worker] static method fromFloat32Array +[Worker] static method fromFloat64Array +[Worker] static method fromMatrix +[Worker] attribute @@toStringTag +[Worker] getter a +[Worker] getter b +[Worker] getter c +[Worker] getter d +[Worker] getter e +[Worker] getter f +[Worker] getter is2D +[Worker] getter isIdentity +[Worker] getter m11 +[Worker] getter m12 +[Worker] getter m13 +[Worker] getter m14 +[Worker] getter m21 +[Worker] getter m22 +[Worker] getter m23 +[Worker] getter m24 +[Worker] getter m31 +[Worker] getter m32 +[Worker] getter m33 +[Worker] getter m34 +[Worker] getter m41 +[Worker] getter m42 +[Worker] getter m43 +[Worker] getter m44 +[Worker] method constructor +[Worker] method flipX +[Worker] method flipY +[Worker] method inverse +[Worker] method multiply +[Worker] method rotate +[Worker] method rotateAxisAngle +[Worker] method rotateFromVector +[Worker] method scale +[Worker] method scale3d +[Worker] method skewX +[Worker] method skewY +[Worker] method toFloat32Array +[Worker] method toFloat64Array +[Worker] method toJSON +[Worker] method toString +[Worker] method transformPoint +[Worker] method translate +[Worker] interface DOMPoint : DOMPointReadOnly +[Worker] attribute @@toStringTag +[Worker] getter w +[Worker] getter x +[Worker] getter y +[Worker] getter z +[Worker] method constructor +[Worker] setter w +[Worker] setter x +[Worker] setter y +[Worker] setter z +[Worker] interface DOMPointReadOnly +[Worker] static method fromPoint +[Worker] attribute @@toStringTag +[Worker] getter w +[Worker] getter x +[Worker] getter y +[Worker] getter z +[Worker] method constructor +[Worker] method matrixTransform +[Worker] method toJSON +[Worker] interface DOMQuad +[Worker] static method fromQuad +[Worker] static method fromRect +[Worker] attribute @@toStringTag +[Worker] getter p1 +[Worker] getter p2 +[Worker] getter p3 +[Worker] getter p4 +[Worker] method constructor +[Worker] method getBounds +[Worker] method toJSON +[Worker] interface DOMRect : DOMRectReadOnly +[Worker] attribute @@toStringTag +[Worker] getter height +[Worker] getter width +[Worker] getter x +[Worker] getter y +[Worker] method constructor +[Worker] setter height +[Worker] setter width +[Worker] setter x +[Worker] setter y +[Worker] interface DOMRectReadOnly +[Worker] static method fromRect +[Worker] attribute @@toStringTag +[Worker] getter bottom +[Worker] getter height +[Worker] getter left +[Worker] getter right +[Worker] getter top +[Worker] getter width +[Worker] getter x +[Worker] getter y +[Worker] method constructor +[Worker] method toJSON [Worker] interface DOMStringList [Worker] attribute @@toStringTag [Worker] getter length
diff --git a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt index a88a980..34730a3b0 100644 --- a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt +++ b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt
@@ -104,6 +104,168 @@ [Worker] getter name [Worker] method constructor [Worker] method toString +[Worker] interface DOMMatrix : DOMMatrixReadOnly +[Worker] attribute @@toStringTag +[Worker] getter a +[Worker] getter b +[Worker] getter c +[Worker] getter d +[Worker] getter e +[Worker] getter f +[Worker] getter m11 +[Worker] getter m12 +[Worker] getter m13 +[Worker] getter m14 +[Worker] getter m21 +[Worker] getter m22 +[Worker] getter m23 +[Worker] getter m24 +[Worker] getter m31 +[Worker] getter m32 +[Worker] getter m33 +[Worker] getter m34 +[Worker] getter m41 +[Worker] getter m42 +[Worker] getter m43 +[Worker] getter m44 +[Worker] method constructor +[Worker] method invertSelf +[Worker] method multiplySelf +[Worker] method preMultiplySelf +[Worker] method rotateAxisAngleSelf +[Worker] method rotateFromVectorSelf +[Worker] method rotateSelf +[Worker] method scale3dSelf +[Worker] method scaleSelf +[Worker] method setMatrixValue +[Worker] method skewXSelf +[Worker] method skewYSelf +[Worker] method translateSelf +[Worker] setter a +[Worker] setter b +[Worker] setter c +[Worker] setter d +[Worker] setter e +[Worker] setter f +[Worker] setter m11 +[Worker] setter m12 +[Worker] setter m13 +[Worker] setter m14 +[Worker] setter m21 +[Worker] setter m22 +[Worker] setter m23 +[Worker] setter m24 +[Worker] setter m31 +[Worker] setter m32 +[Worker] setter m33 +[Worker] setter m34 +[Worker] setter m41 +[Worker] setter m42 +[Worker] setter m43 +[Worker] setter m44 +[Worker] interface DOMMatrixReadOnly +[Worker] static method fromFloat32Array +[Worker] static method fromFloat64Array +[Worker] static method fromMatrix +[Worker] attribute @@toStringTag +[Worker] getter a +[Worker] getter b +[Worker] getter c +[Worker] getter d +[Worker] getter e +[Worker] getter f +[Worker] getter is2D +[Worker] getter isIdentity +[Worker] getter m11 +[Worker] getter m12 +[Worker] getter m13 +[Worker] getter m14 +[Worker] getter m21 +[Worker] getter m22 +[Worker] getter m23 +[Worker] getter m24 +[Worker] getter m31 +[Worker] getter m32 +[Worker] getter m33 +[Worker] getter m34 +[Worker] getter m41 +[Worker] getter m42 +[Worker] getter m43 +[Worker] getter m44 +[Worker] method constructor +[Worker] method flipX +[Worker] method flipY +[Worker] method inverse +[Worker] method multiply +[Worker] method rotate +[Worker] method rotateAxisAngle +[Worker] method rotateFromVector +[Worker] method scale +[Worker] method scale3d +[Worker] method skewX +[Worker] method skewY +[Worker] method toFloat32Array +[Worker] method toFloat64Array +[Worker] method toJSON +[Worker] method toString +[Worker] method transformPoint +[Worker] method translate +[Worker] interface DOMPoint : DOMPointReadOnly +[Worker] attribute @@toStringTag +[Worker] getter w +[Worker] getter x +[Worker] getter y +[Worker] getter z +[Worker] method constructor +[Worker] setter w +[Worker] setter x +[Worker] setter y +[Worker] setter z +[Worker] interface DOMPointReadOnly +[Worker] static method fromPoint +[Worker] attribute @@toStringTag +[Worker] getter w +[Worker] getter x +[Worker] getter y +[Worker] getter z +[Worker] method constructor +[Worker] method matrixTransform +[Worker] method toJSON +[Worker] interface DOMQuad +[Worker] static method fromQuad +[Worker] static method fromRect +[Worker] attribute @@toStringTag +[Worker] getter p1 +[Worker] getter p2 +[Worker] getter p3 +[Worker] getter p4 +[Worker] method constructor +[Worker] method getBounds +[Worker] method toJSON +[Worker] interface DOMRect : DOMRectReadOnly +[Worker] attribute @@toStringTag +[Worker] getter height +[Worker] getter width +[Worker] getter x +[Worker] getter y +[Worker] method constructor +[Worker] setter height +[Worker] setter width +[Worker] setter x +[Worker] setter y +[Worker] interface DOMRectReadOnly +[Worker] static method fromRect +[Worker] attribute @@toStringTag +[Worker] getter bottom +[Worker] getter height +[Worker] getter left +[Worker] getter right +[Worker] getter top +[Worker] getter width +[Worker] getter x +[Worker] getter y +[Worker] method constructor +[Worker] method toJSON [Worker] interface DOMStringList [Worker] attribute @@toStringTag [Worker] getter length
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 5f26cbc..6dd5b94 100644 --- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt +++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
@@ -8507,7 +8507,7 @@ getter animationName getter elapsedTime method constructor -interface WebKitCSSMatrix +interface WebKitCSSMatrix : DOMMatrixReadOnly attribute @@toStringTag getter a getter b @@ -8532,16 +8532,18 @@ getter m43 getter m44 method constructor - method inverse - method multiply - method rotate - method rotateAxisAngle - method scale + method invertSelf + method multiplySelf + method preMultiplySelf + method rotateAxisAngleSelf + method rotateFromVectorSelf + method rotateSelf + method scale3dSelf + method scaleSelf method setMatrixValue - method skewX - method skewY - method toString - method translate + method skewXSelf + method skewYSelf + method translateSelf setter a setter b setter c
diff --git a/third_party/WebKit/Source/core/clipboard/DataTransfer.cpp b/third_party/WebKit/Source/core/clipboard/DataTransfer.cpp index 8aed56e7..fc51051f 100644 --- a/third_party/WebKit/Source/core/clipboard/DataTransfer.cpp +++ b/third_party/WebKit/Source/core/clipboard/DataTransfer.cpp
@@ -25,6 +25,7 @@ #include "core/clipboard/DataTransfer.h" +#include <memory> #include "core/HTMLNames.h" #include "core/clipboard/DataObject.h" #include "core/clipboard/DataTransferItem.h" @@ -34,19 +35,105 @@ #include "core/editing/serializers/Serialization.h" #include "core/fileapi/FileList.h" #include "core/frame/LocalFrame.h" +#include "core/frame/VisualViewport.h" #include "core/html/HTMLImageElement.h" #include "core/html/TextControlElement.h" #include "core/layout/LayoutImage.h" #include "core/layout/LayoutObject.h" #include "core/loader/resource/ImageResourceContent.h" +#include "core/page/ChromeClient.h" +#include "core/page/Page.h" +#include "core/paint/PaintInfo.h" +#include "core/paint/PaintLayer.h" +#include "core/paint/PaintLayerPainter.h" #include "platform/DragImage.h" #include "platform/clipboard/ClipboardMimeTypes.h" #include "platform/clipboard/ClipboardUtilities.h" +#include "platform/graphics/StaticBitmapImage.h" +#include "platform/graphics/paint/PaintRecordBuilder.h" #include "platform/network/mime/MIMETypeRegistry.h" -#include <memory> +#include "public/platform/WebScreenInfo.h" +#include "third_party/skia/include/core/SkSurface.h" namespace blink { +namespace { + +class DraggedNodeImageBuilder { + STACK_ALLOCATED(); + + public: + DraggedNodeImageBuilder(const LocalFrame& local_frame, Node& node) + : local_frame_(&local_frame), + node_(&node) +#if DCHECK_IS_ON() + , + dom_tree_version_(node.GetDocument().DomTreeVersion()) +#endif + { + for (Node& descendant : NodeTraversal::InclusiveDescendantsOf(*node_)) + descendant.SetDragged(true); + } + + ~DraggedNodeImageBuilder() { +#if DCHECK_IS_ON() + DCHECK_EQ(dom_tree_version_, node_->GetDocument().DomTreeVersion()); +#endif + for (Node& descendant : NodeTraversal::InclusiveDescendantsOf(*node_)) + descendant.SetDragged(false); + } + + std::unique_ptr<DragImage> CreateImage() { +#if DCHECK_IS_ON() + DCHECK_EQ(dom_tree_version_, node_->GetDocument().DomTreeVersion()); +#endif + // Construct layout object for |m_node| with pseudo class "-webkit-drag" + local_frame_->View()->UpdateAllLifecyclePhasesExceptPaint(); + LayoutObject* const dragged_layout_object = node_->GetLayoutObject(); + if (!dragged_layout_object) + return nullptr; + // Paint starting at the nearest stacking context, clipped to the object + // itself. This will also paint the contents behind the object if the + // object contains transparency and there are other elements in the same + // stacking context which stacked below. + PaintLayer* layer = dragged_layout_object->EnclosingLayer(); + if (!layer->StackingNode()->IsStackingContext()) + layer = layer->StackingNode()->AncestorStackingContextNode()->Layer(); + IntRect absolute_bounding_box = + dragged_layout_object->AbsoluteBoundingBoxRectIncludingDescendants(); + FloatRect bounding_box = + layer->GetLayoutObject() + .AbsoluteToLocalQuad(FloatQuad(absolute_bounding_box), + kUseTransforms) + .BoundingBox(); + PaintLayerPaintingInfo painting_info(layer, LayoutRect(bounding_box), + kGlobalPaintFlattenCompositingLayers, + LayoutSize()); + PaintLayerFlags flags = kPaintLayerHaveTransparency | + kPaintLayerAppliedTransform | + kPaintLayerUncachedClipRects; + PaintRecordBuilder builder( + DataTransfer::DeviceSpaceBounds(bounding_box, *local_frame_)); + PaintLayerPainter(*layer).Paint(builder.Context(), painting_info, flags); + PropertyTreeState border_box_properties = PropertyTreeState::Root(); + if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { + border_box_properties = + *layer->GetLayoutObject().LocalBorderBoxProperties(); + } + return DataTransfer::CreateDragImageForFrame( + *local_frame_, 1.0f, + LayoutObject::ShouldRespectImageOrientation(dragged_layout_object), + bounding_box, builder, border_box_properties); + } + + private: + const Member<const LocalFrame> local_frame_; + const Member<Node> node_; +#if DCHECK_IS_ON() + const uint64_t dom_tree_version_; +#endif +}; +} // namespace static DragOperation ConvertEffectAllowedToDragOperation(const String& op) { // Values specified in // http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#dom-datatransfer-effectallowed @@ -255,6 +342,68 @@ setDragImage(0, node, loc); } +// static +// Converts from bounds in CSS space to device space based on the given +// frame. +FloatRect DataTransfer::DeviceSpaceBounds(const FloatRect css_bounds, + const LocalFrame& frame) { + float device_scale_factor = frame.GetPage()->DeviceScaleFactorDeprecated(); + float page_scale_factor = frame.GetPage()->GetVisualViewport().Scale(); + FloatRect device_bounds(css_bounds); + device_bounds.SetWidth(css_bounds.Width() * device_scale_factor * + page_scale_factor); + device_bounds.SetHeight(css_bounds.Height() * device_scale_factor * + page_scale_factor); + return device_bounds; +} + +// static +// Returns a DragImage whose bitmap contains |contents|, positioned and scaled +// in device space. +std::unique_ptr<DragImage> DataTransfer::CreateDragImageForFrame( + const LocalFrame& frame, + float opacity, + RespectImageOrientationEnum image_orientation, + const FloatRect& css_bounds, + PaintRecordBuilder& builder, + const PropertyTreeState& property_tree_state) { + float device_scale_factor = frame.GetPage()->DeviceScaleFactorDeprecated(); + float page_scale_factor = frame.GetPage()->GetVisualViewport().Scale(); + + FloatRect device_bounds = DeviceSpaceBounds(css_bounds, frame); + + AffineTransform transform; + transform.Scale(device_scale_factor * page_scale_factor); + transform.Translate(-device_bounds.X(), -device_bounds.Y()); + + // Rasterize upfront, since DragImage::create() is going to do it anyway + // (SkImage::asLegacyBitmap). + SkSurfaceProps surface_props(0, kUnknown_SkPixelGeometry); + sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul( + device_bounds.Width(), device_bounds.Height(), &surface_props); + if (!surface) + return nullptr; + + SkiaPaintCanvas skia_paint_canvas(surface->getCanvas()); + skia_paint_canvas.concat(AffineTransformToSkMatrix(transform)); + builder.EndRecording(skia_paint_canvas, property_tree_state); + + RefPtr<Image> image = StaticBitmapImage::Create(surface->makeImageSnapshot()); + float screen_device_scale_factor = + frame.GetPage()->GetChromeClient().GetScreenInfo().device_scale_factor; + + return DragImage::Create(image.Get(), image_orientation, + screen_device_scale_factor, kInterpolationHigh, + opacity); +} + +// static +std::unique_ptr<DragImage> DataTransfer::NodeImage(const LocalFrame& frame, + Node& node) { + DraggedNodeImageBuilder image_node(frame, node); + return image_node.CreateImage(); +} + std::unique_ptr<DragImage> DataTransfer::CreateDragImage( IntPoint& loc, LocalFrame* frame) const {
diff --git a/third_party/WebKit/Source/core/core_idl_files.gni b/third_party/WebKit/Source/core/core_idl_files.gni index c32a2d6..6c7906f1 100644 --- a/third_party/WebKit/Source/core/core_idl_files.gni +++ b/third_party/WebKit/Source/core/core_idl_files.gni
@@ -62,7 +62,6 @@ "css/StyleMedia.idl", "css/StyleSheet.idl", "css/StyleSheetList.idl", - "css/WebKitCSSMatrix.idl", "css/cssom/CSSImageValue.idl", "css/cssom/CSSKeywordValue.idl", "css/cssom/CSSMatrixComponent.idl",
diff --git a/third_party/WebKit/Source/core/css/BUILD.gn b/third_party/WebKit/Source/core/css/BUILD.gn index 32721fe..2f94d0a 100644 --- a/third_party/WebKit/Source/core/css/BUILD.gn +++ b/third_party/WebKit/Source/core/css/BUILD.gn
@@ -94,8 +94,6 @@ "CSSKeyframesRule.h", "CSSMarkup.cpp", "CSSMarkup.h", - "CSSMatrix.cpp", - "CSSMatrix.h", "CSSMediaRule.cpp", "CSSMediaRule.h", "CSSNamespaceRule.cpp",
diff --git a/third_party/WebKit/Source/core/css/CSSMatrix.cpp b/third_party/WebKit/Source/core/css/CSSMatrix.cpp deleted file mode 100644 index 92af0333..0000000 --- a/third_party/WebKit/Source/core/css/CSSMatrix.cpp +++ /dev/null
@@ -1,205 +0,0 @@ -/* - * Copyright (C) 2008 Apple Inc. 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. ``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 - * 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. - */ - -#include "core/css/CSSMatrix.h" - -#include "bindings/core/v8/ExceptionState.h" -#include "core/CSSPropertyNames.h" -#include "core/CSSValueKeywords.h" -#include "core/css/CSSIdentifierValue.h" -#include "core/css/CSSToLengthConversionData.h" -#include "core/css/StylePropertySet.h" -#include "core/css/parser/CSSParser.h" -#include "core/css/resolver/TransformBuilder.h" -#include "core/dom/ExceptionCode.h" -#include "core/frame/UseCounter.h" -#include "core/layout/api/LayoutViewItem.h" -#include "core/style/ComputedStyle.h" -#include "platform/wtf/MathExtras.h" - -namespace blink { - -CSSMatrix* CSSMatrix::Create(ExecutionContext* execution_context, - const String& s, - ExceptionState& exception_state) { - return new CSSMatrix(s, exception_state); -} - -CSSMatrix::CSSMatrix(const TransformationMatrix& m) - : matrix_(TransformationMatrix::Create(m)) {} - -CSSMatrix::CSSMatrix(const String& s, ExceptionState& exception_state) - : matrix_(TransformationMatrix::Create()) { - setMatrixValue(s, exception_state); -} - -static inline PassRefPtr<ComputedStyle> CreateInitialStyle() { - RefPtr<ComputedStyle> initial_style = ComputedStyle::Create(); - initial_style->GetFont().Update(nullptr); - return initial_style; -} - -void CSSMatrix::setMatrixValue(const String& string, - ExceptionState& exception_state) { - if (string.IsEmpty()) - return; - - if (const CSSValue* value = - CSSParser::ParseSingleValue(CSSPropertyTransform, string)) { - // Check for a "none" transform. In these cases we can use the default - // identity matrix. - if (value->IsIdentifierValue() && - (ToCSSIdentifierValue(value))->GetValueID() == CSSValueNone) - return; - - DEFINE_STATIC_REF(ComputedStyle, initial_style, CreateInitialStyle()); - TransformOperations operations = - TransformBuilder::CreateTransformOperations( - *value, CSSToLengthConversionData(initial_style, initial_style, - LayoutViewItem(nullptr), 1.0f)); - - // Convert transform operations to a TransformationMatrix. This can fail - // if a param has a percentage ('%') - if (operations.DependsOnBoxSize()) { - exception_state.ThrowDOMException(kSyntaxError, - "The transformation depends on the box " - "size, which is not supported."); - } - matrix_ = TransformationMatrix::Create(); - operations.Apply(FloatSize(0, 0), *matrix_); - } else { // There is something there but parsing failed. - exception_state.ThrowDOMException(kSyntaxError, - "Failed to parse '" + string + "'."); - } -} - -// Perform a concatenation of the matrices (this * secondMatrix) -CSSMatrix* CSSMatrix::multiply(CSSMatrix* second_matrix) const { - if (!second_matrix) - return nullptr; - - return CSSMatrix::Create( - TransformationMatrix(*matrix_).Multiply(*second_matrix->matrix_)); -} - -CSSMatrix* CSSMatrix::inverse(ExceptionState& exception_state) const { - if (!matrix_->IsInvertible()) { - exception_state.ThrowDOMException(kNotSupportedError, - "The matrix is not invertable."); - return nullptr; - } - - return CSSMatrix::Create(matrix_->Inverse()); -} - -CSSMatrix* CSSMatrix::translate(double x, double y, double z) const { - if (std::isnan(x)) - x = 0; - if (std::isnan(y)) - y = 0; - if (std::isnan(z)) - z = 0; - return CSSMatrix::Create(TransformationMatrix(*matrix_).Translate3d(x, y, z)); -} - -CSSMatrix* CSSMatrix::scale(double scale_x, - double scale_y, - double scale_z) const { - if (std::isnan(scale_x)) - scale_x = 1; - if (std::isnan(scale_y)) - scale_y = scale_x; - if (std::isnan(scale_z)) - scale_z = 1; - return CSSMatrix::Create( - TransformationMatrix(*matrix_).Scale3d(scale_x, scale_y, scale_z)); -} - -CSSMatrix* CSSMatrix::rotate(double rot_x, double rot_y, double rot_z) const { - if (std::isnan(rot_x)) - rot_x = 0; - - if (std::isnan(rot_y) && std::isnan(rot_z)) { - rot_z = rot_x; - rot_x = 0; - rot_y = 0; - } - - if (std::isnan(rot_y)) - rot_y = 0; - if (std::isnan(rot_z)) - rot_z = 0; - return CSSMatrix::Create( - TransformationMatrix(*matrix_).Rotate3d(rot_x, rot_y, rot_z)); -} - -CSSMatrix* CSSMatrix::rotateAxisAngle(double x, - double y, - double z, - double angle) const { - if (std::isnan(x)) - x = 0; - if (std::isnan(y)) - y = 0; - if (std::isnan(z)) - z = 0; - if (std::isnan(angle)) - angle = 0; - if (!x && !y && !z) - z = 1; - return CSSMatrix::Create( - TransformationMatrix(*matrix_).Rotate3d(x, y, z, angle)); -} - -CSSMatrix* CSSMatrix::skewX(double angle) const { - if (std::isnan(angle)) - angle = 0; - return CSSMatrix::Create(TransformationMatrix(*matrix_).SkewX(angle)); -} - -CSSMatrix* CSSMatrix::skewY(double angle) const { - if (std::isnan(angle)) - angle = 0; - return CSSMatrix::Create(TransformationMatrix(*matrix_).SkewY(angle)); -} - -String CSSMatrix::toString() const { - // FIXME - Need to ensure valid CSS floating point values - // (https://bugs.webkit.org/show_bug.cgi?id=20674) - if (matrix_->IsAffine()) { - return String::Format("matrix(%g, %g, %g, %g, %g, %g)", matrix_->A(), - matrix_->B(), matrix_->C(), matrix_->D(), - matrix_->E(), matrix_->F()); - } - return String::Format( - "matrix3d(%g, %g, %g, %g, %g, %g, %g, %g, %g, %g, %g, %g, %g, %g, %g, " - "%g)", - matrix_->M11(), matrix_->M12(), matrix_->M13(), matrix_->M14(), - matrix_->M21(), matrix_->M22(), matrix_->M23(), matrix_->M24(), - matrix_->M31(), matrix_->M32(), matrix_->M33(), matrix_->M34(), - matrix_->M41(), matrix_->M42(), matrix_->M43(), matrix_->M44()); -} - -} // namespace blink
diff --git a/third_party/WebKit/Source/core/css/CSSMatrix.h b/third_party/WebKit/Source/core/css/CSSMatrix.h deleted file mode 100644 index 1c25efb2..0000000 --- a/third_party/WebKit/Source/core/css/CSSMatrix.h +++ /dev/null
@@ -1,171 +0,0 @@ -/* - * Copyright (C) 2008 Apple Inc. 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. ``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 - * 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 CSSMatrix_h -#define CSSMatrix_h - -#include <memory> -#include "platform/bindings/ScriptWrappable.h" -#include "platform/transforms/TransformationMatrix.h" -#include "platform/wtf/text/WTFString.h" - -namespace blink { - -class ExceptionState; -class ExecutionContext; - -class CSSMatrix final : public GarbageCollectedFinalized<CSSMatrix>, - public ScriptWrappable { - DEFINE_WRAPPERTYPEINFO(); - - public: - static CSSMatrix* Create(const TransformationMatrix& m) { - return new CSSMatrix(m); - } - static CSSMatrix* Create(ExecutionContext*, const String&, ExceptionState&); - - double a() const { return matrix_->A(); } - double b() const { return matrix_->B(); } - double c() const { return matrix_->C(); } - double d() const { return matrix_->D(); } - double e() const { return matrix_->E(); } - double f() const { return matrix_->F(); } - - void setA(double f) { matrix_->SetA(f); } - void setB(double f) { matrix_->SetB(f); } - void setC(double f) { matrix_->SetC(f); } - void setD(double f) { matrix_->SetD(f); } - void setE(double f) { matrix_->SetE(f); } - void setF(double f) { matrix_->SetF(f); } - - double m11() const { return matrix_->M11(); } - double m12() const { return matrix_->M12(); } - double m13() const { return matrix_->M13(); } - double m14() const { return matrix_->M14(); } - double m21() const { return matrix_->M21(); } - double m22() const { return matrix_->M22(); } - double m23() const { return matrix_->M23(); } - double m24() const { return matrix_->M24(); } - double m31() const { return matrix_->M31(); } - double m32() const { return matrix_->M32(); } - double m33() const { return matrix_->M33(); } - double m34() const { return matrix_->M34(); } - double m41() const { return matrix_->M41(); } - double m42() const { return matrix_->M42(); } - double m43() const { return matrix_->M43(); } - double m44() const { return matrix_->M44(); } - - void setM11(double f) { matrix_->SetM11(f); } - void setM12(double f) { matrix_->SetM12(f); } - void setM13(double f) { matrix_->SetM13(f); } - void setM14(double f) { matrix_->SetM14(f); } - void setM21(double f) { matrix_->SetM21(f); } - void setM22(double f) { matrix_->SetM22(f); } - void setM23(double f) { matrix_->SetM23(f); } - void setM24(double f) { matrix_->SetM24(f); } - void setM31(double f) { matrix_->SetM31(f); } - void setM32(double f) { matrix_->SetM32(f); } - void setM33(double f) { matrix_->SetM33(f); } - void setM34(double f) { matrix_->SetM34(f); } - void setM41(double f) { matrix_->SetM41(f); } - void setM42(double f) { matrix_->SetM42(f); } - void setM43(double f) { matrix_->SetM43(f); } - void setM44(double f) { matrix_->SetM44(f); } - - void setMatrixValue(const String&, ExceptionState&); - - // The following math function return a new matrix with the - // specified operation applied. The this value is not modified. - - // Multiply this matrix by secondMatrix, on the right - // (result = this * secondMatrix) - CSSMatrix* multiply(CSSMatrix* second_matrix) const; - - // Return the inverse of this matrix. Throw an exception if the matrix is not - // invertible. - CSSMatrix* inverse(ExceptionState&) const; - - // Return this matrix translated by the passed values. - // Passing a NaN will use a value of 0. This allows the 3D form to used for 2D - // operations. - // Operation is performed as though the this matrix is multiplied by a matrix - // with the translation values on the left - // (result = translation(x,y,z) * this) - CSSMatrix* translate(double x, double y, double z) const; - - // Returns this matrix scaled by the passed values. - // Passing scaleX or scaleZ as NaN uses a value of 1, but passing scaleY of - // NaN makes it the same as scaleX. This allows the 3D form to used for 2D - // operations Operation is performed as though the this matrix is multiplied - // by a matrix with the scale values on the left - // (result = scale(x,y,z) * this) - CSSMatrix* scale(double scale_x, double scale_y, double scale_z) const; - - // Returns this matrix rotated by the passed values. - // If rotY and rotZ are NaN, rotate about Z (rotX=0, rotateY=0, rotateZ=rotX). - // Otherwise use a rotation value of 0 for any passed NaN. - // Operation is performed as though the this matrix is multiplied by a matrix - // with the rotation values on the left (result = rotation(x,y,z) * this) - CSSMatrix* rotate(double rot_x, double rot_y, double rot_z) const; - - // Returns this matrix rotated about the passed axis by the passed angle. - // Passing a NaN will use a value of 0. If the axis is (0,0,0) use a value - // Operation is performed as though the this matrix is multiplied by a matrix - // with the rotation values on the left - // (result = rotation(x,y,z,angle) * this) - CSSMatrix* rotateAxisAngle(double x, double y, double z, double angle) const; - - // Return this matrix skewed along the X axis by the passed values. - // Passing a NaN will use a value of 0. - // Operation is performed as though the this matrix is multiplied by a matrix - // with the skew values on the left (result = skewX(angle) * this) - CSSMatrix* skewX(double angle) const; - - // Return this matrix skewed along the Y axis by the passed values. - // Passing a NaN will use a value of 0. - // Operation is performed as though the this matrix is multiplied by a matrix - // with the skew values on the left (result = skewY(angle) * this) - CSSMatrix* skewY(double angle) const; - - const TransformationMatrix& Transform() const { return *matrix_; } - - String toString() const; - - DEFINE_INLINE_TRACE() {} - - protected: - CSSMatrix(const TransformationMatrix&); - CSSMatrix(const String&, ExceptionState&); - - // TransformationMatrix needs to be 16-byte aligned. PartitionAlloc - // supports 16-byte alignment but Oilpan doesn't. So we use an std::unique_ptr - // to allocate TransformationMatrix on PartitionAlloc. - // TODO(oilpan): Oilpan should support 16-byte aligned allocations. - std::unique_ptr<TransformationMatrix> matrix_; -}; - -} // namespace blink - -#endif // CSSMatrix_h
diff --git a/third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h b/third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h index c29bbbf..bffbfbd 100644 --- a/third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h +++ b/third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h
@@ -554,39 +554,6 @@ } template <> -inline CSSIdentifierValue::CSSIdentifierValue(EFlexWrap e) - : CSSValue(kIdentifierClass) { - switch (e) { - case EFlexWrap::kNowrap: - value_id_ = CSSValueNowrap; - break; - case EFlexWrap::kWrap: - value_id_ = CSSValueWrap; - break; - case EFlexWrap::kWrapReverse: - value_id_ = CSSValueWrapReverse; - break; - } -} - -template <> -inline EFlexWrap CSSIdentifierValue::ConvertTo() const { - switch (value_id_) { - case CSSValueNowrap: - return EFlexWrap::kNowrap; - case CSSValueWrap: - return EFlexWrap::kWrap; - case CSSValueWrapReverse: - return EFlexWrap::kWrapReverse; - default: - break; - } - - NOTREACHED(); - return EFlexWrap::kNowrap; -} - -template <> inline CSSIdentifierValue::CSSIdentifierValue(EFloat e) : CSSValue(kIdentifierClass) { switch (e) {
diff --git a/third_party/WebKit/Source/core/css/CSSProperties.json5 b/third_party/WebKit/Source/core/css/CSSProperties.json5 index 833718dd..e143700 100644 --- a/third_party/WebKit/Source/core/css/CSSProperties.json5 +++ b/third_party/WebKit/Source/core/css/CSSProperties.json5
@@ -1208,7 +1208,7 @@ converter: "ConvertLengthOrAuto", interpolable: true, type_name: "Length", - field_template: "storage_only", + field_template: "external", default_value: "Length(kAuto)", field_group: "rare-non-inherited->flexible-box", }, @@ -1226,7 +1226,7 @@ api_methods: ["parseSingleValue"], interpolable: true, type_name: "float", - field_template: "storage_only", + field_template: "primitive", default_value: "0.0f", field_group: "rare-non-inherited->flexible-box", }, @@ -1236,17 +1236,17 @@ api_methods: ["parseSingleValue"], interpolable: true, type_name: "float", - field_template: "storage_only", + field_template: "primitive", default_value: "1.0f", field_group: "rare-non-inherited->flexible-box", }, { name: "flex-wrap", type_name: "EFlexWrap", - field_template: "storage_only", - default_value: "EFlexWrap::kNowrap", - field_size: 2, + field_template: "keyword", + default_value: "nowrap", field_group: "rare-non-inherited->flexible-box", + keywords: ["nowrap", "wrap", "wrap-reverse"], }, { name: "float",
diff --git a/third_party/WebKit/Source/core/css/FontFaceSetLoadEvent.idl b/third_party/WebKit/Source/core/css/FontFaceSetLoadEvent.idl index 047b12d..f22dd2c 100644 --- a/third_party/WebKit/Source/core/css/FontFaceSetLoadEvent.idl +++ b/third_party/WebKit/Source/core/css/FontFaceSetLoadEvent.idl
@@ -32,7 +32,7 @@ [ Constructor(DOMString type, optional FontFaceSetLoadEventInit eventInitDict), - // TODO(lunalu): Exposed=(Window,Worker) + // TODO(loonybear): Exposed=(Window,Worker) Exposed=Window ] interface FontFaceSetLoadEvent : Event { [SameObject] readonly attribute FrozenArray<FontFace> fontfaces;
diff --git a/third_party/WebKit/Source/core/css/WebKitCSSMatrix.idl b/third_party/WebKit/Source/core/css/WebKitCSSMatrix.idl deleted file mode 100644 index 76647fa..0000000 --- a/third_party/WebKit/Source/core/css/WebKitCSSMatrix.idl +++ /dev/null
@@ -1,104 +0,0 @@ -/* - * Copyright (C) 2008, 2010 Apple Inc. 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. ``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 - * 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. - */ - -// Introduced in DOM Level ?: -[ - Constructor(optional DOMString cssValue = null), - ConstructorCallWith=ExecutionContext, - ImplementedAs=CSSMatrix, - RaisesException=Constructor -] interface WebKitCSSMatrix { - - // These attributes are simple aliases for certain elements of the 4x4 matrix - attribute unrestricted double a; // alias for m11 - attribute unrestricted double b; // alias for m12 - attribute unrestricted double c; // alias for m21 - attribute unrestricted double d; // alias for m22 - attribute unrestricted double e; // alias for m41 - attribute unrestricted double f; // alias for m42 - - attribute unrestricted double m11; - attribute unrestricted double m12; - attribute unrestricted double m13; - attribute unrestricted double m14; - attribute unrestricted double m21; - attribute unrestricted double m22; - attribute unrestricted double m23; - attribute unrestricted double m24; - attribute unrestricted double m31; - attribute unrestricted double m32; - attribute unrestricted double m33; - attribute unrestricted double m34; - attribute unrestricted double m41; - attribute unrestricted double m42; - attribute unrestricted double m43; - attribute unrestricted double m44; - - [RaisesException, MeasureAs=WebkitCSSMatrixSetMatrixValue] void setMatrixValue([Default=Undefined] optional DOMString string); - - // Multiply this matrix by secondMatrix, on the right (result = this * secondMatrix) - [LegacyInterfaceTypeChecking] WebKitCSSMatrix multiply([Default=Undefined] optional WebKitCSSMatrix secondMatrix); - - // Return the inverse of this matrix. Throw an exception if the matrix is not invertible - [RaisesException] WebKitCSSMatrix inverse(); - - // Return this matrix translated by the passed values. - // Passing a NaN will use a value of 0. This allows the 3D form to used for 2D operations - WebKitCSSMatrix translate([Default=Undefined] optional unrestricted double x, - [Default=Undefined] optional unrestricted double y, - [Default=Undefined] optional unrestricted double z); - - // Returns this matrix scaled by the passed values. - // Passing scaleX or scaleZ as NaN uses a value of 1, but passing scaleY of NaN - // makes it the same as scaleX. This allows the 3D form to used for 2D operations - WebKitCSSMatrix scale([Default=Undefined] optional unrestricted double scaleX, - [Default=Undefined] optional unrestricted double scaleY, - [Default=Undefined] optional unrestricted double scaleZ); - - // Returns this matrix rotated by the passed values. - // If rotY and rotZ are NaN, rotate about Z (rotX=0, rotateY=0, rotateZ=rotX). - // Otherwise use a rotation value of 0 for any passed NaN. - WebKitCSSMatrix rotate([Default=Undefined] optional unrestricted double rotX, - [Default=Undefined] optional unrestricted double rotY, - [Default=Undefined] optional unrestricted double rotZ); - - // Returns this matrix rotated about the passed axis by the passed angle. - // Passing a NaN will use a value of 0. If the axis is (0,0,0) use a value - // of (0,0,1). - WebKitCSSMatrix rotateAxisAngle([Default=Undefined] optional unrestricted double x, - [Default=Undefined] optional unrestricted double y, - [Default=Undefined] optional unrestricted double z, - [Default=Undefined] optional unrestricted double angle); - - // Returns this matrix skewed along the X axis by the passed values. - // Passing a NaN will use a value of 0. - WebKitCSSMatrix skewX([Default=Undefined] optional unrestricted double angle); - - // Returns this matrix skewed along the Y axis by the passed values. - // Passing a NaN will use a value of 0. - WebKitCSSMatrix skewY([Default=Undefined] optional unrestricted double angle); - - [NotEnumerable] stringifier; -};
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSMatrixComponent.idl b/third_party/WebKit/Source/core/css/cssom/CSSMatrixComponent.idl index a2a6738..7dd2600 100644 --- a/third_party/WebKit/Source/core/css/cssom/CSSMatrixComponent.idl +++ b/third_party/WebKit/Source/core/css/cssom/CSSMatrixComponent.idl
@@ -9,8 +9,7 @@ [ Constructor(DOMMatrixReadOnly matrix), Exposed=(Window,PaintWorklet), - RuntimeEnabled=CSSTypedOM, - RuntimeEnabled=GeometryInterfaces + RuntimeEnabled=CSSTypedOM ] interface CSSMatrixComponent : CSSTransformComponent { attribute DOMMatrix matrix; };
diff --git a/third_party/WebKit/Source/core/editing/VisibleUnits.cpp b/third_party/WebKit/Source/core/editing/VisibleUnits.cpp index 3bfedbb..d6842c7 100644 --- a/third_party/WebKit/Source/core/editing/VisibleUnits.cpp +++ b/third_party/WebKit/Source/core/editing/VisibleUnits.cpp
@@ -749,48 +749,52 @@ return prev_box->BidiLevel() > inline_box->BidiLevel(); } +static InlineBoxPosition AdjustInlineBoxPositionForPrimaryDirection( + InlineBox* inline_box, + int caret_offset) { + if (caret_offset == inline_box->CaretRightmostOffset()) { + InlineBox* const next_box = inline_box->NextLeafChild(); + if (!next_box || next_box->BidiLevel() >= inline_box->BidiLevel()) + return InlineBoxPosition(inline_box, caret_offset); + + const unsigned level = next_box->BidiLevel(); + InlineBox* const prev_box = + InlineBoxTraversal::FindLeftBidiRun(*inline_box, level); + + // For example, abc FED 123 ^ CBA + if (prev_box && prev_box->BidiLevel() == level) + return InlineBoxPosition(inline_box, caret_offset); + + // For example, abc 123 ^ CBA + inline_box = InlineBoxTraversal::FindRightBoundaryOfEntireBidiRun( + *inline_box, level); + return InlineBoxPosition(inline_box, inline_box->CaretRightmostOffset()); + } + + if (IsStartOfDifferentDirection(inline_box)) + return InlineBoxPosition(inline_box, caret_offset); + + const unsigned level = inline_box->PrevLeafChild()->BidiLevel(); + InlineBox* const next_box = + InlineBoxTraversal::FindRightBidiRun(*inline_box, level); + + if (next_box && next_box->BidiLevel() == level) + return InlineBoxPosition(inline_box, caret_offset); + + inline_box = + InlineBoxTraversal::FindLeftBoundaryOfEntireBidiRun(*inline_box, level); + return InlineBoxPosition(inline_box, inline_box->CaretLeftmostOffset()); +} + static InlineBoxPosition AdjustInlineBoxPositionForTextDirection( InlineBox* inline_box, int caret_offset, UnicodeBidi unicode_bidi, TextDirection primary_direction) { - unsigned char level = inline_box->BidiLevel(); + if (inline_box->Direction() == primary_direction) + return AdjustInlineBoxPositionForPrimaryDirection(inline_box, caret_offset); - if (inline_box->Direction() == primary_direction) { - if (caret_offset == inline_box->CaretRightmostOffset()) { - InlineBox* next_box = inline_box->NextLeafChild(); - if (!next_box || next_box->BidiLevel() >= level) - return InlineBoxPosition(inline_box, caret_offset); - - level = next_box->BidiLevel(); - InlineBox* const prev_box = - InlineBoxTraversal::FindLeftBidiRun(*inline_box, level); - - // For example, abc FED 123 ^ CBA - if (prev_box && prev_box->BidiLevel() == level) - return InlineBoxPosition(inline_box, caret_offset); - - // For example, abc 123 ^ CBA - inline_box = InlineBoxTraversal::FindRightBoundaryOfEntireBidiRun( - *inline_box, level); - return InlineBoxPosition(inline_box, inline_box->CaretRightmostOffset()); - } - - if (IsStartOfDifferentDirection(inline_box)) - return InlineBoxPosition(inline_box, caret_offset); - - level = inline_box->PrevLeafChild()->BidiLevel(); - InlineBox* const next_box = - InlineBoxTraversal::FindRightBidiRun(*inline_box, level); - - if (next_box && next_box->BidiLevel() == level) - return InlineBoxPosition(inline_box, caret_offset); - - inline_box = - InlineBoxTraversal::FindLeftBoundaryOfEntireBidiRun(*inline_box, level); - return InlineBoxPosition(inline_box, inline_box->CaretLeftmostOffset()); - } - + const unsigned char level = inline_box->BidiLevel(); if (caret_offset == inline_box->CaretLeftmostOffset()) { InlineBox* prev_box = inline_box->PrevLeafChildIgnoringLineBreak(); if (!prev_box || prev_box->BidiLevel() < level) {
diff --git a/third_party/WebKit/Source/core/editing/VisibleUnits.h b/third_party/WebKit/Source/core/editing/VisibleUnits.h index 77618f7..15a8099 100644 --- a/third_party/WebKit/Source/core/editing/VisibleUnits.h +++ b/third_party/WebKit/Source/core/editing/VisibleUnits.h
@@ -386,9 +386,10 @@ const VisiblePosition&, EditableType); -Position PreviousRootInlineBoxCandidatePosition(Node*, - const VisiblePosition&, - EditableType); +CORE_EXPORT Position +PreviousRootInlineBoxCandidatePosition(Node*, + const VisiblePosition&, + EditableType); } // namespace blink
diff --git a/third_party/WebKit/Source/core/editing/VisibleUnitsLine.cpp b/third_party/WebKit/Source/core/editing/VisibleUnitsLine.cpp index 215ab70..0cedabce 100644 --- a/third_party/WebKit/Source/core/editing/VisibleUnitsLine.cpp +++ b/third_party/WebKit/Source/core/editing/VisibleUnitsLine.cpp
@@ -261,7 +261,7 @@ bool InSameLine(const Node& node, const VisiblePosition& visible_position) { if (!node.GetLayoutObject()) - return false; + return true; return InSameLine(CreateVisiblePosition( FirstPositionInOrBeforeNode(const_cast<Node*>(&node))), visible_position);
diff --git a/third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp b/third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp index 6b2f9149..88e68409 100644 --- a/third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp +++ b/third_party/WebKit/Source/core/editing/VisibleUnitsTest.cpp
@@ -1909,4 +1909,20 @@ EXPECT_EQ(Position(text, 2), start); } +TEST_F(VisibleUnitsTest, + PreviousRootInlineBoxCandidatePositionWithDisplayNone) { + SetBodyContent( + "<div contenteditable>" + "<div id=one>one abc</div>" + "<div id=two>two <b id=none style=display:none>def</b> ghi</div>" + "</div>"); + Element* const one = GetDocument().getElementById("one"); + Element* const two = GetDocument().getElementById("two"); + const VisiblePosition& visible_position = + CreateVisiblePosition(Position::LastPositionInNode(two)); + EXPECT_EQ(Position(one->firstChild(), 7), + PreviousRootInlineBoxCandidatePosition( + two->lastChild(), visible_position, kContentIsEditable)); +} + } // namespace blink
diff --git a/third_party/WebKit/Source/core/frame/LocalFrame.cpp b/third_party/WebKit/Source/core/frame/LocalFrame.cpp index f64499cac..3f9bd30 100644 --- a/third_party/WebKit/Source/core/frame/LocalFrame.cpp +++ b/third_party/WebKit/Source/core/frame/LocalFrame.cpp
@@ -52,7 +52,6 @@ #include "core/frame/LocalFrameView.h" #include "core/frame/PerformanceMonitor.h" #include "core/frame/Settings.h" -#include "core/frame/VisualViewport.h" #include "core/html/HTMLFrameElementBase.h" #include "core/html/HTMLPlugInElement.h" #include "core/html/PluginDocument.h" @@ -66,32 +65,23 @@ #include "core/loader/DocumentLoader.h" #include "core/loader/FrameLoadRequest.h" #include "core/loader/NavigationScheduler.h" -#include "core/page/ChromeClient.h" #include "core/page/DragController.h" #include "core/page/FocusController.h" -#include "core/page/Page.h" #include "core/page/scrolling/ScrollingCoordinator.h" #include "core/paint/ObjectPainter.h" -#include "core/paint/PaintInfo.h" -#include "core/paint/PaintLayer.h" -#include "core/paint/PaintLayerPainter.h" #include "core/paint/TransformRecorder.h" #include "core/plugins/PluginView.h" #include "core/probe/CoreProbes.h" #include "core/svg/SVGDocumentExtensions.h" #include "core/timing/Performance.h" -#include "platform/DragImage.h" #include "platform/Histogram.h" #include "platform/PluginScriptForbiddenScope.h" #include "platform/RuntimeEnabledFeatures.h" #include "platform/ScriptForbiddenScope.h" #include "platform/WebFrameScheduler.h" -#include "platform/graphics/GraphicsContext.h" -#include "platform/graphics/StaticBitmapImage.h" #include "platform/graphics/paint/ClipRecorder.h" #include "platform/graphics/paint/PaintCanvas.h" #include "platform/graphics/paint/PaintController.h" -#include "platform/graphics/paint/PaintRecordBuilder.h" #include "platform/graphics/paint/TransformDisplayItem.h" #include "platform/instrumentation/resource_coordinator/FrameResourceCoordinator.h" #include "platform/json/JSONValues.h" @@ -105,156 +95,14 @@ #include "platform/wtf/StdLibExtras.h" #include "public/platform/InterfaceProvider.h" #include "public/platform/InterfaceRegistry.h" -#include "public/platform/WebScreenInfo.h" #include "public/platform/WebURLRequest.h" -#include "third_party/skia/include/core/SkImage.h" -#include "third_party/skia/include/core/SkSurface.h" namespace blink { using namespace HTMLNames; -// static -// Converts from bounds in CSS space to device space based on the given -// frame. -// TODO(tanvir.rizvi): DeviceSpaceBounds is used for drag related functionality -// and is irrelevant to core functionality of LocalFrame. This should be moved -// out of LocalFrame to appropriate place. -FloatRect DataTransfer::DeviceSpaceBounds(const FloatRect css_bounds, - const LocalFrame& frame) { - float device_scale_factor = frame.GetPage()->DeviceScaleFactorDeprecated(); - float page_scale_factor = frame.GetPage()->GetVisualViewport().Scale(); - FloatRect device_bounds(css_bounds); - device_bounds.SetWidth(css_bounds.Width() * device_scale_factor * - page_scale_factor); - device_bounds.SetHeight(css_bounds.Height() * device_scale_factor * - page_scale_factor); - return device_bounds; -} - -// static -// Returns a DragImage whose bitmap contains |contents|, positioned and scaled -// in device space. -// TODO(tanvir.rizvi): CreateDragImageForFrame is used for drag related -// functionality and is irrelevant to core functionality of LocalFrame. This -// should be moved out of LocalFrame to appropriate place. -std::unique_ptr<DragImage> DataTransfer::CreateDragImageForFrame( - const LocalFrame& frame, - float opacity, - RespectImageOrientationEnum image_orientation, - const FloatRect& css_bounds, - PaintRecordBuilder& builder, - const PropertyTreeState& property_tree_state) { - float device_scale_factor = frame.GetPage()->DeviceScaleFactorDeprecated(); - float page_scale_factor = frame.GetPage()->GetVisualViewport().Scale(); - - FloatRect device_bounds = DeviceSpaceBounds(css_bounds, frame); - - AffineTransform transform; - transform.Scale(device_scale_factor * page_scale_factor); - transform.Translate(-device_bounds.X(), -device_bounds.Y()); - - // Rasterize upfront, since DragImage::create() is going to do it anyway - // (SkImage::asLegacyBitmap). - SkSurfaceProps surface_props(0, kUnknown_SkPixelGeometry); - sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul( - device_bounds.Width(), device_bounds.Height(), &surface_props); - if (!surface) - return nullptr; - - SkiaPaintCanvas skia_paint_canvas(surface->getCanvas()); - skia_paint_canvas.concat(AffineTransformToSkMatrix(transform)); - builder.EndRecording(skia_paint_canvas, property_tree_state); - - RefPtr<Image> image = StaticBitmapImage::Create(surface->makeImageSnapshot()); - float screen_device_scale_factor = - frame.GetPage()->GetChromeClient().GetScreenInfo().device_scale_factor; - - return DragImage::Create(image.Get(), image_orientation, - screen_device_scale_factor, kInterpolationHigh, - opacity); -} - namespace { -// TODO(tanvir.rizvi): DraggedNodeImageBuilder is used for drag related -// functionality and is irrelevant to core functionality of LocalFrame. This -// should be moved out of LocalFrame to appropriate place. -class DraggedNodeImageBuilder { - STACK_ALLOCATED(); - - public: - DraggedNodeImageBuilder(const LocalFrame& local_frame, Node& node) - : local_frame_(&local_frame), - node_(&node) -#if DCHECK_IS_ON() - , - dom_tree_version_(node.GetDocument().DomTreeVersion()) -#endif - { - for (Node& descendant : NodeTraversal::InclusiveDescendantsOf(*node_)) - descendant.SetDragged(true); - } - - ~DraggedNodeImageBuilder() { -#if DCHECK_IS_ON() - DCHECK_EQ(dom_tree_version_, node_->GetDocument().DomTreeVersion()); -#endif - for (Node& descendant : NodeTraversal::InclusiveDescendantsOf(*node_)) - descendant.SetDragged(false); - } - - std::unique_ptr<DragImage> CreateImage() { -#if DCHECK_IS_ON() - DCHECK_EQ(dom_tree_version_, node_->GetDocument().DomTreeVersion()); -#endif - // Construct layout object for |m_node| with pseudo class "-webkit-drag" - local_frame_->View()->UpdateAllLifecyclePhasesExceptPaint(); - LayoutObject* const dragged_layout_object = node_->GetLayoutObject(); - if (!dragged_layout_object) - return nullptr; - // Paint starting at the nearest stacking context, clipped to the object - // itself. This will also paint the contents behind the object if the - // object contains transparency and there are other elements in the same - // stacking context which stacked below. - PaintLayer* layer = dragged_layout_object->EnclosingLayer(); - if (!layer->StackingNode()->IsStackingContext()) - layer = layer->StackingNode()->AncestorStackingContextNode()->Layer(); - IntRect absolute_bounding_box = - dragged_layout_object->AbsoluteBoundingBoxRectIncludingDescendants(); - FloatRect bounding_box = - layer->GetLayoutObject() - .AbsoluteToLocalQuad(FloatQuad(absolute_bounding_box), - kUseTransforms) - .BoundingBox(); - PaintLayerPaintingInfo painting_info(layer, LayoutRect(bounding_box), - kGlobalPaintFlattenCompositingLayers, - LayoutSize()); - PaintLayerFlags flags = kPaintLayerHaveTransparency | - kPaintLayerAppliedTransform | - kPaintLayerUncachedClipRects; - PaintRecordBuilder builder( - DataTransfer::DeviceSpaceBounds(bounding_box, *local_frame_)); - PaintLayerPainter(*layer).Paint(builder.Context(), painting_info, flags); - PropertyTreeState border_box_properties = PropertyTreeState::Root(); - if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { - border_box_properties = - *layer->GetLayoutObject().LocalBorderBoxProperties(); - } - return DataTransfer::CreateDragImageForFrame( - *local_frame_, 1.0f, - LayoutObject::ShouldRespectImageOrientation(dragged_layout_object), - bounding_box, builder, border_box_properties); - } - - private: - const Member<const LocalFrame> local_frame_; - const Member<Node> node_; -#if DCHECK_IS_ON() - const uint64_t dom_tree_version_; -#endif -}; - inline float ParentPageZoomFactor(LocalFrame* frame) { Frame* parent = frame->Tree().Parent(); if (!parent || !parent->IsLocalFrame()) @@ -768,42 +616,6 @@ return ratio; } -// static -// TODO(tanvir.rizvi): NodeImage is used only by DataTransfer, -// and is irrelevant to LocalFrame core functionality, so it can be moved to -// DataTransfer. -std::unique_ptr<DragImage> DataTransfer::NodeImage(const LocalFrame& frame, - Node& node) { - DraggedNodeImageBuilder image_node(frame, node); - return image_node.CreateImage(); -} - -// static -// TODO(tanvir.rizvi): DragImageForSelection is used only by DragController, -// and is irrelevant to LocalFrame core functionality, so it can be moved to -// DragController. -std::unique_ptr<DragImage> DragController::DragImageForSelection( - const LocalFrame& frame, - float opacity) { - if (!frame.Selection().ComputeVisibleSelectionInDOMTreeDeprecated().IsRange()) - return nullptr; - - frame.View()->UpdateAllLifecyclePhasesExceptPaint(); - DCHECK(frame.GetDocument()->IsActive()); - - FloatRect painting_rect = FloatRect(frame.Selection().Bounds()); - GlobalPaintFlags paint_flags = - kGlobalPaintSelectionOnly | kGlobalPaintFlattenCompositingLayers; - - PaintRecordBuilder builder( - DataTransfer::DeviceSpaceBounds(painting_rect, frame)); - frame.View()->PaintContents(builder.Context(), paint_flags, - EnclosingIntRect(painting_rect)); - return DataTransfer::CreateDragImageForFrame( - frame, opacity, kDoNotRespectImageOrientation, painting_rect, builder, - PropertyTreeState::Root()); -} - String LocalFrame::SelectedText() const { return Selection().SelectedText(); }
diff --git a/third_party/WebKit/Source/core/frame/LocalFrameView.cpp b/third_party/WebKit/Source/core/frame/LocalFrameView.cpp index 77b04ca..cee41dcd 100644 --- a/third_party/WebKit/Source/core/frame/LocalFrameView.cpp +++ b/third_party/WebKit/Source/core/frame/LocalFrameView.cpp
@@ -1772,7 +1772,8 @@ *viewport_constrained_objects_) { LayoutObject* layout_object = viewport_constrained_object; LayoutItem layout_item = LayoutItem(layout_object); - DCHECK(layout_item.Style()->HasViewportConstrainedPosition()); + DCHECK(layout_item.Style()->HasViewportConstrainedPosition() || + layout_item.Style()->HasStickyConstrainedPosition()); DCHECK(layout_item.HasLayer()); PaintLayer* layer = LayoutBoxModel(layout_item).Layer();
diff --git a/third_party/WebKit/Source/core/frame/LocalFrameViewTest.cpp b/third_party/WebKit/Source/core/frame/LocalFrameViewTest.cpp index 32fe830d..3a7bf59c 100644 --- a/third_party/WebKit/Source/core/frame/LocalFrameViewTest.cpp +++ b/third_party/WebKit/Source/core/frame/LocalFrameViewTest.cpp
@@ -179,32 +179,59 @@ GetDocument().body()->setInnerHTML( "<style>.container { height: 200%; }" - "#sticky { position: sticky; top: 0; height: 50px; }</style>" - "<div class='container'><div id='sticky'></div></div>"); + "#sticky1 { position: sticky; top: 0; height: 50px; }" + "#sticky2 { position: sticky; height: 50px; }</style>" + "<div class='container'>" + " <div id='sticky1'></div>" + " <div id='sticky2'></div>" + "</div>"); GetDocument().View()->UpdateAllLifecyclePhases(); - LayoutBoxModelObject* sticky = ToLayoutBoxModelObject( - GetDocument().getElementById("sticky")->GetLayoutObject()); + LayoutBoxModelObject* sticky1 = ToLayoutBoxModelObject( + GetDocument().getElementById("sticky1")->GetLayoutObject()); + LayoutBoxModelObject* sticky2 = ToLayoutBoxModelObject( + GetDocument().getElementById("sticky2")->GetLayoutObject()); EXPECT_TRUE( - GetDocument().View()->ViewportConstrainedObjects()->Contains(sticky)); + GetDocument().View()->ViewportConstrainedObjects()->Contains(sticky1)); + // #sticky2 is not viewport constrained because it has no anchor edges. + EXPECT_FALSE( + GetDocument().View()->ViewportConstrainedObjects()->Contains(sticky2)); // Making the element non-sticky should remove it from the set of // viewport-constrained objects. - GetDocument().getElementById("sticky")->setAttribute(HTMLNames::styleAttr, - "position: relative"); + GetDocument().getElementById("sticky1")->setAttribute(HTMLNames::styleAttr, + "position: relative"); GetDocument().View()->UpdateAllLifecyclePhases(); EXPECT_FALSE( - GetDocument().View()->ViewportConstrainedObjects()->Contains(sticky)); + GetDocument().View()->ViewportConstrainedObjects()->Contains(sticky1)); - // And making it sticky again should put it back in that list. - GetDocument().getElementById("sticky")->setAttribute(HTMLNames::styleAttr, - ""); + // And making it sticky1 again should put it back in that list. + GetDocument().getElementById("sticky1")->setAttribute(HTMLNames::styleAttr, + ""); GetDocument().View()->UpdateAllLifecyclePhases(); EXPECT_TRUE( - GetDocument().View()->ViewportConstrainedObjects()->Contains(sticky)); + GetDocument().View()->ViewportConstrainedObjects()->Contains(sticky1)); + + // Adding an anchor edge on the non-anchored sticky should add it to the + // viewport-constrained objects. + GetDocument().getElementById("sticky2")->setAttribute(HTMLNames::styleAttr, + "top: 0"); + GetDocument().View()->UpdateAllLifecyclePhases(); + + EXPECT_TRUE( + GetDocument().View()->ViewportConstrainedObjects()->Contains(sticky2)); + + // Removing the anchor edge on a sticky position element should remove it from + // the viewport-constrained objects. + GetDocument().getElementById("sticky2")->setAttribute(HTMLNames::styleAttr, + ""); + GetDocument().View()->UpdateAllLifecyclePhases(); + + EXPECT_FALSE( + GetDocument().View()->ViewportConstrainedObjects()->Contains(sticky2)); } } // namespace
diff --git a/third_party/WebKit/Source/core/frame/Window.idl b/third_party/WebKit/Source/core/frame/Window.idl index 3853d02..79251b2f 100644 --- a/third_party/WebKit/Source/core/frame/Window.idl +++ b/third_party/WebKit/Source/core/frame/Window.idl
@@ -204,6 +204,8 @@ // https://w3c.github.io/webappsec/specs/powerfulfeatures/#monkey-patching-global-object readonly attribute boolean isSecureContext; + + attribute DOMMatrixConstructor WebKitCSSMatrix; }; // https://html.spec.whatwg.org/#transferable-objects
diff --git a/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.cpp b/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.cpp index 918ada4..3506eb94 100644 --- a/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.cpp +++ b/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.cpp
@@ -407,12 +407,21 @@ // relationship is compliant to the same-origin policy. If they're from // different domains, |m_source| would not be set to EncodingFromParentFrame // in the first place. -bool TextResourceDecoder::ShouldAutoDetect() const { - // Just checking m_hintEncoding suffices here because it's only set - // in setHintEncoding when the source is AutoDetectedEncoding. - return encoding_detection_option_ == kUseAllAutoDetection && - (source_ == kDefaultEncoding || - (source_ == kEncodingFromParentFrame && hint_encoding_)); +void TextResourceDecoder::AutoDetectEncodingIfAllowed(const char* data, + size_t len) { + if (encoding_detection_option_ != kUseAllAutoDetection) + return; + + // Just checking hint_encoding_ suffices here because it's only set + // in SetHintEncoding when the source is AutoDetectedEncoding. + if (!(source_ == kDefaultEncoding || + (source_ == kEncodingFromParentFrame && hint_encoding_))) + return; + + WTF::TextEncoding detected_encoding; + if (DetectTextEncoding(data, len, hint_encoding_, hint_url_, hint_language_, + &detected_encoding)) + SetEncoding(detected_encoding, kEncodingFromContentSniffing); } String TextResourceDecoder::Decode(const char* data, size_t len) { @@ -463,12 +472,7 @@ if (content_type_ == kHTMLContent && !checked_for_meta_charset_) CheckForMetaCharset(data_for_decode, length_for_decode); - if (ShouldAutoDetect()) { - WTF::TextEncoding detected_encoding; - if (DetectTextEncoding(data, len, hint_encoding_, hint_url_, hint_language_, - &detected_encoding)) - SetEncoding(detected_encoding, kEncodingFromContentSniffing); - } + AutoDetectEncodingIfAllowed(data, len); DCHECK(encoding_.IsValid()); @@ -487,14 +491,11 @@ // If we can not identify the encoding even after a document is completely // loaded, we need to detect the encoding if other conditions for // autodetection is satisfied. - if (buffer_.size() && ShouldAutoDetect() && + if (buffer_.size() && ((!checked_for_xml_charset_ && (content_type_ == kHTMLContent || content_type_ == kXMLContent)) || (!checked_for_css_charset_ && (content_type_ == kCSSContent)))) { - WTF::TextEncoding detected_encoding; - if (DetectTextEncoding(buffer_.data(), buffer_.size(), hint_encoding_, - hint_url_, hint_language_, &detected_encoding)) - SetEncoding(detected_encoding, kEncodingFromContentSniffing); + AutoDetectEncodingIfAllowed(buffer_.data(), buffer_.size()); } if (!codec_)
diff --git a/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.h b/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.h index f88fa47..81f5a90 100644 --- a/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.h +++ b/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.h
@@ -133,7 +133,7 @@ bool CheckForCSSCharset(const char*, size_t, bool& moved_data_to_buffer); bool CheckForXMLCharset(const char*, size_t, bool& moved_data_to_buffer); void CheckForMetaCharset(const char*, size_t); - bool ShouldAutoDetect() const; + void AutoDetectEncodingIfAllowed(const char* data, size_t len); ContentType content_type_; WTF::TextEncoding encoding_;
diff --git a/third_party/WebKit/Source/core/layout/BUILD.gn b/third_party/WebKit/Source/core/layout/BUILD.gn index 19144509..bf1b7a3 100644 --- a/third_party/WebKit/Source/core/layout/BUILD.gn +++ b/third_party/WebKit/Source/core/layout/BUILD.gn
@@ -32,6 +32,8 @@ "GeneratedChildren.h", "Grid.cpp", "Grid.h", + "GridLayoutUtils.cpp", + "GridLayoutUtils.h", "GridTrackSizingAlgorithm.cpp", "GridTrackSizingAlgorithm.h", "HitTestCache.cpp",
diff --git a/third_party/WebKit/Source/core/layout/GridLayoutUtils.cpp b/third_party/WebKit/Source/core/layout/GridLayoutUtils.cpp new file mode 100644 index 0000000..f8528d6 --- /dev/null +++ b/third_party/WebKit/Source/core/layout/GridLayoutUtils.cpp
@@ -0,0 +1,52 @@ +// 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 "core/layout/GridLayoutUtils.h" + +#include "platform/LengthFunctions.h" + +namespace blink { + +static LayoutUnit ComputeMarginLogicalSizeForChild( + const LayoutGrid& grid, + MarginDirection for_direction, + const LayoutBox& child) { + if (!child.StyleRef().HasMargin()) + return LayoutUnit(); + + bool is_inline_direction = for_direction == kInlineDirection; + LayoutUnit margin_start; + LayoutUnit margin_end; + LayoutUnit logical_size = + is_inline_direction ? child.LogicalWidth() : child.LogicalHeight(); + Length margin_start_length = is_inline_direction + ? child.StyleRef().MarginStart() + : child.StyleRef().MarginBefore(); + Length margin_end_length = is_inline_direction + ? child.StyleRef().MarginEnd() + : child.StyleRef().MarginAfter(); + child.ComputeMarginsForDirection( + for_direction, &grid, child.ContainingBlockLogicalWidthForContent(), + logical_size, margin_start, margin_end, margin_start_length, + margin_end_length); + + return margin_start + margin_end; +} + +LayoutUnit GridLayoutUtils::MarginLogicalWidthForChild(const LayoutGrid& grid, + const LayoutBox& child) { + return child.NeedsLayout() + ? ComputeMarginLogicalSizeForChild(grid, kInlineDirection, child) + : child.MarginLogicalWidth(); +} + +LayoutUnit GridLayoutUtils::MarginLogicalHeightForChild( + const LayoutGrid& grid, + const LayoutBox& child) { + return child.NeedsLayout() + ? ComputeMarginLogicalSizeForChild(grid, kBlockDirection, child) + : child.MarginLogicalHeight(); +} + +} // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/GridLayoutUtils.h b/third_party/WebKit/Source/core/layout/GridLayoutUtils.h new file mode 100644 index 0000000..c6995c4 --- /dev/null +++ b/third_party/WebKit/Source/core/layout/GridLayoutUtils.h
@@ -0,0 +1,22 @@ +// 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 GridLayoutUtils_h +#define GridLayoutUtils_h + +#include "core/layout/LayoutGrid.h" +#include "platform/LayoutUnit.h" + +namespace blink { + +class GridLayoutUtils { + public: + static LayoutUnit MarginLogicalWidthForChild(const LayoutGrid&, + const LayoutBox&); + static LayoutUnit MarginLogicalHeightForChild(const LayoutGrid&, + const LayoutBox&); +}; +} // namespace blink + +#endif // GridLayoutUtils_h
diff --git a/third_party/WebKit/Source/core/layout/GridTrackSizingAlgorithm.cpp b/third_party/WebKit/Source/core/layout/GridTrackSizingAlgorithm.cpp index 7008550f..574307c 100644 --- a/third_party/WebKit/Source/core/layout/GridTrackSizingAlgorithm.cpp +++ b/third_party/WebKit/Source/core/layout/GridTrackSizingAlgorithm.cpp
@@ -5,6 +5,7 @@ #include "core/layout/GridTrackSizingAlgorithm.h" #include "core/layout/Grid.h" +#include "core/layout/GridLayoutUtils.h" #include "core/layout/LayoutGrid.h" #include "platform/LengthFunctions.h" @@ -126,31 +127,6 @@ } }; -// TODO(svillar): Repeated in LayoutGrid. -LayoutUnit GridTrackSizingAlgorithmStrategy::ComputeMarginLogicalSizeForChild( - MarginDirection for_direction, - const LayoutGrid* grid, - const LayoutBox& child) { - if (!child.StyleRef().HasMargin()) - return LayoutUnit(); - - bool is_row_axis = for_direction == kInlineDirection; - LayoutUnit margin_start; - LayoutUnit margin_end; - LayoutUnit logical_size = - is_row_axis ? child.LogicalWidth() : child.LogicalHeight(); - Length margin_start_length = is_row_axis ? child.StyleRef().MarginStart() - : child.StyleRef().MarginBefore(); - Length margin_end_length = is_row_axis ? child.StyleRef().MarginEnd() - : child.StyleRef().MarginAfter(); - child.ComputeMarginsForDirection( - for_direction, grid, child.ContainingBlockLogicalWidthForContent(), - logical_size, margin_start, margin_end, margin_start_length, - margin_end_length); - - return margin_start + margin_end; -} - bool GridTrackSizingAlgorithmStrategy:: HasOverrideContainingBlockContentSizeForChild( const LayoutBox& child, @@ -307,11 +283,8 @@ // FIXME: It's unclear if we should return the intrinsic width or the // preferred width. // See http://lists.w3.org/Archives/Public/www-style/2013Jan/0245.html - LayoutUnit margin_logical_width = - child.NeedsLayout() ? ComputeMarginLogicalSizeForChild( - kInlineDirection, GetLayoutGrid(), child) - : child.MarginLogicalWidth(); - return child.MinPreferredLogicalWidth() + margin_logical_width; + return child.MinPreferredLogicalWidth() + + GridLayoutUtils::MarginLogicalWidthForChild(*GetLayoutGrid(), child); } if (Direction() == kForColumns && !AvailableSpace()) { @@ -344,11 +317,8 @@ // FIXME: It's unclear if we should return the intrinsic width or the // preferred width. // See http://lists.w3.org/Archives/Public/www-style/2013Jan/0245.html - LayoutUnit margin_logical_width = - child.NeedsLayout() ? ComputeMarginLogicalSizeForChild( - kInlineDirection, GetLayoutGrid(), child) - : child.MarginLogicalWidth(); - return child.MaxPreferredLogicalWidth() + margin_logical_width; + return child.MaxPreferredLogicalWidth() + + GridLayoutUtils::MarginLogicalWidthForChild(*GetLayoutGrid(), child); } if (UpdateOverrideContainingBlockContentSizeForChild(child, @@ -434,14 +404,12 @@ LayoutBox& child, Length child_min_size, GridTrackSizingDirection child_inline_direction) const { - LayoutUnit margin_logical_width = ComputeMarginLogicalSizeForChild( - kInlineDirection, GetLayoutGrid(), child); return child.ComputeLogicalWidthUsing( kMinSize, child_min_size, OverrideContainingBlockContentSizeForChild(child, child_inline_direction), GetLayoutGrid()) + - margin_logical_width; + GridLayoutUtils::MarginLogicalWidthForChild(*GetLayoutGrid(), child); } void DefiniteSizeStrategy::LayoutGridItemForMinSizeComputation(
diff --git a/third_party/WebKit/Source/core/layout/GridTrackSizingAlgorithm.h b/third_party/WebKit/Source/core/layout/GridTrackSizingAlgorithm.h index 675a93cfa82..d09d5381 100644 --- a/third_party/WebKit/Source/core/layout/GridTrackSizingAlgorithm.h +++ b/third_party/WebKit/Source/core/layout/GridTrackSizingAlgorithm.h
@@ -275,10 +275,6 @@ } // Helper functions - static LayoutUnit ComputeMarginLogicalSizeForChild( - MarginDirection for_direction, - const LayoutGrid*, - const LayoutBox& child); static bool HasOverrideContainingBlockContentSizeForChild( const LayoutBox& child, GridTrackSizingDirection);
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlock.h b/third_party/WebKit/Source/core/layout/LayoutBlock.h index c8c3f7d..5458ead 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBlock.h +++ b/third_party/WebKit/Source/core/layout/LayoutBlock.h
@@ -564,7 +564,7 @@ friend class NGBlockNode; public: - // TODO(lunalu): Temporary in order to ensure compatibility with existing + // TODO(loonybear): Temporary in order to ensure compatibility with existing // layout test results. virtual void AdjustChildDebugRect(LayoutRect&) const {} };
diff --git a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp index 1aa005a..1e946466 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
@@ -74,7 +74,7 @@ LayoutObject* to) { LayoutObject* maybe_sticky_ancestor = from; while (maybe_sticky_ancestor && maybe_sticky_ancestor != to) { - if (maybe_sticky_ancestor->IsStickyPositioned()) { + if (maybe_sticky_ancestor->Style()->HasStickyConstrainedPosition()) { return ToLayoutBoxModelObject(maybe_sticky_ancestor); } @@ -252,7 +252,8 @@ // 0 during destruction. if (LocalFrame* frame = this->GetFrame()) { if (LocalFrameView* frame_view = frame->View()) { - if (Style()->HasViewportConstrainedPosition()) + if (Style()->HasViewportConstrainedPosition() || + Style()->HasStickyConstrainedPosition()) frame_view->RemoveViewportConstrainedObject(*this); } } @@ -439,9 +440,9 @@ Style()->GetPosition() == EPosition::kFixed; bool old_style_is_viewport_constrained = old_style && old_style->GetPosition() == EPosition::kFixed; - bool new_style_is_sticky = Style()->GetPosition() == EPosition::kSticky; + bool new_style_is_sticky = Style()->HasStickyConstrainedPosition(); bool old_style_is_sticky = - old_style && old_style->GetPosition() == EPosition::kSticky; + old_style && old_style->HasStickyConstrainedPosition(); if (new_style_is_sticky != old_style_is_sticky) { if (new_style_is_sticky) { @@ -1068,6 +1069,8 @@ constraints.AddAnchorEdge( StickyPositionScrollingConstraints::kAnchorEdgeBottom); } + // At least one edge should be anchored if we are calculating constraints. + DCHECK(constraints.GetAnchorEdges()); scrollable_area->GetStickyConstraintsMap().Set(Layer(), constraints); }
diff --git a/third_party/WebKit/Source/core/layout/LayoutBoxModelObjectTest.cpp b/third_party/WebKit/Source/core/layout/LayoutBoxModelObjectTest.cpp index 44225813..0004d1b 100644 --- a/third_party/WebKit/Source/core/layout/LayoutBoxModelObjectTest.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutBoxModelObjectTest.cpp
@@ -340,14 +340,18 @@ TEST_F(LayoutBoxModelObjectTest, StickyPositionFindsCorrectStickyBoxShiftingAncestor) { SetBodyInnerHTML( - "<style>#stickyOuterDiv { position: sticky; }" - "#stickyOuterInline { position: sticky; display: inline; }" - "#stickyInnerInline { position: sticky; display: inline; }" - ".inline { display: inline; }</style>" + "<style>#stickyOuterDiv { position: sticky; top: 0;}" + "#stickyOuterInline { position: sticky; top: 0; display: inline; }" + "#unanchoredSticky { position: sticky; display: inline; }" + ".inline { display: inline; }" + "#stickyInnerInline { position: sticky; top: 0; display: inline; " + "}</style>" "<div id='stickyOuterDiv'>" " <div id='stickyOuterInline'>" - " <div class='inline'>" - " <div id='stickyInnerInline'></div>" + " <div id='unanchoredSticky'>" + " <div class='inline'>" + " <div id='stickyInnerInline'></div>" + " </div>" " </div>" " </div>" "</div>"); @@ -356,6 +360,8 @@ ToLayoutBoxModelObject(GetLayoutObjectByElementId("stickyOuterDiv")); LayoutBoxModelObject* sticky_outer_inline = ToLayoutBoxModelObject(GetLayoutObjectByElementId("stickyOuterInline")); + LayoutBoxModelObject* unanchored_sticky = + ToLayoutBoxModelObject(GetLayoutObjectByElementId("unanchoredSticky")); LayoutBoxModelObject* sticky_inner_inline = ToLayoutBoxModelObject(GetLayoutObjectByElementId("stickyInnerInline")); @@ -367,6 +373,7 @@ ASSERT_TRUE(constraints_map.Contains(sticky_outer_div->Layer())); ASSERT_TRUE(constraints_map.Contains(sticky_outer_inline->Layer())); + ASSERT_FALSE(constraints_map.Contains(unanchored_sticky->Layer())); ASSERT_TRUE(constraints_map.Contains(sticky_inner_inline->Layer())); // The outer block element trivially has no sticky-box shifting ancestor. @@ -395,12 +402,19 @@ // We make the scroller itself sticky in order to check that elements do not // detect it as their containing-block shifting ancestor. SetBodyInnerHTML( - "<style>#scroller { overflow-y: scroll; position: sticky; }" - "#stickyParent { position: sticky; }" - "#stickyChild { position: sticky; }" - "#stickyNestedChild { position: sticky; }</style>" - "<div id='scroller'><div id='stickyParent'><div id='stickyChild'></div>" - "<div><div id='stickyNestedChild'></div></div></div></div>"); + "<style>#scroller { overflow-y: scroll; position: sticky; top: 0;}" + "#stickyParent { position: sticky; top: 0;}" + "#stickyChild { position: sticky; top: 0;}" + "#unanchoredSticky { position: sticky; }" + "#stickyNestedChild { position: sticky; top: 0;}</style>" + "<div id='scroller'>" + " <div id='stickyParent'>" + " <div id='unanchoredSticky'>" + " <div id='stickyChild'></div>" + " <div><div id='stickyNestedChild'></div></div>" + " </div>" + " </div>" + "</div>"); LayoutBoxModelObject* scroller = ToLayoutBoxModelObject(GetLayoutObjectByElementId("scroller")); @@ -428,7 +442,8 @@ .NearestStickyBoxShiftingContainingBlock()); // Both inner children should detect the parent <div> as their - // containing-block shifting ancestor. + // containing-block shifting ancestor. They skip past unanchored sticky + // because it will never have a non-zero offset. EXPECT_EQ(sticky_parent, constraints_map.at(sticky_child->Layer()) .NearestStickyBoxShiftingContainingBlock()); EXPECT_EQ(sticky_parent, constraints_map.at(sticky_nested_child->Layer()) @@ -443,8 +458,8 @@ TEST_F(LayoutBoxModelObjectTest, StickyPositionFindsCorrectContainingBlockShiftingAncestorRoot) { SetBodyInnerHTML( - "<style>#stickyParent { position: sticky; }" - "#stickyGrandchild { position: sticky; }</style>" + "<style>#stickyParent { position: sticky; top: 0;}" + "#stickyGrandchild { position: sticky; top: 0;}</style>" "<div id='stickyParent'><div><div id='stickyGrandchild'></div></div>" "</div>"); @@ -476,8 +491,8 @@ StickyPositionFindsCorrectContainingBlockShiftingAncestorTable) { SetBodyInnerHTML( "<style>#scroller { overflow-y: scroll; }" - "#stickyOuter { position: sticky; }" - "#stickyTh { position: sticky; }</style>" + "#stickyOuter { position: sticky; top: 0;}" + "#stickyTh { position: sticky; top: 0;}</style>" "<div id='scroller'><div id='stickyOuter'><table><thead><tr>" "<th id='stickyTh'></th></tr></thead></table></div></div>"); @@ -851,14 +866,17 @@ "<style>#scroller { width: 100px; height: 100px; overflow-y: scroll; }" "#paddingBefore { height: 50px; }" "#outerInline { display: inline; position: sticky; top: 0; }" + "#unanchoredSticky { position: sticky; display: inline; }" ".inline {display: inline;}" "#innerInline { display: inline; position: sticky; top: 25px; }" "#paddingAfter { height: 200px; }</style>" "<div id='scroller'>" " <div id='paddingBefore'></div>" " <div id='outerInline'>" - " <div class='inline'>" - " <div id='innerInline'></div>" + " <div id='unanchoredSticky'>" + " <div class='inline'>" + " <div id='innerInline'></div>" + " </div>" " </div>" " </div>" " <div id='paddingAfter'></div>"
diff --git a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp index c4360f5..c7b7b09 100644 --- a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
@@ -28,6 +28,7 @@ #include <algorithm> #include <memory> #include "core/frame/UseCounter.h" +#include "core/layout/GridLayoutUtils.h" #include "core/layout/LayoutState.h" #include "core/layout/TextAutosizer.h" #include "core/paint/GridPainter.h" @@ -1547,50 +1548,15 @@ return LayoutUnit(); } -LayoutUnit LayoutGrid::MarginLogicalSizeForChild( - GridTrackSizingDirection direction, - const LayoutBox& child) const { - return FlowAwareDirectionForChild(child, direction) == kForColumns - ? child.MarginLogicalWidth() - : child.MarginLogicalHeight(); -} - -LayoutUnit LayoutGrid::ComputeMarginLogicalSizeForChild( - MarginDirection for_direction, - const LayoutBox& child) const { - if (!child.StyleRef().HasMargin()) - return LayoutUnit(); - - bool is_row_axis = for_direction == kInlineDirection; - LayoutUnit margin_start; - LayoutUnit margin_end; - LayoutUnit logical_size = - is_row_axis ? child.LogicalWidth() : child.LogicalHeight(); - Length margin_start_length = is_row_axis ? child.StyleRef().MarginStart() - : child.StyleRef().MarginBefore(); - Length margin_end_length = is_row_axis ? child.StyleRef().MarginEnd() - : child.StyleRef().MarginAfter(); - child.ComputeMarginsForDirection( - for_direction, this, child.ContainingBlockLogicalWidthForContent(), - logical_size, margin_start, margin_end, margin_start_length, - margin_end_length); - - return margin_start + margin_end; -} - LayoutUnit LayoutGrid::AvailableAlignmentSpaceForChildBeforeStretching( LayoutUnit grid_area_breadth_for_child, const LayoutBox& child) const { // Because we want to avoid multiple layouts, stretching logic might be // performed before children are laid out, so we can't use the child cached - // values. Hence, we need to compute margins in order to determine the + // values. Hence, we may need to compute margins in order to determine the // available height before stretching. - GridTrackSizingDirection child_block_flow_direction = - FlowAwareDirectionForChild(child, kForRows); return grid_area_breadth_for_child - - (child.NeedsLayout() - ? ComputeMarginLogicalSizeForChild(kBlockDirection, child) - : MarginLogicalSizeForChild(child_block_flow_direction, child)); + GridLayoutUtils::MarginLogicalHeightForChild(*this, child); } StyleSelfAlignmentData LayoutGrid::AlignSelfForChild(
diff --git a/third_party/WebKit/Source/core/layout/LayoutGrid.h b/third_party/WebKit/Source/core/layout/LayoutGrid.h index 17a07508..c15b45c 100644 --- a/third_party/WebKit/Source/core/layout/LayoutGrid.h +++ b/third_party/WebKit/Source/core/layout/LayoutGrid.h
@@ -212,10 +212,6 @@ void PaintChildren(const PaintInfo&, const LayoutPoint&) const override; - LayoutUnit MarginLogicalSizeForChild(GridTrackSizingDirection, - const LayoutBox&) const; - LayoutUnit ComputeMarginLogicalSizeForChild(MarginDirection, - const LayoutBox&) const; LayoutUnit AvailableAlignmentSpaceForChildBeforeStretching( LayoutUnit grid_area_breadth_for_child, const LayoutBox&) const;
diff --git a/third_party/WebKit/Source/core/layout/LayoutInline.cpp b/third_party/WebKit/Source/core/layout/LayoutInline.cpp index a7cfa23..5fef505ad 100644 --- a/third_party/WebKit/Source/core/layout/LayoutInline.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutInline.cpp
@@ -1550,7 +1550,7 @@ paint_invalidator.InvalidateDisplayItemClient(*box, invalidation_reason); } -// TODO(lunalu): Not to just dump 0, 0 as the x and y here +// TODO(loonybear): Not to just dump 0, 0 as the x and y here LayoutRect LayoutInline::DebugRect() const { IntRect lines_box = EnclosingIntRect(LinesBoundingBox()); return LayoutRect(IntRect(0, 0, lines_box.Width(), lines_box.Height()));
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp b/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp index 1b7c0de4..adc6f2b 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp
@@ -1495,7 +1495,7 @@ invalidator.InvalidateDisplayItemClient(*collapsed_border_values_, reason); } -// TODO(lunalu): Deliberately dump the "inner" box of table cells, since that +// TODO(loonybear): Deliberately dump the "inner" box of table cells, since that // is what current results reflect. We'd like to clean up the results to dump // both the outer box and the intrinsic padding so that both bits of information // are captured by the results.
diff --git a/third_party/WebKit/Source/core/layout/LayoutText.cpp b/third_party/WebKit/Source/core/layout/LayoutText.cpp index 2ca809ee..7a087e2f 100644 --- a/third_party/WebKit/Source/core/layout/LayoutText.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutText.cpp
@@ -1990,7 +1990,7 @@ } } -// TODO(lunalu): Would be better to dump the bounding box x and y rather than +// TODO(loonybear): Would be better to dump the bounding box x and y rather than // the first run's x and y, but that would involve updating many test results. LayoutRect LayoutText::DebugRect() const { IntRect lines_box = EnclosingIntRect(LinesBoundingBox());
diff --git a/third_party/WebKit/Source/core/layout/LayoutTheme.cpp b/third_party/WebKit/Source/core/layout/LayoutTheme.cpp index 9bbe8ea..1ac06f87 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTheme.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutTheme.cpp
@@ -340,6 +340,10 @@ return Color(192, 192, 192); } +Color LayoutTheme::PlatformActiveSpellingMarkerHighlightColor() const { + return Color(255, 0, 0, 102); +} + Color LayoutTheme::PlatformActiveSelectionBackgroundColor() const { // Use a blue color by default if the platform theme doesn't define anything. return Color(0, 0, 255);
diff --git a/third_party/WebKit/Source/core/layout/LayoutTheme.h b/third_party/WebKit/Source/core/layout/LayoutTheme.h index 5427103..0c6cc87 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTheme.h +++ b/third_party/WebKit/Source/core/layout/LayoutTheme.h
@@ -133,6 +133,8 @@ virtual Color PlatformSpellingMarkerUnderlineColor() const; virtual Color PlatformGrammarMarkerUnderlineColor() const; + Color PlatformActiveSpellingMarkerHighlightColor() const; + // Highlight and text colors for TextMatches. Color PlatformTextSearchHighlightColor(bool active_match) const; Color PlatformTextSearchColor(bool active_match) const;
diff --git a/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp b/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp index e37a881..2c7f4bf 100644 --- a/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp +++ b/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp
@@ -119,7 +119,8 @@ static bool CandidateMayMoveWithScroller(const LayoutObject* candidate, const ScrollableArea* scroller) { if (const ComputedStyle* style = candidate->Style()) { - if (style->HasViewportConstrainedPosition()) + if (style->HasViewportConstrainedPosition() || + style->HasStickyConstrainedPosition()) return false; }
diff --git a/third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp b/third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp index f69eaf8..e86d3b8 100644 --- a/third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp +++ b/third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp
@@ -224,6 +224,23 @@ EXPECT_EQ(101, viewport->ScrollOffsetInt().Height()); } +TEST_P(ScrollAnchorTest, AvoidStickyAnchorWhichMovesWithScroll) { + SetBodyInnerHTML( + "<style> body { height: 1000px } </style>" + "<div id='block1' style='height: 50px'>abc</div>" + "<div id='block2' style='height: 100px; position: sticky; top: 0;'>" + " def</div>"); + + ScrollableArea* viewport = LayoutViewport(); + ScrollLayoutViewport(ScrollOffset(0, 60)); + + GetDocument().getElementById("block1")->setAttribute(HTMLNames::styleAttr, + "height: 100px"); + Update(); + + EXPECT_EQ(60, viewport->ScrollOffsetInt().Height()); +} + TEST_P(ScrollAnchorTest, AnchorWithLayerInScrollingDiv) { SetBodyInnerHTML( "<style>"
diff --git a/third_party/WebKit/Source/core/layout/VisualRectMappingTest.cpp b/third_party/WebKit/Source/core/layout/VisualRectMappingTest.cpp index fa43ddc9..5c28245 100644 --- a/third_party/WebKit/Source/core/layout/VisualRectMappingTest.cpp +++ b/third_party/WebKit/Source/core/layout/VisualRectMappingTest.cpp
@@ -46,7 +46,7 @@ FloatClipRect geometry_mapper_rect((FloatRect(local_rect))); if (object.PaintProperties() || object.LocalBorderBoxProperties()) { geometry_mapper_rect.MoveBy(FloatPoint(object.PaintOffset())); - GeometryMapper::LocalToAncestorVisualRect( + GeometryMapper::SourceToDestinationVisualRect( *object.LocalBorderBoxProperties(), ancestor.ContentsProperties(), geometry_mapper_rect); geometry_mapper_rect.MoveBy(-FloatPoint(ancestor.PaintOffset()));
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp index 2110feca..37f037cb 100644 --- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp +++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
@@ -288,7 +288,7 @@ } bool CompositedLayerMapping::UsesCompositedStickyPosition() const { - return GetLayoutObject().Style()->GetPosition() == EPosition::kSticky && + return GetLayoutObject().Style()->HasStickyConstrainedPosition() && (owning_layer_.AncestorOverflowLayer()->IsRootLayer() ? GetLayoutObject().View()->GetFrameView()->IsScrollable() : owning_layer_.AncestorOverflowLayer()
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.cpp index 6e67bcdc..234af1f 100644 --- a/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.cpp +++ b/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.cpp
@@ -105,7 +105,7 @@ const PaintLayer* previous_overflow_layer = layer->AncestorOverflowLayer(); layer->UpdateAncestorOverflowLayer(info.last_overflow_clip_layer); if (info.last_overflow_clip_layer && layer->NeedsCompositingInputsUpdate() && - layer->GetLayoutObject().Style()->GetPosition() == EPosition::kSticky) { + layer->GetLayoutObject().Style()->HasStickyConstrainedPosition()) { if (!RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { if (info.last_overflow_clip_layer != previous_overflow_layer) { // Old ancestor scroller should no longer have these constraints.
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.cpp index 43383fe..1dc39e1 100644 --- a/third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.cpp +++ b/third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.cpp
@@ -216,8 +216,8 @@ bool CompositingReasonFinder::RequiresCompositingForScrollDependentPosition( const PaintLayer* layer, bool ignore_lcd_text) const { - if (layer->GetLayoutObject().Style()->GetPosition() != EPosition::kFixed && - layer->GetLayoutObject().Style()->GetPosition() != EPosition::kSticky) + if (!layer->GetLayoutObject().Style()->HasViewportConstrainedPosition() && + !layer->GetLayoutObject().Style()->HasStickyConstrainedPosition()) return false; if (!(ignore_lcd_text ||
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_bidi_paragraph.cc b/third_party/WebKit/Source/core/layout/ng/inline/ng_bidi_paragraph.cc index 5c513d6..44ec374 100644 --- a/third_party/WebKit/Source/core/layout/ng/inline/ng_bidi_paragraph.cc +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_bidi_paragraph.cc
@@ -18,20 +18,30 @@ const ComputedStyle& block_style) { DCHECK(!ubidi_); ubidi_ = ubidi_open(); + + bool use_heuristic_base_direction = + block_style.GetUnicodeBidi() == UnicodeBidi::kPlaintext; + UBiDiLevel para_level; + if (use_heuristic_base_direction) { + para_level = UBIDI_DEFAULT_LTR; + } else { + base_direction_ = block_style.Direction(); + para_level = IsLtr(base_direction_) ? UBIDI_LTR : UBIDI_RTL; + } + ICUError error; - ubidi_setPara( - ubidi_, text.Characters16(), text.length(), - block_style.GetUnicodeBidi() == UnicodeBidi::kPlaintext - ? UBIDI_DEFAULT_LTR - : (block_style.Direction() == TextDirection::kRtl ? UBIDI_RTL - : UBIDI_LTR), - nullptr, &error); + ubidi_setPara(ubidi_, text.Characters16(), text.length(), para_level, nullptr, + &error); if (U_FAILURE(error)) { NOTREACHED(); ubidi_close(ubidi_); ubidi_ = nullptr; return false; } + + if (use_heuristic_base_direction) + base_direction_ = DirectionFromLevel(ubidi_getParaLevel(ubidi_)); + return true; }
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_bidi_paragraph.h b/third_party/WebKit/Source/core/layout/ng/inline/ng_bidi_paragraph.h index 6b6144e..eb88454 100644 --- a/third_party/WebKit/Source/core/layout/ng/inline/ng_bidi_paragraph.h +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_bidi_paragraph.h
@@ -5,6 +5,7 @@ #ifndef NGBidiParagraph_h #define NGBidiParagraph_h +#include "platform/text/TextDirection.h" #include "platform/wtf/Allocator.h" #include "platform/wtf/Forward.h" #include "platform/wtf/Vector.h" @@ -35,8 +36,13 @@ // called. bool SetParagraph(const String&, const ComputedStyle&); - // Returns whether the paragraph is LTR, RTL, or MIXED. - UBiDiDirection Direction() const { return ubidi_getDirection(ubidi_); } + // @return the entire text is unidirectional. + bool IsUnidirectional() const { + return ubidi_getDirection(ubidi_) != UBIDI_MIXED; + } + + // The base direction (a.k.a. paragraph direction) of this block. + TextDirection BaseDirection() const { return base_direction_; } // Returns the end offset of a logical run that starts from the |start| // offset. @@ -50,6 +56,7 @@ private: UBiDi* ubidi_ = nullptr; + TextDirection base_direction_ = TextDirection::kLtr; }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_item.h b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_item.h index 39ae2ebb..27ce82d 100644 --- a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_item.h +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_item.h
@@ -75,9 +75,7 @@ unsigned StartOffset() const { return start_offset_; } unsigned EndOffset() const { return end_offset_; } unsigned Length() const { return end_offset_ - start_offset_; } - TextDirection Direction() const { - return BidiLevel() & 1 ? TextDirection::kRtl : TextDirection::kLtr; - } + TextDirection Direction() const { return DirectionFromLevel(BidiLevel()); } UBiDiLevel BidiLevel() const { return static_cast<UBiDiLevel>(bidi_level_); } UScriptCode GetScript() const { return script_; } const ComputedStyle* Style() const { return style_.Get(); }
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc index d387bb9..1b1bbfa3 100644 --- a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc
@@ -248,7 +248,7 @@ LayoutUnit inline_size = position; NGLogicalOffset offset(LogicalLeftOffset(line_opp), baseline - box_states_.LineBoxState().metrics.ascent); - ApplyTextAlign(line_style, line_style.GetTextAlign(line_info->IsLastLine()), + ApplyTextAlign(line_style.GetTextAlign(line_info->IsLastLine()), &offset.inline_offset, inline_size, line_opp.InlineSize()); line_box.SetInlineSize(inline_size); @@ -311,25 +311,55 @@ return box_states_.OnCloseTag(item, line_box, box, baseline_type_); } -void NGInlineLayoutAlgorithm::ApplyTextAlign(const ComputedStyle& line_style, - ETextAlign text_align, +void NGInlineLayoutAlgorithm::ApplyTextAlign(ETextAlign text_align, LayoutUnit* line_left, LayoutUnit inline_size, LayoutUnit available_width) { - switch (text_align) { - case ETextAlign::kRight: - case ETextAlign::kWebkitRight: - // Wide lines spill out of the block based off direction. - // So even if text-align is right, if direction is LTR, wide lines should - // overflow out of the right side of the block. - // TODO(kojii): Investigate how to handle trailing spaces. - if (inline_size < available_width || !line_style.IsLeftToRightDirection()) - *line_left += available_width - inline_size; - break; - default: - // TODO(layout-dev): Implement. - // Refer to LayoutBlockFlow::UpdateLogicalWidthForAlignment(). - break; + bool is_base_ltr = IsLtr(Node().BaseDirection()); + // TODO(kojii): Investigate handling trailing spaces for 'white-space: + // pre|pre-wrap'. Refer to LayoutBlockFlow::UpdateLogicalWidthForAlignment(). + while (true) { + switch (text_align) { + case ETextAlign::kLeft: + case ETextAlign::kWebkitLeft: + // The direction of the block should determine what happens with wide + // lines. In particular with RTL blocks, wide lines should still spill + // out to the left. + if (!is_base_ltr && inline_size > available_width) + *line_left -= inline_size - available_width; + return; + case ETextAlign::kRight: + case ETextAlign::kWebkitRight: + // Wide lines spill out of the block based off direction. + // So even if text-align is right, if direction is LTR, wide lines + // should overflow out of the right side of the block. + if (inline_size < available_width || !is_base_ltr) + *line_left += available_width - inline_size; + return; + case ETextAlign::kCenter: + case ETextAlign::kWebkitCenter: + if (is_base_ltr) { + *line_left += + std::max((available_width - inline_size) / 2, LayoutUnit()); + } else if (inline_size <= available_width) { + *line_left += (available_width - inline_size) / 2; + } else { + // In RTL, wide lines should spill out to the left, same as kRight. + *line_left += available_width - inline_size; + } + return; + case ETextAlign::kStart: + text_align = is_base_ltr ? ETextAlign::kLeft : ETextAlign::kRight; + continue; + case ETextAlign::kEnd: + text_align = is_base_ltr ? ETextAlign::kRight : ETextAlign::kLeft; + continue; + case ETextAlign::kJustify: + // TODO(kojii): Implement. + return; + } + NOTREACHED(); + return; } }
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 fe8b26d..fb49785 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
@@ -62,8 +62,7 @@ NGLineBoxFragmentBuilder*, NGTextFragmentBuilder*); - void ApplyTextAlign(const ComputedStyle&, - ETextAlign, + void ApplyTextAlign(ETextAlign, LayoutUnit* line_left, LayoutUnit inline_size, LayoutUnit available_width);
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node.cc b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node.cc index e00cfde..6befe47 100644 --- a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node.cc +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node.cc
@@ -192,8 +192,7 @@ // Scan list of siblings collecting all in-flow non-atomic inlines. A single // NGInlineNode represent a collection of adjacent non-atomic inlines. CollectInlines(Data().start_inline_, GetLayoutBlockFlow()); - if (Data().is_bidi_enabled_) - SegmentText(); + SegmentText(); ShapeText(); } @@ -282,21 +281,30 @@ } void NGInlineNode::SegmentText() { - // TODO(kojii): Move this to caller, this will be used again after line break. - NGBidiParagraph bidi; - MutableData().text_content_.Ensure16Bit(); - if (!bidi.SetParagraph(Data().text_content_, Style())) { - // On failure, give up bidi resolving and reordering. - MutableData().is_bidi_enabled_ = false; - return; - } - if (bidi.Direction() == UBIDI_LTR) { - // All runs are LTR, no need to reorder. - MutableData().is_bidi_enabled_ = false; + NGInlineNodeData& data = MutableData(); + if (!data.is_bidi_enabled_) { + data.SetBaseDirection(TextDirection::kLtr); return; } - Vector<NGInlineItem>& items = MutableData().items_; + NGBidiParagraph bidi; + data.text_content_.Ensure16Bit(); + if (!bidi.SetParagraph(data.text_content_, Style())) { + // On failure, give up bidi resolving and reordering. + data.is_bidi_enabled_ = false; + data.SetBaseDirection(TextDirection::kLtr); + return; + } + + data.SetBaseDirection(bidi.BaseDirection()); + + if (bidi.IsUnidirectional() && IsLtr(bidi.BaseDirection())) { + // All runs are LTR, no need to reorder. + data.is_bidi_enabled_ = false; + return; + } + + Vector<NGInlineItem>& items = data.items_; unsigned item_index = 0; for (unsigned start = 0; start < Data().text_content_.length();) { UBiDiLevel level;
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node.h b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node.h index fca695e..f203a73a 100644 --- a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node.h +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node.h
@@ -61,6 +61,7 @@ void GetLayoutTextOffsets(Vector<unsigned, 32>*); bool IsBidiEnabled() const { return Data().is_bidi_enabled_; } + TextDirection BaseDirection() const { return Data().BaseDirection(); } void AssertOffset(unsigned index, unsigned offset) const; void AssertEndOffset(unsigned index, unsigned offset) const;
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node_data.h b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node_data.h index 1989c8a..2550071b 100644 --- a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node_data.h +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_node_data.h
@@ -16,6 +16,13 @@ // Data which is required for inline nodes. struct CORE_EXPORT NGInlineNodeData { private: + TextDirection BaseDirection() const { + return static_cast<TextDirection>(base_direction_); + } + void SetBaseDirection(TextDirection direction) { + base_direction_ = static_cast<unsigned>(direction); + } + friend class NGInlineNode; friend class NGInlineNodeForTest; @@ -31,9 +38,8 @@ // start_inline_ must always be reset within the constructor of NGInlineNode. LayoutObject* start_inline_; - // TODO(kojii): This should move to somewhere else when we move PrepareLayout - // to the correct place. - bool is_bidi_enabled_ = false; + unsigned is_bidi_enabled_ : 1; + unsigned base_direction_ : 1; // TextDirection }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/loader/EmptyClients.cpp b/third_party/WebKit/Source/core/loader/EmptyClients.cpp index 29daa55..4e77ef26 100644 --- a/third_party/WebKit/Source/core/loader/EmptyClients.cpp +++ b/third_party/WebKit/Source/core/loader/EmptyClients.cpp
@@ -117,7 +117,7 @@ void EmptyChromeClient::OpenTextDataListChooser(HTMLInputElement&) {} -void EmptyChromeClient::OpenFileChooser(LocalFrame*, PassRefPtr<FileChooser>) {} +void EmptyChromeClient::OpenFileChooser(LocalFrame*, RefPtr<FileChooser>) {} void EmptyChromeClient::AttachRootGraphicsLayer(GraphicsLayer* layer, LocalFrame* local_root) {
diff --git a/third_party/WebKit/Source/core/loader/EmptyClients.h b/third_party/WebKit/Source/core/loader/EmptyClients.h index 0e82026..7d0e2d5 100644 --- a/third_party/WebKit/Source/core/loader/EmptyClients.h +++ b/third_party/WebKit/Source/core/loader/EmptyClients.h
@@ -185,7 +185,7 @@ const DateTimeChooserParameters&) override; void OpenTextDataListChooser(HTMLInputElement&) override; - void OpenFileChooser(LocalFrame*, PassRefPtr<FileChooser>) override; + void OpenFileChooser(LocalFrame*, RefPtr<FileChooser>) override; void SetCursor(const Cursor&, LocalFrame* local_root) override {} void SetCursorOverridden(bool) override {}
diff --git a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp index 2c7c2a1c..591c9cb5 100644 --- a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp +++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
@@ -1087,9 +1087,9 @@ return loader; } -void FrameFetchContext::Detach() { +FetchContext* FrameFetchContext::Detach() { if (IsDetached()) - return; + return this; if (document_) { frozen_state_ = new FrozenState( @@ -1113,6 +1113,8 @@ // This is needed to break a reference cycle in which off-heap // ComputedStyle is involved. See https://crbug.com/383860 for details. document_ = nullptr; + + return this; } DEFINE_TRACE(FrameFetchContext) {
diff --git a/third_party/WebKit/Source/core/loader/FrameFetchContext.h b/third_party/WebKit/Source/core/loader/FrameFetchContext.h index 6d84ea7..98f51e3 100644 --- a/third_party/WebKit/Source/core/loader/FrameFetchContext.h +++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.h
@@ -156,7 +156,7 @@ std::unique_ptr<WebURLLoader> CreateURLLoader( const ResourceRequest&) override; - void Detach() override; + FetchContext* Detach() override; DECLARE_VIRTUAL_TRACE();
diff --git a/third_party/WebKit/Source/core/page/ChromeClient.h b/third_party/WebKit/Source/core/page/ChromeClient.h index b291a9d..a9f4583 100644 --- a/third_party/WebKit/Source/core/page/ChromeClient.h +++ b/third_party/WebKit/Source/core/page/ChromeClient.h
@@ -229,7 +229,7 @@ virtual void OpenTextDataListChooser(HTMLInputElement&) = 0; - virtual void OpenFileChooser(LocalFrame*, PassRefPtr<FileChooser>) = 0; + virtual void OpenFileChooser(LocalFrame*, RefPtr<FileChooser>) = 0; // Asychronous request to enumerate all files in a directory chosen by the // user.
diff --git a/third_party/WebKit/Source/core/page/DragController.cpp b/third_party/WebKit/Source/core/page/DragController.cpp index f5b309f..06c544b 100644 --- a/third_party/WebKit/Source/core/page/DragController.cpp +++ b/third_party/WebKit/Source/core/page/DragController.cpp
@@ -76,6 +76,7 @@ #include "platform/graphics/BitmapImage.h" #include "platform/graphics/Image.h" #include "platform/graphics/ImageOrientation.h" +#include "platform/graphics/paint/PaintRecordBuilder.h" #include "platform/loader/fetch/ResourceFetcher.h" #include "platform/loader/fetch/ResourceRequest.h" #include "platform/weborigin/SecurityOrigin.h" @@ -1080,6 +1081,29 @@ return drag_image; } +// static +std::unique_ptr<DragImage> DragController::DragImageForSelection( + const LocalFrame& frame, + float opacity) { + if (!frame.Selection().ComputeVisibleSelectionInDOMTreeDeprecated().IsRange()) + return nullptr; + + frame.View()->UpdateAllLifecyclePhasesExceptPaint(); + DCHECK(frame.GetDocument()->IsActive()); + + FloatRect painting_rect = FloatRect(frame.Selection().Bounds()); + GlobalPaintFlags paint_flags = + kGlobalPaintSelectionOnly | kGlobalPaintFlattenCompositingLayers; + + PaintRecordBuilder builder( + DataTransfer::DeviceSpaceBounds(painting_rect, frame)); + frame.View()->PaintContents(builder.Context(), paint_flags, + EnclosingIntRect(painting_rect)); + return DataTransfer::CreateDragImageForFrame( + frame, opacity, kDoNotRespectImageOrientation, painting_rect, builder, + PropertyTreeState::Root()); +} + bool DragController::StartDrag(LocalFrame* src, const DragState& state, const WebMouseEvent& drag_event,
diff --git a/third_party/WebKit/Source/core/paint/PaintInvalidator.cpp b/third_party/WebKit/Source/core/paint/PaintInvalidator.cpp index cdeb6df..1e9b5af5 100644 --- a/third_party/WebKit/Source/core/paint/PaintInvalidator.cpp +++ b/third_party/WebKit/Source/core/paint/PaintInvalidator.cpp
@@ -126,7 +126,7 @@ context.tree_builder_context_->current.clip, nullptr); FloatClipRect float_rect((FloatRect(rect))); - GeometryMapper::LocalToAncestorVisualRect( + GeometryMapper::SourceToDestinationVisualRect( current_tree_state, container_contents_properties, float_rect); result = LayoutRect(float_rect.Rect()); }
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp b/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp index 238cf7c9d..3a703ca 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp +++ b/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp
@@ -458,12 +458,12 @@ if (HasOverflowClip(layer_)) { FloatClipRect clip_rect((FloatRect(LocalVisualRect()))); clip_rect.MoveBy(FloatPoint(layer_.GetLayoutObject().PaintOffset())); - GeometryMapper::LocalToAncestorVisualRect( + GeometryMapper::SourceToDestinationVisualRect( source_property_tree_state, destination_property_tree_state, clip_rect); output.SetRect(clip_rect); } else { const FloatClipRect& clipped_rect_in_root_layer_space = - GeometryMapper::LocalToAncestorClipRect( + GeometryMapper::SourceToDestinationClipRect( source_property_tree_state, destination_property_tree_state); output.SetRect(clipped_rect_in_root_layer_space); }
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp index 48713d5..64a7d7b 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp +++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
@@ -1640,7 +1640,7 @@ if (PaintLayerScrollableAreaRareData* d = RareData()) { d->sticky_constraints_map_.erase(layer); if (needs_compositing_update && - layer->GetLayoutObject().Style()->GetPosition() == EPosition::kSticky) + layer->GetLayoutObject().Style()->HasStickyConstrainedPosition()) layer->SetNeedsCompositingInputsUpdate(); } }
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp index f3ec46e9..4e0b191 100644 --- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp +++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
@@ -87,7 +87,7 @@ source.MoveBy((source_object)->PaintOffset()); \ auto contents_properties = (ancestor)->ContentsProperties(); \ FloatClipRect actual_float_rect((FloatRect(source))); \ - GeometryMapper::LocalToAncestorVisualRect( \ + GeometryMapper::SourceToDestinationVisualRect( \ *(source_object)->LocalBorderBoxProperties(), contents_properties, \ actual_float_rect); \ LayoutRect actual(actual_float_rect.Rect()); \
diff --git a/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp b/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp index 7aade4d..1e15ce2 100644 --- a/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp +++ b/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp
@@ -118,7 +118,7 @@ paint_layer->UpdateAncestorOverflowLayer( context.ancestor_overflow_paint_layer); - if (object.StyleRef().GetPosition() == EPosition::kSticky) { + if (object.StyleRef().HasStickyConstrainedPosition()) { paint_layer->GetLayoutObject().UpdateStickyPositionConstraints(); // Sticky position constraints and ancestor overflow scroller affect the @@ -140,7 +140,7 @@ PropertyTreeState local_state(context.transform, context.clip, effect); const auto& clip_rect = - GeometryMapper::LocalToAncestorClipRect(local_state, ancestor_state); + GeometryMapper::SourceToDestinationClipRect(local_state, ancestor_state); // HasRadius() is ignored because it doesn't affect descendants' visual rects. LayoutRect result(clip_rect.Rect()); if (!clip_rect.IsInfinite())
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.cpp b/third_party/WebKit/Source/core/style/ComputedStyle.cpp index 390ad8c..dc9453b0 100644 --- a/third_party/WebKit/Source/core/style/ComputedStyle.cpp +++ b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
@@ -832,6 +832,7 @@ HasTransformRelatedProperty() || HasMask() || ClipPath() || BoxReflect() || HasFilterInducingProperty() || HasBackdropFilter() || HasBlendMode() || HasIsolation() || HasViewportConstrainedPosition() || + GetPosition() == EPosition::kSticky || HasPropertyThatCreatesStackingContext(WillChangeProperties()) || ContainsPaint()) { SetIsStackingContext(true);
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.h b/third_party/WebKit/Source/core/style/ComputedStyle.h index cb5af429..b5b5b92 100644 --- a/third_party/WebKit/Source/core/style/ComputedStyle.h +++ b/third_party/WebKit/Source/core/style/ComputedStyle.h
@@ -694,47 +694,6 @@ } void SetContent(ContentData*); - // Flex properties. - // flex-basis (aka -webkit-flex-basis) - static Length InitialFlexBasis() { return Length(kAuto); } - const Length& FlexBasis() const { - return rare_non_inherited_data_->flexible_box_data_->flex_basis_; - } - void SetFlexBasis(const Length& length) { - SET_NESTED_VAR(rare_non_inherited_data_, flexible_box_data_, flex_basis_, - length); - } - - // flex-grow (aka -webkit-flex-grow) - static float InitialFlexGrow() { return 0; } - float FlexGrow() const { - return rare_non_inherited_data_->flexible_box_data_->flex_grow_; - } - void SetFlexGrow(float f) { - SET_NESTED_VAR(rare_non_inherited_data_, flexible_box_data_, flex_grow_, f); - } - - // flex-shrink (aka -webkit-flex-shrink) - static float InitialFlexShrink() { return 1; } - float FlexShrink() const { - return rare_non_inherited_data_->flexible_box_data_->flex_shrink_; - } - void SetFlexShrink(float f) { - SET_NESTED_VAR(rare_non_inherited_data_, flexible_box_data_, flex_shrink_, - f); - } - - // flex-wrap (aka -webkit-flex-wrap) - static EFlexWrap InitialFlexWrap() { return EFlexWrap::kNowrap; } - EFlexWrap FlexWrap() const { - return static_cast<EFlexWrap>( - rare_non_inherited_data_->flexible_box_data_->flex_wrap_); - } - void SetFlexWrap(EFlexWrap w) { - SET_NESTED_VAR(rare_non_inherited_data_, flexible_box_data_, flex_wrap_, - static_cast<unsigned>(w)); - } - // -webkit-box-ordinal-group static unsigned InitialBoxOrdinalGroup() { return 1; } unsigned BoxOrdinalGroup() const { @@ -2262,8 +2221,12 @@ GetPosition() == EPosition::kSticky; } bool HasViewportConstrainedPosition() const { - return GetPosition() == EPosition::kFixed || - GetPosition() == EPosition::kSticky; + return GetPosition() == EPosition::kFixed; + } + bool HasStickyConstrainedPosition() const { + return GetPosition() == EPosition::kSticky && + (!Top().IsAuto() || !Left().IsAuto() || !Right().IsAuto() || + !Bottom().IsAuto()); } // Clip utility functions.
diff --git a/third_party/WebKit/Source/core/style/ComputedStyleConstants.h b/third_party/WebKit/Source/core/style/ComputedStyleConstants.h index cb64a7cd..7e77268 100644 --- a/third_party/WebKit/Source/core/style/ComputedStyleConstants.h +++ b/third_party/WebKit/Source/core/style/ComputedStyleConstants.h
@@ -144,10 +144,6 @@ // CSS Mask Source Types enum EMaskSourceType { kMaskAlpha, kMaskLuminance }; -// CSS3 Flexbox Properties - -enum class EFlexWrap { kNowrap, kWrap, kWrapReverse }; - // CSS3 Image Values enum QuoteType { OPEN_QUOTE, CLOSE_QUOTE, NO_OPEN_QUOTE, NO_CLOSE_QUOTE };
diff --git a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp index 50de328..4996a56 100644 --- a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp +++ b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
@@ -670,7 +670,10 @@ } bool XMLHttpRequest::InitSend(ExceptionState& exception_state) { - if (!GetExecutionContext()) { + // We need to check ContextDestroyed because it is possible to create a + // XMLHttpRequest with already detached document. + // TODO(yhirano): Fix this. + if (!GetExecutionContext() || GetExecutionContext()->IsContextDestroyed()) { HandleNetworkError(); ThrowForLoadFailureIfNeeded(exception_state, "Document is already detached.");
diff --git a/third_party/WebKit/Source/devtools/.eslintignore b/third_party/WebKit/Source/devtools/.eslintignore index 63b1c52..a66ee24 100644 --- a/third_party/WebKit/Source/devtools/.eslintignore +++ b/third_party/WebKit/Source/devtools/.eslintignore
@@ -11,4 +11,4 @@ front_end/gonzales/gonzales-scss.js front_end/terminal/xterm.js/** front_end/protocol_externs.js -scripts/jsdoc_validator/tests/* +scripts/*
diff --git a/third_party/WebKit/Source/devtools/front_end/emulation/module.json b/third_party/WebKit/Source/devtools/front_end/emulation/module.json index b480ea0f..e0df459c 100644 --- a/third_party/WebKit/Source/devtools/front_end/emulation/module.json +++ b/third_party/WebKit/Source/devtools/front_end/emulation/module.json
@@ -119,7 +119,7 @@ "location": "settings-view", "id": "devices", "title": "Devices", - "order": "30", + "order": 30, "className": "Emulation.DevicesSettingsTab", "settings": [ "standardEmulatedDeviceList",
diff --git a/third_party/WebKit/Source/devtools/front_end/mobile_throttling/module.json b/third_party/WebKit/Source/devtools/front_end/mobile_throttling/module.json index 3c83425..f9741fd3 100644 --- a/third_party/WebKit/Source/devtools/front_end/mobile_throttling/module.json +++ b/third_party/WebKit/Source/devtools/front_end/mobile_throttling/module.json
@@ -27,7 +27,7 @@ "location": "settings-view", "id": "network-conditions", "title": "Throttling", - "order": "35", + "order": 35, "className": "MobileThrottling.NetworkConditionsSettingsTab", "settings": [ "customNetworkConditions"
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 e4d607e..4915c94 100644 --- a/third_party/WebKit/Source/devtools/front_end/persistence/module.json +++ b/third_party/WebKit/Source/devtools/front_end/persistence/module.json
@@ -10,7 +10,7 @@ "location": "settings-view", "id": "workspace", "title": "Workspace", - "order": "1", + "order": 1, "className": "Persistence.WorkspaceSettingsTab" } ],
diff --git a/third_party/WebKit/Source/devtools/front_end/settings/module.json b/third_party/WebKit/Source/devtools/front_end/settings/module.json index aeae371..9f0ad02 100644 --- a/third_party/WebKit/Source/devtools/front_end/settings/module.json +++ b/third_party/WebKit/Source/devtools/front_end/settings/module.json
@@ -50,7 +50,7 @@ "location": "settings-view", "id": "preferences", "title": "Preferences", - "order": "0", + "order": 0, "className": "Settings.GenericSettingsTab" }, { @@ -58,7 +58,7 @@ "location": "settings-view", "id": "experiments", "title": "Experiments", - "order": "2", + "order": 2, "experiment": "*", "className": "Settings.ExperimentsSettingsTab" }, @@ -67,7 +67,7 @@ "location": "settings-view", "id": "blackbox", "title": "Blackboxing", - "order": "3", + "order": 3, "className": "Settings.FrameworkBlackboxSettingsTab" }, {
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 03cee9f..8ffe17d51 100644 --- a/third_party/WebKit/Source/devtools/front_end/sources/module.json +++ b/third_party/WebKit/Source/devtools/front_end/sources/module.json
@@ -526,7 +526,7 @@ "id": "sources.xhrBreakpoints", "title": "XHR Breakpoints", "order": 5, - "hasToolbar": "true", + "hasToolbar": true, "persistence": "permanent", "className": "Sources.XHRBreakpointsSidebarPane" }, @@ -536,7 +536,7 @@ "id": "sources.globalListeners", "title": "Global Listeners", "order": 8, - "hasToolbar": "true", + "hasToolbar": true, "persistence": "permanent", "className": "Sources.ObjectEventListenersSidebarPane" },
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/module.json b/third_party/WebKit/Source/devtools/front_end/timeline/module.json index 70b6676..3891d31 100644 --- a/third_party/WebKit/Source/devtools/front_end/timeline/module.json +++ b/third_party/WebKit/Source/devtools/front_end/timeline/module.json
@@ -110,7 +110,7 @@ "contextTypes": [ "Timeline.TimelinePanel" ], - "order": "10", + "order": 10, "className": "Timeline.TimelinePanel.ActionDelegate", "title": "Load profile\u2026", "bindings": [
diff --git a/third_party/WebKit/Source/devtools/package.json b/third_party/WebKit/Source/devtools/package.json index af41be8..e12315e 100644 --- a/third_party/WebKit/Source/devtools/package.json +++ b/third_party/WebKit/Source/devtools/package.json
@@ -14,7 +14,8 @@ "setup-dtrun": "cd scripts/devtools_run && npm link", "format-py": "yapf --exclude scripts/build/rjsmin.py -i --recursive scripts PRESUBMIT.py", "extract": "node scripts/extract_module/extract_module.js", - "check-gn": "node scripts/check_gn.js" + "check-gn": "node scripts/check_gn.js", + "check-json": "node scripts/json_validator/validate_module_json.js" }, "repository": { "type": "git", @@ -34,6 +35,7 @@ }, "homepage": "https://devtools.chrome.com", "devDependencies": { + "ajv": "^5.1.5", "eslint": "3.10.0" } }
diff --git a/third_party/WebKit/Source/devtools/scripts/json_validator/module.schema.json b/third_party/WebKit/Source/devtools/scripts/json_validator/module.schema.json new file mode 100644 index 0000000..2c7c3fa --- /dev/null +++ b/third_party/WebKit/Source/devtools/scripts/json_validator/module.schema.json
@@ -0,0 +1,46 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "additionalProperties": false, + "properties": { + "extensions": { + "type": "array", + "description": "Extension points", + "items": { + "properties": { + "type": {"type": "string"}, + "order": {"type": "number"} + } + } + }, + "dependencies": { + "type": "array", + "items": { + "type": "string" + } + }, + "scripts": { + "type": "array", + "items": { + "type": "string" + } + }, + "resources": { + "type": "array", + "items": { + "type": "string" + } + }, + "skip_compilation": { + "type": "array", + "items": { + "type": "string" + } + }, + "experiment": { + "type": "string" + } + }, + "definitions": { + } +} \ No newline at end of file
diff --git a/third_party/WebKit/Source/devtools/scripts/json_validator/validate_module_json.js b/third_party/WebKit/Source/devtools/scripts/json_validator/validate_module_json.js new file mode 100644 index 0000000..2d43584 --- /dev/null +++ b/third_party/WebKit/Source/devtools/scripts/json_validator/validate_module_json.js
@@ -0,0 +1,39 @@ +const fs = require('fs'); +const path = require('path'); + +const utils = require('../utils'); + +const FRONTEND_PATH = path.resolve(__dirname, '..', '..', 'front_end'); + +const modules = []; +for (let dir of fs.readdirSync(FRONTEND_PATH)) { + if (!utils.isDir(path.resolve(FRONTEND_PATH, dir))) + continue; + let module = path.resolve(dir, 'module.json'); + if (utils.isFile(path.resolve(FRONTEND_PATH, dir, 'module.json'))) + modules.push(dir); +} + +const Ajv = require('ajv'); +const ajv = new Ajv(); +// This seems to be the most widely supported version of the schema. +ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-04.json')); +const schema = JSON.parse(fs.readFileSync(path.resolve(__dirname, 'module.schema.json'))); +const validate = ajv.compile(schema); + +let totalErrors = 0; +for (let module of modules) { + const moduleObject = JSON.parse(fs.readFileSync(path.resolve(FRONTEND_PATH, module, 'module.json'))); + const valid = validate(moduleObject); + if (!valid) { + console.log('Issue with ./front_end/' + module + '/module.json:'); + totalErrors++; + validate.errors.sort((a, b) => b.dataPath.length - a.dataPath.length); + const error = validate.errors[0]; + console.log(' ', error.dataPath, error.message, error.params); + console.log(''); + } +} +if (totalErrors) + console.log('module.json errors:', totalErrors); +process.exit(totalErrors);
diff --git a/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnectionIceEvent.idl b/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnectionIceEvent.idl index 646aab54..a5440dd 100644 --- a/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnectionIceEvent.idl +++ b/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnectionIceEvent.idl
@@ -27,6 +27,6 @@ Constructor(DOMString type, optional RTCPeerConnectionIceEventInit eventInitDict) ] interface RTCPeerConnectionIceEvent : Event { readonly attribute RTCIceCandidate? candidate; - // TODO(lunalu): add nullable url attribute here: + // TODO(loonybear): add nullable url attribute here: // https://rawgit.com/w3c/webrtc-pc/master/webrtc.html#rtcpeerconnectioniceevent };
diff --git a/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnectionIceEventInit.idl b/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnectionIceEventInit.idl index 4af8c30..7b18b69 100644 --- a/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnectionIceEventInit.idl +++ b/third_party/WebKit/Source/modules/peerconnection/RTCPeerConnectionIceEventInit.idl
@@ -6,6 +6,6 @@ dictionary RTCPeerConnectionIceEventInit : EventInit { RTCIceCandidate? candidate; - // TODO(lunalu): add url attribute. + // TODO(loonybear): add url attribute. // DOMString? url; };
diff --git a/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5 b/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5 index 3a821f168..70e28fb0 100644 --- a/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5 +++ b/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5
@@ -478,7 +478,7 @@ { name: "GeometryInterfaces", implied_by: ["CompositorWorker"], - status: "experimental", + status: "stable", }, { name: "GetUserMedia",
diff --git a/third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.cpp b/third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.cpp index 53be7b8..9fcc268 100644 --- a/third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.cpp +++ b/third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.cpp
@@ -86,7 +86,7 @@ bool IsSupportedInFeaturePolicy(WebFeaturePolicyFeature feature) { switch (feature) { - // TODO(lunalu): Re-enabled fullscreen in feature policy once tests have + // TODO(loonybear): Re-enabled fullscreen in feature policy once tests have // been updated. // crbug.com/666761 case WebFeaturePolicyFeature::kFullscreen:
diff --git a/third_party/WebKit/Source/platform/graphics/CompositorMutableStateTest.cpp b/third_party/WebKit/Source/platform/graphics/CompositorMutableStateTest.cpp index f8c49c24..12837a81 100644 --- a/third_party/WebKit/Source/platform/graphics/CompositorMutableStateTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/CompositorMutableStateTest.cpp
@@ -4,9 +4,11 @@ #include "platform/graphics/CompositorMutableState.h" +#include <memory> + #include "base/message_loop/message_loop.h" -#include "cc/test/fake_compositor_frame_sink.h" #include "cc/test/fake_impl_task_runner_provider.h" +#include "cc/test/fake_layer_tree_frame_sink.h" #include "cc/test/fake_layer_tree_host_impl.h" #include "cc/test/test_shared_bitmap_manager.h" #include "cc/test/test_task_graph_runner.h" @@ -17,13 +19,12 @@ #include "platform/graphics/CompositorMutableStateProvider.h" #include "platform/graphics/CompositorMutation.h" #include "testing/gtest/include/gtest/gtest.h" -#include <memory> namespace blink { using cc::FakeImplTaskRunnerProvider; using cc::FakeLayerTreeHostImpl; -using cc::FakeCompositorFrameSink; +using cc::FakeLayerTreeFrameSink; using cc::LayerImpl; using cc::LayerTreeSettings; using cc::TestTaskGraphRunner; @@ -32,13 +33,13 @@ class CompositorMutableStateTest : public testing::Test { public: CompositorMutableStateTest() - : compositor_frame_sink_(FakeCompositorFrameSink::Create3d()) { + : layer_tree_frame_sink_(FakeLayerTreeFrameSink::Create3d()) { LayerTreeSettings settings; settings.layer_transforms_should_scale_layer_contents = true; host_impl_.reset(new FakeLayerTreeHostImpl(settings, &task_runner_provider_, &task_graph_runner_)); host_impl_->SetVisible(true); - EXPECT_TRUE(host_impl_->InitializeRenderer(compositor_frame_sink_.get())); + EXPECT_TRUE(host_impl_->InitializeRenderer(layer_tree_frame_sink_.get())); } void SetLayerPropertiesForTesting(LayerImpl* layer) { @@ -61,7 +62,7 @@ base::MessageLoop message_loop_; TestTaskGraphRunner task_graph_runner_; FakeImplTaskRunnerProvider task_runner_provider_; - std::unique_ptr<FakeCompositorFrameSink> compositor_frame_sink_; + std::unique_ptr<FakeLayerTreeFrameSink> layer_tree_frame_sink_; std::unique_ptr<FakeLayerTreeHostImpl> host_impl_; };
diff --git a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositorTest.cpp b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositorTest.cpp index e2d380b..9cb8d22 100644 --- a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositorTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositorTest.cpp
@@ -9,7 +9,7 @@ #include "base/test/test_simple_task_runner.h" #include "base/threading/thread_task_runner_handle.h" #include "cc/layers/layer.h" -#include "cc/test/fake_compositor_frame_sink.h" +#include "cc/test/fake_layer_tree_frame_sink.h" #include "cc/test/geometry_test_utils.h" #include "cc/trees/clip_node.h" #include "cc/trees/effect_node.h" @@ -65,16 +65,16 @@ return transform; } -class WebLayerTreeViewWithCompositorFrameSink +class WebLayerTreeViewWithLayerTreeFrameSink : public WebLayerTreeViewImplForTesting { public: - WebLayerTreeViewWithCompositorFrameSink(const cc::LayerTreeSettings& settings) + WebLayerTreeViewWithLayerTreeFrameSink(const cc::LayerTreeSettings& settings) : WebLayerTreeViewImplForTesting(settings) {} // cc::LayerTreeHostClient - void RequestNewCompositorFrameSink() override { - GetLayerTreeHost()->SetCompositorFrameSink( - cc::FakeCompositorFrameSink::Create3d()); + void RequestNewLayerTreeFrameSink() override { + GetLayerTreeHost()->SetLayerTreeFrameSink( + cc::FakeLayerTreeFrameSink::Create3d()); } }; @@ -97,7 +97,7 @@ settings.single_thread_proxy_scheduler = false; settings.use_layer_lists = true; web_layer_tree_view_ = - WTF::MakeUnique<WebLayerTreeViewWithCompositorFrameSink>(settings); + WTF::MakeUnique<WebLayerTreeViewWithLayerTreeFrameSink>(settings); web_layer_tree_view_->SetRootLayer( *paint_artifact_compositor_->GetWebLayer()); } @@ -185,7 +185,7 @@ std::unique_ptr<PaintArtifactCompositor> paint_artifact_compositor_; scoped_refptr<base::TestSimpleTaskRunner> task_runner_; base::ThreadTaskRunnerHandle task_runner_handle_; - std::unique_ptr<WebLayerTreeViewWithCompositorFrameSink> web_layer_tree_view_; + std::unique_ptr<WebLayerTreeViewWithLayerTreeFrameSink> web_layer_tree_view_; }; TEST_F(PaintArtifactCompositorTestWithPropertyTrees, EmptyPaintArtifact) {
diff --git a/third_party/WebKit/Source/platform/graphics/compositing/PaintChunksToCcLayer.cpp b/third_party/WebKit/Source/platform/graphics/compositing/PaintChunksToCcLayer.cpp index 44f49632..171e6a32 100644 --- a/third_party/WebKit/Source/platform/graphics/compositing/PaintChunksToCcLayer.cpp +++ b/third_party/WebKit/Source/platform/graphics/compositing/PaintChunksToCcLayer.cpp
@@ -31,8 +31,8 @@ local_state.Clip()->LocalTransformSpace(); if (transform_node != ancestor_state.Transform()) { const TransformationMatrix& local_to_ancestor_matrix = - GeometryMapper::SourceToDestinationProjection( - transform_node, ancestor_state.Transform()); + GeometryMapper::LocalToAncestorMatrix(transform_node, + ancestor_state.Transform()); // Clips are only in descendant spaces that are transformed by one // or more scrolls. DCHECK(local_to_ancestor_matrix.IsIdentityOrTranslation()); @@ -121,8 +121,8 @@ const TransformPaintPropertyNode* transform_node = paired_state->Effect()->LocalTransformSpace(); const TransformationMatrix& local_to_ancestor_matrix = - GeometryMapper::SourceToDestinationProjection( - transform_node, paired_state->Transform()); + GeometryMapper::LocalToAncestorMatrix(transform_node, + paired_state->Transform()); // Effects are only in descendant spaces that are transformed by one // or more scrolls. DCHECK(local_to_ancestor_matrix.IsIdentityOrTranslation());
diff --git a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.cpp b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.cpp index 29415f55..d744746 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.cpp
@@ -9,123 +9,80 @@ namespace blink { -const TransformationMatrix& GeometryMapper::SourceToDestinationProjection( - const TransformPaintPropertyNode* source, - const TransformPaintPropertyNode* destination) { - DCHECK(source && destination); - bool success = false; - const auto& result = - SourceToDestinationProjectionInternal(source, destination, success); - DCHECK(success); - return result; +const TransformationMatrix& GeometryMapper::IdentityMatrix() { + DEFINE_STATIC_LOCAL(TransformationMatrix, identity, (TransformationMatrix())); + return identity; } -// Returns flatten(destination_to_screen)^-1 * flatten(source_to_screen) -// -// In case that source and destination are coplanar in tree hierarchy [1], -// computes destination_to_plane_root ^ -1 * source_to_plane_root. -// It can be proved that [2] the result will be the same (except numerical -// errors) when the plane root has invertible screen projection, and this -// offers fallback definition when plane root is singular. For example: -// <div style="transform:rotateY(90deg); overflow:scroll;"> -// <div id="A" style="opacity:0.5;"> -// <div id="B" style="position:absolute;"></div> -// </div> -// </div> -// Both A and B have non-invertible screen projection, nevertheless it is -// useful to define projection between A and B. Say, the transform may be -// animated in compositor thus become visible. -// As SPv1 treats 3D transforms as compositing trigger, that implies mappings -// within the same compositing layer can only contain 2D transforms, thus -// intra-composited-layer queries are guaranteed to be handled correctly. -// -// [1] As defined by that all local transforms between source and some common -// ancestor 'plane root' and all local transforms between the destination -// and the plane root being flat. -// [2] destination_to_screen = plane_root_to_screen * destination_to_plane_root -// source_to_screen = plane_root_to_screen * source_to_plane_root -// output = flatten(destination_to_screen)^-1 * flatten(source_to_screen) -// = flatten(plane_root_to_screen * destination_to_plane_root)^-1 * -// flatten(plane_root_to_screen * source_to_plane_root) -// Because both destination_to_plane_root and source_to_plane_root are -// already flat, -// = flatten(plane_root_to_screen * flatten(destination_to_plane_root))^-1 * -// flatten(plane_root_to_screen * flatten(source_to_plane_root)) -// By flatten lemma [3] flatten(A * flatten(B)) = flatten(A) * flatten(B), -// = flatten(destination_to_plane_root)^-1 * -// flatten(plane_root_to_screen)^-1 * -// flatten(plane_root_to_screen) * flatten(source_to_plane_root) -// If flatten(plane_root_to_screen) is invertible, they cancel out: -// = flatten(destination_to_plane_root)^-1 * flatten(source_to_plane_root) -// = destination_to_plane_root^-1 * source_to_plane_root -// [3] Flatten lemma: https://goo.gl/DNKyOc -const TransformationMatrix& -GeometryMapper::SourceToDestinationProjectionInternal( - const TransformPaintPropertyNode* source, - const TransformPaintPropertyNode* destination, - bool& success) { - DCHECK(source && destination); - DEFINE_STATIC_LOCAL(TransformationMatrix, identity, (TransformationMatrix())); - DEFINE_STATIC_LOCAL(TransformationMatrix, temp, (TransformationMatrix())); +const FloatClipRect& GeometryMapper::InfiniteClip() { + DEFINE_STATIC_LOCAL(FloatClipRect, infinite, (FloatClipRect())); + return infinite; +} - if (source == destination) { - success = true; - return identity; - } - - const GeometryMapperTransformCache& source_cache = - source->GetTransformCache(); - const GeometryMapperTransformCache& destination_cache = - destination->GetTransformCache(); - - // Case 1: Check if source and destination are known to be coplanar. - // Even if destination may have invertible screen projection, - // this formula is likely to be numerically more stable. - if (source_cache.plane_root() == destination_cache.plane_root()) { - success = true; - if (source == destination_cache.plane_root()) - return destination_cache.from_plane_root(); - if (destination == source_cache.plane_root()) - return source_cache.to_plane_root(); - temp = destination_cache.from_plane_root(); - temp.Multiply(source_cache.to_plane_root()); - return temp; - } - - // Case 2: Check if we can fallback to the canonical definition of - // flatten(destination_to_screen)^-1 * flatten(source_to_screen) - // If flatten(destination_to_screen)^-1 is invalid, we are out of luck. - if (!destination_cache.projection_from_screen_is_valid()) { - success = false; - return identity; - } - - // Case 3: Compute: - // flatten(destination_to_screen)^-1 * flatten(source_to_screen) - const auto* root = TransformPaintPropertyNode::Root(); - success = true; - if (source == root) - return destination_cache.projection_from_screen(); - if (destination == root) { - temp = source_cache.to_screen(); - } else { - temp = destination_cache.projection_from_screen(); - temp.Multiply(source_cache.to_screen()); - } - temp.FlattenTo2d(); +FloatClipRect& GeometryMapper::TempRect() { + DEFINE_STATIC_LOCAL(FloatClipRect, temp, (FloatClipRect())); return temp; } +void GeometryMapper::SourceToDestinationVisualRect( + const PropertyTreeState& source_state, + const PropertyTreeState& destination_state, + FloatClipRect& rect) { + bool success = false; + SourceToDestinationVisualRectInternal(source_state, destination_state, rect, + success); + DCHECK(success); +} + +void GeometryMapper::SourceToDestinationVisualRectInternal( + const PropertyTreeState& source_state, + const PropertyTreeState& destination_state, + FloatClipRect& mapping_rect, + bool& success) { + LocalToAncestorVisualRectInternal(source_state, destination_state, + mapping_rect, success); + // Success if destinationState is an ancestor state. + if (success) + return; + + // Otherwise first map to the lowest common ancestor, then map to destination. + const TransformPaintPropertyNode* lca_transform = LowestCommonAncestor( + source_state.Transform(), destination_state.Transform()); + DCHECK(lca_transform); + + // Assume that the clip of destinationState is an ancestor of the clip of + // sourceState and is under the space of lcaTransform. Otherwise + // localToAncestorVisualRect() will fail. + PropertyTreeState lca_state = destination_state; + lca_state.SetTransform(lca_transform); + + LocalToAncestorVisualRectInternal(source_state, lca_state, mapping_rect, + success); + if (!success) + return; + + AncestorToLocalRect(lca_transform, destination_state.Transform(), + mapping_rect.Rect()); +} + void GeometryMapper::SourceToDestinationRect( const TransformPaintPropertyNode* source_transform_node, const TransformPaintPropertyNode* destination_transform_node, FloatRect& mapping_rect) { bool success = false; - const TransformationMatrix& source_to_destination = - SourceToDestinationProjectionInternal( - source_transform_node, destination_transform_node, success); - mapping_rect = - success ? source_to_destination.MapRect(mapping_rect) : FloatRect(); + LocalToAncestorRectInternal(source_transform_node, destination_transform_node, + mapping_rect, success); + // Success if destinationTransformNode is an ancestor of sourceTransformNode. + if (success) + return; + + // Otherwise first map to the least common ancestor, then map to destination. + const TransformPaintPropertyNode* lca_transform = + LowestCommonAncestor(source_transform_node, destination_transform_node); + DCHECK(lca_transform); + + LocalToAncestorRect(source_transform_node, lca_transform, mapping_rect); + AncestorToLocalRect(lca_transform, destination_transform_node, mapping_rect); } void GeometryMapper::LocalToAncestorVisualRect( @@ -154,29 +111,18 @@ return; } - const auto& transform_matrix = SourceToDestinationProjectionInternal( + const auto& transform_matrix = LocalToAncestorMatrixInternal( local_state.Transform(), ancestor_state.Transform(), success); if (!success) { - // A failure implies either source-to-plane or destination-to-plane being - // singular. A notable example of singular source-to-plane from valid CSS: - // <div id="plane" style="transform:rotateY(180deg)"> - // <div style="overflow:overflow"> - // <div id="ancestor" style="opacity:0.5;"> - // <div id="local" style="position:absolute; transform:scaleX(0);"> - // </div> - // </div> - // </div> - // </div> - // Either way, the element won't be renderable thus returning empty rect. - success = true; - rect_to_map = FloatClipRect(FloatRect()); return; } + FloatRect mapped_rect = transform_matrix.MapRect(rect_to_map.Rect()); const FloatClipRect& clip_rect = LocalToAncestorClipRectInternal(local_state.Clip(), ancestor_state.Clip(), ancestor_state.Transform(), success); + if (success) { // This is where we propagate the rounded-ness of |clipRect| to // |rectToMap|. @@ -209,14 +155,11 @@ PropertyTreeState transform_and_clip_state(effect->LocalTransformSpace(), effect->OutputClip(), nullptr); - LocalToAncestorVisualRectInternal(last_transform_and_clip_state, - transform_and_clip_state, mapping_rect, - success); - if (!success) { - success = true; - mapping_rect = FloatClipRect(FloatRect()); + SourceToDestinationVisualRectInternal(last_transform_and_clip_state, + transform_and_clip_state, + mapping_rect, success); + if (!success) return; - } mapping_rect.SetRect(effect->MapRect(mapping_rect.Rect())); last_transform_and_clip_state = transform_and_clip_state; @@ -224,9 +167,51 @@ PropertyTreeState final_transform_and_clip_state( ancestor_state.Transform(), ancestor_state.Clip(), nullptr); - LocalToAncestorVisualRectInternal(last_transform_and_clip_state, - final_transform_and_clip_state, - mapping_rect, success); + SourceToDestinationVisualRectInternal(last_transform_and_clip_state, + final_transform_and_clip_state, + mapping_rect, success); +} + +void GeometryMapper::LocalToAncestorRect( + const TransformPaintPropertyNode* local_transform_node, + const TransformPaintPropertyNode* ancestor_transform_node, + FloatRect& mapping_rect) { + bool success = false; + LocalToAncestorRectInternal(local_transform_node, ancestor_transform_node, + mapping_rect, success); + DCHECK(success); +} + +void GeometryMapper::LocalToAncestorRectInternal( + const TransformPaintPropertyNode* local_transform_node, + const TransformPaintPropertyNode* ancestor_transform_node, + FloatRect& mapping_rect, + bool& success) { + if (local_transform_node == ancestor_transform_node) { + success = true; + return; + } + + const auto& transform_matrix = LocalToAncestorMatrixInternal( + local_transform_node, ancestor_transform_node, success); + if (!success) + return; + mapping_rect = transform_matrix.MapRect(mapping_rect); +} + +void GeometryMapper::AncestorToLocalRect( + const TransformPaintPropertyNode* ancestor_transform_node, + const TransformPaintPropertyNode* local_transform_node, + FloatRect& rect) { + if (local_transform_node == ancestor_transform_node) + return; + + const auto& transform_matrix = + LocalToAncestorMatrix(local_transform_node, ancestor_transform_node); + DCHECK(transform_matrix.IsInvertible()); + + // TODO(chrishtr): Cache the inverse? + rect = transform_matrix.Inverse().MapRect(rect); } const FloatClipRect& GeometryMapper::LocalToAncestorClipRect( @@ -242,18 +227,75 @@ return result; } +const FloatClipRect& GeometryMapper::SourceToDestinationClipRect( + const PropertyTreeState& source_state, + const PropertyTreeState& destination_state) { + bool success = false; + const FloatClipRect& result = SourceToDestinationClipRectInternal( + source_state, destination_state, success); + DCHECK(success); + + return result; +} + +const FloatClipRect& GeometryMapper::SourceToDestinationClipRectInternal( + const PropertyTreeState& source_state, + const PropertyTreeState& destination_state, + bool& success) { + const FloatClipRect& result = LocalToAncestorClipRectInternal( + source_state.Clip(), destination_state.Clip(), + destination_state.Transform(), success); + // Success if destinationState is an ancestor state. + if (success) + return result; + + // Otherwise first map to the lowest common ancestor, then map to + // destination. + const TransformPaintPropertyNode* lca_transform = LowestCommonAncestor( + source_state.Transform(), destination_state.Transform()); + DCHECK(lca_transform); + + // Assume that the clip of destinationState is an ancestor of the clip of + // sourceState and is under the space of lcaTransform. Otherwise + // localToAncestorClipRectInternal() will fail. + PropertyTreeState lca_state = destination_state; + lca_state.SetTransform(lca_transform); + + const FloatClipRect& result2 = LocalToAncestorClipRectInternal( + source_state.Clip(), lca_state.Clip(), lca_state.Transform(), success); + if (!success) { + if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { + // On SPv1 we may fail when the paint invalidation container creates an + // overflow clip (in ancestorState) which is not in localState of an + // out-of-flow positioned descendant. See crbug.com/513108 and layout + // test compositing/overflow/handle-non-ancestor-clip-parent.html (run + // with --enable-prefer-compositing-to-lcd-text) for details. + // Ignore it for SPv1 for now. + success = true; + } + return result2; + } + if (!result2.IsInfinite()) { + FloatRect rect = result2.Rect(); + AncestorToLocalRect(lca_transform, destination_state.Transform(), rect); + FloatClipRect& temp = TempRect(); + temp.SetRect(rect); + if (result2.HasRadius()) + temp.SetHasRadius(); + return temp; + } + return result2; +} + const FloatClipRect& GeometryMapper::LocalToAncestorClipRectInternal( const ClipPaintPropertyNode* descendant, const ClipPaintPropertyNode* ancestor_clip, const TransformPaintPropertyNode* ancestor_transform, bool& success) { - DEFINE_STATIC_LOCAL(FloatClipRect, infinite, (FloatClipRect())); - DEFINE_STATIC_LOCAL(FloatClipRect, empty, (FloatRect())); - FloatClipRect clip; if (descendant == ancestor_clip) { success = true; - return infinite; + return InfiniteClip(); } const ClipPaintPropertyNode* clip_node = descendant; @@ -275,29 +317,19 @@ } if (!clip_node) { success = false; - if (!RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { - // On SPv1 we may fail when the paint invalidation container creates an - // overflow clip (in ancestorState) which is not in localState of an - // out-of-flow positioned descendant. See crbug.com/513108 and layout - // test compositing/overflow/handle-non-ancestor-clip-parent.html (run - // with --enable-prefer-compositing-to-lcd-text) for details. - // Ignore it for SPv1 for now. - success = true; - } - return infinite; + return InfiniteClip(); } // Iterate down from the top intermediate node found in the previous loop, // computing and memoizing clip rects as we go. for (auto it = intermediate_nodes.rbegin(); it != intermediate_nodes.rend(); ++it) { + success = false; const TransformationMatrix& transform_matrix = - SourceToDestinationProjectionInternal((*it)->LocalTransformSpace(), - ancestor_transform, success); - if (!success) { - success = true; - return empty; - } + LocalToAncestorMatrixInternal((*it)->LocalTransformSpace(), + ancestor_transform, success); + if (!success) + return InfiniteClip(); FloatRect mapped_rect = transform_matrix.MapRect((*it)->ClipRect().Rect()); clip.Intersect(mapped_rect); if ((*it)->ClipRect().IsRounded()) @@ -306,15 +338,83 @@ (*it)->GetClipCache().SetCachedClip(clip_and_transform, clip); } + success = true; + const FloatClipRect* cached_clip = descendant->GetClipCache().GetCachedClip(clip_and_transform); DCHECK(cached_clip); CHECK(clip.HasRadius() == cached_clip->HasRadius()); - - success = true; return *cached_clip; } +const TransformationMatrix& GeometryMapper::LocalToAncestorMatrix( + const TransformPaintPropertyNode* local_transform_node, + const TransformPaintPropertyNode* ancestor_transform_node) { + bool success = false; + const auto& result = LocalToAncestorMatrixInternal( + local_transform_node, ancestor_transform_node, success); + DCHECK(success); + return result; +} + +const TransformationMatrix& GeometryMapper::LocalToAncestorMatrixInternal( + const TransformPaintPropertyNode* local_transform_node, + const TransformPaintPropertyNode* ancestor_transform_node, + bool& success) { + if (local_transform_node == ancestor_transform_node) { + success = true; + return IdentityMatrix(); + } + + const TransformPaintPropertyNode* transform_node = local_transform_node; + Vector<const TransformPaintPropertyNode*> intermediate_nodes; + TransformationMatrix transform_matrix; + + // Iterate over the path from localTransformNode to ancestorState.transform. + // Stop if we've found a memoized (precomputed) transform for any particular + // node. + while (transform_node && transform_node != ancestor_transform_node) { + if (const TransformationMatrix* cached_matrix = + transform_node->GetTransformCache().GetCachedTransform( + ancestor_transform_node)) { + transform_matrix = *cached_matrix; + break; + } + + intermediate_nodes.push_back(transform_node); + transform_node = transform_node->Parent(); + } + if (!transform_node) { + success = false; + return IdentityMatrix(); + } + + // Iterate down from the top intermediate node found in the previous loop, + // computing and memoizing transforms as we go. + for (auto it = intermediate_nodes.rbegin(); it != intermediate_nodes.rend(); + it++) { + TransformationMatrix local_transform_matrix = (*it)->Matrix(); + local_transform_matrix.ApplyTransformOrigin((*it)->Origin()); + + // Flattening Lemma: flatten(A * flatten(B)) = flatten(flatten(A) * B). + // goo.gl/DNKyOc. Thus we can flatten transformMatrix rather than + // localTransformMatrix, because GeometryMapper only supports transforms + // into a flattened destination space. + if ((*it)->FlattensInheritedTransform()) + transform_matrix.FlattenTo2d(); + + transform_matrix = transform_matrix * local_transform_matrix; + (*it)->GetTransformCache().SetCachedTransform(ancestor_transform_node, + transform_matrix); + } + success = true; + const TransformationMatrix* cached_matrix = + local_transform_node->GetTransformCache().GetCachedTransform( + ancestor_transform_node); + DCHECK(cached_matrix); + return *cached_matrix; +} + void GeometryMapper::ClearCache() { GeometryMapperTransformCache::ClearCache(); GeometryMapperClipCache::ClearCache();
diff --git a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.h b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.h index 200ca82b..559e131c 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.h +++ b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapper.h
@@ -7,12 +7,11 @@ #include "platform/graphics/paint/FloatClipRect.h" #include "platform/graphics/paint/PropertyTreeState.h" +#include "platform/transforms/TransformationMatrix.h" #include "platform/wtf/HashMap.h" namespace blink { -class TransformationMatrix; - // GeometryMapper is a helper class for fast computations of transformed and // visual rects in different PropertyTreeStates. The design document has a // number of details on use cases, algorithmic definitions, and running times. @@ -32,19 +31,34 @@ STATIC_ONLY(GeometryMapper); public: - // Returns the matrix that is suitable to map geometries on the source plane - // to some backing in the destination plane. - // Formal definition: - // output = flatten(destination_to_screen)^-1 * flatten(source_to_screen) - // There are some cases that flatten(destination_to_screen) being - // singular yet we can still define a reasonable projection, for example: - // 1. Both nodes inherited a common singular flat ancestor: - // 2. Both nodes are co-planar to a common singular ancestor: - // Not every cases outlined above are supported! - // Read implementation comments for specific restrictions. - static const TransformationMatrix& SourceToDestinationProjection( - const TransformPaintPropertyNode* source, - const TransformPaintPropertyNode* destination); + // The runtime of m calls among localToAncestorVisualRect, localToAncestorRect + // or ancestorToLocalRect with the same |ancestorState| parameter is + // guaranteed to be O(n + m), where n is the number of transform and clip + // nodes in their respective property trees. + + // If the clips and transforms of |sourceState| are equal to or descendants of + // those of |destinationState|, returns the same value as + // localToAncestorVisualRect. Otherwise, maps the input rect to the + // transform state which is the lowest common ancestor of + // |sourceState.transform| and |destinationState.transform|, then multiplies + // it by the the inverse transform mapping from the lowest common ancestor to + // |destinationState.transform|. + // + // DCHECK fails if the clip of |destinationState| is not an ancestor of the + // clip of |sourceState|, or the inverse transform is not invertible. + // + // |mappingRect| is both input and output. + // + // The output FloatClipRect may contain false positives for rounded-ness + // if a rounded clip is clipped out, and overly conservative results + // in the presences of transforms. + // + // TODO(chrishtr): we should provide a variant of these methods that + // guarantees a tight result, or else signals an error. crbug.com/708741 + static void SourceToDestinationVisualRect( + const PropertyTreeState& source_state, + const PropertyTreeState& destination_state, + FloatClipRect& mapping_rect); // Same as sourceToDestinationVisualRect() except that only transforms are // applied. @@ -55,16 +69,6 @@ const TransformPaintPropertyNode* destination_transform_node, FloatRect& mapping_rect); - // Returns the "clip visual rect" between |localTransformState| and - // |ancestorState|. See above for the definition of "clip visual rect". - // - // The output FloatClipRect may contain false positives for rounded-ness - // if a rounded clip is clipped out, and overly conservative results - // in the presences of transforms. - static const FloatClipRect& LocalToAncestorClipRect( - const PropertyTreeState& local_transform_state, - const PropertyTreeState& ancestor_state); - // Maps from a rect in |localTransformSpace| to its visual rect in // |ancestorState|. This is computed by multiplying the rect by its combined // transform between |localTransformSpace| and |ancestorSpace|, then @@ -83,14 +87,71 @@ // The output FloatClipRect may contain false positives for rounded-ness // if a rounded clip is clipped out, and overly conservative results // in the presences of transforms. - // - // TODO(chrishtr): we should provide a variant of these methods that - // guarantees a tight result, or else signals an error. crbug.com/708741 static void LocalToAncestorVisualRect( const PropertyTreeState& local_transform_state, const PropertyTreeState& ancestor_state, FloatClipRect& mapping_rect); + // Maps from a rect in |localTransformNode| space to its transformed rect in + // |ancestorTransformNode| space. This is computed by multiplying the rect by + // the combined transform between |localTransformNode| and + // |ancestorTransformNode|, then flattening into 2D space. + // + // DCHECK fails if |localTransformNode| is not equal to or a descendant of + // |ancestorTransformNode|. + // + //|mappingRect| is both input and output. + static void LocalToAncestorRect( + const TransformPaintPropertyNode* local_transform_node, + const TransformPaintPropertyNode* ancestor_transform_node, + FloatRect& mapping_rect); + + // Maps from a rect in |ancestorTransformNode| space to its transformed rect + // in |localTransformNode| space. This is computed by multiplying the rect by + // the inverse combined transform between |localTransformNode| and + // |ancestorTransformNode|, if the transform is invertible. + // + // DCHECK fails if the combined transform is not invertible, or + // |localTransformNode| is not equal to or a descendant of + // |ancestorTransformNode|. + // + // |mappingRect| is both input and output. + static void AncestorToLocalRect( + const TransformPaintPropertyNode* ancestor_transform_node, + const TransformPaintPropertyNode* local_transform_node, + FloatRect& mapping_rect); + + // Returns the matrix used in |LocalToAncestorRect|. DCHECK fails iff + // |localTransformNode| is not equal to or a descendant of + // |ancestorTransformNode|. + // This matrix may not be flattened. Since GeometryMapper only supports + // flattened ancestor spaces, the returned matrix must be flattened to have + // the correct semantics (calling mapRect() on it implicitly applies + // flattening to the input; flattenTo2d() does it explicitly to tme matrix). + static const TransformationMatrix& LocalToAncestorMatrix( + const TransformPaintPropertyNode* local_transform_node, + const TransformPaintPropertyNode* ancestor_transform_node); + + // Returns the "clip visual rect" between |localTransformState| and + // |ancestorState|. See above for the definition of "clip visual rect". + // + // The output FloatClipRect may contain false positives for rounded-ness + // if a rounded clip is clipped out, and overly conservative results + // in the presences of transforms. + static const FloatClipRect& LocalToAncestorClipRect( + const PropertyTreeState& local_transform_state, + const PropertyTreeState& ancestor_state); + + // Like localToAncestorClipRect, except it can handle destination transform + // spaces which are not direct ancestors of the source transform space. + // + // The output FloatClipRect may contain false positives for rounded-ness + // if a rounded clip is clipped out, and overly conservative results + // in the presences of transforms. + static const FloatClipRect& SourceToDestinationClipRect( + const PropertyTreeState& source_state, + const PropertyTreeState& destination_state); + // Returns the lowest common ancestor in the paint property tree. template <typename NodeType> static PLATFORM_EXPORT const NodeType* LowestCommonAncestor(const NodeType*, @@ -104,15 +165,10 @@ // successful on return. See comments of the public functions for failure // conditions. - static const TransformationMatrix& SourceToDestinationProjectionInternal( - const TransformPaintPropertyNode* source, - const TransformPaintPropertyNode* destination, - bool& success); - - static const FloatClipRect& LocalToAncestorClipRectInternal( - const ClipPaintPropertyNode* descendant, - const ClipPaintPropertyNode* ancestor_clip, - const TransformPaintPropertyNode* ancestor_transform, + static void SourceToDestinationVisualRectInternal( + const PropertyTreeState& source_state, + const PropertyTreeState& destination_state, + FloatClipRect& mapping_rect, bool& success); static void LocalToAncestorVisualRectInternal( @@ -121,12 +177,38 @@ FloatClipRect& mapping_rect, bool& success); + static void LocalToAncestorRectInternal( + const TransformPaintPropertyNode* local_transform_node, + const TransformPaintPropertyNode* ancestor_transform_node, + FloatRect&, + bool& success); + + static const TransformationMatrix& LocalToAncestorMatrixInternal( + const TransformPaintPropertyNode* local_transform_node, + const TransformPaintPropertyNode* ancestor_transform_node, + bool& success); + + static const FloatClipRect& LocalToAncestorClipRectInternal( + const ClipPaintPropertyNode* descendant, + const ClipPaintPropertyNode* ancestor_clip, + const TransformPaintPropertyNode* ancestor_transform, + bool& success); + + static const FloatClipRect& SourceToDestinationClipRectInternal( + const PropertyTreeState& source_state, + const PropertyTreeState& destination_state, + bool& success); + static void SlowLocalToAncestorVisualRectWithEffects( const PropertyTreeState& local_state, const PropertyTreeState& ancestor_state, FloatClipRect& mapping_rect, bool& success); + static const TransformationMatrix& IdentityMatrix(); + static const FloatClipRect& InfiniteClip(); + static FloatClipRect& TempRect(); + friend class GeometryMapperTest; friend class PaintLayerClipperTest; };
diff --git a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTest.cpp b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTest.cpp index d809cb7..9649b49 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTest.cpp
@@ -34,12 +34,30 @@ return descendant_clip->GetClipCache().GetCachedClip(clip_and_transform); } + const TransformationMatrix* GetTransform( + const TransformPaintPropertyNode* descendant_transform, + const TransformPaintPropertyNode* ancestor_transform) { + return descendant_transform->GetTransformCache().GetCachedTransform( + ancestor_transform); + } + const TransformPaintPropertyNode* LowestCommonAncestor( const TransformPaintPropertyNode* a, const TransformPaintPropertyNode* b) { return GeometryMapper::LowestCommonAncestor(a, b); } + void SourceToDestinationVisualRectInternal( + const PropertyTreeState& source_state, + const PropertyTreeState& destination_state, + FloatRect& mapping_rect, + bool& success) { + FloatClipRect float_clip_rect(mapping_rect); + GeometryMapper::LocalToAncestorVisualRectInternal( + source_state, destination_state, float_clip_rect, success); + mapping_rect = float_clip_rect.Rect(); + } + void LocalToAncestorVisualRectInternal( const PropertyTreeState& local_state, const PropertyTreeState& ancestor_state, @@ -51,6 +69,15 @@ mapping_rect = float_clip_rect.Rect(); } + void LocalToAncestorRectInternal( + const TransformPaintPropertyNode* local_transform_node, + const TransformPaintPropertyNode* ancestor_transform_node, + FloatRect& rect, + bool& success) { + GeometryMapper::LocalToAncestorRectInternal( + local_transform_node, ancestor_transform_node, rect, success); + } + private: }; @@ -102,14 +129,14 @@ EXPECT_EQ(has_radius, float_clip_rect.HasRadius()); \ EXPECT_CLIP_RECT_EQ(expectedClipInAncestorSpace, float_clip_rect); \ float_rect.SetRect(inputRect); \ - GeometryMapper::LocalToAncestorVisualRect( \ + GeometryMapper::SourceToDestinationVisualRect( \ localPropertyTreeState, ancestorPropertyTreeState, float_rect); \ EXPECT_RECT_EQ(expectedVisualRect, float_rect.Rect()); \ EXPECT_EQ(has_radius, float_rect.HasRadius()); \ FloatRect test_mapped_rect = inputRect; \ - GeometryMapper::SourceToDestinationRect( \ - localPropertyTreeState.Transform(), \ - ancestorPropertyTreeState.Transform(), test_mapped_rect); \ + GeometryMapper::LocalToAncestorRect(localPropertyTreeState.Transform(), \ + ancestorPropertyTreeState.Transform(), \ + test_mapped_rect); \ EXPECT_RECT_EQ(expectedTransformedRect, test_mapped_rect); \ test_mapped_rect = inputRect; \ GeometryMapper::SourceToDestinationRect( \ @@ -118,11 +145,11 @@ EXPECT_RECT_EQ(expectedTransformedRect, test_mapped_rect); \ if (ancestorPropertyTreeState.Transform() != \ localPropertyTreeState.Transform()) { \ - const TransformationMatrix& transform_for_testing = \ - GeometryMapper::SourceToDestinationProjection( \ - localPropertyTreeState.Transform(), \ - ancestorPropertyTreeState.Transform()); \ - EXPECT_EQ(expectedTransformToAncestor, transform_for_testing); \ + const TransformationMatrix* transform_for_testing = \ + GetTransform(localPropertyTreeState.Transform(), \ + ancestorPropertyTreeState.Transform()); \ + CHECK(transform_for_testing); \ + EXPECT_EQ(expectedTransformToAncestor, *transform_for_testing); \ } \ if (ancestorPropertyTreeState.Clip() != localPropertyTreeState.Clip()) { \ const FloatClipRect* output_clip_for_testing = \ @@ -177,8 +204,8 @@ CHECK_MAPPINGS(input, output, output, transform->Matrix(), FloatClipRect(), local_state, PropertyTreeState::Root()); - GeometryMapper::SourceToDestinationRect(TransformPaintPropertyNode::Root(), - local_state.Transform(), output); + GeometryMapper::AncestorToLocalRect(TransformPaintPropertyNode::Root(), + local_state.Transform(), output); EXPECT_RECT_EQ(input, output); } @@ -244,6 +271,11 @@ bool has_radius = false; CHECK_MAPPINGS(input, output, output, final, FloatClipRect(), local_state, PropertyTreeState::Root()); + + // Check the cached matrix for the intermediate transform. + EXPECT_EQ( + rotate_transform, + *GetTransform(transform1.Get(), TransformPaintPropertyNode::Root())); } TEST_P(GeometryMapperTest, NestedTransformsFlattening) { @@ -265,11 +297,10 @@ FloatRect input(0, 0, 100, 100); rotate_transform.FlattenTo2d(); - TransformationMatrix combined = rotate_transform * inverse_rotate_transform; - combined.FlattenTo2d(); - FloatRect output = combined.MapRect(input); + TransformationMatrix final = rotate_transform * inverse_rotate_transform; + FloatRect output = final.MapRect(input); bool has_radius = false; - CHECK_MAPPINGS(input, output, output, combined, FloatClipRect(), local_state, + CHECK_MAPPINGS(input, output, output, final, FloatClipRect(), local_state, PropertyTreeState::Root()); } @@ -298,6 +329,10 @@ bool has_radius = false; CHECK_MAPPINGS(input, output, output, final, FloatClipRect(), local_state, PropertyTreeState::Root()); + + // Check the cached matrix for the intermediate transform. + EXPECT_EQ(scale_transform, *GetTransform(transform1.Get(), + TransformPaintPropertyNode::Root())); } TEST_P(GeometryMapperTest, NestedTransformsIntermediateDestination) { @@ -615,26 +650,49 @@ PropertyTreeState transform2_state = PropertyTreeState::Root(); transform2_state.SetTransform(transform2.Get()); + bool success; FloatRect input(0, 0, 100, 100); - FloatClipRect result_clip(input); - GeometryMapper::LocalToAncestorVisualRect(transform1_state, transform2_state, - result_clip); - EXPECT_RECT_EQ(FloatRect(-100, 0, 100, 100), result_clip.Rect()); - FloatRect result = input; - GeometryMapper::SourceToDestinationRect(transform1.Get(), transform2.Get(), - result); - EXPECT_RECT_EQ(FloatRect(-100, 0, 100, 100), result); - - result_clip = FloatClipRect(input); - GeometryMapper::LocalToAncestorVisualRect(transform2_state, transform1_state, - result_clip); - EXPECT_RECT_EQ(FloatRect(0, -100, 100, 100), result_clip.Rect()); + LocalToAncestorVisualRectInternal(transform1_state, transform2_state, result, + success); + // Fails, because the transform2state is not an ancestor of transform1State. + EXPECT_FALSE(success); + EXPECT_RECT_EQ(input, result); result = input; - GeometryMapper::SourceToDestinationRect(transform2.Get(), transform1.Get(), + LocalToAncestorRectInternal(transform1.Get(), transform2.Get(), result, + success); + // Fails, because the transform2state is not an ancestor of transform1State. + EXPECT_FALSE(success); + EXPECT_RECT_EQ(input, result); + + result = input; + LocalToAncestorVisualRectInternal(transform2_state, transform1_state, result, + success); + // Fails, because the transform1state is not an ancestor of transform2State. + EXPECT_FALSE(success); + EXPECT_RECT_EQ(input, result); + + result = input; + LocalToAncestorRectInternal(transform2.Get(), transform1.Get(), result, + success); + // Fails, because the transform1state is not an ancestor of transform2State. + EXPECT_FALSE(success); + EXPECT_RECT_EQ(input, result); + + FloatRect expected = + rotate_transform2.Inverse().MapRect(rotate_transform1.MapRect(input)); + result = input; + FloatClipRect float_clip_rect(result); + GeometryMapper::SourceToDestinationVisualRect( + transform1_state, transform2_state, float_clip_rect); + result = float_clip_rect.Rect(); + EXPECT_RECT_EQ(expected, result); + + result = input; + GeometryMapper::SourceToDestinationRect(transform1.Get(), transform2.Get(), result); - EXPECT_RECT_EQ(FloatRect(0, -100, 100, 100), result); + EXPECT_RECT_EQ(expected, result); } TEST_P(GeometryMapperTest, SiblingTransformsWithClip) { @@ -654,7 +712,7 @@ RefPtr<ClipPaintPropertyNode> clip = ClipPaintPropertyNode::Create( ClipPaintPropertyNode::Root(), transform2.Get(), - FloatRoundedRect(10, 20, 30, 40)); + FloatRoundedRect(10, 10, 70, 70)); PropertyTreeState transform1_state = PropertyTreeState::Root(); transform1_state.SetTransform(transform1.Get()); @@ -664,23 +722,46 @@ bool success; FloatRect input(0, 0, 100, 100); - FloatRect result = input; - LocalToAncestorVisualRectInternal(transform1_state, transform2_and_clip_state, - result, success); - // Fails, because the clip of the destination state is not an ancestor of the - // clip of the source state. A known bug in SPv1 would make such query, - // in such case, no clips are applied. - if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { - EXPECT_FALSE(success); - } else { - EXPECT_TRUE(success); - EXPECT_EQ(FloatRect(-100, 0, 100, 100), result); - } - FloatClipRect float_clip_rect(input); - GeometryMapper::LocalToAncestorVisualRect(transform2_and_clip_state, - transform1_state, float_clip_rect); - EXPECT_RECT_EQ(FloatRect(20, -40, 40, 30), float_clip_rect.Rect()); + // Test map from transform1State to transform2AndClipState. + FloatRect expected = + rotate_transform2.Inverse().MapRect(rotate_transform1.MapRect(input)); + + // sourceToDestinationVisualRect ignores clip from the common ancestor to + // destination. + FloatRect result = input; + SourceToDestinationVisualRectInternal( + transform1_state, transform2_and_clip_state, result, success); + // Fails, because the clip of the destination state is not an ancestor of the + // clip of the source state. + EXPECT_FALSE(success); + + // sourceToDestinationRect applies transforms only. + result = input; + GeometryMapper::SourceToDestinationRect(transform1.Get(), transform2.Get(), + result); + EXPECT_RECT_EQ(expected, result); + + // Test map from transform2AndClipState to transform1State. + FloatRect expected_unclipped = + rotate_transform1.Inverse().MapRect(rotate_transform2.MapRect(input)); + FloatRect expected_clipped = rotate_transform1.Inverse().MapRect( + rotate_transform2.MapRect(FloatRect(10, 10, 70, 70))); + + // sourceToDestinationVisualRect ignores clip from the common ancestor to + // destination. + result = input; + FloatClipRect float_clip_rect(result); + GeometryMapper::SourceToDestinationVisualRect( + transform2_and_clip_state, transform1_state, float_clip_rect); + result = float_clip_rect.Rect(); + EXPECT_RECT_EQ(expected_clipped, result); + + // sourceToDestinationRect applies transforms only. + result = input; + GeometryMapper::SourceToDestinationRect(transform2.Get(), transform1.Get(), + result); + EXPECT_RECT_EQ(expected_unclipped, result); } TEST_P(GeometryMapperTest, LowestCommonAncestor) {
diff --git a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTransformCache.cpp b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTransformCache.cpp index 1634d58..c94c50a5 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTransformCache.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTransformCache.cpp
@@ -4,70 +4,49 @@ #include "platform/graphics/paint/GeometryMapperTransformCache.h" -#include "platform/graphics/paint/TransformPaintPropertyNode.h" - namespace blink { // All transform caches invalidate themselves by tracking a local cache // generation, and invalidating their cache if their cache generation disagrees -// with s_global_generation. -unsigned GeometryMapperTransformCache::s_global_generation; +// with s_transformCacheGeneration. +static unsigned g_transform_cache_generation = 0; + +GeometryMapperTransformCache::GeometryMapperTransformCache() + : cache_generation_(g_transform_cache_generation) {} void GeometryMapperTransformCache::ClearCache() { - s_global_generation++; + g_transform_cache_generation++; } -// Computes flatten(m) ^ -1, return true if the inversion succeeded. -static bool InverseProjection(TransformationMatrix m, - TransformationMatrix& out) { - m.FlattenTo2d(); - if (!m.IsInvertible()) - return false; - out = m.Inverse(); - return true; +void GeometryMapperTransformCache::InvalidateCacheIfNeeded() { + if (cache_generation_ != g_transform_cache_generation) { + transform_cache_.clear(); + cache_generation_ = g_transform_cache_generation; + } } -void GeometryMapperTransformCache::Update( - const TransformPaintPropertyNode& node) { - DCHECK_NE(cache_generation_, s_global_generation); - cache_generation_ = s_global_generation; - - if (!node.Parent()) { - to_screen_.MakeIdentity(); - to_screen_is_invertible_ = true; - projection_from_screen_.MakeIdentity(); - projection_from_screen_is_valid_ = true; - plane_root_ = &node; - to_plane_root_.MakeIdentity(); - from_plane_root_.MakeIdentity(); - return; +const TransformationMatrix* GeometryMapperTransformCache::GetCachedTransform( + const TransformPaintPropertyNode* ancestor_transform) { + InvalidateCacheIfNeeded(); + for (const auto& entry : transform_cache_) { + if (entry.ancestor_node == ancestor_transform) { + return &entry.to_ancestor; + } } + return nullptr; +} - const GeometryMapperTransformCache& parent = - node.Parent()->GetTransformCache(); - - TransformationMatrix local = node.Matrix(); - local.ApplyTransformOrigin(node.Origin()); - - to_screen_ = parent.to_screen_; - if (node.FlattensInheritedTransform()) - to_screen_.FlattenTo2d(); - to_screen_.Multiply(local); - to_screen_is_invertible_ = to_screen_.IsInvertible(); - projection_from_screen_is_valid_ = - InverseProjection(to_screen_, projection_from_screen_); - - if (!local.IsFlat() || !local.IsInvertible()) { - plane_root_ = &node; - to_plane_root_.MakeIdentity(); - from_plane_root_.MakeIdentity(); - } else { // (local.IsFlat() && local.IsInvertible()) - plane_root_ = parent.plane_root_; - to_plane_root_ = parent.to_plane_root_; - to_plane_root_.Multiply(local); - from_plane_root_ = local.Inverse(); - from_plane_root_.Multiply(parent.from_plane_root_); +void GeometryMapperTransformCache::SetCachedTransform( + const TransformPaintPropertyNode* ancestor_transform, + const TransformationMatrix& matrix) { + InvalidateCacheIfNeeded(); +#if DCHECK_IS_ON() + for (const auto& entry : transform_cache_) { + if (entry.ancestor_node == ancestor_transform) + DCHECK(false); // There should be no existing entry. } +#endif + transform_cache_.push_back(TransformCacheEntry(ancestor_transform, matrix)); } } // namespace blink
diff --git a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTransformCache.h b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTransformCache.h index af40d94b..398fc0e 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTransformCache.h +++ b/third_party/WebKit/Source/platform/graphics/paint/GeometryMapperTransformCache.h
@@ -14,108 +14,44 @@ class TransformPaintPropertyNode; -// A GeometryMapperTransformCache hangs off a TransformPaintPropertyNode. -// It stores useful intermediate results such as screen matrix for geometry -// queries. +// A GeometryMapperTransformCache hangs off a TransformPaintPropertyNode. It +// stores cached "transformed rects" (See GeometryMapper.h) from that node in +// ancestor spaces. class PLATFORM_EXPORT GeometryMapperTransformCache { USING_FAST_MALLOC(GeometryMapperTransformCache); + public: - GeometryMapperTransformCache() = default; + GeometryMapperTransformCache(); + + // Returns the transformed rect (see GeometryMapper.h) of |this| in the + // space of |ancestorTransform|, if there is one cached. Otherwise returns + // null. + // + // These transforms are not flattened to 2d. + const TransformationMatrix* GetCachedTransform( + const TransformPaintPropertyNode* ancestor_transform); + + // Stores the "transformed rect" of |this| in the space of |ancestors|, + // into a local cache. + void SetCachedTransform(const TransformPaintPropertyNode* ancestor_transform, + const TransformationMatrix& to_ancestor); static void ClearCache(); - void UpdateIfNeeded(const TransformPaintPropertyNode& node) { - if (cache_generation_ != s_global_generation) - Update(node); - DCHECK_EQ(cache_generation_, s_global_generation); - } - - const TransformationMatrix& to_screen() const { return to_screen_; } - bool to_screen_is_invertible() const { return to_screen_is_invertible_; } - - const TransformationMatrix& projection_from_screen() const { - return projection_from_screen_; - } - bool projection_from_screen_is_valid() const { - return projection_from_screen_is_valid_; - } - - const TransformationMatrix& to_plane_root() const { return to_plane_root_; } - const TransformationMatrix& from_plane_root() const { - return from_plane_root_; - } - const TransformPaintPropertyNode* plane_root() const { return plane_root_; } - private: - void Update(const TransformPaintPropertyNode&); + struct TransformCacheEntry { + const TransformPaintPropertyNode* ancestor_node; + TransformationMatrix to_ancestor; + TransformCacheEntry(const TransformPaintPropertyNode* ancestor_node_arg, + const TransformationMatrix& to_ancestor_arg) + : ancestor_node(ancestor_node_arg), to_ancestor(to_ancestor_arg) {} + }; - static unsigned s_global_generation; + void InvalidateCacheIfNeeded(); - // The cached values here can be categorized in two logical groups: - // - // [ Screen Transform ] - // to_screen : The screen matrix of the node, as defined by: - // to_screen = (flattens_inherited_transform ? - // flatten(parent.to_screen) : parent.to_screen) * local - // to_screen_is_invertible : Whether to_screen is invertible. - // projection_from_screen : Back projection from screen. - // projection_from_screen = flatten(to_screen) ^ -1 - // Undefined if the inverse projection doesn't exist. - // Guaranteed to be flat. - // projection_from_screen_is_valid : Whether projection_from_screen - // is defined. - // - // [ Plane Root Transform ] - // plane_root : The oldest ancestor node such that every intermediate node - // in the ancestor chain has a flat and invertible local matrix. In other - // words, a node inherits its parent's plane_root if its local matrix is - // flat and invertible. Otherwise, it becomes its own plane root. - // For example: - // <xfrm id="A" matrix="rotateY(10deg)"> - // <xfrm id="B" flatten_inherited matrix="translateX(10px)"/> - // <xfrm id="C" matrix="scaleX(0)"> - // <xfrm id="D" matrix="scaleX(2)"/> - // <xfrm id="E" matrix="rotate(30deg)"/> - // </xfrm> - // <xfrm id="F" matrix="scaleZ(0)"/> - // </xfrm> - // A is the plane root of itself because its local matrix is 3D. - // B's plane root is A because its local matrix is flat. - // C is the plane root of itself because its local matrix is non-invertible. - // D and E's plane root is C because their local matrix is flat. - // F is the plane root of itself because its local matrix is 3D and - // non-invertible. - // to_plane_root : The accumulated matrix between this node and plane_root. - // to_plane_root = (plane_root == this) ? I : parent.to_plane_root * local - // Guaranteed to be flat. - // from_plane_root : - // from_plane_root = to_plane_root ^ -1 - // Guaranteed to exist because each local matrices are invertible. - // Guaranteed to be flat. - // An important invariant is that - // flatten(to_screen) = flatten(plane_root.to_screen) * to_plane_root - // Proof by induction: - // If plane_root == this, - // flatten(plane_root.to_screen) * to_plane_root = flatten(to_screen) * I - // = flatten(to_screen) - // Otherwise, - // flatten(to_screen) = flatten((flattens_inherited_transform ? - // flatten(parent.to_screen) : parent.to_screen) * local) - // Because local is known to be flat, - // = flatten((flattens_inherited_transform ? - // flatten(parent.to_screen) : parent.to_screen) * flatten(local)) - // Then by flatten lemma (https://goo.gl/DNKyOc), - // = flatten(parent.to_screen) * local - // = flatten(parent.plane_root.to_screen) * parent.to_plane_root * local - // = flatten(plane_root.to_screen) * to_plane_root - TransformationMatrix to_screen_; - TransformationMatrix projection_from_screen_; - TransformationMatrix to_plane_root_; - TransformationMatrix from_plane_root_; - const TransformPaintPropertyNode* plane_root_ = nullptr; - unsigned cache_generation_ = s_global_generation - 1; - unsigned to_screen_is_invertible_ : 1; - unsigned projection_from_screen_is_valid_ : 1; + Vector<TransformCacheEntry> transform_cache_; + unsigned cache_generation_; + DISALLOW_COPY_AND_ASSIGN(GeometryMapperTransformCache); };
diff --git a/third_party/WebKit/Source/platform/graphics/paint/TransformPaintPropertyNode.h b/third_party/WebKit/Source/platform/graphics/paint/TransformPaintPropertyNode.h index 5b39615..3ac42f2 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/TransformPaintPropertyNode.h +++ b/third_party/WebKit/Source/platform/graphics/paint/TransformPaintPropertyNode.h
@@ -215,13 +215,16 @@ // For access to getTransformCache() and setCachedTransform. friend class GeometryMapper; friend class GeometryMapperTest; - friend class GeometryMapperTransformCache; - const GeometryMapperTransformCache& GetTransformCache() const { - if (!transform_cache_) - transform_cache_.reset(new GeometryMapperTransformCache); - transform_cache_->UpdateIfNeeded(*this); - return *transform_cache_; + GeometryMapperTransformCache& GetTransformCache() const { + return const_cast<TransformPaintPropertyNode*>(this)->GetTransformCache(); + } + + GeometryMapperTransformCache& GetTransformCache() { + if (!geometry_mapper_transform_cache_) + geometry_mapper_transform_cache_.reset( + new GeometryMapperTransformCache()); + return *geometry_mapper_transform_cache_.get(); } RefPtr<const TransformPaintPropertyNode> parent_; @@ -233,7 +236,8 @@ CompositorElementId compositor_element_id_; RefPtr<ScrollPaintPropertyNode> scroll_; - mutable std::unique_ptr<GeometryMapperTransformCache> transform_cache_; + std::unique_ptr<GeometryMapperTransformCache> + geometry_mapper_transform_cache_; }; // Redeclared here to avoid ODR issues.
diff --git a/third_party/WebKit/Source/platform/loader/fetch/FetchContext.h b/third_party/WebKit/Source/platform/loader/fetch/FetchContext.h index ca810e0..92504a0 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/FetchContext.h +++ b/third_party/WebKit/Source/platform/loader/fetch/FetchContext.h
@@ -216,7 +216,8 @@ // Called when the underlying context is detached. Note that some // FetchContexts continue working after detached (e.g., for fetch() operations // with "keepalive" specified). - virtual void Detach() {} + // Returns a "detached" fetch context which can be null. + virtual FetchContext* Detach() { return nullptr; } protected: FetchContext();
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp index 5452bf4..a43e4f9 100644 --- a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp +++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
@@ -1189,8 +1189,7 @@ void ResourceFetcher::ClearContext() { ClearPreloads(ResourceFetcher::kClearAllPreloads); - Context().Detach(); - context_.Clear(); + context_ = Context().Detach(); } int ResourceFetcher::BlockingRequestCount() const {
diff --git a/third_party/WebKit/Source/platform/testing/WebLayerTreeViewImplForTesting.cpp b/third_party/WebKit/Source/platform/testing/WebLayerTreeViewImplForTesting.cpp index 18b5bd1..6e8dc90 100644 --- a/third_party/WebKit/Source/platform/testing/WebLayerTreeViewImplForTesting.cpp +++ b/third_party/WebKit/Source/platform/testing/WebLayerTreeViewImplForTesting.cpp
@@ -138,11 +138,11 @@ bool has_scrolled_by_wheel, bool has_scrolled_by_touch) {} -void WebLayerTreeViewImplForTesting::RequestNewCompositorFrameSink() { - // Intentionally do not create and set an CompositorFrameSink. +void WebLayerTreeViewImplForTesting::RequestNewLayerTreeFrameSink() { + // Intentionally do not create and set a LayerTreeFrameSink. } -void WebLayerTreeViewImplForTesting::DidFailToInitializeCompositorFrameSink() { +void WebLayerTreeViewImplForTesting::DidFailToInitializeLayerTreeFrameSink() { NOTREACHED(); }
diff --git a/third_party/WebKit/Source/platform/testing/WebLayerTreeViewImplForTesting.h b/third_party/WebKit/Source/platform/testing/WebLayerTreeViewImplForTesting.h index c06b6a7..ddf923b 100644 --- a/third_party/WebKit/Source/platform/testing/WebLayerTreeViewImplForTesting.h +++ b/third_party/WebKit/Source/platform/testing/WebLayerTreeViewImplForTesting.h
@@ -90,9 +90,9 @@ float browser_controls_delta) override; void RecordWheelAndTouchScrollingCount(bool has_scrolled_by_wheel, bool has_scrolled_by_touch) override; - void RequestNewCompositorFrameSink() override; - void DidInitializeCompositorFrameSink() override {} - void DidFailToInitializeCompositorFrameSink() override; + void RequestNewLayerTreeFrameSink() override; + void DidInitializeLayerTreeFrameSink() override {} + void DidFailToInitializeLayerTreeFrameSink() override; void WillCommit() override {} void DidCommit() override {} void DidCommitAndDrawFrame() override {} @@ -103,7 +103,7 @@ // cc::LayerTreeHostSingleThreadClient implementation. void DidSubmitCompositorFrame() override {} - void DidLoseCompositorFrameSink() override {} + void DidLoseLayerTreeFrameSink() override {} private: cc::TestTaskGraphRunner task_graph_runner_;
diff --git a/third_party/WebKit/Source/platform/text/TextDirection.h b/third_party/WebKit/Source/platform/text/TextDirection.h index 5d33442b..fa6b7f68 100644 --- a/third_party/WebKit/Source/platform/text/TextDirection.h +++ b/third_party/WebKit/Source/platform/text/TextDirection.h
@@ -48,6 +48,10 @@ inline bool IsRtl(TextDirection direction) { return direction != TextDirection::kLtr; } + +inline TextDirection DirectionFromLevel(unsigned level) { + return level & 1 ? TextDirection::kRtl : TextDirection::kLtr; +} } #endif
diff --git a/third_party/WebKit/Source/platform/transforms/TransformationMatrix.h b/third_party/WebKit/Source/platform/transforms/TransformationMatrix.h index 8975c7c..6e8e2b94 100644 --- a/third_party/WebKit/Source/platform/transforms/TransformationMatrix.h +++ b/third_party/WebKit/Source/platform/transforms/TransformationMatrix.h
@@ -439,12 +439,6 @@ return result; } - bool IsFlat() const { - return matrix_[0][2] == 0.f && matrix_[1][2] == 0.f && - matrix_[2][0] == 0.f && matrix_[2][1] == 0.f && - matrix_[2][2] == 1.f && matrix_[2][3] == 0.f && matrix_[3][2] == 0.f; - } - bool IsIdentityOrTranslation() const { return matrix_[0][0] == 1 && matrix_[0][1] == 0 && matrix_[0][2] == 0 && matrix_[0][3] == 0 && matrix_[1][0] == 0 && matrix_[1][1] == 1 &&
diff --git a/third_party/WebKit/Source/web/ChromeClientImpl.cpp b/third_party/WebKit/Source/web/ChromeClientImpl.cpp index f9a30643..0e10a61 100644 --- a/third_party/WebKit/Source/web/ChromeClientImpl.cpp +++ b/third_party/WebKit/Source/web/ChromeClientImpl.cpp
@@ -571,7 +571,7 @@ } void ChromeClientImpl::OpenFileChooser(LocalFrame* frame, - PassRefPtr<FileChooser> file_chooser) { + RefPtr<FileChooser> file_chooser) { NotifyPopupOpeningObservers(); WebFrameClient* client = WebLocalFrameImpl::FromFrame(frame)->Client(); if (!client)
diff --git a/third_party/WebKit/Source/web/ChromeClientImpl.h b/third_party/WebKit/Source/web/ChromeClientImpl.h index 2ff7b48..adad1665 100644 --- a/third_party/WebKit/Source/web/ChromeClientImpl.h +++ b/third_party/WebKit/Source/web/ChromeClientImpl.h
@@ -124,7 +124,7 @@ DateTimeChooser* OpenDateTimeChooser( DateTimeChooserClient*, const DateTimeChooserParameters&) override; - void OpenFileChooser(LocalFrame*, PassRefPtr<FileChooser>) override; + void OpenFileChooser(LocalFrame*, RefPtr<FileChooser>) override; void EnumerateChosenDirectory(FileChooser*) override; void SetCursor(const Cursor&, LocalFrame*) override; void SetCursorOverridden(bool) override;
diff --git a/third_party/WebKit/Source/web/tests/MHTMLTest.cpp b/third_party/WebKit/Source/web/tests/MHTMLTest.cpp index 42907457..ea4c3662 100644 --- a/third_party/WebKit/Source/web/tests/MHTMLTest.cpp +++ b/third_party/WebKit/Source/web/tests/MHTMLTest.cpp
@@ -114,7 +114,7 @@ void AddResource(const char* url, const char* mime, - PassRefPtr<SharedBuffer> data) { + RefPtr<SharedBuffer> data) { SerializedResource resource(ToKURL(url), mime, std::move(data)); resources_.push_back(resource); }
diff --git a/third_party/WebKit/Source/web/tests/WebImageTest.cpp b/third_party/WebKit/Source/web/tests/WebImageTest.cpp index adb7140..f2e7454 100644 --- a/third_party/WebKit/Source/web/tests/WebImageTest.cpp +++ b/third_party/WebKit/Source/web/tests/WebImageTest.cpp
@@ -38,7 +38,7 @@ namespace blink { -static PassRefPtr<SharedBuffer> ReadFile(const char* file_name) { +static RefPtr<SharedBuffer> ReadFile(const char* file_name) { String file_path = testing::WebTestDataPath(file_name); return testing::ReadFromFile(file_path);
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py index fe7bd16..d5368f51 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
@@ -369,6 +369,7 @@ help='Output per-test profile information, using the specified profiler.'), optparse.make_option( '--repeat-each', + '--gtest_repeat', type='int', default=1, help='Number of times to run each test (e.g. AAABBBCCC)'),
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py index b487f38..bb66750 100644 --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py
@@ -394,6 +394,16 @@ tests_run = get_tests_run(['--repeat-each', '2', '--order', 'natural'] + tests_to_run) self.assertEqual(tests_run, ['passes/image.html', 'passes/image.html', 'passes/text.html', 'passes/text.html']) + def test_gtest_repeat(self): + tests_to_run = ['passes/image.html', 'passes/text.html'] + tests_run = get_tests_run(['--gtest_repeat', '2', '--order', 'natural'] + tests_to_run) + self.assertEqual(tests_run, ['passes/image.html', 'passes/image.html', 'passes/text.html', 'passes/text.html']) + + def test_gtest_repeat_overrides_repeat_each(self): + tests_to_run = ['passes/image.html', 'passes/text.html'] + tests_run = get_tests_run(['--repeat-each', '4', '--gtest_repeat', '2', '--order', 'natural'] + tests_to_run) + self.assertEqual(tests_run, ['passes/image.html', 'passes/image.html', 'passes/text.html', 'passes/text.html']) + def test_ignore_flag(self): # Note that passes/image.html is expected to be run since we specified it directly. tests_run = get_tests_run(['-i', 'passes', 'passes/image.html'])
diff --git a/third_party/WebKit/public/platform/modules/presentation/presentation.mojom b/third_party/WebKit/public/platform/modules/presentation/presentation.mojom index f68bc43a..7055cb9e 100644 --- a/third_party/WebKit/public/platform/modules/presentation/presentation.mojom +++ b/third_party/WebKit/public/platform/modules/presentation/presentation.mojom
@@ -124,12 +124,6 @@ interface PresentationServiceClient { ////////// This API is implemented by a controlling frame. ///////////////// - // Called when the client tries to listen for screen availability changes for - // presentation of |url| but it is not supported by the device or underlying - // platform. This can also be called if the device is currently in a mode - // where it can't do screen discoveries (eg. low battery). - OnScreenAvailabilityNotSupported(url.mojom.Url url); - // Called when the client is listening for screen availability for // presentation of |url| and the state changes. When the client starts to // listen for screen availability, this method will always be called to give
diff --git a/tools/gn/docs/reference.md b/tools/gn/docs/reference.md index 2e6aa6f6..af2224a 100644 --- a/tools/gn/docs/reference.md +++ b/tools/gn/docs/reference.md
@@ -598,7 +598,7 @@ ### <a name="gen:"></a>**gn gen**: Generate ninja files. ``` - gn gen [<ide options>] <out_dir> + gn gen [--check] [<ide options>] <out_dir> Generates ninja files from the current tree and puts them in the given output directory. @@ -608,6 +608,9 @@ Or it can be a directory relative to the current directory such as: out/foo + "gn gen --check" is the same as running "gn check". See "gn help check" + for documentation on that mode. + See "gn help switches" for the common command-line switches. ``` @@ -645,6 +648,11 @@ --no-deps Don't include targets dependencies to the solution. Changes the way how --filters option works. Only directly matching targets are included. + + --winsdk=<sdk_version> + Use the specified Windows 10 SDK version to generate project files. + As an example, "10.0.15063.0" can be specified to use Creators Update SDK + instead of the default one. ``` #### **Xcode Flags** @@ -688,9 +696,10 @@ #### **Generic JSON Output** ``` - Dumps target information to JSON file and optionally invokes python script on - generated file. See comments at the beginning of json_project_writer.cc and - desc_builder.cc for overview of JSON file format. + Dumps target information to a JSON file and optionally invokes a + python script on the generated file. See the comments at the beginning + of json_project_writer.cc and desc_builder.cc for an overview of the JSON + file format. --json-file-name=<json_file_name> Overrides default file name (project.json) of generated JSON file. @@ -1932,7 +1941,7 @@ get_label_info(":foo", "name") # Returns string "foo". - get_label_info("//foo/bar:baz", "gen_dir") + get_label_info("//foo/bar:baz", "target_gen_dir") # Returns string "//out/Debug/gen/foo/bar". ``` ### <a name="get_path_info"></a>**get_path_info**: Extract parts of a file or directory name. @@ -5358,6 +5367,11 @@ build file containing this target name. This defaults to "//:" which will cause the file //BUILD.gn to be loaded. + script_executable [optional] + Path to specific Python executable or potentially a different language + interpreter that is used to execute scripts in action targets and + exec_script calls. + secondary_source [optional] Label of an alternate directory tree to find input files. When searching for a BUILD.gn file (or the build config file discussed above), the file
diff --git a/tools/gn/setup.cc b/tools/gn/setup.cc index 192230d..7fc4a2e 100644 --- a/tools/gn/setup.cc +++ b/tools/gn/setup.cc
@@ -98,6 +98,11 @@ build file containing this target name. This defaults to "//:" which will cause the file //BUILD.gn to be loaded. + script_executable [optional] + Path to specific Python executable or potentially a different language + interpreter that is used to execute scripts in action targets and + exec_script calls. + secondary_source [optional] Label of an alternate directory tree to find input files. When searching for a BUILD.gn file (or the build config file discussed above), the file @@ -314,13 +319,6 @@ if (!FillBuildDir(build_dir, !force_create)) return false; - // Check for unused variables in the .gn file. - Err err; - if (!dotfile_scope_.CheckForUnusedVars(&err)) { - err.PrintToStdout(); - return false; - } - // Apply project-specific default (if specified). // Must happen before FillArguments(). if (default_args_) { @@ -333,7 +331,15 @@ if (!FillArguments(*cmdline)) return false; } - FillPythonPath(*cmdline); + if (!FillPythonPath(*cmdline)) + return false; + + // Check for unused variables in the .gn file. + Err err; + if (!dotfile_scope_.CheckForUnusedVars(&err)) { + err.PrintToStdout(); + return false; + } return true; } @@ -626,12 +632,21 @@ return true; } -void Setup::FillPythonPath(const base::CommandLine& cmdline) { +bool Setup::FillPythonPath(const base::CommandLine& cmdline) { // Trace this since it tends to be a bit slow on Windows. ScopedTrace setup_trace(TraceItem::TRACE_SETUP, "Fill Python Path"); + const Value* value = dotfile_scope_.GetValue("script_executable", true); if (cmdline.HasSwitch(switches::kScriptExecutable)) { build_settings_.set_python_path( cmdline.GetSwitchValuePath(switches::kScriptExecutable)); + } else if (value) { + Err err; + if (!value->VerifyTypeIs(Value::STRING, &err)) { + err.PrintToStdout(); + return false; + } + build_settings_.set_python_path( + base::FilePath(UTF8ToFilePath(value->string_value()))); } else { #if defined(OS_WIN) base::FilePath python_path = FindWindowsPython(); @@ -645,6 +660,7 @@ build_settings_.set_python_path(base::FilePath("python")); #endif } + return true; } bool Setup::RunConfigFile() {
diff --git a/tools/gn/setup.h b/tools/gn/setup.h index d9a77d0..68a8f0b3 100644 --- a/tools/gn/setup.h +++ b/tools/gn/setup.h
@@ -119,7 +119,7 @@ // Fills the python path portion of the command line. On failure, sets // it to just "python". - void FillPythonPath(const base::CommandLine& cmdline); + bool FillPythonPath(const base::CommandLine& cmdline); // Run config file. bool RunConfigFile();
diff --git a/tools/mb/mb_config.pyl b/tools/mb/mb_config.pyl index 7b311cf..75faca3d 100644 --- a/tools/mb/mb_config.pyl +++ b/tools/mb/mb_config.pyl
@@ -348,6 +348,7 @@ 'chromium.perf.fyi': { 'Android Builder FYI': 'official_goma_minimal_symbols_android', + 'Android arm64 Builder FYI': 'official_goma_minimal_symbols_android_arm64', 'Win Builder FYI': 'official_goma', 'Win Clang Builder': 'official_goma_minimal_symbols_clang', 'Battor Agent Linux': 'official_goma_minimal_symbols_clang',
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 35df5947..4658371 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -2588,7 +2588,13 @@ <int value="4" label="Bad disable reasons"/> </enum> -<enum name="BaseRelocationType"> +<enum name="BankNameDisplayedFormEvent" type="int"> + <int value="0" label="Suggestions shown with bank name available (once)"/> + <int value="1" + label="Server suggestion filled with bank name available (once)"/> +</enum> + +<enum name="BaseRelocationType" type="int"> <int value="0" label="IMAGE_REL_BASED_ABSOLUTE"/> <int value="1" label="IMAGE_REL_BASED_HIGH"/> <int value="2" label="IMAGE_REL_BASED_LOW"/> @@ -22072,6 +22078,7 @@ <int value="-1847835522" label="disable-touch-adjustment"/> <int value="-1847776781" label="enable-loading-ipc-optimization-for-small-resources"/> + <int value="-1839637286" label="AutofillCreditCardBankNameDisplay:disabled"/> <int value="-1838482444" label="disable-settings-window"/> <int value="-1835975804" label="disable-offline-auto-reload"/> <int value="-1833149810" label="enable-accessibility-tab-switcher"/> @@ -22379,6 +22386,7 @@ <int value="-770319039" label="enable-touch-editing"/> <int value="-763759697" label="enable-audio-support-for-desktop-share"/> <int value="-759830869" label="enable-tab-discarding"/> + <int value="-751273871" label="AutofillCreditCardBankNameDisplay:enabled"/> <int value="-750175757" label="ClientLoFi:enabled"/> <int value="-749048160" label="enable-panels"/> <int value="-747463111" label="ContentSuggestionsNotifications:disabled"/>
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index c9896b2..f81d3e5 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -4118,6 +4118,25 @@ </details> </histogram> +<histogram name="Autofill.FormEvents.CreditCard.BankNameDisplayed" + enum="BankNameDisplayedFormEvent"> + <owner>szhangcs@google.com</owner> + <summary> + Autofill form events for credit card forms. These are recorded when the user + interacts with a form requesting a credit card, a dropdown of suggestions + is shown and at least one of the suggestions has a bank name. Form events + are logged at most once per page load. + </summary> + <details> + These metrics are used to measure the impact of the bank name experiment. + They are used to calculate the CTR of the autofill UI with bank names + available. Not all credit cards will have bank names even if we launch the + experiment. With these metrics we can run the experiment on 2 groups. For + one group, we will show bank names if available. For the other, we won't + shown. + </details> +</histogram> + <histogram name="Autofill.FormEvents.CreditCard.OnNonsecurePage" enum="AutofillFormEvent"> <owner>estark@chromium.org</owner> @@ -92486,6 +92505,10 @@ <affected-histogram name="PageLoad.Clients.DocWrite.Evaluator.Timing2.ParseDuration"/> <affected-histogram + name="PageLoad.Clients.MultiTabLoading.DocumentTiming.NavigationToDOMContentLoadedEventFired"/> + <affected-histogram + name="PageLoad.Clients.MultiTabLoading.DocumentTiming.NavigationToLoadEventFired"/> + <affected-histogram name="PageLoad.Clients.ServiceWorker.PaintTiming.NavigationToFirstContentfulPaint"/> <affected-histogram name="PageLoad.Clients.ServiceWorker.ParseTiming.NavigationToParseStart"/> @@ -92869,6 +92892,25 @@ <affected-histogram name="PageLoad.Experimental.Bytes.Total"/> </histogram_suffixes> +<histogram_suffixes name="PageLoadMetricsClientsMultiTabLoading" separator="." + ordering="prefix"> + <suffix name="Clients.MultiTabLoading" + label="PageLoadMetrics for page loads that started while there are + other loading tabs."/> + <affected-histogram + name="PageLoad.DocumentTiming.NavigationToDOMContentLoadedEventFired"/> + <affected-histogram + name="PageLoad.DocumentTiming.NavigationToLoadEventFired"/> + <affected-histogram + name="PageLoad.Experimental.PaintTiming.ForegroundToFirstMeaningfulPaint"/> + <affected-histogram + name="PageLoad.Experimental.PaintTiming.NavigationToFirstMeaningfulPaint"/> + <affected-histogram + name="PageLoad.PaintTiming.ForegroundToFirstContentfulPaint"/> + <affected-histogram + name="PageLoad.PaintTiming.NavigationToFirstContentfulPaint"/> +</histogram_suffixes> + <histogram_suffixes name="PageLoadMetricsClientsNoServiceWorkerSpecialApps" separator="."> <suffix name="search"
diff --git a/tools/perf/benchmarks/oopif.py b/tools/perf/benchmarks/oopif.py index 8a741ce..a657346a 100644 --- a/tools/perf/benchmarks/oopif.py +++ b/tools/perf/benchmarks/oopif.py
@@ -8,6 +8,7 @@ from benchmarks import loading_metrics_category from telemetry import benchmark +from telemetry import story from telemetry.page import cache_temperature from telemetry.web_perf import timeline_based_measurement @@ -51,6 +52,12 @@ return page_sets.OopifBasicPageSet(cache_temperatures=[ cache_temperature.PCV1_COLD, cache_temperature.PCV1_WARM]) + def GetExpectations(self): + class StoryExpectations(story.expectations.StoryExpectations): + def SetExpectations(self): + pass # No tests disabled. + return StoryExpectations() + @benchmark.Disabled('android') @benchmark.Owner(emails=['nasko@chromium.org']) @@ -66,3 +73,9 @@ def CreateStorySet(self, options): return page_sets.OopifBasicPageSet(cache_temperatures=[ cache_temperature.PCV1_COLD, cache_temperature.PCV1_WARM]) + + def GetExpectations(self): + class StoryExpectations(story.expectations.StoryExpectations): + def SetExpectations(self): + pass # No tests disabled. + return StoryExpectations()
diff --git a/tools/perf/benchmarks/tab_switching.py b/tools/perf/benchmarks/tab_switching.py index b1cf856..9eec5c8b 100644 --- a/tools/perf/benchmarks/tab_switching.py +++ b/tools/perf/benchmarks/tab_switching.py
@@ -48,3 +48,9 @@ @classmethod def ShouldTearDownStateAfterEachStoryRun(cls): return False + + def GetExpectations(self): + class StoryExpectations(story.expectations.StoryExpectations): + def SetExpectations(self): + pass # No tests disabled. + return StoryExpectations()
diff --git a/tools/perf/benchmarks/tracing.py b/tools/perf/benchmarks/tracing.py index 805ccdf..7e39d103 100644 --- a/tools/perf/benchmarks/tracing.py +++ b/tools/perf/benchmarks/tracing.py
@@ -5,6 +5,7 @@ from core import perf_benchmark from telemetry import benchmark +from telemetry import story from telemetry.timeline import chrome_trace_category_filter from telemetry.timeline import chrome_trace_config from telemetry.web_perf import timeline_based_measurement @@ -29,6 +30,12 @@ def Name(cls): return 'tracing.tracing_with_debug_overhead' + def GetExpectations(self): + class StoryExpectations(story.expectations.StoryExpectations): + def SetExpectations(self): + pass # No tests disabled. + return StoryExpectations() + # TODO(ssid): Enable on reference builds once stable browser starts supporting # background mode memory-infra. crbug.com/621195. @@ -53,3 +60,9 @@ @classmethod def Name(cls): return 'tracing.tracing_with_background_memory_infra' + + def GetExpectations(self): + class StoryExpectations(story.expectations.StoryExpectations): + def SetExpectations(self): + pass # No tests disabled. + return StoryExpectations()
diff --git a/tools/perf/benchmarks/v8.py b/tools/perf/benchmarks/v8.py index 490ad5a..877af17 100644 --- a/tools/perf/benchmarks/v8.py +++ b/tools/perf/benchmarks/v8.py
@@ -9,6 +9,7 @@ import page_sets from telemetry import benchmark +from telemetry import story from telemetry.timeline import chrome_trace_category_filter from telemetry.timeline import chrome_trace_config from telemetry.web_perf import timeline_based_measurement @@ -33,6 +34,11 @@ return True return False + def GetExpectations(self): + class StoryExpectations(story.expectations.StoryExpectations): + def SetExpectations(self): + pass # Nothing not disabled. + return StoryExpectations() class _InfiniteScrollBenchmark(perf_benchmark.PerfBenchmark): """ Base class for infinite scroll benchmarks. @@ -97,6 +103,12 @@ def Name(cls): return 'v8.infinite_scroll_tbmv2' + def GetExpectations(self): + class StoryExpectations(story.expectations.StoryExpectations): + def SetExpectations(self): + pass # blank_page.html not disabled. + return StoryExpectations() + @benchmark.Enabled('android') @benchmark.Owner(emails=['ulan@chromium.org']) @@ -111,6 +123,12 @@ def Name(cls): return 'v8.mobile_infinite_scroll_tbmv2' + def GetExpectations(self): + class StoryExpectations(story.expectations.StoryExpectations): + def SetExpectations(self): + pass # blank_page.html not disabled. + return StoryExpectations() + class _Top25RuntimeStats(perf_benchmark.PerfBenchmark): options = {'pageset_repeat': 3} @@ -170,3 +188,9 @@ def CreateStorySet(self, options): return page_sets.V8Top25StorySet() + + def GetExpectations(self): + class StoryExpectations(story.expectations.StoryExpectations): + def SetExpectations(self): + pass # blank_page.html not disabled. + return StoryExpectations()
diff --git a/tools/perf/contrib/cluster_telemetry/loading_ct.py b/tools/perf/contrib/cluster_telemetry/loading_ct.py index 5f637e1d..eccfa68 100644 --- a/tools/perf/contrib/cluster_telemetry/loading_ct.py +++ b/tools/perf/contrib/cluster_telemetry/loading_ct.py
@@ -6,6 +6,7 @@ from contrib.cluster_telemetry import ct_benchmarks_util from contrib.cluster_telemetry import page_set +from telemetry import story from telemetry.page import traffic_setting @@ -40,3 +41,9 @@ @classmethod def Name(cls): return 'loading.cluster_telemetry' + + def GetExpectations(self): + class StoryExpectations(story.expectations.StoryExpectations): + def SetExpectations(self): + pass # Not tests disabled. + return StoryExpectations()
diff --git a/tools/perf/contrib/cluster_telemetry/multipage_skpicture_printer.py b/tools/perf/contrib/cluster_telemetry/multipage_skpicture_printer.py index 3ad1d47a..f0806f38 100644 --- a/tools/perf/contrib/cluster_telemetry/multipage_skpicture_printer.py +++ b/tools/perf/contrib/cluster_telemetry/multipage_skpicture_printer.py
@@ -54,6 +54,12 @@ options.page_set_base_dir) return story_set_class() + def GetExpectations(self): + class StoryExpectations(story.expectations.StoryExpectations): + def SetExpectations(self): + pass # Not tests disabled. + return StoryExpectations() + class MultipageSkpicturePrinterCT(perf_benchmark.PerfBenchmark): """Captures mSKPs for Cluster Telemetry.""" @@ -81,3 +87,9 @@ return page_set.CTPageSet( options.urls_list, options.user_agent, options.archive_data_file, run_page_interaction_callback=repaint_helpers.WaitThenRepaint) + + def GetExpectations(self): + class StoryExpectations(story.expectations.StoryExpectations): + def SetExpectations(self): + pass # Not tests disabled. + return StoryExpectations()
diff --git a/ui/aura/BUILD.gn b/ui/aura/BUILD.gn index 9b176e1..fad47943 100644 --- a/ui/aura/BUILD.gn +++ b/ui/aura/BUILD.gn
@@ -33,7 +33,7 @@ "input_state_lookup.h", "input_state_lookup_win.h", "layout_manager.h", - "local/compositor_frame_sink_local.h", + "local/layer_tree_frame_sink_local.h", "local/window_port_local.h", "mus/capture_synchronizer.h", "mus/capture_synchronizer_delegate.h", @@ -99,7 +99,7 @@ "input_state_lookup.cc", "input_state_lookup_win.cc", "layout_manager.cc", - "local/compositor_frame_sink_local.cc", + "local/layer_tree_frame_sink_local.cc", "local/window_port_local.cc", "mus/capture_synchronizer.cc", "mus/client_surface_embedder.cc",
diff --git a/ui/aura/local/compositor_frame_sink_local.cc b/ui/aura/local/layer_tree_frame_sink_local.cc similarity index 76% rename from ui/aura/local/compositor_frame_sink_local.cc rename to ui/aura/local/layer_tree_frame_sink_local.cc index a92bca4..f2bb69b 100644 --- a/ui/aura/local/compositor_frame_sink_local.cc +++ b/ui/aura/local/layer_tree_frame_sink_local.cc
@@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ui/aura/local/compositor_frame_sink_local.h" +#include "ui/aura/local/layer_tree_frame_sink_local.h" -#include "cc/output/compositor_frame_sink_client.h" +#include "cc/output/layer_tree_frame_sink_client.h" #include "cc/surfaces/compositor_frame_sink_support.h" #include "ui/aura/client/cursor_client.h" #include "ui/aura/env.h" @@ -15,18 +15,18 @@ namespace aura { -CompositorFrameSinkLocal::CompositorFrameSinkLocal( +LayerTreeFrameSinkLocal::LayerTreeFrameSinkLocal( const cc::FrameSinkId& frame_sink_id, cc::SurfaceManager* surface_manager) - : cc::CompositorFrameSink(nullptr, nullptr, nullptr, nullptr), + : cc::LayerTreeFrameSink(nullptr, nullptr, nullptr, nullptr), frame_sink_id_(frame_sink_id), surface_manager_(surface_manager) {} -CompositorFrameSinkLocal::~CompositorFrameSinkLocal() {} +LayerTreeFrameSinkLocal::~LayerTreeFrameSinkLocal() {} -bool CompositorFrameSinkLocal::BindToClient( - cc::CompositorFrameSinkClient* client) { - if (!cc::CompositorFrameSink::BindToClient(client)) +bool LayerTreeFrameSinkLocal::BindToClient( + cc::LayerTreeFrameSinkClient* client) { + if (!cc::LayerTreeFrameSink::BindToClient(client)) return false; DCHECK(!thread_checker_); thread_checker_ = base::MakeUnique<base::ThreadChecker>(); @@ -40,13 +40,13 @@ return true; } -void CompositorFrameSinkLocal::SetSurfaceChangedCallback( +void LayerTreeFrameSinkLocal::SetSurfaceChangedCallback( const SurfaceChangedCallback& callback) { DCHECK(!surface_changed_callback_); surface_changed_callback_ = callback; } -void CompositorFrameSinkLocal::DetachFromClient() { +void LayerTreeFrameSinkLocal::DetachFromClient() { DCHECK(thread_checker_); DCHECK(thread_checker_->CalledOnValidThread()); client_->SetBeginFrameSource(nullptr); @@ -54,11 +54,10 @@ support_->EvictCurrentSurface(); support_.reset(); thread_checker_.reset(); - cc::CompositorFrameSink::DetachFromClient(); + cc::LayerTreeFrameSink::DetachFromClient(); } -void CompositorFrameSinkLocal::SubmitCompositorFrame( - cc::CompositorFrame frame) { +void LayerTreeFrameSinkLocal::SubmitCompositorFrame(cc::CompositorFrame frame) { DCHECK(thread_checker_); DCHECK(thread_checker_->CalledOnValidThread()); DCHECK(frame.metadata.begin_frame_ack.has_damage); @@ -84,8 +83,7 @@ } } -void CompositorFrameSinkLocal::DidNotProduceFrame( - const cc::BeginFrameAck& ack) { +void LayerTreeFrameSinkLocal::DidNotProduceFrame(const cc::BeginFrameAck& ack) { DCHECK(thread_checker_); DCHECK(thread_checker_->CalledOnValidThread()); DCHECK(!ack.has_damage); @@ -93,7 +91,7 @@ support_->DidNotProduceFrame(ack); } -void CompositorFrameSinkLocal::DidReceiveCompositorFrameAck( +void LayerTreeFrameSinkLocal::DidReceiveCompositorFrameAck( const cc::ReturnedResourceArray& resources) { DCHECK(thread_checker_); DCHECK(thread_checker_->CalledOnValidThread()); @@ -104,13 +102,13 @@ client_->DidReceiveCompositorFrameAck(); } -void CompositorFrameSinkLocal::OnBeginFrame(const cc::BeginFrameArgs& args) { +void LayerTreeFrameSinkLocal::OnBeginFrame(const cc::BeginFrameArgs& args) { DCHECK(thread_checker_); DCHECK(thread_checker_->CalledOnValidThread()); begin_frame_source_->OnBeginFrame(args); } -void CompositorFrameSinkLocal::ReclaimResources( +void LayerTreeFrameSinkLocal::ReclaimResources( const cc::ReturnedResourceArray& resources) { DCHECK(thread_checker_); DCHECK(thread_checker_->CalledOnValidThread()); @@ -119,7 +117,7 @@ client_->ReclaimResources(resources); } -void CompositorFrameSinkLocal::OnNeedsBeginFrames(bool needs_begin_frames) { +void LayerTreeFrameSinkLocal::OnNeedsBeginFrames(bool needs_begin_frames) { DCHECK(thread_checker_); DCHECK(thread_checker_->CalledOnValidThread()); support_->SetNeedsBeginFrame(needs_begin_frames);
diff --git a/ui/aura/local/compositor_frame_sink_local.h b/ui/aura/local/layer_tree_frame_sink_local.h similarity index 70% rename from ui/aura/local/compositor_frame_sink_local.h rename to ui/aura/local/layer_tree_frame_sink_local.h index 77e3c29a..611eb40 100644 --- a/ui/aura/local/compositor_frame_sink_local.h +++ b/ui/aura/local/layer_tree_frame_sink_local.h
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef UI_AURA_LOCAL_COMPOSITOR_FRAME_SINK_LOCAL_H_ -#define UI_AURA_LOCAL_COMPOSITOR_FRAME_SINK_LOCAL_H_ +#ifndef UI_AURA_LOCAL_LAYER_TREE_FRAME_SINK_LOCAL_H_ +#define UI_AURA_LOCAL_LAYER_TREE_FRAME_SINK_LOCAL_H_ #include "base/callback.h" #include "base/macros.h" -#include "cc/output/compositor_frame_sink.h" +#include "cc/output/layer_tree_frame_sink.h" #include "cc/scheduler/begin_frame_source.h" #include "cc/surfaces/compositor_frame_sink_support_client.h" #include "cc/surfaces/frame_sink_id.h" @@ -18,29 +18,29 @@ namespace cc { class CompositorFrameSinkSupport; class SurfaceManager; -} +} // namespace cc namespace aura { -// cc::CompositorFrameSink implementation for classic aura, e.g. not mus. -// aura::Window::CreateCompositorFramSink creates this class for a given +// cc::LayerTreeFrameSink implementation for classic aura, e.g. not mus. +// aura::Window::CreateLayerTreeFrameSink creates this class for a given // aura::Window, and then the sink can be used for submitting frames to the // aura::Window's ui::Layer. -class CompositorFrameSinkLocal : public cc::CompositorFrameSink, - public cc::CompositorFrameSinkSupportClient, - public cc::ExternalBeginFrameSourceClient { +class LayerTreeFrameSinkLocal : public cc::LayerTreeFrameSink, + public cc::CompositorFrameSinkSupportClient, + public cc::ExternalBeginFrameSourceClient { public: - CompositorFrameSinkLocal(const cc::FrameSinkId& frame_sink_id, - cc::SurfaceManager* surface_manager); - ~CompositorFrameSinkLocal() override; + LayerTreeFrameSinkLocal(const cc::FrameSinkId& frame_sink_id, + cc::SurfaceManager* surface_manager); + ~LayerTreeFrameSinkLocal() override; using SurfaceChangedCallback = base::Callback<void(const cc::SurfaceId&, const gfx::Size&)>; // Set a callback which will be called when the surface is changed. void SetSurfaceChangedCallback(const SurfaceChangedCallback& callback); - // cc::CompositorFrameSink: - bool BindToClient(cc::CompositorFrameSinkClient* client) override; + // cc::LayerTreeFrameSink: + bool BindToClient(cc::LayerTreeFrameSinkClient* client) override; void DetachFromClient() override; void SubmitCompositorFrame(cc::CompositorFrame frame) override; void DidNotProduceFrame(const cc::BeginFrameAck& ack) override; @@ -68,9 +68,9 @@ std::unique_ptr<base::ThreadChecker> thread_checker_; SurfaceChangedCallback surface_changed_callback_; - DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkLocal); + DISALLOW_COPY_AND_ASSIGN(LayerTreeFrameSinkLocal); }; } // namespace aura -#endif // UI_AURA_LOCAL_COMPOSITOR_FRAME_SINK_LOCAL_H_ +#endif // UI_AURA_LOCAL_LAYER_TREE_FRAME_SINK_LOCAL_H_
diff --git a/ui/aura/local/window_port_local.cc b/ui/aura/local/window_port_local.cc index 8b2ceac..64540ba 100644 --- a/ui/aura/local/window_port_local.cc +++ b/ui/aura/local/window_port_local.cc
@@ -7,7 +7,7 @@ #include "cc/surfaces/surface_manager.h" #include "ui/aura/client/cursor_client.h" #include "ui/aura/env.h" -#include "ui/aura/local/compositor_frame_sink_local.h" +#include "ui/aura/local/layer_tree_frame_sink_local.h" #include "ui/aura/window.h" #include "ui/aura/window_delegate.h" #include "ui/display/display.h" @@ -96,13 +96,13 @@ int64_t old_value, std::unique_ptr<ui::PropertyData> data) {} -std::unique_ptr<cc::CompositorFrameSink> -WindowPortLocal::CreateCompositorFrameSink() { +std::unique_ptr<cc::LayerTreeFrameSink> +WindowPortLocal::CreateLayerTreeFrameSink() { DCHECK(!frame_sink_id_.is_valid()); auto* context_factory_private = aura::Env::GetInstance()->context_factory_private(); frame_sink_id_ = context_factory_private->AllocateFrameSinkId(); - auto frame_sink = base::MakeUnique<CompositorFrameSinkLocal>( + auto frame_sink = base::MakeUnique<LayerTreeFrameSinkLocal>( frame_sink_id_, context_factory_private->GetSurfaceManager()); frame_sink->SetSurfaceChangedCallback(base::Bind( &WindowPortLocal::OnSurfaceChanged, weak_factory_.GetWeakPtr()));
diff --git a/ui/aura/local/window_port_local.h b/ui/aura/local/window_port_local.h index 6599abc..4bcc934 100644 --- a/ui/aura/local/window_port_local.h +++ b/ui/aura/local/window_port_local.h
@@ -41,7 +41,7 @@ void OnPropertyChanged(const void* key, int64_t old_value, std::unique_ptr<ui::PropertyData> data) override; - std::unique_ptr<cc::CompositorFrameSink> CreateCompositorFrameSink() override; + std::unique_ptr<cc::LayerTreeFrameSink> CreateLayerTreeFrameSink() override; cc::SurfaceId GetSurfaceId() const override; void OnWindowAddedToRootWindow() override; void OnWillRemoveWindowFromRootWindow() override;
diff --git a/ui/aura/mus/DEPS b/ui/aura/mus/DEPS index 1f61421..1fae0da 100644 --- a/ui/aura/mus/DEPS +++ b/ui/aura/mus/DEPS
@@ -1,8 +1,8 @@ include_rules = [ "+cc/base/switches.h", "+cc/ipc/mojo_compositor_frame_sink.mojom.h", - "+cc/output/compositor_frame_sink_client.h", - "+cc/output/compositor_frame_sink.h", + "+cc/output/layer_tree_frame_sink_client.h", + "+cc/output/layer_tree_frame_sink.h", "+cc/scheduler/begin_frame_source.h", "+cc/surfaces/local_surface_id.h", "+cc/surfaces/local_surface_id_allocator.h", @@ -20,6 +20,6 @@ "+services/ui/public/cpp/gpu", "+services/ui/public/cpp/property_type_converters.h", "+services/ui/public/cpp/raster_thread_helper.h", - "+services/ui/public/cpp/client_compositor_frame_sink.h", + "+services/ui/public/cpp/client_layer_tree_frame_sink.h", "+ui/gl/gl_bindings.h", ]
diff --git a/ui/aura/mus/mus_context_factory.cc b/ui/aura/mus/mus_context_factory.cc index fd6cd92..c73271e 100644 --- a/ui/aura/mus/mus_context_factory.cc +++ b/ui/aura/mus/mus_context_factory.cc
@@ -38,14 +38,14 @@ WindowTreeHost::GetForAcceleratedWidget(compositor->widget()); WindowPortMus* window_port = WindowPortMus::Get(host->window()); DCHECK(window_port); - std::unique_ptr<cc::CompositorFrameSink> compositor_frame_sink = - window_port->RequestCompositorFrameSink( + std::unique_ptr<cc::LayerTreeFrameSink> layer_tree_frame_sink = + window_port->RequestLayerTreeFrameSink( gpu_->CreateContextProvider(std::move(gpu_channel)), gpu_->gpu_memory_buffer_manager()); - compositor->SetCompositorFrameSink(std::move(compositor_frame_sink)); + compositor->SetLayerTreeFrameSink(std::move(layer_tree_frame_sink)); } -void MusContextFactory::CreateCompositorFrameSink( +void MusContextFactory::CreateLayerTreeFrameSink( base::WeakPtr<ui::Compositor> compositor) { gpu_->EstablishGpuChannel( base::Bind(&MusContextFactory::OnEstablishedGpuChannel,
diff --git a/ui/aura/mus/mus_context_factory.h b/ui/aura/mus/mus_context_factory.h index 20d67f6b..ea0c5d74 100644 --- a/ui/aura/mus/mus_context_factory.h +++ b/ui/aura/mus/mus_context_factory.h
@@ -44,7 +44,7 @@ scoped_refptr<gpu::GpuChannelHost> gpu_channel); // ContextFactory: - void CreateCompositorFrameSink( + void CreateLayerTreeFrameSink( base::WeakPtr<ui::Compositor> compositor) override; scoped_refptr<cc::ContextProvider> SharedMainThreadContextProvider() override; void RemoveCompositor(ui::Compositor* compositor) override;
diff --git a/ui/aura/mus/window_mus.h b/ui/aura/mus/window_mus.h index 7087bf54..329f71b 100644 --- a/ui/aura/mus/window_mus.h +++ b/ui/aura/mus/window_mus.h
@@ -127,7 +127,7 @@ virtual void NotifyEmbeddedAppDisconnected() = 0; - virtual bool HasLocalCompositorFrameSink() = 0; + virtual bool HasLocalLayerTreeFrameSink() = 0; private: // Just for set_server_id(), which other places should not call.
diff --git a/ui/aura/mus/window_port_mus.cc b/ui/aura/mus/window_port_mus.cc index 72af5f3..2902086 100644 --- a/ui/aura/mus/window_port_mus.cc +++ b/ui/aura/mus/window_port_mus.cc
@@ -96,8 +96,8 @@ window_tree_client_->Embed(window_, std::move(client), flags, callback); } -std::unique_ptr<viz::ClientCompositorFrameSink> -WindowPortMus::RequestCompositorFrameSink( +std::unique_ptr<viz::ClientLayerTreeFrameSink> +WindowPortMus::RequestLayerTreeFrameSink( scoped_refptr<cc::ContextProvider> context_provider, gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager) { cc::mojom::MojoCompositorFrameSinkPtrInfo sink_info; @@ -107,7 +107,7 @@ cc::mojom::MojoCompositorFrameSinkClientRequest client_request = mojo::MakeRequest(&client); constexpr bool enable_surface_synchronization = true; - auto compositor_frame_sink = base::MakeUnique<viz::ClientCompositorFrameSink>( + auto layer_tree_frame_sink = base::MakeUnique<viz::ClientLayerTreeFrameSink>( std::move(context_provider), nullptr /* worker_context_provider */, gpu_memory_buffer_manager, nullptr /* shared_bitmap_manager */, nullptr /* synthetic_begin_frame_source */, std::move(sink_info), @@ -116,7 +116,7 @@ enable_surface_synchronization); window_tree_client_->AttachCompositorFrameSink( server_id(), std::move(sink_request), std::move(client)); - return compositor_frame_sink; + return layer_tree_frame_sink; } WindowPortMus::ServerChangeIdType WindowPortMus::ScheduleChange( @@ -307,8 +307,8 @@ if (frame_sink_id_.is_valid()) UpdatePrimarySurfaceInfo(); - if (local_compositor_frame_sink_) - local_compositor_frame_sink_->SetLocalSurfaceId(local_surface_id_); + if (local_layer_tree_frame_sink_) + local_layer_tree_frame_sink_->SetLocalSurfaceId(local_surface_id_); return local_surface_id_; } @@ -434,8 +434,8 @@ observer.OnEmbeddedAppDisconnected(window_); } -bool WindowPortMus::HasLocalCompositorFrameSink() { - return !!local_compositor_frame_sink_; +bool WindowPortMus::HasLocalLayerTreeFrameSink() { + return !!local_layer_tree_frame_sink_; } void WindowPortMus::OnPreInit(Window* window) { @@ -531,14 +531,14 @@ std::move(data)); } -std::unique_ptr<cc::CompositorFrameSink> -WindowPortMus::CreateCompositorFrameSink() { +std::unique_ptr<cc::LayerTreeFrameSink> +WindowPortMus::CreateLayerTreeFrameSink() { DCHECK_EQ(window_mus_type(), WindowMusType::LOCAL); - DCHECK(!local_compositor_frame_sink_); - auto frame_sink = RequestCompositorFrameSink( + DCHECK(!local_layer_tree_frame_sink_); + auto frame_sink = RequestLayerTreeFrameSink( nullptr, aura::Env::GetInstance()->context_factory()->GetGpuMemoryBufferManager()); - local_compositor_frame_sink_ = frame_sink->GetWeakPtr(); + local_layer_tree_frame_sink_ = frame_sink->GetWeakPtr(); return std::move(frame_sink); }
diff --git a/ui/aura/mus/window_port_mus.h b/ui/aura/mus/window_port_mus.h index aa18c57c..14abb2d2 100644 --- a/ui/aura/mus/window_port_mus.h +++ b/ui/aura/mus/window_port_mus.h
@@ -13,7 +13,7 @@ #include "base/logging.h" #include "base/macros.h" #include "cc/surfaces/surface_info.h" -#include "components/viz/client/client_compositor_frame_sink.h" +#include "components/viz/client/client_layer_tree_frame_sink.h" #include "services/ui/public/interfaces/cursor/cursor.mojom.h" #include "services/ui/public/interfaces/window_tree.mojom.h" #include "services/ui/public/interfaces/window_tree_constants.mojom.h" @@ -25,7 +25,7 @@ #include "ui/platform_window/mojo/text_input_state.mojom.h" namespace viz { -class ClientCompositorFrameSink; +class ClientLayerTreeFrameSink; } namespace aura { @@ -80,7 +80,7 @@ uint32_t flags, const ui::mojom::WindowTree::EmbedCallback& callback); - std::unique_ptr<viz::ClientCompositorFrameSink> RequestCompositorFrameSink( + std::unique_ptr<viz::ClientLayerTreeFrameSink> RequestLayerTreeFrameSink( scoped_refptr<cc::ContextProvider> context_provider, gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager); @@ -242,7 +242,7 @@ void PrepareForTransientRestack(WindowMus* window) override; void OnTransientRestackDone(WindowMus* window) override; void NotifyEmbeddedAppDisconnected() override; - bool HasLocalCompositorFrameSink() override; + bool HasLocalLayerTreeFrameSink() override; // WindowPort: void OnPreInit(Window* window) override; @@ -260,7 +260,7 @@ void OnPropertyChanged(const void* key, int64_t old_value, std::unique_ptr<ui::PropertyData> data) override; - std::unique_ptr<cc::CompositorFrameSink> CreateCompositorFrameSink() override; + std::unique_ptr<cc::LayerTreeFrameSink> CreateLayerTreeFrameSink() override; cc::SurfaceId GetSurfaceId() const override; void OnWindowAddedToRootWindow() override {} void OnWillRemoveWindowFromRootWindow() override {} @@ -292,7 +292,7 @@ // When a frame sink is created // for a local aura::Window, we need keep a weak ptr of it, so we can update // the local surface id when necessary. - base::WeakPtr<viz::ClientCompositorFrameSink> local_compositor_frame_sink_; + base::WeakPtr<viz::ClientLayerTreeFrameSink> local_layer_tree_frame_sink_; DISALLOW_COPY_AND_ASSIGN(WindowPortMus); };
diff --git a/ui/aura/mus/window_tree_client.cc b/ui/aura/mus/window_tree_client.cc index e5aa0bd45..ee5791c 100644 --- a/ui/aura/mus/window_tree_client.cc +++ b/ui/aura/mus/window_tree_client.cc
@@ -700,7 +700,7 @@ if (window->window_mus_type() == WindowMusType::TOP_LEVEL_IN_WM || window->window_mus_type() == WindowMusType::EMBED_IN_OWNER || window->window_mus_type() == WindowMusType::DISPLAY_MANUALLY_CREATED || - window->HasLocalCompositorFrameSink()) { + window->HasLocalLayerTreeFrameSink()) { local_surface_id = window->GetOrAllocateLocalSurfaceId(new_bounds.size()); synchronizing_with_child_on_next_frame_ = true; }
diff --git a/ui/aura/test/aura_test_helper.cc b/ui/aura/test/aura_test_helper.cc index 6c3f1a9..7083d8a 100644 --- a/ui/aura/test/aura_test_helper.cc +++ b/ui/aura/test/aura_test_helper.cc
@@ -11,7 +11,7 @@ #include "ui/aura/client/focus_client.h" #include "ui/aura/env.h" #include "ui/aura/input_state_lookup.h" -#include "ui/aura/local/compositor_frame_sink_local.h" +#include "ui/aura/local/layer_tree_frame_sink_local.h" #include "ui/aura/mus/capture_synchronizer.h" #include "ui/aura/mus/focus_synchronizer.h" #include "ui/aura/mus/window_port_mus.h"
diff --git a/ui/aura/window.cc b/ui/aura/window.cc index 5ed1291..d879c24 100644 --- a/ui/aura/window.cc +++ b/ui/aura/window.cc
@@ -19,7 +19,7 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" -#include "cc/output/compositor_frame_sink.h" +#include "cc/output/layer_tree_frame_sink.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/client/capture_client.h" #include "ui/aura/client/cursor_client.h" @@ -30,7 +30,7 @@ #include "ui/aura/client/window_stacking_client.h" #include "ui/aura/env.h" #include "ui/aura/layout_manager.h" -#include "ui/aura/local/compositor_frame_sink_local.h" +#include "ui/aura/local/layer_tree_frame_sink_local.h" #include "ui/aura/window_delegate.h" #include "ui/aura/window_event_dispatcher.h" #include "ui/aura/window_observer.h" @@ -982,8 +982,8 @@ return state_modified; } -std::unique_ptr<cc::CompositorFrameSink> Window::CreateCompositorFrameSink() { - return port_->CreateCompositorFrameSink(); +std::unique_ptr<cc::LayerTreeFrameSink> Window::CreateLayerTreeFrameSink() { + return port_->CreateLayerTreeFrameSink(); } cc::SurfaceId Window::GetSurfaceId() const {
diff --git a/ui/aura/window.h b/ui/aura/window.h index 22794c7..b719842 100644 --- a/ui/aura/window.h +++ b/ui/aura/window.h
@@ -32,7 +32,7 @@ #include "ui/gfx/native_widget_types.h" namespace cc { -class CompositorFrameSink; +class LayerTreeFrameSink; } namespace display { @@ -309,8 +309,8 @@ // Returns true if there was state needing to be cleaned up. bool CleanupGestureState(); - // Create a CompositorFrameSink for the aura::Window. - std::unique_ptr<cc::CompositorFrameSink> CreateCompositorFrameSink(); + // Create a LayerTreeFrameSink for the aura::Window. + std::unique_ptr<cc::LayerTreeFrameSink> CreateLayerTreeFrameSink(); // Get the current cc::SurfaceId. cc::SurfaceId GetSurfaceId() const;
diff --git a/ui/aura/window_port.h b/ui/aura/window_port.h index bd41ffb..f33170a 100644 --- a/ui/aura/window_port.h +++ b/ui/aura/window_port.h
@@ -18,7 +18,7 @@ #include "ui/base/class_property.h" namespace cc { -class CompositorFrameSink; +class LayerTreeFrameSink; } namespace gfx { @@ -80,9 +80,9 @@ int64_t old_value, std::unique_ptr<ui::PropertyData> data) = 0; - // Called for creating a cc::CompositorFrameSink for the window. - virtual std::unique_ptr<cc::CompositorFrameSink> - CreateCompositorFrameSink() = 0; + // Called for creating a cc::LayerTreeFrameSink for the window. + virtual std::unique_ptr<cc::LayerTreeFrameSink> + CreateLayerTreeFrameSink() = 0; // Get the current cc::SurfaceId. virtual cc::SurfaceId GetSurfaceId() const = 0;
diff --git a/ui/aura/window_port_for_shutdown.cc b/ui/aura/window_port_for_shutdown.cc index 3c1cc2e..84c66f7 100644 --- a/ui/aura/window_port_for_shutdown.cc +++ b/ui/aura/window_port_for_shutdown.cc
@@ -5,7 +5,7 @@ #include "ui/aura/window_port_for_shutdown.h" #include "base/memory/ptr_util.h" -#include "cc/output/compositor_frame_sink.h" +#include "cc/output/layer_tree_frame_sink.h" #include "ui/aura/window.h" namespace aura { @@ -51,8 +51,8 @@ int64_t old_value, std::unique_ptr<ui::PropertyData> data) {} -std::unique_ptr<cc::CompositorFrameSink> -WindowPortForShutdown::CreateCompositorFrameSink() { +std::unique_ptr<cc::LayerTreeFrameSink> +WindowPortForShutdown::CreateLayerTreeFrameSink() { return nullptr; }
diff --git a/ui/aura/window_port_for_shutdown.h b/ui/aura/window_port_for_shutdown.h index 56473cd..b355141e 100644 --- a/ui/aura/window_port_for_shutdown.h +++ b/ui/aura/window_port_for_shutdown.h
@@ -35,7 +35,7 @@ void OnPropertyChanged(const void* key, int64_t old_value, std::unique_ptr<ui::PropertyData> data) override; - std::unique_ptr<cc::CompositorFrameSink> CreateCompositorFrameSink() override; + std::unique_ptr<cc::LayerTreeFrameSink> CreateLayerTreeFrameSink() override; cc::SurfaceId GetSurfaceId() const override; void OnWindowAddedToRootWindow() override; void OnWillRemoveWindowFromRootWindow() override;
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc index d8a0150..4303f63 100644 --- a/ui/compositor/compositor.cc +++ b/ui/compositor/compositor.cc
@@ -236,10 +236,10 @@ host_->SetLocalSurfaceId(local_surface_id); } -void Compositor::SetCompositorFrameSink( - std::unique_ptr<cc::CompositorFrameSink> compositor_frame_sink) { - compositor_frame_sink_requested_ = false; - host_->SetCompositorFrameSink(std::move(compositor_frame_sink)); +void Compositor::SetLayerTreeFrameSink( + std::unique_ptr<cc::LayerTreeFrameSink> layer_tree_frame_sink) { + layer_tree_frame_sink_requested_ = false; + host_->SetLayerTreeFrameSink(std::move(layer_tree_frame_sink)); // Display properties are reset when the output surface is lost, so update it // to match the Compositor's. if (context_factory_private_) { @@ -392,13 +392,13 @@ DCHECK(!widget_valid_); widget_ = widget; widget_valid_ = true; - if (compositor_frame_sink_requested_) - context_factory_->CreateCompositorFrameSink(weak_ptr_factory_.GetWeakPtr()); + if (layer_tree_frame_sink_requested_) + context_factory_->CreateLayerTreeFrameSink(weak_ptr_factory_.GetWeakPtr()); } gfx::AcceleratedWidget Compositor::ReleaseAcceleratedWidget() { DCHECK(!IsVisible()); - host_->ReleaseCompositorFrameSink(); + host_->ReleaseLayerTreeFrameSink(); context_factory_->RemoveCompositor(this); widget_valid_ = false; gfx::AcceleratedWidget widget = widget_; @@ -467,15 +467,15 @@ SendDamagedRectsRecursive(root_layer()); } -void Compositor::RequestNewCompositorFrameSink() { - DCHECK(!compositor_frame_sink_requested_); - compositor_frame_sink_requested_ = true; +void Compositor::RequestNewLayerTreeFrameSink() { + DCHECK(!layer_tree_frame_sink_requested_); + layer_tree_frame_sink_requested_ = true; if (widget_valid_) - context_factory_->CreateCompositorFrameSink(weak_ptr_factory_.GetWeakPtr()); + context_factory_->CreateLayerTreeFrameSink(weak_ptr_factory_.GetWeakPtr()); } -void Compositor::DidFailToInitializeCompositorFrameSink() { - // The CompositorFrameSink should already be bound/initialized before being +void Compositor::DidFailToInitializeLayerTreeFrameSink() { + // The LayerTreeFrameSink should already be bound/initialized before being // given to // the Compositor. NOTREACHED();
diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h index 25c3e0c..9c72fc4 100644 --- a/ui/compositor/compositor.h +++ b/ui/compositor/compositor.h
@@ -43,6 +43,7 @@ class ContextProvider; class Layer; class LayerTreeDebugState; +class LayerTreeFrameSink; class LayerTreeHost; class LocalSurfaceId; class ResourceSettings; @@ -112,7 +113,7 @@ // Inform the display corresponding to this compositor if it is visible. When // false it does not need to produce any frames. Visibility is reset for each - // call to CreateCompositorFrameSink. + // call to CreateLayerTreeFrameSink. virtual void SetDisplayVisible(ui::Compositor* compositor, bool visible) = 0; // Resize the display corresponding to this compositor to a particular size. @@ -128,7 +129,7 @@ virtual void SetAuthoritativeVSyncInterval(ui::Compositor* compositor, base::TimeDelta interval) = 0; // Mac path for transporting vsync parameters to the display. Other platforms - // update it via the BrowserCompositorCompositorFrameSink directly. + // update it via the BrowserCompositorLayerTreeFrameSink directly. virtual void SetDisplayVSyncParameters(ui::Compositor* compositor, base::TimeTicks timebase, base::TimeDelta interval) = 0; @@ -145,7 +146,7 @@ // Creates an output surface for the given compositor. The factory may keep // per-compositor data (e.g. a shared context), that needs to be cleaned up // by calling RemoveCompositor when the compositor gets destroyed. - virtual void CreateCompositorFrameSink( + virtual void CreateLayerTreeFrameSink( base::WeakPtr<Compositor> compositor) = 0; // Return a reference to a shared offscreen context provider usable from the @@ -201,7 +202,7 @@ void SetLocalSurfaceId(const cc::LocalSurfaceId& local_surface_id); - void SetCompositorFrameSink(std::unique_ptr<cc::CompositorFrameSink> surface); + void SetLayerTreeFrameSink(std::unique_ptr<cc::LayerTreeFrameSink> surface); // Schedules a redraw of the layer tree associated with this compositor. void ScheduleDraw(); @@ -274,9 +275,8 @@ void SetAuthoritativeVSyncInterval(const base::TimeDelta& interval); // Most platforms set their vsync info via - // BrowerCompositorCompositorFrameSink's - // OnUpdateVSyncParametersFromGpu, but Mac routes vsync info via the - // browser compositor instead through this path. + // BrowerCompositorLayerTreeFrameSink::OnUpdateVSyncParametersFromGpu(), but + // Mac routes vsync info via the browser compositor instead through this path. void SetDisplayVSyncParameters(base::TimeTicks timebase, base::TimeDelta interval); @@ -341,9 +341,9 @@ float top_controls_delta) override {} void RecordWheelAndTouchScrollingCount(bool has_scrolled_by_wheel, bool has_scrolled_by_touch) override {} - void RequestNewCompositorFrameSink() override; - void DidInitializeCompositorFrameSink() override {} - void DidFailToInitializeCompositorFrameSink() override; + void RequestNewLayerTreeFrameSink() override; + void DidInitializeLayerTreeFrameSink() override {} + void DidFailToInitializeLayerTreeFrameSink() override; void WillCommit() override {} void DidCommit() override; void DidCommitAndDrawFrame() override {} @@ -354,7 +354,7 @@ // cc::LayerTreeHostSingleThreadClient implementation. void DidSubmitCompositorFrame() override; - void DidLoseCompositorFrameSink() override {} + void DidLoseLayerTreeFrameSink() override {} bool IsLocked() { return !active_locks_.empty(); } @@ -405,7 +405,7 @@ // A map from child id to parent id. std::unordered_set<cc::FrameSinkId, cc::FrameSinkIdHash> child_frame_sinks_; bool widget_valid_ = false; - bool compositor_frame_sink_requested_ = false; + bool layer_tree_frame_sink_requested_ = false; const cc::FrameSinkId frame_sink_id_; scoped_refptr<cc::Layer> root_web_layer_; std::unique_ptr<cc::AnimationHost> animation_host_;
diff --git a/ui/compositor/test/fake_context_factory.cc b/ui/compositor/test/fake_context_factory.cc index 906c1ee..1b396bd 100644 --- a/ui/compositor/test/fake_context_factory.cc +++ b/ui/compositor/test/fake_context_factory.cc
@@ -8,10 +8,10 @@ #include "base/threading/thread_task_runner_handle.h" #include "cc/base/switches.h" #include "cc/output/compositor_frame.h" -#include "cc/output/compositor_frame_sink_client.h" +#include "cc/output/layer_tree_frame_sink_client.h" #include "cc/scheduler/begin_frame_source.h" #include "cc/scheduler/delay_based_time_source.h" -#include "cc/test/fake_compositor_frame_sink.h" +#include "cc/test/fake_layer_tree_frame_sink.h" #include "ui/compositor/compositor_switches.h" #include "ui/display/display_switches.h" #include "ui/gfx/switches.h" @@ -45,11 +45,11 @@ return *frame_sink_->last_sent_frame(); } -void FakeContextFactory::CreateCompositorFrameSink( +void FakeContextFactory::CreateLayerTreeFrameSink( base::WeakPtr<ui::Compositor> compositor) { - auto frame_sink = cc::FakeCompositorFrameSink::Create3d(); + auto frame_sink = cc::FakeLayerTreeFrameSink::Create3d(); frame_sink_ = frame_sink.get(); - compositor->SetCompositorFrameSink(std::move(frame_sink)); + compositor->SetLayerTreeFrameSink(std::move(frame_sink)); } scoped_refptr<cc::ContextProvider>
diff --git a/ui/compositor/test/fake_context_factory.h b/ui/compositor/test/fake_context_factory.h index 9be39d8..aadc8d6 100644 --- a/ui/compositor/test/fake_context_factory.h +++ b/ui/compositor/test/fake_context_factory.h
@@ -13,7 +13,7 @@ namespace cc { class CompositorFrame; class ContextProvider; -class FakeCompositorFrameSink; +class FakeLayerTreeFrameSink; class ResourceSettings; class TestTaskGraphRunner; class TestGpuMemoryBufferManager; @@ -29,7 +29,7 @@ const cc::CompositorFrame& GetLastCompositorFrame() const; // ui::ContextFactory: - void CreateCompositorFrameSink( + void CreateLayerTreeFrameSink( base::WeakPtr<ui::Compositor> compositor) override; scoped_refptr<cc::ContextProvider> SharedMainThreadContextProvider() override; void RemoveCompositor(ui::Compositor* compositor) override; @@ -41,7 +41,7 @@ void RemoveObserver(ui::ContextFactoryObserver* observer) override {} private: - cc::FakeCompositorFrameSink* frame_sink_ = nullptr; + cc::FakeLayerTreeFrameSink* frame_sink_ = nullptr; cc::TestTaskGraphRunner task_graph_runner_; cc::TestGpuMemoryBufferManager gpu_memory_buffer_manager_; cc::RendererSettings renderer_settings_;
diff --git a/ui/compositor/test/in_process_context_factory.cc b/ui/compositor/test/in_process_context_factory.cc index ec253793..3d83f10 100644 --- a/ui/compositor/test/in_process_context_factory.cc +++ b/ui/compositor/test/in_process_context_factory.cc
@@ -18,7 +18,7 @@ #include "cc/output/texture_mailbox_deleter.h" #include "cc/scheduler/begin_frame_source.h" #include "cc/scheduler/delay_based_time_source.h" -#include "cc/surfaces/direct_compositor_frame_sink.h" +#include "cc/surfaces/direct_layer_tree_frame_sink.h" #include "cc/surfaces/display.h" #include "cc/surfaces/display_scheduler.h" #include "cc/surfaces/local_surface_id_allocator.h" @@ -179,7 +179,7 @@ refresh_rate_ = 200.0; } -void InProcessContextFactory::CreateCompositorFrameSink( +void InProcessContextFactory::CreateLayerTreeFrameSink( base::WeakPtr<Compositor> compositor) { // Try to reuse existing shared worker context provider. bool shared_worker_context_provider_lost = false; @@ -251,11 +251,11 @@ data->begin_frame_source = std::move(begin_frame_source); auto* display = per_compositor_data_[compositor.get()]->display.get(); - auto compositor_frame_sink = base::MakeUnique<cc::DirectCompositorFrameSink>( + auto layer_tree_frame_sink = base::MakeUnique<cc::DirectLayerTreeFrameSink>( compositor->frame_sink_id(), GetSurfaceManager(), display, context_provider, shared_worker_context_provider_, &gpu_memory_buffer_manager_, &shared_bitmap_manager_); - compositor->SetCompositorFrameSink(std::move(compositor_frame_sink)); + compositor->SetLayerTreeFrameSink(std::move(layer_tree_frame_sink)); data->display->Resize(compositor->size()); }
diff --git a/ui/compositor/test/in_process_context_factory.h b/ui/compositor/test/in_process_context_factory.h index 3fbdbf5a..12f64ac 100644 --- a/ui/compositor/test/in_process_context_factory.h +++ b/ui/compositor/test/in_process_context_factory.h
@@ -36,7 +36,7 @@ // Both |frame_sink_manager_host| and |surface_manager| must outlive the // ContextFactory. // TODO(crbug.com/657959): |surface_manager| should go away and we should use - // the CompositorFrameSink from the FrameSinkManagerHost. + // the LayerTreeFrameSink from the FrameSinkManagerHost. InProcessContextFactory(viz::FrameSinkManagerHost* frame_sink_manager_host, cc::SurfaceManager* surface_manager); ~InProcessContextFactory() override; @@ -55,8 +55,8 @@ // used for tests. void SetUseFastRefreshRateForTests(); - // ContextFactory implementation - void CreateCompositorFrameSink(base::WeakPtr<Compositor> compositor) override; + // ContextFactory implementation. + void CreateLayerTreeFrameSink(base::WeakPtr<Compositor> compositor) override; std::unique_ptr<Reflector> CreateReflector(Compositor* mirrored_compositor, Layer* mirroring_layer) override;
diff --git a/ui/login/account_picker/md_user_pod_row.js b/ui/login/account_picker/md_user_pod_row.js index 9be1edd..fcca34c2 100644 --- a/ui/login/account_picker/md_user_pod_row.js +++ b/ui/login/account_picker/md_user_pod_row.js
@@ -76,7 +76,7 @@ /** * Supported authentication types. Keep in sync with the enum in - * chrome/browser/signin/screenlock_bridge.h + * components/proximity_auth/public/interfaces/auth_type.mojom * @enum {number} * @const */ @@ -128,7 +128,7 @@ ]; // Supported multi-profile user behavior values. - // Keep in sync with the enum in multi_profile_user_controller.h + // Keep in sync with the enum in login_user_info.mojom var MULTI_PROFILE_USER_BEHAVIOR = { UNRESTRICTED: 0, PRIMARY_ONLY: 1,
diff --git a/ui/login/account_picker/user_pod_row.js b/ui/login/account_picker/user_pod_row.js index 7969075..65d49d3 100644 --- a/ui/login/account_picker/user_pod_row.js +++ b/ui/login/account_picker/user_pod_row.js
@@ -99,7 +99,7 @@ /** * Supported authentication types. Keep in sync with the enum in - * chrome/browser/signin/screenlock_bridge.h + * components/proximity_auth/public/interfaces/auth_type.mojom * @enum {number} * @const */ @@ -151,7 +151,7 @@ ]; // Supported multi-profile user behavior values. - // Keep in sync with the enum in multi_profile_user_controller.h + // Keep in sync with the enum in login_user_info.mojom var MULTI_PROFILE_USER_BEHAVIOR = { UNRESTRICTED: 0, PRIMARY_ONLY: 1,
diff --git a/ui/views/controls/button/checkbox.cc b/ui/views/controls/button/checkbox.cc index ddf64ece..1438fc4 100644 --- a/ui/views/controls/button/checkbox.cc +++ b/ui/views/controls/button/checkbox.cc
@@ -14,7 +14,7 @@ #include "ui/gfx/canvas.h" #include "ui/gfx/color_utils.h" #include "ui/gfx/paint_vector_icon.h" -#include "ui/views/animation/ink_drop_impl.h" +#include "ui/views/animation/ink_drop_highlight.h" #include "ui/views/animation/ink_drop_ripple.h" #include "ui/views/animation/square_ink_drop_ripple.h" #include "ui/views/controls/button/label_button_border.h" @@ -143,10 +143,8 @@ } std::unique_ptr<InkDrop> Checkbox::CreateInkDrop() { - // Completely removes the highlight. - std::unique_ptr<InkDropImpl> ink_drop = CreateDefaultInkDropImpl(); + std::unique_ptr<InkDrop> ink_drop = LabelButton::CreateInkDrop(); ink_drop->SetShowHighlightOnHover(false); - ink_drop->SetAutoHighlightMode(views::InkDropImpl::AutoHighlightMode::NONE); return ink_drop; }
diff --git a/ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.js b/ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.js index 854a812d..17b91df4 100644 --- a/ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.js +++ b/ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.js
@@ -98,12 +98,6 @@ extends: 'dialog', /** - * List of all options in this action menu. - * @private {?NodeList<!Element>} - */ - options_: null, - - /** * The element which the action menu will be anchored to. Also the element * where focus will be returned after the menu is closed. Only populated if * menu is opened with showAt(). @@ -132,11 +126,6 @@ }, /** override */ - attached: function() { - this.options_ = this.querySelectorAll('.dropdown-item'); - }, - - /** override */ detached: function() { this.removeListeners_(); }, @@ -219,9 +208,10 @@ // hidden/disabled. var counter = 0; var nextOption = null; - var numOptions = this.options_.length; + var options = this.querySelectorAll('.dropdown-item'); + var numOptions = options.length; var focusedIndex = - Array.prototype.indexOf.call(this.options_, this.root.activeElement); + Array.prototype.indexOf.call(options, this.root.activeElement); // Handle case where nothing is focused and up is pressed. if (focusedIndex === -1 && step === -1) @@ -229,7 +219,7 @@ do { focusedIndex = (numOptions + focusedIndex + step) % numOptions; - nextOption = this.options_[focusedIndex]; + nextOption = options[focusedIndex]; if (nextOption.disabled || nextOption.hidden) nextOption = null; counter++;