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

Side by Side Diff: net/disk_cache/simple/simple_backend_impl.cc

Issue 13839011: Asynchronous initialization in Simple Index. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "net/disk_cache/simple/simple_backend_impl.h" 5 #include "net/disk_cache/simple/simple_backend_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 base::Bind(&SimpleBackendImpl::EnsureCachePathExists, 62 base::Bind(&SimpleBackendImpl::EnsureCachePathExists,
63 simple_cache_path, 63 simple_cache_path,
64 cache_thread, 64 cache_thread,
65 MessageLoopProxy::current(), 65 MessageLoopProxy::current(),
66 callback, 66 callback,
67 backend)); 67 backend));
68 return net::ERR_IO_PENDING; 68 return net::ERR_IO_PENDING;
69 } 69 }
70 70
71 SimpleBackendImpl::~SimpleBackendImpl() { 71 SimpleBackendImpl::~SimpleBackendImpl() {
72 index_->Cleanup(); 72 index_->WriteToDisk();
73 } 73 }
74 74
75 net::CacheType SimpleBackendImpl::GetCacheType() const { 75 net::CacheType SimpleBackendImpl::GetCacheType() const {
76 return net::DISK_CACHE; 76 return net::DISK_CACHE;
77 } 77 }
78 78
79 int32 SimpleBackendImpl::GetEntryCount() const { 79 int32 SimpleBackendImpl::GetEntryCount() const {
80 NOTIMPLEMENTED(); 80 NOTIMPLEMENTED();
81 return 0; 81 return 0;
82 } 82 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 NOTIMPLEMENTED(); 136 NOTIMPLEMENTED();
137 } 137 }
138 138
139 void SimpleBackendImpl::OnExternalCacheHit(const std::string& key) { 139 void SimpleBackendImpl::OnExternalCacheHit(const std::string& key) {
140 NOTIMPLEMENTED(); 140 NOTIMPLEMENTED();
141 } 141 }
142 142
143 SimpleBackendImpl::SimpleBackendImpl( 143 SimpleBackendImpl::SimpleBackendImpl(
144 const scoped_refptr<base::TaskRunner>& cache_thread, 144 const scoped_refptr<base::TaskRunner>& cache_thread,
145 const FilePath& path) : path_(path) { 145 const FilePath& path) : path_(path) {
146 index_.reset(new SimpleIndex(cache_thread, path)); 146 index_.reset(new SimpleIndex(cache_thread,
147 MessageLoopProxy::current(), // io_thread
148 path));
147 } 149 }
148 150
149 void SimpleBackendImpl::Initialize() { 151 void SimpleBackendImpl::Initialize() {
150 index_->Initialize(); 152 index_->Initialize();
151 } 153 }
152 154
153 // static 155 // static
154 void SimpleBackendImpl::EnsureCachePathExists( 156 void SimpleBackendImpl::EnsureCachePathExists(
155 const FilePath& path, 157 const FilePath& path,
156 const scoped_refptr<base::TaskRunner>& cache_thread, 158 const scoped_refptr<base::TaskRunner>& cache_thread,
(...skipping 13 matching lines...) Expand all
170 base::Bind(callback, result)); 172 base::Bind(callback, result));
171 } else { 173 } else {
172 io_thread->PostTask(FROM_HERE, 174 io_thread->PostTask(FROM_HERE,
173 base::Bind( 175 base::Bind(
174 &DeleteBackendImpl, 176 &DeleteBackendImpl,
175 backend, callback, result)); 177 backend, callback, result));
176 } 178 }
177 } 179 }
178 180
179 } // namespace disk_cache 181 } // namespace disk_cache
OLDNEW
« no previous file with comments | « no previous file | net/disk_cache/simple/simple_disk_format.h » ('j') | net/disk_cache/simple/simple_disk_format.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698