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/message_loop_proxy.h" | 7 #include "base/message_loop_proxy.h" |
| 8 #include "cc/compositor_frame.h" |
8 #include "cc/output_surface_client.h" | 9 #include "cc/output_surface_client.h" |
9 #include "content/common/view_messages.h" | 10 #include "content/common/view_messages.h" |
10 #include "content/renderer/render_thread_impl.h" | 11 #include "content/renderer/render_thread_impl.h" |
11 #include "ipc/ipc_forwarding_message_filter.h" | 12 #include "ipc/ipc_forwarding_message_filter.h" |
12 #include "ipc/ipc_sync_channel.h" | 13 #include "ipc/ipc_sync_channel.h" |
| 14 #include "ipc/ipc_sync_message_filter.h" |
13 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" | 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" |
14 | 16 |
| 17 using cc::CompositorFrame; |
15 using cc::SoftwareOutputDevice; | 18 using cc::SoftwareOutputDevice; |
16 using WebKit::WebGraphicsContext3D; | 19 using WebKit::WebGraphicsContext3D; |
17 | 20 |
18 namespace content { | 21 namespace content { |
19 | 22 |
20 //------------------------------------------------------------------------------ | 23 //------------------------------------------------------------------------------ |
21 | 24 |
22 // static | 25 // static |
23 IPC::ForwardingMessageFilter* CompositorOutputSurface::CreateFilter( | 26 IPC::ForwardingMessageFilter* CompositorOutputSurface::CreateFilter( |
24 base::TaskRunner* target_task_runner) | 27 base::TaskRunner* target_task_runner) |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 WebGraphicsContext3D* CompositorOutputSurface::Context3D() const { | 84 WebGraphicsContext3D* CompositorOutputSurface::Context3D() const { |
82 DCHECK(CalledOnValidThread()); | 85 DCHECK(CalledOnValidThread()); |
83 return context3D_.get(); | 86 return context3D_.get(); |
84 } | 87 } |
85 | 88 |
86 cc::SoftwareOutputDevice* CompositorOutputSurface::SoftwareDevice() const { | 89 cc::SoftwareOutputDevice* CompositorOutputSurface::SoftwareDevice() const { |
87 return software_device_.get(); | 90 return software_device_.get(); |
88 } | 91 } |
89 | 92 |
90 void CompositorOutputSurface::SendFrameToParentCompositor( | 93 void CompositorOutputSurface::SendFrameToParentCompositor( |
91 const cc::CompositorFrame&) { | 94 const cc::CompositorFrame& frame) { |
92 DCHECK(CalledOnValidThread()); | 95 DCHECK(CalledOnValidThread()); |
93 NOTREACHED(); | 96 Send(new ViewHostMsg_SwapCompositorFrame(routing_id_, frame)); |
94 } | 97 } |
95 | 98 |
96 void CompositorOutputSurface::OnMessageReceived(const IPC::Message& message) { | 99 void CompositorOutputSurface::OnMessageReceived(const IPC::Message& message) { |
97 DCHECK(CalledOnValidThread()); | 100 DCHECK(CalledOnValidThread()); |
98 if (!client_) | 101 if (!client_) |
99 return; | 102 return; |
100 IPC_BEGIN_MESSAGE_MAP(CompositorOutputSurface, message) | 103 IPC_BEGIN_MESSAGE_MAP(CompositorOutputSurface, message) |
101 IPC_MESSAGE_HANDLER(ViewMsg_UpdateVSyncParameters, OnUpdateVSyncParameters); | 104 IPC_MESSAGE_HANDLER(ViewMsg_UpdateVSyncParameters, OnUpdateVSyncParameters); |
102 IPC_END_MESSAGE_MAP() | 105 IPC_END_MESSAGE_MAP() |
103 } | 106 } |
104 | 107 |
105 void CompositorOutputSurface::OnUpdateVSyncParameters( | 108 void CompositorOutputSurface::OnUpdateVSyncParameters( |
106 base::TimeTicks timebase, base::TimeDelta interval) { | 109 base::TimeTicks timebase, base::TimeDelta interval) { |
107 DCHECK(CalledOnValidThread()); | 110 DCHECK(CalledOnValidThread()); |
108 DCHECK(client_); | 111 DCHECK(client_); |
109 client_->OnVSyncParametersChanged(timebase, interval); | 112 client_->OnVSyncParametersChanged(timebase, interval); |
110 } | 113 } |
111 | 114 |
| 115 bool CompositorOutputSurface::Send(IPC::Message* message) { |
| 116 return ChildThread::current()->sync_message_filter()->Send(message); |
| 117 } |
| 118 |
112 } // namespace content | 119 } // namespace content |
OLD | NEW |