| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef REMOTING_HOST_PLUGIN_HOST_SCRIPT_OBJECT_H_ | 5 #ifndef REMOTING_HOST_PLUGIN_HOST_SCRIPT_OBJECT_H_ |
| 6 #define REMOTING_HOST_PLUGIN_HOST_SCRIPT_OBJECT_H_ | 6 #define REMOTING_HOST_PLUGIN_HOST_SCRIPT_OBJECT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 // Helper functions that run on main thread. Can be called on any | 99 // Helper functions that run on main thread. Can be called on any |
| 100 // other thread. | 100 // other thread. |
| 101 void ConnectInternal(const std::string& uid, | 101 void ConnectInternal(const std::string& uid, |
| 102 const std::string& auth_token, | 102 const std::string& auth_token, |
| 103 const std::string& auth_service); | 103 const std::string& auth_service); |
| 104 void DisconnectInternal(); | 104 void DisconnectInternal(); |
| 105 | 105 |
| 106 // Callback for ChromotingHost::Shutdown(). | 106 // Callback for ChromotingHost::Shutdown(). |
| 107 void OnShutdownFinished(); | 107 void OnShutdownFinished(); |
| 108 | 108 |
| 109 // Call a JavaScript function wrapped as an NPObject. | 109 // Helper function for executing InvokeDefault on an NPObject, and ignoring |
| 110 // If result is non-null, the result of the call will be stored in it. | 110 // the return value. |
| 111 // Caller is responsible for releasing result if they ask for it. | 111 bool InvokeAndIgnoreResult(NPObject* func, |
| 112 static bool CallJSFunction(NPObject* func, | |
| 113 const NPVariant* args, | 112 const NPVariant* args, |
| 114 uint32_t argCount, | 113 uint32_t argCount); |
| 115 NPVariant* result); | |
| 116 | 114 |
| 117 // Posts a task on the main NP thread. | 115 // Posts a task on the main NP thread. |
| 118 void PostTaskToNPThread(const tracked_objects::Location& from_here, | 116 void PostTaskToNPThread(const tracked_objects::Location& from_here, |
| 119 Task* task); | 117 Task* task); |
| 120 | 118 |
| 121 // Utility function for PostTaskToNPThread. | 119 // Utility function for PostTaskToNPThread. |
| 122 static void NPTaskSpringboard(void* task); | 120 static void NPTaskSpringboard(void* task); |
| 123 | 121 |
| 124 // Set an exception for the current call. | 122 // Set an exception for the current call. |
| 125 void SetException(const std::string& exception_string); | 123 void SetException(const std::string& exception_string); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 140 | 138 |
| 141 base::WaitableEvent disconnected_event_; | 139 base::WaitableEvent disconnected_event_; |
| 142 base::CancellationFlag destructing_; | 140 base::CancellationFlag destructing_; |
| 143 }; | 141 }; |
| 144 | 142 |
| 145 } // namespace remoting | 143 } // namespace remoting |
| 146 | 144 |
| 147 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::HostNPScriptObject); | 145 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::HostNPScriptObject); |
| 148 | 146 |
| 149 #endif // REMOTING_HOST_HOST_SCRIPT_OBJECT_H_ | 147 #endif // REMOTING_HOST_HOST_SCRIPT_OBJECT_H_ |
| OLD | NEW |