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

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

Issue 1804303004: 🚙 GN: Add write_runtime_deps variable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove {}s Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « tools/gn/runtime_deps.cc ('k') | tools/gn/scheduler.cc » ('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_SCHEDULER_H_ 5 #ifndef TOOLS_GN_SCHEDULER_H_
6 #define TOOLS_GN_SCHEDULER_H_ 6 #define TOOLS_GN_SCHEDULER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/atomic_ref_count.h" 10 #include "base/atomic_ref_count.h"
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/run_loop.h" 14 #include "base/run_loop.h"
15 #include "base/synchronization/lock.h" 15 #include "base/synchronization/lock.h"
16 #include "base/threading/sequenced_worker_pool.h" 16 #include "base/threading/sequenced_worker_pool.h"
17 #include "tools/gn/input_file_manager.h" 17 #include "tools/gn/input_file_manager.h"
18 #include "tools/gn/label.h"
19 #include "tools/gn/source_file.h"
20 #include "tools/gn/token.h"
18 21
19 class Target; 22 class Target;
20 23
21 // Maintains the thread pool and error state. 24 // Maintains the thread pool and error state.
22 class Scheduler { 25 class Scheduler {
23 public: 26 public:
24 Scheduler(); 27 Scheduler();
25 ~Scheduler(); 28 ~Scheduler();
26 29
27 bool Run(); 30 bool Run();
(...skipping 22 matching lines...) Expand all
50 // start using >1 build settings, then we probably want this to take a 53 // start using >1 build settings, then we probably want this to take a
51 // BuildSettings object so we know the depdency on a per-build basis. 54 // BuildSettings object so we know the depdency on a per-build basis.
52 // If moved, most of the Add/Get functions below should move as well. 55 // If moved, most of the Add/Get functions below should move as well.
53 void AddGenDependency(const base::FilePath& file); 56 void AddGenDependency(const base::FilePath& file);
54 std::vector<base::FilePath> GetGenDependencies() const; 57 std::vector<base::FilePath> GetGenDependencies() const;
55 58
56 // Tracks calls to write_file for resolving with the unknown generated 59 // Tracks calls to write_file for resolving with the unknown generated
57 // inputs (see AddUnknownGeneratedInput below). 60 // inputs (see AddUnknownGeneratedInput below).
58 void AddWrittenFile(const SourceFile& file); 61 void AddWrittenFile(const SourceFile& file);
59 62
63 // Schedules a file to be written due to a target setting write_runtime_deps.
64 void AddWriteRuntimeDepsTarget(const Target* entry);
65 std::vector<const Target*> GetWriteRuntimeDepsTargets() const;
66 bool IsFileGeneratedByWriteRuntimeDeps(const OutputFile& file) const;
67
60 // Unknown generated inputs are files that a target declares as an input 68 // Unknown generated inputs are files that a target declares as an input
61 // in the output directory, but which aren't generated by any dependency. 69 // in the output directory, but which aren't generated by any dependency.
62 // 70 //
63 // Some of these files will be files written by write_file and will be 71 // Some of these files will be files written by write_file and will be
64 // GenDependencies (see AddWrittenFile above). There are OK and include 72 // GenDependencies (see AddWrittenFile above). There are OK and include
65 // things like response files for scripts. Others cases will be ones where 73 // things like response files for scripts. Others cases will be ones where
66 // the file is generated by a target that's not a dependency. 74 // the file is generated by a target that's not a dependency.
67 // 75 //
68 // In order to distinguish these two cases, the checking for these input 76 // In order to distinguish these two cases, the checking for these input
69 // files needs to be done after all targets are complete. This also has the 77 // files needs to be done after all targets are complete. This also has the
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 bool is_failed_; 114 bool is_failed_;
107 115
108 // Used to track whether the worker pool has been shutdown. This is necessary 116 // Used to track whether the worker pool has been shutdown. This is necessary
109 // to clean up after tests that make a scheduler but don't run the message 117 // to clean up after tests that make a scheduler but don't run the message
110 // loop. 118 // loop.
111 bool has_been_shutdown_; 119 bool has_been_shutdown_;
112 120
113 // Protected by the lock. See the corresponding Add/Get functions above. 121 // Protected by the lock. See the corresponding Add/Get functions above.
114 std::vector<base::FilePath> gen_dependencies_; 122 std::vector<base::FilePath> gen_dependencies_;
115 std::vector<SourceFile> written_files_; 123 std::vector<SourceFile> written_files_;
124 std::vector<const Target*> write_runtime_deps_targets_;
116 std::multimap<SourceFile, const Target*> unknown_generated_inputs_; 125 std::multimap<SourceFile, const Target*> unknown_generated_inputs_;
117 126
118 DISALLOW_COPY_AND_ASSIGN(Scheduler); 127 DISALLOW_COPY_AND_ASSIGN(Scheduler);
119 }; 128 };
120 129
121 extern Scheduler* g_scheduler; 130 extern Scheduler* g_scheduler;
122 131
123 #endif // TOOLS_GN_SCHEDULER_H_ 132 #endif // TOOLS_GN_SCHEDULER_H_
OLDNEW
« no previous file with comments | « tools/gn/runtime_deps.cc ('k') | tools/gn/scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698