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

Side by Side Diff: content/browser/net/url_request_slow_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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "content/browser/net/url_request_slow_http_job.h" 5 #include "content/browser/net/url_request_slow_http_job.h"
6 6
7 #include "base/time.h" 7 #include "base/time.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "net/url_request/url_request_filter.h" 9 #include "net/url_request/url_request_filter.h"
10 10
11 static const char kMockHostname[] = "mock.slow.http"; 11 static const char kMockHostname[] = "mock.slow.http";
12 12
13 FilePath URLRequestSlowHTTPJob::base_path_; 13 namespace {
14
15 // This is the file path leading to the root of the directory to use as the
16 // root of the http server. This returns a reference that can be assigned to.
17 FilePath& BasePath() {
18 CR_DEFINE_STATIC_LOCAL(FilePath, base_path, ());
19 return base_path;
20 }
21
22 } // namespace
14 23
15 // static 24 // static
16 const int URLRequestSlowHTTPJob::kDelayMs = 1000; 25 const int URLRequestSlowHTTPJob::kDelayMs = 1000;
17 26
18 using base::TimeDelta; 27 using base::TimeDelta;
19 28
20 /* static */ 29 // static
21 net::URLRequestJob* URLRequestSlowHTTPJob::Factory(net::URLRequest* request, 30 net::URLRequestJob* URLRequestSlowHTTPJob::Factory(net::URLRequest* request,
22 const std::string& scheme) { 31 const std::string& scheme) {
23 return new URLRequestSlowHTTPJob(request, 32 return new URLRequestSlowHTTPJob(request,
24 GetOnDiskPath(base_path_, request, scheme)); 33 GetOnDiskPath(BasePath(), request, scheme));
25 } 34 }
26 35
27 /* static */ 36 // static
28 void URLRequestSlowHTTPJob::AddUrlHandler(const FilePath& base_path) { 37 void URLRequestSlowHTTPJob::AddUrlHandler(const FilePath& base_path) {
29 base_path_ = base_path; 38 BasePath() = base_path;
30 39
31 // Add kMockHostname to net::URLRequestFilter. 40 // Add kMockHostname to net::URLRequestFilter.
32 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance(); 41 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance();
33 filter->AddHostnameHandler("http", kMockHostname, 42 filter->AddHostnameHandler("http", kMockHostname,
34 URLRequestSlowHTTPJob::Factory); 43 URLRequestSlowHTTPJob::Factory);
35 } 44 }
36 45
37 /* static */ 46 /* static */
38 GURL URLRequestSlowHTTPJob::GetMockUrl(const FilePath& path) { 47 GURL URLRequestSlowHTTPJob::GetMockUrl(const FilePath& path) {
39 std::string url = "http://"; 48 std::string url = "http://";
(...skipping 13 matching lines...) Expand all
53 delay_timer_.Start(FROM_HERE, TimeDelta::FromMilliseconds(kDelayMs), this, 62 delay_timer_.Start(FROM_HERE, TimeDelta::FromMilliseconds(kDelayMs), this,
54 &URLRequestSlowHTTPJob::RealStart); 63 &URLRequestSlowHTTPJob::RealStart);
55 } 64 }
56 65
57 URLRequestSlowHTTPJob::~URLRequestSlowHTTPJob() { 66 URLRequestSlowHTTPJob::~URLRequestSlowHTTPJob() {
58 } 67 }
59 68
60 void URLRequestSlowHTTPJob::RealStart() { 69 void URLRequestSlowHTTPJob::RealStart() {
61 URLRequestMockHTTPJob::Start(); 70 URLRequestMockHTTPJob::Start();
62 } 71 }
OLDNEW
« no previous file with comments | « content/browser/net/url_request_slow_http_job.h ('k') | content/browser/renderer_host/render_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698