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

Side by Side Diff: content/public/browser/desktop_media_id.h

Issue 1462213002: Use std::tie() for operator< in content/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_PUBLIC_BROWSER_DESKTOP_MEDIA_ID_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_DESKTOP_MEDIA_ID_H_
6 #define CONTENT_PUBLIC_BROWSER_DESKTOP_MEDIA_ID_H_ 6 #define CONTENT_PUBLIC_BROWSER_DESKTOP_MEDIA_ID_H_
7 7
8 #include <string> 8 #include <string>
9 #include <tuple>
9 10
10 #include "base/basictypes.h" 11 #include "base/basictypes.h"
11 #include "content/common/content_export.h" 12 #include "content/common/content_export.h"
12 13
13 #if defined(USE_AURA) 14 #if defined(USE_AURA)
14 namespace aura { 15 namespace aura {
15 class Window; 16 class Window;
16 } // namespace aura 17 } // namespace aura
17 #endif // defined(USE_AURA) 18 #endif // defined(USE_AURA)
18 19
(...skipping 28 matching lines...) Expand all
47 DesktopMediaID() = default; 48 DesktopMediaID() = default;
48 49
49 DesktopMediaID(Type type, Id id) 50 DesktopMediaID(Type type, Id id)
50 : type(type), 51 : type(type),
51 id(id) { 52 id(id) {
52 } 53 }
53 54
54 // Operators so that DesktopMediaID can be used with STL containers. 55 // Operators so that DesktopMediaID can be used with STL containers.
55 bool operator<(const DesktopMediaID& other) const { 56 bool operator<(const DesktopMediaID& other) const {
56 #if defined(USE_AURA) 57 #if defined(USE_AURA)
57 return (type < other.type || 58 return std::tie(type, id, aura_id) <
58 (type == other.type && 59 std::tie(other.type, other.id, other.aura_id);
59 (id < other.id || (id == other.id &&
60 aura_id < other.aura_id))));
61 #else 60 #else
62 return type < other.type || (type == other.type && id < other.id); 61 return std::tie(type, id) < std::tie(other.type, other.id);
63 #endif 62 #endif
64 } 63 }
65 bool operator==(const DesktopMediaID& other) const { 64 bool operator==(const DesktopMediaID& other) const {
66 #if defined(USE_AURA) 65 #if defined(USE_AURA)
67 return type == other.type && id == other.id && aura_id == other.aura_id; 66 return type == other.type && id == other.id && aura_id == other.aura_id;
68 #else 67 #else
69 return type == other.type && id == other.id; 68 return type == other.type && id == other.id;
70 #endif 69 #endif
71 } 70 }
72 71
(...skipping 11 matching lines...) Expand all
84 Id id = kNullId; 83 Id id = kNullId;
85 #if defined(USE_AURA) 84 #if defined(USE_AURA)
86 // TODO(miu): Make this an int, after clean-up for http://crbug.com/513490. 85 // TODO(miu): Make this an int, after clean-up for http://crbug.com/513490.
87 Id aura_id = kNullId; 86 Id aura_id = kNullId;
88 #endif 87 #endif
89 }; 88 };
90 89
91 } // namespace content 90 } // namespace content
92 91
93 #endif // CONTENT_PUBLIC_BROWSER_DESKTOP_MEDIA_ID_H_ 92 #endif // CONTENT_PUBLIC_BROWSER_DESKTOP_MEDIA_ID_H_
OLDNEW
« no previous file with comments | « content/browser/media/webrtc_identity_store_backend.cc ('k') | content/public/browser/global_request_id.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698