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

Side by Side Diff: content/browser/browser_plugin/browser_plugin_guest.cc

Issue 10965017: Browser Plugin: Implement getProcessId (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed Nits Created 8 years, 3 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/browser/browser_plugin/browser_plugin_guest.h" 5 #include "content/browser/browser_plugin/browser_plugin_guest.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "content/browser/browser_plugin/browser_plugin_guest_helper.h" 9 #include "content/browser/browser_plugin/browser_plugin_guest_helper.h"
10 #include "content/browser/browser_plugin/browser_plugin_host_factory.h" 10 #include "content/browser/browser_plugin/browser_plugin_host_factory.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 size_t guest_damage_buffer_size = dib->size(); 122 size_t guest_damage_buffer_size = dib->size();
123 size_t embedder_damage_buffer_size = damage_buffer_->size(); 123 size_t embedder_damage_buffer_size = damage_buffer_->size();
124 #endif 124 #endif
125 void* guest_memory = dib->memory(); 125 void* guest_memory = dib->memory();
126 void* embedder_memory = damage_buffer_->memory(); 126 void* embedder_memory = damage_buffer_->memory();
127 size_t size = std::min(guest_damage_buffer_size, 127 size_t size = std::min(guest_damage_buffer_size,
128 embedder_damage_buffer_size); 128 embedder_damage_buffer_size);
129 memcpy(embedder_memory, guest_memory, size); 129 memcpy(embedder_memory, guest_memory, size);
130 } 130 }
131 } 131 }
132 DCHECK(embedder_render_process_host());
133 BrowserPluginMsg_UpdateRect_Params relay_params; 132 BrowserPluginMsg_UpdateRect_Params relay_params;
134 relay_params.bitmap_rect = params.bitmap_rect; 133 relay_params.bitmap_rect = params.bitmap_rect;
135 relay_params.dx = params.dx; 134 relay_params.dx = params.dx;
136 relay_params.dy = params.dy; 135 relay_params.dy = params.dy;
137 relay_params.scroll_rect = params.scroll_rect; 136 relay_params.scroll_rect = params.scroll_rect;
138 relay_params.copy_rects = params.copy_rects; 137 relay_params.copy_rects = params.copy_rects;
139 relay_params.view_size = params.view_size; 138 relay_params.view_size = params.view_size;
140 relay_params.scale_factor = params.scale_factor; 139 relay_params.scale_factor = params.scale_factor;
141 relay_params.is_resize_ack = ViewHostMsg_UpdateRect_Flags::is_resize_ack( 140 relay_params.is_resize_ack = ViewHostMsg_UpdateRect_Flags::is_resize_ack(
142 params.flags); 141 params.flags);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 // TODO(fsamuel): What do we need to do here? This is for keyboard shortcuts. 190 // TODO(fsamuel): What do we need to do here? This is for keyboard shortcuts.
192 if (input_event->type == WebKit::WebInputEvent::RawKeyDown) 191 if (input_event->type == WebKit::WebInputEvent::RawKeyDown)
193 message->WriteBool(false); 192 message->WriteBool(false);
194 bool sent = guest_rvh->Send(message); 193 bool sent = guest_rvh->Send(message);
195 if (!sent) { 194 if (!sent) {
196 // If the embedder is waiting for a previous input ack, a new input message 195 // If the embedder is waiting for a previous input ack, a new input message
197 // won't get sent to the guest. Reply immediately with handled = false so 196 // won't get sent to the guest. Reply immediately with handled = false so
198 // embedder doesn't hang. 197 // embedder doesn't hang.
199 BrowserPluginHostMsg_HandleInputEvent::WriteReplyParams( 198 BrowserPluginHostMsg_HandleInputEvent::WriteReplyParams(
200 reply_message, false /* handled */, cursor_); 199 reply_message, false /* handled */, cursor_);
201 embedder_render_process_host()->Send(reply_message); 200 SendMessageToEmbedder(reply_message);
202 return; 201 return;
203 } 202 }
204 203
205 pending_input_event_reply_.reset(reply_message); 204 pending_input_event_reply_.reset(reply_message);
206 // Input events are handled synchronously, meaning it blocks the embedder. We 205 // Input events are handled synchronously, meaning it blocks the embedder. We
207 // set a hang monitor here that will kill the guest process (5s timeout) if we 206 // set a hang monitor here that will kill the guest process (5s timeout) if we
208 // don't receive an ack. This will kill all the guests that are running in the 207 // don't receive an ack. This will kill all the guests that are running in the
209 // same process (undesired behavior). 208 // same process (undesired behavior).
210 // TODO(fsamuel,lazyboy): Find a way to get rid of guest process kill 209 // TODO(fsamuel,lazyboy): Find a way to get rid of guest process kill
211 // behavior. http://crbug.com/147272. 210 // behavior. http://crbug.com/147272.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 cursor_ = cursor; 243 cursor_ = cursor;
245 } 244 }
246 245
247 void BrowserPluginGuest::DidCommitProvisionalLoadForFrame( 246 void BrowserPluginGuest::DidCommitProvisionalLoadForFrame(
248 int64 frame_id, 247 int64 frame_id,
249 bool is_main_frame, 248 bool is_main_frame,
250 const GURL& url, 249 const GURL& url,
251 PageTransition transition_type, 250 PageTransition transition_type,
252 RenderViewHost* render_view_host) { 251 RenderViewHost* render_view_host) {
253 // Inform its embedder of the updated URL. 252 // Inform its embedder of the updated URL.
254 DCHECK(embedder_render_process_host());
255 if (is_main_frame) 253 if (is_main_frame)
256 SendMessageToEmbedder(new BrowserPluginMsg_DidNavigate(instance_id(), url)); 254 SendMessageToEmbedder(
255 new BrowserPluginMsg_DidNavigate(
256 instance_id(),
257 url,
258 render_view_host->GetProcess()->GetID()));
Charlie Reis 2012/09/21 00:24:06 Interesting that we're piggy-backing on navigation
Fady Samuel 2012/09/21 14:48:46 Each navigation has the potential to be to a new p
257 } 259 }
258 260
259 void BrowserPluginGuest::RenderViewGone(base::TerminationStatus status) { 261 void BrowserPluginGuest::RenderViewGone(base::TerminationStatus status) {
260 DCHECK(embedder_render_process_host());
261 if (pending_input_event_reply_.get()) { 262 if (pending_input_event_reply_.get()) {
262 IPC::Message* reply_message = pending_input_event_reply_.release(); 263 IPC::Message* reply_message = pending_input_event_reply_.release();
263 BrowserPluginHostMsg_HandleInputEvent::WriteReplyParams(reply_message, 264 BrowserPluginHostMsg_HandleInputEvent::WriteReplyParams(reply_message,
264 false, 265 false,
265 cursor_); 266 cursor_);
266 SendMessageToEmbedder(reply_message); 267 SendMessageToEmbedder(reply_message);
267 } 268 }
268 SendMessageToEmbedder(new BrowserPluginMsg_GuestCrashed(instance_id())); 269 SendMessageToEmbedder(new BrowserPluginMsg_GuestCrashed(instance_id()));
269 IDMap<RenderViewHost>::const_iterator iter(&pending_updates_); 270 IDMap<RenderViewHost>::const_iterator iter(&pending_updates_);
270 while (!iter.IsAtEnd()) { 271 while (!iter.IsAtEnd()) {
271 pending_updates_.Remove(iter.GetCurrentKey()); 272 pending_updates_.Remove(iter.GetCurrentKey());
272 iter.Advance(); 273 iter.Advance();
273 } 274 }
274 } 275 }
275 276
276 void BrowserPluginGuest::SendMessageToEmbedder(IPC::Message* msg) { 277 void BrowserPluginGuest::SendMessageToEmbedder(IPC::Message* msg) {
278 DCHECK(embedder_render_process_host());
277 embedder_render_process_host()->Send(msg); 279 embedder_render_process_host()->Send(msg);
278 } 280 }
279 281
280 } // namespace content 282 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/common/browser_plugin_messages.h » ('j') | content/renderer/browser_plugin/browser_plugin.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698