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

Side by Side Diff: content/public/renderer/v8_value_converter.h

Issue 248903003: Extend V8ValueConverter::Strategy for the needs of Gin Java Bridge (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tranquillize clang Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/renderer/v8_value_converter_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 22 matching lines...) Expand all
33 33
34 virtual ~Strategy() {} 34 virtual ~Strategy() {}
35 35
36 // If false is returned, V8ValueConverter proceeds with the default 36 // If false is returned, V8ValueConverter proceeds with the default
37 // behavior. 37 // behavior.
38 // Use |callback| to convert any child values, as this will retain 38 // Use |callback| to convert any child values, as this will retain
39 // the ValueConverter's internal checks for depth and cycles. 39 // the ValueConverter's internal checks for depth and cycles.
40 virtual bool FromV8Object(v8::Handle<v8::Object> value, 40 virtual bool FromV8Object(v8::Handle<v8::Object> value,
41 base::Value** out, 41 base::Value** out,
42 v8::Isolate* isolate, 42 v8::Isolate* isolate,
43 const FromV8ValueCallback& callback) const = 0; 43 const FromV8ValueCallback& callback) const;
44 44
45 // If false is returned, V8ValueConverter proceeds with the default 45 // If false is returned, V8ValueConverter proceeds with the default
46 // behavior. 46 // behavior.
47 // Use |callback| to convert any child values, as this will retain 47 // Use |callback| to convert any child values, as this will retain
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 = 0; 52 const FromV8ValueCallback& callback) const;
53
54 // If false is returned, V8ValueConverter proceeds with the default
55 // behavior. v8::Object is passed as ArrayBuffer and ArrayBufferView
56 // classes are siblings.
57 virtual bool FromV8ArrayBuffer(v8::Handle<v8::Object> value,
58 base::Value** out) const;
59
60 // If false is returned, V8ValueConverter proceeds with the default
61 // behavior. This allows to intercept "non-finite" values and do something
62 // with them.
63 virtual bool FromV8Number(v8::Handle<v8::Number> value,
64 base::Value** out) const;
65
66 // If false is returned, V8ValueConverter proceeds with the default
67 // behavior.
68 virtual bool FromV8Undefined(base::Value** out) const;
53 }; 69 };
54 70
55 static V8ValueConverter* create(); 71 static V8ValueConverter* create();
56 72
57 virtual ~V8ValueConverter() {} 73 virtual ~V8ValueConverter() {}
58 74
59 // If true, Date objects are converted into DoubleValues with the number of 75 // If true, Date objects are converted into DoubleValues with the number of
60 // seconds since Unix epoch. 76 // seconds since Unix epoch.
61 // 77 //
62 // Otherwise they are converted into DictionaryValues with whatever additional 78 // Otherwise they are converted into DictionaryValues with whatever additional
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // Likewise, if an object throws while converting a property it will not be 117 // Likewise, if an object throws while converting a property it will not be
102 // converted, whereas if an array throws while converting an item it will be 118 // converted, whereas if an array throws while converting an item it will be
103 // converted to Value(TYPE_NULL). 119 // converted to Value(TYPE_NULL).
104 virtual base::Value* FromV8Value(v8::Handle<v8::Value> value, 120 virtual base::Value* FromV8Value(v8::Handle<v8::Value> value,
105 v8::Handle<v8::Context> context) const = 0; 121 v8::Handle<v8::Context> context) const = 0;
106 }; 122 };
107 123
108 } // namespace content 124 } // namespace content
109 125
110 #endif // CONTENT_PUBLIC_RENDERER_V8_VALUE_CONVERTER_H_ 126 #endif // CONTENT_PUBLIC_RENDERER_V8_VALUE_CONVERTER_H_
OLDNEW
« no previous file with comments | « no previous file | content/renderer/v8_value_converter_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698