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

Unified Diff: base/environment.h

Issue 2094913002: Make base::Environment::Create() return unique_ptrs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit, rebase Created 4 years, 6 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 | « no previous file | base/environment.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/environment.h
diff --git a/base/environment.h b/base/environment.h
index 12eeaf7ebb115ad0bd45d8c9e9cc64bbe180a161..3a4ed04e4bb58238dbe84708406ba4d8ce38e279 100644
--- a/base/environment.h
+++ b/base/environment.h
@@ -11,6 +11,7 @@
#include "base/base_export.h"
#include "base/strings/string16.h"
+#include "base/strings/string_piece.h"
#include "build/build_config.h"
namespace base {
@@ -27,23 +28,22 @@ class BASE_EXPORT Environment {
public:
virtual ~Environment();
- // Static factory method that returns the implementation that provide the
- // appropriate platform-specific instance.
- static Environment* Create();
+ // Returns the appropriate platform-specific instance.
+ static std::unique_ptr<Environment> Create();
// Gets an environment variable's value and stores it in |result|.
// Returns false if the key is unset.
- virtual bool GetVar(const char* variable_name, std::string* result) = 0;
+ virtual bool GetVar(StringPiece variable_name, std::string* result) = 0;
- // Syntactic sugar for GetVar(variable_name, NULL);
- virtual bool HasVar(const char* variable_name);
+ // Syntactic sugar for GetVar(variable_name, nullptr);
+ virtual bool HasVar(StringPiece variable_name);
// Returns true on success, otherwise returns false.
- virtual bool SetVar(const char* variable_name,
+ virtual bool SetVar(StringPiece variable_name,
const std::string& new_value) = 0;
// Returns true on success, otherwise returns false.
- virtual bool UnSetVar(const char* variable_name) = 0;
+ virtual bool UnSetVar(StringPiece variable_name) = 0;
};
« no previous file with comments | « no previous file | base/environment.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698