| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 PPAPI_PROXY_PLUGIN_VAR_TRACKER_H_ | 5 #ifndef PPAPI_PROXY_PLUGIN_VAR_TRACKER_H_ |
| 6 #define PPAPI_PROXY_PLUGIN_VAR_TRACKER_H_ | 6 #define PPAPI_PROXY_PLUGIN_VAR_TRACKER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // a single ref in the renderer process whenever we have a nonzero refcount | 23 // a single ref in the renderer process whenever we have a nonzero refcount |
| 24 // in the plugin process. This allows AddRef and Release to not initiate too | 24 // in the plugin process. This allows AddRef and Release to not initiate too |
| 25 // much IPC chat. | 25 // much IPC chat. |
| 26 class PluginVarTracker { | 26 class PluginVarTracker { |
| 27 public: | 27 public: |
| 28 // You must call Init() after creation to set up the correct interfaces. We | 28 // You must call Init() after creation to set up the correct interfaces. We |
| 29 // do this to avoid having to depend on the dispatcher in the constructor, | 29 // do this to avoid having to depend on the dispatcher in the constructor, |
| 30 // which is probably just being created from our constructor. | 30 // which is probably just being created from our constructor. |
| 31 PluginVarTracker(PluginDispatcher* dispatcher); | 31 PluginVarTracker(PluginDispatcher* dispatcher); |
| 32 | 32 |
| 33 ~PluginVarTracker(); |
| 34 |
| 33 // Must be called after construction. | 35 // Must be called after construction. |
| 34 void Init(); | 36 void Init(); |
| 35 | 37 |
| 36 // Allocates a string and returns the ID of it. The refcount will be 1. | 38 // Allocates a string and returns the ID of it. The refcount will be 1. |
| 37 int64_t MakeString(const std::string& str); | 39 int64_t MakeString(const std::string& str); |
| 38 | 40 |
| 39 // Returns the string associated with the given string var. The var must be | 41 // Returns the string associated with the given string var. The var must be |
| 40 // of type string and must be valid or this function will crash. | 42 // of type string and must be valid or this function will crash. |
| 41 std::string GetString(const PP_Var& var) const; | 43 std::string GetString(const PP_Var& var) const; |
| 42 | 44 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 62 // Tracks object references to the reference count of that object on the | 64 // Tracks object references to the reference count of that object on the |
| 63 // plugin side. | 65 // plugin side. |
| 64 typedef std::map<int64_t, int> ObjectRefCount; | 66 typedef std::map<int64_t, int> ObjectRefCount; |
| 65 ObjectRefCount object_ref_count_; | 67 ObjectRefCount object_ref_count_; |
| 66 }; | 68 }; |
| 67 | 69 |
| 68 } // namespace proxy | 70 } // namespace proxy |
| 69 } // namespace pp | 71 } // namespace pp |
| 70 | 72 |
| 71 #endif // PPAPI_PROXY_PLUGIN_VAR_TRACKER_H_ | 73 #endif // PPAPI_PROXY_PLUGIN_VAR_TRACKER_H_ |
| OLD | NEW |