| 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/scheduler/begin_frame_source.h" | 9 #include "cc/scheduler/begin_frame_source.h" |
| 10 #include "cc/surfaces/display_scheduler.h" | 10 #include "cc/surfaces/display_scheduler.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 const RendererSettings& settings, | 22 const RendererSettings& settings, |
| 23 scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 23 scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
| 24 : output_surface_(output_surface.Pass()), | 24 : output_surface_(output_surface.Pass()), |
| 25 display_(new Display(this, | 25 display_(new Display(this, |
| 26 manager, | 26 manager, |
| 27 bitmap_manager, | 27 bitmap_manager, |
| 28 gpu_memory_buffer_manager, | 28 gpu_memory_buffer_manager, |
| 29 settings)), | 29 settings)), |
| 30 task_runner_(task_runner), | 30 task_runner_(task_runner), |
| 31 output_surface_lost_(false), | 31 output_surface_lost_(false), |
| 32 disable_gpu_vsync_(settings.disable_gpu_vsync) { | 32 disable_display_vsync_(settings.disable_display_vsync) { |
| 33 } | 33 } |
| 34 | 34 |
| 35 OnscreenDisplayClient::~OnscreenDisplayClient() { | 35 OnscreenDisplayClient::~OnscreenDisplayClient() { |
| 36 } | 36 } |
| 37 | 37 |
| 38 bool OnscreenDisplayClient::Initialize() { | 38 bool OnscreenDisplayClient::Initialize() { |
| 39 int max_frames_pending = | 39 int max_frames_pending = |
| 40 output_surface_ ? output_surface_->capabilities().max_frames_pending : 0; | 40 output_surface_ ? output_surface_->capabilities().max_frames_pending : 0; |
| 41 if (max_frames_pending <= 0) | 41 if (max_frames_pending <= 0) |
| 42 max_frames_pending = OutputSurface::DEFAULT_MAX_FRAMES_PENDING; | 42 max_frames_pending = OutputSurface::DEFAULT_MAX_FRAMES_PENDING; |
| 43 | 43 |
| 44 BeginFrameSource* frame_source; | 44 BeginFrameSource* frame_source; |
| 45 if (disable_gpu_vsync_) { | 45 if (disable_display_vsync_) { |
| 46 unthrottled_frame_source_ = | 46 unthrottled_frame_source_ = |
| 47 BackToBackBeginFrameSource::Create(task_runner_.get()); | 47 BackToBackBeginFrameSource::Create(task_runner_.get()); |
| 48 frame_source = unthrottled_frame_source_.get(); | 48 frame_source = unthrottled_frame_source_.get(); |
| 49 } else { | 49 } else { |
| 50 synthetic_frame_source_ = SyntheticBeginFrameSource::Create( | 50 synthetic_frame_source_ = SyntheticBeginFrameSource::Create( |
| 51 task_runner_.get(), BeginFrameArgs::DefaultInterval()); | 51 task_runner_.get(), BeginFrameArgs::DefaultInterval()); |
| 52 frame_source = synthetic_frame_source_.get(); | 52 frame_source = synthetic_frame_source_.get(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 scheduler_.reset(new DisplayScheduler( | 55 scheduler_.reset(new DisplayScheduler( |
| (...skipping 17 matching lines...) Expand all Loading... |
| 73 void OnscreenDisplayClient::OutputSurfaceLost() { | 73 void OnscreenDisplayClient::OutputSurfaceLost() { |
| 74 output_surface_lost_ = true; | 74 output_surface_lost_ = true; |
| 75 surface_display_output_surface_->DidLoseOutputSurface(); | 75 surface_display_output_surface_->DidLoseOutputSurface(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void OnscreenDisplayClient::SetMemoryPolicy(const ManagedMemoryPolicy& policy) { | 78 void OnscreenDisplayClient::SetMemoryPolicy(const ManagedMemoryPolicy& policy) { |
| 79 surface_display_output_surface_->SetMemoryPolicy(policy); | 79 surface_display_output_surface_->SetMemoryPolicy(policy); |
| 80 } | 80 } |
| 81 | 81 |
| 82 } // namespace cc | 82 } // namespace cc |
| OLD | NEW |