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

Side by Side Diff: chrome/test/testing_profile.cc

Issue 3971004: Revert "Revert "Const-ify RefCountedThreadSafe::AddRef and Release."" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/service/net/service_url_request_context.cc ('k') | chrome_frame/metrics_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/test/testing_profile.h" 5 #include "chrome/test/testing_profile.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #include "base/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 // a leak if your test does not have a BrowserThread::IO in it because 115 // a leak if your test does not have a BrowserThread::IO in it because
116 // URLRequestContextGetter is defined as a ReferenceCounted object with a 116 // URLRequestContextGetter is defined as a ReferenceCounted object with a
117 // special trait that deletes it on the IO thread. 117 // special trait that deletes it on the IO thread.
118 class TestURLRequestContextGetter : public URLRequestContextGetter { 118 class TestURLRequestContextGetter : public URLRequestContextGetter {
119 public: 119 public:
120 virtual URLRequestContext* GetURLRequestContext() { 120 virtual URLRequestContext* GetURLRequestContext() {
121 if (!context_) 121 if (!context_)
122 context_ = new TestURLRequestContext(); 122 context_ = new TestURLRequestContext();
123 return context_.get(); 123 return context_.get();
124 } 124 }
125 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() { 125 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const {
126 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); 126 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO);
127 } 127 }
128 128
129 private: 129 private:
130 scoped_refptr<URLRequestContext> context_; 130 scoped_refptr<URLRequestContext> context_;
131 }; 131 };
132 132
133 class TestExtensionURLRequestContext : public URLRequestContext { 133 class TestExtensionURLRequestContext : public URLRequestContext {
134 public: 134 public:
135 TestExtensionURLRequestContext() { 135 TestExtensionURLRequestContext() {
136 net::CookieMonster* cookie_monster = new net::CookieMonster(NULL, NULL); 136 net::CookieMonster* cookie_monster = new net::CookieMonster(NULL, NULL);
137 const char* schemes[] = {chrome::kExtensionScheme}; 137 const char* schemes[] = {chrome::kExtensionScheme};
138 cookie_monster->SetCookieableSchemes(schemes, 1); 138 cookie_monster->SetCookieableSchemes(schemes, 1);
139 cookie_store_ = cookie_monster; 139 cookie_store_ = cookie_monster;
140 } 140 }
141 }; 141 };
142 142
143 class TestExtensionURLRequestContextGetter : public URLRequestContextGetter { 143 class TestExtensionURLRequestContextGetter : public URLRequestContextGetter {
144 public: 144 public:
145 virtual URLRequestContext* GetURLRequestContext() { 145 virtual URLRequestContext* GetURLRequestContext() {
146 if (!context_) 146 if (!context_)
147 context_ = new TestExtensionURLRequestContext(); 147 context_ = new TestExtensionURLRequestContext();
148 return context_.get(); 148 return context_.get();
149 } 149 }
150 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() { 150 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const {
151 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); 151 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO);
152 } 152 }
153 153
154 private: 154 private:
155 scoped_refptr<URLRequestContext> context_; 155 scoped_refptr<URLRequestContext> context_;
156 }; 156 };
157 157
158 } // namespace 158 } // namespace
159 159
160 TestingProfile::TestingProfile() 160 TestingProfile::TestingProfile()
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 } 505 }
506 return profile_sync_service_.get(); 506 return profile_sync_service_.get();
507 } 507 }
508 508
509 void TestingProfile::DestroyWebDataService() { 509 void TestingProfile::DestroyWebDataService() {
510 if (!web_data_service_.get()) 510 if (!web_data_service_.get())
511 return; 511 return;
512 512
513 web_data_service_->Shutdown(); 513 web_data_service_->Shutdown();
514 } 514 }
OLDNEW
« no previous file with comments | « chrome/service/net/service_url_request_context.cc ('k') | chrome_frame/metrics_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698