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

Unified Diff: chrome/common/page_load_metrics/page_load_metrics_util.h

Issue 2901383002: Buffer cross frame paint timing updates. (Closed)
Patch Set: address comment Created 3 years, 7 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
« no previous file with comments | « chrome/common/BUILD.gn ('k') | chrome/common/page_load_metrics/page_load_metrics_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/page_load_metrics/page_load_metrics_util.h
diff --git a/chrome/common/page_load_metrics/page_load_metrics_util.h b/chrome/common/page_load_metrics/page_load_metrics_util.h
new file mode 100644
index 0000000000000000000000000000000000000000..03e4b830171352ebcb923459868f9e7b01cfec33
--- /dev/null
+++ b/chrome/common/page_load_metrics/page_load_metrics_util.h
@@ -0,0 +1,40 @@
+// Copyright 2017 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.
+
+#ifndef CHROME_COMMON_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_UTIL_H_
+#define CHROME_COMMON_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_UTIL_H_
+
+#include <string>
+
+#include "base/optional.h"
+#include "base/time/time.h"
+#include "url/gurl.h"
+
+namespace page_load_metrics {
+
+// Returns the minimum value of the optional TimeDeltas, if both values are
+// set. Otherwise, if one value is set, returns that value. Otherwise, returns
+// an unset value.
+base::Optional<base::TimeDelta> OptionalMin(
+ const base::Optional<base::TimeDelta>& a,
+ const base::Optional<base::TimeDelta>& b);
+
+// Whether the given url has a google hostname.
+bool IsGoogleHostname(const GURL& url);
+
+// If the given hostname is a google hostname, returns the portion of the
+// hostname before the google hostname. Otherwise, returns an unset optional
+// value.
+//
+// For example:
+// https://example.com/foo => returns an unset optional value
+// https://google.com/foo => returns ''
+// https://www.google.com/foo => returns 'www'
+// https://news.google.com/foo => returns 'news'
+// https://a.b.c.google.com/foo => returns 'a.b.c'
+base::Optional<std::string> GetGoogleHostnamePrefix(const GURL& url);
+
+} // namespace page_load_metrics
+
+#endif // CHROME_COMMON_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_UTIL_H_
« no previous file with comments | « chrome/common/BUILD.gn ('k') | chrome/common/page_load_metrics/page_load_metrics_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698