OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/onscreen_display_client.h" | 5 #include "cc/surfaces/onscreen_display_client.h" |
6 | 6 |
7 #include "base/trace_event/trace_event.h" | 7 #include "base/trace_event/trace_event.h" |
8 #include "cc/output/output_surface.h" | 8 #include "cc/output/output_surface.h" |
9 #include "cc/output/vsync_parameter_observer.h" | 9 #include "cc/output/vsync_parameter_observer.h" |
10 #include "cc/scheduler/begin_frame_source.h" | 10 #include "cc/scheduler/begin_frame_source.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 24 scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
25 : output_surface_(output_surface.Pass()), | 25 : output_surface_(output_surface.Pass()), |
26 display_(new Display(this, | 26 display_(new Display(this, |
27 manager, | 27 manager, |
28 bitmap_manager, | 28 bitmap_manager, |
29 gpu_memory_buffer_manager, | 29 gpu_memory_buffer_manager, |
30 settings)), | 30 settings)), |
31 vsync_observer_(nullptr), | 31 vsync_observer_(nullptr), |
32 task_runner_(task_runner), | 32 task_runner_(task_runner), |
33 output_surface_lost_(false), | 33 output_surface_lost_(false), |
34 disable_gpu_vsync_(settings.disable_gpu_vsync) { | 34 disable_display_vsync_(settings.disable_display_vsync) { |
35 } | 35 } |
36 | 36 |
37 OnscreenDisplayClient::~OnscreenDisplayClient() { | 37 OnscreenDisplayClient::~OnscreenDisplayClient() { |
38 } | 38 } |
39 | 39 |
40 bool OnscreenDisplayClient::Initialize() { | 40 bool OnscreenDisplayClient::Initialize() { |
41 int max_frames_pending = | 41 int max_frames_pending = |
42 output_surface_ ? output_surface_->capabilities().max_frames_pending : 0; | 42 output_surface_ ? output_surface_->capabilities().max_frames_pending : 0; |
43 if (max_frames_pending <= 0) | 43 if (max_frames_pending <= 0) |
44 max_frames_pending = OutputSurface::DEFAULT_MAX_FRAMES_PENDING; | 44 max_frames_pending = OutputSurface::DEFAULT_MAX_FRAMES_PENDING; |
45 | 45 |
46 if (disable_gpu_vsync_) { | 46 if (disable_display_vsync_) { |
47 begin_frame_source_ = | 47 begin_frame_source_ = |
48 BackToBackBeginFrameSource::Create(task_runner_.get()); | 48 BackToBackBeginFrameSource::Create(task_runner_.get()); |
49 } else { | 49 } else { |
50 scoped_ptr<SyntheticBeginFrameSource> synthetic_source = | 50 scoped_ptr<SyntheticBeginFrameSource> synthetic_source = |
51 SyntheticBeginFrameSource::Create(task_runner_.get(), base::TimeTicks(), | 51 SyntheticBeginFrameSource::Create(task_runner_.get(), base::TimeTicks(), |
52 BeginFrameArgs::DefaultInterval()); | 52 BeginFrameArgs::DefaultInterval()); |
53 vsync_observer_ = synthetic_source.get(); | 53 vsync_observer_ = synthetic_source.get(); |
54 begin_frame_source_ = synthetic_source.Pass(); | 54 begin_frame_source_ = synthetic_source.Pass(); |
55 } | 55 } |
56 | 56 |
(...skipping 19 matching lines...) Expand all Loading... |
76 void OnscreenDisplayClient::OutputSurfaceLost() { | 76 void OnscreenDisplayClient::OutputSurfaceLost() { |
77 output_surface_lost_ = true; | 77 output_surface_lost_ = true; |
78 surface_display_output_surface_->DidLoseOutputSurface(); | 78 surface_display_output_surface_->DidLoseOutputSurface(); |
79 } | 79 } |
80 | 80 |
81 void OnscreenDisplayClient::SetMemoryPolicy(const ManagedMemoryPolicy& policy) { | 81 void OnscreenDisplayClient::SetMemoryPolicy(const ManagedMemoryPolicy& policy) { |
82 surface_display_output_surface_->SetMemoryPolicy(policy); | 82 surface_display_output_surface_->SetMemoryPolicy(policy); |
83 } | 83 } |
84 | 84 |
85 } // namespace cc | 85 } // namespace cc |
OLD | NEW |