| 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 "content/browser/plugin_data_remover_impl.h" | 5 #include "content/browser/plugin_data_remover_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
| 10 #include "base/version.h" | 10 #include "base/version.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 77 |
| 78 void Init(const std::string& mime_type) { | 78 void Init(const std::string& mime_type) { |
| 79 BrowserThread::PostTask( | 79 BrowserThread::PostTask( |
| 80 BrowserThread::IO, | 80 BrowserThread::IO, |
| 81 FROM_HERE, | 81 FROM_HERE, |
| 82 base::Bind(&Context::InitOnIOThread, this, mime_type)); | 82 base::Bind(&Context::InitOnIOThread, this, mime_type)); |
| 83 BrowserThread::PostDelayedTask( | 83 BrowserThread::PostDelayedTask( |
| 84 BrowserThread::IO, | 84 BrowserThread::IO, |
| 85 FROM_HERE, | 85 FROM_HERE, |
| 86 base::Bind(&Context::OnTimeout, this), | 86 base::Bind(&Context::OnTimeout, this), |
| 87 kRemovalTimeoutMs); | 87 base::TimeDelta::FromMilliseconds(kRemovalTimeoutMs)); |
| 88 } | 88 } |
| 89 | 89 |
| 90 // Initialize on the IO thread. | 90 // Initialize on the IO thread. |
| 91 void InitOnIOThread(const std::string& mime_type) { | 91 void InitOnIOThread(const std::string& mime_type) { |
| 92 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 92 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 93 remove_start_time_ = base::Time::Now(); | 93 remove_start_time_ = base::Time::Now(); |
| 94 is_removing_ = true; | 94 is_removing_ = true; |
| 95 // Balanced in OnChannelOpened or OnError. Exactly one them will eventually | 95 // Balanced in OnChannelOpened or OnError. Exactly one them will eventually |
| 96 // be called, so we need to keep this object around until then. | 96 // be called, so we need to keep this object around until then. |
| 97 AddRef(); | 97 AddRef(); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 PluginDataRemoverImpl::~PluginDataRemoverImpl() { | 231 PluginDataRemoverImpl::~PluginDataRemoverImpl() { |
| 232 } | 232 } |
| 233 | 233 |
| 234 base::WaitableEvent* PluginDataRemoverImpl::StartRemoving( | 234 base::WaitableEvent* PluginDataRemoverImpl::StartRemoving( |
| 235 base::Time begin_time) { | 235 base::Time begin_time) { |
| 236 DCHECK(!context_.get()); | 236 DCHECK(!context_.get()); |
| 237 context_ = new Context(begin_time, resource_context_); | 237 context_ = new Context(begin_time, resource_context_); |
| 238 context_->Init(mime_type_); | 238 context_->Init(mime_type_); |
| 239 return context_->event(); | 239 return context_->event(); |
| 240 } | 240 } |
| OLD | NEW |