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

Unified Diff: Source/bindings/v8/V8StringResource.h

Issue 139293004: Teach the IDL compiler about TreatNullAs=EmptyString (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: update test results Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/tests/results/V8TestObject.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/V8StringResource.h
diff --git a/Source/bindings/v8/V8StringResource.h b/Source/bindings/v8/V8StringResource.h
index feb63a990952c79ad04828cd77fe693c67edb140..ddac5697e33881b82b56926545bc1e66ce3eb651 100644
--- a/Source/bindings/v8/V8StringResource.h
+++ b/Source/bindings/v8/V8StringResource.h
@@ -166,6 +166,7 @@ String int32ToWebCoreString(int value);
// or AtomicStrings as appropriate, using multiple typecast operators.
enum V8StringResourceMode {
DefaultMode,
+ TreatNullAsEmptyString,
WithNullCheck,
WithUndefinedOrNullCheck
haraken 2014/01/15 11:57:36 Shall we also rename WithNullCheck to TreatNullAsN
arv (Not doing code reviews) 2014/01/15 15:44:59 sounds good to me
};
@@ -234,6 +235,15 @@ template<> inline bool V8StringResource<DefaultMode>::prepare()
return prepareBase();
}
+template<> inline bool V8StringResource<TreatNullAsEmptyString>::prepare()
+{
+ if (m_v8Object.IsEmpty() || m_v8Object->IsNull()) {
+ setString(emptyString());
+ return true;
+ }
+ return prepareBase();
+}
+
template<> inline bool V8StringResource<WithNullCheck>::prepare()
{
if (m_v8Object.IsEmpty() || m_v8Object->IsNull()) {
« no previous file with comments | « Source/bindings/tests/results/V8TestObject.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698