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

Side by Side Diff: cc/scheduler/scheduler.cc

Issue 60353002: cc: add DevTools instrumentation for impl-side frames (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years 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
« no previous file with comments | « cc/scheduler/scheduler.h ('k') | cc/scheduler/scheduler_unittest.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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/scheduler/scheduler.h" 5 #include "cc/scheduler/scheduler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include "base/auto_reset.h" 8 #include "base/auto_reset.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"
11 #include "cc/debug/devtools_instrumentation.h"
11 #include "cc/debug/traced_value.h" 12 #include "cc/debug/traced_value.h"
12 #include "ui/gfx/frame_time.h" 13 #include "ui/gfx/frame_time.h"
13 14
14 namespace cc { 15 namespace cc {
15 16
16 Scheduler::Scheduler(SchedulerClient* client, 17 Scheduler::Scheduler(SchedulerClient* client,
17 const SchedulerSettings& scheduler_settings) 18 const SchedulerSettings& scheduler_settings,
19 int layer_tree_host_id)
18 : settings_(scheduler_settings), 20 : settings_(scheduler_settings),
19 client_(client), 21 client_(client),
22 layer_tree_host_id_(layer_tree_host_id),
20 last_set_needs_begin_impl_frame_(false), 23 last_set_needs_begin_impl_frame_(false),
21 state_machine_(scheduler_settings), 24 state_machine_(scheduler_settings),
22 inside_process_scheduled_actions_(false), 25 inside_process_scheduled_actions_(false),
23 inside_action_(SchedulerStateMachine::ACTION_NONE), 26 inside_action_(SchedulerStateMachine::ACTION_NONE),
24 weak_factory_(this) { 27 weak_factory_(this) {
25 DCHECK(client_); 28 DCHECK(client_);
26 DCHECK(!state_machine_.BeginImplFrameNeeded()); 29 DCHECK(!state_machine_.BeginImplFrameNeeded());
27 } 30 }
28 31
29 Scheduler::~Scheduler() {} 32 Scheduler::~Scheduler() {}
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 state_machine_.MainThreadIsInHighLatencyMode() && 212 state_machine_.MainThreadIsInHighLatencyMode() &&
210 CanCommitAndActivateBeforeDeadline()); 213 CanCommitAndActivateBeforeDeadline());
211 } 214 }
212 215
213 ProcessScheduledActions(); 216 ProcessScheduledActions();
214 217
215 if (!state_machine_.HasInitializedOutputSurface()) 218 if (!state_machine_.HasInitializedOutputSurface())
216 return; 219 return;
217 220
218 state_machine_.OnBeginImplFrameDeadlinePending(); 221 state_machine_.OnBeginImplFrameDeadlinePending();
219 222 devtools_instrumentation::didBeginFrame(layer_tree_host_id_);
220 if (settings_.using_synchronous_renderer_compositor) { 223 if (settings_.using_synchronous_renderer_compositor) {
221 // The synchronous renderer compositor has to make its GL calls 224 // The synchronous renderer compositor has to make its GL calls
222 // within this call to BeginImplFrame. 225 // within this call to BeginImplFrame.
223 // TODO(brianderson): Have the OutputSurface initiate the deadline tasks 226 // TODO(brianderson): Have the OutputSurface initiate the deadline tasks
224 // so the sychronous renderer compositor can take advantage of splitting 227 // so the sychronous renderer compositor can take advantage of splitting
225 // up the BeginImplFrame and deadline as well. 228 // up the BeginImplFrame and deadline as well.
226 OnBeginImplFrameDeadline(); 229 OnBeginImplFrameDeadline();
227 } else if (!settings_.deadline_scheduling_enabled) { 230 } else if (!settings_.deadline_scheduling_enabled) {
228 // We emulate the old non-deadline scheduler here by posting the 231 // We emulate the old non-deadline scheduler here by posting the
229 // deadline task without any delay. 232 // deadline task without any delay.
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 // impl thread's deadline. 378 // impl thread's deadline.
376 base::TimeTicks estimated_draw_time = 379 base::TimeTicks estimated_draw_time =
377 last_begin_impl_frame_args_.frame_time + 380 last_begin_impl_frame_args_.frame_time +
378 client_->BeginMainFrameToCommitDurationEstimate() + 381 client_->BeginMainFrameToCommitDurationEstimate() +
379 client_->CommitToActivateDurationEstimate(); 382 client_->CommitToActivateDurationEstimate();
380 383
381 return estimated_draw_time < last_begin_impl_frame_args_.deadline; 384 return estimated_draw_time < last_begin_impl_frame_args_.deadline;
382 } 385 }
383 386
384 } // namespace cc 387 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler.h ('k') | cc/scheduler/scheduler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698