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