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

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

Issue 1113783002: Use Local instead of Handle in src/content/* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
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"
(...skipping 18 matching lines...) Expand all
29 }; 29 };
30 V8VarConverter(PP_Instance instance, AllowObjectVars object_vars_allowed); 30 V8VarConverter(PP_Instance instance, AllowObjectVars object_vars_allowed);
31 31
32 // Constructor for testing. 32 // Constructor for testing.
33 V8VarConverter(PP_Instance instance, 33 V8VarConverter(PP_Instance instance,
34 scoped_ptr<ResourceConverter> resource_converter); 34 scoped_ptr<ResourceConverter> resource_converter);
35 ~V8VarConverter(); 35 ~V8VarConverter();
36 36
37 // Converts the given PP_Var to a v8::Value. True is returned upon success. 37 // Converts the given PP_Var to a v8::Value. True is returned upon success.
38 bool ToV8Value(const PP_Var& var, 38 bool ToV8Value(const PP_Var& var,
39 v8::Handle<v8::Context> context, 39 v8::Local<v8::Context> context,
40 v8::Handle<v8::Value>* result); 40 v8::Local<v8::Value>* result);
41 41
42 struct VarResult { 42 struct VarResult {
43 public: 43 public:
44 VarResult() : completed_synchronously(false), success(false) {} 44 VarResult() : completed_synchronously(false), success(false) {}
45 45
46 // True if the conversion completed synchronously and the callback will not 46 // True if the conversion completed synchronously and the callback will not
47 // be called. 47 // be called.
48 bool completed_synchronously; 48 bool completed_synchronously;
49 49
50 // True if the conversion was successful. Only valid if 50 // True if the conversion was successful. Only valid if
51 // |completed_synchronously| is true. 51 // |completed_synchronously| is true.
52 bool success; 52 bool success;
53 53
54 // The result if the conversion was successful. Only valid if 54 // The result if the conversion was successful. Only valid if
55 // |completed_synchronously| and |success| are true. 55 // |completed_synchronously| and |success| are true.
56 ppapi::ScopedPPVar var; 56 ppapi::ScopedPPVar var;
57 }; 57 };
58 58
59 // Converts the given v8::Value to a PP_Var. Every PP_Var in the reference 59 // Converts the given v8::Value to a PP_Var. Every PP_Var in the reference
60 // graph in the result will have a refcount equal to the number of references 60 // graph in the result will have a refcount equal to the number of references
61 // to it in the graph. The root of the result will have one additional 61 // to it in the graph. The root of the result will have one additional
62 // reference. The callback is run when conversion is complete with the 62 // reference. The callback is run when conversion is complete with the
63 // resulting var and a bool indicating success or failure. Conversion may be 63 // resulting var and a bool indicating success or failure. Conversion may be
64 // asynchronous because converting some resources may result in communication 64 // asynchronous because converting some resources may result in communication
65 // across IPC. |context| is guaranteed to only be used synchronously. If 65 // across IPC. |context| is guaranteed to only be used synchronously. If
66 // the conversion can occur synchronously, |callback| will not be run, 66 // the conversion can occur synchronously, |callback| will not be run,
67 // otherwise it will be run. 67 // otherwise it will be run.
68 VarResult FromV8Value( 68 VarResult FromV8Value(
69 v8::Handle<v8::Value> val, 69 v8::Local<v8::Value> val,
70 v8::Handle<v8::Context> context, 70 v8::Local<v8::Context> context,
71 const base::Callback<void(const ppapi::ScopedPPVar&, bool)>& callback); 71 const base::Callback<void(const ppapi::ScopedPPVar&, bool)>& callback);
72 bool FromV8ValueSync(v8::Handle<v8::Value> val, 72 bool FromV8ValueSync(v8::Local<v8::Value> val,
73 v8::Handle<v8::Context> context, 73 v8::Local<v8::Context> context,
74 ppapi::ScopedPPVar* result_var); 74 ppapi::ScopedPPVar* result_var);
75 private: 75 private:
76 // Returns true on success, false on failure. 76 // Returns true on success, false on failure.
77 bool FromV8ValueInternal(v8::Handle<v8::Value> val, 77 bool FromV8ValueInternal(v8::Local<v8::Value> val,
78 v8::Handle<v8::Context> context, 78 v8::Local<v8::Context> context,
79 ppapi::ScopedPPVar* result_var); 79 ppapi::ScopedPPVar* result_var);
80 80
81 PP_Instance instance_; 81 PP_Instance instance_;
82 82
83 // Whether or not to support conversion to PP_VARTYPE_OBJECT. 83 // Whether or not to support conversion to PP_VARTYPE_OBJECT.
84 AllowObjectVars object_vars_allowed_; 84 AllowObjectVars object_vars_allowed_;
85 85
86 // The converter to use for converting V8 vars to resources. 86 // The converter to use for converting V8 vars to resources.
87 scoped_ptr<ResourceConverter> resource_converter_; 87 scoped_ptr<ResourceConverter> resource_converter_;
88 88
89 DISALLOW_COPY_AND_ASSIGN(V8VarConverter); 89 DISALLOW_COPY_AND_ASSIGN(V8VarConverter);
90 }; 90 };
91 91
92 } // namespace content 92 } // namespace content
93 93
94 #endif // CONTENT_RENDERER_PEPPER_V8_VAR_CONVERTER_H_ 94 #endif // CONTENT_RENDERER_PEPPER_V8_VAR_CONVERTER_H_
OLDNEW
« no previous file with comments | « content/renderer/pepper/resource_converter.cc ('k') | content/renderer/pepper/v8_var_converter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698