| Index: webkit/appcache/appcache_service.cc
|
| diff --git a/webkit/appcache/appcache_service.cc b/webkit/appcache/appcache_service.cc
|
| index bc0f4cc17207a60a3d94bbb10b5f744859de110a..57ba00d2337dcba7da97ba0e8c49836f4a4001a4 100644
|
| --- a/webkit/appcache/appcache_service.cc
|
| +++ b/webkit/appcache/appcache_service.cc
|
| @@ -110,12 +110,16 @@ class AppCacheService::DeleteHelper : public AsyncHelper {
|
| public:
|
| DeleteHelper(
|
| AppCacheService* service, const GURL& manifest_url,
|
| - net::CompletionCallback* callback)
|
| - : AsyncHelper(service, callback), manifest_url_(manifest_url) {
|
| + net::CompletionCallback* callback, bool sync)
|
| + : AsyncHelper(service, callback), manifest_url_(manifest_url),
|
| + sync_(sync) {
|
| }
|
|
|
| virtual void Start() {
|
| - service_->storage()->LoadOrCreateGroup(manifest_url_, this);
|
| + if (sync_)
|
| + service_->storage()->SyncLoadOrCreateGroup(manifest_url_, this);
|
| + else
|
| + service_->storage()->LoadOrCreateGroup(manifest_url_, this);
|
| }
|
|
|
| private:
|
| @@ -126,6 +130,8 @@ class AppCacheService::DeleteHelper : public AsyncHelper {
|
| appcache::AppCacheGroup* group, bool success);
|
|
|
| GURL manifest_url_;
|
| + bool sync_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(DeleteHelper);
|
| };
|
|
|
| @@ -134,16 +140,21 @@ void AppCacheService::DeleteHelper::OnGroupLoaded(
|
| if (group) {
|
| group->set_being_deleted(true);
|
| group->CancelUpdate();
|
| - service_->storage()->MakeGroupObsolete(group, this);
|
| + if (sync_)
|
| + service_->storage()->SyncMakeGroupObsolete(group, this);
|
| + else
|
| + service_->storage()->MakeGroupObsolete(group, this);
|
| } else {
|
| - CallCallback(net::ERR_FAILED);
|
| + if (!sync_)
|
| + CallCallback(net::ERR_FAILED);
|
| delete this;
|
| }
|
| }
|
|
|
| void AppCacheService::DeleteHelper::OnGroupMadeObsolete(
|
| appcache::AppCacheGroup* group, bool success) {
|
| - CallCallback(success ? net::OK : net::ERR_FAILED);
|
| + if (!sync_)
|
| + CallCallback(success ? net::OK : net::ERR_FAILED);
|
| delete this;
|
| }
|
|
|
| @@ -243,12 +254,15 @@ class AppCacheService::GetInfoHelper : AsyncHelper {
|
| public:
|
| GetInfoHelper(
|
| AppCacheService* service, AppCacheInfoCollection* collection,
|
| - net::CompletionCallback* callback)
|
| - : AsyncHelper(service, callback), collection_(collection) {
|
| + net::CompletionCallback* callback, bool sync)
|
| + : AsyncHelper(service, callback), collection_(collection), sync_(sync) {
|
| }
|
|
|
| virtual void Start() {
|
| - service_->storage()->GetAllInfo(this);
|
| + if (sync_)
|
| + service_->storage()->SyncGetAllInfo(this);
|
| + else
|
| + service_->storage()->GetAllInfo(this);
|
| }
|
|
|
| private:
|
| @@ -256,6 +270,8 @@ class AppCacheService::GetInfoHelper : AsyncHelper {
|
| virtual void OnAllInfo(AppCacheInfoCollection* collection);
|
|
|
| scoped_refptr<AppCacheInfoCollection> collection_;
|
| + bool sync_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(GetInfoHelper);
|
| };
|
|
|
| @@ -263,7 +279,8 @@ void AppCacheService::GetInfoHelper::OnAllInfo(
|
| AppCacheInfoCollection* collection) {
|
| if (collection)
|
| collection->infos_by_origin.swap(collection_->infos_by_origin);
|
| - CallCallback(collection ? net::OK : net::ERR_FAILED);
|
| + if (!sync_)
|
| + CallCallback(collection ? net::OK : net::ERR_FAILED);
|
| delete this;
|
| }
|
|
|
| @@ -309,13 +326,25 @@ void AppCacheService::CanHandleMainResourceOffline(
|
| void AppCacheService::GetAllAppCacheInfo(AppCacheInfoCollection* collection,
|
| net::CompletionCallback* callback) {
|
| DCHECK(collection);
|
| - GetInfoHelper* helper = new GetInfoHelper(this, collection, callback);
|
| + GetInfoHelper* helper = new GetInfoHelper(this, collection, callback, false);
|
| + helper->Start();
|
| +}
|
| +
|
| +void AppCacheService::SyncGetAllAppCacheInfo(
|
| + AppCacheInfoCollection* collection) {
|
| + DCHECK(collection);
|
| + GetInfoHelper* helper = new GetInfoHelper(this, collection, NULL, true);
|
| helper->Start();
|
| }
|
|
|
| void AppCacheService::DeleteAppCacheGroup(const GURL& manifest_url,
|
| net::CompletionCallback* callback) {
|
| - DeleteHelper* helper = new DeleteHelper(this, manifest_url, callback);
|
| + DeleteHelper* helper = new DeleteHelper(this, manifest_url, callback, false);
|
| + helper->Start();
|
| +}
|
| +
|
| +void AppCacheService::SyncDeleteAppCacheGroup(const GURL& manifest_url) {
|
| + DeleteHelper* helper = new DeleteHelper(this, manifest_url, NULL, true);
|
| helper->Start();
|
| }
|
|
|
|
|