OLD | NEW |
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 "chrome/browser/sync/glue/typed_url_change_processor.h" | 5 #include "chrome/browser/sync/glue/typed_url_change_processor.h" |
6 | 6 |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/single_thread_task_runner.h" |
9 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
11 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/sync/glue/typed_url_model_associator.h" | 13 #include "chrome/browser/sync/glue/typed_url_model_associator.h" |
13 #include "chrome/browser/sync/profile_sync_service.h" | 14 #include "chrome/browser/sync/profile_sync_service.h" |
14 #include "components/history/core/browser/history_backend.h" | 15 #include "components/history/core/browser/history_backend.h" |
15 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
16 #include "sync/internal_api/public/change_record.h" | 17 #include "sync/internal_api/public/change_record.h" |
17 #include "sync/internal_api/public/read_node.h" | 18 #include "sync/internal_api/public/read_node.h" |
18 #include "sync/internal_api/public/write_node.h" | 19 #include "sync/internal_api/public/write_node.h" |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 | 326 |
326 void TypedUrlChangeProcessor::Disconnect() { | 327 void TypedUrlChangeProcessor::Disconnect() { |
327 base::AutoLock al(disconnect_lock_); | 328 base::AutoLock al(disconnect_lock_); |
328 disconnected_ = true; | 329 disconnected_ = true; |
329 } | 330 } |
330 | 331 |
331 void TypedUrlChangeProcessor::StartImpl() { | 332 void TypedUrlChangeProcessor::StartImpl() { |
332 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 333 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
333 DCHECK(history_backend_); | 334 DCHECK(history_backend_); |
334 DCHECK(backend_loop_); | 335 DCHECK(backend_loop_); |
335 backend_loop_->PostTask(FROM_HERE, | 336 backend_loop_->task_runner()->PostTask( |
336 base::Bind(&TypedUrlChangeProcessor::StartObserving, | 337 FROM_HERE, base::Bind(&TypedUrlChangeProcessor::StartObserving, |
337 base::Unretained(this))); | 338 base::Unretained(this))); |
338 } | 339 } |
339 | 340 |
340 void TypedUrlChangeProcessor::StartObserving() { | 341 void TypedUrlChangeProcessor::StartObserving() { |
341 DCHECK(backend_loop_ == base::MessageLoop::current()); | 342 DCHECK(backend_loop_ == base::MessageLoop::current()); |
342 DCHECK(history_backend_); | 343 DCHECK(history_backend_); |
343 DCHECK(profile_); | 344 DCHECK(profile_); |
344 history_backend_observer_.Add(history_backend_); | 345 history_backend_observer_.Add(history_backend_); |
345 } | 346 } |
346 | 347 |
347 void TypedUrlChangeProcessor::StopObserving() { | 348 void TypedUrlChangeProcessor::StopObserving() { |
348 DCHECK(backend_loop_ == base::MessageLoop::current()); | 349 DCHECK(backend_loop_ == base::MessageLoop::current()); |
349 DCHECK(history_backend_); | 350 DCHECK(history_backend_); |
350 DCHECK(profile_); | 351 DCHECK(profile_); |
351 history_backend_observer_.RemoveAll(); | 352 history_backend_observer_.RemoveAll(); |
352 } | 353 } |
353 | 354 |
354 } // namespace browser_sync | 355 } // namespace browser_sync |
OLD | NEW |