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

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

Issue 2029323004: Get rid of virtual Display::CreateScheduler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@onscreendisplayclient
Patch Set: displaytest: unusedvar Created 4 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
« no previous file with comments | « cc/surfaces/display_scheduler.h ('k') | cc/surfaces/display_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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/display_scheduler.h" 5 #include "cc/surfaces/display_scheduler.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
11 #include "cc/output/output_surface.h" 11 #include "cc/output/output_surface.h"
12 12
13 namespace cc { 13 namespace cc {
14 14
15 DisplayScheduler::DisplayScheduler(DisplaySchedulerClient* client, 15 DisplayScheduler::DisplayScheduler(BeginFrameSource* begin_frame_source,
16 BeginFrameSource* begin_frame_source,
17 base::SingleThreadTaskRunner* task_runner, 16 base::SingleThreadTaskRunner* task_runner,
18 int max_pending_swaps) 17 int max_pending_swaps)
19 : client_(client), 18 : begin_frame_source_(begin_frame_source),
20 begin_frame_source_(begin_frame_source),
21 task_runner_(task_runner), 19 task_runner_(task_runner),
22 output_surface_lost_(false), 20 output_surface_lost_(false),
23 root_surface_resources_locked_(true), 21 root_surface_resources_locked_(true),
24 inside_begin_frame_deadline_interval_(false), 22 inside_begin_frame_deadline_interval_(false),
25 needs_draw_(false), 23 needs_draw_(false),
26 expecting_root_surface_damage_because_of_resize_(false), 24 expecting_root_surface_damage_because_of_resize_(false),
27 all_active_child_surfaces_ready_to_draw_(false), 25 all_active_child_surfaces_ready_to_draw_(false),
28 pending_swaps_(0), 26 pending_swaps_(0),
29 max_pending_swaps_(max_pending_swaps), 27 max_pending_swaps_(max_pending_swaps),
30 observing_begin_frame_source_(false), 28 observing_begin_frame_source_(false),
31 root_surface_damaged_(false), 29 root_surface_damaged_(false),
32 expect_damage_from_root_surface_(false), 30 expect_damage_from_root_surface_(false),
33 weak_ptr_factory_(this) { 31 weak_ptr_factory_(this) {
34 begin_frame_deadline_closure_ = base::Bind( 32 begin_frame_deadline_closure_ = base::Bind(
35 &DisplayScheduler::OnBeginFrameDeadline, weak_ptr_factory_.GetWeakPtr()); 33 &DisplayScheduler::OnBeginFrameDeadline, weak_ptr_factory_.GetWeakPtr());
36 } 34 }
37 35
38 DisplayScheduler::~DisplayScheduler() { 36 DisplayScheduler::~DisplayScheduler() {
39 if (observing_begin_frame_source_) 37 if (observing_begin_frame_source_)
40 begin_frame_source_->RemoveObserver(this); 38 begin_frame_source_->RemoveObserver(this);
41 } 39 }
42 40
41 void DisplayScheduler::SetClient(DisplaySchedulerClient* client) {
42 client_ = client;
43 }
44
43 // If we try to draw when the root surface resources are locked, the 45 // If we try to draw when the root surface resources are locked, the
44 // draw will fail. 46 // draw will fail.
45 void DisplayScheduler::SetRootSurfaceResourcesLocked(bool locked) { 47 void DisplayScheduler::SetRootSurfaceResourcesLocked(bool locked) {
46 TRACE_EVENT1("cc", "DisplayScheduler::SetRootSurfaceResourcesLocked", 48 TRACE_EVENT1("cc", "DisplayScheduler::SetRootSurfaceResourcesLocked",
47 "locked", locked); 49 "locked", locked);
48 root_surface_resources_locked_ = locked; 50 root_surface_resources_locked_ = locked;
49 ScheduleBeginFrameDeadline(); 51 ScheduleBeginFrameDeadline();
50 } 52 }
51 53
52 // This is used to force an immediate swap before a resize. 54 // This is used to force an immediate swap before a resize.
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 } 301 }
300 302
301 void DisplayScheduler::DidSwapBuffersComplete() { 303 void DisplayScheduler::DidSwapBuffersComplete() {
302 pending_swaps_--; 304 pending_swaps_--;
303 TRACE_EVENT_ASYNC_END1("cc", "DisplayScheduler:pending_swaps", this, 305 TRACE_EVENT_ASYNC_END1("cc", "DisplayScheduler:pending_swaps", this,
304 "pending_frames", pending_swaps_); 306 "pending_frames", pending_swaps_);
305 ScheduleBeginFrameDeadline(); 307 ScheduleBeginFrameDeadline();
306 } 308 }
307 309
308 } // namespace cc 310 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/display_scheduler.h ('k') | cc/surfaces/display_scheduler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698