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

Unified Diff: chromecast/renderer/cast_render_process_observer.cc

Issue 917063003: Chromecast: add platform hooks to inject browser/renderer message filters. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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/renderer/cast_render_process_observer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromecast/renderer/cast_render_process_observer.cc
diff --git a/chromecast/renderer/cast_render_process_observer.cc b/chromecast/renderer/cast_render_process_observer.cc
index 60638935e0f5e48e27690f917575fb3079a95254..316fd616f74ca6b161a3b94c26d97d3139156c7c 100644
--- a/chromecast/renderer/cast_render_process_observer.cc
+++ b/chromecast/renderer/cast_render_process_observer.cc
@@ -10,7 +10,10 @@
namespace chromecast {
namespace shell {
-CastRenderProcessObserver::CastRenderProcessObserver() {
+CastRenderProcessObserver::CastRenderProcessObserver(
+ const std::vector<scoped_refptr<IPC::MessageFilter>>&
+ platform_message_filters)
+ : platform_message_filters_(platform_message_filters) {
content::RenderThread* thread = content::RenderThread::Get();
thread->AddObserver(this);
CreateCustomFilters();
@@ -22,22 +25,32 @@ CastRenderProcessObserver::~CastRenderProcessObserver() {
}
void CastRenderProcessObserver::CreateCustomFilters() {
-#if !defined(OS_ANDROID)
content::RenderThread* thread = content::RenderThread::Get();
+#if !defined(OS_ANDROID)
cma_message_filter_proxy_ =
new media::CmaMessageFilterProxy(thread->GetIOMessageLoopProxy());
thread->AddFilter(cma_message_filter_proxy_.get());
#endif // !defined(OS_ANDROID)
+ for (const auto& filter : platform_message_filters_) {
+ thread->AddFilter(filter.get());
+ }
}
void CastRenderProcessObserver::OnRenderProcessShutdown() {
-#if !defined(OS_ANDROID)
content::RenderThread* thread = content::RenderThread::Get();
+#if !defined(OS_ANDROID)
if (cma_message_filter_proxy_.get()) {
thread->RemoveFilter(cma_message_filter_proxy_.get());
cma_message_filter_proxy_ = NULL;
}
#endif // !defined(OS_ANDROID)
+ for (auto& filter : platform_message_filters_) {
+ if (filter.get()) {
+ thread->RemoveFilter(filter.get());
+ filter = nullptr;
+ }
+ }
+ platform_message_filters_.clear();
}
} // namespace shell
« no previous file with comments | « chromecast/renderer/cast_render_process_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698