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

Side by Side Diff: webkit/appcache/appcache_service.cc

Issue 8399019: base::Bind usage (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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
« no previous file with comments | « webkit/appcache/appcache_response.cc ('k') | webkit/appcache/appcache_service_unittest.cc » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "webkit/appcache/appcache_service.h" 5 #include "webkit/appcache/appcache_service.h"
6 6
7 #include "base/bind.h"
7 #include "base/logging.h" 8 #include "base/logging.h"
8 #include "base/message_loop.h" 9 #include "base/message_loop.h"
9 #include "base/stl_util.h" 10 #include "base/stl_util.h"
10 #include "net/base/io_buffer.h" 11 #include "net/base/io_buffer.h"
11 #include "webkit/appcache/appcache.h" 12 #include "webkit/appcache/appcache.h"
12 #include "webkit/appcache/appcache_backend_impl.h" 13 #include "webkit/appcache/appcache_backend_impl.h"
13 #include "webkit/appcache/appcache_entry.h" 14 #include "webkit/appcache/appcache_entry.h"
14 #include "webkit/appcache/appcache_histograms.h" 15 #include "webkit/appcache/appcache_histograms.h"
15 #include "webkit/appcache/appcache_policy.h" 16 #include "webkit/appcache/appcache_policy.h"
16 #include "webkit/appcache/appcache_quota_client.h" 17 #include "webkit/appcache/appcache_quota_client.h"
(...skipping 25 matching lines...) Expand all
42 } 43 }
43 44
44 virtual void Start() = 0; 45 virtual void Start() = 0;
45 virtual void Cancel(); 46 virtual void Cancel();
46 47
47 protected: 48 protected:
48 void CallCallback(int rv) { 49 void CallCallback(int rv) {
49 if (callback_) { 50 if (callback_) {
50 // Defer to guarentee async completion. 51 // Defer to guarentee async completion.
51 MessageLoop::current()->PostTask( 52 MessageLoop::current()->PostTask(
52 FROM_HERE, 53 FROM_HERE, base::Bind(&DeferredCallCallback, callback_, rv));
53 NewRunnableFunction(&DeferredCallCallback, callback_, rv));
54 } 54 }
55 callback_ = NULL; 55 callback_ = NULL;
56 } 56 }
57 57
58 static void DeferredCallCallback(net::OldCompletionCallback* callback, int rv) { 58 static void DeferredCallCallback(net::OldCompletionCallback* callback,
59 int rv) {
59 callback->Run(rv); 60 callback->Run(rv);
60 } 61 }
61 62
62 AppCacheService* service_; 63 AppCacheService* service_;
63 net::OldCompletionCallback* callback_; 64 net::OldCompletionCallback* callback_;
64 }; 65 };
65 66
66 void AppCacheService::AsyncHelper::Cancel() { 67 void AppCacheService::AsyncHelper::Cancel() {
67 if (callback_) { 68 if (callback_) {
68 callback_->Run(net::ERR_ABORTED); 69 callback_->Run(net::ERR_ABORTED);
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 backends_.insert( 490 backends_.insert(
490 BackendMap::value_type(backend_impl->process_id(), backend_impl)); 491 BackendMap::value_type(backend_impl->process_id(), backend_impl));
491 } 492 }
492 493
493 void AppCacheService::UnregisterBackend( 494 void AppCacheService::UnregisterBackend(
494 AppCacheBackendImpl* backend_impl) { 495 AppCacheBackendImpl* backend_impl) {
495 backends_.erase(backend_impl->process_id()); 496 backends_.erase(backend_impl->process_id());
496 } 497 }
497 498
498 } // namespace appcache 499 } // namespace appcache
OLDNEW
« no previous file with comments | « webkit/appcache/appcache_response.cc ('k') | webkit/appcache/appcache_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698