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

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

Issue 1015153002: Commit History transaction when app is backgrounded on iOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « components/history/core/browser/history_service.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) 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 // The history system runs on a background thread so that potentially slow 5 // The history system runs on a background thread so that potentially slow
6 // database operations don't delay the browser. This backend processing is 6 // database operations don't delay the browser. This backend processing is
7 // represented by HistoryBackend. The HistoryService's job is to dispatch to 7 // represented by HistoryBackend. The HistoryService's job is to dispatch to
8 // that thread. 8 // that thread.
9 // 9 //
10 // Main thread History thread 10 // Main thread History thread
(...skipping 28 matching lines...) Expand all
39 #include "components/history/core/browser/in_memory_history_backend.h" 39 #include "components/history/core/browser/in_memory_history_backend.h"
40 #include "components/history/core/browser/keyword_search_term.h" 40 #include "components/history/core/browser/keyword_search_term.h"
41 #include "components/history/core/browser/visit_database.h" 41 #include "components/history/core/browser/visit_database.h"
42 #include "components/history/core/browser/visit_delegate.h" 42 #include "components/history/core/browser/visit_delegate.h"
43 #include "components/history/core/browser/visit_filter.h" 43 #include "components/history/core/browser/visit_filter.h"
44 #include "components/history/core/browser/web_history_service.h" 44 #include "components/history/core/browser/web_history_service.h"
45 #include "components/history/core/common/thumbnail_score.h" 45 #include "components/history/core/common/thumbnail_score.h"
46 #include "sync/api/sync_error_factory.h" 46 #include "sync/api/sync_error_factory.h"
47 #include "third_party/skia/include/core/SkBitmap.h" 47 #include "third_party/skia/include/core/SkBitmap.h"
48 48
49 #if defined(OS_IOS)
50 #include "base/critical_closure.h"
51 #endif
52
49 using base::Time; 53 using base::Time;
50 54
51 namespace history { 55 namespace history {
52 namespace { 56 namespace {
53 57
54 static const char* kHistoryThreadName = "Chrome_HistoryThread"; 58 static const char* kHistoryThreadName = "Chrome_HistoryThread";
55 59
56 void RunWithFaviconResults( 60 void RunWithFaviconResults(
57 const favicon_base::FaviconResultsCallback& callback, 61 const favicon_base::FaviconResultsCallback& callback,
58 std::vector<favicon_base::FaviconRawBitmapResult>* bitmap_results) { 62 std::vector<favicon_base::FaviconRawBitmapResult>* bitmap_results) {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 DCHECK(thread_checker_.CalledOnValidThread()); 202 DCHECK(thread_checker_.CalledOnValidThread());
199 // Shutdown the backend. This does nothing if Cleanup was already invoked. 203 // Shutdown the backend. This does nothing if Cleanup was already invoked.
200 Cleanup(); 204 Cleanup();
201 } 205 }
202 206
203 bool HistoryService::BackendLoaded() { 207 bool HistoryService::BackendLoaded() {
204 DCHECK(thread_checker_.CalledOnValidThread()); 208 DCHECK(thread_checker_.CalledOnValidThread());
205 return backend_loaded_; 209 return backend_loaded_;
206 } 210 }
207 211
212 #if defined(OS_IOS)
213 void HistoryService::HandleBackgrounding() {
214 if (!thread_ || !history_backend_.get())
215 return;
216
217 ScheduleTask(PRIORITY_NORMAL,
218 base::MakeCriticalClosure(base::Bind(
219 &HistoryBackend::PersistState, history_backend_.get())));
220 }
221 #endif
222
208 void HistoryService::ClearCachedDataForContextID(ContextID context_id) { 223 void HistoryService::ClearCachedDataForContextID(ContextID context_id) {
209 DCHECK(thread_) << "History service being called after cleanup"; 224 DCHECK(thread_) << "History service being called after cleanup";
210 DCHECK(thread_checker_.CalledOnValidThread()); 225 DCHECK(thread_checker_.CalledOnValidThread());
211 ScheduleTask(PRIORITY_NORMAL, 226 ScheduleTask(PRIORITY_NORMAL,
212 base::Bind(&HistoryBackend::ClearCachedDataForContextID, 227 base::Bind(&HistoryBackend::ClearCachedDataForContextID,
213 history_backend_.get(), context_id)); 228 history_backend_.get(), context_id));
214 } 229 }
215 230
216 URLDatabase* HistoryService::InMemoryDatabase() { 231 URLDatabase* HistoryService::InMemoryDatabase() {
217 DCHECK(thread_checker_.CalledOnValidThread()); 232 DCHECK(thread_checker_.CalledOnValidThread());
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 return favicon_changed_callback_list_.Add(callback); 1133 return favicon_changed_callback_list_.Add(callback);
1119 } 1134 }
1120 1135
1121 void HistoryService::NotifyFaviconChanged( 1136 void HistoryService::NotifyFaviconChanged(
1122 const std::set<GURL>& changed_favicons) { 1137 const std::set<GURL>& changed_favicons) {
1123 DCHECK(thread_checker_.CalledOnValidThread()); 1138 DCHECK(thread_checker_.CalledOnValidThread());
1124 favicon_changed_callback_list_.Notify(changed_favicons); 1139 favicon_changed_callback_list_.Notify(changed_favicons);
1125 } 1140 }
1126 1141
1127 } // namespace history 1142 } // namespace history
OLDNEW
« no previous file with comments | « components/history/core/browser/history_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698