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

Unified Diff: extensions/common/features/simple_feature.h

Issue 2186893002: Reduce size of generated extension FeatureProviders. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/common/features/json_feature_provider.cc ('k') | extensions/common/features/simple_feature.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/features/simple_feature.h
diff --git a/extensions/common/features/simple_feature.h b/extensions/common/features/simple_feature.h
index 7dba312b1713b669b72e080d296a9ac01bc49d00..fb931562298d7780739ed0c411a69535105ae1cb 100644
--- a/extensions/common/features/simple_feature.h
+++ b/extensions/common/features/simple_feature.h
@@ -7,6 +7,7 @@
#include <stddef.h>
+#include <initializer_list>
#include <memory>
#include <set>
#include <string>
@@ -99,28 +100,27 @@ class SimpleFeature : public Feature {
};
// Setters used by generated code to create the feature.
- // NOTE: These setters use rvalue references deliberately. These should only
- // ever be used by generated code, and we ensure that in each call, the new
- // value is constructed in-place. This allows us to avoid a copy when we
- // assign it to the value in this class, and results in noticable improvements
- // in both speed and binary size.
- void set_blacklist(std::vector<std::string>&& blacklist);
+ // NOTE: These setters use base::StringPiece and std::initalizer_list rather
+ // than std::string and std::vector for binary size reasons. Using STL types
+ // directly in the header means that code that doesn't already have that exact
+ // type ends up triggering many implicit conversions which are all inlined.
+ void set_blacklist(std::initializer_list<const char* const> blacklist);
void set_channel(version_info::Channel channel) {
channel_.reset(new version_info::Channel(channel));
}
- void set_command_line_switch(std::string&& command_line_switch);
+ void set_command_line_switch(base::StringPiece command_line_switch);
void set_component_extensions_auto_granted(bool granted) {
component_extensions_auto_granted_ = granted;
}
- void set_contexts(std::vector<Context>&& contexts);
- void set_dependencies(std::vector<std::string>&& dependencies);
- void set_extension_types(std::vector<Manifest::Type>&& types);
+ void set_contexts(std::initializer_list<Context> contexts);
+ void set_dependencies(std::initializer_list<const char* const> dependencies);
+ void set_extension_types(std::initializer_list<Manifest::Type> types);
void set_internal(bool is_internal) { is_internal_ = is_internal; }
void set_location(Location location) { location_ = location; }
// set_matches() is an exception to pass-by-value since we construct an
// URLPatternSet from the vector of strings.
// TODO(devlin): Pass in an URLPatternSet directly.
- void set_matches(const std::vector<std::string>& matches);
+ void set_matches(std::initializer_list<const char* const> matches);
void set_max_manifest_version(int max_manifest_version) {
max_manifest_version_ = max_manifest_version;
}
@@ -128,8 +128,8 @@ class SimpleFeature : public Feature {
min_manifest_version_ = min_manifest_version;
}
void set_noparent(bool no_parent) { no_parent_ = no_parent; }
- void set_platforms(std::vector<Platform>&& platforms);
- void set_whitelist(std::vector<std::string>&& whitelist);
+ void set_platforms(std::initializer_list<Platform> platforms);
+ void set_whitelist(std::initializer_list<const char* const> whitelist);
protected:
// Accessors used by subclasses in feature verification.
« no previous file with comments | « extensions/common/features/json_feature_provider.cc ('k') | extensions/common/features/simple_feature.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698