Chromium Code Reviews| 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 switch (frame.type) { |
| 97 case CompositorFrame::DELEGATED: | |
|
piman
2012/12/14 22:02:22
nit: indent according to chrome style (case at +2)
aelias_OOO_until_Jul13
2012/12/15 00:06:17
Done.
| |
| 98 Send(new ViewHostMsg_SwapDelegatedCompositorFrame(routing_id_, | |
| 99 static_cast<const cc::DelegatedCompositorFrame&>(frame))); | |
| 100 break; | |
| 101 case CompositorFrame::GL: | |
| 102 Send(new ViewHostMsg_SwapGLCompositorFrame(routing_id_, | |
| 103 static_cast<const cc::GLCompositorFrame&>(frame))); | |
| 104 break; | |
| 105 default: | |
| 106 NOTREACHED(); | |
| 107 } | |
| 94 } | 108 } |
| 95 | 109 |
| 96 void CompositorOutputSurface::OnMessageReceived(const IPC::Message& message) { | 110 void CompositorOutputSurface::OnMessageReceived(const IPC::Message& message) { |
| 97 DCHECK(CalledOnValidThread()); | 111 DCHECK(CalledOnValidThread()); |
| 98 if (!client_) | 112 if (!client_) |
| 99 return; | 113 return; |
| 100 IPC_BEGIN_MESSAGE_MAP(CompositorOutputSurface, message) | 114 IPC_BEGIN_MESSAGE_MAP(CompositorOutputSurface, message) |
| 101 IPC_MESSAGE_HANDLER(ViewMsg_UpdateVSyncParameters, OnUpdateVSyncParameters); | 115 IPC_MESSAGE_HANDLER(ViewMsg_UpdateVSyncParameters, OnUpdateVSyncParameters); |
| 102 IPC_END_MESSAGE_MAP() | 116 IPC_END_MESSAGE_MAP() |
| 103 } | 117 } |
| 104 | 118 |
| 105 void CompositorOutputSurface::OnUpdateVSyncParameters( | 119 void CompositorOutputSurface::OnUpdateVSyncParameters( |
| 106 base::TimeTicks timebase, base::TimeDelta interval) { | 120 base::TimeTicks timebase, base::TimeDelta interval) { |
| 107 DCHECK(CalledOnValidThread()); | 121 DCHECK(CalledOnValidThread()); |
| 108 DCHECK(client_); | 122 DCHECK(client_); |
| 109 client_->OnVSyncParametersChanged(timebase, interval); | 123 client_->OnVSyncParametersChanged(timebase, interval); |
| 110 } | 124 } |
| 111 | 125 |
| 126 bool CompositorOutputSurface::Send(IPC::Message* message) { | |
| 127 return ChildThread::current()->sync_message_filter()->Send(message); | |
| 128 } | |
| 129 | |
| 112 } // namespace content | 130 } // namespace content |
| OLD | NEW |