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 "chrome/browser/budget_service/budget_manager.h" | 5 #include "chrome/browser/budget_service/budget_manager.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
11 #include "base/metrics/histogram_macros.h" | 11 #include "base/metrics/histogram_macros.h" |
| 12 #include "base/threading/sequenced_worker_pool.h" |
12 #include "base/threading/thread_task_runner_handle.h" | 13 #include "base/threading/thread_task_runner_handle.h" |
13 #include "base/time/time.h" | 14 #include "base/time/time.h" |
14 #include "chrome/browser/engagement/site_engagement_score.h" | 15 #include "chrome/browser/engagement/site_engagement_score.h" |
15 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
16 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
17 #include "content/public/common/origin_util.h" | 18 #include "content/public/common/origin_util.h" |
18 #include "third_party/WebKit/public/platform/modules/budget_service/budget_servi
ce.mojom.h" | 19 #include "third_party/WebKit/public/platform/modules/budget_service/budget_servi
ce.mojom.h" |
19 #include "url/origin.h" | 20 #include "url/origin.h" |
20 | 21 |
21 using content::BrowserThread; | 22 using content::BrowserThread; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 blink::mojom::BudgetServiceErrorType error, | 135 blink::mojom::BudgetServiceErrorType error, |
135 bool success) { | 136 bool success) { |
136 // If the call succeeded, write the new reservation into the map. | 137 // If the call succeeded, write the new reservation into the map. |
137 if (success && error == blink::mojom::BudgetServiceErrorType::NONE) | 138 if (success && error == blink::mojom::BudgetServiceErrorType::NONE) |
138 reservation_map_[origin]++; | 139 reservation_map_[origin]++; |
139 | 140 |
140 UMA_HISTOGRAM_BOOLEAN("Blink.BudgetAPI.Reserve", success); | 141 UMA_HISTOGRAM_BOOLEAN("Blink.BudgetAPI.Reserve", success); |
141 | 142 |
142 callback.Run(error, success); | 143 callback.Run(error, success); |
143 } | 144 } |
OLD | NEW |