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

Side by Side Diff: content/renderer/render_widget.cc

Issue 12804006: cc: Save correct frame begin time to FrameRateCounter (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase to 188402 Created 7 years, 9 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 | « content/renderer/render_widget.h ('k') | ui/compositor/compositor.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderer/render_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 } else { // Accelerated compositing path 1233 } else { // Accelerated compositing path
1234 // Begin painting. 1234 // Begin painting.
1235 // If painting is done via the gpu process then we don't set any damage 1235 // If painting is done via the gpu process then we don't set any damage
1236 // rects to save the browser process from doing unecessary work. 1236 // rects to save the browser process from doing unecessary work.
1237 pending_update_params_->bitmap_rect = bounds; 1237 pending_update_params_->bitmap_rect = bounds;
1238 pending_update_params_->scroll_rect = gfx::Rect(); 1238 pending_update_params_->scroll_rect = gfx::Rect();
1239 // We don't need an ack, because we're not sharing a DIB with the browser. 1239 // We don't need an ack, because we're not sharing a DIB with the browser.
1240 // If it needs to (e.g. composited UI), the GPU process does its own ACK 1240 // If it needs to (e.g. composited UI), the GPU process does its own ACK
1241 // with the browser for the GPU surface. 1241 // with the browser for the GPU surface.
1242 pending_update_params_->needs_ack = false; 1242 pending_update_params_->needs_ack = false;
1243 Composite(); 1243 Composite(frame_begin_ticks);
1244 } 1244 }
1245 1245
1246 // If we're holding a pending input event ACK, send the ACK before sending the 1246 // If we're holding a pending input event ACK, send the ACK before sending the
1247 // UpdateReply message so we can receive another input event before the 1247 // UpdateReply message so we can receive another input event before the
1248 // UpdateRect_ACK on platforms where the UpdateRect_ACK is sent from within 1248 // UpdateRect_ACK on platforms where the UpdateRect_ACK is sent from within
1249 // the UpdateRect IPC message handler. 1249 // the UpdateRect IPC message handler.
1250 if (pending_input_event_ack_.get()) 1250 if (pending_input_event_ack_.get())
1251 Send(pending_input_event_ack_.release()); 1251 Send(pending_input_event_ack_.release());
1252 1252
1253 // If Composite() called SwapBuffers, pending_update_params_ will be reset (in 1253 // If Composite() called SwapBuffers, pending_update_params_ will be reset (in
1254 // OnSwapBuffersPosted), meaning a message has been added to the 1254 // OnSwapBuffersPosted), meaning a message has been added to the
1255 // updates_pending_swap_ queue, that will be sent later. Otherwise, we send 1255 // updates_pending_swap_ queue, that will be sent later. Otherwise, we send
1256 // the message now. 1256 // the message now.
1257 if (pending_update_params_.get()) { 1257 if (pending_update_params_.get()) {
1258 // sending an ack to browser process that the paint is complete... 1258 // sending an ack to browser process that the paint is complete...
1259 update_reply_pending_ = pending_update_params_->needs_ack; 1259 update_reply_pending_ = pending_update_params_->needs_ack;
1260 Send(new ViewHostMsg_UpdateRect(routing_id_, *pending_update_params_)); 1260 Send(new ViewHostMsg_UpdateRect(routing_id_, *pending_update_params_));
1261 pending_update_params_.reset(); 1261 pending_update_params_.reset();
1262 } 1262 }
1263 1263
1264 // If we're software rendering then we're done initiating the paint. 1264 // If we're software rendering then we're done initiating the paint.
1265 if (!is_accelerated_compositing_active_) 1265 if (!is_accelerated_compositing_active_)
1266 DidInitiatePaint(); 1266 DidInitiatePaint();
1267 } 1267 }
1268 1268
1269 void RenderWidget::Composite() { 1269 void RenderWidget::Composite(base::TimeTicks frame_begin_time) {
1270 DCHECK(is_accelerated_compositing_active_); 1270 DCHECK(is_accelerated_compositing_active_);
1271 if (compositor_) // TODO(jamesr): Figure out how this can be null. 1271 if (compositor_) // TODO(jamesr): Figure out how this can be null.
1272 compositor_->Composite(); 1272 compositor_->Composite(frame_begin_time);
1273 } 1273 }
1274 1274
1275 /////////////////////////////////////////////////////////////////////////////// 1275 ///////////////////////////////////////////////////////////////////////////////
1276 // WebWidgetClient 1276 // WebWidgetClient
1277 1277
1278 void RenderWidget::didInvalidateRect(const WebRect& rect) { 1278 void RenderWidget::didInvalidateRect(const WebRect& rect) {
1279 TRACE_EVENT2("renderer", "RenderWidget::didInvalidateRect", 1279 TRACE_EVENT2("renderer", "RenderWidget::didInvalidateRect",
1280 "width", rect.width, "height", rect.height); 1280 "width", rect.width, "height", rect.height);
1281 // The invalidated rect might be outside the bounds of the view. 1281 // The invalidated rect might be outside the bounds of the view.
1282 gfx::Rect view_rect(size_); 1282 gfx::Rect view_rect(size_);
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after
2276 if (!context->Initialize( 2276 if (!context->Initialize(
2277 attributes, 2277 attributes,
2278 false /* bind generates resources */, 2278 false /* bind generates resources */,
2279 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZ E)) 2279 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZ E))
2280 return NULL; 2280 return NULL;
2281 return context.release(); 2281 return context.release();
2282 } 2282 }
2283 } 2283 }
2284 2284
2285 } // namespace content 2285 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_widget.h ('k') | ui/compositor/compositor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698