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

Side by Side Diff: chrome/browser/dom_ui/chrome_url_data_manager.cc

Issue 6268014: Release all DataSources before the main thread goes away. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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/browser/dom_ui/chrome_url_data_manager.h ('k') | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/browser/dom_ui/chrome_url_data_manager.h" 5 #include "chrome/browser/dom_ui/chrome_url_data_manager.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/i18n/rtl.h" 8 #include "base/i18n/rtl.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 // If |AddDataSource| is called more than once, it will destruct the object 200 // If |AddDataSource| is called more than once, it will destruct the object
201 // that it had before, as it is the only thing still holding a reference to 201 // that it had before, as it is the only thing still holding a reference to
202 // that object. |DataSource| uses the |DeleteOnUIThread| trait to insure 202 // that object. |DataSource| uses the |DeleteOnUIThread| trait to insure
203 // that the destructor is called on the UI thread. 203 // that the destructor is called on the UI thread.
204 // 204 //
205 // TODO(jackson): A new data source with same name should not clobber the 205 // TODO(jackson): A new data source with same name should not clobber the
206 // existing one. 206 // existing one.
207 data_sources_[source->source_name()] = source; 207 data_sources_[source->source_name()] = source;
208 } 208 }
209 209
210 void ChromeURLDataManager::RemoveAllDataSources() {
211 for (DataSourceMap::iterator i = data_sources_.begin();
eroman 2011/01/25 23:47:35 why not simply data_sources_.clear() ?
ahendrickson 2011/01/26 04:34:38 I wanted to call Release() rather than destruct th
212 i != data_sources_.end();
213 i = data_sources_.begin()) {
214 (*i).second = NULL; // Calls Release().
215 data_sources_.erase(i);
216 }
217 }
218
210 void ChromeURLDataManager::AddFileSource(const std::string& source_name, 219 void ChromeURLDataManager::AddFileSource(const std::string& source_name,
211 const FilePath& file_path) { 220 const FilePath& file_path) {
212 DCHECK(file_sources_.count(source_name) == 0); 221 DCHECK(file_sources_.count(source_name) == 0);
213 file_sources_[source_name] = file_path; 222 file_sources_[source_name] = file_path;
214 } 223 }
215 224
216 void ChromeURLDataManager::RemoveFileSource(const std::string& source_name) { 225 void ChromeURLDataManager::RemoveFileSource(const std::string& source_name) {
217 DCHECK(file_sources_.count(source_name) == 1); 226 DCHECK(file_sources_.count(source_name) == 1);
218 file_sources_.erase(source_name); 227 file_sources_.erase(source_name);
219 } 228 }
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 net::ERR_INVALID_URL)); 459 net::ERR_INVALID_URL));
451 } 460 }
452 } 461 }
453 462
454 URLRequestChromeFileJob::URLRequestChromeFileJob(net::URLRequest* request, 463 URLRequestChromeFileJob::URLRequestChromeFileJob(net::URLRequest* request,
455 const FilePath& path) 464 const FilePath& path)
456 : net::URLRequestFileJob(request, path) { 465 : net::URLRequestFileJob(request, path) {
457 } 466 }
458 467
459 URLRequestChromeFileJob::~URLRequestChromeFileJob() { } 468 URLRequestChromeFileJob::~URLRequestChromeFileJob() { }
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/chrome_url_data_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698