| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/content_verify_job.h" | 5 #include "extensions/browser/content_verify_job.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 UMA_HISTOGRAM_COUNTS("ExtensionContentVerifyJob.TimeSpentUS", | 59 UMA_HISTOGRAM_COUNTS("ExtensionContentVerifyJob.TimeSpentUS", |
| 60 time_spent_.InMicroseconds()); | 60 time_spent_.InMicroseconds()); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void ContentVerifyJob::Start() { | 63 void ContentVerifyJob::Start() { |
| 64 DCHECK(thread_checker_.CalledOnValidThread()); | 64 DCHECK(thread_checker_.CalledOnValidThread()); |
| 65 if (g_test_observer) | 65 if (g_test_observer) |
| 66 g_test_observer->JobStarted(hash_reader_->extension_id(), | 66 g_test_observer->JobStarted(hash_reader_->extension_id(), |
| 67 hash_reader_->relative_path()); | 67 hash_reader_->relative_path()); |
| 68 base::PostTaskWithTraitsAndReplyWithResult( | 68 base::PostTaskWithTraitsAndReplyWithResult( |
| 69 FROM_HERE, | 69 FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE}, |
| 70 base::TaskTraits().MayBlock().WithPriority( | |
| 71 base::TaskPriority::USER_VISIBLE), | |
| 72 base::Bind(&ContentHashReader::Init, hash_reader_), | 70 base::Bind(&ContentHashReader::Init, hash_reader_), |
| 73 base::Bind(&ContentVerifyJob::OnHashesReady, this)); | 71 base::Bind(&ContentVerifyJob::OnHashesReady, this)); |
| 74 } | 72 } |
| 75 | 73 |
| 76 void ContentVerifyJob::BytesRead(int count, const char* data) { | 74 void ContentVerifyJob::BytesRead(int count, const char* data) { |
| 77 ScopedElapsedTimer timer(&time_spent_); | 75 ScopedElapsedTimer timer(&time_spent_); |
| 78 DCHECK(thread_checker_.CalledOnValidThread()); | 76 DCHECK(thread_checker_.CalledOnValidThread()); |
| 79 if (failed_) | 77 if (failed_) |
| 80 return; | 78 return; |
| 81 if (g_test_delegate) { | 79 if (g_test_delegate) { |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 << " reason:" << reason; | 227 << " reason:" << reason; |
| 230 std::move(failure_callback_).Run(reason); | 228 std::move(failure_callback_).Run(reason); |
| 231 } | 229 } |
| 232 if (g_test_observer) { | 230 if (g_test_observer) { |
| 233 g_test_observer->JobFinished(hash_reader_->extension_id(), | 231 g_test_observer->JobFinished(hash_reader_->extension_id(), |
| 234 hash_reader_->relative_path(), reason); | 232 hash_reader_->relative_path(), reason); |
| 235 } | 233 } |
| 236 } | 234 } |
| 237 | 235 |
| 238 } // namespace extensions | 236 } // namespace extensions |
| OLD | NEW |