| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PUBLIC_RENDERER_V8_VALUE_CONVERTER_H_ | 5 #ifndef CONTENT_PUBLIC_RENDERER_V8_VALUE_CONVERTER_H_ |
| 6 #define CONTENT_PUBLIC_RENDERER_V8_VALUE_CONVERTER_H_ | 6 #define CONTENT_PUBLIC_RENDERER_V8_VALUE_CONVERTER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
| 10 #include "v8/include/v8.h" | 10 #include "v8/include/v8.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // the ValueConverter's internal checks for depth and cycles. | 48 // the ValueConverter's internal checks for depth and cycles. |
| 49 virtual bool FromV8Array(v8::Handle<v8::Array> value, | 49 virtual bool FromV8Array(v8::Handle<v8::Array> value, |
| 50 base::Value** out, | 50 base::Value** out, |
| 51 v8::Isolate* isolate, | 51 v8::Isolate* isolate, |
| 52 const FromV8ValueCallback& callback) const; | 52 const FromV8ValueCallback& callback) const; |
| 53 | 53 |
| 54 // If false is returned, V8ValueConverter proceeds with the default | 54 // If false is returned, V8ValueConverter proceeds with the default |
| 55 // behavior. v8::Object is passed as ArrayBuffer and ArrayBufferView | 55 // behavior. v8::Object is passed as ArrayBuffer and ArrayBufferView |
| 56 // classes are siblings. | 56 // classes are siblings. |
| 57 virtual bool FromV8ArrayBuffer(v8::Handle<v8::Object> value, | 57 virtual bool FromV8ArrayBuffer(v8::Handle<v8::Object> value, |
| 58 base::Value** out) const; | 58 base::Value** out, |
| 59 v8::Isolate* isolate) const; |
| 59 | 60 |
| 60 // If false is returned, V8ValueConverter proceeds with the default | 61 // If false is returned, V8ValueConverter proceeds with the default |
| 61 // behavior. This allows to intercept "non-finite" values and do something | 62 // behavior. This allows to intercept "non-finite" values and do something |
| 62 // with them. | 63 // with them. |
| 63 virtual bool FromV8Number(v8::Handle<v8::Number> value, | 64 virtual bool FromV8Number(v8::Handle<v8::Number> value, |
| 64 base::Value** out) const; | 65 base::Value** out) const; |
| 65 | 66 |
| 66 // If false is returned, V8ValueConverter proceeds with the default | 67 // If false is returned, V8ValueConverter proceeds with the default |
| 67 // behavior. | 68 // behavior. |
| 68 virtual bool FromV8Undefined(base::Value** out) const; | 69 virtual bool FromV8Undefined(base::Value** out) const; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 // Likewise, if an object throws while converting a property it will not be | 118 // Likewise, if an object throws while converting a property it will not be |
| 118 // converted, whereas if an array throws while converting an item it will be | 119 // converted, whereas if an array throws while converting an item it will be |
| 119 // converted to Value(TYPE_NULL). | 120 // converted to Value(TYPE_NULL). |
| 120 virtual base::Value* FromV8Value(v8::Handle<v8::Value> value, | 121 virtual base::Value* FromV8Value(v8::Handle<v8::Value> value, |
| 121 v8::Handle<v8::Context> context) const = 0; | 122 v8::Handle<v8::Context> context) const = 0; |
| 122 }; | 123 }; |
| 123 | 124 |
| 124 } // namespace content | 125 } // namespace content |
| 125 | 126 |
| 126 #endif // CONTENT_PUBLIC_RENDERER_V8_VALUE_CONVERTER_H_ | 127 #endif // CONTENT_PUBLIC_RENDERER_V8_VALUE_CONVERTER_H_ |
| OLD | NEW |