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

Side by Side Diff: remoting/host/plugin/host_plugin.cc

Issue 10830016: Replace PluginMessageLoopProxy with PluginThreadTaskRunner. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
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 <stdio.h> 5 #include <stdio.h>
6 #include <string.h> 6 #include <string.h>
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/at_exit.h" 11 #include "base/at_exit.h"
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/stringize_macros.h" 14 #include "base/stringize_macros.h"
15 #include "net/socket/ssl_server_socket.h" 15 #include "net/socket/ssl_server_socket.h"
16 #include "remoting/base/plugin_message_loop_proxy.h" 16 #include "remoting/base/plugin_thread_task_runner.h"
17 #include "remoting/host/plugin/constants.h" 17 #include "remoting/host/plugin/constants.h"
18 #include "remoting/host/plugin/host_log_handler.h" 18 #include "remoting/host/plugin/host_log_handler.h"
19 #include "remoting/host/plugin/host_plugin_utils.h" 19 #include "remoting/host/plugin/host_plugin_utils.h"
20 #include "remoting/host/plugin/host_script_object.h" 20 #include "remoting/host/plugin/host_script_object.h"
21 #include "third_party/npapi/bindings/npapi.h" 21 #include "third_party/npapi/bindings/npapi.h"
22 #include "third_party/npapi/bindings/npfunctions.h" 22 #include "third_party/npapi/bindings/npfunctions.h"
23 #include "third_party/npapi/bindings/npruntime.h" 23 #include "third_party/npapi/bindings/npruntime.h"
24 24
25 // Symbol export is handled with a separate def file on Windows. 25 // Symbol export is handled with a separate def file on Windows.
26 #if defined (__GNUC__) && __GNUC__ >= 4 26 #if defined (__GNUC__) && __GNUC__ >= 4
(...skipping 23 matching lines...) Expand all
50 using remoting::HostNPScriptObject; 50 using remoting::HostNPScriptObject;
51 using remoting::StringFromNPIdentifier; 51 using remoting::StringFromNPIdentifier;
52 52
53 namespace { 53 namespace {
54 54
55 base::AtExitManager* g_at_exit_manager = NULL; 55 base::AtExitManager* g_at_exit_manager = NULL;
56 56
57 // NPAPI plugin implementation for remoting host. 57 // NPAPI plugin implementation for remoting host.
58 // Documentation for most of the calls in this class can be found here: 58 // Documentation for most of the calls in this class can be found here:
59 // https://developer.mozilla.org/en/Gecko_Plugin_API_Reference/Scripting_plugins 59 // https://developer.mozilla.org/en/Gecko_Plugin_API_Reference/Scripting_plugins
60 class HostNPPlugin : public remoting::PluginMessageLoopProxy::Delegate { 60 class HostNPPlugin : public remoting::PluginThreadTaskRunner::Delegate {
61 public: 61 public:
62 // |mode| is the display mode of plug-in. Values: 62 // |mode| is the display mode of plug-in. Values:
63 // NP_EMBED: (1) Instance was created by an EMBED tag and shares the browser 63 // NP_EMBED: (1) Instance was created by an EMBED tag and shares the browser
64 // window with other content. 64 // window with other content.
65 // NP_FULL: (2) Instance was created by a separate file and is the primary 65 // NP_FULL: (2) Instance was created by a separate file and is the primary
66 // content in the window. 66 // content in the window.
67 HostNPPlugin(NPP instance, uint16 mode) 67 HostNPPlugin(NPP instance, uint16 mode)
68 : instance_(instance), 68 : instance_(instance),
69 scriptable_object_(NULL) { 69 scriptable_object_(NULL) {
70 } 70 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 &RemoveProperty, 141 &RemoveProperty,
142 &Enumerate, 142 &Enumerate,
143 NULL 143 NULL
144 }; 144 };
145 scriptable_object_ = g_npnetscape_funcs->createobject(instance_, 145 scriptable_object_ = g_npnetscape_funcs->createobject(instance_,
146 &npc_ref_object); 146 &npc_ref_object);
147 } 147 }
148 return scriptable_object_; 148 return scriptable_object_;
149 } 149 }
150 150
151 // PluginMessageLoopProxy::Delegate implementation. 151 // PluginThreadTaskRunner::Delegate implementation.
152 virtual bool RunOnPluginThread( 152 virtual bool RunOnPluginThread(
153 base::TimeDelta delay, void(function)(void*), void* data) OVERRIDE { 153 base::TimeDelta delay, void(function)(void*), void* data) OVERRIDE {
154 if (delay == base::TimeDelta()) { 154 if (delay == base::TimeDelta()) {
155 g_npnetscape_funcs->pluginthreadasynccall(instance_, function, data); 155 g_npnetscape_funcs->pluginthreadasynccall(instance_, function, data);
156 } else { 156 } else {
157 base::AutoLock auto_lock(timers_lock_); 157 base::AutoLock auto_lock(timers_lock_);
158 uint32_t timer_id = g_npnetscape_funcs->scheduletimer( 158 uint32_t timer_id = g_npnetscape_funcs->scheduletimer(
159 instance_, delay.InMilliseconds(), false, &NPDelayedTaskSpringboard); 159 instance_, delay.InMilliseconds(), false, &NPDelayedTaskSpringboard);
160 DelayedTask task = {function, data}; 160 DelayedTask task = {function, data};
161 timers_[timer_id] = task; 161 timers_[timer_id] = task;
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 } 507 }
508 508
509 EXPORT NPError API_CALL NP_GetValue(void* npp, 509 EXPORT NPError API_CALL NP_GetValue(void* npp,
510 NPPVariable variable, 510 NPPVariable variable,
511 void* value) { 511 void* value) {
512 return GetValue((NPP)npp, variable, value); 512 return GetValue((NPP)npp, variable, value);
513 } 513 }
514 #endif 514 #endif
515 515
516 } // extern "C" 516 } // extern "C"
OLDNEW
« no previous file with comments | « remoting/client/plugin/pepper_plugin_thread_delegate.h ('k') | remoting/host/plugin/host_script_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698