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

Side by Side Diff: Source/bindings/core/v8/Dictionary.h

Issue 1071963002: Replace Handle<> with Local<> in bindings/core/v8 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
« no previous file with comments | « Source/bindings/core/v8/DOMDataStore.h ('k') | Source/bindings/core/v8/Dictionary.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 namespace blink { 43 namespace blink {
44 44
45 // Dictionary class provides ways to retrieve property values as C++ objects 45 // Dictionary class provides ways to retrieve property values as C++ objects
46 // from a V8 object. Instances of this class must not outlive V8's handle scope 46 // from a V8 object. Instances of this class must not outlive V8's handle scope
47 // because they hold a V8 value without putting it on persistent handles. 47 // because they hold a V8 value without putting it on persistent handles.
48 class CORE_EXPORT Dictionary final { 48 class CORE_EXPORT Dictionary final {
49 ALLOW_ONLY_INLINE_ALLOCATION(); 49 ALLOW_ONLY_INLINE_ALLOCATION();
50 public: 50 public:
51 Dictionary(); 51 Dictionary();
52 Dictionary(const v8::Handle<v8::Value>& options, v8::Isolate*, ExceptionStat e&); 52 Dictionary(const v8::Local<v8::Value>& options, v8::Isolate*, ExceptionState &);
53 ~Dictionary(); 53 ~Dictionary();
54 54
55 Dictionary& operator=(const Dictionary&); 55 Dictionary& operator=(const Dictionary&);
56 56
57 bool isObject() const; 57 bool isObject() const;
58 bool isUndefinedOrNull() const; 58 bool isUndefinedOrNull() const;
59 59
60 bool get(const String&, Dictionary&) const; 60 bool get(const String&, Dictionary&) const;
61 bool get(const String&, v8::Local<v8::Value>&) const; 61 bool get(const String&, v8::Local<v8::Value>&) const;
62 62
63 v8::Handle<v8::Value> v8Value() const { return m_options; } 63 v8::Local<v8::Value> v8Value() const { return m_options; }
64 64
65 class CORE_EXPORT ConversionContext { 65 class CORE_EXPORT ConversionContext {
66 public: 66 public:
67 explicit ConversionContext(ExceptionState& exceptionState) 67 explicit ConversionContext(ExceptionState& exceptionState)
68 : m_exceptionState(exceptionState) 68 : m_exceptionState(exceptionState)
69 , m_dirty(true) 69 , m_dirty(true)
70 { 70 {
71 resetPerPropertyContext(); 71 resetPerPropertyContext();
72 } 72 }
73 73
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 { 114 {
115 ASSERT(m_isolate); 115 ASSERT(m_isolate);
116 return m_isolate->GetCurrentContext(); 116 return m_isolate->GetCurrentContext();
117 } 117 }
118 118
119 bool getKey(const String& key, v8::Local<v8::Value>&) const; 119 bool getKey(const String& key, v8::Local<v8::Value>&) const;
120 120
121 private: 121 private:
122 bool toObject(v8::Local<v8::Object>&) const; 122 bool toObject(v8::Local<v8::Object>&) const;
123 123
124 v8::Handle<v8::Value> m_options; 124 v8::Local<v8::Value> m_options;
125 v8::Isolate* m_isolate; 125 v8::Isolate* m_isolate;
126 ExceptionState* m_exceptionState; 126 ExceptionState* m_exceptionState;
127 }; 127 };
128 128
129 template<> 129 template<>
130 struct NativeValueTraits<Dictionary> { 130 struct NativeValueTraits<Dictionary> {
131 static inline Dictionary nativeValue(v8::Isolate* isolate, v8::Handle<v8::Va lue> value, ExceptionState& exceptionState) 131 static inline Dictionary nativeValue(v8::Isolate* isolate, v8::Local<v8::Val ue> value, ExceptionState& exceptionState)
132 { 132 {
133 return Dictionary(value, isolate, exceptionState); 133 return Dictionary(value, isolate, exceptionState);
134 } 134 }
135 }; 135 };
136 136
137 // DictionaryHelper is a collection of static methods for getting or 137 // DictionaryHelper is a collection of static methods for getting or
138 // converting a value from Dictionary. 138 // converting a value from Dictionary.
139 struct DictionaryHelper { 139 struct DictionaryHelper {
140 template <typename T> 140 template <typename T>
141 static bool get(const Dictionary&, const String& key, T& value); 141 static bool get(const Dictionary&, const String& key, T& value);
(...skipping 15 matching lines...) Expand all
157 static bool convert(const Dictionary&, Dictionary::ConversionContext&, const String& key, T& value); 157 static bool convert(const Dictionary&, Dictionary::ConversionContext&, const String& key, T& value);
158 template <typename T> 158 template <typename T>
159 static bool convert(const Dictionary&, Dictionary::ConversionContext&, const String& key, Nullable<T>& value); 159 static bool convert(const Dictionary&, Dictionary::ConversionContext&, const String& key, Nullable<T>& value);
160 template <template <typename> class PointerType, typename T> 160 template <template <typename> class PointerType, typename T>
161 static bool convert(const Dictionary&, Dictionary::ConversionContext&, const String& key, PointerType<T>& value); 161 static bool convert(const Dictionary&, Dictionary::ConversionContext&, const String& key, PointerType<T>& value);
162 }; 162 };
163 163
164 } 164 }
165 165
166 #endif // Dictionary_h 166 #endif // Dictionary_h
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/DOMDataStore.h ('k') | Source/bindings/core/v8/Dictionary.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698