| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CONTENT_RENDERER_PEPPER_V8OBJECT_VAR_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_V8OBJECT_VAR_H_ |
| 6 #define CONTENT_RENDERER_PEPPER_V8OBJECT_VAR_H_ | 6 #define CONTENT_RENDERER_PEPPER_V8OBJECT_VAR_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 // Represents a JavaScript object Var. By itself, this represents random | 24 // Represents a JavaScript object Var. By itself, this represents random |
| 25 // v8 objects that a given plugin (identified by the resource's module) wants to | 25 // v8 objects that a given plugin (identified by the resource's module) wants to |
| 26 // reference. If two different modules reference the same v8 object (like the | 26 // reference. If two different modules reference the same v8 object (like the |
| 27 // "window" object), then there will be different V8ObjectVar's (and hence | 27 // "window" object), then there will be different V8ObjectVar's (and hence |
| 28 // PP_Var IDs) for each module. This allows us to track all references owned by | 28 // PP_Var IDs) for each module. This allows us to track all references owned by |
| 29 // a given module and free them when the plugin exits independently of other | 29 // a given module and free them when the plugin exits independently of other |
| 30 // plugins that may be running at the same time. | 30 // plugins that may be running at the same time. |
| 31 class CONTENT_EXPORT V8ObjectVar : public Var { | 31 class CONTENT_EXPORT V8ObjectVar : public Var { |
| 32 public: | 32 public: |
| 33 V8ObjectVar(PP_Instance instance, v8::Handle<v8::Object> v8_object); | 33 V8ObjectVar(PP_Instance instance, v8::Local<v8::Object> v8_object); |
| 34 | 34 |
| 35 // Var overrides. | 35 // Var overrides. |
| 36 V8ObjectVar* AsV8ObjectVar() override; | 36 V8ObjectVar* AsV8ObjectVar() override; |
| 37 PP_VarType GetType() const override; | 37 PP_VarType GetType() const override; |
| 38 | 38 |
| 39 // Returns the underlying v8 object corresponding to this V8ObjectVar. This | 39 // Returns the underlying v8 object corresponding to this V8ObjectVar. This |
| 40 // should only be used on the stack. | 40 // should only be used on the stack. |
| 41 v8::Local<v8::Object> GetHandle() const; | 41 v8::Local<v8::Object> GetHandle() const; |
| 42 | 42 |
| 43 // Notification that the instance was deleted, the internal reference will be | 43 // Notification that the instance was deleted, the internal reference will be |
| (...skipping 13 matching lines...) Expand all Loading... |
| 57 content::PepperPluginInstanceImpl* instance_; | 57 content::PepperPluginInstanceImpl* instance_; |
| 58 | 58 |
| 59 v8::Persistent<v8::Object> v8_object_; | 59 v8::Persistent<v8::Object> v8_object_; |
| 60 | 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(V8ObjectVar); | 61 DISALLOW_COPY_AND_ASSIGN(V8ObjectVar); |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 } // ppapi | 64 } // ppapi |
| 65 | 65 |
| 66 #endif // CONTENT_RENDERER_PEPPER_V8OBJECT_VAR_H_ | 66 #endif // CONTENT_RENDERER_PEPPER_V8OBJECT_VAR_H_ |
| OLD | NEW |