| 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 21 matching lines...) Expand all Loading... |
| 32 disable_display_vsync_(settings.disable_display_vsync) {} | 32 disable_display_vsync_(settings.disable_display_vsync) {} |
| 33 | 33 |
| 34 OnscreenDisplayClient::~OnscreenDisplayClient() { | 34 OnscreenDisplayClient::~OnscreenDisplayClient() { |
| 35 } | 35 } |
| 36 | 36 |
| 37 bool OnscreenDisplayClient::Initialize() { | 37 bool OnscreenDisplayClient::Initialize() { |
| 38 DCHECK(output_surface_); | 38 DCHECK(output_surface_); |
| 39 | 39 |
| 40 BeginFrameSource* frame_source; | 40 BeginFrameSource* frame_source; |
| 41 if (disable_display_vsync_) { | 41 if (disable_display_vsync_) { |
| 42 unthrottled_frame_source_ = | 42 unthrottled_frame_source_.reset( |
| 43 BackToBackBeginFrameSource::Create(task_runner_.get()); | 43 new BackToBackBeginFrameSource(task_runner_.get())); |
| 44 frame_source = unthrottled_frame_source_.get(); | 44 frame_source = unthrottled_frame_source_.get(); |
| 45 } else { | 45 } else { |
| 46 synthetic_frame_source_ = SyntheticBeginFrameSource::Create( | 46 synthetic_frame_source_.reset(new SyntheticBeginFrameSource( |
| 47 task_runner_.get(), BeginFrameArgs::DefaultInterval()); | 47 task_runner_.get(), BeginFrameArgs::DefaultInterval())); |
| 48 frame_source = synthetic_frame_source_.get(); | 48 frame_source = synthetic_frame_source_.get(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 scheduler_.reset( | 51 scheduler_.reset( |
| 52 new DisplayScheduler(display_.get(), frame_source, task_runner_.get(), | 52 new DisplayScheduler(display_.get(), frame_source, task_runner_.get(), |
| 53 output_surface_->capabilities().max_frames_pending)); | 53 output_surface_->capabilities().max_frames_pending)); |
| 54 | 54 |
| 55 return display_->Initialize(std::move(output_surface_), scheduler_.get()); | 55 return display_->Initialize(std::move(output_surface_), scheduler_.get()); |
| 56 } | 56 } |
| 57 | 57 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 70 void OnscreenDisplayClient::OutputSurfaceLost() { | 70 void OnscreenDisplayClient::OutputSurfaceLost() { |
| 71 output_surface_lost_ = true; | 71 output_surface_lost_ = true; |
| 72 surface_display_output_surface_->DidLoseOutputSurface(); | 72 surface_display_output_surface_->DidLoseOutputSurface(); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void OnscreenDisplayClient::SetMemoryPolicy(const ManagedMemoryPolicy& policy) { | 75 void OnscreenDisplayClient::SetMemoryPolicy(const ManagedMemoryPolicy& policy) { |
| 76 surface_display_output_surface_->SetMemoryPolicy(policy); | 76 surface_display_output_surface_->SetMemoryPolicy(policy); |
| 77 } | 77 } |
| 78 | 78 |
| 79 } // namespace cc | 79 } // namespace cc |
| OLD | NEW |