Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Unified Diff: components/offline_pages/core/offline_page_model_impl.cc

Issue 2489443002: Move all components/offline_pages/ files into component/offline_pages/core (Closed)
Patch Set: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/offline_pages/core/offline_page_model_impl.cc
diff --git a/components/offline_pages/offline_page_model_impl.cc b/components/offline_pages/core/offline_page_model_impl.cc
similarity index 96%
rename from components/offline_pages/offline_page_model_impl.cc
rename to components/offline_pages/core/offline_page_model_impl.cc
index b026304f41c633487a3eaaedd5c426585d38541a..32f8213107a614134f35d528905eba5225ce9de0 100644
--- a/components/offline_pages/offline_page_model_impl.cc
+++ b/components/offline_pages/core/offline_page_model_impl.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "components/offline_pages/offline_page_model_impl.h"
+#include "components/offline_pages/core/offline_page_model_impl.h"
#include <algorithm>
#include <limits>
@@ -19,12 +19,12 @@
#include "base/threading/thread_task_runner_handle.h"
#include "base/time/clock.h"
#include "base/time/time.h"
-#include "components/offline_pages/archive_manager.h"
-#include "components/offline_pages/client_namespace_constants.h"
-#include "components/offline_pages/client_policy_controller.h"
-#include "components/offline_pages/offline_page_item.h"
-#include "components/offline_pages/offline_page_model_query.h"
-#include "components/offline_pages/offline_page_storage_manager.h"
+#include "components/offline_pages/core/archive_manager.h"
+#include "components/offline_pages/core/client_namespace_constants.h"
+#include "components/offline_pages/core/client_policy_controller.h"
+#include "components/offline_pages/core/offline_page_item.h"
+#include "components/offline_pages/core/offline_page_model_query.h"
+#include "components/offline_pages/core/offline_page_storage_manager.h"
#include "url/gurl.h"
using ArchiverResult = offline_pages::OfflinePageArchiver::ArchiverResult;
@@ -128,13 +128,12 @@ void ReportStorageHistogramsAfterDelete(
}
void ReportSavePageResultHistogramAfterSave(const ClientId& client_id,
- SavePageResult result) {
+ SavePageResult result) {
// The histogram below is an expansion of the UMA_HISTOGRAM_ENUMERATION
// macro adapted to allow for a dynamically suffixed histogram name.
// Note: The factory creates and owns the histogram.
base::HistogramBase* histogram = base::LinearHistogram::FactoryGet(
- AddHistogramSuffix(client_id, "OfflinePages.SavePageResult"),
- 1,
+ AddHistogramSuffix(client_id, "OfflinePages.SavePageResult"), 1,
static_cast<int>(SavePageResult::RESULT_COUNT),
static_cast<int>(SavePageResult::RESULT_COUNT) + 1,
base::HistogramBase::kUmaTargetedHistogramFlag);
@@ -202,8 +201,8 @@ void ReportPageHistogramAfterSave(
// Note: The factory creates and owns the histogram.
// Reported as Kb between 1Kb and 10Mb.
histogram = base::Histogram::FactoryGet(
- AddHistogramSuffix(offline_page.client_id, "OfflinePages.PageSize"),
- 1, 10000, 50, base::HistogramBase::kUmaTargetedHistogramFlag);
+ AddHistogramSuffix(offline_page.client_id, "OfflinePages.PageSize"), 1,
+ 10000, 50, base::HistogramBase::kUmaTargetedHistogramFlag);
histogram->Add(offline_page.file_size / 1024);
if (policy_controller_->IsSupportedByDownload(
@@ -252,39 +251,39 @@ void ReportPageHistogramsAfterDelete(
// macro adapted to allow for a dynamically suffixed histogram name.
// Note: The factory creates and owns the histogram.
base::HistogramBase* histogram = base::Histogram::FactoryGet(
- AddHistogramSuffix(client_id, "OfflinePages.PageLifetime"),
- 1, max_minutes, 100, base::HistogramBase::kUmaTargetedHistogramFlag);
+ AddHistogramSuffix(client_id, "OfflinePages.PageLifetime"), 1,
+ max_minutes, 100, base::HistogramBase::kUmaTargetedHistogramFlag);
histogram->Add((delete_time - page.creation_time).InMinutes());
histogram = base::Histogram::FactoryGet(
- AddHistogramSuffix(
- client_id, "OfflinePages.DeletePage.TimeSinceLastOpen"),
+ AddHistogramSuffix(client_id,
+ "OfflinePages.DeletePage.TimeSinceLastOpen"),
1, max_minutes, 100, base::HistogramBase::kUmaTargetedHistogramFlag);
histogram->Add((delete_time - page.last_access_time).InMinutes());
histogram = base::Histogram::FactoryGet(
- AddHistogramSuffix(
- client_id, "OfflinePages.DeletePage.LastOpenToCreated"),
+ AddHistogramSuffix(client_id,
+ "OfflinePages.DeletePage.LastOpenToCreated"),
1, max_minutes, 100, base::HistogramBase::kUmaTargetedHistogramFlag);
histogram->Add((page.last_access_time - page.creation_time).InMinutes());
// Reported as Kb between 1Kb and 10Mb.
histogram = base::Histogram::FactoryGet(
- AddHistogramSuffix(client_id, "OfflinePages.DeletePage.PageSize"),
- 1, 10000, 50, base::HistogramBase::kUmaTargetedHistogramFlag);
+ AddHistogramSuffix(client_id, "OfflinePages.DeletePage.PageSize"), 1,
+ 10000, 50, base::HistogramBase::kUmaTargetedHistogramFlag);
histogram->Add(page.file_size / 1024);
histogram = base::Histogram::FactoryGet(
- AddHistogramSuffix(client_id, "OfflinePages.DeletePage.AccessCount"),
- 1, 1000000, 50, base::HistogramBase::kUmaTargetedHistogramFlag);
+ AddHistogramSuffix(client_id, "OfflinePages.DeletePage.AccessCount"), 1,
+ 1000000, 50, base::HistogramBase::kUmaTargetedHistogramFlag);
histogram->Add(page.access_count);
}
if (deleted_pages.size() > 1) {
UMA_HISTOGRAM_COUNTS("OfflinePages.BatchDelete.Count",
static_cast<int32_t>(deleted_pages.size()));
- UMA_HISTOGRAM_MEMORY_KB(
- "OfflinePages.BatchDelete.TotalPageSize", total_size / 1024);
+ UMA_HISTOGRAM_MEMORY_KB("OfflinePages.BatchDelete.TotalPageSize",
+ total_size / 1024);
}
}
@@ -294,13 +293,12 @@ void ReportPageHistogramsAfterAccess(const OfflinePageItem& offline_page_item,
// macro adapted to allow for a dynamically suffixed histogram name.
// Note: The factory creates and owns the histogram.
base::HistogramBase* histogram = base::Histogram::FactoryGet(
- AddHistogramSuffix(
- offline_page_item.client_id,
- offline_page_item.access_count == 0 ?
- "OfflinePages.FirstOpenSinceCreated" :
- "OfflinePages.OpenSinceLastOpen"),
- 1, kMaxOpenedPageHistogramBucket.InMinutes(), 50,
- base::HistogramBase::kUmaTargetedHistogramFlag);
+ AddHistogramSuffix(offline_page_item.client_id,
+ offline_page_item.access_count == 0
+ ? "OfflinePages.FirstOpenSinceCreated"
+ : "OfflinePages.OpenSinceLastOpen"),
+ 1, kMaxOpenedPageHistogramBucket.InMinutes(), 50,
+ base::HistogramBase::kUmaTargetedHistogramFlag);
histogram->Add(
(access_time - offline_page_item.last_access_time).InMinutes());
}
@@ -392,7 +390,7 @@ void OfflinePageModelImpl::MarkPageAccessedWhenLoadDone(int64_t offline_id) {
offline_page_item.last_access_time = GetCurrentTime();
offline_page_item.access_count++;
- std::vector<OfflinePageItem> items = { offline_page_item };
+ std::vector<OfflinePageItem> items = {offline_page_item};
store_->UpdateOfflinePages(
items, base::Bind(&OfflinePageModelImpl::OnMarkPageAccesseDone,
weak_ptr_factory_.GetWeakPtr(), offline_page_item));

Powered by Google App Engine
This is Rietveld 408576698