OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer/gpu/compositor_output_surface.h" | 5 #include "content/renderer/gpu/compositor_output_surface.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/message_loop_proxy.h" | 8 #include "base/message_loop_proxy.h" |
9 #include "cc/output/compositor_frame.h" | 9 #include "cc/output/compositor_frame.h" |
10 #include "cc/output/compositor_frame_ack.h" | 10 #include "cc/output/compositor_frame_ack.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 int32 routing_id, | 51 int32 routing_id, |
52 WebGraphicsContext3DCommandBufferImpl* context3D, | 52 WebGraphicsContext3DCommandBufferImpl* context3D, |
53 cc::SoftwareOutputDevice* software_device) | 53 cc::SoftwareOutputDevice* software_device) |
54 : OutputSurface(scoped_ptr<WebKit::WebGraphicsContext3D>(context3D), | 54 : OutputSurface(scoped_ptr<WebKit::WebGraphicsContext3D>(context3D), |
55 make_scoped_ptr(software_device)), | 55 make_scoped_ptr(software_device)), |
56 output_surface_filter_( | 56 output_surface_filter_( |
57 RenderThreadImpl::current()->compositor_output_surface_filter()), | 57 RenderThreadImpl::current()->compositor_output_surface_filter()), |
58 routing_id_(routing_id), | 58 routing_id_(routing_id), |
59 prefers_smoothness_(false), | 59 prefers_smoothness_(false), |
60 main_thread_handle_(base::PlatformThread::CurrentHandle()) { | 60 main_thread_handle_(base::PlatformThread::CurrentHandle()) { |
61 DCHECK(output_surface_filter_); | 61 DCHECK(output_surface_filter_.get()); |
62 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 62 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
63 capabilities_.has_parent_compositor = command_line->HasSwitch( | 63 capabilities_.has_parent_compositor = command_line->HasSwitch( |
64 switches::kEnableDelegatedRenderer); | 64 switches::kEnableDelegatedRenderer); |
65 DetachFromThread(); | 65 DetachFromThread(); |
66 message_sender_ = RenderThreadImpl::current()->sync_message_filter(); | 66 message_sender_ = RenderThreadImpl::current()->sync_message_filter(); |
67 DCHECK(message_sender_); | 67 DCHECK(message_sender_.get()); |
68 } | 68 } |
69 | 69 |
70 CompositorOutputSurface::~CompositorOutputSurface() { | 70 CompositorOutputSurface::~CompositorOutputSurface() { |
71 DCHECK(CalledOnValidThread()); | 71 DCHECK(CalledOnValidThread()); |
72 if (!client_) | 72 if (!client_) |
73 return; | 73 return; |
74 UpdateSmoothnessTakesPriority(false); | 74 UpdateSmoothnessTakesPriority(false); |
75 if (output_surface_proxy_) | 75 if (output_surface_proxy_.get()) |
76 output_surface_proxy_->ClearOutputSurface(); | 76 output_surface_proxy_->ClearOutputSurface(); |
77 output_surface_filter_->RemoveRoute(routing_id_); | 77 output_surface_filter_->RemoveRoute(routing_id_); |
78 } | 78 } |
79 | 79 |
80 bool CompositorOutputSurface::BindToClient( | 80 bool CompositorOutputSurface::BindToClient( |
81 cc::OutputSurfaceClient* client) { | 81 cc::OutputSurfaceClient* client) { |
82 DCHECK(CalledOnValidThread()); | 82 DCHECK(CalledOnValidThread()); |
83 | 83 |
84 if (!cc::OutputSurface::BindToClient(client)) | 84 if (!cc::OutputSurface::BindToClient(client)) |
85 return false; | 85 return false; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 // If this is the last surface to stop preferring smoothness, | 197 // If this is the last surface to stop preferring smoothness, |
198 // Reset the main thread's priority to the default. | 198 // Reset the main thread's priority to the default. |
199 if (prefers_smoothness_ == true && | 199 if (prefers_smoothness_ == true && |
200 --g_prefer_smoothness_count == 0) { | 200 --g_prefer_smoothness_count == 0) { |
201 SetThreadPriorityToDefault(main_thread_handle_); | 201 SetThreadPriorityToDefault(main_thread_handle_); |
202 } | 202 } |
203 prefers_smoothness_ = prefers_smoothness; | 203 prefers_smoothness_ = prefers_smoothness; |
204 } | 204 } |
205 | 205 |
206 } // namespace content | 206 } // namespace content |
OLD | NEW |