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

Unified Diff: mojo/edk/system/dispatcher.h

Issue 1160203002: Make Dispatcher::Type an enum class. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 7 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: mojo/edk/system/dispatcher.h
diff --git a/mojo/edk/system/dispatcher.h b/mojo/edk/system/dispatcher.h
index 8d7e1cb665c3034a5cac585b0bc958f8224d7d98..d7b7780ccf198ffe102331c241b77d372ba58b68 100644
--- a/mojo/edk/system/dispatcher.h
+++ b/mojo/edk/system/dispatcher.h
@@ -8,6 +8,7 @@
#include <stddef.h>
#include <stdint.h>
+#include <ostream>
#include <vector>
#include "base/macros.h"
@@ -59,15 +60,15 @@ DispatcherTryStartTransport(Dispatcher* dispatcher);
class MOJO_SYSTEM_IMPL_EXPORT Dispatcher
: public base::RefCountedThreadSafe<Dispatcher> {
public:
- enum Type {
- kTypeUnknown = 0,
- kTypeMessagePipe,
- kTypeDataPipeProducer,
- kTypeDataPipeConsumer,
- kTypeSharedBuffer,
+ enum class Type {
+ UNKNOWN = 0,
+ MESSAGE_PIPE,
+ DATA_PIPE_PRODUCER,
+ DATA_PIPE_CONSUMER,
+ SHARED_BUFFER,
// "Private" types (not exposed via the public interface):
- kTypePlatformHandle = -1
+ PLATFORM_HANDLE = -1
};
virtual Type GetType() const = 0;
@@ -399,6 +400,12 @@ class MOJO_SYSTEM_IMPL_EXPORT DispatcherTransport {
// Copy and assign allowed.
};
+// So logging macros and |DCHECK_EQ()|, etc. work.
+MOJO_SYSTEM_IMPL_EXPORT inline std::ostream& operator<<(std::ostream& out,
+ Dispatcher::Type type) {
+ return out << static_cast<int>(type);
+}
+
} // namespace system
} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698