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

Side by Side Diff: components/history/core/browser/history_backend.cc

Issue 1074963003: Clean up potentially leaky use of base::DeletePointer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed another probleb Created 5 years, 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "components/history/core/browser/history_backend.h" 5 #include "components/history/core/browser/history_backend.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 : task_(task.Pass()), origin_loop_(origin_loop), is_canceled_(is_canceled) { 153 : task_(task.Pass()), origin_loop_(origin_loop), is_canceled_(is_canceled) {
154 DCHECK(task_); 154 DCHECK(task_);
155 DCHECK(origin_loop_.get()); 155 DCHECK(origin_loop_.get());
156 DCHECK(!is_canceled_.is_null()); 156 DCHECK(!is_canceled_.is_null());
157 } 157 }
158 158
159 QueuedHistoryDBTask::~QueuedHistoryDBTask() { 159 QueuedHistoryDBTask::~QueuedHistoryDBTask() {
160 // Ensure that |task_| is destroyed on its origin thread. 160 // Ensure that |task_| is destroyed on its origin thread.
161 origin_loop_->PostTask(FROM_HERE, 161 origin_loop_->PostTask(FROM_HERE,
162 base::Bind(&base::DeletePointer<HistoryDBTask>, 162 base::Bind(&base::DeletePointer<HistoryDBTask>,
163 base::Unretained(task_.release()))); 163 base::Passed(&task_)));
164 } 164 }
165 165
166 bool QueuedHistoryDBTask::is_canceled() { 166 bool QueuedHistoryDBTask::is_canceled() {
167 return is_canceled_.Run(); 167 return is_canceled_.Run();
168 } 168 }
169 169
170 bool QueuedHistoryDBTask::Run(HistoryBackend* backend, HistoryDatabase* db) { 170 bool QueuedHistoryDBTask::Run(HistoryBackend* backend, HistoryDatabase* db) {
171 return task_->RunOnDBThread(backend, db); 171 return task_->RunOnDBThread(backend, db);
172 } 172 }
173 173
(...skipping 2461 matching lines...) Expand 10 before | Expand all | Expand 10 after
2635 return true; 2635 return true;
2636 } 2636 }
2637 2637
2638 HistoryClient* HistoryBackend::GetHistoryClient() { 2638 HistoryClient* HistoryBackend::GetHistoryClient() {
2639 if (history_client_) 2639 if (history_client_)
2640 history_client_->BlockUntilBookmarksLoaded(); 2640 history_client_->BlockUntilBookmarksLoaded();
2641 return history_client_; 2641 return history_client_;
2642 } 2642 }
2643 2643
2644 } // namespace history 2644 } // namespace history
OLDNEW
« no previous file with comments | « chromeos/network/firewall_hole.cc ('k') | content/browser/media/capture/web_contents_audio_input_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698