| 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 bool FromV8ValueSync(v8::Handle<v8::Value> val, |
| 50 v8::Handle<v8::Context> context, |
| 51 ppapi::ScopedPPVar* result_var); |
| 49 private: | 52 private: |
| 50 // Returns true on success, false on failure. | 53 // Returns true on success, false on failure. |
| 51 bool FromV8ValueInternal(v8::Handle<v8::Value> val, | 54 bool FromV8ValueInternal(v8::Handle<v8::Value> val, |
| 52 v8::Handle<v8::Context> context, | 55 v8::Handle<v8::Context> context, |
| 53 ppapi::ScopedPPVar* result_var); | 56 ppapi::ScopedPPVar* result_var); |
| 54 | 57 |
| 55 // The message loop to run the callback to |FromV8Value| from. | 58 // The message loop to run the callback to |FromV8Value| from. |
| 56 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; | 59 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; |
| 57 | 60 |
| 58 // The converter to use for converting V8 vars to resources. | 61 // The converter to use for converting V8 vars to resources. |
| 59 scoped_ptr<ResourceConverter> resource_converter_; | 62 scoped_ptr<ResourceConverter> resource_converter_; |
| 60 | 63 |
| 61 DISALLOW_COPY_AND_ASSIGN(V8VarConverter); | 64 DISALLOW_COPY_AND_ASSIGN(V8VarConverter); |
| 62 }; | 65 }; |
| 63 | 66 |
| 64 } // namespace content | 67 } // namespace content |
| 65 | 68 |
| 66 #endif // CONTENT_RENDERER_PEPPER_V8_VAR_CONVERTER_H | 69 #endif // CONTENT_RENDERER_PEPPER_V8_VAR_CONVERTER_H |
| OLD | NEW |