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

Unified Diff: Source/bindings/core/v8/Nullable.h

Issue 466323002: IDL: Use Nullable for union type return value (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 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 | « no previous file | Source/bindings/scripts/v8_interface.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/Nullable.h
diff --git a/Source/bindings/core/v8/Nullable.h b/Source/bindings/core/v8/Nullable.h
index 6d3cb441a790f2c515ad27c55221c621e7d0c893..590c09ad3873a84ddd795586982dc1e10f35792c 100644
--- a/Source/bindings/core/v8/Nullable.h
+++ b/Source/bindings/core/v8/Nullable.h
@@ -33,10 +33,18 @@ public:
return *this;
}
+ void set(const T& value)
+ {
+ m_value = value;
+ m_isNull = false;
+ }
const T& get() const { ASSERT(!m_isNull); return m_value; }
+ T& get() { ASSERT(!m_isNull); return m_value; }
bool isNull() const { return m_isNull; }
- operator bool() const { return !m_isNull && m_value; }
+ // See comment in RefPtr.h about what UnspecifiedBoolType is.
+ typedef const T* UnspecifiedBoolType;
+ operator UnspecifiedBoolType() const { return m_isNull ? 0 : &m_value; }
bool operator==(const Nullable& other) const
{
« no previous file with comments | « no previous file | Source/bindings/scripts/v8_interface.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698