OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/tools/test_shell/simple_appcache_system.h" | 5 #include "webkit/tools/test_shell/simple_appcache_system.h" |
6 | 6 |
| 7 #include <string> |
| 8 #include <vector> |
| 9 |
7 #include "base/callback.h" | 10 #include "base/callback.h" |
8 #include "base/lock.h" | |
9 #include "base/task.h" | 11 #include "base/task.h" |
10 #include "base/waitable_event.h" | 12 #include "base/waitable_event.h" |
11 #include "webkit/appcache/appcache_interceptor.h" | 13 #include "webkit/appcache/appcache_interceptor.h" |
12 #include "webkit/appcache/web_application_cache_host_impl.h" | 14 #include "webkit/appcache/web_application_cache_host_impl.h" |
13 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" | 15 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" |
14 | 16 |
15 using WebKit::WebApplicationCacheHost; | 17 using WebKit::WebApplicationCacheHost; |
16 using WebKit::WebApplicationCacheHostClient; | 18 using WebKit::WebApplicationCacheHostClient; |
17 using appcache::WebApplicationCacheHostImpl; | 19 using appcache::WebApplicationCacheHostImpl; |
18 using appcache::AppCacheBackendImpl; | 20 using appcache::AppCacheBackendImpl; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 explicit SimpleFrontendProxy(SimpleAppCacheSystem* appcache_system) | 58 explicit SimpleFrontendProxy(SimpleAppCacheSystem* appcache_system) |
57 : system_(appcache_system) { | 59 : system_(appcache_system) { |
58 } | 60 } |
59 | 61 |
60 void clear_appcache_system() { system_ = NULL; } | 62 void clear_appcache_system() { system_ = NULL; } |
61 | 63 |
62 virtual void OnCacheSelected(int host_id, | 64 virtual void OnCacheSelected(int host_id, |
63 const appcache::AppCacheInfo& info) { | 65 const appcache::AppCacheInfo& info) { |
64 if (!system_) | 66 if (!system_) |
65 return; | 67 return; |
66 if (system_->is_io_thread()) | 68 if (system_->is_io_thread()) { |
67 system_->ui_message_loop()->PostTask(FROM_HERE, NewRunnableMethod( | 69 system_->ui_message_loop()->PostTask(FROM_HERE, NewRunnableMethod( |
68 this, &SimpleFrontendProxy::OnCacheSelected, | 70 this, &SimpleFrontendProxy::OnCacheSelected, |
69 host_id, info)); | 71 host_id, info)); |
70 else if (system_->is_ui_thread()) { | 72 } else if (system_->is_ui_thread()) { |
71 system_->frontend_impl_.OnCacheSelected(host_id, info); | 73 system_->frontend_impl_.OnCacheSelected(host_id, info); |
| 74 } else { |
| 75 NOTREACHED(); |
72 } | 76 } |
73 else | |
74 NOTREACHED(); | |
75 } | 77 } |
76 | 78 |
77 virtual void OnStatusChanged(const std::vector<int>& host_ids, | 79 virtual void OnStatusChanged(const std::vector<int>& host_ids, |
78 appcache::Status status) { | 80 appcache::Status status) { |
79 if (!system_) | 81 if (!system_) |
80 return; | 82 return; |
81 if (system_->is_io_thread()) | 83 if (system_->is_io_thread()) |
82 system_->ui_message_loop()->PostTask(FROM_HERE, NewRunnableMethod( | 84 system_->ui_message_loop()->PostTask(FROM_HERE, NewRunnableMethod( |
83 this, &SimpleFrontendProxy::OnStatusChanged, host_ids, status)); | 85 this, &SimpleFrontendProxy::OnStatusChanged, host_ids, status)); |
84 else if (system_->is_ui_thread()) | 86 else if (system_->is_ui_thread()) |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 } | 445 } |
444 | 446 |
445 void SimpleAppCacheSystem::GetExtraResponseBits( | 447 void SimpleAppCacheSystem::GetExtraResponseBits( |
446 URLRequest* request, int64* cache_id, GURL* manifest_url) { | 448 URLRequest* request, int64* cache_id, GURL* manifest_url) { |
447 if (is_initialized()) { | 449 if (is_initialized()) { |
448 DCHECK(is_io_thread()); | 450 DCHECK(is_io_thread()); |
449 AppCacheInterceptor::GetExtraResponseInfo( | 451 AppCacheInterceptor::GetExtraResponseInfo( |
450 request, cache_id, manifest_url); | 452 request, cache_id, manifest_url); |
451 } | 453 } |
452 } | 454 } |
OLD | NEW |