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 #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 28 matching lines...) Expand all Loading... |
39 // 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 |
40 // 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 |
41 // reference. The callback is run when conversion is complete with the | 41 // reference. The callback is run when conversion is complete with the |
42 // resulting var and a bool indicating success or failure. Conversion is | 42 // resulting var and a bool indicating success or failure. Conversion is |
43 // asynchronous because converting some resources may result in communication | 43 // asynchronous because converting some resources may result in communication |
44 // across IPC. |context| is guaranteed to only be used synchronously. | 44 // across IPC. |context| is guaranteed to only be used synchronously. |
45 void FromV8Value( | 45 void FromV8Value( |
46 v8::Handle<v8::Value> val, | 46 v8::Handle<v8::Value> val, |
47 v8::Handle<v8::Context> context, | 47 v8::Handle<v8::Context> context, |
48 const base::Callback<void(const ppapi::ScopedPPVar&, bool)>& callback); | 48 const base::Callback<void(const ppapi::ScopedPPVar&, bool)>& callback); |
| 49 private: |
| 50 // Returns true on success, false on failure. |
| 51 bool FromV8ValueInternal(v8::Handle<v8::Value> val, |
| 52 v8::Handle<v8::Context> context, |
| 53 ppapi::ScopedPPVar* result_var); |
49 | 54 |
50 private: | |
51 // The message loop to run the callback to |FromV8Value| from. | 55 // The message loop to run the callback to |FromV8Value| from. |
52 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; | 56 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; |
53 | 57 |
54 // The converter to use for converting V8 vars to resources. | 58 // The converter to use for converting V8 vars to resources. |
55 scoped_ptr<ResourceConverter> resource_converter_; | 59 scoped_ptr<ResourceConverter> resource_converter_; |
56 | 60 |
57 DISALLOW_COPY_AND_ASSIGN(V8VarConverter); | 61 DISALLOW_COPY_AND_ASSIGN(V8VarConverter); |
58 }; | 62 }; |
59 | 63 |
60 } // namespace content | 64 } // namespace content |
61 | 65 |
62 #endif // CONTENT_RENDERER_PEPPER_V8_VAR_CONVERTER_H | 66 #endif // CONTENT_RENDERER_PEPPER_V8_VAR_CONVERTER_H |
OLD | NEW |