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

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

Issue 15836005: cc: Emulate BeginFrame in OutputSurfaces that don't support it natively (Closed) Base URL: http://git.chromium.org/chromium/src.git@nofrc
Patch Set: Ignore last patch set: bad upload. Created 7 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
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_output_surfa ce.h" 5 #include "content/browser/android/in_process/synchronous_compositor_output_surfa ce.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "cc/output/compositor_frame.h" 10 #include "cc/output/compositor_frame.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 bool finished_draw = current_sw_canvas_ == NULL; 176 bool finished_draw = current_sw_canvas_ == NULL;
177 current_sw_canvas_ = NULL; 177 current_sw_canvas_ = NULL;
178 return finished_draw; 178 return finished_draw;
179 } 179 }
180 180
181 bool SynchronousCompositorOutputSurface::DemandDrawHw( 181 bool SynchronousCompositorOutputSurface::DemandDrawHw(
182 gfx::Size view_size, 182 gfx::Size view_size,
183 const gfx::Transform& transform, 183 const gfx::Transform& transform,
184 gfx::Rect damage_area) { 184 gfx::Rect damage_area) {
185 DCHECK(CalledOnValidThread()); 185 DCHECK(CalledOnValidThread());
186 DCHECK(client_); 186 DCHECK(hasClient());
187 DCHECK(context3d()); 187 DCHECK(context3d());
188 188
189 // Force a GL state restore next time a GLContextVirtual is made current. 189 // Force a GL state restore next time a GLContextVirtual is made current.
190 // TODO(boliu): Move this to the end of this function after we have fixed 190 // TODO(boliu): Move this to the end of this function after we have fixed
191 // all cases of MakeCurrent calls outside of draws. Tracked in 191 // all cases of MakeCurrent calls outside of draws. Tracked in
192 // crbug.com/239856. 192 // crbug.com/239856.
193 gfx::GLContext* current_context = gfx::GLContext::GetCurrent(); 193 gfx::GLContext* current_context = gfx::GLContext::GetCurrent();
194 if (current_context) 194 if (current_context)
195 current_context->ReleaseCurrent(NULL); 195 current_context->ReleaseCurrent(NULL);
196 196
197 did_swap_buffer_ = false; 197 did_swap_buffer_ = false;
198 198
199 InvokeComposite(transform, damage_area); 199 InvokeComposite(transform, damage_area);
200 200
201 return did_swap_buffer_; 201 return did_swap_buffer_;
202 } 202 }
203 203
204 void SynchronousCompositorOutputSurface::InvokeComposite( 204 void SynchronousCompositorOutputSurface::InvokeComposite(
205 const gfx::Transform& transform, 205 const gfx::Transform& transform,
206 gfx::Rect damage_area) { 206 gfx::Rect damage_area) {
207 // TODO(boliu): This assumes |transform| is identity and |damage_area| is the 207 // TODO(boliu): This assumes |transform| is identity and |damage_area| is the
208 // whole view. Tracking bug to implement this: crbug.com/230463. 208 // whole view. Tracking bug to implement this: crbug.com/230463.
209 client_->SetNeedsRedrawRect(damage_area); 209 SetNeedsRedrawRect(damage_area);
210 if (needs_begin_frame_) 210 if (needs_begin_frame_)
211 client_->BeginFrame(base::TimeTicks::Now()); 211 BeginFrame(base::TimeTicks::Now());
212 } 212 }
213 213
214 // Not using base::NonThreadSafe as we want to enforce a more exacting threading 214 // Not using base::NonThreadSafe as we want to enforce a more exacting threading
215 // requirement: SynchronousCompositorOutputSurface() must only be used on the UI 215 // requirement: SynchronousCompositorOutputSurface() must only be used on the UI
216 // thread. 216 // thread.
217 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { 217 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const {
218 return BrowserThread::CurrentlyOn(BrowserThread::UI); 218 return BrowserThread::CurrentlyOn(BrowserThread::UI);
219 } 219 }
220 220
221 SynchronousCompositorOutputSurfaceDelegate* 221 SynchronousCompositorOutputSurfaceDelegate*
222 SynchronousCompositorOutputSurface::GetDelegate() { 222 SynchronousCompositorOutputSurface::GetDelegate() {
223 return SynchronousCompositorImpl::FromRoutingID(routing_id_); 223 return SynchronousCompositorImpl::FromRoutingID(routing_id_);
224 } 224 }
225 225
226 } // namespace content 226 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698