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

Unified Diff: content/browser/net/url_request_mock_http_job.cc

Issue 8493016: content: Remove 16 exit time destructors and 15 static initializers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mac compile Created 9 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
Index: content/browser/net/url_request_mock_http_job.cc
diff --git a/content/browser/net/url_request_mock_http_job.cc b/content/browser/net/url_request_mock_http_job.cc
index 4b22301440ec8288c2aeaada54e754b73b356935..09af31d5a96b596078d1e515c33fbe31475fd958 100644
--- a/content/browser/net/url_request_mock_http_job.cc
+++ b/content/browser/net/url_request_mock_http_job.cc
@@ -14,22 +14,31 @@
#include "net/http/http_response_headers.h"
#include "net/url_request/url_request_filter.h"
-static const char kMockHostname[] = "mock.http";
-static const FilePath::CharType kMockHeaderFileSuffix[] =
+const char kMockHostname[] = "mock.http";
+const FilePath::CharType kMockHeaderFileSuffix[] =
FILE_PATH_LITERAL(".mock-http-headers");
-FilePath URLRequestMockHTTPJob::base_path_;
+namespace {
+
+// This is the file path leading to the root of the directory to use as the
+// root of the http server. This returns a reference that can be assigned to.
+FilePath& BasePath() {
+ CR_DEFINE_STATIC_LOCAL(FilePath, base_path, ());
+ return base_path;
+}
+
+} // namespace
// static
net::URLRequestJob* URLRequestMockHTTPJob::Factory(net::URLRequest* request,
const std::string& scheme) {
return new URLRequestMockHTTPJob(request,
- GetOnDiskPath(base_path_, request, scheme));
+ GetOnDiskPath(BasePath(), request, scheme));
}
// static
void URLRequestMockHTTPJob::AddUrlHandler(const FilePath& base_path) {
- base_path_ = base_path;
+ BasePath() = base_path;
// Add kMockHostname to net::URLRequestFilter.
net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance();
@@ -37,7 +46,7 @@ void URLRequestMockHTTPJob::AddUrlHandler(const FilePath& base_path) {
URLRequestMockHTTPJob::Factory);
}
-/* static */
+// static
GURL URLRequestMockHTTPJob::GetMockUrl(const FilePath& path) {
std::string url = "http://";
url.append(kMockHostname);
@@ -48,7 +57,7 @@ GURL URLRequestMockHTTPJob::GetMockUrl(const FilePath& path) {
return GURL(url);
}
-/* static */
+// static
GURL URLRequestMockHTTPJob::GetMockViewSourceUrl(const FilePath& path) {
std::string url = chrome::kViewSourceScheme;
url.append(":");
@@ -56,7 +65,7 @@ GURL URLRequestMockHTTPJob::GetMockViewSourceUrl(const FilePath& path) {
return GURL(url);
}
-/* static */
+// static
FilePath URLRequestMockHTTPJob::GetOnDiskPath(const FilePath& base_path,
net::URLRequest* request,
const std::string& scheme) {
« no previous file with comments | « content/browser/net/url_request_mock_http_job.h ('k') | content/browser/net/url_request_slow_download_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698