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

Unified Diff: chromecast/browser/cast_content_browser_client.cc

Issue 1081673004: Chromecast startup race: don't add filter before HostResolver exists. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « chromecast/browser/cast_content_browser_client.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromecast/browser/cast_content_browser_client.cc
diff --git a/chromecast/browser/cast_content_browser_client.cc b/chromecast/browser/cast_content_browser_client.cc
index 3234a597e1b5f7780aa1ac1b484feabeadba41ab..35c6c20f13bc9aaf238ab1758af8031b514013a8 100644
--- a/chromecast/browser/cast_content_browser_client.cc
+++ b/chromecast/browser/cast_content_browser_client.cc
@@ -39,6 +39,7 @@
#include "content/public/common/url_constants.h"
#include "content/public/common/web_preferences.h"
#include "gin/v8_initializer.h"
+#include "media/base/bind_to_current_loop.h"
#include "net/ssl/ssl_cert_request_info.h"
#include "ui/gl/gl_switches.h"
@@ -74,22 +75,39 @@ content::BrowserMainParts* CastContentBrowserClient::CreateBrowserMainParts(
void CastContentBrowserClient::RenderProcessWillLaunch(
content::RenderProcessHost* host) {
- scoped_refptr<content::BrowserMessageFilter> network_hints_message_filter(
- new network_hints::NetworkHintsMessageFilter(
- url_request_context_factory_->host_resolver()));
- host->AddFilter(network_hints_message_filter.get());
#if !defined(OS_ANDROID)
scoped_refptr<media::CmaMessageFilterHost> cma_message_filter(
new media::CmaMessageFilterHost(host->GetID()));
host->AddFilter(cma_message_filter.get());
#endif // !defined(OS_ANDROID)
+ content::BrowserThread::PostTaskAndReplyWithResult(
+ content::BrowserThread::IO, FROM_HERE,
+ base::Bind(&URLRequestContextFactory::host_resolver,
+ base::Unretained(url_request_context_factory_.get())),
+ base::Bind(&CastContentBrowserClient::AddExtraFilter,
+ base::Unretained(this), host->GetID()));
byungchul 2015/04/17 00:22:20 It changes the order of message filter. Is it okay
gunsch 2015/04/17 01:06:27 Changing order is okay. Order was not so important
+
auto extra_filters = PlatformGetBrowserMessageFilters();
for (auto const& filter : extra_filters) {
host->AddFilter(filter.get());
}
}
+void CastContentBrowserClient::AddExtraFilter(
+ int render_process_id, net::HostResolver* host_resolver) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+
+ content::RenderProcessHost* host =
+ content::RenderProcessHost::FromID(render_process_id);
+ if (!host)
+ return;
+
+ scoped_refptr<content::BrowserMessageFilter> network_hints_message_filter(
+ new network_hints::NetworkHintsMessageFilter(host_resolver));
+ host->AddFilter(network_hints_message_filter.get());
+}
+
net::URLRequestContextGetter* CastContentBrowserClient::CreateRequestContext(
content::BrowserContext* browser_context,
content::ProtocolHandlerMap* protocol_handlers,
« no previous file with comments | « chromecast/browser/cast_content_browser_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698