Index: android_webview/browser/compositor_id.cc |
diff --git a/android_webview/browser/compositor_id.cc b/android_webview/browser/compositor_id.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..80bb427a82fadb446887b5e04908d2580113ffb6 |
--- /dev/null |
+++ b/android_webview/browser/compositor_id.cc |
@@ -0,0 +1,52 @@ |
+// 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. |
+ |
+#include "android_webview/browser/compositor_id.h" |
+#include "content/public/common/child_process_host.h" |
+ |
+namespace android_webview { |
+ |
+CompositorID::CompositorID() |
+ : process_id(content::ChildProcessHost::kInvalidUniqueID), |
+ routing_id(content::ChildProcessHost::kInvalidUniqueID) {} |
boliu
2016/06/13 15:30:44
does this apply to routing_id too?
either way, I
hush (inactive)
2016/06/14 23:48:28
it does apply to routing_id. Example here: https:/
|
+ |
+CompositorID::CompositorID(int process_id, int routing_id) |
+ : process_id(process_id), routing_id(routing_id) {} |
+ |
+CompositorID::CompositorID(const CompositorID& other) = default; |
+ |
+CompositorID& CompositorID::operator=(const CompositorID& other) { |
+ process_id = other.process_id; |
+ routing_id = other.routing_id; |
+ return *this; |
+} |
+ |
+bool operator==(const CompositorID& lhs, const CompositorID& rhs) { |
+ return lhs.process_id == rhs.process_id && lhs.routing_id == rhs.routing_id; |
+} |
+ |
+bool operator<(const CompositorID& lhs, const CompositorID& rhs) { |
+ if (lhs.process_id == rhs.process_id) { |
+ return lhs.routing_id < rhs.routing_id; |
+ } |
+ return lhs.process_id < rhs.process_id; |
+} |
+ |
+bool operator!=(const CompositorID& lhs, const CompositorID& rhs) { |
+ return !(lhs == rhs); |
+} |
+ |
+bool operator>(const CompositorID& lhs, const CompositorID& rhs) { |
+ return rhs < lhs; |
+} |
+ |
+bool operator<=(const CompositorID& lhs, const CompositorID& rhs) { |
+ return !(rhs > lhs); |
+} |
+ |
+bool operator>=(const CompositorID& lhs, const CompositorID& rhs) { |
+ return !(lhs < rhs); |
+} |
+ |
+} // namespace android_webview |