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

Unified Diff: chrome/browser/renderer_host/chrome_render_message_filter.cc

Issue 2052613003: Speculatively launch Service Workers on mouse/touch events. [3/5] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove unnecessary includes Created 4 years, 5 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/browser/renderer_host/chrome_render_message_filter.h ('k') | content/browser/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/chrome_render_message_filter.cc
diff --git a/chrome/browser/renderer_host/chrome_render_message_filter.cc b/chrome/browser/renderer_host/chrome_render_message_filter.cc
index 0afbb9429a581889755d620bc2a82f50a07646bd..b885387712980c2b631175c58dd8a1ad73e70203 100644
--- a/chrome/browser/renderer_host/chrome_render_message_filter.cc
+++ b/chrome/browser/renderer_host/chrome_render_message_filter.cc
@@ -31,6 +31,7 @@
#include "components/web_cache/browser/web_cache_manager.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_process_host.h"
+#include "content/public/browser/service_worker_context.h"
#if defined(ENABLE_EXTENSIONS)
#include "extensions/browser/guest_view/web_view/web_view_permission_helper.h"
@@ -46,17 +47,23 @@ const uint32_t kFilteredMessageClasses[] = {
ChromeMsgStart, ContentSettingsMsgStart, NetworkHintsMsgStart,
};
+void DidStartServiceWorkerForNavigationHint(bool success) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+}
+
} // namespace
-ChromeRenderMessageFilter::ChromeRenderMessageFilter(int render_process_id,
- Profile* profile)
+ChromeRenderMessageFilter::ChromeRenderMessageFilter(
+ int render_process_id,
+ Profile* profile,
+ content::ServiceWorkerContext* service_worker_context)
: BrowserMessageFilter(kFilteredMessageClasses,
arraysize(kFilteredMessageClasses)),
render_process_id_(render_process_id),
profile_(profile),
predictor_(profile_->GetNetworkPredictor()),
- cookie_settings_(CookieSettingsFactory::GetForProfile(profile)) {
-}
+ cookie_settings_(CookieSettingsFactory::GetForProfile(profile)),
+ service_worker_context_(service_worker_context) {}
ChromeRenderMessageFilter::~ChromeRenderMessageFilter() {
}
@@ -94,6 +101,7 @@ bool ChromeRenderMessageFilter::OnMessageReceived(const IPC::Message& message) {
void ChromeRenderMessageFilter::OverrideThreadForMessage(
const IPC::Message& message, BrowserThread::ID* thread) {
switch (message.type()) {
+ case NetworkHintsMsg_NavigationHint::ID:
#if defined(ENABLE_PLUGINS)
case ChromeViewHostMsg_IsCrashReportingEnabled::ID:
#endif
@@ -134,7 +142,10 @@ void ChromeRenderMessageFilter::OnNavigationHint(
blink::WebNavigationHintType type) {
// TODO(horo): We don't need to have this method in //chrome. Move it to
// //content while mojoifing network_hints. (crbug.com/610750)
- // TODO(horo): Implement this.
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ service_worker_context_->StartServiceWorkerForNavigationHint(
+ url, type, render_process_id_,
+ base::Bind(&DidStartServiceWorkerForNavigationHint));
}
void ChromeRenderMessageFilter::OnUpdatedCacheStats(
« no previous file with comments | « chrome/browser/renderer_host/chrome_render_message_filter.h ('k') | content/browser/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698