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 "content/browser/compositor/browser_compositor_output_surface.h" | 5 #include "content/browser/compositor/browser_compositor_output_surface.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/command_line.h" | 10 #include "base/command_line.h" |
9 #include "base/location.h" | 11 #include "base/location.h" |
10 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
11 #include "cc/base/switches.h" | 13 #include "cc/base/switches.h" |
12 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida
tor.h" | 14 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida
tor.h" |
13 #include "content/browser/compositor/reflector_impl.h" | 15 #include "content/browser/compositor/reflector_impl.h" |
14 #include "content/common/gpu/client/context_provider_command_buffer.h" | 16 #include "content/common/gpu/client/context_provider_command_buffer.h" |
15 | 17 |
16 namespace content { | 18 namespace content { |
17 | 19 |
18 BrowserCompositorOutputSurface::BrowserCompositorOutputSurface( | 20 BrowserCompositorOutputSurface::BrowserCompositorOutputSurface( |
19 const scoped_refptr<cc::ContextProvider>& context_provider, | 21 const scoped_refptr<cc::ContextProvider>& context_provider, |
20 const scoped_refptr<cc::ContextProvider>& worker_context_provider, | 22 const scoped_refptr<cc::ContextProvider>& worker_context_provider, |
21 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager, | 23 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager, |
22 scoped_ptr<BrowserCompositorOverlayCandidateValidator> | 24 scoped_ptr<BrowserCompositorOverlayCandidateValidator> |
23 overlay_candidate_validator) | 25 overlay_candidate_validator) |
24 : OutputSurface(context_provider, worker_context_provider), | 26 : OutputSurface(context_provider, worker_context_provider), |
25 vsync_manager_(vsync_manager), | 27 vsync_manager_(vsync_manager), |
26 reflector_(nullptr), | 28 reflector_(nullptr), |
27 use_begin_frame_scheduling_( | 29 use_begin_frame_scheduling_( |
28 base::CommandLine::ForCurrentProcess() | 30 base::CommandLine::ForCurrentProcess() |
29 ->HasSwitch(cc::switches::kEnableBeginFrameScheduling)) { | 31 ->HasSwitch(cc::switches::kEnableBeginFrameScheduling)) { |
30 overlay_candidate_validator_ = overlay_candidate_validator.Pass(); | 32 overlay_candidate_validator_ = std::move(overlay_candidate_validator); |
31 Initialize(); | 33 Initialize(); |
32 } | 34 } |
33 | 35 |
34 BrowserCompositorOutputSurface::BrowserCompositorOutputSurface( | 36 BrowserCompositorOutputSurface::BrowserCompositorOutputSurface( |
35 scoped_ptr<cc::SoftwareOutputDevice> software_device, | 37 scoped_ptr<cc::SoftwareOutputDevice> software_device, |
36 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager) | 38 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager) |
37 : OutputSurface(software_device.Pass()), | 39 : OutputSurface(std::move(software_device)), |
38 vsync_manager_(vsync_manager), | 40 vsync_manager_(vsync_manager), |
39 reflector_(nullptr), | 41 reflector_(nullptr), |
40 use_begin_frame_scheduling_(base::CommandLine::ForCurrentProcess()-> | 42 use_begin_frame_scheduling_( |
41 HasSwitch(cc::switches::kEnableBeginFrameScheduling)) { | 43 base::CommandLine::ForCurrentProcess() |
| 44 ->HasSwitch(cc::switches::kEnableBeginFrameScheduling)) { |
42 Initialize(); | 45 Initialize(); |
43 } | 46 } |
44 | 47 |
45 BrowserCompositorOutputSurface::~BrowserCompositorOutputSurface() { | 48 BrowserCompositorOutputSurface::~BrowserCompositorOutputSurface() { |
46 if (reflector_) | 49 if (reflector_) |
47 reflector_->DetachFromOutputSurface(); | 50 reflector_->DetachFromOutputSurface(); |
48 DCHECK(!reflector_); | 51 DCHECK(!reflector_); |
49 if (!HasClient()) | 52 if (!HasClient()) |
50 return; | 53 return; |
51 | 54 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 BrowserCompositorOutputSurface::CreateCompositionStartedCallback() { | 111 BrowserCompositorOutputSurface::CreateCompositionStartedCallback() { |
109 return base::Closure(); | 112 return base::Closure(); |
110 } | 113 } |
111 | 114 |
112 cc::OverlayCandidateValidator* | 115 cc::OverlayCandidateValidator* |
113 BrowserCompositorOutputSurface::GetOverlayCandidateValidator() const { | 116 BrowserCompositorOutputSurface::GetOverlayCandidateValidator() const { |
114 return overlay_candidate_validator_.get(); | 117 return overlay_candidate_validator_.get(); |
115 } | 118 } |
116 | 119 |
117 } // namespace content | 120 } // namespace content |
OLD | NEW |