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

Side by Side Diff: chrome/plugin/webplugin_delegate_stub.cc

Issue 10895: Add Terminate() to the Process object, have RenderProcessHost use this to avo... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 1 month 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 | « chrome/plugin/webplugin_delegate_stub.h ('k') | chrome/plugin/webplugin_proxy.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "chrome/plugin/webplugin_delegate_stub.h" 5 #include "chrome/plugin/webplugin_delegate_stub.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/time.h" 8 #include "base/time.h"
9 #include "base/gfx/platform_device_win.h" 9 #include "base/gfx/platform_device_win.h"
10 #include "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 gfx::PlatformDeviceWin::InitializeDC(hdc); 219 gfx::PlatformDeviceWin::InitializeDC(hdc);
220 delegate_->Print(hdc); 220 delegate_->Print(hdc);
221 if (!emf.CloseDc()) { 221 if (!emf.CloseDc()) {
222 NOTREACHED(); 222 NOTREACHED();
223 return; 223 return;
224 } 224 }
225 225
226 size_t size = emf.GetDataSize(); 226 size_t size = emf.GetDataSize();
227 DCHECK(size); 227 DCHECK(size);
228 params->size = size; 228 params->size = size;
229 SharedMemory shared_buf; 229 base::SharedMemory shared_buf;
230 CreateSharedBuffer(size, &shared_buf, &params->shared_memory); 230 CreateSharedBuffer(size, &shared_buf, &params->shared_memory);
231 231
232 // Retrieve a copy of the data. 232 // Retrieve a copy of the data.
233 bool success = emf.GetData(shared_buf.memory(), size); 233 bool success = emf.GetData(shared_buf.memory(), size);
234 DCHECK(success); 234 DCHECK(success);
235 } 235 }
236 236
237 void WebPluginDelegateStub::OnUpdateGeometry( 237 void WebPluginDelegateStub::OnUpdateGeometry(
238 const gfx::Rect& window_rect, 238 const gfx::Rect& window_rect,
239 const gfx::Rect& clip_rect, 239 const gfx::Rect& clip_rect,
240 const std::vector<gfx::Rect>& cutout_rects, 240 const std::vector<gfx::Rect>& cutout_rects,
241 bool visible, 241 bool visible,
242 const SharedMemoryHandle& windowless_buffer, 242 const base::SharedMemoryHandle& windowless_buffer,
243 const SharedMemoryHandle& background_buffer) { 243 const base::SharedMemoryHandle& background_buffer) {
244 webplugin_->UpdateGeometry( 244 webplugin_->UpdateGeometry(
245 window_rect, clip_rect, cutout_rects, visible, windowless_buffer, 245 window_rect, clip_rect, cutout_rects, visible, windowless_buffer,
246 background_buffer); 246 background_buffer);
247 } 247 }
248 248
249 void WebPluginDelegateStub::OnGetPluginScriptableObject(int* route_id, 249 void WebPluginDelegateStub::OnGetPluginScriptableObject(int* route_id,
250 void** npobject_ptr) { 250 void** npobject_ptr) {
251 NPObject* object = delegate_->GetPluginScriptableObject(); 251 NPObject* object = delegate_->GetPluginScriptableObject();
252 if (!object) { 252 if (!object) {
253 *route_id = MSG_ROUTING_NONE; 253 *route_id = MSG_ROUTING_NONE;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 void WebPluginDelegateStub::OnDidManualLoadFail() { 294 void WebPluginDelegateStub::OnDidManualLoadFail() {
295 delegate_->DidManualLoadFail(); 295 delegate_->DidManualLoadFail();
296 } 296 }
297 297
298 void WebPluginDelegateStub::OnInstallMissingPlugin() { 298 void WebPluginDelegateStub::OnInstallMissingPlugin() {
299 delegate_->InstallMissingPlugin(); 299 delegate_->InstallMissingPlugin();
300 } 300 }
301 301
302 void WebPluginDelegateStub::CreateSharedBuffer( 302 void WebPluginDelegateStub::CreateSharedBuffer(
303 size_t size, 303 size_t size,
304 SharedMemory* shared_buf, 304 base::SharedMemory* shared_buf,
305 SharedMemoryHandle* remote_handle) { 305 base::SharedMemoryHandle* remote_handle) {
306 if (!shared_buf->Create(std::wstring(), false, false, size)) { 306 if (!shared_buf->Create(std::wstring(), false, false, size)) {
307 NOTREACHED(); 307 NOTREACHED();
308 return; 308 return;
309 } 309 }
310 if (!shared_buf->Map(size)) { 310 if (!shared_buf->Map(size)) {
311 NOTREACHED(); 311 NOTREACHED();
312 shared_buf->Close(); 312 shared_buf->Close();
313 return; 313 return;
314 } 314 }
315 315
316 BOOL result = DuplicateHandle(GetCurrentProcess(), 316 BOOL result = DuplicateHandle(GetCurrentProcess(),
317 shared_buf->handle(), 317 shared_buf->handle(),
318 channel_->renderer_handle(), 318 channel_->renderer_handle(),
319 remote_handle, 0, FALSE, 319 remote_handle, 0, FALSE,
320 DUPLICATE_SAME_ACCESS); 320 DUPLICATE_SAME_ACCESS);
321 DCHECK_NE(result, 0); 321 DCHECK_NE(result, 0);
322
322 // If the calling function's shared_buf is on the stack, its destructor will 323 // If the calling function's shared_buf is on the stack, its destructor will
323 // close the shared memory buffer handle. This is fine since we already 324 // close the shared memory buffer handle. This is fine since we already
324 // duplicated the handle to the renderer process so it will stay "alive". 325 // duplicated the handle to the renderer process so it will stay "alive".
325 } 326 }
326 327
327 void WebPluginDelegateStub::OnHandleURLRequestReply( 328 void WebPluginDelegateStub::OnHandleURLRequestReply(
328 const PluginMsg_URLRequestReply_Params& params) { 329 const PluginMsg_URLRequestReply_Params& params) {
329 WebPluginResourceClient* resource_client = 330 WebPluginResourceClient* resource_client =
330 delegate_->CreateResourceClient(params.resource_id, params.url, 331 delegate_->CreateResourceClient(params.resource_id, params.url,
331 params.notify_needed, 332 params.notify_needed,
332 params.notify_data, 333 params.notify_data,
333 params.stream); 334 params.stream);
334 webplugin_->OnResourceCreated(params.resource_id, resource_client); 335 webplugin_->OnResourceCreated(params.resource_id, resource_client);
335 } 336 }
336 337
337 void WebPluginDelegateStub::OnURLRequestRouted(const std::string& url, 338 void WebPluginDelegateStub::OnURLRequestRouted(const std::string& url,
338 bool notify_needed, 339 bool notify_needed,
339 HANDLE notify_data) { 340 HANDLE notify_data) {
340 delegate_->URLRequestRouted(url, notify_needed, notify_data); 341 delegate_->URLRequestRouted(url, notify_needed, notify_data);
341 } 342 }
342 343
OLDNEW
« no previous file with comments | « chrome/plugin/webplugin_delegate_stub.h ('k') | chrome/plugin/webplugin_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698