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

Side by Side Diff: tools/gn/label_ptr.h

Issue 56433003: GN threading refactor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « tools/gn/item_tree.cc ('k') | tools/gn/loader.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 TOOLS_GN_LABEL_PTR_H_ 5 #ifndef TOOLS_GN_LABEL_PTR_H_
6 #define TOOLS_GN_LABEL_PTR_H_ 6 #define TOOLS_GN_LABEL_PTR_H_
7 7
8 #include <functional> 8 #include <functional>
9 9
10 class ParseNode; 10 class ParseNode;
11 11
12 // Structure that holds a labeled "thing". This is used for various places 12 // Structure that holds a labeled "thing". This is used for various places
13 // where we need to store lists of targets or configs. We sometimes populate 13 // where we need to store lists of targets or configs. We sometimes populate
14 // the pointers on another thread from where we compute the labels, so this 14 // the pointers on another thread from where we compute the labels, so this
15 // structure lets us save them separately. This also allows us to store the 15 // structure lets us save them separately. This also allows us to store the
16 // location of the thing that added this dependency. 16 // location of the thing that added this dependency.
17 template<typename T> 17 template<typename T>
18 struct LabelPtrPair { 18 struct LabelPtrPair {
19 typedef T DestType; 19 typedef T DestType;
20 20
21 LabelPtrPair() : label(), ptr(NULL), origin(NULL) {} 21 LabelPtrPair() : label(), ptr(NULL), origin(NULL) {}
22 22
23 explicit LabelPtrPair(const Label& l) : label(l), ptr(NULL), origin(NULL) {
24 }
25
23 // This contructor is typically used in unit tests, it extracts the label 26 // This contructor is typically used in unit tests, it extracts the label
24 // automatically from a given pointer. 27 // automatically from a given pointer.
25 explicit LabelPtrPair(const T* p) : label(p->label()), ptr(p), origin(NULL) { 28 explicit LabelPtrPair(const T* p) : label(p->label()), ptr(p), origin(NULL) {
26 } 29 }
27 30
28 ~LabelPtrPair() {} 31 ~LabelPtrPair() {}
29 32
30 Label label; 33 Label label;
31 const T* ptr; // May be NULL. 34 const T* ptr; // May be NULL.
32 const ParseNode* origin; // May be NULL. 35 const ParseNode* origin; // May be NULL.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 template<typename T> 74 template<typename T>
72 struct LabelPtrLabelLess : public std::binary_function<LabelPtrPair<T>, 75 struct LabelPtrLabelLess : public std::binary_function<LabelPtrPair<T>,
73 LabelPtrPair<T>, 76 LabelPtrPair<T>,
74 bool> { 77 bool> {
75 bool operator()(const LabelPtrPair<T>& a, const LabelPtrPair<T>& b) const { 78 bool operator()(const LabelPtrPair<T>& a, const LabelPtrPair<T>& b) const {
76 return a.label < b.label; 79 return a.label < b.label;
77 } 80 }
78 }; 81 };
79 82
80 #endif // TOOLS_GN_LABEL_PTR_H_ 83 #endif // TOOLS_GN_LABEL_PTR_H_
OLDNEW
« no previous file with comments | « tools/gn/item_tree.cc ('k') | tools/gn/loader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698