| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright 2008 The Native Client Authors. All rights reserved. | |
| 3 * Use of this source code is governed by a BSD-style license that can | |
| 4 * be found in the LICENSE file. | |
| 5 */ | |
| 6 | |
| 7 | |
| 8 // The browser scriptable container class. The methods on this class | |
| 9 // are defined in the specific API directories. | |
| 10 | |
| 11 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SRPC_SCRIPTABLE_HANDLE_H_ | |
| 12 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SRPC_SCRIPTABLE_HANDLE_H_ | |
| 13 | |
| 14 #include "native_client/src/trusted/plugin/srpc/scriptable_handle.h" | |
| 15 | |
| 16 #include <stdio.h> | |
| 17 #include <string.h> | |
| 18 | |
| 19 #include <set> | |
| 20 | |
| 21 #include "native_client/src/include/checked_cast.h" | |
| 22 #include "native_client/src/include/nacl_macros.h" | |
| 23 #include "native_client/src/include/portability.h" | |
| 24 #include "native_client/src/trusted/plugin/srpc/utility.h" | |
| 25 | |
| 26 namespace plugin { | |
| 27 | |
| 28 // Forward declarations for externals. | |
| 29 class PortableHandle; | |
| 30 | |
| 31 // ScriptableHandle encapsulates objects that are scriptable from the browser. | |
| 32 class ScriptableHandle { | |
| 33 public: | |
| 34 // Check that a pointer is to a validly created ScriptableHandle. | |
| 35 static bool is_valid(const ScriptableHandle* handle); | |
| 36 | |
| 37 // Get the contained object. | |
| 38 PortableHandle* handle() const { return handle_; } | |
| 39 // Set the contained object. | |
| 40 void set_handle(PortableHandle* handle) { handle_ = handle; } | |
| 41 | |
| 42 // Add a browser reference to this object. | |
| 43 virtual ScriptableHandle* AddRef() = 0; | |
| 44 // Remove a browser reference to this object. | |
| 45 virtual void Unref() = 0; | |
| 46 | |
| 47 protected: | |
| 48 explicit ScriptableHandle(PortableHandle* handle); | |
| 49 virtual ~ScriptableHandle(); | |
| 50 | |
| 51 private: | |
| 52 NACL_DISALLOW_COPY_AND_ASSIGN(ScriptableHandle); | |
| 53 PortableHandle* handle_; | |
| 54 }; | |
| 55 | |
| 56 } // namespace plugin | |
| 57 | |
| 58 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_SRPC_SCRIPTABLE_HANDLE_H_ | |
| OLD | NEW |