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

Unified Diff: chrome/browser/tab_contents/origins_seen_service.cc

Issue 1844753002: Histogram the scheme of an origin on the 1st navigation to it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to comments. Created 4 years, 8 months 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: chrome/browser/tab_contents/origins_seen_service.cc
diff --git a/chrome/browser/tab_contents/origins_seen_service.cc b/chrome/browser/tab_contents/origins_seen_service.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7d3736650663bb83bcccc2bbc07bcaa9ddfef923
--- /dev/null
+++ b/chrome/browser/tab_contents/origins_seen_service.cc
@@ -0,0 +1,20 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/tab_contents/origins_seen_service.h"
+
+namespace {
+const size_t kDefaultMRUCacheSize = 1000;
+} // namespace
+
+OriginsSeenService::OriginsSeenService()
+ : origins_seen_(kDefaultMRUCacheSize) {}
+
+OriginsSeenService::~OriginsSeenService() {}
+
+bool OriginsSeenService::Insert(const url::Origin& origin) {
+ bool seen = origins_seen_.Peek(origin) != origins_seen_.end();
+ origins_seen_.Put(origin, true);
+ return seen;
+}
« no previous file with comments | « chrome/browser/tab_contents/origins_seen_service.h ('k') | chrome/browser/tab_contents/origins_seen_service_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698