| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_V8_VAR_CONVERTER_H | 5 #ifndef CONTENT_RENDERER_PEPPER_V8_VAR_CONVERTER_H |
| 6 #define CONTENT_RENDERER_PEPPER_V8_VAR_CONVERTER_H | 6 #define CONTENT_RENDERER_PEPPER_V8_VAR_CONVERTER_H |
| 7 | 7 |
| 8 | |
| 9 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 10 #include "base/callback.h" | 9 #include "base/callback.h" |
| 11 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 12 #include "base/message_loop/message_loop_proxy.h" | 11 #include "base/message_loop/message_loop_proxy.h" |
| 13 #include "ppapi/c/pp_instance.h" | 12 #include "ppapi/c/pp_instance.h" |
| 14 #include "ppapi/c/pp_var.h" | 13 #include "ppapi/c/pp_var.h" |
| 15 #include "v8/include/v8.h" | 14 #include "v8/include/v8.h" |
| 16 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
| 17 | 16 |
| 18 namespace ppapi { | 17 namespace ppapi { |
| 19 class ScopedPPVar; | 18 class ScopedPPVar; |
| 20 } | 19 } |
| 21 | 20 |
| 22 namespace content { | 21 namespace content { |
| 23 | 22 |
| 24 class ResourceConverter; | 23 class ResourceConverter; |
| 25 | 24 |
| 26 class CONTENT_EXPORT V8VarConverter { | 25 class CONTENT_EXPORT V8VarConverter { |
| 27 public: | 26 public: |
| 28 explicit V8VarConverter(PP_Instance instance); | 27 explicit V8VarConverter(PP_Instance instance); |
| 29 // Constructor for testing. | 28 // Constructor for testing. |
| 30 V8VarConverter( | 29 V8VarConverter(PP_Instance instance, |
| 31 PP_Instance instance, | 30 scoped_ptr<ResourceConverter> resource_converter); |
| 32 scoped_ptr<ResourceConverter> resource_converter); | |
| 33 ~V8VarConverter(); | 31 ~V8VarConverter(); |
| 34 | 32 |
| 35 // Converts the given PP_Var to a v8::Value. True is returned upon success. | 33 // Converts the given PP_Var to a v8::Value. True is returned upon success. |
| 36 bool ToV8Value(const PP_Var& var, | 34 bool ToV8Value(const PP_Var& var, |
| 37 v8::Handle<v8::Context> context, | 35 v8::Handle<v8::Context> context, |
| 38 v8::Handle<v8::Value>* result); | 36 v8::Handle<v8::Value>* result); |
| 39 | 37 |
| 40 // Converts the given v8::Value to a PP_Var. Every PP_Var in the reference | 38 // Converts the given v8::Value to a PP_Var. Every PP_Var in the reference |
| 41 // graph in the result will have a refcount equal to the number of references | 39 // graph in the result will have a refcount equal to the number of references |
| 42 // to it in the graph. The root of the result will have one additional | 40 // to it in the graph. The root of the result will have one additional |
| (...skipping 12 matching lines...) Expand all Loading... |
| 55 | 53 |
| 56 // The converter to use for converting V8 vars to resources. | 54 // The converter to use for converting V8 vars to resources. |
| 57 scoped_ptr<ResourceConverter> resource_converter_; | 55 scoped_ptr<ResourceConverter> resource_converter_; |
| 58 | 56 |
| 59 DISALLOW_COPY_AND_ASSIGN(V8VarConverter); | 57 DISALLOW_COPY_AND_ASSIGN(V8VarConverter); |
| 60 }; | 58 }; |
| 61 | 59 |
| 62 } // namespace content | 60 } // namespace content |
| 63 | 61 |
| 64 #endif // CONTENT_RENDERER_PEPPER_V8_VAR_CONVERTER_H | 62 #endif // CONTENT_RENDERER_PEPPER_V8_VAR_CONVERTER_H |
| OLD | NEW |