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

Side by Side Diff: Source/bindings/v8/V8Binding.h

Issue 113213002: Rename toWebCoreString*() utility methods to toCoreString*() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Keep "to" prefix Created 7 years 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/v8/ScriptValue.cpp ('k') | Source/bindings/v8/V8Initializer.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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Ericsson AB. All rights reserved. 3 * Copyright (C) 2012 Ericsson AB. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 if (string.isNull()) { 149 if (string.isNull()) {
150 v8SetReturnValueUndefined(info); 150 v8SetReturnValueUndefined(info);
151 return; 151 return;
152 } 152 }
153 V8PerIsolateData::from(isolate)->stringCache()->setReturnValueFromString (info.GetReturnValue(), string.impl()); 153 V8PerIsolateData::from(isolate)->stringCache()->setReturnValueFromString (info.GetReturnValue(), string.impl());
154 } 154 }
155 155
156 // Convert v8::String to a WTF::String. If the V8 string is not already 156 // Convert v8::String to a WTF::String. If the V8 string is not already
157 // an external string then it is transformed into an external string at this 157 // an external string then it is transformed into an external string at this
158 // point to avoid repeated conversions. 158 // point to avoid repeated conversions.
159 inline String toWebCoreString(v8::Handle<v8::String> value) 159 inline String toCoreString(v8::Handle<v8::String> value)
160 { 160 {
161 return v8StringToWebCoreString<String>(value, Externalize); 161 return v8StringToWebCoreString<String>(value, Externalize);
162 } 162 }
163 163
164 inline String toWebCoreStringWithNullCheck(v8::Handle<v8::String> value) 164 inline String toCoreStringWithNullCheck(v8::Handle<v8::String> value)
165 { 165 {
166 if (value.IsEmpty() || value->IsNull()) 166 if (value.IsEmpty() || value->IsNull())
167 return String(); 167 return String();
168 return toWebCoreString(value); 168 return toCoreString(value);
169 } 169 }
170 170
171 inline String toWebCoreStringWithUndefinedOrNullCheck(v8::Handle<v8::String> value) 171 inline String toCoreStringWithUndefinedOrNullCheck(v8::Handle<v8::String> va lue)
172 { 172 {
173 if (value.IsEmpty() || value->IsNull() || value->IsUndefined()) 173 if (value.IsEmpty() || value->IsNull() || value->IsUndefined())
174 return String(); 174 return String();
175 return toWebCoreString(value); 175 return toCoreString(value);
176 } 176 }
177 177
178 inline AtomicString toWebCoreAtomicString(v8::Handle<v8::String> value) 178 inline AtomicString toCoreAtomicString(v8::Handle<v8::String> value)
179 { 179 {
180 return v8StringToWebCoreString<AtomicString>(value, Externalize); 180 return v8StringToWebCoreString<AtomicString>(value, Externalize);
181 } 181 }
182 182
183 // Convert v8 types to a WTF::String. If the V8 string is not already 183 // Convert v8 types to a WTF::String. If the V8 string is not already
184 // an external string then it is transformed into an external string at this 184 // an external string then it is transformed into an external string at this
185 // point to avoid repeated conversions. 185 // point to avoid repeated conversions.
186 // 186 //
187 // FIXME: Replace all the call sites with V8TRYCATCH_FOR_V8STRINGRESOURCE(). 187 // FIXME: Replace all the call sites with V8TRYCATCH_FOR_V8STRINGRESOURCE().
188 // Using this method will lead to a wrong behavior, because you cannot stop the 188 // Using this method will lead to a wrong behavior, because you cannot stop the
189 // execution when an exception is thrown inside stringResource.prepare(). 189 // execution when an exception is thrown inside stringResource.prepare().
190 inline String toWebCoreStringWithUndefinedOrNullCheck(v8::Handle<v8::Value> value) 190 inline String toCoreStringWithUndefinedOrNullCheck(v8::Handle<v8::Value> val ue)
191 { 191 {
192 V8StringResource<WithUndefinedOrNullCheck> stringResource(value); 192 V8StringResource<WithUndefinedOrNullCheck> stringResource(value);
193 if (!stringResource.prepare()) 193 if (!stringResource.prepare())
194 return String(); 194 return String();
195 return stringResource; 195 return stringResource;
196 } 196 }
197 197
198 // Convert a string to a V8 string. 198 // Convert a string to a V8 string.
199 // Return a V8 external string that shares the underlying buffer with the gi ven 199 // Return a V8 external string that shares the underlying buffer with the gi ven
200 // WebCore string. The reference counting mechanism is used to keep the 200 // WebCore string. The reference counting mechanism is used to keep the
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 696
697 // Converts a DOM object to a v8 value. 697 // Converts a DOM object to a v8 value.
698 // This is a no-inline version of toV8(). If you want to call toV8() 698 // This is a no-inline version of toV8(). If you want to call toV8()
699 // without creating #include cycles, you can use this function instead. 699 // without creating #include cycles, you can use this function instead.
700 // Each specialized implementation will be generated. 700 // Each specialized implementation will be generated.
701 template<typename T> 701 template<typename T>
702 v8::Handle<v8::Value> toV8NoInline(T* impl, v8::Handle<v8::Object> creationC ontext, v8::Isolate*); 702 v8::Handle<v8::Value> toV8NoInline(T* impl, v8::Handle<v8::Object> creationC ontext, v8::Isolate*);
703 } // namespace WebCore 703 } // namespace WebCore
704 704
705 #endif // V8Binding_h 705 #endif // V8Binding_h
OLDNEW
« no previous file with comments | « Source/bindings/v8/ScriptValue.cpp ('k') | Source/bindings/v8/V8Initializer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698