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

Unified Diff: remoting/host/plugin/host_plugin.cc

Issue 7655006: Revert 97050 - Add PluginMessageLoopProxy and use it for Host plugin UI thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 4 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 | « remoting/host/host_mock_objects.cc ('k') | remoting/host/plugin/host_script_object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/plugin/host_plugin.cc
===================================================================
--- remoting/host/plugin/host_plugin.cc (revision 97052)
+++ remoting/host/plugin/host_plugin.cc (working copy)
@@ -12,7 +12,6 @@
#include "base/basictypes.h"
#include "base/logging.h"
#include "base/stringize_macros.h"
-#include "remoting/base/plugin_message_loop_proxy.h"
#include "remoting/host/plugin/host_plugin_utils.h"
#include "remoting/host/plugin/host_script_object.h"
#include "third_party/npapi/bindings/npapi.h"
@@ -59,7 +58,7 @@
// NPAPI plugin implementation for remoting host.
// Documentation for most of the calls in this class can be found here:
// https://developer.mozilla.org/en/Gecko_Plugin_API_Reference/Scripting_plugins
-class HostNPPlugin : public remoting::PluginMessageLoopProxy::Delegate {
+class HostNPPlugin {
public:
// |mode| is the display mode of plug-in. Values:
// NP_EMBED: (1) Instance was created by an EMBED tag and shares the browser
@@ -67,10 +66,7 @@
// NP_FULL: (2) Instance was created by a separate file and is the primary
// content in the window.
HostNPPlugin(NPP instance, uint16 mode)
- : instance_(instance),
- scriptable_object_(NULL),
- np_thread_id_(base::PlatformThread::CurrentId()) {
- }
+ : instance_(instance), scriptable_object_(NULL) {}
~HostNPPlugin() {
if (scriptable_object_) {
@@ -150,49 +146,11 @@
return scriptable_object_;
}
- // PluginMessageLoopProxy::Delegate implementation.
- virtual bool RunOnPluginThread(
- int delay_ms, void(function)(void*), void* data) OVERRIDE {
- if (delay_ms == 0) {
- g_npnetscape_funcs->pluginthreadasynccall(instance_, function, data);
- } else {
- base::AutoLock auto_lock(timers_lock_);
- uint32_t timer_id = g_npnetscape_funcs->scheduletimer(
- instance_, delay_ms, false, &NPDelayedTaskSpringboard);
- DelayedTask task = {function, data};
- timers_[timer_id] = task;
- }
- return true;
- }
-
- virtual bool IsPluginThread() OVERRIDE {
- return np_thread_id_ == base::PlatformThread::CurrentId();
- }
-
- static void NPDelayedTaskSpringboard(NPP npp, uint32_t timer_id) {
- HostNPPlugin* self = reinterpret_cast<HostNPPlugin*>(npp->pdata);
- DelayedTask task;
- {
- base::AutoLock auto_lock(self->timers_lock_);
- std::map<uint32_t, DelayedTask>::iterator it =
- self->timers_.find(timer_id);
- CHECK(it != self->timers_.end());
- task = it->second;
- self->timers_.erase(it);
- }
- task.function(task.data);
- }
-
private:
struct ScriptableNPObject : public NPObject {
HostNPScriptObject* scriptable_object;
};
- struct DelayedTask {
- void (*function)(void*);
- void* data;
- };
-
static HostNPScriptObject* ScriptableFromObject(NPObject* obj) {
return reinterpret_cast<ScriptableNPObject*>(obj)->scriptable_object;
}
@@ -202,11 +160,10 @@
ScriptableNPObject* object =
reinterpret_cast<ScriptableNPObject*>(
g_npnetscape_funcs->memalloc(sizeof(ScriptableNPObject)));
- HostNPPlugin* plugin = reinterpret_cast<HostNPPlugin*>(npp->pdata);
object->_class = aClass;
object->referenceCount = 1;
- object->scriptable_object = new HostNPScriptObject(npp, object, plugin);
+ object->scriptable_object = new HostNPScriptObject(npp, object);
if (!object->scriptable_object->Init()) {
Deallocate(object);
object = NULL;
@@ -333,10 +290,6 @@
NPP instance_;
NPObject* scriptable_object_;
-
- base::PlatformThreadId np_thread_id_;
- std::map<uint32_t, DelayedTask> timers_;
- base::Lock timers_lock_;
};
// Utility functions to map NPAPI Entry Points to C++ Objects.
« no previous file with comments | « remoting/host/host_mock_objects.cc ('k') | remoting/host/plugin/host_script_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698