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

Side by Side Diff: content/renderer/webplugin_delegate_proxy.cc

Issue 10081018: Revert 132218 - Convert plugin and GPU process to brokered handle duplication. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 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 | « content/renderer/render_thread_impl.cc ('k') | no next file » | 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/renderer/webplugin_delegate_proxy.h" 5 #include "content/renderer/webplugin_delegate_proxy.h"
6 6
7 #if defined(TOOLKIT_GTK) 7 #if defined(TOOLKIT_GTK)
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #elif defined(USE_X11) 9 #elif defined(USE_X11)
10 #include <cairo/cairo.h> 10 #include <cairo/cairo.h>
11 #endif 11 #endif
12 12
13 #include <algorithm> 13 #include <algorithm>
14 14
15 #include "base/basictypes.h" 15 #include "base/basictypes.h"
16 #include "base/command_line.h" 16 #include "base/command_line.h"
17 #include "base/file_util.h" 17 #include "base/file_util.h"
18 #include "base/logging.h" 18 #include "base/logging.h"
19 #include "base/memory/ref_counted.h" 19 #include "base/memory/ref_counted.h"
20 #include "base/memory/scoped_ptr.h" 20 #include "base/memory/scoped_ptr.h"
21 #include "base/process.h"
22 #include "base/string_split.h" 21 #include "base/string_split.h"
23 #include "base/string_util.h" 22 #include "base/string_util.h"
24 #include "base/utf_string_conversions.h" 23 #include "base/utf_string_conversions.h"
25 #include "base/version.h" 24 #include "base/version.h"
26 #include "content/common/child_process.h" 25 #include "content/common/child_process.h"
27 #include "content/common/npobject_proxy.h" 26 #include "content/common/npobject_proxy.h"
28 #include "content/common/npobject_stub.h" 27 #include "content/common/npobject_stub.h"
29 #include "content/common/npobject_util.h" 28 #include "content/common/npobject_util.h"
30 #include "content/common/plugin_messages.h" 29 #include "content/common/plugin_messages.h"
31 #include "content/common/view_messages.h" 30 #include "content/common/view_messages.h"
(...skipping 22 matching lines...) Expand all
54 #include "webkit/plugins/sad_plugin.h" 53 #include "webkit/plugins/sad_plugin.h"
55 54
56 #if defined(OS_POSIX) 55 #if defined(OS_POSIX)
57 #include "ipc/ipc_channel_posix.h" 56 #include "ipc/ipc_channel_posix.h"
58 #endif 57 #endif
59 58
60 #if defined(OS_MACOSX) 59 #if defined(OS_MACOSX)
61 #include "base/mac/mac_util.h" 60 #include "base/mac/mac_util.h"
62 #endif 61 #endif
63 62
64 #if defined(OS_WIN)
65 #include "content/common/sandbox_policy.h"
66 #endif
67
68 using WebKit::WebBindings; 63 using WebKit::WebBindings;
69 using WebKit::WebCursorInfo; 64 using WebKit::WebCursorInfo;
70 using WebKit::WebDragData; 65 using WebKit::WebDragData;
71 using WebKit::WebInputEvent; 66 using WebKit::WebInputEvent;
72 using WebKit::WebString; 67 using WebKit::WebString;
73 using WebKit::WebView; 68 using WebKit::WebView;
74 69
75 // Proxy for WebPluginResourceClient. The object owns itself after creation, 70 // Proxy for WebPluginResourceClient. The object owns itself after creation,
76 // deleting itself after its callback has been called. 71 // deleting itself after its callback has been called.
77 class ResourceClientProxy : public webkit::npapi::WebPluginResourceClient { 72 class ResourceClientProxy : public webkit::npapi::WebPluginResourceClient {
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 477
483 #if defined(OS_MACOSX) || defined(OS_WIN) 478 #if defined(OS_MACOSX) || defined(OS_WIN)
484 // Ensure that the renderer doesn't think the plugin still has focus. 479 // Ensure that the renderer doesn't think the plugin still has focus.
485 if (render_view_) 480 if (render_view_)
486 render_view_->PluginFocusChanged(false, instance_id_); 481 render_view_->PluginFocusChanged(false, instance_id_);
487 #endif 482 #endif
488 } 483 }
489 484
490 static void CopyTransportDIBHandleForMessage( 485 static void CopyTransportDIBHandleForMessage(
491 const TransportDIB::Handle& handle_in, 486 const TransportDIB::Handle& handle_in,
492 TransportDIB::Handle* handle_out, 487 TransportDIB::Handle* handle_out) {
493 base::ProcessId peer_pid) {
494 #if defined(OS_MACOSX) 488 #if defined(OS_MACOSX)
495 // On Mac, TransportDIB::Handle is typedef'ed to FileDescriptor, and 489 // On Mac, TransportDIB::Handle is typedef'ed to FileDescriptor, and
496 // FileDescriptor message fields needs to remain valid until the message is 490 // FileDescriptor message fields needs to remain valid until the message is
497 // sent or else the sendmsg() call will fail. 491 // sent or else the sendmsg() call will fail.
498 if ((handle_out->fd = HANDLE_EINTR(dup(handle_in.fd))) < 0) { 492 if ((handle_out->fd = HANDLE_EINTR(dup(handle_in.fd))) < 0) {
499 PLOG(ERROR) << "dup()"; 493 PLOG(ERROR) << "dup()";
500 return; 494 return;
501 } 495 }
502 handle_out->auto_close = true; 496 handle_out->auto_close = true;
503 #elif defined(OS_WIN)
504 // On Windows we need to duplicate the handle for the plugin process.
505 *handle_out = NULL;
506 sandbox::BrokerDuplicateHandle(handle_in, peer_pid, handle_out,
507 FILE_MAP_READ | FILE_MAP_WRITE, 0);
508 CHECK(*handle_out != NULL);
509 #else 497 #else
510 // Don't need to do anything special for other platforms. 498 // Don't need to do anything special for other platforms.
511 *handle_out = handle_in; 499 *handle_out = handle_in;
512 #endif 500 #endif
513 } 501 }
514 502
515 void WebPluginDelegateProxy::SendUpdateGeometry( 503 void WebPluginDelegateProxy::SendUpdateGeometry(
516 bool bitmaps_changed) { 504 bool bitmaps_changed) {
517 PluginMsg_UpdateGeometry_Param param; 505 PluginMsg_UpdateGeometry_Param param;
518 param.window_rect = plugin_rect_; 506 param.window_rect = plugin_rect_;
519 param.clip_rect = clip_rect_; 507 param.clip_rect = clip_rect_;
520 param.windowless_buffer0 = TransportDIB::DefaultHandleValue(); 508 param.windowless_buffer0 = TransportDIB::DefaultHandleValue();
521 param.windowless_buffer1 = TransportDIB::DefaultHandleValue(); 509 param.windowless_buffer1 = TransportDIB::DefaultHandleValue();
522 param.windowless_buffer_index = back_buffer_index(); 510 param.windowless_buffer_index = back_buffer_index();
523 param.background_buffer = TransportDIB::DefaultHandleValue(); 511 param.background_buffer = TransportDIB::DefaultHandleValue();
524 param.transparent = transparent_; 512 param.transparent = transparent_;
525 513
526 #if defined(OS_POSIX) 514 #if defined(OS_POSIX)
527 // If we're using POSIX mmap'd TransportDIBs, sending the handle across 515 // If we're using POSIX mmap'd TransportDIBs, sending the handle across
528 // IPC establishes a new mapping rather than just sending a window ID, 516 // IPC establishes a new mapping rather than just sending a window ID,
529 // so only do so if we've actually changed the shared memory bitmaps. 517 // so only do so if we've actually changed the shared memory bitmaps.
530 if (bitmaps_changed) 518 if (bitmaps_changed)
531 #endif 519 #endif
532 { 520 {
533 if (transport_stores_[0].dib.get()) 521 if (transport_stores_[0].dib.get())
534 CopyTransportDIBHandleForMessage(transport_stores_[0].dib->handle(), 522 CopyTransportDIBHandleForMessage(transport_stores_[0].dib->handle(),
535 &param.windowless_buffer0, 523 &param.windowless_buffer0);
536 channel_host_->peer_pid());
537 524
538 if (transport_stores_[1].dib.get()) 525 if (transport_stores_[1].dib.get())
539 CopyTransportDIBHandleForMessage(transport_stores_[1].dib->handle(), 526 CopyTransportDIBHandleForMessage(transport_stores_[1].dib->handle(),
540 &param.windowless_buffer1, 527 &param.windowless_buffer1);
541 channel_host_->peer_pid());
542 528
543 if (background_store_.dib.get()) 529 if (background_store_.dib.get())
544 CopyTransportDIBHandleForMessage(background_store_.dib->handle(), 530 CopyTransportDIBHandleForMessage(background_store_.dib->handle(),
545 &param.background_buffer, 531 &param.background_buffer);
546 channel_host_->peer_pid());
547 } 532 }
548 533
549 IPC::Message* msg; 534 IPC::Message* msg;
550 #if defined(OS_WIN) 535 #if defined(OS_WIN)
551 if (UseSynchronousGeometryUpdates()) { 536 if (UseSynchronousGeometryUpdates()) {
552 msg = new PluginMsg_UpdateGeometrySync(instance_id_, param); 537 msg = new PluginMsg_UpdateGeometrySync(instance_id_, param);
553 } else // NOLINT 538 } else // NOLINT
554 #endif 539 #endif
555 { 540 {
556 msg = new PluginMsg_UpdateGeometry(instance_id_, param); 541 msg = new PluginMsg_UpdateGeometry(instance_id_, param);
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after
1473 } 1458 }
1474 #endif 1459 #endif
1475 1460
1476 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, 1461 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow,
1477 int resource_id) { 1462 int resource_id) {
1478 if (!plugin_) 1463 if (!plugin_)
1479 return; 1464 return;
1480 1465
1481 plugin_->URLRedirectResponse(allow, resource_id); 1466 plugin_->URLRedirectResponse(allow, resource_id);
1482 } 1467 }
OLDNEW
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698