| 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 OnLogMessage(int host_id, |
| 119 appcache::LogLevel log_level, |
| 120 const std::string& message) { |
| 121 if (!system_) |
| 122 return; |
| 123 if (system_->is_io_thread()) |
| 124 system_->ui_message_loop()->PostTask(FROM_HERE, NewRunnableMethod( |
| 125 this, &SimpleFrontendProxy::OnLogMessage, |
| 126 host_id, log_level, message)); |
| 127 else if (system_->is_ui_thread()) |
| 128 system_->frontend_impl_.OnLogMessage( |
| 129 host_id, log_level, message); |
| 130 else |
| 131 NOTREACHED(); |
| 132 } |
| 133 |
| 118 virtual void OnContentBlocked(int host_id) {} | 134 virtual void OnContentBlocked(int host_id) {} |
| 119 | 135 |
| 120 private: | 136 private: |
| 121 friend class base::RefCountedThreadSafe<SimpleFrontendProxy>; | 137 friend class base::RefCountedThreadSafe<SimpleFrontendProxy>; |
| 122 | 138 |
| 123 ~SimpleFrontendProxy() {} | 139 ~SimpleFrontendProxy() {} |
| 124 | 140 |
| 125 SimpleAppCacheSystem* system_; | 141 SimpleAppCacheSystem* system_; |
| 126 }; | 142 }; |
| 127 | 143 |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 | 414 |
| 399 delete backend_impl_; | 415 delete backend_impl_; |
| 400 delete service_; | 416 delete service_; |
| 401 backend_impl_ = NULL; | 417 backend_impl_ = NULL; |
| 402 service_ = NULL; | 418 service_ = NULL; |
| 403 io_message_loop_ = NULL; | 419 io_message_loop_ = NULL; |
| 404 | 420 |
| 405 // Just in case the main thread is waiting on it. | 421 // Just in case the main thread is waiting on it. |
| 406 backend_proxy_->SignalEvent(); | 422 backend_proxy_->SignalEvent(); |
| 407 } | 423 } |
| OLD | NEW |