OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/appcache/appcache_service_impl.h" | 5 #include "content/browser/appcache/appcache_service_impl.h" |
6 | 6 |
7 #include <functional> | 7 #include <functional> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/location.h" |
11 #include "base/logging.h" | 12 #include "base/logging.h" |
12 #include "base/message_loop/message_loop.h" | |
13 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
| 15 #include "base/thread_task_runner_handle.h" |
15 #include "content/browser/appcache/appcache.h" | 16 #include "content/browser/appcache/appcache.h" |
16 #include "content/browser/appcache/appcache_backend_impl.h" | 17 #include "content/browser/appcache/appcache_backend_impl.h" |
17 #include "content/browser/appcache/appcache_entry.h" | 18 #include "content/browser/appcache/appcache_entry.h" |
18 #include "content/browser/appcache/appcache_executable_handler.h" | 19 #include "content/browser/appcache/appcache_executable_handler.h" |
19 #include "content/browser/appcache/appcache_histograms.h" | 20 #include "content/browser/appcache/appcache_histograms.h" |
20 #include "content/browser/appcache/appcache_policy.h" | 21 #include "content/browser/appcache/appcache_policy.h" |
21 #include "content/browser/appcache/appcache_quota_client.h" | 22 #include "content/browser/appcache/appcache_quota_client.h" |
22 #include "content/browser/appcache/appcache_response.h" | 23 #include "content/browser/appcache/appcache_response.h" |
23 #include "content/browser/appcache/appcache_service_impl.h" | 24 #include "content/browser/appcache/appcache_service_impl.h" |
24 #include "content/browser/appcache/appcache_storage_impl.h" | 25 #include "content/browser/appcache/appcache_storage_impl.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 service_->pending_helpers_.erase(this); | 57 service_->pending_helpers_.erase(this); |
57 } | 58 } |
58 | 59 |
59 virtual void Start() = 0; | 60 virtual void Start() = 0; |
60 virtual void Cancel(); | 61 virtual void Cancel(); |
61 | 62 |
62 protected: | 63 protected: |
63 void CallCallback(int rv) { | 64 void CallCallback(int rv) { |
64 if (!callback_.is_null()) { | 65 if (!callback_.is_null()) { |
65 // Defer to guarantee async completion. | 66 // Defer to guarantee async completion. |
66 base::MessageLoop::current()->PostTask( | 67 base::ThreadTaskRunnerHandle::Get()->PostTask( |
67 FROM_HERE, base::Bind(&DeferredCallback, callback_, rv)); | 68 FROM_HERE, base::Bind(&DeferredCallback, callback_, rv)); |
68 } | 69 } |
69 callback_.Reset(); | 70 callback_.Reset(); |
70 } | 71 } |
71 | 72 |
72 AppCacheServiceImpl* service_; | 73 AppCacheServiceImpl* service_; |
73 net::CompletionCallback callback_; | 74 net::CompletionCallback callback_; |
74 }; | 75 }; |
75 | 76 |
76 void AppCacheServiceImpl::AsyncHelper::Cancel() { | 77 void AppCacheServiceImpl::AsyncHelper::Cancel() { |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 backends_.insert( | 572 backends_.insert( |
572 BackendMap::value_type(backend_impl->process_id(), backend_impl)); | 573 BackendMap::value_type(backend_impl->process_id(), backend_impl)); |
573 } | 574 } |
574 | 575 |
575 void AppCacheServiceImpl::UnregisterBackend( | 576 void AppCacheServiceImpl::UnregisterBackend( |
576 AppCacheBackendImpl* backend_impl) { | 577 AppCacheBackendImpl* backend_impl) { |
577 backends_.erase(backend_impl->process_id()); | 578 backends_.erase(backend_impl->process_id()); |
578 } | 579 } |
579 | 580 |
580 } // namespace content | 581 } // namespace content |
OLD | NEW |