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

Side by Side Diff: webkit/plugins/ppapi/plugin_module.cc

Issue 10625007: Revert 143656 - Add an IPC channel between the NaCl loader process and the renderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « webkit/plugins/ppapi/plugin_module.h ('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 "webkit/plugins/ppapi/plugin_module.h" 5 #include "webkit/plugins/ppapi/plugin_module.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 const FilePath& path, 412 const FilePath& path,
413 PluginDelegate::ModuleLifetime* lifetime_delegate) 413 PluginDelegate::ModuleLifetime* lifetime_delegate)
414 : lifetime_delegate_(lifetime_delegate), 414 : lifetime_delegate_(lifetime_delegate),
415 callback_tracker_(new ::ppapi::CallbackTracker), 415 callback_tracker_(new ::ppapi::CallbackTracker),
416 is_in_destructor_(false), 416 is_in_destructor_(false),
417 is_crashed_(false), 417 is_crashed_(false),
418 broker_(NULL), 418 broker_(NULL),
419 library_(NULL), 419 library_(NULL),
420 name_(name), 420 name_(name),
421 path_(path), 421 path_(path),
422 reserve_instance_id_(NULL), 422 reserve_instance_id_(NULL) {
423 nacl_ipc_proxy_(false) {
424 // Ensure the globals object is created. 423 // Ensure the globals object is created.
425 if (!host_globals) 424 if (!host_globals)
426 host_globals = new HostGlobals; 425 host_globals = new HostGlobals;
427 426
428 memset(&entry_points_, 0, sizeof(entry_points_)); 427 memset(&entry_points_, 0, sizeof(entry_points_));
429 pp_module_ = HostGlobals::Get()->AddModule(this); 428 pp_module_ = HostGlobals::Get()->AddModule(this);
430 GetMainThreadMessageLoop(); // Initialize the main thread message loop. 429 GetMainThreadMessageLoop(); // Initialize the main thread message loop.
431 GetLivePluginSet()->insert(this); 430 GetLivePluginSet()->insert(this);
432 } 431 }
433 432
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 return true; 489 return true;
491 } 490 }
492 491
493 void PluginModule::InitAsProxied( 492 void PluginModule::InitAsProxied(
494 PluginDelegate::OutOfProcessProxy* out_of_process_proxy) { 493 PluginDelegate::OutOfProcessProxy* out_of_process_proxy) {
495 DCHECK(!out_of_process_proxy_.get()); 494 DCHECK(!out_of_process_proxy_.get());
496 out_of_process_proxy_.reset(out_of_process_proxy); 495 out_of_process_proxy_.reset(out_of_process_proxy);
497 } 496 }
498 497
499 void PluginModule::InitAsProxiedNaCl( 498 void PluginModule::InitAsProxiedNaCl(
500 scoped_ptr<PluginDelegate::OutOfProcessProxy> out_of_process_proxy, 499 PluginDelegate::OutOfProcessProxy* out_of_process_proxy,
501 PP_Instance instance) { 500 PP_Instance instance) {
502 // TODO(bbudge) We need to switch the mode of the PluginModule on a 501 InitAsProxied(out_of_process_proxy);
503 // per-instance basis. Fix this so out_of_process_proxy and other
504 // state is stored in a map, indexed by instance.
505 nacl_ipc_proxy_ = true;
506 InitAsProxied(out_of_process_proxy.release());
507 // InitAsProxied (for the trusted/out-of-process case) initializes only the 502 // InitAsProxied (for the trusted/out-of-process case) initializes only the
508 // module, and one or more instances are added later. In this case, the 503 // module, and one or more instances are added later. In this case, the
509 // PluginInstance was already created as in-process, so we missed the proxy 504 // PluginInstance was already created as in-process, so we missed the proxy
510 // AddInstance step and must do it now. 505 // AddInstance step and must do it now.
511 out_of_process_proxy_->AddInstance(instance); 506 out_of_process_proxy_->AddInstance(instance);
512 507
513 // In NaCl, we need to tell the instance to reset itself as proxied. This will 508 // In NaCl, we need to tell the instance to reset itself as proxied. This will
514 // clear cached interface pointers and send DidCreate (etc) to the plugin 509 // clear cached interface pointers and send DidCreate (etc) to the plugin
515 // side of the proxy. 510 // side of the proxy.
516 PluginInstance* plugin_instance = host_globals->GetInstance(instance); 511 PluginInstance* plugin_instance = host_globals->GetInstance(instance);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 } 553 }
559 554
560 void PluginModule::InstanceCreated(PluginInstance* instance) { 555 void PluginModule::InstanceCreated(PluginInstance* instance) {
561 instances_.insert(instance); 556 instances_.insert(instance);
562 } 557 }
563 558
564 void PluginModule::InstanceDeleted(PluginInstance* instance) { 559 void PluginModule::InstanceDeleted(PluginInstance* instance) {
565 if (out_of_process_proxy_.get()) 560 if (out_of_process_proxy_.get())
566 out_of_process_proxy_->RemoveInstance(instance->pp_instance()); 561 out_of_process_proxy_->RemoveInstance(instance->pp_instance());
567 instances_.erase(instance); 562 instances_.erase(instance);
568
569 if (nacl_ipc_proxy_) {
570 out_of_process_proxy_.reset();
571 reserve_instance_id_ = NULL;
572 }
573 } 563 }
574 564
575 scoped_refptr< ::ppapi::CallbackTracker> PluginModule::GetCallbackTracker() { 565 scoped_refptr< ::ppapi::CallbackTracker> PluginModule::GetCallbackTracker() {
576 return callback_tracker_; 566 return callback_tracker_;
577 } 567 }
578 568
579 void PluginModule::PluginCrashed() { 569 void PluginModule::PluginCrashed() {
580 DCHECK(!is_crashed_); // Should only get one notification. 570 DCHECK(!is_crashed_); // Should only get one notification.
581 is_crashed_ = true; 571 is_crashed_ = true;
582 572
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 int retval = entry_points.initialize_module(pp_module(), &GetInterface); 606 int retval = entry_points.initialize_module(pp_module(), &GetInterface);
617 if (retval != 0) { 607 if (retval != 0) {
618 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval; 608 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval;
619 return false; 609 return false;
620 } 610 }
621 return true; 611 return true;
622 } 612 }
623 613
624 } // namespace ppapi 614 } // namespace ppapi
625 } // namespace webkit 615 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/plugin_module.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698