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

Unified Diff: webkit/plugins/ppapi/plugin_module.cc

Issue 8344025: Add a new globals object for PPAPI tracking information. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/plugins/ppapi/npobject_var.cc ('k') | webkit/plugins/ppapi/plugin_object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/ppapi/plugin_module.cc
===================================================================
--- webkit/plugins/ppapi/plugin_module.cc (revision 106515)
+++ webkit/plugins/ppapi/plugin_module.cc (working copy)
@@ -90,6 +90,7 @@
#include "webkit/plugins/plugin_switches.h"
#include "webkit/plugins/ppapi/callbacks.h"
#include "webkit/plugins/ppapi/common.h"
+#include "webkit/plugins/ppapi/host_globals.h"
#include "webkit/plugins/ppapi/ppapi_interface_factory.h"
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
#include "webkit/plugins/ppapi/ppb_directory_reader_impl.h"
@@ -114,6 +115,7 @@
#include "webkit/plugins/ppapi/resource_tracker.h"
#include "webkit/plugins/ppapi/webkit_forwarding_impl.h"
+using ppapi::PpapiGlobals;
using ppapi::TimeTicksToPPTimeTicks;
using ppapi::TimeToPPTime;
using ppapi::thunk::EnterResource;
@@ -124,6 +126,14 @@
namespace {
+// Global tracking info for PPAPI plugins. This is lazily created before the
+// first plugin is allocated, and leaked on shutdown.
+//
+// Note that we don't want a Singleton here since destroying this object will
+// try to free some stuff that requires WebKit, and Singletons are destroyed
+// after WebKit.
+webkit::ppapi::HostGlobals* host_globals = NULL;
+
// Maintains all currently loaded plugin libs for validating PP_Module
// identifiers.
typedef std::set<PluginModule*> PluginModuleSet;
@@ -142,11 +152,11 @@
// PPB_Core --------------------------------------------------------------------
void AddRefResource(PP_Resource resource) {
- ResourceTracker::Get()->AddRefResource(resource);
+ PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(resource);
}
void ReleaseResource(PP_Resource resource) {
- ResourceTracker::Get()->ReleaseResource(resource);
+ PpapiGlobals::Get()->GetResourceTracker()->ReleaseResource(resource);
}
PP_Time GetTime() {
@@ -205,7 +215,8 @@
}
uint32_t GetLiveObjectsForInstance(PP_Instance instance_id) {
- return ResourceTracker::Get()->GetLiveObjectsForInstance(instance_id);
+ return HostGlobals::Get()->host_resource_tracker()->GetLiveObjectsForInstance(
+ instance_id);
}
PP_Bool IsOutOfProcess() {
@@ -371,8 +382,12 @@
name_(name),
path_(path),
reserve_instance_id_(NULL) {
+ // Ensure the globals object is created.
+ if (!host_globals)
+ host_globals = new HostGlobals;
+
memset(&entry_points_, 0, sizeof(entry_points_));
- pp_module_ = ResourceTracker::Get()->AddModule(this);
+ pp_module_ = HostGlobals::Get()->host_resource_tracker()->AddModule(this);
GetMainThreadMessageLoop(); // Initialize the main thread message loop.
GetLivePluginSet()->insert(this);
}
@@ -398,7 +413,7 @@
base::UnloadNativeLibrary(library_);
// Notifications that we've been deleted should be last.
- ResourceTracker::Get()->ModuleDeleted(pp_module_);
+ HostGlobals::Get()->host_resource_tracker()->ModuleDeleted(pp_module_);
if (!is_crashed_) {
// When the plugin crashes, we immediately tell the lifetime delegate that
// we're gone, so we don't want to tell it again.
Property changes on: webkit/plugins/ppapi/plugin_module.cc
___________________________________________________________________
Deleted: svn:mergeinfo
Reverse-merged /branches/chrome_webkit_merge_branch/src/webkit/plugins/ppapi/plugin_module.cc:r3734-4217,4606-5108,5177-5263
« no previous file with comments | « webkit/plugins/ppapi/npobject_var.cc ('k') | webkit/plugins/ppapi/plugin_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698