diff options
author | dcastagna <dcastagna@chromium.org> | 2016-03-22 14:30:50 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-22 21:31:53 +0000 |
commit | 1e6a2bc451904125ced0e829f030056b8e2bd8e2 (patch) | |
tree | ee7cfa1dea4d7b6142474568f637828382b9e892 | |
parent | 1a87fbf87fc1ac4aaef80094be817c6b3a87dc1b (diff) | |
download | chromium_src-1e6a2bc451904125ced0e829f030056b8e2bd8e2.zip chromium_src-1e6a2bc451904125ced0e829f030056b8e2bd8e2.tar.gz chromium_src-1e6a2bc451904125ced0e829f030056b8e2bd8e2.tar.bz2 |
Update secure output flags on display changes.
This patch adds a WindowTreeHostManager::Observer to exo that
sets the appropriate output secure flag to the compositors
when the display configuration changes.
The first iteration for the logic that determines if the output
is secure is simply a check if the connected display is internal and
mirroring is disabled on all the devices.
Additionally this patch moves the 'is_secure_' flag from the OutputSurface
to LayerTreeImpl, since the lifetime of the latter better matches the
display configuration changes.
BUG=b/27173841,b/27174223
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
Review URL: https://codereview.chromium.org/1821553002
Cr-Commit-Position: refs/heads/master@{#382683}
-rw-r--r-- | ash/display/window_tree_host_manager.cc | 10 | ||||
-rw-r--r-- | cc/layers/texture_layer_impl.cc | 3 | ||||
-rw-r--r-- | cc/layers/texture_layer_impl_unittest.cc | 6 | ||||
-rw-r--r-- | cc/output/output_surface.h | 5 | ||||
-rw-r--r-- | cc/test/fake_proxy.h | 1 | ||||
-rw-r--r-- | cc/test/layer_test_common.h | 4 | ||||
-rw-r--r-- | cc/trees/layer_tree_host.cc | 4 | ||||
-rw-r--r-- | cc/trees/layer_tree_host.h | 2 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_impl.cc | 1 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_impl.h | 8 | ||||
-rw-r--r-- | cc/trees/layer_tree_impl.cc | 4 | ||||
-rw-r--r-- | cc/trees/layer_tree_impl.h | 2 | ||||
-rw-r--r-- | cc/trees/proxy.h | 2 | ||||
-rw-r--r-- | cc/trees/proxy_main.cc | 4 | ||||
-rw-r--r-- | cc/trees/proxy_main.h | 1 | ||||
-rw-r--r-- | cc/trees/remote_channel_impl.cc | 4 | ||||
-rw-r--r-- | cc/trees/remote_channel_impl.h | 1 | ||||
-rw-r--r-- | cc/trees/single_thread_proxy.cc | 4 | ||||
-rw-r--r-- | cc/trees/single_thread_proxy.h | 1 | ||||
-rw-r--r-- | ui/compositor/compositor.cc | 5 | ||||
-rw-r--r-- | ui/compositor/compositor.h | 2 |
21 files changed, 62 insertions, 12 deletions
diff --git a/ash/display/window_tree_host_manager.cc b/ash/display/window_tree_host_manager.cc index 4b59621..13e143b 100644 --- a/ash/display/window_tree_host_manager.cc +++ b/ash/display/window_tree_host_manager.cc @@ -775,6 +775,16 @@ void WindowTreeHostManager::PostDisplayConfigurationChange() { : layout.primary_id); } } + + for (const gfx::Display& display : display_manager->active_display_list()) { + bool output_is_secure = + !display_manager->IsInMirrorMode() && display.IsInternal(); + GetAshWindowTreeHostForDisplayId(display.id()) + ->AsWindowTreeHost() + ->compositor() + ->SetOutputIsSecure(output_is_secure); + } + FOR_EACH_OBSERVER(Observer, observers_, OnDisplayConfigurationChanged()); UpdateMouseLocationAfterDisplayChange(); } diff --git a/cc/layers/texture_layer_impl.cc b/cc/layers/texture_layer_impl.cc index c1a688e..12efed0 100644 --- a/cc/layers/texture_layer_impl.cc +++ b/cc/layers/texture_layer_impl.cc @@ -166,8 +166,7 @@ void TextureLayerImpl::AppendQuads(RenderPass* render_pass, return; if (!texture_mailbox_.secure_output_only() || - (layer_tree_impl()->output_surface()->is_secure() && - !AnchestorHasCopyRequest())) { + (layer_tree_impl()->OutputIsSecure() && !AnchestorHasCopyRequest())) { TextureDrawQuad* quad = render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); ResourceId id = diff --git a/cc/layers/texture_layer_impl_unittest.cc b/cc/layers/texture_layer_impl_unittest.cc index 5b3bac8..997a5c0 100644 --- a/cc/layers/texture_layer_impl_unittest.cc +++ b/cc/layers/texture_layer_impl_unittest.cc @@ -103,7 +103,7 @@ TEST(TextureLayerImplTest, Occlusion) { } } -TEST(TextureLayerImplTest, Protected) { +TEST(TextureLayerImplTest, OutputIsSecure) { gfx::Size layer_size(1000, 1000); gfx::Size viewport_size(1000, 1000); @@ -138,7 +138,7 @@ TEST(TextureLayerImplTest, Protected) { } { - impl.SetSecureOutputSurface(true); + impl.SetOutputIsSecure(true); gfx::Rect occluded; impl.AppendQuadsWithOcclusion(texture_layer_impl, occluded); @@ -148,7 +148,7 @@ TEST(TextureLayerImplTest, Protected) { } { - impl.SetSecureOutputSurface(false); + impl.SetOutputIsSecure(false); impl.RequestCopyOfOutput(); gfx::Rect occluded; impl.AppendQuadsWithOcclusion(texture_layer_impl, occluded); diff --git a/cc/output/output_surface.h b/cc/output/output_surface.h index 64cb19e..43cacfe 100644 --- a/cc/output/output_surface.h +++ b/cc/output/output_surface.h @@ -167,10 +167,6 @@ class CC_EXPORT OutputSurface : public base::trace_event::MemoryDumpProvider { bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, base::trace_event::ProcessMemoryDump* pmd) override; - // Is this output surface associated with a secure display. - bool is_secure() const { return is_secure_; } - void set_is_secure(bool is_secure) { is_secure_ = is_secure; } - protected: OutputSurfaceClient* client_; @@ -196,7 +192,6 @@ class CC_EXPORT OutputSurface : public base::trace_event::MemoryDumpProvider { private: bool external_stencil_test_enabled_; - bool is_secure_ = false; base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(OutputSurface); diff --git a/cc/test/fake_proxy.h b/cc/test/fake_proxy.h index 040c12b..cbb3ead 100644 --- a/cc/test/fake_proxy.h +++ b/cc/test/fake_proxy.h @@ -45,6 +45,7 @@ class FakeProxy : public Proxy { void UpdateTopControlsState(TopControlsState constraints, TopControlsState current, bool animate) override {} + void SetOutputIsSecure(bool output_is_secure) override {} virtual RendererCapabilities& GetRendererCapabilities(); diff --git a/cc/test/layer_test_common.h b/cc/test/layer_test_common.h index 39d2168..af93e73 100644 --- a/cc/test/layer_test_common.h +++ b/cc/test/layer_test_common.h @@ -139,8 +139,8 @@ class LayerTestCommon { void RequestCopyOfOutput(); - void SetSecureOutputSurface(bool secure_output) { - host_->host_impl()->output_surface()->set_is_secure(secure_output); + void SetOutputIsSecure(bool output_is_secure) { + host_->host_impl()->set_output_is_secure(output_is_secure); } OutputSurface* output_surface() const { diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc index ced57c2..16197c3 100644 --- a/cc/trees/layer_tree_host.cc +++ b/cc/trees/layer_tree_host.cc @@ -613,6 +613,10 @@ void LayerTreeHost::SetNeedsDisplayOnAllLayers() { } } +void LayerTreeHost::SetOutputIsSecure(bool output_is_secure) { + proxy_->SetOutputIsSecure(output_is_secure); +} + const RendererCapabilities& LayerTreeHost::GetRendererCapabilities() const { return proxy_->GetRendererCapabilities(); } diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h index ffb597b..8af3dcb 100644 --- a/cc/trees/layer_tree_host.h +++ b/cc/trees/layer_tree_host.h @@ -182,6 +182,8 @@ class CC_EXPORT LayerTreeHost : public MutatorHostClient { void SetNeedsDisplayOnAllLayers(); + void SetOutputIsSecure(bool output_is_secure); + void CollectRenderingStats(RenderingStats* stats) const; RenderingStatsInstrumentation* rendering_stats_instrumentation() const { diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 7e7adfe..efc8eb0 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc @@ -226,6 +226,7 @@ LayerTreeHostImpl::LayerTreeHostImpl( texture_mailbox_deleter_(new TextureMailboxDeleter(GetTaskRunner())), max_memory_needed_bytes_(0), resourceless_software_draw_(false), + output_is_secure_(false), animation_host_(), rendering_stats_instrumentation_(rendering_stats_instrumentation), micro_benchmark_controller_(this), diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h index f9ad198..a7d6b08 100644 --- a/cc/trees/layer_tree_host_impl.h +++ b/cc/trees/layer_tree_host_impl.h @@ -580,6 +580,12 @@ class CC_EXPORT LayerTreeHostImpl bool is_direct_manipulation, ScrollTree* scroll_tree); + void set_output_is_secure(bool output_is_secure) { + output_is_secure_ = output_is_secure; + } + + bool output_is_secure() const { return output_is_secure_; } + // Record main frame timing information. // |start_of_main_frame_args| is the BeginFrameArgs of the beginning of the // main frame (ie the frame that kicked off the main frame). @@ -809,6 +815,8 @@ class CC_EXPORT LayerTreeHostImpl gfx::Rect viewport_rect_for_tile_priority_; bool resourceless_software_draw_; + bool output_is_secure_; + gfx::Rect viewport_damage_rect_; scoped_ptr<AnimationHost> animation_host_; diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc index 35406d4..e89c84d 100644 --- a/cc/trees/layer_tree_impl.cc +++ b/cc/trees/layer_tree_impl.cc @@ -1391,6 +1391,10 @@ bool LayerTreeImpl::IsUIResourceOpaque(UIResourceId uid) const { return layer_tree_host_impl_->IsUIResourceOpaque(uid); } +bool LayerTreeImpl::OutputIsSecure() const { + return layer_tree_host_impl_->output_is_secure(); +} + void LayerTreeImpl::ProcessUIResourceRequestQueue() { for (const auto& req : ui_resource_request_queue_) { switch (req.GetType()) { diff --git a/cc/trees/layer_tree_impl.h b/cc/trees/layer_tree_impl.h index ce68146..a137011 100644 --- a/cc/trees/layer_tree_impl.h +++ b/cc/trees/layer_tree_impl.h @@ -367,6 +367,8 @@ class CC_EXPORT LayerTreeImpl { bool IsUIResourceOpaque(UIResourceId uid) const; + bool OutputIsSecure() const; + void RegisterPictureLayerImpl(PictureLayerImpl* layer); void UnregisterPictureLayerImpl(PictureLayerImpl* layer); const std::vector<PictureLayerImpl*>& picture_layers() const { diff --git a/cc/trees/proxy.h b/cc/trees/proxy.h index cb7152d..27144aa 100644 --- a/cc/trees/proxy.h +++ b/cc/trees/proxy.h @@ -83,6 +83,8 @@ class CC_EXPORT Proxy { TopControlsState current, bool animate) = 0; + virtual void SetOutputIsSecure(bool output_is_secure) = 0; + // Testing hooks virtual bool MainFrameWillHappenForTesting() = 0; }; diff --git a/cc/trees/proxy_main.cc b/cc/trees/proxy_main.cc index 63bac73..c5821f3 100644 --- a/cc/trees/proxy_main.cc +++ b/cc/trees/proxy_main.cc @@ -449,6 +449,10 @@ void ProxyMain::UpdateTopControlsState(TopControlsState constraints, channel_main_->UpdateTopControlsStateOnImpl(constraints, current, animate); } +void ProxyMain::SetOutputIsSecure(bool output_is_secure) { + NOTREACHED() << "Only used by SingleProxyMain"; +} + bool ProxyMain::SendCommitRequestToImplThreadIfNeeded( CommitPipelineStage required_stage) { DCHECK(IsMainThread()); diff --git a/cc/trees/proxy_main.h b/cc/trees/proxy_main.h index 560d26b..1b627dd 100644 --- a/cc/trees/proxy_main.h +++ b/cc/trees/proxy_main.h @@ -113,6 +113,7 @@ class CC_EXPORT ProxyMain : public Proxy { void UpdateTopControlsState(TopControlsState constraints, TopControlsState current, bool animate) override; + void SetOutputIsSecure(bool output_is_secure) override; // This sets the channel used by ProxyMain to communicate with ProxyImpl. void SetChannel(scoped_ptr<ChannelMain> channel_main); diff --git a/cc/trees/remote_channel_impl.cc b/cc/trees/remote_channel_impl.cc index 4708c1e..5d98369 100644 --- a/cc/trees/remote_channel_impl.cc +++ b/cc/trees/remote_channel_impl.cc @@ -306,6 +306,10 @@ void RemoteChannelImpl::UpdateTopControlsState(TopControlsState constraints, NOTREACHED() << "Should not be called on the remote client LayerTreeHost"; } +void RemoteChannelImpl::SetOutputIsSecure(bool output_is_secure) { + NOTREACHED() << "Only used by SingleProxyMain"; +} + bool RemoteChannelImpl::MainFrameWillHappenForTesting() { DCHECK(task_runner_provider_->IsMainThread()); bool main_frame_will_happen; diff --git a/cc/trees/remote_channel_impl.h b/cc/trees/remote_channel_impl.h index 79e19ec..8989776 100644 --- a/cc/trees/remote_channel_impl.h +++ b/cc/trees/remote_channel_impl.h @@ -162,6 +162,7 @@ class CC_EXPORT RemoteChannelImpl : public ChannelImpl, void UpdateTopControlsState(TopControlsState constraints, TopControlsState current, bool animate) override; + void SetOutputIsSecure(bool output_is_secure) override; bool MainFrameWillHappenForTesting() override; // Called on impl thread. diff --git a/cc/trees/single_thread_proxy.cc b/cc/trees/single_thread_proxy.cc index 7c1d821..fa193bf 100644 --- a/cc/trees/single_thread_proxy.cc +++ b/cc/trees/single_thread_proxy.cc @@ -886,6 +886,10 @@ void SingleThreadProxy::UpdateTopControlsState(TopControlsState constraints, NOTREACHED() << "Top Controls are used only in threaded mode"; } +void SingleThreadProxy::SetOutputIsSecure(bool output_is_secure) { + layer_tree_host_impl_->set_output_is_secure(output_is_secure); +} + void SingleThreadProxy::DidFinishImplFrame() { layer_tree_host_impl_->DidFinishImplFrame(); #if DCHECK_IS_ON() diff --git a/cc/trees/single_thread_proxy.h b/cc/trees/single_thread_proxy.h index 66e0075..b5477f2 100644 --- a/cc/trees/single_thread_proxy.h +++ b/cc/trees/single_thread_proxy.h @@ -61,6 +61,7 @@ class CC_EXPORT SingleThreadProxy : public Proxy, void UpdateTopControlsState(TopControlsState constraints, TopControlsState current, bool animate) override; + void SetOutputIsSecure(bool output_is_secure) override; // SchedulerClient implementation void WillBeginImplFrame(const BeginFrameArgs& args) override; diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc index a942a89..9c49269 100644 --- a/ui/compositor/compositor.cc +++ b/ui/compositor/compositor.cc @@ -468,6 +468,11 @@ void Compositor::DidAbortSwapBuffers() { OnCompositingAborted(this)); } +void Compositor::SetOutputIsSecure(bool output_is_secure) { + host_->SetOutputIsSecure(output_is_secure); + host_->SetNeedsRedraw(); +} + void Compositor::SendBeginFramesToChildren(const cc::BeginFrameArgs& args) { FOR_EACH_OBSERVER(CompositorBeginFrameObserver, begin_frame_observer_list_, OnSendBeginFrame(args)); diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h index 5222b41..acae0be 100644 --- a/ui/compositor/compositor.h +++ b/ui/compositor/compositor.h @@ -318,6 +318,8 @@ class COMPOSITOR_EXPORT Compositor bool IsLocked() { return compositor_lock_ != NULL; } + void SetOutputIsSecure(bool output_is_secure); + const cc::LayerTreeDebugState& GetLayerTreeDebugState() const; void SetLayerTreeDebugState(const cc::LayerTreeDebugState& debug_state); const cc::RendererSettings& GetRendererSettings() const; |