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

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: Merged with ToT 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
« no previous file with comments | « no previous file | content/common/browser_plugin_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 cursor_ = cursor; 254 cursor_ = cursor;
256 } 255 }
257 256
258 void BrowserPluginGuest::DidCommitProvisionalLoadForFrame( 257 void BrowserPluginGuest::DidCommitProvisionalLoadForFrame(
259 int64 frame_id, 258 int64 frame_id,
260 bool is_main_frame, 259 bool is_main_frame,
261 const GURL& url, 260 const GURL& url,
262 PageTransition transition_type, 261 PageTransition transition_type,
263 RenderViewHost* render_view_host) { 262 RenderViewHost* render_view_host) {
264 // Inform its embedder of the updated URL. 263 // Inform its embedder of the updated URL.
265 DCHECK(embedder_render_process_host());
266 if (is_main_frame) 264 if (is_main_frame)
267 SendMessageToEmbedder(new BrowserPluginMsg_DidNavigate(instance_id(), url)); 265 SendMessageToEmbedder(
266 new BrowserPluginMsg_DidNavigate(
267 instance_id(),
268 url,
269 render_view_host->GetProcess()->GetID()));
268 } 270 }
269 271
270 void BrowserPluginGuest::RenderViewGone(base::TerminationStatus status) { 272 void BrowserPluginGuest::RenderViewGone(base::TerminationStatus status) {
271 DCHECK(embedder_render_process_host());
272 if (pending_input_event_reply_.get()) { 273 if (pending_input_event_reply_.get()) {
273 IPC::Message* reply_message = pending_input_event_reply_.release(); 274 IPC::Message* reply_message = pending_input_event_reply_.release();
274 BrowserPluginHostMsg_HandleInputEvent::WriteReplyParams(reply_message, 275 BrowserPluginHostMsg_HandleInputEvent::WriteReplyParams(reply_message,
275 false, 276 false,
276 cursor_); 277 cursor_);
277 SendMessageToEmbedder(reply_message); 278 SendMessageToEmbedder(reply_message);
278 } 279 }
279 SendMessageToEmbedder(new BrowserPluginMsg_GuestCrashed(instance_id())); 280 SendMessageToEmbedder(new BrowserPluginMsg_GuestCrashed(instance_id()));
280 IDMap<RenderViewHost>::const_iterator iter(&pending_updates_); 281 IDMap<RenderViewHost>::const_iterator iter(&pending_updates_);
281 while (!iter.IsAtEnd()) { 282 while (!iter.IsAtEnd()) {
282 pending_updates_.Remove(iter.GetCurrentKey()); 283 pending_updates_.Remove(iter.GetCurrentKey());
283 iter.Advance(); 284 iter.Advance();
284 } 285 }
285 } 286 }
286 287
287 void BrowserPluginGuest::SendMessageToEmbedder(IPC::Message* msg) { 288 void BrowserPluginGuest::SendMessageToEmbedder(IPC::Message* msg) {
289 DCHECK(embedder_render_process_host());
288 embedder_render_process_host()->Send(msg); 290 embedder_render_process_host()->Send(msg);
289 } 291 }
290 292
291 } // namespace content 293 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/common/browser_plugin_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698