OLD | NEW |
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/tools/test_shell/simple_appcache_system.h" | 5 #include "webkit/tools/test_shell/simple_appcache_system.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 } else { | 260 } else { |
261 NOTREACHED(); | 261 NOTREACHED(); |
262 } | 262 } |
263 } | 263 } |
264 | 264 |
265 virtual appcache::Status GetStatus(int host_id) { | 265 virtual appcache::Status GetStatus(int host_id) { |
266 if (system_->is_ui_thread()) { | 266 if (system_->is_ui_thread()) { |
267 status_result_ = appcache::UNCACHED; | 267 status_result_ = appcache::UNCACHED; |
268 event_.Reset(); | 268 event_.Reset(); |
269 system_->io_message_loop()->PostTask( | 269 system_->io_message_loop()->PostTask( |
270 FROM_HERE, base::IgnoreReturn<appcache::Status>( | 270 FROM_HERE, |
271 base::Bind(&SimpleBackendProxy::GetStatus, this, host_id))); | 271 base::Bind(base::IgnoreResult(&SimpleBackendProxy::GetStatus), |
| 272 this, host_id)); |
272 event_.Wait(); | 273 event_.Wait(); |
273 } else if (system_->is_io_thread()) { | 274 } else if (system_->is_io_thread()) { |
274 system_->backend_impl_->GetStatusWithCallback( | 275 system_->backend_impl_->GetStatusWithCallback( |
275 host_id, get_status_callback_, NULL); | 276 host_id, get_status_callback_, NULL); |
276 } else { | 277 } else { |
277 NOTREACHED(); | 278 NOTREACHED(); |
278 } | 279 } |
279 return status_result_; | 280 return status_result_; |
280 } | 281 } |
281 | 282 |
282 virtual bool StartUpdate(int host_id) { | 283 virtual bool StartUpdate(int host_id) { |
283 if (system_->is_ui_thread()) { | 284 if (system_->is_ui_thread()) { |
284 bool_result_ = false; | 285 bool_result_ = false; |
285 event_.Reset(); | 286 event_.Reset(); |
286 system_->io_message_loop()->PostTask( | 287 system_->io_message_loop()->PostTask( |
287 FROM_HERE, base::IgnoreReturn<bool>( | 288 FROM_HERE, |
288 base::Bind(&SimpleBackendProxy::StartUpdate, this, host_id))); | 289 base::Bind(base::IgnoreResult(&SimpleBackendProxy::StartUpdate), |
| 290 this, host_id)); |
289 event_.Wait(); | 291 event_.Wait(); |
290 } else if (system_->is_io_thread()) { | 292 } else if (system_->is_io_thread()) { |
291 system_->backend_impl_->StartUpdateWithCallback( | 293 system_->backend_impl_->StartUpdateWithCallback( |
292 host_id, start_update_callback_, NULL); | 294 host_id, start_update_callback_, NULL); |
293 } else { | 295 } else { |
294 NOTREACHED(); | 296 NOTREACHED(); |
295 } | 297 } |
296 return bool_result_; | 298 return bool_result_; |
297 } | 299 } |
298 | 300 |
299 virtual bool SwapCache(int host_id) { | 301 virtual bool SwapCache(int host_id) { |
300 if (system_->is_ui_thread()) { | 302 if (system_->is_ui_thread()) { |
301 bool_result_ = false; | 303 bool_result_ = false; |
302 event_.Reset(); | 304 event_.Reset(); |
303 system_->io_message_loop()->PostTask( | 305 system_->io_message_loop()->PostTask( |
304 FROM_HERE, base::IgnoreReturn<bool>( | 306 FROM_HERE, |
305 base::Bind(&SimpleBackendProxy::SwapCache, this, host_id))); | 307 base::Bind(base::IgnoreResult(&SimpleBackendProxy::SwapCache), |
| 308 this, host_id)); |
306 event_.Wait(); | 309 event_.Wait(); |
307 } else if (system_->is_io_thread()) { | 310 } else if (system_->is_io_thread()) { |
308 system_->backend_impl_->SwapCacheWithCallback( | 311 system_->backend_impl_->SwapCacheWithCallback( |
309 host_id, swap_cache_callback_, NULL); | 312 host_id, swap_cache_callback_, NULL); |
310 } else { | 313 } else { |
311 NOTREACHED(); | 314 NOTREACHED(); |
312 } | 315 } |
313 return bool_result_; | 316 return bool_result_; |
314 } | 317 } |
315 | 318 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 } | 455 } |
453 | 456 |
454 void SimpleAppCacheSystem::GetExtraResponseBits( | 457 void SimpleAppCacheSystem::GetExtraResponseBits( |
455 net::URLRequest* request, int64* cache_id, GURL* manifest_url) { | 458 net::URLRequest* request, int64* cache_id, GURL* manifest_url) { |
456 if (is_initialized()) { | 459 if (is_initialized()) { |
457 DCHECK(is_io_thread()); | 460 DCHECK(is_io_thread()); |
458 AppCacheInterceptor::GetExtraResponseInfo( | 461 AppCacheInterceptor::GetExtraResponseInfo( |
459 request, cache_id, manifest_url); | 462 request, cache_id, manifest_url); |
460 } | 463 } |
461 } | 464 } |
OLD | NEW |