Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(432)

Side by Side Diff: content/renderer/gpu/compositor_output_surface.cc

Issue 11861020: Aura: Browser-side changes for Composite-To-Mailbox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/compositor_frame.h"
9 #include "cc/compositor_frame_ack.h"
9 #include "cc/output_surface_client.h" 10 #include "cc/output_surface_client.h"
10 #include "content/common/view_messages.h" 11 #include "content/common/view_messages.h"
11 #include "content/renderer/render_thread_impl.h" 12 #include "content/renderer/render_thread_impl.h"
12 #include "ipc/ipc_forwarding_message_filter.h" 13 #include "ipc/ipc_forwarding_message_filter.h"
13 #include "ipc/ipc_sync_channel.h" 14 #include "ipc/ipc_sync_channel.h"
14 #include "ipc/ipc_sync_message_filter.h" 15 #include "ipc/ipc_sync_message_filter.h"
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h" 16 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h"
16 17
17 using cc::CompositorFrame; 18 using cc::CompositorFrame;
18 using cc::SoftwareOutputDevice; 19 using cc::SoftwareOutputDevice;
19 using WebKit::WebGraphicsContext3D; 20 using WebKit::WebGraphicsContext3D;
20 21
21 namespace content { 22 namespace content {
22 23
23 //------------------------------------------------------------------------------ 24 //------------------------------------------------------------------------------
24 25
25 // static 26 // static
26 IPC::ForwardingMessageFilter* CompositorOutputSurface::CreateFilter( 27 IPC::ForwardingMessageFilter* CompositorOutputSurface::CreateFilter(
27 base::TaskRunner* target_task_runner) 28 base::TaskRunner* target_task_runner)
28 { 29 {
29 uint32 messages_to_filter[] = {ViewMsg_UpdateVSyncParameters::ID}; 30 uint32 messages_to_filter[] = {
31 ViewMsg_UpdateVSyncParameters::ID,
32 ViewMsg_SwapCompositorFrameAck::ID
33 };
34
30 return new IPC::ForwardingMessageFilter( 35 return new IPC::ForwardingMessageFilter(
31 messages_to_filter, arraysize(messages_to_filter), 36 messages_to_filter, arraysize(messages_to_filter),
32 target_task_runner); 37 target_task_runner);
33 } 38 }
34 39
35 CompositorOutputSurface::CompositorOutputSurface( 40 CompositorOutputSurface::CompositorOutputSurface(
36 int32 routing_id, 41 int32 routing_id,
37 WebGraphicsContext3D* context3D, 42 WebGraphicsContext3D* context3D,
38 cc::SoftwareOutputDevice* software_device) 43 cc::SoftwareOutputDevice* software_device,
44 bool renderToMailbox)
39 : output_surface_filter_( 45 : output_surface_filter_(
40 RenderThreadImpl::current()->compositor_output_surface_filter()), 46 RenderThreadImpl::current()->compositor_output_surface_filter()),
41 client_(NULL), 47 client_(NULL),
42 routing_id_(routing_id), 48 routing_id_(routing_id),
43 context3D_(context3D), 49 context3D_(context3D),
44 software_device_(software_device) { 50 software_device_(software_device) {
45 DCHECK(output_surface_filter_); 51 DCHECK(output_surface_filter_);
46 capabilities_.has_parent_compositor = false; 52 capabilities_.has_parent_compositor = false;
53 capabilities_.render_to_mailbox = renderToMailbox;
47 DetachFromThread(); 54 DetachFromThread();
48 } 55 }
49 56
50 CompositorOutputSurface::~CompositorOutputSurface() { 57 CompositorOutputSurface::~CompositorOutputSurface() {
51 DCHECK(CalledOnValidThread()); 58 DCHECK(CalledOnValidThread());
52 if (!client_) 59 if (!client_)
53 return; 60 return;
54 output_surface_proxy_->ClearOutputSurface(); 61 output_surface_proxy_->ClearOutputSurface();
55 output_surface_filter_->RemoveRoute(routing_id_); 62 output_surface_filter_->RemoveRoute(routing_id_);
56 } 63 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 DCHECK(CalledOnValidThread()); 102 DCHECK(CalledOnValidThread());
96 Send(new ViewHostMsg_SwapCompositorFrame(routing_id_, *frame)); 103 Send(new ViewHostMsg_SwapCompositorFrame(routing_id_, *frame));
97 } 104 }
98 105
99 void CompositorOutputSurface::OnMessageReceived(const IPC::Message& message) { 106 void CompositorOutputSurface::OnMessageReceived(const IPC::Message& message) {
100 DCHECK(CalledOnValidThread()); 107 DCHECK(CalledOnValidThread());
101 if (!client_) 108 if (!client_)
102 return; 109 return;
103 IPC_BEGIN_MESSAGE_MAP(CompositorOutputSurface, message) 110 IPC_BEGIN_MESSAGE_MAP(CompositorOutputSurface, message)
104 IPC_MESSAGE_HANDLER(ViewMsg_UpdateVSyncParameters, OnUpdateVSyncParameters); 111 IPC_MESSAGE_HANDLER(ViewMsg_UpdateVSyncParameters, OnUpdateVSyncParameters);
112 IPC_MESSAGE_HANDLER(ViewMsg_SwapCompositorFrameAck, OnSwapAck);
105 IPC_END_MESSAGE_MAP() 113 IPC_END_MESSAGE_MAP()
106 } 114 }
107 115
108 void CompositorOutputSurface::OnUpdateVSyncParameters( 116 void CompositorOutputSurface::OnUpdateVSyncParameters(
109 base::TimeTicks timebase, base::TimeDelta interval) { 117 base::TimeTicks timebase, base::TimeDelta interval) {
110 DCHECK(CalledOnValidThread()); 118 DCHECK(CalledOnValidThread());
111 DCHECK(client_); 119 DCHECK(client_);
112 client_->OnVSyncParametersChanged(timebase, interval); 120 client_->OnVSyncParametersChanged(timebase, interval);
113 } 121 }
114 122
123 void CompositorOutputSurface::OnSwapAck(const cc::CompositorFrameAck& ack) {
124 client_->OnSendFrameToParentCompositorAck(ack);
125 }
126
115 bool CompositorOutputSurface::Send(IPC::Message* message) { 127 bool CompositorOutputSurface::Send(IPC::Message* message) {
116 return ChildThread::current()->sync_message_filter()->Send(message); 128 return ChildThread::current()->sync_message_filter()->Send(message);
117 } 129 }
118 130
119 } // namespace content 131 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698