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

Unified Diff: tools/gn/build_settings.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/binary_target_generator.cc ('k') | tools/gn/build_settings.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/build_settings.h
diff --git a/tools/gn/build_settings.h b/tools/gn/build_settings.h
index fc175dfe795167204e97b678c664a4b9df8bb93a..2e93296bc237375c39ded91cadfeee4e689e2c5e 100644
--- a/tools/gn/build_settings.h
+++ b/tools/gn/build_settings.h
@@ -10,21 +10,20 @@
#include "base/basictypes.h"
#include "base/callback.h"
#include "base/files/file_path.h"
+#include "base/memory/scoped_ptr.h"
#include "tools/gn/args.h"
-#include "tools/gn/item_tree.h"
#include "tools/gn/scope.h"
#include "tools/gn/source_dir.h"
#include "tools/gn/source_file.h"
-#include "tools/gn/target_manager.h"
-#include "tools/gn/toolchain_manager.h"
+class Item;
class OutputFile;
// Settings for one build, which is one toplevel output directory. There
// may be multiple Settings objects that refer to this, one for each toolchain.
class BuildSettings {
public:
- typedef base::Callback<void(const Target*)> TargetResolvedCallback;
+ typedef base::Callback<void(scoped_ptr<Item>)> ItemDefinedCallback;
BuildSettings();
BuildSettings(const BuildSettings& other);
@@ -44,13 +43,6 @@ class BuildSettings {
}
void SetSecondarySourcePath(const SourceDir& d);
- // Set when we're running an external generator (e.g. GYP) and should
- // enable "external" flags on targets.
- bool using_external_generator() const { return using_external_generator_; }
- void set_using_external_generator(bool ueg) {
- using_external_generator_ = ueg;
- }
-
// Path of the python executable to run scripts with.
base::FilePath python_path() const { return python_path_; }
void set_python_path(const base::FilePath& p) { python_path_ = p; }
@@ -74,16 +66,6 @@ class BuildSettings {
Args& build_args() { return build_args_; }
const Args& build_args() const { return build_args_; }
- // These accessors do not return const objects since the resulting objects
- // are threadsafe. In this setting, we use constness primarily to ensure
- // that the Settings object is used in a threadsafe manner. Although this
- // violates the concept of logical constness, that's less important in our
- // application, and actually implementing this in a way that preserves
- // logical constness is cumbersome.
- ItemTree& item_tree() const { return item_tree_; }
- TargetManager& target_manager() const { return target_manager_; }
- ToolchainManager& toolchain_manager() const { return toolchain_manager_; }
-
// Returns the full absolute OS path cooresponding to the given file in the
// root source tree.
base::FilePath GetFullPath(const SourceFile& file) const;
@@ -95,22 +77,16 @@ class BuildSettings {
base::FilePath GetFullPathSecondary(const SourceFile& file) const;
base::FilePath GetFullPathSecondary(const SourceDir& dir) const;
- // This is the callback to execute when a target is marked resolved. If we
- // don't need to do anything, this will be null. When a target is resolved,
- // this callback should be posted to the scheduler pool so the work is
- // distributed properly.
- const TargetResolvedCallback& target_resolved_callback() const {
- return target_resolved_callback_;
- }
- void set_target_resolved_callback(const TargetResolvedCallback& cb) {
- target_resolved_callback_ = cb;
+ // Called when an item is defined from a background thread.
+ void ItemDefined(scoped_ptr<Item> item) const;
+ void set_item_defined_callback(ItemDefinedCallback cb) {
+ item_defined_callback_ = cb;
}
private:
base::FilePath root_path_;
std::string root_path_utf8_;
base::FilePath secondary_source_path_;
- bool using_external_generator_;
base::FilePath python_path_;
SourceFile build_config_file_;
@@ -118,12 +94,7 @@ class BuildSettings {
std::string build_to_source_dir_string_;
Args build_args_;
- TargetResolvedCallback target_resolved_callback_;
-
- // See getters above.
- mutable ItemTree item_tree_;
- mutable TargetManager target_manager_;
- mutable ToolchainManager toolchain_manager_;
+ ItemDefinedCallback item_defined_callback_;
BuildSettings& operator=(const BuildSettings& other); // Disallow.
};
« no previous file with comments | « tools/gn/binary_target_generator.cc ('k') | tools/gn/build_settings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698