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

Side by Side Diff: content/browser/android/in_process/synchronous_compositor_impl.cc

Issue 240163005: Deliver IPC messages together with SwapCompositorFrame (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: don't use unknown to break the promise on deletion Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/browser/android/in_process/synchronous_compositor_impl.h" 5 #include "content/browser/android/in_process/synchronous_compositor_impl.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "cc/input/input_handler.h" 9 #include "cc/input/input_handler.h"
10 #include "content/browser/android/in_process/synchronous_compositor_factory_impl .h" 10 #include "content/browser/android/in_process/synchronous_compositor_factory_impl .h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 gfx::Rect viewport, 122 gfx::Rect viewport,
123 gfx::Rect clip, 123 gfx::Rect clip,
124 bool stencil_enabled) { 124 bool stencil_enabled) {
125 DCHECK(CalledOnValidThread()); 125 DCHECK(CalledOnValidThread());
126 DCHECK(output_surface_); 126 DCHECK(output_surface_);
127 127
128 scoped_ptr<cc::CompositorFrame> frame = output_surface_->DemandDrawHw( 128 scoped_ptr<cc::CompositorFrame> frame = output_surface_->DemandDrawHw(
129 surface_size, transform, viewport, clip, stencil_enabled); 129 surface_size, transform, viewport, clip, stencil_enabled);
130 if (frame.get()) 130 if (frame.get())
131 UpdateFrameMetaData(frame->metadata); 131 UpdateFrameMetaData(frame->metadata);
132
132 return frame.Pass(); 133 return frame.Pass();
133 } 134 }
134 135
135 void SynchronousCompositorImpl::ReturnResources( 136 void SynchronousCompositorImpl::ReturnResources(
136 const cc::CompositorFrameAck& frame_ack) { 137 const cc::CompositorFrameAck& frame_ack) {
137 DCHECK(CalledOnValidThread()); 138 DCHECK(CalledOnValidThread());
138 output_surface_->ReturnResources(frame_ack); 139 output_surface_->ReturnResources(frame_ack);
139 } 140 }
140 141
141 bool SynchronousCompositorImpl::DemandDrawSw(SkCanvas* canvas) { 142 bool SynchronousCompositorImpl::DemandDrawSw(SkCanvas* canvas) {
(...skipping 14 matching lines...) Expand all
156 FROM_HERE, 157 FROM_HERE,
157 base::Bind(&SynchronousCompositorImpl::UpdateFrameMetaData, 158 base::Bind(&SynchronousCompositorImpl::UpdateFrameMetaData,
158 weak_ptr_factory_.GetWeakPtr(), 159 weak_ptr_factory_.GetWeakPtr(),
159 frame_metadata)); 160 frame_metadata));
160 return; 161 return;
161 } 162 }
162 RenderWidgetHostViewAndroid* rwhv = static_cast<RenderWidgetHostViewAndroid*>( 163 RenderWidgetHostViewAndroid* rwhv = static_cast<RenderWidgetHostViewAndroid*>(
163 contents_->GetRenderWidgetHostView()); 164 contents_->GetRenderWidgetHostView());
164 if (rwhv) 165 if (rwhv)
165 rwhv->SynchronousFrameMetadata(frame_metadata); 166 rwhv->SynchronousFrameMetadata(frame_metadata);
167 DeliverMessages();
166 } 168 }
167 169
168 void SynchronousCompositorImpl::SetMemoryPolicy( 170 void SynchronousCompositorImpl::SetMemoryPolicy(
169 const SynchronousCompositorMemoryPolicy& policy) { 171 const SynchronousCompositorMemoryPolicy& policy) {
170 DCHECK(CalledOnValidThread()); 172 DCHECK(CalledOnValidThread());
171 DCHECK(output_surface_); 173 DCHECK(output_surface_);
172 174
173 output_surface_->SetMemoryPolicy(policy); 175 output_surface_->SetMemoryPolicy(policy);
174 } 176 }
175 177
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 compositor_client_->SetContinuousInvalidate(enable); 237 compositor_client_->SetContinuousInvalidate(enable);
236 } 238 }
237 239
238 InputEventAckState SynchronousCompositorImpl::HandleInputEvent( 240 InputEventAckState SynchronousCompositorImpl::HandleInputEvent(
239 const blink::WebInputEvent& input_event) { 241 const blink::WebInputEvent& input_event) {
240 DCHECK(CalledOnValidThread()); 242 DCHECK(CalledOnValidThread());
241 return g_factory.Get().synchronous_input_event_filter()->HandleInputEvent( 243 return g_factory.Get().synchronous_input_event_filter()->HandleInputEvent(
242 contents_->GetRoutingID(), input_event); 244 contents_->GetRoutingID(), input_event);
243 } 245 }
244 246
247 void SynchronousCompositorImpl::DeliverMessages() {
248 std::vector<IPC::Message> messages;
249 output_surface_->GetMessagesToDeliver(&messages);
250 RenderProcessHost* rph = contents_->GetRenderProcessHost();
251 for (std::vector<IPC::Message>::const_iterator i = messages.begin();
252 i != messages.end();
253 ++i) {
254 rph->OnMessageReceived(*i);
255 }
256 }
257
245 void SynchronousCompositorImpl::DidActivatePendingTree() { 258 void SynchronousCompositorImpl::DidActivatePendingTree() {
246 if (compositor_client_) 259 if (compositor_client_)
247 compositor_client_->DidUpdateContent(); 260 compositor_client_->DidUpdateContent();
248 } 261 }
249 262
250 gfx::Vector2dF SynchronousCompositorImpl::GetTotalScrollOffset() { 263 gfx::Vector2dF SynchronousCompositorImpl::GetTotalScrollOffset() {
251 DCHECK(CalledOnValidThread()); 264 DCHECK(CalledOnValidThread());
252 if (compositor_client_) 265 if (compositor_client_)
253 return compositor_client_->GetTotalRootLayerScrollOffset(); 266 return compositor_client_->GetTotalRootLayerScrollOffset();
254 return gfx::Vector2dF(); 267 return gfx::Vector2dF();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 g_factory.Get(); // Ensure it's initialized. 308 g_factory.Get(); // Ensure it's initialized.
296 SynchronousCompositorImpl::CreateForWebContents(contents); 309 SynchronousCompositorImpl::CreateForWebContents(contents);
297 } 310 }
298 if (SynchronousCompositorImpl* instance = 311 if (SynchronousCompositorImpl* instance =
299 SynchronousCompositorImpl::FromWebContents(contents)) { 312 SynchronousCompositorImpl::FromWebContents(contents)) {
300 instance->SetClient(client); 313 instance->SetClient(client);
301 } 314 }
302 } 315 }
303 316
304 } // namespace content 317 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698