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

Side by Side Diff: extensions/browser/process_map.cc

Issue 1461163002: Use std::tie() for operator< in extensions/ (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 #include "extensions/browser/process_map.h" 5 #include "extensions/browser/process_map.h"
6 6
7 #include <tuple>
8
7 #include "content/public/browser/child_process_security_policy.h" 9 #include "content/public/browser/child_process_security_policy.h"
8 #include "extensions/browser/extension_registry.h" 10 #include "extensions/browser/extension_registry.h"
9 #include "extensions/browser/process_map_factory.h" 11 #include "extensions/browser/process_map_factory.h"
10 #include "extensions/common/extension.h" 12 #include "extensions/common/extension.h"
11 #include "extensions/common/features/feature.h" 13 #include "extensions/common/features/feature.h"
12 14
13 namespace extensions { 15 namespace extensions {
14 16
15 // Item 17 // Item
16 struct ProcessMap::Item { 18 struct ProcessMap::Item {
(...skipping 12 matching lines...) Expand all
29 int site_instance_id) 31 int site_instance_id)
30 : extension_id(extension_id), 32 : extension_id(extension_id),
31 process_id(process_id), 33 process_id(process_id),
32 site_instance_id(site_instance_id) { 34 site_instance_id(site_instance_id) {
33 } 35 }
34 36
35 ~Item() { 37 ~Item() {
36 } 38 }
37 39
38 bool operator<(const ProcessMap::Item& other) const { 40 bool operator<(const ProcessMap::Item& other) const {
39 if (extension_id < other.extension_id) 41 return std::tie(extension_id, process_id, site_instance_id) <
40 return true; 42 std::tie(other.extension_id, other.process_id,
41 43 other.site_instance_id);
42 if (extension_id == other.extension_id &&
43 process_id < other.process_id) {
44 return true;
45 }
46
47 if (extension_id == other.extension_id &&
48 process_id == other.process_id &&
49 site_instance_id < other.site_instance_id) {
50 return true;
51 }
52
53 return false;
54 } 44 }
55 45
56 std::string extension_id; 46 std::string extension_id;
57 int process_id; 47 int process_id;
58 int site_instance_id; 48 int site_instance_id;
59 }; 49 };
60 50
61 51
62 // ProcessMap 52 // ProcessMap
63 ProcessMap::ProcessMap() { 53 ProcessMap::ProcessMap() {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 137
148 if (extension->is_hosted_app() && 138 if (extension->is_hosted_app() &&
149 extension->location() != Manifest::COMPONENT) { 139 extension->location() != Manifest::COMPONENT) {
150 return Feature::BLESSED_WEB_PAGE_CONTEXT; 140 return Feature::BLESSED_WEB_PAGE_CONTEXT;
151 } 141 }
152 142
153 return Feature::BLESSED_EXTENSION_CONTEXT; 143 return Feature::BLESSED_EXTENSION_CONTEXT;
154 } 144 }
155 145
156 } // namespace extensions 146 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/event_router.cc ('k') | extensions/common/api/sockets/sockets_manifest_permission_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698