cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / components / webdata / common / web_data_service_base.cc
blob3418eb4dc8dbea5d8b9adffa14f608f661fd0e8a
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
3 // found in the LICENSE file.
5 #include "components/webdata/common/web_data_service_base.h"
7 #include "base/bind.h"
8 #include "base/single_thread_task_runner.h"
9 #include "base/stl_util.h"
10 #include "base/threading/thread.h"
11 #include "components/webdata/common/web_database_service.h"
13 ////////////////////////////////////////////////////////////////////////////////
15 // WebDataServiceBase implementation.
17 ////////////////////////////////////////////////////////////////////////////////
19 using base::Bind;
20 using base::Time;
22 WebDataServiceBase::WebDataServiceBase(
23 scoped_refptr<WebDatabaseService> wdbs,
24 const ProfileErrorCallback& callback,
25 const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread)
26 : base::RefCountedDeleteOnMessageLoop<WebDataServiceBase>(ui_thread),
27 wdbs_(wdbs),
28 profile_error_callback_(callback) {
31 void WebDataServiceBase::ShutdownOnUIThread() {
34 void WebDataServiceBase::Init() {
35 DCHECK(wdbs_.get());
36 wdbs_->RegisterDBErrorCallback(profile_error_callback_);
37 wdbs_->LoadDatabase();
40 void WebDataServiceBase::ShutdownDatabase() {
41 if (!wdbs_.get())
42 return;
43 wdbs_->ShutdownDatabase();
46 void WebDataServiceBase::CancelRequest(Handle h) {
47 if (!wdbs_.get())
48 return;
49 wdbs_->CancelRequest(h);
52 bool WebDataServiceBase::IsDatabaseLoaded() {
53 if (!wdbs_.get())
54 return false;
55 return wdbs_->db_loaded();
58 void WebDataServiceBase::RegisterDBLoadedCallback(
59 const DBLoadedCallback& callback) {
60 if (!wdbs_.get())
61 return;
62 wdbs_->RegisterDBLoadedCallback(callback);
65 WebDatabase* WebDataServiceBase::GetDatabase() {
66 if (!wdbs_.get())
67 return NULL;
68 return wdbs_->GetDatabaseOnDB();
71 WebDataServiceBase::~WebDataServiceBase() {