Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(434)

Side by Side Diff: content/renderer/pepper/v8_var_converter.h

Issue 421963008: Add PepperTryCatch and V8ObjectVar classes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/message_loop/message_loop_proxy.h" 11 #include "base/message_loop/message_loop_proxy.h"
12 #include "ppapi/c/pp_instance.h" 12 #include "ppapi/c/pp_instance.h"
13 #include "ppapi/c/pp_var.h" 13 #include "ppapi/c/pp_var.h"
14 #include "ppapi/shared_impl/scoped_pp_var.h" 14 #include "ppapi/shared_impl/scoped_pp_var.h"
15 #include "v8/include/v8.h" 15 #include "v8/include/v8.h"
16 #include "content/common/content_export.h" 16 #include "content/common/content_export.h"
17 17
18 namespace content { 18 namespace content {
19 19
20 class ResourceConverter; 20 class ResourceConverter;
21 21
22 class CONTENT_EXPORT V8VarConverter { 22 class CONTENT_EXPORT V8VarConverter {
23 public: 23 public:
24 explicit V8VarConverter(PP_Instance instance); 24 explicit V8VarConverter(PP_Instance instance);
25 V8VarConverter(PP_Instance instance, bool object_vars_allowed);
26
25 // Constructor for testing. 27 // Constructor for testing.
26 V8VarConverter(PP_Instance instance, 28 V8VarConverter(PP_Instance instance,
27 scoped_ptr<ResourceConverter> resource_converter); 29 scoped_ptr<ResourceConverter> resource_converter);
28 ~V8VarConverter(); 30 ~V8VarConverter();
29 31
30 // Converts the given PP_Var to a v8::Value. True is returned upon success. 32 // Converts the given PP_Var to a v8::Value. True is returned upon success.
31 bool ToV8Value(const PP_Var& var, 33 bool ToV8Value(const PP_Var& var,
32 v8::Handle<v8::Context> context, 34 v8::Handle<v8::Context> context,
33 v8::Handle<v8::Value>* result); 35 v8::Handle<v8::Value>* result);
34 36
(...skipping 29 matching lines...) Expand all
64 const base::Callback<void(const ppapi::ScopedPPVar&, bool)>& callback); 66 const base::Callback<void(const ppapi::ScopedPPVar&, bool)>& callback);
65 bool FromV8ValueSync(v8::Handle<v8::Value> val, 67 bool FromV8ValueSync(v8::Handle<v8::Value> val,
66 v8::Handle<v8::Context> context, 68 v8::Handle<v8::Context> context,
67 ppapi::ScopedPPVar* result_var); 69 ppapi::ScopedPPVar* result_var);
68 private: 70 private:
69 // Returns true on success, false on failure. 71 // Returns true on success, false on failure.
70 bool FromV8ValueInternal(v8::Handle<v8::Value> val, 72 bool FromV8ValueInternal(v8::Handle<v8::Value> val,
71 v8::Handle<v8::Context> context, 73 v8::Handle<v8::Context> context,
72 ppapi::ScopedPPVar* result_var); 74 ppapi::ScopedPPVar* result_var);
73 75
76 PP_Instance instance_;
77
78 // Whether or not to support conversion to PP_VARTYPE_OBJECT.
79 bool object_vars_allowed_;
80
74 // The message loop to run the callback to |FromV8Value| from. 81 // The message loop to run the callback to |FromV8Value| from.
75 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; 82 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
76 83
77 // The converter to use for converting V8 vars to resources. 84 // The converter to use for converting V8 vars to resources.
78 scoped_ptr<ResourceConverter> resource_converter_; 85 scoped_ptr<ResourceConverter> resource_converter_;
79 86
80 DISALLOW_COPY_AND_ASSIGN(V8VarConverter); 87 DISALLOW_COPY_AND_ASSIGN(V8VarConverter);
81 }; 88 };
82 89
83 } // namespace content 90 } // namespace content
84 91
85 #endif // CONTENT_RENDERER_PEPPER_V8_VAR_CONVERTER_H 92 #endif // CONTENT_RENDERER_PEPPER_V8_VAR_CONVERTER_H
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_try_catch.cc ('k') | content/renderer/pepper/v8_var_converter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698