Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: cc/surfaces/direct_compositor_frame_sink.cc

Issue 2369793002: WIP: Propagate SurfaceID up window tree hierarchy
Patch Set: Fix input events: EventDispatcher ignores container windows Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/surfaces/BUILD.gn ('k') | cc/surfaces/display.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/surfaces/direct_compositor_frame_sink.h" 5 #include "cc/surfaces/direct_compositor_frame_sink.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "cc/output/compositor_frame.h" 8 #include "cc/output/compositor_frame.h"
9 #include "cc/output/compositor_frame_sink_client.h" 9 #include "cc/output/compositor_frame_sink_client.h"
10 #include "cc/surfaces/display.h" 10 #include "cc/surfaces/display.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 DCHECK(thread_checker_.CalledOnValidThread()); 52 DCHECK(thread_checker_.CalledOnValidThread());
53 if (HasClient()) 53 if (HasClient())
54 DetachFromClient(); 54 DetachFromClient();
55 } 55 }
56 56
57 bool DirectCompositorFrameSink::BindToClient( 57 bool DirectCompositorFrameSink::BindToClient(
58 CompositorFrameSinkClient* client) { 58 CompositorFrameSinkClient* client) {
59 DCHECK(thread_checker_.CalledOnValidThread()); 59 DCHECK(thread_checker_.CalledOnValidThread());
60 60
61 surface_manager_->RegisterSurfaceFactoryClient( 61 surface_manager_->RegisterSurfaceFactoryClient(
62 surface_id_allocator_->client_id(), this); 62 surface_id_allocator_->frame_sink_id(), this);
63 63
64 if (!CompositorFrameSink::BindToClient(client)) 64 if (!CompositorFrameSink::BindToClient(client))
65 return false; 65 return false;
66 66
67 // We want the Display's output surface to hear about lost context, and since 67 // We want the Display's output surface to hear about lost context, and since
68 // this shares a context with it, we should not be listening for lost context 68 // this shares a context with it, we should not be listening for lost context
69 // callbacks on the context here. 69 // callbacks on the context here.
70 if (context_provider()) 70 if (context_provider())
71 context_provider()->SetLostContextCallback(base::Closure()); 71 context_provider()->SetLostContextCallback(base::Closure());
72 72
73 // Avoid initializing GL context here, as this should be sharing the 73 // Avoid initializing GL context here, as this should be sharing the
74 // Display's context. 74 // Display's context.
75 display_->Initialize(this, surface_manager_, 75 display_->Initialize(this, surface_manager_,
76 surface_id_allocator_->client_id()); 76 surface_id_allocator_->frame_sink_id());
77 return true; 77 return true;
78 } 78 }
79 79
80 void DirectCompositorFrameSink::DetachFromClient() { 80 void DirectCompositorFrameSink::DetachFromClient() {
81 DCHECK(HasClient()); 81 DCHECK(HasClient());
82 // Unregister the SurfaceFactoryClient here instead of the dtor so that only 82 // Unregister the SurfaceFactoryClient here instead of the dtor so that only
83 // one client is alive for this namespace at any given time. 83 // one client is alive for this namespace at any given time.
84 surface_manager_->UnregisterSurfaceFactoryClient( 84 surface_manager_->UnregisterSurfaceFactoryClient(
85 surface_id_allocator_->client_id()); 85 surface_id_allocator_->frame_sink_id());
86 if (!delegated_surface_id_.is_null()) 86 if (!delegated_surface_id_.is_null())
87 factory_.Destroy(delegated_surface_id_); 87 factory_.Destroy(delegated_surface_id_);
88 88
89 CompositorFrameSink::DetachFromClient(); 89 CompositorFrameSink::DetachFromClient();
90 } 90 }
91 91
92 void DirectCompositorFrameSink::SwapBuffers(CompositorFrame frame) { 92 void DirectCompositorFrameSink::SwapBuffers(CompositorFrame frame) {
93 gfx::Size frame_size = 93 gfx::Size frame_size =
94 frame.delegated_frame_data->render_pass_list.back()->output_rect.size(); 94 frame.delegated_frame_data->render_pass_list.back()->output_rect.size();
95 if (frame_size.IsEmpty() || frame_size != last_swap_frame_size_) { 95 if (frame_size.IsEmpty() || frame_size != last_swap_frame_size_) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // be drawn. 145 // be drawn.
146 } 146 }
147 147
148 void DirectCompositorFrameSink::DidDrawCallback() { 148 void DirectCompositorFrameSink::DidDrawCallback() {
149 // TODO(danakj): Why the lost check? 149 // TODO(danakj): Why the lost check?
150 if (!is_lost_) 150 if (!is_lost_)
151 client_->DidSwapBuffersComplete(); 151 client_->DidSwapBuffersComplete();
152 } 152 }
153 153
154 } // namespace cc 154 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/BUILD.gn ('k') | cc/surfaces/display.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698