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

Unified Diff: Source/Platform/chromium/public/WebPrescientNetworking.h

Issue 14746002: Add WebPrescientNetworking to trigger preconnect from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: use WebPrescientNetworking instead of WebPrerenderingSupport Created 7 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
Index: Source/Platform/chromium/public/WebPrescientNetworking.h
diff --git a/Source/Platform/chromium/public/WebPrerenderingSupport.h b/Source/Platform/chromium/public/WebPrescientNetworking.h
similarity index 58%
copy from Source/Platform/chromium/public/WebPrerenderingSupport.h
copy to Source/Platform/chromium/public/WebPrescientNetworking.h
index a2672911fa50a83358d2bf4b0996fd5493806ba2..7fd1277b1fc8b8a8bada8dcc60cc99e18a0520aa 100644
--- a/Source/Platform/chromium/public/WebPrerenderingSupport.h
+++ b/Source/Platform/chromium/public/WebPrescientNetworking.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -28,40 +28,44 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebPrerenderingSupport_h
-#define WebPrerenderingSupport_h
+#ifndef WebPrescientNetworking_h
+#define WebPrescientNetworking_h
#include "WebCommon.h"
namespace WebKit {
-class WebPrerender;
+class WebURL;
-class WebPrerenderingSupport {
+// FIXME (kouhei): Passing preconnect motivation to net is layering vioration.
abarth-chromium 2013/05/14 06:18:56 " (kouhei)" <-- you should delete this part. We d
kouhei (in TOK) 2013/05/14 06:34:07 Done.
+// However, this is done temporarily to perform a Finch field trial to enable
+// preconnect in different triggers one at a time. This enum can be safely
+// removed after the field trial is done.
+enum WebPreconnectMotivation {
+ WebPreconnectMotivationLinkMouseDown,
+ WebPreconnectMotivationLinkMouseOver,
+ WebPreconnectMotivationLinkTapUnconfirmed,
+ WebPreconnectMotivationLinkTapDown,
+};
+
+class WebPrescientNetworking {
public:
- WEBKIT_EXPORT static void initialize(WebPrerenderingSupport*);
+ WEBKIT_EXPORT static void initialize(WebPrescientNetworking*);
WEBKIT_EXPORT static void shutdown();
- WEBKIT_EXPORT static WebPrerenderingSupport* current();
-
- // A prerender link element is added when it is inserted into a document.
- virtual void add(const WebPrerender&) = 0;
-
- // A prerender is canceled when it is removed from a document.
- virtual void cancel(const WebPrerender&) = 0;
+ WEBKIT_EXPORT static WebPrescientNetworking* current();
abarth-chromium 2013/05/14 06:18:56 None of these methods are needed. They should all
kouhei (in TOK) 2013/05/14 06:34:07 Done.
- // A prerender is abandoned when it's navigated away from or suspended in the page cache. This
- // is a weaker signal than cancel(), since the launcher hasn't indicated that the prerender isn't
- // wanted, and we may end up using it after, for instance, a short redirect chain.
- virtual void abandon(const WebPrerender&) = 0;
+ // When a page navigation is speculated, preconnect is triggered to hide
+ // session initialization latency to the server providing the page resource.
+ virtual void preconnect(const WebURL&, WebPreconnectMotivation) { }
protected:
- WebPrerenderingSupport() { }
- virtual ~WebPrerenderingSupport() { }
+ WebPrescientNetworking() { }
abarth-chromium 2013/05/14 06:18:56 No constructor is needed.
kouhei (in TOK) 2013/05/14 06:34:07 Done.
+ virtual ~WebPrescientNetworking() { }
private:
- static WebPrerenderingSupport* s_platform;
+ static WebPrescientNetworking* s_platform;
abarth-chromium 2013/05/14 06:18:56 Please remove the static state from this class. I
kouhei (in TOK) 2013/05/14 06:34:07 Done.
};
} // namespace WebKit
-#endif // WebPrerenderingSupport_h
+#endif // WebPrescientNetworking_h

Powered by Google App Engine
This is Rietveld 408576698