| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // reference. The callback is run when conversion is complete with the | 55 // reference. The callback is run when conversion is complete with the |
| 56 // resulting var and a bool indicating success or failure. Conversion may be | 56 // resulting var and a bool indicating success or failure. Conversion may be |
| 57 // asynchronous because converting some resources may result in communication | 57 // asynchronous because converting some resources may result in communication |
| 58 // across IPC. |context| is guaranteed to only be used synchronously. If | 58 // across IPC. |context| is guaranteed to only be used synchronously. If |
| 59 // the conversion can occur synchronously, |callback| will not be run, | 59 // the conversion can occur synchronously, |callback| will not be run, |
| 60 // otherwise it will be run. | 60 // otherwise it will be run. |
| 61 VarResult FromV8Value( | 61 VarResult FromV8Value( |
| 62 v8::Handle<v8::Value> val, | 62 v8::Handle<v8::Value> val, |
| 63 v8::Handle<v8::Context> context, | 63 v8::Handle<v8::Context> context, |
| 64 const base::Callback<void(const ppapi::ScopedPPVar&, bool)>& callback); | 64 const base::Callback<void(const ppapi::ScopedPPVar&, bool)>& callback); |
| 65 bool FromV8ValueSync(v8::Handle<v8::Value> val, |
| 66 v8::Handle<v8::Context> context, |
| 67 ppapi::ScopedPPVar* result_var); |
| 65 private: | 68 private: |
| 66 // Returns true on success, false on failure. | 69 // Returns true on success, false on failure. |
| 67 bool FromV8ValueInternal(v8::Handle<v8::Value> val, | 70 bool FromV8ValueInternal(v8::Handle<v8::Value> val, |
| 68 v8::Handle<v8::Context> context, | 71 v8::Handle<v8::Context> context, |
| 69 ppapi::ScopedPPVar* result_var); | 72 ppapi::ScopedPPVar* result_var); |
| 70 | 73 |
| 71 // The message loop to run the callback to |FromV8Value| from. | 74 // The message loop to run the callback to |FromV8Value| from. |
| 72 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; | 75 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; |
| 73 | 76 |
| 74 // The converter to use for converting V8 vars to resources. | 77 // The converter to use for converting V8 vars to resources. |
| 75 scoped_ptr<ResourceConverter> resource_converter_; | 78 scoped_ptr<ResourceConverter> resource_converter_; |
| 76 | 79 |
| 77 DISALLOW_COPY_AND_ASSIGN(V8VarConverter); | 80 DISALLOW_COPY_AND_ASSIGN(V8VarConverter); |
| 78 }; | 81 }; |
| 79 | 82 |
| 80 } // namespace content | 83 } // namespace content |
| 81 | 84 |
| 82 #endif // CONTENT_RENDERER_PEPPER_V8_VAR_CONVERTER_H | 85 #endif // CONTENT_RENDERER_PEPPER_V8_VAR_CONVERTER_H |
| OLD | NEW |