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

Side by Side Diff: content/browser/frame_host/cross_process_frame_connector.cc

Issue 1094113003: Allow out-of-process iframes to render to compositing surfaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Destroy Surface when resetting id Created 5 years, 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/browser/frame_host/cross_process_frame_connector.h" 5 #include "content/browser/frame_host/cross_process_frame_connector.h"
6 6
7 #include "cc/surfaces/surface.h"
8 #include "cc/surfaces/surface_manager.h"
7 #include "content/browser/frame_host/render_frame_proxy_host.h" 9 #include "content/browser/frame_host/render_frame_proxy_host.h"
8 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" 10 #include "content/browser/frame_host/render_widget_host_view_child_frame.h"
9 #include "content/browser/renderer_host/render_view_host_impl.h" 11 #include "content/browser/renderer_host/render_view_host_impl.h"
10 #include "content/browser/renderer_host/render_widget_host_impl.h" 12 #include "content/browser/renderer_host/render_widget_host_impl.h"
11 #include "content/common/frame_messages.h" 13 #include "content/common/frame_messages.h"
12 #include "content/common/gpu/gpu_messages.h" 14 #include "content/common/gpu/gpu_messages.h"
13 #include "third_party/WebKit/public/web/WebInputEvent.h" 15 #include "third_party/WebKit/public/web/WebInputEvent.h"
14 16
15 namespace content { 17 namespace content {
16 18
(...skipping 13 matching lines...) Expand all
30 bool handled = true; 32 bool handled = true;
31 33
32 IPC_BEGIN_MESSAGE_MAP(CrossProcessFrameConnector, msg) 34 IPC_BEGIN_MESSAGE_MAP(CrossProcessFrameConnector, msg)
33 IPC_MESSAGE_HANDLER(FrameHostMsg_CompositorFrameSwappedACK, 35 IPC_MESSAGE_HANDLER(FrameHostMsg_CompositorFrameSwappedACK,
34 OnCompositorFrameSwappedACK) 36 OnCompositorFrameSwappedACK)
35 IPC_MESSAGE_HANDLER(FrameHostMsg_ReclaimCompositorResources, 37 IPC_MESSAGE_HANDLER(FrameHostMsg_ReclaimCompositorResources,
36 OnReclaimCompositorResources) 38 OnReclaimCompositorResources)
37 IPC_MESSAGE_HANDLER(FrameHostMsg_ForwardInputEvent, OnForwardInputEvent) 39 IPC_MESSAGE_HANDLER(FrameHostMsg_ForwardInputEvent, OnForwardInputEvent)
38 IPC_MESSAGE_HANDLER(FrameHostMsg_InitializeChildFrame, 40 IPC_MESSAGE_HANDLER(FrameHostMsg_InitializeChildFrame,
39 OnInitializeChildFrame) 41 OnInitializeChildFrame)
42 IPC_MESSAGE_HANDLER(FrameHostMsg_SatisfySequence, OnSatisfySequence)
43 IPC_MESSAGE_HANDLER(FrameHostMsg_RequireSequence, OnRequireSequence)
40 IPC_MESSAGE_UNHANDLED(handled = false) 44 IPC_MESSAGE_UNHANDLED(handled = false)
41 IPC_END_MESSAGE_MAP() 45 IPC_END_MESSAGE_MAP()
42 46
43 return handled; 47 return handled;
44 } 48 }
45 49
46 void CrossProcessFrameConnector::set_view( 50 void CrossProcessFrameConnector::set_view(
47 RenderWidgetHostViewChildFrame* view) { 51 RenderWidgetHostViewChildFrame* view) {
48 // Detach ourselves from the previous |view_|. 52 // Detach ourselves from the previous |view_|.
49 if (view_) 53 if (view_)
(...skipping 21 matching lines...) Expand all
71 scoped_ptr<cc::CompositorFrame> frame) { 75 scoped_ptr<cc::CompositorFrame> frame) {
72 FrameMsg_CompositorFrameSwapped_Params params; 76 FrameMsg_CompositorFrameSwapped_Params params;
73 frame->AssignTo(&params.frame); 77 frame->AssignTo(&params.frame);
74 params.output_surface_id = output_surface_id; 78 params.output_surface_id = output_surface_id;
75 params.producing_route_id = route_id; 79 params.producing_route_id = route_id;
76 params.producing_host_id = host_id; 80 params.producing_host_id = host_id;
77 frame_proxy_in_parent_renderer_->Send(new FrameMsg_CompositorFrameSwapped( 81 frame_proxy_in_parent_renderer_->Send(new FrameMsg_CompositorFrameSwapped(
78 frame_proxy_in_parent_renderer_->GetRoutingID(), params)); 82 frame_proxy_in_parent_renderer_->GetRoutingID(), params));
79 } 83 }
80 84
85 void CrossProcessFrameConnector::SetChildFrameSurface(
86 cc::SurfaceId& surface_id,
87 gfx::Size frame_size,
88 float scale_factor,
89 cc::SurfaceSequence& sequence) {
90 frame_proxy_in_parent_renderer_->Send(new FrameMsg_SetChildFrameSurface(
91 frame_proxy_in_parent_renderer_->GetRoutingID(), surface_id, frame_size,
92 scale_factor, sequence));
93 }
94
95 void CrossProcessFrameConnector::OnSatisfySequence(
96 const cc::SurfaceSequence& sequence) {
97 #if !defined(OS_ANDROID)
98 std::vector<uint32_t> sequences;
99 sequences.push_back(sequence.sequence);
100 cc::SurfaceManager* manager =
101 ImageTransportFactory::GetInstance()->GetSurfaceManager();
102 manager->DidSatisfySequences(sequence.id_namespace, &sequences);
103 #endif
104 }
105
106 void CrossProcessFrameConnector::OnRequireSequence(
107 const cc::SurfaceId& id,
108 const cc::SurfaceSequence& sequence) {
109 #if !defined(OS_ANDROID)
110 cc::SurfaceManager* manager =
111 ImageTransportFactory::GetInstance()->GetSurfaceManager();
112 cc::Surface* surface = manager->GetSurfaceForId(id);
113 if (!surface) {
114 LOG(ERROR) << "Attempting to require callback on nonexistent surface";
115 return;
116 }
117 surface->AddDestructionDependency(sequence);
118 #endif
119 }
120
81 void CrossProcessFrameConnector::OnCompositorFrameSwappedACK( 121 void CrossProcessFrameConnector::OnCompositorFrameSwappedACK(
82 const FrameHostMsg_CompositorFrameSwappedACK_Params& params) { 122 const FrameHostMsg_CompositorFrameSwappedACK_Params& params) {
83 RenderWidgetHostImpl::SendSwapCompositorFrameAck(params.producing_route_id, 123 RenderWidgetHostImpl::SendSwapCompositorFrameAck(params.producing_route_id,
84 params.output_surface_id, 124 params.output_surface_id,
85 params.producing_host_id, 125 params.producing_host_id,
86 params.ack); 126 params.ack);
87 } 127 }
88 128
89 void CrossProcessFrameConnector::OnReclaimCompositorResources( 129 void CrossProcessFrameConnector::OnReclaimCompositorResources(
90 const FrameHostMsg_ReclaimCompositorResources_Params& params) { 130 const FrameHostMsg_ReclaimCompositorResources_Params& params) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 } 189 }
150 } 190 }
151 191
152 void CrossProcessFrameConnector::SetSize(gfx::Rect frame_rect) { 192 void CrossProcessFrameConnector::SetSize(gfx::Rect frame_rect) {
153 child_frame_rect_ = frame_rect; 193 child_frame_rect_ = frame_rect;
154 if (view_) 194 if (view_)
155 view_->SetSize(frame_rect.size()); 195 view_->SetSize(frame_rect.size());
156 } 196 }
157 197
158 } // namespace content 198 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698