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/message_loop_proxy.h" | 8 #include "base/message_loop/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" |
11 #include "cc/output/managed_memory_policy.h" | 11 #include "cc/output/managed_memory_policy.h" |
12 #include "cc/output/output_surface_client.h" | 12 #include "cc/output/output_surface_client.h" |
13 #include "content/common/gpu/client/command_buffer_proxy_impl.h" | 13 #include "content/common/gpu/client/command_buffer_proxy_impl.h" |
14 #include "content/common/gpu/client/context_provider_command_buffer.h" | 14 #include "content/common/gpu/client/context_provider_command_buffer.h" |
15 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 15 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
16 #include "content/common/view_messages.h" | 16 #include "content/common/view_messages.h" |
17 #include "content/public/common/content_switches.h" | 17 #include "content/public/common/content_switches.h" |
18 #include "content/renderer/render_thread_impl.h" | 18 #include "content/renderer/render_thread_impl.h" |
19 #include "gpu/command_buffer/client/gles2_interface.h" | |
19 #include "ipc/ipc_forwarding_message_filter.h" | 20 #include "ipc/ipc_forwarding_message_filter.h" |
20 #include "ipc/ipc_sync_channel.h" | 21 #include "ipc/ipc_sync_channel.h" |
21 | 22 |
22 namespace { | 23 namespace { |
23 // There are several compositor surfaces in a process, but they share the same | 24 // There are several compositor surfaces in a process, but they share the same |
24 // compositor thread, so we use a simple int here to track prefer-smoothness. | 25 // compositor thread, so we use a simple int here to track prefer-smoothness. |
25 int g_prefer_smoothness_count = 0; | 26 int g_prefer_smoothness_count = 0; |
26 } // namespace | 27 } // namespace |
27 | 28 |
28 namespace content { | 29 namespace content { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 void CompositorOutputSurface::SwapBuffers(cc::CompositorFrame* frame) { | 114 void CompositorOutputSurface::SwapBuffers(cc::CompositorFrame* frame) { |
114 if (use_swap_compositor_frame_message_) { | 115 if (use_swap_compositor_frame_message_) { |
115 Send(new ViewHostMsg_SwapCompositorFrame(routing_id_, | 116 Send(new ViewHostMsg_SwapCompositorFrame(routing_id_, |
116 output_surface_id_, | 117 output_surface_id_, |
117 *frame)); | 118 *frame)); |
118 DidSwapBuffers(); | 119 DidSwapBuffers(); |
119 return; | 120 return; |
120 } | 121 } |
121 | 122 |
122 if (frame->gl_frame_data) { | 123 if (frame->gl_frame_data) { |
123 WebGraphicsContext3DCommandBufferImpl* command_buffer_context = | 124 ContextProviderCommandBuffer* provider_cb = |
danakj
2014/01/06 20:59:37
provider_command_buffer?
| |
124 static_cast<WebGraphicsContext3DCommandBufferImpl*>( | 125 static_cast<ContextProviderCommandBuffer*>(context_provider_.get()); |
125 context_provider_->Context3d()); | |
126 CommandBufferProxyImpl* command_buffer_proxy = | 126 CommandBufferProxyImpl* command_buffer_proxy = |
127 command_buffer_context->GetCommandBufferProxy(); | 127 provider_cb->GetCommandBufferProxy(); |
128 DCHECK(command_buffer_proxy); | 128 DCHECK(command_buffer_proxy); |
129 context_provider_->Context3d()->shallowFlushCHROMIUM(); | 129 context_provider_->ContextGL()->ShallowFlushCHROMIUM(); |
130 command_buffer_proxy->SetLatencyInfo(frame->metadata.latency_info); | 130 command_buffer_proxy->SetLatencyInfo(frame->metadata.latency_info); |
131 } | 131 } |
132 | 132 |
133 OutputSurface::SwapBuffers(frame); | 133 OutputSurface::SwapBuffers(frame); |
134 } | 134 } |
135 | 135 |
136 void CompositorOutputSurface::OnMessageReceived(const IPC::Message& message) { | 136 void CompositorOutputSurface::OnMessageReceived(const IPC::Message& message) { |
137 DCHECK(CalledOnValidThread()); | 137 DCHECK(CalledOnValidThread()); |
138 if (!HasClient()) | 138 if (!HasClient()) |
139 return; | 139 return; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
226 // If this is the last surface to stop preferring smoothness, | 226 // If this is the last surface to stop preferring smoothness, |
227 // Reset the main thread's priority to the default. | 227 // Reset the main thread's priority to the default. |
228 if (prefers_smoothness_ == true && | 228 if (prefers_smoothness_ == true && |
229 --g_prefer_smoothness_count == 0) { | 229 --g_prefer_smoothness_count == 0) { |
230 SetThreadPriorityToDefault(main_thread_handle_); | 230 SetThreadPriorityToDefault(main_thread_handle_); |
231 } | 231 } |
232 prefers_smoothness_ = prefers_smoothness; | 232 prefers_smoothness_ = prefers_smoothness; |
233 } | 233 } |
234 | 234 |
235 } // namespace content | 235 } // namespace content |
OLD | NEW |