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

Unified Diff: third_party/WebKit/Source/platform/inspector_protocol/Maybe.h

Issue 2238423002: [DevTools] Generate all files in inspector_protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2240663003
Patch Set: Created 4 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
Index: third_party/WebKit/Source/platform/inspector_protocol/Maybe.h
diff --git a/third_party/WebKit/Source/platform/inspector_protocol/Maybe.h b/third_party/WebKit/Source/platform/inspector_protocol/Maybe.h
deleted file mode 100644
index 560e7da9629b970dda037542fa640143a78d1be3..0000000000000000000000000000000000000000
--- a/third_party/WebKit/Source/platform/inspector_protocol/Maybe.h
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef Maybe_h
-#define Maybe_h
-
-#include "platform/inspector_protocol/Platform.h"
-#include "platform/inspector_protocol/String16.h"
-
-#include <memory>
-
-namespace blink {
-namespace protocol {
-
-template<typename T>
-class Maybe {
-public:
- Maybe() : m_value() { }
- Maybe(std::unique_ptr<T> value) : m_value(std::move(value)) { }
- void operator=(std::unique_ptr<T> value) { m_value = std::move(value); }
- T* fromJust() const { DCHECK(m_value); return m_value.get(); }
- T* fromMaybe(T* defaultValue) const { return m_value ? m_value.get() : defaultValue; }
- bool isJust() const { return !!m_value; }
- std::unique_ptr<T> takeJust() { DCHECK(m_value); return m_value.release(); }
-private:
- std::unique_ptr<T> m_value;
-};
-
-template<typename T>
-class MaybeBase {
-public:
- MaybeBase() : m_isJust(false) { }
- MaybeBase(T value) : m_isJust(true), m_value(value) { }
- void operator=(T value) { m_value = value; m_isJust = true; }
- T fromJust() const { DCHECK(m_isJust); return m_value; }
- T fromMaybe(const T& defaultValue) const { return m_isJust ? m_value : defaultValue; }
- bool isJust() const { return m_isJust; }
- T takeJust() { DCHECK(m_isJust); return m_value; }
-
-protected:
- bool m_isJust;
- T m_value;
-};
-
-template<>
-class Maybe<bool> : public MaybeBase<bool> {
-public:
- Maybe() { }
- Maybe(bool value) : MaybeBase(value) { }
- using MaybeBase::operator=;
-};
-
-template<>
-class Maybe<int> : public MaybeBase<int> {
-public:
- Maybe() { }
- Maybe(int value) : MaybeBase(value) { }
- using MaybeBase::operator=;
-};
-
-template<>
-class Maybe<double> : public MaybeBase<double> {
-public:
- Maybe() { }
- Maybe(double value) : MaybeBase(value) { }
- using MaybeBase::operator=;
-};
-
-template<>
-class Maybe<InspectorProtocolConvenienceStringType> : public MaybeBase<InspectorProtocolConvenienceStringType> {
-public:
- Maybe() { }
- Maybe(const InspectorProtocolConvenienceStringType& value) : MaybeBase(value) { }
- using MaybeBase::operator=;
-};
-
-template<>
-class Maybe<String16> : public MaybeBase<String16> {
-public:
- Maybe() { }
- Maybe(const String16& value) : MaybeBase(value) { }
- using MaybeBase::operator=;
-};
-
-} // namespace platform
-} // namespace blink
-
-#endif // !defined(Maybe_h)

Powered by Google App Engine
This is Rietveld 408576698