| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/browsing_data/content/conditional_cache_counting_helper.h" | 5 #include "components/browsing_data/content/conditional_cache_counting_helper.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
| 9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 } | 67 } |
| 68 | 68 |
| 69 bool ConditionalCacheCountingHelper::IsFinished() { | 69 bool ConditionalCacheCountingHelper::IsFinished() { |
| 70 return is_finished_; | 70 return is_finished_; |
| 71 } | 71 } |
| 72 | 72 |
| 73 void ConditionalCacheCountingHelper::Finished() { | 73 void ConditionalCacheCountingHelper::Finished() { |
| 74 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 74 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 75 DCHECK(!is_finished_); | 75 DCHECK(!is_finished_); |
| 76 is_finished_ = true; | 76 is_finished_ = true; |
| 77 result_callback_.Run(calculation_result_, is_upper_limit_); | 77 result_callback_.Run(is_upper_limit_, calculation_result_); |
| 78 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); | 78 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void ConditionalCacheCountingHelper::CountHttpCacheOnIOThread() { | 81 void ConditionalCacheCountingHelper::CountHttpCacheOnIOThread() { |
| 82 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 82 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 83 next_cache_state_ = CacheState::NONE; | 83 next_cache_state_ = CacheState::NONE; |
| 84 DCHECK_EQ(CacheState::NONE, next_cache_state_); | 84 DCHECK_EQ(CacheState::NONE, next_cache_state_); |
| 85 DCHECK(main_context_getter_.get()); | 85 DCHECK(main_context_getter_.get()); |
| 86 DCHECK(media_context_getter_.get()); | 86 DCHECK(media_context_getter_.get()); |
| 87 | 87 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 } | 169 } |
| 170 case CacheState::NONE: { | 170 case CacheState::NONE: { |
| 171 NOTREACHED() << "bad state"; | 171 NOTREACHED() << "bad state"; |
| 172 return; | 172 return; |
| 173 } | 173 } |
| 174 } | 174 } |
| 175 } | 175 } |
| 176 } | 176 } |
| 177 | 177 |
| 178 } // namespace browsing_data | 178 } // namespace browsing_data |
| OLD | NEW |