| 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 "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/lock.h" | 8 #include "base/lock.h" |
| 9 #include "base/task.h" | 9 #include "base/task.h" |
| 10 #include "base/waitable_event.h" | 10 #include "base/waitable_event.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 system_->ui_message_loop()->PostTask(FROM_HERE, NewRunnableMethod( | 108 system_->ui_message_loop()->PostTask(FROM_HERE, NewRunnableMethod( |
| 109 this, &SimpleFrontendProxy::OnProgressEventRaised, | 109 this, &SimpleFrontendProxy::OnProgressEventRaised, |
| 110 host_ids, url, num_total, num_complete)); | 110 host_ids, url, num_total, num_complete)); |
| 111 else if (system_->is_ui_thread()) | 111 else if (system_->is_ui_thread()) |
| 112 system_->frontend_impl_.OnProgressEventRaised( | 112 system_->frontend_impl_.OnProgressEventRaised( |
| 113 host_ids, url, num_total, num_complete); | 113 host_ids, url, num_total, num_complete); |
| 114 else | 114 else |
| 115 NOTREACHED(); | 115 NOTREACHED(); |
| 116 } | 116 } |
| 117 | 117 |
| 118 virtual void OnErrorEventRaised(const std::vector<int>& host_ids, |
| 119 const std::string& message) { |
| 120 if (!system_) |
| 121 return; |
| 122 if (system_->is_io_thread()) |
| 123 system_->ui_message_loop()->PostTask(FROM_HERE, NewRunnableMethod( |
| 124 this, &SimpleFrontendProxy::OnErrorEventRaised, |
| 125 host_ids, message)); |
| 126 else if (system_->is_ui_thread()) |
| 127 system_->frontend_impl_.OnErrorEventRaised( |
| 128 host_ids, message); |
| 129 else |
| 130 NOTREACHED(); |
| 131 } |
| 132 |
| 118 virtual void OnLogMessage(int host_id, | 133 virtual void OnLogMessage(int host_id, |
| 119 appcache::LogLevel log_level, | 134 appcache::LogLevel log_level, |
| 120 const std::string& message) { | 135 const std::string& message) { |
| 121 if (!system_) | 136 if (!system_) |
| 122 return; | 137 return; |
| 123 if (system_->is_io_thread()) | 138 if (system_->is_io_thread()) |
| 124 system_->ui_message_loop()->PostTask(FROM_HERE, NewRunnableMethod( | 139 system_->ui_message_loop()->PostTask(FROM_HERE, NewRunnableMethod( |
| 125 this, &SimpleFrontendProxy::OnLogMessage, | 140 this, &SimpleFrontendProxy::OnLogMessage, |
| 126 host_id, log_level, message)); | 141 host_id, log_level, message)); |
| 127 else if (system_->is_ui_thread()) | 142 else if (system_->is_ui_thread()) |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 | 429 |
| 415 delete backend_impl_; | 430 delete backend_impl_; |
| 416 delete service_; | 431 delete service_; |
| 417 backend_impl_ = NULL; | 432 backend_impl_ = NULL; |
| 418 service_ = NULL; | 433 service_ = NULL; |
| 419 io_message_loop_ = NULL; | 434 io_message_loop_ = NULL; |
| 420 | 435 |
| 421 // Just in case the main thread is waiting on it. | 436 // Just in case the main thread is waiting on it. |
| 422 backend_proxy_->SignalEvent(); | 437 backend_proxy_->SignalEvent(); |
| 423 } | 438 } |
| OLD | NEW |