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

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

Issue 10915298: Add CCDelegatingRenderer, and corresponding IPCs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge fix Created 8 years, 2 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/command_line.h"
7 #include "base/message_loop_proxy.h" 8 #include "base/message_loop_proxy.h"
8 #include "content/common/view_messages.h" 9 #include "content/common/view_messages.h"
10 #include "content/public/common/content_switches.h"
9 #include "content/renderer/render_thread_impl.h" 11 #include "content/renderer/render_thread_impl.h"
10 #include "ipc/ipc_forwarding_message_filter.h" 12 #include "ipc/ipc_forwarding_message_filter.h"
11 #include "ipc/ipc_sync_channel.h" 13 #include "ipc/ipc_sync_channel.h"
14 #include "ipc/ipc_sync_message_filter.h"
12 #include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorOutput SurfaceClient.h" 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorOutput SurfaceClient.h"
13 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h" 16 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h"
14 17
15 using WebKit::WebGraphicsContext3D; 18 using WebKit::WebGraphicsContext3D;
16 using WebKit::WebCompositorSoftwareOutputDevice; 19 using WebKit::WebCompositorSoftwareOutputDevice;
17 20
18 //------------------------------------------------------------------------------ 21 //------------------------------------------------------------------------------
19 22
20 // static 23 // static
21 IPC::ForwardingMessageFilter* CompositorOutputSurface::CreateFilter( 24 IPC::ForwardingMessageFilter* CompositorOutputSurface::CreateFilter(
22 base::TaskRunner* target_task_runner) 25 base::TaskRunner* target_task_runner)
23 { 26 {
24 uint32 messages_to_filter[] = {ViewMsg_UpdateVSyncParameters::ID}; 27 uint32 messages_to_filter[] = {
28 ViewMsg_UpdateVSyncParameters::ID,
29 ViewMsg_SwapCompositorFrameACK::ID,
30 };
25 return new IPC::ForwardingMessageFilter( 31 return new IPC::ForwardingMessageFilter(
26 messages_to_filter, arraysize(messages_to_filter), 32 messages_to_filter, arraysize(messages_to_filter),
27 target_task_runner); 33 target_task_runner);
28 } 34 }
29 35
30 CompositorOutputSurface::CompositorOutputSurface( 36 CompositorOutputSurface::CompositorOutputSurface(
31 int32 routing_id, 37 int32 routing_id,
32 WebGraphicsContext3D* context3D, 38 WebGraphicsContext3D* context3D,
33 WebCompositorSoftwareOutputDevice* software_device) 39 WebCompositorSoftwareOutputDevice* software_device)
34 : output_surface_filter_( 40 : output_surface_filter_(
35 RenderThreadImpl::current()->compositor_output_surface_filter()), 41 RenderThreadImpl::current()->compositor_output_surface_filter()),
36 client_(NULL), 42 client_(NULL),
37 routing_id_(routing_id), 43 routing_id_(routing_id),
38 context3D_(context3D), 44 context3D_(context3D),
39 software_device_(software_device) { 45 software_device_(software_device) {
40 DCHECK(output_surface_filter_); 46 DCHECK(output_surface_filter_);
41 capabilities_.hasParentCompositor = false; 47 CommandLine* command_line = CommandLine::ForCurrentProcess();
48 capabilities_.hasParentCompositor = command_line->HasSwitch(
49 switches::kEnableDelegatedRenderer);
42 DetachFromThread(); 50 DetachFromThread();
43 } 51 }
44 52
45 CompositorOutputSurface::~CompositorOutputSurface() { 53 CompositorOutputSurface::~CompositorOutputSurface() {
46 DCHECK(CalledOnValidThread()); 54 DCHECK(CalledOnValidThread());
47 if (!client_) 55 if (!client_)
48 return; 56 return;
49 output_surface_proxy_->ClearOutputSurface(); 57 output_surface_proxy_->ClearOutputSurface();
50 output_surface_filter_->RemoveRoute(routing_id_); 58 output_surface_filter_->RemoveRoute(routing_id_);
51 } 59 }
(...skipping 28 matching lines...) Expand all
80 DCHECK(CalledOnValidThread()); 88 DCHECK(CalledOnValidThread());
81 return context3D_.get(); 89 return context3D_.get();
82 } 90 }
83 91
84 WebCompositorSoftwareOutputDevice* CompositorOutputSurface::softwareDevice() 92 WebCompositorSoftwareOutputDevice* CompositorOutputSurface::softwareDevice()
85 const { 93 const {
86 return software_device_.get(); 94 return software_device_.get();
87 } 95 }
88 96
89 void CompositorOutputSurface::sendFrameToParentCompositor( 97 void CompositorOutputSurface::sendFrameToParentCompositor(
90 const WebKit::WebCompositorFrame&) { 98 const WebKit::WebCompositorFrame& frame) {
91 DCHECK(CalledOnValidThread()); 99 DCHECK(CalledOnValidThread());
92 NOTREACHED(); 100 Send(new ViewHostMsg_SwapCompositorFrame(routing_id_, frame));
93 } 101 }
94 102
95 void CompositorOutputSurface::OnMessageReceived(const IPC::Message& message) { 103 void CompositorOutputSurface::OnMessageReceived(const IPC::Message& message) {
96 DCHECK(CalledOnValidThread()); 104 DCHECK(CalledOnValidThread());
97 if (!client_) 105 if (!client_)
98 return; 106 return;
99 IPC_BEGIN_MESSAGE_MAP(CompositorOutputSurface, message) 107 IPC_BEGIN_MESSAGE_MAP(CompositorOutputSurface, message)
100 IPC_MESSAGE_HANDLER(ViewMsg_UpdateVSyncParameters, OnUpdateVSyncParameters); 108 IPC_MESSAGE_HANDLER(ViewMsg_UpdateVSyncParameters, OnUpdateVSyncParameters);
109 IPC_MESSAGE_HANDLER(ViewMsg_SwapCompositorFrameACK, OnSwapCompositorFrameACK );
101 IPC_END_MESSAGE_MAP() 110 IPC_END_MESSAGE_MAP()
102 } 111 }
103 112
104 void CompositorOutputSurface::OnUpdateVSyncParameters( 113 void CompositorOutputSurface::OnUpdateVSyncParameters(
105 base::TimeTicks timebase, 114 base::TimeTicks timebase,
106 base::TimeDelta interval) { 115 base::TimeDelta interval) {
107 DCHECK(CalledOnValidThread()); 116 DCHECK(CalledOnValidThread());
108 DCHECK(client_); 117 DCHECK(client_);
109 double monotonicTimebase = timebase.ToInternalValue() / 118 double monotonicTimebase = timebase.ToInternalValue() /
110 static_cast<double>(base::Time::kMicrosecondsPerSecond); 119 static_cast<double>(base::Time::kMicrosecondsPerSecond);
111 double intervalInSeconds = interval.ToInternalValue() / 120 double intervalInSeconds = interval.ToInternalValue() /
112 static_cast<double>(base::Time::kMicrosecondsPerSecond); 121 static_cast<double>(base::Time::kMicrosecondsPerSecond);
113 client_->onVSyncParametersChanged(monotonicTimebase, intervalInSeconds); 122 client_->onVSyncParametersChanged(monotonicTimebase, intervalInSeconds);
114 } 123 }
124
125 void CompositorOutputSurface::OnSwapCompositorFrameACK(
126 const WebKit::WebCompositorFrameAck& ack) {
127 client_->onSendFrameToParentCompositorAck(ack);
128 }
129
130 bool CompositorOutputSurface::Send(IPC::Message* message) {
131 return ChildThread::current()->sync_message_filter()->Send(message);
132 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698